\n );\n});\n"],"names":[],"version":3,"file":"index.es.js.map"}
\ No newline at end of file
diff --git a/src/frontend/packages/activitypub-components/src/constants.js b/src/frontend/packages/activitypub-components/src/constants.js
index 84680d410..da0e73512 100644
--- a/src/frontend/packages/activitypub-components/src/constants.js
+++ b/src/frontend/packages/activitypub-components/src/constants.js
@@ -23,7 +23,7 @@ export const ACTIVITY_TYPES = {
REMOVE: 'Remove',
TENTATIVE_REJECT: 'TentativeReject',
TENTATIVE_ACCEPT: 'TentativeAccept',
- TRAVAL: 'Travel',
+ TRAVEL: 'Travel',
UNDO: 'Undo',
UPDATE: 'Update',
VIEW: 'View'
diff --git a/src/frontend/packages/activitypub-components/src/hooks/useCollection.js b/src/frontend/packages/activitypub-components/src/hooks/useCollection.js
index ba123a466..c77871172 100644
--- a/src/frontend/packages/activitypub-components/src/hooks/useCollection.js
+++ b/src/frontend/packages/activitypub-components/src/hooks/useCollection.js
@@ -1,16 +1,76 @@
import { useCallback, useMemo, useState, useEffect } from 'react';
import { useGetIdentity, useDataProvider } from 'react-admin';
-import { useInfiniteQuery, useQueryClient } from 'react-query';
+import { useInfiniteQuery, useQueries } from 'react-query';
+import { getOrCreateWsChannel } from '@semapps/semantic-data-provider';
import { arrayOf } from '../utils';
+const useItemsFromPagesAndNotifications = (pages, notifications, dereferenceItems) => {
+ const dataProvider = useDataProvider();
+
+ // Add all items from pages and process notifications (possibly new and deleted items).
+ const items = useMemo(
+ () => {
+ const addItems = notifications.map(n => n.type === 'Add').map(n => n.object);
+ const removeItems = notifications.map(n => n.type === 'Remove').map(n => n.object.id || n.object);
+ const currentItems = !pages ? [] : pages.flatMap(p => arrayOf(p.orderedItems || p.items));
+ const currentAndNew = currentItems.concat(addItems);
+
+ return (
+ currentAndNew
+ // Filter out removed items.
+ .filter(item => !removeItems.some(r => (r.id ?? r) === (item.id ?? item)))
+ // Filter duplicates.
+ .filter(item => currentAndNew.some(i2 => (i2.id ?? i2) === (item.id ?? item)))
+ );
+ },
+ pages,
+ notifications
+ );
+
+ if (!dereferenceItems) {
+ return { loadedItems: items, isLoading: false, isFetching: false };
+ }
+
+ // Dereference all items, if they are not yet.
+ const itemQueries = useQueries(
+ items
+ .filter(item => typeof item === 'string')
+ .map(itemUri => ({
+ queryKey: ['resource', itemUri],
+ queryFn: async () => (await dataProvider.fetch(itemUri)).json,
+ staleTime: Infinity
+ }))
+ );
+
+ // Put all loaded items together (might be dereferenced already, so concatenate).
+ const loadedItems = items
+ .filter(item => typeof item !== 'string')
+ .concat(
+ itemQueries.flatMap(itemQuery => {
+ return (itemQuery.isSuccess && itemQuery.data) || [];
+ })
+ );
+
+ console.log('loadedItems', loadedItems.length, 'total', items.length);
+
+ const errors = itemQueries.filter(q => q.error);
+ return {
+ loadedItems,
+ isLoading: itemQueries.some(q => q.isLoading),
+ isFetching: itemQueries.some(q => q.isFetching),
+ errors: errors.length > 0 && errors
+ };
+};
+
const useCollection = (predicateOrUrl, options = {}) => {
- const { dereferenceItems = false } = options;
+ const { dereferenceItems = false, liveUpdates = true } = options;
const { data: identity } = useGetIdentity();
- const [items, setItems] = useState();
const [totalItems, setTotalItems] = useState();
+ const [notifications, setNotifications] = useState([]);
+ const [hasLiveUpdates, setHasLiveUpdates] = useState({ status: 'disconnected', error: undefined });
const dataProvider = useDataProvider();
- const queryClient = useQueryClient();
+ // Get collectionUrl from webId predicate or URL.
const collectionUrl = useMemo(() => {
if (predicateOrUrl) {
if (predicateOrUrl.startsWith('http')) {
@@ -20,13 +80,19 @@ const useCollection = (predicateOrUrl, options = {}) => {
return identity?.webIdData?.[predicateOrUrl];
}
}
+ return undefined;
+ // throw new Error(`No URL available for useCollection: ${predicateOrUrl}.`);
}, [identity, predicateOrUrl]);
+ // Fetch page of collection item references (if pageParam provided)
+ // or default to `collectionUrl` (which should give you the first page).
const fetchCollection = useCallback(
async ({ pageParam: nextPageUrl }) => {
+ // Fetch page or first page (collectionUrl)
let { json } = await dataProvider.fetch(nextPageUrl || collectionUrl);
if (json.totalItems) setTotalItems(json.totalItems);
+ // If first page, handle this here.
if ((json.type === 'OrderedCollection' || json.type === 'Collection') && json.first) {
if (json.first?.items) {
if (json.first?.items.length === 0 && json.first?.next) {
@@ -41,86 +107,77 @@ const useCollection = (predicateOrUrl, options = {}) => {
}
}
- // Force dereference of items
- if (dereferenceItems) {
- const itemPredicate = json.items ? 'items' : 'orderedItems';
- json[itemPredicate] =
- json[itemPredicate] &&
- (await Promise.all(
- arrayOf(json[itemPredicate]).map(async item => {
- if (typeof item === 'string') {
- const { json } = await dataProvider.fetch(item);
- return json;
- }
- return item;
- })
- ));
- }
-
return json;
},
[dataProvider, collectionUrl, identity, setTotalItems]
);
- const { data, error, fetchNextPage, refetch, hasNextPage, isLoading, isFetching, isFetchingNextPage, status } =
- useInfiniteQuery(['Collection', { collectionUrl }], fetchCollection, {
- enabled: !!(collectionUrl && identity?.id),
- getNextPageParam: lastPage => lastPage.next,
- getPreviousPageParam: firstPage => firstPage.prev
- });
+ // Use infiniteQuery to handle pagination, fetching, etc.
+ const {
+ data,
+ error: collectionError,
+ fetchNextPage,
+ refetch,
+ hasNextPage,
+ isLoading: isLoadingPage,
+ isFetching: isFetchingPage,
+ isFetchingNextPage
+ } = useInfiniteQuery(['collection', { collectionUrl }], fetchCollection, {
+ enabled: !!(collectionUrl && identity?.id),
+ getNextPageParam: lastPage => lastPage.next,
+ getPreviousPageParam: firstPage => firstPage.prev
+ });
+
+ // Put all items together in a list.
+ const {
+ loadedItems: items,
+ isLoading: isLoadingItems,
+ isFetching: isFetchingItems,
+ errors: itemErrors
+ } = useItemsFromPagesAndNotifications(data?.pages, notifications, dereferenceItems);
+ // Notifications have been processed after hook call, so reset.
+ // useEffect(() => {
+ // setNotifications([]);
+ // }, [notifications])
+ // Live Updates
useEffect(() => {
- if (data?.pages) {
- setItems([].concat(...data.pages.map(p => arrayOf(p.orderedItems || p.items))));
+ if (liveUpdates && collectionUrl) {
+ // Create ws that listens to collectionUri changes
+ getOrCreateWsChannel(dataProvider.fetch, collectionUrl)
+ .then(webSocket => {
+ webSocket.addEventListener('message', e => {
+ if ((e.data && e.data.type === 'Add') || e.data.type === 'Remove') {
+ setNotifications([...notifications, e.data]);
+ }
+ });
+ webSocket.addEventListener('error', e => {
+ setHasLiveUpdates({ status: 'error', error: e });
+ // TODO: Retry after a while
+ });
+ webSocket.addEventListener('close', e => {
+ setHasLiveUpdates({ ...hasLiveUpdates, status: 'disconnected' });
+ });
+ setHasLiveUpdates({ status: 'connected' });
+ })
+ .catch(() => {}); // If it fails, we won't receive live updates. But that's okay.
}
- }, [data, setItems]);
-
- const addItem = useCallback(
- item => {
- setItems(oldItems => [...oldItems, item]);
- // TODO use queryClient.setQueryData to update items directly in react-query cache
- setTimeout(
- () =>
- queryClient.refetchQueries(['Collection', { collectionUrl }], {
- active: true,
- exact: true
- }),
- 2000
- );
- },
- [setItems, queryClient, collectionUrl]
- );
+ }, [collectionUrl, liveUpdates, dataProvider.fetch]);
- const removeItem = useCallback(
- itemId => {
- setItems(oldItems => oldItems.filter(item => (typeof item === 'string' ? item !== itemId : item.id !== itemId)));
- // TODO use queryClient.setQueryData to update items directly in react-query cache
- setTimeout(
- () =>
- queryClient.refetchQueries(['Collection', { collectionUrl }], {
- active: true,
- exact: true
- }),
- 2000
- );
- },
- [setItems, queryClient, collectionUrl]
- );
+ const allErrors = arrayOf(collectionError).concat(arrayOf(itemErrors));
return {
items,
totalItems,
- error,
+ error: allErrors.length > 0 && allErrors,
refetch,
fetchNextPage,
hasNextPage,
- isLoading,
- isFetching,
+ isLoading: isLoadingPage || isLoadingItems,
+ isFetching: isFetchingPage || isFetchingItems,
isFetchingNextPage,
- status,
- addItem,
- removeItem,
- url: collectionUrl
+ url: collectionUrl,
+ hasLiveUpdates
};
};
diff --git a/src/frontend/packages/activitypub-components/src/hooks/useCollection.ts b/src/frontend/packages/activitypub-components/src/hooks/useCollection.ts
new file mode 100644
index 000000000..65f9bbcd0
--- /dev/null
+++ b/src/frontend/packages/activitypub-components/src/hooks/useCollection.ts
@@ -0,0 +1,245 @@
+import { useCallback, useMemo, useState, useEffect } from 'react';
+import { useGetIdentity, useDataProvider } from 'react-admin';
+import { QueryFunction, useInfiniteQuery, useQueries, useQueryClient } from 'react-query';
+import { getOrCreateWsChannel } from '@semapps/semantic-data-provider';
+import { arrayOf } from '../utils';
+
+const useItemsFromPages = (pages: any[], dereferenceItems: boolean) => {
+ const dataProvider = useDataProvider();
+ const items = useMemo(() => pages.flatMap(p => arrayOf(p.orderedItems || p.items)), [pages]);
+
+ // We will force dereference, if some items are not URI string references.
+ const shouldDereference = useMemo(() => {
+ return dereferenceItems || items.some(item => typeof item !== 'string');
+ }, [dereferenceItems, items]);
+
+ // Dereference all items, if necessary (even if shouldDereference is false, the hook needs to be called).
+ const itemQueries = useQueries(
+ !shouldDereference
+ ? []
+ : items
+ .filter(item => typeof item === 'string')
+ .map(itemUri => ({
+ queryKey: ['resource', itemUri],
+ queryFn: async () => (await dataProvider.fetch(itemUri)).json,
+ staleTime: Infinity
+ }))
+ );
+
+ if (!shouldDereference) {
+ return { loadedItems: items, isLoading: false, isFetching: false };
+ }
+
+ // Put all loaded items together (might be dereferenced already, so concatenate).
+ const loadedItems = items
+ .filter(item => typeof item !== 'string')
+ .concat(
+ itemQueries.flatMap(itemQuery => {
+ return (itemQuery.isSuccess && itemQuery.data) || [];
+ })
+ );
+
+ const errors = itemQueries.filter(q => q.error);
+ return {
+ loadedItems,
+ isLoading: itemQueries.some(q => q.isLoading),
+ isFetching: itemQueries.some(q => q.isFetching),
+ errors: errors.length > 0 ? errors : undefined
+ };
+};
+
+interface UseCollectionOptions {
+ dereferenceItems?: boolean;
+ liveUpdates?: boolean;
+}
+
+/**
+ * Subscribe a collection. Supports pagination.
+ * @param predicateOrUrl The collection URI or the predicate to get the collection URI from the identity (webId).
+ * @param {UseCollectionOptions} options Defaults to `{ dereferenceItems: false, liveUpdates: true }`
+ */
+const useCollection = (predicateOrUrl: string, options: UseCollectionOptions = {}) => {
+ const { dereferenceItems = false, liveUpdates = true } = options;
+ const { data: identity } = useGetIdentity();
+ const [totalItems, setTotalItems] = useState();
+ const queryClient = useQueryClient();
+ const [hasLiveUpdates, setHasLiveUpdates] = useState<{ status: string; error?: any }>({ status: 'connecting' });
+ const dataProvider = useDataProvider();
+
+ // Get collectionUrl from webId predicate or URL.
+ const collectionUrl = useMemo(() => {
+ if (predicateOrUrl) {
+ if (predicateOrUrl.startsWith('http')) {
+ return predicateOrUrl;
+ }
+ if (identity?.webIdData) {
+ return identity?.webIdData?.[predicateOrUrl];
+ }
+ }
+ return undefined;
+ // throw new Error(`No URL available for useCollection: ${predicateOrUrl}.`);
+ }, [identity, predicateOrUrl]);
+
+ // Fetch page of collection item references (if pageParam provided)
+ // or default to `collectionUrl` (which should give you the first page).
+ const fetchCollection: QueryFunction = useCallback(
+ async ({ pageParam: nextPageUrl }) => {
+ // Fetch page or first page (collectionUrl)
+ let { json } = await dataProvider.fetch(nextPageUrl || collectionUrl);
+ if (json.totalItems) setTotalItems(json.totalItems);
+
+ // If first page, handle this here.
+ if ((json.type === 'OrderedCollection' || json.type === 'Collection') && json.first) {
+ if (json.first?.items) {
+ if (json.first?.items.length === 0 && json.first?.next) {
+ // Special case where the first property is an object without items
+ ({ json } = await dataProvider.fetch(json.first?.next));
+ } else {
+ json = json.first;
+ }
+ } else {
+ // Fetch the first page
+ ({ json } = await dataProvider.fetch(json.first));
+ }
+ }
+
+ return json;
+ },
+ [dataProvider, collectionUrl, identity, setTotalItems]
+ );
+
+ // Use infiniteQuery to handle pagination, fetching, etc.
+ const {
+ data: pageData,
+ error: collectionError,
+ fetchNextPage,
+ refetch,
+ hasNextPage,
+ isLoading: isLoadingPage,
+ isFetching: isFetchingPage,
+ isFetchingNextPage
+ } = useInfiniteQuery(['collection', { collectionUrl }], fetchCollection, {
+ enabled: !!(collectionUrl && identity?.id),
+ getNextPageParam: (lastPage: any) => lastPage.next,
+ getPreviousPageParam: (firstPage: any) => firstPage.prev
+ });
+
+ // Put all items together in a list (and dereference, if required).
+ const {
+ loadedItems: items,
+ isLoading: isLoadingItems,
+ isFetching: isFetchingItems,
+ errors: itemErrors
+ } = useItemsFromPages(pageData?.pages ?? [], dereferenceItems);
+
+ const allErrors = arrayOf(collectionError).concat(arrayOf(itemErrors));
+
+ const addItem = useCallback(
+ (item: string | any, shouldRefetch: boolean | number = true) => {
+ queryClient.setQueryData(['collection', { collectionUrl }], (oldData: any) => {
+ if (!oldData) return oldData;
+ setTotalItems(totalItems && totalItems + 1);
+
+ // Destructure, so react knows, it needs to re-render the pages.
+ const pages = [...oldData.pages];
+ const firstPageItems: any[] = pages?.[0]?.orderedItems || pages?.[0]?.items || [];
+ firstPageItems.unshift(item);
+
+ oldData.pages = pages;
+ return oldData;
+ });
+ if (shouldRefetch) {
+ setTimeout(
+ () =>
+ queryClient.refetchQueries(['collection', { collectionUrl }], {
+ active: true,
+ exact: true
+ }),
+ typeof shouldRefetch === 'number' ? shouldRefetch : 2000
+ );
+ }
+ },
+ [queryClient, collectionUrl]
+ );
+
+ const removeItem = useCallback(
+ (item: string | any, shouldRefetch: boolean = true) => {
+ queryClient.setQueryData(['collection', { collectionUrl }], (oldData: any) => {
+ if (!oldData) return oldData;
+ setTotalItems(totalItems && totalItems - 1);
+
+ // Destructure, so react knows, it needs to re-render the pages array.
+ const pages = [...oldData.pages];
+ // Find the item in all pages and remove the item to be removed (either item.id or just item)
+ pages.forEach(page => {
+ if (page.orderedItems) {
+ page.orderedItems = page.orderedItems.filter((i: any) => (i.id || i) !== (item.id || item));
+ } else if (page.items) {
+ page.items = page.items.filter((i: any) => (i.id || i) !== (item?.id || item));
+ }
+ });
+
+ oldData.pages = pages;
+ return oldData;
+ });
+ if (shouldRefetch) {
+ setTimeout(
+ () =>
+ queryClient.refetchQueries(['collection', { collectionUrl }], {
+ active: true,
+ exact: true
+ }),
+ typeof shouldRefetch === 'number' ? shouldRefetch : 2000
+ );
+ }
+ },
+ [queryClient, collectionUrl]
+ );
+
+ // Live Updates
+ useEffect(() => {
+ if (liveUpdates && collectionUrl) {
+ // Create ws that listens to collectionUri changes
+ getOrCreateWsChannel(dataProvider.fetch, collectionUrl)
+ .then(webSocket => {
+ webSocket.addEventListener('message', e => {
+ const data = JSON.parse(e.data);
+ if (data && data.type === 'Add') {
+ addItem(data.object, true);
+ } else if (data && data.type === 'Remove') {
+ removeItem(data.object, true);
+ }
+ });
+ webSocket.addEventListener('error', e => {
+ setHasLiveUpdates({ status: 'error', error: e });
+ // TODO: Retry after a while
+ });
+ webSocket.addEventListener('close', e => {
+ if (!hasLiveUpdates.error) {
+ setHasLiveUpdates({ ...hasLiveUpdates, status: 'closed' });
+ }
+ });
+ setHasLiveUpdates({ status: 'connected' });
+ })
+ .catch(() => {}); // If it fails, we won't receive live updates. But that's okay.
+ }
+ }, [collectionUrl, liveUpdates, dataProvider]);
+
+ return {
+ items,
+ totalItems,
+ error: allErrors.length > 0 && allErrors,
+ refetch,
+ fetchNextPage,
+ addItem,
+ removeItem,
+ hasNextPage,
+ isLoading: isLoadingPage || isLoadingItems,
+ isFetching: isFetchingPage || isFetchingItems,
+ isFetchingNextPage,
+ url: collectionUrl,
+ hasLiveUpdates
+ };
+};
+
+export default useCollection;
diff --git a/src/frontend/packages/activitypub-components/src/utils.js b/src/frontend/packages/activitypub-components/src/utils.js
deleted file mode 100644
index 7b78cfd03..000000000
--- a/src/frontend/packages/activitypub-components/src/utils.js
+++ /dev/null
@@ -1,16 +0,0 @@
-export const arrayOf = value => {
- // If the field is null-ish, we suppose there are no values.
- if (value === null || value === undefined) {
- return [];
- }
- // Return as is.
- if (Array.isArray(value)) {
- return value;
- }
- // Single value is made an array.
- return [value];
-};
-
-export default {
- arrayOf
-};
diff --git a/src/frontend/packages/activitypub-components/src/utils.ts b/src/frontend/packages/activitypub-components/src/utils.ts
new file mode 100644
index 000000000..122e9c97a
--- /dev/null
+++ b/src/frontend/packages/activitypub-components/src/utils.ts
@@ -0,0 +1,28 @@
+export const arrayOf = (value: T | T[]) => {
+ // If the field is null-ish, we suppose there are no values.
+ if (value === null || value === undefined) {
+ return [];
+ }
+ // Return as is.
+ if (Array.isArray(value)) {
+ return value;
+ }
+ // Single value is made an array.
+ return [value];
+};
+
+export default {
+ arrayOf
+};
+
+export const filterDuplicates = (iterable: T[], predicate: (item: T) => string) => {
+ const seen = new Set();
+ return iterable.filter(item => {
+ const key = predicate(item);
+ if (seen.has(key)) {
+ return false;
+ }
+ seen.add(key);
+ return true;
+ });
+};
diff --git a/src/frontend/packages/auth-provider/dist/index.d.ts b/src/frontend/packages/auth-provider/dist/index.d.ts
index 2a80c21c7..689986e51 100644
--- a/src/frontend/packages/auth-provider/dist/index.d.ts
+++ b/src/frontend/packages/auth-provider/dist/index.d.ts
@@ -1,208 +1,167 @@
-import React from 'react';
-import { ToolbarProps } from 'react-admin';
-export function authProvider({
- dataProvider,
- authType,
- allowAnonymous,
- checkUser,
- checkPermissions,
- clientId
-}: {
- dataProvider: any;
- authType: any;
- allowAnonymous?: boolean | undefined;
- checkUser: any;
- checkPermissions?: boolean | undefined;
- clientId: any;
+import React from "react";
+import { ToolbarProps } from "react-admin";
+export function authProvider({ dataProvider, authType, allowAnonymous, checkUser, checkPermissions, clientId }: {
+ dataProvider: any;
+ authType: any;
+ allowAnonymous?: boolean | undefined;
+ checkUser: any;
+ checkPermissions?: boolean | undefined;
+ clientId: any;
}): {
- login: (params: any) => Promise;
- handleCallback: () => Promise;
- signup: (params: any) => Promise;
- logout: () => Promise;
- checkAuth: () => Promise;
- checkUser: (userData: any) => any;
- checkError: (error: any) => Promise;
- getPermissions: (uri: any) => Promise;
- addPermission: (uri: any, agentId: any, predicate: any, mode: any) => Promise;
- removePermission: (uri: any, agentId: any, predicate: any, mode: any) => Promise;
- getIdentity: () => Promise<
- | {
+ login: (params: any) => Promise;
+ handleCallback: () => Promise;
+ signup: (params: any) => Promise;
+ logout: () => Promise;
+ checkAuth: () => Promise;
+ checkUser: (userData: any) => any;
+ checkError: (error: any) => Promise;
+ getPermissions: (uri: any) => Promise;
+ addPermission: (uri: any, agentId: any, predicate: any, mode: any) => Promise;
+ removePermission: (uri: any, agentId: any, predicate: any, mode: any) => Promise;
+ getIdentity: () => Promise<{
id: any;
fullName: any;
profileData: any;
webIdData: any;
- }
- | undefined
- >;
- resetPassword: (params: any) => Promise;
- setNewPassword: (params: any) => Promise;
- getAccountSettings: (params: any) => Promise;
- updateAccountSettings: (params: any) => Promise;
- /**
- * Inform the OIDC server that the login interaction has been completed.
- * This is necessary, otherwise the OIDC server will keep on redirecting to the login form.
- * We call the endpoint with the token as a proof of login, otherwise it could be abused.
- */
- loginCompleted: (interactionId: any, webId: any) => Promise;
+ } | undefined>;
+ resetPassword: (params: any) => Promise;
+ setNewPassword: (params: any) => Promise;
+ getAccountSettings: (params: any) => Promise;
+ updateAccountSettings: (params: any) => Promise;
+ /**
+ * Inform the OIDC server that the login interaction has been completed.
+ * This is necessary, otherwise the OIDC server will keep on redirecting to the login form.
+ * We call the endpoint with the token as a proof of login, otherwise it could be abused.
+ */
+ loginCompleted: (interactionId: any, webId: any) => Promise;
};
type AclMode = 'acl:Read' | 'acl:Append' | 'acl:Write' | 'acl:Control';
/** foaf:Agent = anonymous, acl:AuthenticatedAgent = logged */
type AclClass = 'foaf:Agent' | 'acl:AuthenticatedAgent';
type BasePermission = {
- /** '#Control' | '#Read' | '#Write' | custom string */
- '@id': string;
- '@type': 'acl:Authorization';
- 'acl:mode': AclMode;
-} & (
- | {
- /** Related resource URI */
- 'acl:accessTo'?: string;
- }
- | {
- /** Parent resource URI */
- 'acl:default': string;
- }
-);
+ /** '#Control' | '#Read' | '#Write' | custom string */
+ '@id': string;
+ '@type': 'acl:Authorization';
+ 'acl:mode': AclMode;
+} & ({
+ /** Related resource URI */
+ 'acl:accessTo'?: string;
+} | {
+ /** Parent resource URI */
+ 'acl:default': string;
+});
type UserPermission = BasePermission & {
- /** User resource URI */
- 'acl:agent': string;
+ /** User resource URI */
+ 'acl:agent': string;
};
type GroupPermission = BasePermission & {
- /** ACL Group resource URI */
- 'acl:agentGroup': string;
+ /** ACL Group resource URI */
+ 'acl:agentGroup': string;
};
type ClassPermission = BasePermission & {
- 'acl:agentClass': AclClass | AclClass[];
+ 'acl:agentClass': AclClass | AclClass[];
};
type Permission = UserPermission | GroupPermission | ClassPermission;
type Permissions = Permission[];
declare const rights: {
- show: AclMode[];
- list: AclMode[];
- create: AclMode[];
- edit: AclMode[];
- delete: AclMode[];
- control: AclMode[];
+ show: AclMode[];
+ list: AclMode[];
+ create: AclMode[];
+ edit: AclMode[];
+ delete: AclMode[];
+ control: AclMode[];
};
-export const useCheckPermissions: (
- uri: string,
- mode: keyof typeof rights,
- redirectUrl?: string
-) => Permissions | undefined;
-export function CreateWithPermissions(props: any): import('react/jsx-runtime').JSX.Element;
+export const useCheckPermissions: (uri: string, mode: keyof typeof rights, redirectUrl?: string) => Permissions | undefined;
+export function CreateWithPermissions(props: any): import("react/jsx-runtime").JSX.Element;
declare namespace CreateWithPermissions {
- namespace defaultProps {
- let actions: import('react/jsx-runtime').JSX.Element;
- }
+ namespace defaultProps {
+ let actions: import("react/jsx-runtime").JSX.Element;
+ }
}
export function useAgents(uri: any): {
- agents: {};
- addPermission: (agentId: any, predicate: any, mode: any) => void;
- removePermission: (agentId: any, predicate: any, mode: any) => void;
+ agents: {};
+ addPermission: (agentId: any, predicate: any, mode: any) => void;
+ removePermission: (agentId: any, predicate: any, mode: any) => void;
};
-export function PermissionsButton({ isContainer }: { isContainer: any }): import('react/jsx-runtime').JSX.Element;
+export function PermissionsButton({ isContainer }: {
+ isContainer: any;
+}): import("react/jsx-runtime").JSX.Element;
declare namespace PermissionsButton {
- namespace defaultProps {
- let isContainer: boolean;
- }
+ namespace defaultProps {
+ let isContainer: boolean;
+ }
}
-export const EditActionsWithPermissions: () => import('react/jsx-runtime').JSX.Element;
-export function DeleteButtonWithPermissions(props: any): import('react/jsx-runtime').JSX.Element | null;
+export const EditActionsWithPermissions: () => import("react/jsx-runtime").JSX.Element;
+export function DeleteButtonWithPermissions(props: any): import("react/jsx-runtime").JSX.Element | null;
export const EditToolbarWithPermissions: React.FunctionComponent;
-export function EditWithPermissions(props: any): import('react/jsx-runtime').JSX.Element;
+export function EditWithPermissions(props: any): import("react/jsx-runtime").JSX.Element;
declare namespace EditWithPermissions {
- namespace defaultProps {
- let actions: import('react/jsx-runtime').JSX.Element;
- }
+ namespace defaultProps {
+ let actions: import("react/jsx-runtime").JSX.Element;
+ }
}
-export function EditButtonWithPermissions(props: any): import('react/jsx-runtime').JSX.Element | null;
-export function ListActionsWithPermissions({
- bulkActions,
- sort,
- displayedFilters,
- exporter,
- filters,
- filterValues,
- onUnselectItems,
- selectedIds,
- showFilter,
- total
-}: {
- bulkActions: any;
- sort: any;
- displayedFilters: any;
- exporter: any;
- filters: any;
- filterValues: any;
- onUnselectItems: any;
- selectedIds: any;
- showFilter: any;
- total: any;
-}): import('react/jsx-runtime').JSX.Element;
-export function ListWithPermissions(props: any): import('react/jsx-runtime').JSX.Element;
+export function EditButtonWithPermissions(props: any): import("react/jsx-runtime").JSX.Element | null;
+export function ListActionsWithPermissions({ bulkActions, sort, displayedFilters, exporter, filters, filterValues, onUnselectItems, selectedIds, showFilter, total }: {
+ bulkActions: any;
+ sort: any;
+ displayedFilters: any;
+ exporter: any;
+ filters: any;
+ filterValues: any;
+ onUnselectItems: any;
+ selectedIds: any;
+ showFilter: any;
+ total: any;
+}): import("react/jsx-runtime").JSX.Element;
+export function ListWithPermissions(props: any): import("react/jsx-runtime").JSX.Element;
declare namespace ListWithPermissions {
- namespace defaultProps {
- let actions: import('react/jsx-runtime').JSX.Element;
- }
+ namespace defaultProps {
+ let actions: import("react/jsx-runtime").JSX.Element;
+ }
}
-export const ShowActionsWithPermissions: () => import('react/jsx-runtime').JSX.Element;
-export function ShowWithPermissions(props: any): import('react/jsx-runtime').JSX.Element;
+export const ShowActionsWithPermissions: () => import("react/jsx-runtime").JSX.Element;
+export function ShowWithPermissions(props: any): import("react/jsx-runtime").JSX.Element;
declare namespace ShowWithPermissions {
- namespace defaultProps {
- let actions: import('react/jsx-runtime').JSX.Element;
- }
+ namespace defaultProps {
+ let actions: import("react/jsx-runtime").JSX.Element;
+ }
}
-export function AuthDialog({
- open,
- onClose,
- title,
- message,
- redirect,
- ...rest
-}: {
- [x: string]: any;
- open: any;
- onClose: any;
- title: any;
- message: any;
- redirect: any;
-}): import('react/jsx-runtime').JSX.Element;
+export function AuthDialog({ open, onClose, title, message, redirect, ...rest }: {
+ [x: string]: any;
+ open: any;
+ onClose: any;
+ title: any;
+ message: any;
+ redirect: any;
+}): import("react/jsx-runtime").JSX.Element;
declare namespace AuthDialog {
- namespace defaultProps {
- let title: string;
- let message: string;
- }
+ namespace defaultProps {
+ let title: string;
+ let message: string;
+ }
}
export declare namespace SsoLoginPageClasses {
- export let card: string;
- export let avatar: string;
- export let icon: string;
- let _switch: string;
- export { _switch as switch };
+ export let card: string;
+ export let avatar: string;
+ export let icon: string;
+ let _switch: string;
+ export { _switch as switch };
}
-export function LoginPage({
- children,
- backgroundImage,
- buttons,
- userResource,
- propertiesExist,
- text,
- ...rest
-}: {
- [x: string]: any;
- children: any;
- backgroundImage: any;
- buttons: any;
- userResource: any;
- propertiesExist: any;
- text: any;
-}): import('react/jsx-runtime').JSX.Element | null;
+export function LoginPage({ children, backgroundImage, buttons, userResource, propertiesExist, text, ...rest }: {
+ [x: string]: any;
+ children: any;
+ backgroundImage: any;
+ buttons: any;
+ userResource: any;
+ propertiesExist: any;
+ text: any;
+}): import("react/jsx-runtime").JSX.Element | null;
declare namespace SsoLoginPage {
- namespace defaultProps {
- let propertiesExist: never[];
- let buttons: import('react/jsx-runtime').JSX.Element[];
- let userResource: string;
- }
+ namespace defaultProps {
+ let propertiesExist: never[];
+ let buttons: import("react/jsx-runtime").JSX.Element[];
+ let userResource: string;
+ }
}
export function useSignup(): (params?: {}) => any;
/**
@@ -218,84 +177,75 @@ export function useSignup(): (params?: {}) => any;
*/
/** @type {PasswordStrengthOptions} */
export const defaultPasswordScorerOptions: PasswordStrengthOptions;
-export function createPasswordScorer(
- options?: PasswordStrengthOptions,
- minRequiredScore?: number
-): {
- scoreFn: (password: any) => number;
- minRequiredScore: number;
- maxScore: number;
+export function createPasswordScorer(options?: PasswordStrengthOptions, minRequiredScore?: number): {
+ scoreFn: (password: any) => number;
+ minRequiredScore: number;
+ maxScore: number;
};
export declare namespace defaultScorer {
- export function scoreFn(password: any): number;
- export { minRequiredScore };
- export let maxScore: number;
+ export function scoreFn(password: any): number;
+ export { minRequiredScore };
+ export let maxScore: number;
}
type PasswordStrengthOptions = {
- /**
- * - Required characters for a very long password (default: 12)
- */
- isVeryLongLength: number;
- /**
- * - Required characters for a long password (default: 6)
- */
- isLongLength: number;
- /**
- * - Score for a very long password (default: 2.5)
- */
- isVeryLongScore: number;
- /**
- * - Score for a long password (default: 1.5)
- */
- isLongScore: number;
- /**
- * - Score for a password with uppercase letters (default: 1)
- */
- uppercaseScore: number;
- /**
- * - Score for a password with lowercase letters (default: 1)
- */
- lowercaseScore: number;
- /**
- * - Score for a password with numbers (default: 1)
- */
- numbersScore: number;
- /**
- * - Score for a password without non-alphanumeric characters (default: 1)
- */
- nonAlphanumericsScore: number;
+ /**
+ * - Required characters for a very long password (default: 12)
+ */
+ isVeryLongLength: number;
+ /**
+ * - Required characters for a long password (default: 6)
+ */
+ isLongLength: number;
+ /**
+ * - Score for a very long password (default: 2.5)
+ */
+ isVeryLongScore: number;
+ /**
+ * - Score for a long password (default: 1.5)
+ */
+ isLongScore: number;
+ /**
+ * - Score for a password with uppercase letters (default: 1)
+ */
+ uppercaseScore: number;
+ /**
+ * - Score for a password with lowercase letters (default: 1)
+ */
+ lowercaseScore: number;
+ /**
+ * - Score for a password with numbers (default: 1)
+ */
+ numbersScore: number;
+ /**
+ * - Score for a password without non-alphanumeric characters (default: 1)
+ */
+ nonAlphanumericsScore: number;
};
export function validatePasswordStrength(scorer?: {
- scoreFn: (password: any) => number;
- minRequiredScore: number;
- maxScore: number;
-}): (value: any) => 'auth.input.password_too_weak' | undefined;
-export function PasswordStrengthIndicator({
- scorer,
- password,
- ...restProps
-}: {
- [x: string]: any;
- scorer?:
- | {
+ scoreFn: (password: any) => number;
+ minRequiredScore: number;
+ maxScore: number;
+}): (value: any) => "auth.input.password_too_weak" | undefined;
+export function PasswordStrengthIndicator({ scorer, password, ...restProps }: {
+ [x: string]: any;
+ scorer?: {
scoreFn: (password: any) => number;
minRequiredScore: number;
maxScore: number;
- }
- | undefined;
- password: any;
-}): import('react/jsx-runtime').JSX.Element;
+ } | undefined;
+ password: any;
+}): import("react/jsx-runtime").JSX.Element;
declare namespace SignupForm {
- namespace defaultValues {
- let redirectTo: string;
- let additionalSignupValues: {};
- }
+ namespace defaultValues {
+ let redirectTo: string;
+ let additionalSignupValues: {};
+ }
}
declare namespace LoginForm {
- namespace defaultValues {
- let redirectTo: string;
- let allowUsername: boolean;
- }
+ namespace defaultValues {
+ let redirectTo: string;
+ let allowUsername: boolean;
+ }
}
/**
* @param {object} props Props
@@ -309,253 +259,238 @@ declare namespace LoginForm {
* passwordStrength's `defaultScorer`.
* @returns
*/
-export function LocalLoginPage({
- hasSignup,
- allowUsername,
- postSignupRedirect,
- postLoginRedirect,
- additionalSignupValues,
- passwordScorer
-}: {
- hasSignup: boolean;
- allowUsername: boolean;
- postSignupRedirect: string;
- postLoginRedirect: string;
- additionalSignupValues: object;
- passwordScorer: object;
-}): import('react/jsx-runtime').JSX.Element | null;
+export function LocalLoginPage({ hasSignup, allowUsername, postSignupRedirect, postLoginRedirect, additionalSignupValues, passwordScorer }: {
+ hasSignup: boolean;
+ allowUsername: boolean;
+ postSignupRedirect: string;
+ postLoginRedirect: string;
+ additionalSignupValues: object;
+ passwordScorer: object;
+}): import("react/jsx-runtime").JSX.Element | null;
declare namespace LocalLoginPage {
- namespace defaultProps {
- let hasSignup: boolean;
- let allowUsername: boolean;
- let additionalSignupValues: {};
- }
+ namespace defaultProps {
+ let hasSignup: boolean;
+ let allowUsername: boolean;
+ let additionalSignupValues: {};
+ }
}
-export function ResourceWithPermissions({
- name,
- create,
- ...rest
-}: {
- [x: string]: any;
- name: any;
- create: any;
-}): import('react/jsx-runtime').JSX.Element;
-export function UserMenu({
- logout,
- profileResource,
- ...otherProps
-}: {
- [x: string]: any;
- logout: any;
- profileResource: any;
-}): import('react/jsx-runtime').JSX.Element;
+export function ResourceWithPermissions({ name, create, ...rest }: {
+ [x: string]: any;
+ name: any;
+ create: any;
+}): import("react/jsx-runtime").JSX.Element;
+export function UserMenu({ logout, profileResource, ...otherProps }: {
+ [x: string]: any;
+ logout: any;
+ profileResource: any;
+}): import("react/jsx-runtime").JSX.Element;
declare namespace UserMenu {
- namespace defaultProps {
- let logout: import('react/jsx-runtime').JSX.Element;
- let profileResource: string;
- }
+ namespace defaultProps {
+ let logout: import("react/jsx-runtime").JSX.Element;
+ let profileResource: string;
+ }
}
export function useCheckAuthenticated(message: any): {
- identity: import('react-admin').UserIdentity | undefined;
- isLoading: boolean;
+ identity: import("react-admin").UserIdentity | undefined;
+ isLoading: boolean;
};
export function usePermissionsWithRefetch(params?: {}): {
- refetch: () => Promise;
- permissions?: any;
+ refetch: () => Promise;
+ permissions?: any;
};
declare namespace englishMessages {
- namespace auth {
- namespace dialog {
- let container_permissions: string;
- let resource_permissions: string;
- let login_required: string;
- }
- namespace action {
- let submit: string;
- let permissions: string;
- let signup: string;
- let reset_password: string;
- let set_new_password: string;
- let logout: string;
- let login: string;
- let view_my_profile: string;
- let edit_my_profile: string;
+ namespace auth {
+ namespace dialog {
+ let container_permissions: string;
+ let resource_permissions: string;
+ let login_required: string;
+ }
+ namespace action {
+ let submit: string;
+ let permissions: string;
+ let signup: string;
+ let reset_password: string;
+ let set_new_password: string;
+ let logout: string;
+ let login: string;
+ let view_my_profile: string;
+ let edit_my_profile: string;
+ }
+ namespace right {
+ namespace resource {
+ let read: string;
+ let append: string;
+ let write: string;
+ let control: string;
+ }
+ namespace container {
+ let read_1: string;
+ export { read_1 as read };
+ let append_1: string;
+ export { append_1 as append };
+ let write_1: string;
+ export { write_1 as write };
+ let control_1: string;
+ export { control_1 as control };
+ }
+ }
+ namespace agent {
+ let anonymous: string;
+ let authenticated: string;
+ }
+ namespace input {
+ let agent_select: string;
+ let name: string;
+ let username: string;
+ let email: string;
+ let username_or_email: string;
+ let current_password: string;
+ let new_password: string;
+ let confirm_new_password: string;
+ let password_strength: string;
+ let password_too_weak: string;
+ }
+ namespace helper {
+ let login_1: string;
+ export { login_1 as login };
+ let signup_1: string;
+ export { signup_1 as signup };
+ let reset_password_1: string;
+ export { reset_password_1 as reset_password };
+ let set_new_password_1: string;
+ export { set_new_password_1 as set_new_password };
+ }
+ namespace message {
+ let resource_show_forbidden: string;
+ let resource_edit_forbidden: string;
+ let resource_delete_forbidden: string;
+ let resource_control_forbidden: string;
+ let container_create_forbidden: string;
+ let container_list_forbidden: string;
+ let unable_to_fetch_user_data: string;
+ let no_token_returned: string;
+ let invalid_token_returned: string;
+ let signup_error: string;
+ let user_not_allowed_to_login: string;
+ let user_email_not_found: string;
+ let user_email_exist: string;
+ let username_exist: string;
+ let username_invalid: string;
+ let new_user_created: string;
+ let user_connected: string;
+ let user_disconnected: string;
+ let bad_request: string;
+ let account_settings_updated: string;
+ let login_to_continue: string;
+ let choose_pod_provider: string;
+ }
+ namespace notification {
+ let reset_password_submitted: string;
+ let reset_password_error: string;
+ let password_changed: string;
+ let new_password_error: string;
+ let invalid_password: string;
+ let get_settings_error: string;
+ let update_settings_error: string;
+ }
}
- namespace right {
- namespace resource {
- let read: string;
- let append: string;
- let write: string;
- let control: string;
- }
- namespace container {
- let read_1: string;
- export { read_1 as read };
- let append_1: string;
- export { append_1 as append };
- let write_1: string;
- export { write_1 as write };
- let control_1: string;
- export { control_1 as control };
- }
- }
- namespace agent {
- let anonymous: string;
- let authenticated: string;
- }
- namespace input {
- let agent_select: string;
- let name: string;
- let username: string;
- let email: string;
- let username_or_email: string;
- let current_password: string;
- let new_password: string;
- let confirm_new_password: string;
- let password_strength: string;
- let password_too_weak: string;
- }
- namespace helper {
- let login_1: string;
- export { login_1 as login };
- let signup_1: string;
- export { signup_1 as signup };
- let reset_password_1: string;
- export { reset_password_1 as reset_password };
- let set_new_password_1: string;
- export { set_new_password_1 as set_new_password };
- }
- namespace message {
- let resource_show_forbidden: string;
- let resource_edit_forbidden: string;
- let resource_delete_forbidden: string;
- let resource_control_forbidden: string;
- let container_create_forbidden: string;
- let container_list_forbidden: string;
- let unable_to_fetch_user_data: string;
- let no_token_returned: string;
- let invalid_token_returned: string;
- let signup_error: string;
- let user_not_allowed_to_login: string;
- let user_email_not_found: string;
- let user_email_exist: string;
- let username_exist: string;
- let username_invalid: string;
- let new_user_created: string;
- let user_connected: string;
- let user_disconnected: string;
- let bad_request: string;
- let account_settings_updated: string;
- let login_to_continue: string;
- let choose_pod_provider: string;
- }
- namespace notification {
- let reset_password_submitted: string;
- let reset_password_error: string;
- let password_changed: string;
- let new_password_error: string;
- let invalid_password: string;
- let get_settings_error: string;
- let update_settings_error: string;
- }
- }
}
declare namespace frenchMessages {
- namespace auth {
- namespace dialog {
- let container_permissions: string;
- let resource_permissions: string;
- let login_required: string;
- }
- namespace action {
- let submit: string;
- let permissions: string;
- let signup: string;
- let reset_password: string;
- let set_new_password: string;
- let logout: string;
- let login: string;
- let view_my_profile: string;
- let edit_my_profile: string;
- }
- namespace right {
- namespace resource {
- let read: string;
- let append: string;
- let write: string;
- let control: string;
- }
- namespace container {
- let read_1: string;
- export { read_1 as read };
- let append_1: string;
- export { append_1 as append };
- let write_1: string;
- export { write_1 as write };
- let control_1: string;
- export { control_1 as control };
- }
- }
- namespace agent {
- let anonymous: string;
- let authenticated: string;
- }
- namespace input {
- let agent_select: string;
- let name: string;
- let username: string;
- let email: string;
- let username_or_email: string;
- let current_password: string;
- let new_password: string;
- let confirm_new_password: string;
- let password_strength: string;
- let password_too_weak: string;
- }
- namespace helper {
- let login_1: string;
- export { login_1 as login };
- let signup_1: string;
- export { signup_1 as signup };
- let reset_password_1: string;
- export { reset_password_1 as reset_password };
- let set_new_password_1: string;
- export { set_new_password_1 as set_new_password };
- }
- namespace message {
- let resource_show_forbidden: string;
- let resource_edit_forbidden: string;
- let resource_delete_forbidden: string;
- let resource_control_forbidden: string;
- let container_create_forbidden: string;
- let container_list_forbidden: string;
- let unable_to_fetch_user_data: string;
- let no_token_returned: string;
- let invalid_token_returned: string;
- let signup_error: string;
- let user_not_allowed_to_login: string;
- let user_email_not_found: string;
- let user_email_exist: string;
- let username_exist: string;
- let username_invalid: string;
- let new_user_created: string;
- let user_connected: string;
- let user_disconnected: string;
- let bad_request: string;
- let account_settings_updated: string;
- let login_to_continue: string;
- let choose_pod_provider: string;
- }
- namespace notification {
- let reset_password_submitted: string;
- let reset_password_error: string;
- let password_changed: string;
- let new_password_error: string;
- let invalid_password: string;
- let get_settings_error: string;
- let update_settings_error: string;
+ namespace auth {
+ namespace dialog {
+ let container_permissions: string;
+ let resource_permissions: string;
+ let login_required: string;
+ }
+ namespace action {
+ let submit: string;
+ let permissions: string;
+ let signup: string;
+ let reset_password: string;
+ let set_new_password: string;
+ let logout: string;
+ let login: string;
+ let view_my_profile: string;
+ let edit_my_profile: string;
+ }
+ namespace right {
+ namespace resource {
+ let read: string;
+ let append: string;
+ let write: string;
+ let control: string;
+ }
+ namespace container {
+ let read_1: string;
+ export { read_1 as read };
+ let append_1: string;
+ export { append_1 as append };
+ let write_1: string;
+ export { write_1 as write };
+ let control_1: string;
+ export { control_1 as control };
+ }
+ }
+ namespace agent {
+ let anonymous: string;
+ let authenticated: string;
+ }
+ namespace input {
+ let agent_select: string;
+ let name: string;
+ let username: string;
+ let email: string;
+ let username_or_email: string;
+ let current_password: string;
+ let new_password: string;
+ let confirm_new_password: string;
+ let password_strength: string;
+ let password_too_weak: string;
+ }
+ namespace helper {
+ let login_1: string;
+ export { login_1 as login };
+ let signup_1: string;
+ export { signup_1 as signup };
+ let reset_password_1: string;
+ export { reset_password_1 as reset_password };
+ let set_new_password_1: string;
+ export { set_new_password_1 as set_new_password };
+ }
+ namespace message {
+ let resource_show_forbidden: string;
+ let resource_edit_forbidden: string;
+ let resource_delete_forbidden: string;
+ let resource_control_forbidden: string;
+ let container_create_forbidden: string;
+ let container_list_forbidden: string;
+ let unable_to_fetch_user_data: string;
+ let no_token_returned: string;
+ let invalid_token_returned: string;
+ let signup_error: string;
+ let user_not_allowed_to_login: string;
+ let user_email_not_found: string;
+ let user_email_exist: string;
+ let username_exist: string;
+ let username_invalid: string;
+ let new_user_created: string;
+ let user_connected: string;
+ let user_disconnected: string;
+ let bad_request: string;
+ let account_settings_updated: string;
+ let login_to_continue: string;
+ let choose_pod_provider: string;
+ }
+ namespace notification {
+ let reset_password_submitted: string;
+ let reset_password_error: string;
+ let password_changed: string;
+ let new_password_error: string;
+ let invalid_password: string;
+ let get_settings_error: string;
+ let update_settings_error: string;
+ }
}
- }
}
//# sourceMappingURL=index.d.ts.map
diff --git a/src/frontend/packages/semantic-data-provider/dist/index.cjs.js b/src/frontend/packages/semantic-data-provider/dist/index.cjs.js
index 7e2363444..3c5a55775 100644
--- a/src/frontend/packages/semantic-data-provider/dist/index.cjs.js
+++ b/src/frontend/packages/semantic-data-provider/dist/index.cjs.js
@@ -31,6 +31,9 @@ $parcel$export(module.exports, "useDataServers", () => $c9933a88e2acc4da$export$
$parcel$export(module.exports, "FilterHandler", () => $f763906f9b20f2d8$export$2e2bcd8739ae039);
$parcel$export(module.exports, "GroupedReferenceHandler", () => $b4703fef6d6af456$export$2e2bcd8739ae039);
$parcel$export(module.exports, "ReificationArrayInput", () => $030f1232f6810456$export$2e2bcd8739ae039);
+$parcel$export(module.exports, "createWsChannel", () => $84ab912646919f8c$export$28772ab4c256e709);
+$parcel$export(module.exports, "getOrCreateWsChannel", () => $84ab912646919f8c$export$8d60734939c59ced);
+$parcel$export(module.exports, "createSolidNotificationChannel", () => $84ab912646919f8c$export$3edfe18db119b920);
const $3db7a4510a668a04$var$fetchResource = async (resourceUri, config)=>{
@@ -1565,5 +1568,96 @@ var $030f1232f6810456$export$2e2bcd8739ae039 = $030f1232f6810456$var$Reification
+/**
+ * Find the solid notification description resource for a given resource URI.
+ */ const $84ab912646919f8c$var$findDescriptionResource = async (fetch, resourceUri)=>{
+ const { headers: headers } = await fetch(resourceUri, {
+ method: "HEAD"
+ });
+ const linkHeader = headers.get("Link");
+ const matches = linkHeader?.match(/<([^>]+)>;\s*rel="(?:describedby|http:\/\/www\.w3\.org\/ns\/solid\/terms#storageDescription)"/);
+ if (!matches?.[1]) return undefined;
+ const { json: descriptionResource } = await fetch(matches[1]);
+ return descriptionResource;
+};
+const $84ab912646919f8c$export$3edfe18db119b920 = async (fetch, resourceUri, options = {
+ type: "WebSocketChannel2023"
+})=>{
+ const { type: type, closeAfter: closeAfter, startIn: startIn, rate: rate } = options;
+ let { startAt: startAt, endAt: endAt } = options;
+ if (startIn && !startAt) startAt = new Date(Date.now() + startIn).toISOString();
+ if (closeAfter && !endAt) endAt = new Date(Date.now() + closeAfter).toISOString();
+ const descriptionResource = await $84ab912646919f8c$var$findDescriptionResource(fetch, resourceUri);
+ // TODO: use a json-ld parser / ldo in the future for this...
+ // Get solid notification subscription service for the given type.
+ const subscriptionService = (await Promise.all(// Get the subscription service resources (that describe a channel type).
+ (0, $e6fbab1f303bdb93$export$2e2bcd8739ae039)(descriptionResource.subscription || descriptionResource["notify:subscription"]).map(async (subscriptionServiceOrUri)=>{
+ // They might not be resolved...
+ if (typeof subscriptionServiceOrUri === "string") {
+ const { json: json } = await fetch(subscriptionServiceOrUri);
+ return json;
+ }
+ return subscriptionServiceOrUri;
+ }))).find((service)=>{
+ // Find for the correct channel type (e.g. web socket).
+ const channelType = service.channelType ?? service["notify:channelType"];
+ return channelType === type || channelType === `notify:${type}`;
+ });
+ if (!subscriptionService) throw new Error(`No solid notification subscription service found for type ${type}`);
+ // Create a new channel.
+ const { json: channel } = await fetch(subscriptionService.id || subscriptionService["@id"], {
+ method: "POST",
+ body: JSON.stringify({
+ "@context": "https://www.w3.org/ns/solid/notification/v1",
+ type: "WebSocketChannel2023",
+ topic: resourceUri,
+ startAt: startAt,
+ endAt: endAt,
+ rate: rate
+ })
+ });
+ return channel;
+};
+const $84ab912646919f8c$export$28772ab4c256e709 = async (fetch, resourceUri, options)=>{
+ const channel = await $84ab912646919f8c$export$3edfe18db119b920(fetch, resourceUri, options);
+ const receiveFrom = channel.receiveFrom || channel["notify:receiveFrom"];
+ return new WebSocket(receiveFrom);
+};
+const $84ab912646919f8c$var$registeredWebSockets = new Map();
+/**
+ * @param fetch A react admin fetch function.
+ * @param resourceUri The resource to subscribe to
+ * @param options Options to pass to @see createSolidNotificationChannel, if the channel does not exist yet.
+ * @returns {WebSocket} A new or existing web socket that subscribed to the given resource.
+ */ const $84ab912646919f8c$export$8d60734939c59ced = async (fetch, resourceUri, options = {
+ type: "WebSocketChannel2023",
+ closeAfter: 3600000
+})=>{
+ const socket = $84ab912646919f8c$var$registeredWebSockets.get(resourceUri);
+ if (socket) // Will resolve or is resolved already.
+ return socket;
+ // Create a promise, to return immediately and set the sockets cache.
+ // This prevents racing conditions that create multiple channels.
+ const wsPromise = $84ab912646919f8c$export$28772ab4c256e709(fetch, resourceUri, {
+ ...options,
+ type: "WebSocketChannel2023"
+ }).then((ws)=>{
+ // Remove the promise from the cache, if it closes.
+ ws.addEventListener("close", (e)=>{
+ $84ab912646919f8c$var$registeredWebSockets.delete(resourceUri);
+ });
+ // Close the socket, if the endAt / closeAfter time is reached.
+ const closeIn = options.closeAfter ?? (options.endAt && new Date(options.endAt).getTime() - Date.now());
+ if (closeIn) setTimeout(()=>{
+ ws.close();
+ }, closeIn);
+ return ws;
+ });
+ $84ab912646919f8c$var$registeredWebSockets.set(resourceUri, wsPromise);
+ return wsPromise;
+};
+
+
+
//# sourceMappingURL=index.cjs.js.map
diff --git a/src/frontend/packages/semantic-data-provider/dist/index.cjs.js.map b/src/frontend/packages/semantic-data-provider/dist/index.cjs.js.map
index fa128c5b5..7e4097c7a 100644
--- a/src/frontend/packages/semantic-data-provider/dist/index.cjs.js.map
+++ b/src/frontend/packages/semantic-data-provider/dist/index.cjs.js.map
@@ -1 +1 @@
-{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIEA,MAAM,sCAAgB,OAAO,aAAa;IACxC,MAAM,cAAE,UAAU,eAAE,WAAW,EAAE,GAAG;IAEpC,IAAI,EAAE,MAAM,IAAI,EAAE,GAAG,MAAM,WAAW;IAEtC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAAC;IAE7D,KAAK,EAAE,GAAG,KAAK,EAAE,IAAI,IAAI,CAAC,MAAM;IAEhC,sFAAsF;IACtF,gDAAgD;IAChD,IAAI,IAAI,CAAC,WAAW,KAAK,aACvB,OAAO,MAAM,CAAA,GAAA,uCAAK,EAAE,OAAO,CAAC,MAAM;IAGpC,OAAO;AACT;IAEA,2CAAe;;;ADlBf,MAAM,qCAAe,CAAA,SAAU,OAAO,YAAY;QAChD,MAAM,aAAE,SAAS,EAAE,GAAG;QACtB,MAAM,YAAY,SAAS,CAAC,WAAW;QAEvC,IAAI,CAAC,WAAW,MAAM,IAAI,MAAM,CAAC,SAAS,EAAE,WAAW,gCAAgC,CAAC;QAExF,MAAM,OAAO,MAAM,CAAA,GAAA,wCAAY,EAAE,OAAO,EAAE,EAAE;QAE5C,yDAAyD;QACzD,IAAI,UAAU,IAAI,EAAE,YAAY;YAC9B,KAAK,MAAM,kBAAkB,UAAU,IAAI,EAAE,cAAc,EAAE,CAC3D,IAAI,IAAI,CAAC,eAAe,IAAI,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,eAAe,GAC7D,IAAI,CAAC,eAAe,GAAG;gBAAC,IAAI,CAAC,eAAe;aAAC;QAGnD;QAEA,wCAAwC;QACxC,0CAA0C;QAC1C,2DAA2D;QAC3D,WAAW;QACX,sBAAsB;QACtB,0CAA0C;QAC1C,sCA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kB;IAExB,qBACE,gCAAC,CAAA,GAAA,4BAAS;QAAG,GAAG,UAAU;kBACxB,cAAA,iCAAC,CAAA,GAAA,oCAAiB;YAAE,SAAS;gBAAE,MAAM,gBAAgB,IAAI;YAAC;;gBACvD,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,QAAQ,EAAE,CAAC,OAAO;oBAC1C,qBAAO,CAAA,GAAA,sCAAI,EAAE,YAAY,CAAC,OAAO;wBAC/B,WAAW,gBAAgB,KAAK;oBAClC;gBACF;8BACA,gCAAC,CAAA,GAAA,2BAAQ;oBAAE,WAAW,gBAAgB,IAAI;oBAAE,QAAO;oBAAO,cAAc;;;;;AAIhF;IAEA,2CAAe;;","sources":["packages/semantic-data-provider/src/index.ts","packages/semantic-data-provider/src/dataProvider/dataProvider.js","packages/semantic-data-provider/src/dataProvider/methods/create.js","packages/semantic-data-provider/src/dataProvider/methods/getOne.js","packages/semantic-data-provider/src/dataProvider/utils/fetchResource.js","packages/semantic-data-provider/src/dataProvider/utils/handleFiles.ts","packages/semantic-data-provider/src/dataProvider/utils/findContainersWithTypes.ts","packages/semantic-data-provider/src/dataProvider/utils/parseServerKeys.js","packages/semantic-data-provider/src/dataProvider/utils/getServerKeyFromType.js","packages/semantic-data-provider/src/dataProvider/methods/delete.ts","packages/semantic-data-provider/src/dataProvider/methods/deleteMany.js","packages/semantic-data-provider/src/dataProvider/methods/getDataServers.js","packages/semantic-data-provider/src/dataProvider/methods/getDataModels.js","packages/semantic-data-provider/src/dataProvider/methods/getList.js","packages/semantic-data-provider/src/dataProvider/utils/fetchContainers.ts","packages/semantic-data-provider/src/dataProvider/utils/arrayOf.ts","packages/semantic-data-provider/src/dataProvider/utils/fetchSparqlEndpoints.js","packages/semantic-data-provider/src/dataProvider/utils/getEmbedFrame.js","packages/semantic-data-provider/src/dataProvider/utils/buildSparqlQuery.js","packages/semantic-data-provider/src/dataProvider/utils/buildBaseQuery.js","packages/semantic-data-provider/src/dataProvider/utils/resolvePrefix.js","packages/semantic-data-provider/src/dataProvider/utils/buildBlankNodesQuery.js","packages/semantic-data-provider/src/dataProvider/utils/buildAutoDetectBlankNodesQuery.js","packages/semantic-data-provider/src/dataProvider/utils/findContainersWithPath.js","packages/semantic-data-provider/src/dataProvider/methods/getMany.js","packages/semantic-data-provider/src/dataProvider/methods/getManyReference.js","packages/semantic-data-provider/src/dataProvider/methods/update.ts","packages/semantic-data-provider/src/dataProvider/utils/fetchUserConfig.js","packages/semantic-data-provider/src/dataProvider/utils/fetchVoidEndpoints.js","packages/semantic-data-provider/src/dataProvider/httpClient.js","packages/semantic-data-provider/src/dataProvider/utils/getServerKeyFromUri.js","packages/semantic-data-provider/src/hooks/useGetExternalLink.js","packages/semantic-data-provider/src/hooks/useContainers.ts","packages/semantic-data-provider/src/hooks/useDataModel.ts","packages/semantic-data-provider/src/hooks/useDataServers.ts","packages/semantic-data-provider/src/hooks/useCreateContainer.js","packages/semantic-data-provider/src/dataProvider/utils/findCreateContainerWithTypes.ts","packages/semantic-data-provider/src/hooks/useCreateContainerUri.ts","packages/semantic-data-provider/src/hooks/useDataModels.ts","packages/semantic-data-provider/src/reification/FilterHandler.js","packages/semantic-data-provider/src/reification/GroupedReferenceHandler.js","packages/semantic-data-provider/src/reification/ReificationArrayInput.js"],"sourcesContent":["export { default as dataProvider } from './dataProvider/dataProvider';\n\nexport { default as buildSparqlQuery } from './dataProvider/utils/buildSparqlQuery';\nexport { default as buildBlankNodesQuery } from './dataProvider/utils/buildBlankNodesQuery';\n\nexport { default as useGetExternalLink } from './hooks/useGetExternalLink';\nexport { default as useContainers } from './hooks/useContainers';\nexport { default as useCreateContainer } from './hooks/useCreateContainer';\nexport { default as useCreateContainerUri } from './hooks/useCreateContainerUri';\nexport { default as useDataModel } from './hooks/useDataModel';\nexport { default as useDataModels } from './hooks/useDataModels';\nexport { default as useDataServers } from './hooks/useDataServers';\n\nexport { default as FilterHandler } from './reification/FilterHandler';\nexport { default as GroupedReferenceHandler } from './reification/GroupedReferenceHandler';\nexport { default as ReificationArrayInput } from './reification/ReificationArrayInput';\n","import createMethod from './methods/create';\nimport deleteMethod from './methods/delete';\nimport deleteManyMethod from './methods/deleteMany';\nimport getDataServersMethod from './methods/getDataServers';\nimport getDataModelsMethod from './methods/getDataModels';\nimport getListMethod from './methods/getList';\nimport getManyMethod from './methods/getMany';\nimport getManyReferenceMethod from './methods/getManyReference';\nimport getOneMethod from './methods/getOne';\nimport updateMethod from './methods/update';\nimport fetchUserConfig from './utils/fetchUserConfig';\nimport fetchVoidEndpoints from './utils/fetchVoidEndpoints';\nimport getServerKeyFromType from './utils/getServerKeyFromType';\nimport httpClient from './httpClient';\n\nconst dataProvider = config => {\n // TODO verify all data provider config + data models\n if (!getServerKeyFromType('default', config.dataServers))\n throw new Error('You must define a default server in your dataServers config');\n\n if (!config.jsonContext) config.jsonContext = Object.fromEntries(config.ontologies.map(o => [o.prefix, o.url]));\n if (!config.returnFailedResources) config.returnFailedResources = false;\n\n // Configure httpClient with data servers (this is needed for proxy calls)\n config.httpClient = httpClient(config.dataServers);\n\n // Keep in memory for refresh\n const originalConfig = { ...config };\n\n let fetchUserConfigPromise = fetchUserConfig(config);\n let fetchVoidEndpointsPromise = fetchVoidEndpoints(config);\n\n const waitForConfig =\n method =>\n async (...arg) => {\n await fetchUserConfigPromise;\n await fetchVoidEndpointsPromise; // Return immediately if promise is fulfilled\n return await method(...arg);\n };\n\n return {\n getList: waitForConfig(getListMethod(config)),\n getMany: waitForConfig(getManyMethod(config)),\n getManyReference: waitForConfig(getManyReferenceMethod(config)),\n getOne: waitForConfig(getOneMethod(config)),\n create: waitForConfig(createMethod(config)),\n update: waitForConfig(updateMethod(config)),\n updateMany: () => {\n throw new Error('updateMany is not implemented yet');\n },\n delete: waitForConfig(deleteMethod(config)),\n deleteMany: waitForConfig(deleteManyMethod(config)),\n // Custom methods\n getDataModels: waitForConfig(getDataModelsMethod(config)),\n getDataServers: waitForConfig(getDataServersMethod(config)),\n getLocalDataServers: getDataServersMethod(config),\n fetch: waitForConfig(config.httpClient),\n refreshConfig: async () => {\n config = { ...originalConfig };\n fetchUserConfigPromise = fetchUserConfig(config);\n fetchVoidEndpointsPromise = fetchVoidEndpoints(config);\n await fetchUserConfigPromise;\n await fetchVoidEndpointsPromise;\n return config;\n }\n };\n};\n\nexport default dataProvider;\n","import urlJoin from 'url-join';\nimport getOne from './getOne';\nimport handleFiles from '../utils/handleFiles';\nimport findContainersWithTypes from '../utils/findContainersWithTypes';\n\nconst createMethod = config => async (resourceId, params) => {\n const { dataServers, resources, httpClient, jsonContext } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) Error(`Resource ${resourceId} is not mapped in resources file`);\n\n const headers = new Headers();\n\n let containerUri;\n let serverKey;\n if (dataModel.create?.container) {\n serverKey = Object.keys(dataModel.create.container)[0];\n containerUri = urlJoin(dataServers[serverKey].baseUrl, Object.values(dataModel.create.container)[0]);\n } else {\n serverKey = dataModel.create?.server || Object.keys(dataServers).find(key => dataServers[key].default === true);\n if (!serverKey) throw new Error('You must define a server for the creation, or a container, or a default server');\n\n const containers = findContainersWithTypes(dataModel.types, [serverKey], dataServers);\n // Extract the containerUri from the results (and ensure there is only one)\n const serverKeys = Object.keys(containers);\n\n if (!serverKeys || serverKeys.length === 0)\n throw new Error(`No container with types ${JSON.stringify(dataModel.types)} found on server ${serverKey}`);\n if (serverKeys.length > 1 || containers[serverKeys[0]].length > 1)\n throw new Error(\n `More than one container detected with types ${JSON.stringify(dataModel.types)} on server ${serverKey}`\n );\n containerUri = containers[serverKeys[0]][0];\n }\n\n if (params.data) {\n if (dataModel.fieldsMapping?.title) {\n if (Array.isArray(dataModel.fieldsMapping.title)) {\n headers.set('Slug', dataModel.fieldsMapping.title.map(f => params.data[f]).join(' '));\n } else {\n headers.set('Slug', params.data[dataModel.fieldsMapping.title]);\n }\n }\n\n // Upload files, if there are any\n const { updatedRecord } = await handleFiles.upload(params.data, config);\n params.data = updatedRecord;\n\n const { headers: responseHeaders } = await httpClient(containerUri, {\n method: 'POST',\n headers,\n body: JSON.stringify({\n '@context': jsonContext,\n '@type': dataModel.types,\n ...params.data\n })\n });\n\n // Retrieve newly-created resource\n const resourceUri = responseHeaders.get('Location');\n return await getOne(config)(resourceId, { id: resourceUri });\n }\n if (params.id) {\n headers.set('Content-Type', 'application/sparql-update');\n\n await httpClient(containerUri, {\n method: 'PATCH',\n headers,\n body: `\n PREFIX ldp: \n INSERT DATA { <${containerUri}> ldp:contains <${params.id}>. };\n `\n });\n\n // Create must return the new data, so get them from the remote URI\n return await getOne(config)(resourceId, { id: params.id });\n }\n};\n\nexport default createMethod;\n","import fetchResource from '../utils/fetchResource';\n\nconst getOneMethod = config => async (resourceId, params) => {\n const { resources } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) throw new Error(`Resource ${resourceId} is not mapped in resources file`);\n\n const data = await fetchResource(params.id, config);\n\n // Transform single value into array if forceArray is set\n if (dataModel.list?.forceArray) {\n for (const forceArrayItem of dataModel.list?.forceArray || []) {\n if (data[forceArrayItem] && !Array.isArray(data[forceArrayItem])) {\n data[forceArrayItem] = [data[forceArrayItem]];\n }\n }\n }\n\n // TODO activate defaultFetchPlan option\n // if (dataModel.list?.defaultFetchPlan) {\n // for (const node of dataModel.list?.defaultFetchPlan) {\n // if (\n // data[node] &&\n // typeof data[node] === 'string' &&\n // data[node].startsWith('http')\n // ) {\n // try {\n // const dataToEmbed = await fetchResource(data[node], config);\n // delete dataToEmbed['@context'];\n // data[node] = dataToEmbed;\n // } catch (e) {\n // // Ignore errors (this may happen if user does not have rights to see the resource)\n // }\n // }\n // }\n // }\n\n return { data };\n};\n\nexport default getOneMethod;\n","import jsonld from 'jsonld';\n\nconst fetchResource = async (resourceUri, config) => {\n const { httpClient, jsonContext } = config;\n\n let { json: data } = await httpClient(resourceUri);\n\n if (!data) throw new Error(`Not a valid JSON: ${resourceUri}`);\n\n data.id = data.id || data['@id'];\n\n // We compact only if the context is different between the frontend and the middleware\n // TODO deep compare if the context is an object\n if (data['@context'] !== jsonContext) {\n data = await jsonld.compact(data, jsonContext);\n }\n\n return data;\n};\n\nexport default fetchResource;\n","import urlJoin from 'url-join';\nimport { RaRecord } from 'react-admin';\nimport { Configuration } from '../types';\n\nconst isFile = (o: any): o is { rawFile: File } => o?.rawFile && o.rawFile instanceof File;\nconst isFileToDelete = (o: any): o is { fileToDelete: string } =>\n o?.fileToDelete !== undefined && o?.fileToDelete !== null;\n\nconst getUploadsContainerUri = (config: Configuration) => {\n const serverKey = Object.keys(config.dataServers).find(key => config.dataServers[key].uploadsContainer);\n if (serverKey && config.dataServers[serverKey].uploadsContainer) {\n return urlJoin(config.dataServers[serverKey].baseUrl, config.dataServers[serverKey].uploadsContainer!);\n }\n return null;\n};\n\nconst uploadFile = async (rawFile: File, config: Configuration) => {\n const uploadsContainerUri = getUploadsContainerUri(config);\n if (!uploadsContainerUri) throw new Error(\"You must define an uploadsContainer in one of the server's configuration\");\n\n const response = await config.httpClient(uploadsContainerUri, {\n method: 'POST',\n body: rawFile,\n headers: new Headers({\n 'Content-Type': rawFile.type\n })\n });\n\n if (response.status === 201) {\n return response.headers.get('Location');\n }\n return null;\n};\n\nconst deleteFiles = async (filesToDelete: string[], config: Configuration) => {\n return Promise.all(\n filesToDelete.map(file =>\n config.httpClient(file, {\n method: 'DELETE'\n })\n )\n );\n};\n\n/*\n * Look for raw files in the record data.\n * If there are any, upload them and replace the file by its URL.\n */\nconst uploadAllFiles = async (record: Partial, config: Configuration) => {\n const filesToDelete: string[] = [];\n const updatedRecord = { ...record };\n\n for (const property of Object.keys(record)) {\n const value = record[property];\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const itemValue = value[i];\n if (isFile(itemValue)) {\n if (isFileToDelete(itemValue)) {\n filesToDelete.push(itemValue.fileToDelete);\n }\n updatedRecord[property][i] = await uploadFile(itemValue.rawFile, config);\n } else if (isFileToDelete(itemValue)) {\n filesToDelete.push(itemValue.fileToDelete);\n updatedRecord[property][i] = null;\n }\n }\n } else if (isFile(value)) {\n if (isFileToDelete(value)) {\n filesToDelete.push(value.fileToDelete);\n }\n updatedRecord[property] = await uploadFile(value.rawFile, config);\n } else if (isFileToDelete(value)) {\n filesToDelete.push(value.fileToDelete);\n updatedRecord[property] = null;\n }\n }\n\n return {\n updatedRecord,\n filesToDelete\n };\n};\n\nexport default {\n upload: uploadAllFiles,\n delete: deleteFiles\n};\n","import urlJoin from 'url-join';\nimport { Configuration, DataServerKey } from '../types';\nimport parseServerKeys from './parseServerKeys';\n\nconst findContainersWithTypes = (\n types: string[],\n serverKeys: string | string[] | undefined,\n dataServers: Configuration['dataServers']\n) => {\n const containers = {} as Record;\n const existingContainers: string[] = [];\n\n const parsedServerKeys = parseServerKeys(serverKeys, dataServers);\n\n Object.keys(dataServers)\n .filter(dataServerKey => dataServers[dataServerKey].containers)\n .forEach(dataServerKey => {\n Object.keys(dataServers[dataServerKey].containers || {}).forEach(containerKey => {\n if (!parsedServerKeys || parsedServerKeys.includes(containerKey)) {\n Object.keys(dataServers[dataServerKey].containers![containerKey]).forEach(type => {\n if (types.includes(type)) {\n dataServers[dataServerKey].containers![containerKey][type].map(path => {\n const containerUri = urlJoin(dataServers[containerKey].baseUrl, path);\n\n // Avoid returning the same container several times\n if (!existingContainers.includes(containerUri)) {\n existingContainers.push(containerUri);\n\n if (!containers[dataServerKey]) containers[dataServerKey] = [];\n containers[dataServerKey].push(containerUri);\n }\n });\n }\n });\n }\n });\n });\n return containers;\n};\n\nexport default findContainersWithTypes;\n","import getServerKeyFromType from './getServerKeyFromType';\n\nconst parseServerKey = (serverKey, dataServers) => {\n switch (serverKey) {\n case '@default':\n return getServerKeyFromType('default', dataServers);\n case '@pod':\n return getServerKeyFromType('pod', dataServers);\n case '@authServer':\n return getServerKeyFromType('authServer', dataServers);\n default:\n return serverKey;\n }\n};\n\n// Return the list of servers keys in an array\n// parsing keywords like @all, @default, @pod and @authServer\nconst parseServerKeys = (serverKeys, dataServers) => {\n if (Array.isArray(serverKeys)) {\n if (serverKeys.includes('@all')) {\n return Object.keys(dataServers);\n }\n return serverKeys.map(serverKey => parseServerKey(serverKey, dataServers));\n }\n if (typeof serverKeys === 'string') {\n if (serverKeys === '@all') {\n return Object.keys(dataServers);\n }\n if (serverKeys === '@remote') {\n const defaultServerKey = getServerKeyFromType('default', dataServers);\n return Object.keys(dataServers).filter(serverKey => serverKey !== defaultServerKey);\n }\n return [parseServerKey(serverKeys, dataServers)];\n }\n // If server key is empty\n return false;\n};\n\nexport default parseServerKeys;\n","const getServerKeyFromType = (type, dataServers) => {\n return Object.keys(dataServers).find(key => {\n return dataServers[key][type];\n });\n};\n\nexport default getServerKeyFromType;\n","import { DeleteParams, RaRecord } from 'react-admin';\nimport { Configuration } from '../types';\nimport handleFiles from '../utils/handleFiles';\n\nconst deleteMethod = (config: Configuration) => async (resourceId: string, params: DeleteParams) => {\n const { httpClient } = config;\n\n await httpClient(`${params.id}`, {\n method: 'DELETE'\n });\n\n if (params.meta?.filesToDelete) {\n await handleFiles.delete(params.meta.filesToDelete, config);\n }\n\n return { data: { id: params.id } };\n};\n\nexport default deleteMethod;\n","const deleteManyMethod = config => async (resourceId, params) => {\n const { httpClient } = config;\n const ids = [];\n\n for (const id of params.ids) {\n try {\n await httpClient(id, {\n method: 'DELETE'\n });\n ids.push(id);\n } catch (e) {\n // Do nothing if we fail to delete a resource\n }\n }\n\n return { data: ids };\n};\n\nexport default deleteManyMethod;\n","const getDataServers = config => () => {\n return config.dataServers;\n};\n\nexport default getDataServers;\n","const getDataModels = config => () => {\n return config.resources;\n};\n\nexport default getDataModels;\n","import findContainersWithTypes from '../utils/findContainersWithTypes';\nimport fetchContainers from '../utils/fetchContainers';\nimport fetchSparqlEndpoints from '../utils/fetchSparqlEndpoints';\nimport findContainersWithPaths from '../utils/findContainersWithPath';\n\nconst getListMethod =\n config =>\n async (resourceId, params = {}) => {\n const { dataServers, resources } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) throw new Error(`Resource ${resourceId} is not mapped in resources file`);\n\n let containers;\n if (!params.filter?._servers && dataModel.list?.containers) {\n if (Array.isArray(dataModel.list?.containers))\n throw new Error(\n `The list.containers property of ${resourceId} dataModel must be of type object ({ serverKey: [containerUri] })`\n );\n // If containers are set explicitly, use them\n containers = findContainersWithPaths(dataModel.list.containers, dataServers);\n } else {\n // Otherwise find the container URIs on the given servers (either in the filter or the data model)\n containers = findContainersWithTypes(\n dataModel.types,\n params.filter?._servers || dataModel.list?.servers,\n dataServers\n );\n }\n\n if (dataModel.list?.fetchContainer) {\n return fetchContainers(containers, params, config);\n }\n return fetchSparqlEndpoints(containers, resourceId, params, config);\n };\n\nexport default getListMethod;\n","import jsonld, { ContextDefinition } from 'jsonld';\nimport { GetListParams } from 'react-admin';\nimport arrayOf from './arrayOf';\nimport { Configuration, ContainerURI, DataServerKey } from '../types';\n\ntype LDPContainerType = 'ldp:Container' | 'ldp:BasicContainer';\n\ninterface LDPContainerBase {\n '@context': Configuration['jsonContext'];\n id: string;\n 'ldp:contains': Record[];\n}\n\ninterface LDPContainerWithType extends LDPContainerBase {\n type: LDPContainerType | LDPContainerType[];\n}\n\ninterface LDPContainerWithAtType extends LDPContainerBase {\n '@type': LDPContainerType | LDPContainerType[];\n}\n\ntype LDPContainer = LDPContainerWithType | LDPContainerWithAtType;\n\ntype LDPResource = {\n '@context': Configuration['jsonContext'];\n [key: string]: any;\n};\n\ntype ListFilters = Partial<{\n q: string;\n type: string;\n _predicates: string[];\n _servers: DataServerKey[];\n [attribute: string]: any;\n}>;\n\nconst isValidLDPContainer = (container: LDPContainer) => {\n const resourceType = (container as LDPContainerWithType).type || (container as LDPContainerWithAtType)['@type'];\n return Array.isArray(resourceType) ? resourceType.includes('ldp:Container') : resourceType === 'ldp:Container';\n};\n\nconst isObject = (val: any) => {\n return val != null && typeof val === 'object' && !Array.isArray(val);\n};\n\nconst fetchContainers = async (\n containers: Record,\n params: GetListParams,\n { httpClient, jsonContext }: Configuration\n) => {\n const containersUri = Object.values(containers).flat();\n\n const fetchPromises = containersUri.map(containerUri =>\n httpClient(containerUri)\n .then(async ({ json }) => {\n const jsonResponse: LDPContainer = json;\n\n // If container's context is different, compact it to have an uniform result\n // TODO deep compare if the context is an object\n if (jsonResponse['@context'] !== jsonContext) {\n return jsonld.compact(jsonResponse, jsonContext as ContextDefinition) as unknown as Promise;\n }\n\n return jsonResponse;\n })\n .then((json: LDPContainer) => {\n if (!isValidLDPContainer(json)) {\n throw new Error(`${containerUri} is not a LDP container`);\n }\n\n return arrayOf(json['ldp:contains']).map(resource => ({\n '@context': json['@context'],\n ...resource\n }));\n })\n );\n\n // Fetch simultaneously all containers\n const results = await Promise.all(fetchPromises);\n let resources = results.flat();\n\n resources = resources.map(resource => {\n resource.id = resource.id || resource['@id'];\n return resource;\n });\n\n // Apply filter to results\n const filters: ListFilters = params.filter;\n\n // For SPARQL queries, we use \"a\" to filter types, but in containers it must be \"type\"\n if (filters.a) {\n filters.type = filters.a;\n delete filters.a;\n }\n\n // Filter resources attributes according to _predicates list\n if (filters._predicates && Array.isArray(filters._predicates)) {\n const predicates = filters._predicates;\n const mandatoryAttributes = ['id'];\n\n resources = resources.map(resource => {\n return Object.keys(resource)\n .filter(key => predicates.includes(key) || mandatoryAttributes.includes(key))\n .reduce(\n (filteredResource, key) => {\n filteredResource[key] = resource[key];\n return filteredResource;\n },\n { '@context': [] }\n );\n });\n }\n\n if (Object.keys(filters).filter(f => !['_predicates', '_servers'].includes(f)).length > 0) {\n resources = resources.filter(resource => {\n // Full text filtering\n if (filters.q) {\n return Object.values(resource).some(attributeValue => {\n if (!isObject(attributeValue)) {\n const arrayValues = Array.isArray(attributeValue) ? attributeValue : [attributeValue];\n return arrayValues.some(value => {\n if (typeof value === 'string') {\n return value.toLowerCase().normalize('NFD').includes(filters.q!.toLowerCase().normalize('NFD'));\n }\n return false;\n });\n }\n return false;\n });\n }\n\n // Attribute filtering\n const attributesFilters = Object.keys(filters).filter(f => !['_predicates', '_servers', 'q'].includes(f));\n\n return attributesFilters.every(attribute => {\n if (resource[attribute]) {\n const arrayValues: any[] = Array.isArray(resource[attribute]) ? resource[attribute] : [resource[attribute]];\n return arrayValues.some(\n (value: any) => typeof value === 'string' && value.includes(filters[attribute] as string)\n );\n }\n\n return false;\n });\n });\n }\n\n // Sorting\n if (params.sort) {\n resources = resources.sort((a, b) => {\n if (a[params.sort.field] && b[params.sort.field]) {\n if (params.sort.order === 'ASC') {\n return a[params.sort.field].localeCompare(b[params.sort.field]);\n }\n return b[params.sort.field].localeCompare(a[params.sort.field]);\n }\n return true;\n });\n }\n\n // Pagination\n const total = resources.length;\n\n if (params.pagination) {\n resources = resources.slice(\n (params.pagination.page - 1) * params.pagination.perPage,\n params.pagination.page * params.pagination.perPage\n );\n }\n\n return { data: resources, total };\n};\n\nexport default fetchContainers;\n","const arrayOf = (value: T | T[]) => {\n // If the field is null-ish, we suppose there are no values.\n if (!value) {\n return [];\n }\n // Return as is.\n if (Array.isArray(value)) {\n return value;\n }\n // Single value is made an array.\n return [value];\n};\n\nexport default arrayOf;\n","import jsonld from 'jsonld';\nimport getEmbedFrame from './getEmbedFrame';\nimport buildSparqlQuery from './buildSparqlQuery';\n\nconst compare = (a, b) => {\n switch (typeof a) {\n case 'string':\n return a.localeCompare(b);\n case 'number':\n case 'bigint':\n return a - b;\n default:\n return 0;\n }\n};\n\nconst fetchSparqlEndpoints = async (containers, resourceId, params, config) => {\n const { dataServers, resources, httpClient, jsonContext, ontologies } = config;\n const dataModel = resources[resourceId];\n\n const sparqlQueryPromises = Object.keys(containers).map(\n serverKey =>\n new Promise((resolve, reject) => {\n const blankNodes = params.filter?.blankNodes || dataModel.list?.blankNodes;\n\n // When the SPARQL request comes from the browser's URL, it comes as JSON string which must must be parsed\n if (\n params.filter?.sparqlWhere &&\n (typeof params.filter.sparqlWhere === 'string' || params.filter.sparqlWhere instanceof String)\n ) {\n params.filter.sparqlWhere = JSON.parse(decodeURIComponent(params.filter.sparqlWhere));\n }\n const sparqlQuery = buildSparqlQuery({\n containers: containers[serverKey],\n params,\n dataModel,\n ontologies\n });\n\n httpClient(dataServers[serverKey].sparqlEndpoint, {\n method: 'POST',\n body: sparqlQuery\n })\n .then(({ json }) => {\n // If we declared the blank nodes to dereference, embed only those blank nodes\n // This solve problems which can occur when same-type resources are embedded in other resources\n // To increase performances, you can set explicitEmbedOnFraming to false (make sure the result is still OK)\n const frame =\n blankNodes && dataModel.list?.explicitEmbedOnFraming !== false\n ? {\n '@context': jsonContext,\n '@type': dataModel.types,\n '@embed': '@never',\n ...getEmbedFrame(blankNodes)\n }\n : {\n '@context': jsonContext,\n '@type': dataModel.types\n };\n\n // omitGraph option force results to be in a @graph, even if we have a single result\n return jsonld.frame(json, frame, { omitGraph: false });\n })\n .then(compactJson => {\n if (compactJson['@id']) {\n const { '@context': context, ...rest } = compactJson;\n compactJson = {\n '@context': context,\n '@graph': [rest]\n };\n }\n resolve(\n compactJson['@graph'].map(resource => ({ '@context': compactJson['@context'], ...resource })) || []\n );\n })\n .catch(e => reject(e));\n })\n );\n\n // Run simultaneous SPARQL queries\n let results = await Promise.all(sparqlQueryPromises);\n\n if (results.length === 0) {\n return { data: [], total: 0 };\n }\n // Merge all results in one array\n results = [].concat(...results);\n\n // Add id in addition to @id, as this is what React-Admin expects\n let returnData = results.map(item => {\n item.id = item.id || item['@id'];\n return item;\n });\n\n // TODO sort and paginate the results in the SPARQL query to improve performances\n if (params.sort) {\n returnData = returnData.sort((a, b) => {\n if (a[params.sort.field] !== undefined && b[params.sort.field] !== undefined) {\n if (params.sort.order === 'ASC') {\n return compare(a[params.sort.field], b[params.sort.field]);\n }\n return compare(b[params.sort.field], a[params.sort.field]);\n }\n return 0;\n });\n }\n if (params.pagination) {\n returnData = returnData.slice(\n (params.pagination.page - 1) * params.pagination.perPage,\n params.pagination.page * params.pagination.perPage\n );\n }\n\n return { data: returnData, total: results.length };\n};\n\nexport default fetchSparqlEndpoints;\n","const getEmbedFrame = blankNodes => {\n let embedFrame = {};\n let predicates;\n if (blankNodes) {\n for (const blankNode of blankNodes) {\n if (blankNode.includes('/')) {\n predicates = blankNode.split('/').reverse();\n } else {\n predicates = [blankNode];\n }\n embedFrame = {\n ...embedFrame,\n ...predicates.reduce(\n (accumulator, predicate) => ({\n [predicate]: {\n '@embed': '@last',\n ...accumulator\n }\n }),\n {}\n )\n };\n }\n return embedFrame;\n }\n};\n\nexport default getEmbedFrame;\n","import DataFactory from '@rdfjs/data-model';\nimport buildBaseQuery from './buildBaseQuery';\nimport buildBlankNodesQuery from './buildBlankNodesQuery';\nimport buildAutoDetectBlankNodesQuery from './buildAutoDetectBlankNodesQuery';\nimport resolvePrefix from './resolvePrefix';\n\nconst SparqlGenerator = require('sparqljs').Generator;\n\nconst { literal, namedNode, triple, variable } = DataFactory;\n\nconst generator = new SparqlGenerator({\n /* prefixes, baseIRI, factory, sparqlStar */\n});\n\nconst reservedFilterKeys = ['q', 'sparqlWhere', 'blankNodes', 'blankNodesDepth', '_servers', '_predicates'];\n\nconst buildSparqlQuery = ({ containers, params, dataModel, ontologies }) => {\n const blankNodes = params.filter?.blankNodes || dataModel.list?.blankNodes;\n const predicates = params.filter?._predicates || dataModel.list?.predicates;\n const blankNodesDepth = params.filter?.blankNodesDepth ?? dataModel.list?.blankNodesDepth ?? 2;\n const filter = { ...dataModel.list?.filter, ...params.filter };\n const baseQuery = buildBaseQuery(predicates, ontologies);\n\n const sparqlJsParams = {\n queryType: 'CONSTRUCT',\n template: baseQuery.construct,\n where: [],\n type: 'query',\n prefixes: Object.fromEntries(ontologies.map(ontology => [ontology.prefix, ontology.url]))\n };\n\n const containerWhere = [\n {\n type: 'values',\n values: containers.map(containerUri => ({ '?containerUri': namedNode(containerUri) }))\n },\n triple(variable('containerUri'), namedNode('http://www.w3.org/ns/ldp#contains'), variable('s1')),\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isiri',\n args: [variable('s1')]\n }\n }\n ];\n\n let resourceWhere = [];\n\n if (filter && Object.keys(filter).length > 0) {\n const hasSPARQLFilter = filter.sparqlWhere && Object.keys(filter.sparqlWhere).length > 0;\n const hasFullTextSearch = filter.q && filter.q.length > 0;\n\n if (hasSPARQLFilter) {\n /*\n Example of usage :\n {\n \"sparqlWhere\": {\n \"type\": \"bgp\",\n \"triples\": [{\n \"subject\": {\"termType\": \"Variable\", \"value\": \"s1\"},\n \"predicate\": {\"termType\": \"NameNode\", \"value\": \"http://virtual-assembly.org/ontologies/pair#label\"},\n \"object\": {\"termType\": \"Literal\", \"value\": \"My Organization\"}\n }]\n }\n }\n */\n // initialize array in case of single value :\n [].concat(filter.sparqlWhere).forEach(sw => {\n resourceWhere.push(sw);\n });\n }\n\n if (hasFullTextSearch) {\n resourceWhere.push({\n type: 'group',\n patterns: [\n {\n queryType: 'SELECT',\n variables: [variable('s1')],\n where: [\n triple(variable('s1'), variable('p1'), variable('o1')),\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isliteral',\n args: [variable('o1')]\n }\n },\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'regex',\n args: [\n {\n type: 'operation',\n operator: 'lcase',\n args: [\n {\n type: 'operation',\n operator: 'str',\n args: [variable('o1')]\n }\n ]\n },\n literal(filter.q.toLowerCase(), '', namedNode('http://www.w3.org/2001/XMLSchema#string'))\n ]\n }\n }\n ],\n type: 'query'\n }\n ]\n });\n }\n\n // Other filters\n // SPARQL keyword a = filter based on the class of a resource (example => 'a': 'pair:OrganizationType')\n // Other filters are based on a value (example => 'petr:hasAudience': 'http://localhost:3000/audiences/tout-public')\n Object.entries(filter).forEach(([predicate, object]) => {\n if (!reservedFilterKeys.includes(predicate)) {\n resourceWhere.unshift(\n triple(\n variable('s1'),\n namedNode(resolvePrefix(predicate, ontologies)),\n namedNode(resolvePrefix(object, ontologies))\n )\n );\n }\n });\n }\n\n // Blank nodes\n const blankNodesQuery = blankNodes\n ? buildBlankNodesQuery(blankNodes, baseQuery, ontologies)\n : buildAutoDetectBlankNodesQuery(blankNodesDepth, baseQuery);\n\n if (blankNodesQuery && blankNodesQuery.construct) {\n resourceWhere = resourceWhere.concat(blankNodesQuery.where);\n sparqlJsParams.template = sparqlJsParams.template.concat(blankNodesQuery.construct);\n } else {\n resourceWhere.push(baseQuery.where);\n }\n\n sparqlJsParams.where.push(\n {\n type: 'union',\n patterns: [\n containerWhere,\n {\n type: 'graph',\n name: namedNode('http://semapps.org/mirror'),\n patterns: containerWhere\n }\n ]\n },\n {\n type: 'union',\n patterns: [\n resourceWhere,\n {\n type: 'graph',\n name: namedNode('http://semapps.org/mirror'),\n patterns: resourceWhere\n }\n ]\n }\n );\n\n return generator.stringify(sparqlJsParams);\n};\n\nexport default buildSparqlQuery;\n","import { namedNode, triple, variable } from '@rdfjs/data-model';\nimport resolvePrefix from './resolvePrefix';\n\nconst defaultToArray = value => (!value ? [] : Array.isArray(value) ? value : [value]);\n\n// We need to always include the type or React-Admin will not work properly\nconst typeQuery = triple(\n variable('s1'),\n namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),\n variable('type')\n);\n\nconst buildBaseQuery = (predicates, ontologies) => {\n let baseTriples;\n if (predicates) {\n baseTriples = defaultToArray(predicates).map((predicate, i) =>\n triple(variable('s1'), namedNode(resolvePrefix(predicate, ontologies)), variable(`o${i + 1}`))\n );\n return {\n construct: [typeQuery, ...baseTriples],\n where: [typeQuery, ...baseTriples.map(triple => ({ type: 'optional', patterns: [triple] }))]\n };\n }\n baseTriples = [triple(variable('s1'), variable('p1'), variable('o1'))];\n return {\n construct: baseTriples,\n where: baseTriples\n };\n};\n\nexport default buildBaseQuery;\n","const resolvePrefix = (item, ontologies) => {\n if (item.startsWith('http://') || item.startsWith('https://')) {\n // Already resolved, return the URI\n return item;\n }\n if (item === 'a') {\n // Special case\n return 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type';\n }\n const [prefix, value] = item.split(':');\n if (value) {\n const ontology = ontologies.find(ontology => ontology.prefix === prefix);\n if (ontology) {\n return ontology.url + value;\n }\n throw new Error(`No ontology found with prefix ${prefix}`);\n } else {\n throw new Error(`The value \"${item}\" is not correct. It must include a prefix or be a full URI.`);\n }\n};\n\nexport default resolvePrefix;\n","import md5 from 'crypto-js/md5';\nimport { namedNode, triple, variable } from '@rdfjs/data-model';\nimport resolvePrefix from './resolvePrefix';\n\n// Transform ['ont:predicate1/ont:predicate2'] to ['ont:predicate1', 'ont:predicate1/ont:predicate2']\nconst extractNodes = blankNodes => {\n const nodes = [];\n if (blankNodes) {\n for (const predicate of blankNodes) {\n if (predicate.includes('/')) {\n const nodeNames = predicate.split('/');\n for (let i = 1; i <= nodeNames.length; i++) {\n nodes.push(nodeNames.slice(0, i).join('/'));\n }\n } else {\n nodes.push(predicate);\n }\n }\n }\n return nodes;\n};\n\nconst generateSparqlVarName = node => md5(node);\n\nconst getParentNode = node => node.includes('/') && node.split('/')[0];\n\nconst getPredicate = node => (node.includes('/') ? node.split('/')[1] : node);\n\nconst buildUnionQuery = queries =>\n queries.map(q => {\n let triples = q.query;\n const firstTriple = queries.find(q2 => q.parentNode === q2.node);\n if (firstTriple !== undefined) {\n triples = triples.concat(firstTriple.query[0]);\n }\n return {\n type: 'bgp',\n triples\n };\n });\n\nconst buildBlankNodesQuery = (blankNodes, baseQuery, ontologies) => {\n const queries = [];\n const nodes = extractNodes(blankNodes);\n\n if (nodes && ontologies && ontologies.length > 0) {\n for (const node of nodes) {\n const parentNode = getParentNode(node);\n const predicate = getPredicate(node);\n const varName = generateSparqlVarName(node);\n const parentVarName = parentNode ? generateSparqlVarName(parentNode) : '1';\n\n const query = [\n triple(variable(`s${parentVarName}`), namedNode(resolvePrefix(predicate, ontologies)), variable(`s${varName}`)),\n triple(variable(`s${varName}`), variable(`p${varName}`), variable(`o${varName}`))\n ];\n\n queries.push({\n node,\n parentNode,\n query,\n filter: '' // `FILTER(isBLANK(?s${varName})) .`\n });\n }\n\n return {\n construct: queries.length > 0 ? queries.map(q => q.query).reduce((pre, cur) => pre.concat(cur)) : null,\n where: {\n type: 'union',\n patterns: [baseQuery.where, ...buildUnionQuery(queries)]\n }\n };\n }\n return {\n construct: '',\n where: ''\n };\n};\n\nexport default buildBlankNodesQuery;\n","import { triple, variable } from '@rdfjs/data-model';\n\nconst buildAutoDetectBlankNodesQuery = (depth, baseQuery) => {\n const construct = [...baseQuery.construct];\n let where = {};\n if (depth > 0) {\n const whereQueries = [];\n whereQueries.push([baseQuery.where]);\n for (let i = 1; i <= depth; i++) {\n construct.push(triple(variable(`o${i}`), variable(`p${i + 1}`), variable(`o${i + 1}`)));\n whereQueries.push([\n ...whereQueries[whereQueries.length - 1],\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isblank',\n args: [variable(`o${i}`)]\n }\n },\n triple(variable(`o${i}`), variable(`p${i + 1}`), variable(`o${i + 1}`))\n ]);\n }\n where = {\n type: 'union',\n patterns: whereQueries\n };\n } else if (depth === 0) {\n where = baseQuery.where;\n } else {\n throw new Error('The depth of buildAutoDetectBlankNodesQuery should be 0 or more');\n }\n\n return { construct, where };\n};\n\nexport default buildAutoDetectBlankNodesQuery;\n","import urlJoin from 'url-join';\n\nconst findContainersWithPaths = (paths, dataServers) => {\n const containers = {};\n Object.keys(paths).forEach(serverKey => {\n if (dataServers[serverKey]) {\n containers[serverKey] = [];\n paths[serverKey].forEach(path => {\n containers[serverKey].push(urlJoin(dataServers[serverKey].baseUrl, path));\n });\n } else {\n throw new Error(`No server found with key ${serverKey}`);\n }\n });\n return containers;\n};\n\nexport default findContainersWithPaths;\n","import getOne from './getOne';\n\nconst getManyMethod = config => async (resourceId, params) => {\n const { returnFailedResources } = config;\n\n let returnData = await Promise.all(\n params.ids.map(id =>\n getOne(config)(resourceId, { id: typeof id === 'object' ? id['@id'] : id })\n .then(({ data }) => data)\n .catch(() => {\n // Catch if one resource fails to load\n // Otherwise no references will be show if only one is missing\n // See https://github.com/marmelab/react-admin/issues/5190\n if (returnFailedResources) {\n return { id, _error: true };\n }\n // Returning nothing\n })\n )\n );\n\n // We don't want undefined results to appear in the results as it will break with react-admin\n returnData = returnData.filter(e => e);\n\n return { data: returnData };\n};\n\nexport default getManyMethod;\n","import getList from './getList';\n\nconst getManyReferenceMethod = config => async (resourceId, params) => {\n params.filter = { ...params.filter, [params.target]: params.id };\n delete params.target;\n return await getList(config)(resourceId, params);\n};\n\nexport default getManyReferenceMethod;\n","import { RaRecord, UpdateParams } from 'react-admin';\nimport { Configuration } from '../types';\nimport handleFiles from '../utils/handleFiles';\n\nconst updateMethod = (config: Configuration) => async (resourceId: string, params: UpdateParams) => {\n const { httpClient, jsonContext } = config;\n\n // Upload files, if there are any\n const { updatedRecord, filesToDelete } = await handleFiles.upload(params.data, config);\n params.data = updatedRecord;\n\n await httpClient(`${params.id}`, {\n method: 'PUT',\n body: JSON.stringify({\n '@context': jsonContext,\n ...params.data\n })\n });\n\n // Delete files only if update is successful\n await handleFiles.delete(filesToDelete, config);\n\n return { data: params.data };\n};\n\nexport default updateMethod;\n","import jwtDecode from 'jwt-decode';\nimport urlJoin from 'url-join';\nimport getServerKeyFromType from './getServerKeyFromType';\n\nconst fetchUserConfig = async config => {\n const { dataServers, httpClient } = config;\n const token = localStorage.getItem('token');\n const podKey = getServerKeyFromType('pod', dataServers);\n const authServerKey = getServerKeyFromType('authServer', dataServers);\n\n // If the user is logged in\n if (token) {\n const payload = jwtDecode(token);\n const webId = payload.webId || payload.webid; // Currently we must deal with both formats\n let userData;\n\n try {\n const { json } = await httpClient(webId);\n userData = json;\n } catch (e) {\n console.error(e);\n // If the webId cannot be fetched, assume an invalid token and disconnect the user\n localStorage.clear();\n window.location.reload();\n return;\n }\n\n // If we have a POD server\n if (podKey) {\n // Fill the config provided to the data provider\n // We must modify the config object directly\n config.dataServers[podKey].name = 'My Pod';\n config.dataServers[podKey].baseUrl = urlJoin(webId, 'data'); // TODO find POD URI from user profile\n config.dataServers[podKey].sparqlEndpoint =\n userData.endpoints?.['void:sparqlEndpoint'] || urlJoin(webId, 'sparql');\n }\n\n if (authServerKey) {\n // Fill the config provided to the data provider\n // We must modify the config object directly\n config.dataServers[authServerKey].proxyUrl = userData.endpoints?.proxyUrl;\n }\n } else if (podKey) {\n // If the user is not logged in, ignore the POD server\n delete config.dataServers[podKey];\n }\n};\n\nexport default fetchUserConfig;\n","const defaultToArray = value => (!value ? undefined : Array.isArray(value) ? value : [value]);\n\nconst fetchVoidEndpoints = async config => {\n const fetchPromises = Object.entries(config.dataServers)\n .filter(([key, server]) => server.pod !== true && server.void !== false)\n .map(([key, server]) =>\n config\n .httpClient(new URL('/.well-known/void', server.baseUrl).toString())\n .then(result => ({ key, datasets: result.json['@graph'] }))\n .catch(e => {\n if (e.status === 404 || e.status === 401 || e.status === 500) {\n return { key, error: e };\n }\n throw e;\n })\n );\n\n let results = [];\n\n try {\n results = await Promise.all(fetchPromises);\n } catch (e) {\n // Do not throw error if no endpoint found\n }\n\n for (const result of results) {\n config.dataServers[result.key].containers = config.dataServers[result.key].containers || {};\n config.dataServers[result.key].blankNodes = config.dataServers[result.key].blankNodes || {};\n\n // Ignore unfetchable endpoints\n if (result.datasets) {\n for (const dataset of result.datasets) {\n const datasetServerKey = Object.keys(config.dataServers).find(\n key => dataset['void:uriSpace'] === config.dataServers[key].baseUrl\n );\n\n // If the dataset is not part of a server mapped in the dataServers, ignore it\n if (datasetServerKey) {\n // If this is the local dataset, add the base information\n if (datasetServerKey === result.key) {\n config.dataServers[result.key].name = config.dataServers[result.key].name || dataset['dc:title'];\n config.dataServers[result.key].description =\n config.dataServers[result.key].description || dataset['dc:description'];\n config.dataServers[result.key].sparqlEndpoint =\n config.dataServers[result.key].sparqlEndpoint || dataset['void:sparqlEndpoint'];\n }\n\n config.dataServers[result.key].containers[datasetServerKey] =\n config.dataServers[result.key].containers[datasetServerKey] || {};\n\n for (const partition of defaultToArray(dataset['void:classPartition'])) {\n for (const type of defaultToArray(partition['void:class'])) {\n // Set containers by type\n const path = partition['void:uriSpace'].replace(dataset['void:uriSpace'], '/');\n if (config.dataServers[result.key].containers[datasetServerKey][type]) {\n config.dataServers[result.key].containers[datasetServerKey][type].push(path);\n } else {\n config.dataServers[result.key].containers[datasetServerKey][type] = [path];\n }\n }\n }\n }\n }\n }\n }\n};\n\nexport default fetchVoidEndpoints;\n","import { fetchUtils } from 'react-admin';\nimport getServerKeyFromUri from './utils/getServerKeyFromUri';\nimport getServerKeyFromType from './utils/getServerKeyFromType';\n\n/*\n * HTTP client used by all calls in data provider and auth provider\n * Do proxy calls if a proxy endpoint is available and the server is different from the auth server\n */\nconst httpClient =\n dataServers =>\n (url, options = {}) => {\n const authServerKey = getServerKeyFromType('authServer', dataServers);\n const serverKey = getServerKeyFromUri(url, dataServers);\n const useProxy =\n serverKey !== authServerKey && dataServers[authServerKey]?.proxyUrl && dataServers[serverKey]?.noProxy !== true;\n\n if (!options.headers) options.headers = new Headers();\n\n switch (options.method) {\n case 'POST':\n case 'PATCH':\n case 'PUT':\n if (!options.headers.has('Accept')) options.headers.set('Accept', 'application/ld+json');\n if (!options.headers.has('Content-Type')) options.headers.set('Content-Type', 'application/ld+json');\n break;\n\n case 'DELETE':\n break;\n\n case 'GET':\n default:\n if (!options.headers.has('Accept')) options.headers.set('Accept', 'application/ld+json');\n break;\n }\n\n if (useProxy) {\n const formData = new FormData();\n\n formData.append('id', url);\n formData.append('method', options.method || 'GET');\n formData.append('headers', JSON.stringify(Object.fromEntries(options.headers.entries())));\n\n if (options.body) {\n if (options.body instanceof File) {\n formData.append('body', options.body, options.body.name);\n } else {\n formData.append('body', options.body);\n }\n }\n\n // Post to proxy endpoint with multipart/form-data format\n return fetchUtils.fetchJson(dataServers[authServerKey].proxyUrl, {\n method: 'POST',\n headers: new Headers({\n Authorization: `Bearer ${localStorage.getItem('token')}`\n }),\n body: formData\n });\n }\n // Add token if the server is the same as the auth server\n if (serverKey === authServerKey) {\n const token = localStorage.getItem('token');\n if (token) options.headers.set('Authorization', `Bearer ${token}`);\n }\n return fetchUtils.fetchJson(url, options);\n };\n\nexport default httpClient;\n","// Return the first server matching with the baseUrl\nconst getServerKeyFromUri = (uri, dataServers) => {\n if (!uri) throw Error(`No URI provided to getServerKeyFromUri`);\n return Object.keys(dataServers).find(key => {\n if (dataServers[key].pod) {\n // The baseUrl ends with /data so remove this part to match with the webId and webId-related URLs (/inbox, /outbox...)\n return dataServers[key].baseUrl && uri.startsWith(dataServers[key].baseUrl.replace('/data', ''));\n }\n return uri.startsWith(dataServers[key].baseUrl);\n });\n};\n\nexport default getServerKeyFromUri;\n","import { useCallback, useMemo, useContext } from 'react';\nimport { DataProviderContext } from 'react-admin';\n\nconst compute = (externalLinks, record) =>\n typeof externalLinks === 'function' ? externalLinks(record) : externalLinks;\nconst isURL = url => typeof url === 'string' && url.startsWith('http');\n\nconst useGetExternalLink = componentExternalLinks => {\n // Since the externalLinks config is defined only locally, we don't need to wait for VOID endpoints fetching\n const dataProvider = useContext(DataProviderContext);\n const dataServers = dataProvider.getLocalDataServers();\n\n const serversExternalLinks = useMemo(() => {\n if (dataServers) {\n return Object.fromEntries(\n Object.values(dataServers).map(server => {\n // If externalLinks is not defined in the data server, use external links for non-default servers\n const externalLinks = server.externalLinks !== undefined ? server.externalLinks : !server.default;\n return [server.baseUrl, externalLinks];\n })\n );\n }\n }, [dataServers]);\n\n return useCallback(\n record => {\n const computedComponentExternalLinks = compute(componentExternalLinks, record);\n // If the component explicitly asks not to display as external links, use an internal link\n if (computedComponentExternalLinks === false) return false;\n\n if (!record?.id) return false;\n\n const serverBaseUrl = Object.keys(serversExternalLinks).find(baseUrl => record?.id.startsWith(baseUrl));\n // If no matching data servers could be found, assume we have an internal link\n if (!serverBaseUrl) return false;\n\n const computedServerExternalLinks = compute(serversExternalLinks[serverBaseUrl], record);\n // If the data server explicitly asks not to display as external links, use an internal link\n if (computedServerExternalLinks === false) return false;\n\n if (isURL(computedComponentExternalLinks)) {\n return computedComponentExternalLinks;\n }\n if (isURL(computedServerExternalLinks)) {\n return computedServerExternalLinks;\n }\n return record.id;\n },\n [serversExternalLinks, componentExternalLinks]\n );\n};\n\nexport default useGetExternalLink;\n","import { useState, useEffect } from 'react';\nimport useDataModel from './useDataModel';\nimport useDataServers from './useDataServers';\nimport findContainersWithTypes from '../dataProvider/utils/findContainersWithTypes';\nimport { DataServerKey } from '../dataProvider/types';\n\nconst useContainers = (resourceId: string, serverKeys = '@all') => {\n const dataModel = useDataModel(resourceId);\n const dataServers = useDataServers();\n const [containers, setContainers] = useState>();\n\n useEffect(() => {\n if (dataModel && dataServers) {\n setContainers(findContainersWithTypes(dataModel.types, serverKeys, dataServers));\n }\n }, [dataModel, dataServers, serverKeys]);\n\n return containers;\n};\n\nexport default useContainers;\n","import { useContext, useState, useEffect } from 'react';\nimport { DataProviderContext } from 'react-admin';\n\nconst useDataModel = (resourceId: string) => {\n // Get the raw data provider, since useDataProvider returns a wrapper\n const dataProvider = useContext(DataProviderContext);\n const [dataModel, setDataModel] = useState(undefined); // TODO: Type this object\n\n useEffect(() => {\n dataProvider.getDataModels().then((results: any) => setDataModel(results[resourceId]));\n }, [dataProvider, resourceId, setDataModel]);\n\n return dataModel;\n};\n\nexport default useDataModel;\n","import { useState, useEffect } from 'react';\nimport { useDataProvider } from 'react-admin';\nimport { DataProvider, DataServersConfig } from '../dataProvider/types';\n\nconst useDataServers = () => {\n const dataProvider = useDataProvider();\n const [dataServers, setDataServers] = useState();\n\n useEffect(() => {\n dataProvider.getDataServers().then(results => {\n setDataServers(results);\n });\n }, [dataProvider, setDataServers]);\n\n return dataServers;\n};\n\nexport default useDataServers;\n","import { useState, useEffect } from 'react';\nimport urlJoin from 'url-join';\nimport useDataModel from './useDataModel';\nimport useDataServers from './useDataServers';\nimport findCreateContainerWithTypes from '../dataProvider/utils/findCreateContainerWithTypes';\nimport getServerKeyFromType from '../dataProvider/utils/getServerKeyFromType';\n\n/** @deprecated Use \"useCreateContainerUri\" instead */\nconst useCreateContainer = resourceId => {\n const dataModel = useDataModel(resourceId);\n const dataServers = useDataServers();\n const [createContainer, setCreateContainer] = useState();\n\n useEffect(() => {\n if (dataModel && dataServers) {\n if (dataModel.create?.container) {\n const [serverKey, path] = Object.entries(dataModel.create.container)[0];\n if (!serverKey || !dataServers[serverKey]) {\n throw new Error(`Wrong key for the dataModel.create.container config of resource ${resourceId}`);\n }\n setCreateContainer(urlJoin(dataServers[serverKey].baseUrl, path));\n } else if (dataModel.create?.server) {\n setCreateContainer(findCreateContainerWithTypes(dataModel.types, dataModel.create?.server, dataServers));\n } else {\n const defaultServerKey = getServerKeyFromType('default', dataServers);\n setCreateContainer(findCreateContainerWithTypes(dataModel.types, defaultServerKey, dataServers));\n }\n }\n }, [dataModel, dataServers, setCreateContainer]);\n\n return createContainer;\n};\n\nexport default useCreateContainer;\n","import urlJoin from 'url-join';\nimport { DataModel, DataServerKey, DataServersConfig } from '../types';\n\nconst findCreateContainerWithTypes = (\n types: DataModel['types'],\n createServerKey: DataServerKey,\n dataServers: DataServersConfig\n) => {\n const containers: string[] = [];\n\n Object.keys(dataServers[createServerKey].containers?.[createServerKey] || {}).forEach(type => {\n if (types.includes(type)) {\n dataServers[createServerKey].containers![createServerKey][type].forEach(path => {\n const containerUri = urlJoin(dataServers[createServerKey].baseUrl, path);\n if (!containers.includes(containerUri)) {\n containers.push(containerUri);\n }\n });\n }\n });\n\n if (containers.length === 0) {\n throw new Error(\n `No container found matching with types ${JSON.stringify(\n types\n )}. You can set explicitely the create.container property of the resource.`\n );\n } else if (containers.length > 1) {\n throw new Error(\n `More than one container found matching with types ${JSON.stringify(\n types\n )}. You must set the create.server or create.container property for the resource.`\n );\n }\n\n return containers[0];\n};\n\nexport default findCreateContainerWithTypes;\n","import { useCallback } from 'react';\nimport urlJoin from 'url-join';\nimport useDataServers from './useDataServers';\nimport findCreateContainerWithTypes from '../dataProvider/utils/findCreateContainerWithTypes';\nimport getServerKeyFromType from '../dataProvider/utils/getServerKeyFromType';\nimport useDataModels from './useDataModels';\n\nconst useCreateContainerUri = () => {\n const dataModels = useDataModels();\n const dataServers = useDataServers();\n\n const getContainerUri = useCallback(\n (resourceId: string) => {\n if (!dataModels || !dataServers || !dataModels[resourceId]) {\n return undefined;\n }\n\n const dataModel = dataModels[resourceId];\n\n if (dataModel.create?.container) {\n const [serverKey, path] = Object.entries(dataModel.create.container)[0];\n if (!serverKey || !dataServers[serverKey]) {\n throw new Error(`Wrong key for the dataModel.create.container config of resource ${resourceId}`);\n }\n return urlJoin(dataServers[serverKey].baseUrl, path);\n }\n\n if (dataModel.create?.server) {\n return findCreateContainerWithTypes(dataModel.types, dataModel.create?.server, dataServers);\n }\n\n const defaultServerKey = getServerKeyFromType('default', dataServers);\n\n if (!defaultServerKey) {\n throw new Error(\n `No default dataServer found. You can set explicitly one setting the \"default\" attribute to true`\n );\n }\n\n return findCreateContainerWithTypes(dataModel.types, defaultServerKey, dataServers);\n },\n [dataModels, dataServers]\n );\n\n return getContainerUri;\n};\n\nexport default useCreateContainerUri;\n","import { useState, useEffect } from 'react';\nimport { useDataProvider } from 'react-admin';\nimport { DataModel, DataProvider } from '../dataProvider/types';\n\nconst useDataModels = () => {\n const dataProvider = useDataProvider();\n const [dataModels, setDataModels] = useState>();\n\n useEffect(() => {\n dataProvider.getDataModels().then(results => {\n setDataModels(results);\n });\n }, [dataProvider, setDataModels]);\n\n return dataModels;\n};\n\nexport default useDataModels;\n","import React, { useState, useEffect } from 'react';\n\n/**\n * @example\n * \n * \n * \n * \n * \n * \n */\n\nconst FilterHandler = ({ children, record, filter, source, ...otherProps }) => {\n const [filtered, setFiltered] = useState();\n useEffect(() => {\n if (record && source && Array.isArray(record?.[source])) {\n const filteredData = record?.[source].filter(r => {\n let eq = true;\n for (const key in filter) {\n const value = r[key];\n if (Array.isArray(value)) {\n if (!value.includes(filter[key])) {\n eq = false;\n }\n } else if (value !== filter[key]) {\n eq = false;\n }\n }\n return eq;\n });\n const newRecord = {\n ...record\n };\n // undefined setted if no data to obtain no render in RightLabel or equivalent\n newRecord[source] = filteredData.length > 0 ? filteredData : undefined;\n setFiltered(newRecord);\n }\n }, [record, source, filter]);\n\n return (\n <>\n {React.Children.map(children, (child, i) => {\n return React.cloneElement(child, {\n ...otherProps,\n record: filtered,\n source\n });\n })}\n >\n );\n};\nexport default FilterHandler;\n","import React from 'react';\nimport { useGetList, useRecordContext } from 'react-admin';\nimport { default as FilterHandler } from './FilterHandler';\n\n/*\n * @example Label used in examples\n * const Label = ({label, ...otherProps})=>{\n * return
{label}
\n * }\n *\n * @example show header for each group with group property thanks to groupHeader\n * }\n * filterProperty=\"property of source filtered by groupReference\"\n * >\n * // same props as GroupedArrayField source\n * \n * \n * \n * \n *\n * @example call chhildren with label thanks to groupLabel\n * \n * \n *\n * @example conditional show of group if no data in source. Conditionale groupHeader is not possible because GroupedArrayField define group before filter ; need use chhildren.\n * const ConditionalSourceDefinedHandler = ({record,source,children,...otherProps})=>{\n * if (record?.[source] && (!Array.isArray(record[source])||record[source].length>0)){\n * return React.Children.map(children, (child, i) => {\n * return React.cloneElement(child, {...otherProps,record,source});\n * })\n * }else{\n * return <>>\n * }\n * }\n *\n * \n * \n * \n * \n *\n *\n */\nconst GroupedReferenceHandler = ({\n children,\n groupReference,\n groupLabel,\n groupHeader,\n filterProperty,\n ...otherProps\n}) => {\n const record = useRecordContext();\n const { data } = useGetList(groupReference);\n\n return (\n <>\n {data?.map((data, index) => {\n const filter = {};\n filter[filterProperty] = data.id;\n return (\n <>\n {groupHeader && groupHeader({ ...otherProps, group: data })}\n \n {children}\n \n >\n );\n })}\n >\n );\n};\n\nexport default GroupedReferenceHandler;\n","import React, { useEffect, useState } from 'react';\nimport { ArrayInput, SimpleFormIterator, TextInput } from 'react-admin';\nimport makeStyles from '@mui/styles/makeStyles';\n\nconst useReferenceInputStyles = makeStyles({\n form: {\n display: 'flex'\n },\n input: {\n paddingRight: '20px'\n }\n});\n\nconst useHideInputStyles = makeStyles({\n root: {\n display: 'none'\n }\n});\n\nconst ReificationArrayInput = props => {\n const { reificationClass, children, ...otherProps } = props;\n const flexFormClasses = useReferenceInputStyles();\n const hideInputStyles = useHideInputStyles();\n\n return (\n \n \n {React.Children.map(props.children, (child, i) => {\n return React.cloneElement(child, {\n className: flexFormClasses.input\n });\n })}\n \n \n \n );\n};\n\nexport default ReificationArrayInput;\n"],"names":[],"version":3,"file":"index.cjs.js.map"}
\ No newline at end of file
+{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIEA,MAAM,sCAAgB,OAAO,aAAa;IACxC,MAAM,cAAE,UAAU,eAAE,WAAW,EAAE,GAAG;IAEpC,IAAI,EAAE,MAAM,IAAI,EAAE,GAAG,MAAM,WAAW;IAEtC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAAC;IAE7D,KAAK,EAAE,GAAG,KAAK,EAAE,IAAI,IAAI,CAAC,MAAM;IAEhC,sFAAsF;IACtF,gDAAgD;IAChD,IAAI,IAAI,CAAC,WAAW,KAAK,aACvB,OAAO,MAAM,CAAA,GAAA,uCAAK,EAAE,OAAO,CAAC,MAAM;IAGpC,OAAO;AACT;IAEA,2CAAe;;;ADlBf,MAAM,qCAAe,CAAA,SAAU,OAAO,YAAY;QAChD,MAAM,aAAE,SAAS,EAAE,GAAG;QACtB,MAAM,YAAY,SAAS,CAAC,WAAW;QAEvC,IAAI,CAAC,WAAW,MAAM,IAAI,MAAM,CAAC,SAAS,EAAE,WAAW,gCAAgC,CAAC;QAExF,MAAM,OAAO,MAAM,CAAA,GAAA,wCAAY,EAAE,OAAO,EAAE,EAAE;QAE5C,yDAAyD;QACzD,IAAI,UAAU,IAAI,EAAE,YAAY;YAC9B,KAAK,MAAM,kBAAkB,UAAU,IAAI,EAAE,cAAc,EAAE,CAC3D,IAAI,IAAI,CAAC,eAAe,IAAI,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,eAAe,GAC7D,IAAI,CAAC,eAAe,GAAG;gBAAC,IAAI,CAAC,eAAe;aAAC;QAGnD;QAEA,wCAAwC;QAC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E,iEAAiE;IACjE,MAAM,YAAY,0CAAgB,OAAO,aAAa;QAAE,GAAG,OAAO;QAAE,MAAM;IAAuB,GAAG,IAAI,CAAC,CAAA;QACvG,mDAAmD;QACnD,GAAG,gBAAgB,CAAC,SAAS,CAAA;YAC3B,2CAAqB,MAAM,CAAC;QAC9B;QACA,+DAA+D;QAC/D,MAAM,UAAU,QAAQ,UAAU,IAAK,CAAA,QAAQ,KAAK,IAAI,IAAI,KAAK,QAAQ,KAAK,EAAE,OAAO,KAAK,KAAK,GAAG,EAAC;QACrG,IAAI,SACF,WAAW;YACT,GAAG,KAAK;QACV,GAAG;QAEL,OAAO;IACT;IAEA,2CAAqB,GAAG,CAAC,aAAa;IACtC,OAAO;AACT;","sources":["packages/semantic-data-provider/src/index.ts","packages/semantic-data-provider/src/dataProvider/dataProvider.js","packages/semantic-data-provider/src/dataProvider/methods/create.js","packages/semantic-data-provider/src/dataProvider/methods/getOne.js","packages/semantic-data-provider/src/dataProvider/utils/fetchResource.js","packages/semantic-data-provider/src/dataProvider/utils/handleFiles.ts","packages/semantic-data-provider/src/dataProvider/utils/findContainersWithTypes.ts","packages/semantic-data-provider/src/dataProvider/utils/parseServerKeys.js","packages/semantic-data-provider/src/dataProvider/utils/getServerKeyFromType.js","packages/semantic-data-provider/src/dataProvider/methods/delete.ts","packages/semantic-data-provider/src/dataProvider/methods/deleteMany.js","packages/semantic-data-provider/src/dataProvider/methods/getDataServers.js","packages/semantic-data-provider/src/dataProvider/methods/getDataModels.js","packages/semantic-data-provider/src/dataProvider/methods/getList.js","packages/semantic-data-provider/src/dataProvider/utils/fetchContainers.ts","packages/semantic-data-provider/src/dataProvider/utils/arrayOf.ts","packages/semantic-data-provider/src/dataProvider/utils/fetchSparqlEndpoints.js","packages/semantic-data-provider/src/dataProvider/utils/getEmbedFrame.js","packages/semantic-data-provider/src/dataProvider/utils/buildSparqlQuery.js","packages/semantic-data-provider/src/dataProvider/utils/buildBaseQuery.js","packages/semantic-data-provider/src/dataProvider/utils/resolvePrefix.js","packages/semantic-data-provider/src/dataProvider/utils/buildBlankNodesQuery.js","packages/semantic-data-provider/src/dataProvider/utils/buildAutoDetectBlankNodesQuery.js","packages/semantic-data-provider/src/dataProvider/utils/findContainersWithPath.js","packages/semantic-data-provider/src/dataProvider/methods/getMany.js","packages/semantic-data-provider/src/dataProvider/methods/getManyReference.js","packages/semantic-data-provider/src/dataProvider/methods/update.ts","packages/semantic-data-provider/src/dataProvider/utils/fetchUserConfig.js","packages/semantic-data-provider/src/dataProvider/utils/fetchVoidEndpoints.js","packages/semantic-data-provider/src/dataProvider/httpClient.js","packages/semantic-data-provider/src/dataProvider/utils/getServerKeyFromUri.js","packages/semantic-data-provider/src/hooks/useGetExternalLink.js","packages/semantic-data-provider/src/hooks/useContainers.ts","packages/semantic-data-provider/src/hooks/useDataModel.ts","packages/semantic-data-provider/src/hooks/useDataServers.ts","packages/semantic-data-provider/src/hooks/useCreateContainer.js","packages/semantic-data-provider/src/dataProvider/utils/findCreateContainerWithTypes.ts","packages/semantic-data-provider/src/hooks/useCreateContainerUri.ts","packages/semantic-data-provider/src/hooks/useDataModels.ts","packages/semantic-data-provider/src/reification/FilterHandler.js","packages/semantic-data-provider/src/reification/GroupedReferenceHandler.js","packages/semantic-data-provider/src/reification/ReificationArrayInput.js","packages/semantic-data-provider/src/notificationChannels/subscribeToUpdates.ts"],"sourcesContent":["export { default as dataProvider } from './dataProvider/dataProvider';\n\nexport { default as buildSparqlQuery } from './dataProvider/utils/buildSparqlQuery';\nexport { default as buildBlankNodesQuery } from './dataProvider/utils/buildBlankNodesQuery';\n\nexport { default as useGetExternalLink } from './hooks/useGetExternalLink';\nexport { default as useContainers } from './hooks/useContainers';\nexport { default as useCreateContainer } from './hooks/useCreateContainer';\nexport { default as useCreateContainerUri } from './hooks/useCreateContainerUri';\nexport { default as useDataModel } from './hooks/useDataModel';\nexport { default as useDataModels } from './hooks/useDataModels';\nexport { default as useDataServers } from './hooks/useDataServers';\n\nexport { default as FilterHandler } from './reification/FilterHandler';\nexport { default as GroupedReferenceHandler } from './reification/GroupedReferenceHandler';\nexport { default as ReificationArrayInput } from './reification/ReificationArrayInput';\n\nexport {\n createWsChannel,\n getOrCreateWsChannel,\n createSolidNotificationChannel\n} from './notificationChannels/subscribeToUpdates';\n","import createMethod from './methods/create';\nimport deleteMethod from './methods/delete';\nimport deleteManyMethod from './methods/deleteMany';\nimport getDataServersMethod from './methods/getDataServers';\nimport getDataModelsMethod from './methods/getDataModels';\nimport getListMethod from './methods/getList';\nimport getManyMethod from './methods/getMany';\nimport getManyReferenceMethod from './methods/getManyReference';\nimport getOneMethod from './methods/getOne';\nimport updateMethod from './methods/update';\nimport fetchUserConfig from './utils/fetchUserConfig';\nimport fetchVoidEndpoints from './utils/fetchVoidEndpoints';\nimport getServerKeyFromType from './utils/getServerKeyFromType';\nimport httpClient from './httpClient';\n\nconst dataProvider = config => {\n // TODO verify all data provider config + data models\n if (!getServerKeyFromType('default', config.dataServers))\n throw new Error('You must define a default server in your dataServers config');\n\n if (!config.jsonContext) config.jsonContext = Object.fromEntries(config.ontologies.map(o => [o.prefix, o.url]));\n if (!config.returnFailedResources) config.returnFailedResources = false;\n\n // Configure httpClient with data servers (this is needed for proxy calls)\n config.httpClient = httpClient(config.dataServers);\n\n // Keep in memory for refresh\n const originalConfig = { ...config };\n\n let fetchUserConfigPromise = fetchUserConfig(config);\n let fetchVoidEndpointsPromise = fetchVoidEndpoints(config);\n\n const waitForConfig =\n method =>\n async (...arg) => {\n await fetchUserConfigPromise;\n await fetchVoidEndpointsPromise; // Return immediately if promise is fulfilled\n return await method(...arg);\n };\n\n return {\n getList: waitForConfig(getListMethod(config)),\n getMany: waitForConfig(getManyMethod(config)),\n getManyReference: waitForConfig(getManyReferenceMethod(config)),\n getOne: waitForConfig(getOneMethod(config)),\n create: waitForConfig(createMethod(config)),\n update: waitForConfig(updateMethod(config)),\n updateMany: () => {\n throw new Error('updateMany is not implemented yet');\n },\n delete: waitForConfig(deleteMethod(config)),\n deleteMany: waitForConfig(deleteManyMethod(config)),\n // Custom methods\n getDataModels: waitForConfig(getDataModelsMethod(config)),\n getDataServers: waitForConfig(getDataServersMethod(config)),\n getLocalDataServers: getDataServersMethod(config),\n fetch: waitForConfig(config.httpClient),\n refreshConfig: async () => {\n config = { ...originalConfig };\n fetchUserConfigPromise = fetchUserConfig(config);\n fetchVoidEndpointsPromise = fetchVoidEndpoints(config);\n await fetchUserConfigPromise;\n await fetchVoidEndpointsPromise;\n return config;\n }\n };\n};\n\nexport default dataProvider;\n","import urlJoin from 'url-join';\nimport getOne from './getOne';\nimport handleFiles from '../utils/handleFiles';\nimport findContainersWithTypes from '../utils/findContainersWithTypes';\n\nconst createMethod = config => async (resourceId, params) => {\n const { dataServers, resources, httpClient, jsonContext } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) Error(`Resource ${resourceId} is not mapped in resources file`);\n\n const headers = new Headers();\n\n let containerUri;\n let serverKey;\n if (dataModel.create?.container) {\n serverKey = Object.keys(dataModel.create.container)[0];\n containerUri = urlJoin(dataServers[serverKey].baseUrl, Object.values(dataModel.create.container)[0]);\n } else {\n serverKey = dataModel.create?.server || Object.keys(dataServers).find(key => dataServers[key].default === true);\n if (!serverKey) throw new Error('You must define a server for the creation, or a container, or a default server');\n\n const containers = findContainersWithTypes(dataModel.types, [serverKey], dataServers);\n // Extract the containerUri from the results (and ensure there is only one)\n const serverKeys = Object.keys(containers);\n\n if (!serverKeys || serverKeys.length === 0)\n throw new Error(`No container with types ${JSON.stringify(dataModel.types)} found on server ${serverKey}`);\n if (serverKeys.length > 1 || containers[serverKeys[0]].length > 1)\n throw new Error(\n `More than one container detected with types ${JSON.stringify(dataModel.types)} on server ${serverKey}`\n );\n containerUri = containers[serverKeys[0]][0];\n }\n\n if (params.data) {\n if (dataModel.fieldsMapping?.title) {\n if (Array.isArray(dataModel.fieldsMapping.title)) {\n headers.set('Slug', dataModel.fieldsMapping.title.map(f => params.data[f]).join(' '));\n } else {\n headers.set('Slug', params.data[dataModel.fieldsMapping.title]);\n }\n }\n\n // Upload files, if there are any\n const { updatedRecord } = await handleFiles.upload(params.data, config);\n params.data = updatedRecord;\n\n const { headers: responseHeaders } = await httpClient(containerUri, {\n method: 'POST',\n headers,\n body: JSON.stringify({\n '@context': jsonContext,\n '@type': dataModel.types,\n ...params.data\n })\n });\n\n // Retrieve newly-created resource\n const resourceUri = responseHeaders.get('Location');\n return await getOne(config)(resourceId, { id: resourceUri });\n }\n if (params.id) {\n headers.set('Content-Type', 'application/sparql-update');\n\n await httpClient(containerUri, {\n method: 'PATCH',\n headers,\n body: `\n PREFIX ldp: \n INSERT DATA { <${containerUri}> ldp:contains <${params.id}>. };\n `\n });\n\n // Create must return the new data, so get them from the remote URI\n return await getOne(config)(resourceId, { id: params.id });\n }\n};\n\nexport default createMethod;\n","import fetchResource from '../utils/fetchResource';\n\nconst getOneMethod = config => async (resourceId, params) => {\n const { resources } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) throw new Error(`Resource ${resourceId} is not mapped in resources file`);\n\n const data = await fetchResource(params.id, config);\n\n // Transform single value into array if forceArray is set\n if (dataModel.list?.forceArray) {\n for (const forceArrayItem of dataModel.list?.forceArray || []) {\n if (data[forceArrayItem] && !Array.isArray(data[forceArrayItem])) {\n data[forceArrayItem] = [data[forceArrayItem]];\n }\n }\n }\n\n // TODO activate defaultFetchPlan option\n // if (dataModel.list?.defaultFetchPlan) {\n // for (const node of dataModel.list?.defaultFetchPlan) {\n // if (\n // data[node] &&\n // typeof data[node] === 'string' &&\n // data[node].startsWith('http')\n // ) {\n // try {\n // const dataToEmbed = await fetchResource(data[node], config);\n // delete dataToEmbed['@context'];\n // data[node] = dataToEmbed;\n // } catch (e) {\n // // Ignore errors (this may happen if user does not have rights to see the resource)\n // }\n // }\n // }\n // }\n\n return { data };\n};\n\nexport default getOneMethod;\n","import jsonld from 'jsonld';\n\nconst fetchResource = async (resourceUri, config) => {\n const { httpClient, jsonContext } = config;\n\n let { json: data } = await httpClient(resourceUri);\n\n if (!data) throw new Error(`Not a valid JSON: ${resourceUri}`);\n\n data.id = data.id || data['@id'];\n\n // We compact only if the context is different between the frontend and the middleware\n // TODO deep compare if the context is an object\n if (data['@context'] !== jsonContext) {\n data = await jsonld.compact(data, jsonContext);\n }\n\n return data;\n};\n\nexport default fetchResource;\n","import urlJoin from 'url-join';\nimport { RaRecord } from 'react-admin';\nimport { Configuration } from '../types';\n\nconst isFile = (o: any): o is { rawFile: File } => o?.rawFile && o.rawFile instanceof File;\nconst isFileToDelete = (o: any): o is { fileToDelete: string } =>\n o?.fileToDelete !== undefined && o?.fileToDelete !== null;\n\nconst getUploadsContainerUri = (config: Configuration) => {\n const serverKey = Object.keys(config.dataServers).find(key => config.dataServers[key].uploadsContainer);\n if (serverKey && config.dataServers[serverKey].uploadsContainer) {\n return urlJoin(config.dataServers[serverKey].baseUrl, config.dataServers[serverKey].uploadsContainer!);\n }\n return null;\n};\n\nconst uploadFile = async (rawFile: File, config: Configuration) => {\n const uploadsContainerUri = getUploadsContainerUri(config);\n if (!uploadsContainerUri) throw new Error(\"You must define an uploadsContainer in one of the server's configuration\");\n\n const response = await config.httpClient(uploadsContainerUri, {\n method: 'POST',\n body: rawFile,\n headers: new Headers({\n 'Content-Type': rawFile.type\n })\n });\n\n if (response.status === 201) {\n return response.headers.get('Location');\n }\n return null;\n};\n\nconst deleteFiles = async (filesToDelete: string[], config: Configuration) => {\n return Promise.all(\n filesToDelete.map(file =>\n config.httpClient(file, {\n method: 'DELETE'\n })\n )\n );\n};\n\n/*\n * Look for raw files in the record data.\n * If there are any, upload them and replace the file by its URL.\n */\nconst uploadAllFiles = async (record: Partial, config: Configuration) => {\n const filesToDelete: string[] = [];\n const updatedRecord = { ...record };\n\n for (const property of Object.keys(record)) {\n const value = record[property];\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const itemValue = value[i];\n if (isFile(itemValue)) {\n if (isFileToDelete(itemValue)) {\n filesToDelete.push(itemValue.fileToDelete);\n }\n updatedRecord[property][i] = await uploadFile(itemValue.rawFile, config);\n } else if (isFileToDelete(itemValue)) {\n filesToDelete.push(itemValue.fileToDelete);\n updatedRecord[property][i] = null;\n }\n }\n } else if (isFile(value)) {\n if (isFileToDelete(value)) {\n filesToDelete.push(value.fileToDelete);\n }\n updatedRecord[property] = await uploadFile(value.rawFile, config);\n } else if (isFileToDelete(value)) {\n filesToDelete.push(value.fileToDelete);\n updatedRecord[property] = null;\n }\n }\n\n return {\n updatedRecord,\n filesToDelete\n };\n};\n\nexport default {\n upload: uploadAllFiles,\n delete: deleteFiles\n};\n","import urlJoin from 'url-join';\nimport { Configuration, DataServerKey } from '../types';\nimport parseServerKeys from './parseServerKeys';\n\nconst findContainersWithTypes = (\n types: string[],\n serverKeys: string | string[] | undefined,\n dataServers: Configuration['dataServers']\n) => {\n const containers = {} as Record;\n const existingContainers: string[] = [];\n\n const parsedServerKeys = parseServerKeys(serverKeys, dataServers);\n\n Object.keys(dataServers)\n .filter(dataServerKey => dataServers[dataServerKey].containers)\n .forEach(dataServerKey => {\n Object.keys(dataServers[dataServerKey].containers || {}).forEach(containerKey => {\n if (!parsedServerKeys || parsedServerKeys.includes(containerKey)) {\n Object.keys(dataServers[dataServerKey].containers![containerKey]).forEach(type => {\n if (types.includes(type)) {\n dataServers[dataServerKey].containers![containerKey][type].map(path => {\n const containerUri = urlJoin(dataServers[containerKey].baseUrl, path);\n\n // Avoid returning the same container several times\n if (!existingContainers.includes(containerUri)) {\n existingContainers.push(containerUri);\n\n if (!containers[dataServerKey]) containers[dataServerKey] = [];\n containers[dataServerKey].push(containerUri);\n }\n });\n }\n });\n }\n });\n });\n return containers;\n};\n\nexport default findContainersWithTypes;\n","import getServerKeyFromType from './getServerKeyFromType';\n\nconst parseServerKey = (serverKey, dataServers) => {\n switch (serverKey) {\n case '@default':\n return getServerKeyFromType('default', dataServers);\n case '@pod':\n return getServerKeyFromType('pod', dataServers);\n case '@authServer':\n return getServerKeyFromType('authServer', dataServers);\n default:\n return serverKey;\n }\n};\n\n// Return the list of servers keys in an array\n// parsing keywords like @all, @default, @pod and @authServer\nconst parseServerKeys = (serverKeys, dataServers) => {\n if (Array.isArray(serverKeys)) {\n if (serverKeys.includes('@all')) {\n return Object.keys(dataServers);\n }\n return serverKeys.map(serverKey => parseServerKey(serverKey, dataServers));\n }\n if (typeof serverKeys === 'string') {\n if (serverKeys === '@all') {\n return Object.keys(dataServers);\n }\n if (serverKeys === '@remote') {\n const defaultServerKey = getServerKeyFromType('default', dataServers);\n return Object.keys(dataServers).filter(serverKey => serverKey !== defaultServerKey);\n }\n return [parseServerKey(serverKeys, dataServers)];\n }\n // If server key is empty\n return false;\n};\n\nexport default parseServerKeys;\n","const getServerKeyFromType = (type, dataServers) => {\n return Object.keys(dataServers).find(key => {\n return dataServers[key][type];\n });\n};\n\nexport default getServerKeyFromType;\n","import { DeleteParams, RaRecord } from 'react-admin';\nimport { Configuration } from '../types';\nimport handleFiles from '../utils/handleFiles';\n\nconst deleteMethod = (config: Configuration) => async (resourceId: string, params: DeleteParams) => {\n const { httpClient } = config;\n\n await httpClient(`${params.id}`, {\n method: 'DELETE'\n });\n\n if (params.meta?.filesToDelete) {\n await handleFiles.delete(params.meta.filesToDelete, config);\n }\n\n return { data: { id: params.id } };\n};\n\nexport default deleteMethod;\n","const deleteManyMethod = config => async (resourceId, params) => {\n const { httpClient } = config;\n const ids = [];\n\n for (const id of params.ids) {\n try {\n await httpClient(id, {\n method: 'DELETE'\n });\n ids.push(id);\n } catch (e) {\n // Do nothing if we fail to delete a resource\n }\n }\n\n return { data: ids };\n};\n\nexport default deleteManyMethod;\n","const getDataServers = config => () => {\n return config.dataServers;\n};\n\nexport default getDataServers;\n","const getDataModels = config => () => {\n return config.resources;\n};\n\nexport default getDataModels;\n","import findContainersWithTypes from '../utils/findContainersWithTypes';\nimport fetchContainers from '../utils/fetchContainers';\nimport fetchSparqlEndpoints from '../utils/fetchSparqlEndpoints';\nimport findContainersWithPaths from '../utils/findContainersWithPath';\n\nconst getListMethod =\n config =>\n async (resourceId, params = {}) => {\n const { dataServers, resources } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) throw new Error(`Resource ${resourceId} is not mapped in resources file`);\n\n let containers;\n if (!params.filter?._servers && dataModel.list?.containers) {\n if (Array.isArray(dataModel.list?.containers))\n throw new Error(\n `The list.containers property of ${resourceId} dataModel must be of type object ({ serverKey: [containerUri] })`\n );\n // If containers are set explicitly, use them\n containers = findContainersWithPaths(dataModel.list.containers, dataServers);\n } else {\n // Otherwise find the container URIs on the given servers (either in the filter or the data model)\n containers = findContainersWithTypes(\n dataModel.types,\n params.filter?._servers || dataModel.list?.servers,\n dataServers\n );\n }\n\n if (dataModel.list?.fetchContainer) {\n return fetchContainers(containers, params, config);\n }\n return fetchSparqlEndpoints(containers, resourceId, params, config);\n };\n\nexport default getListMethod;\n","import jsonld, { ContextDefinition } from 'jsonld';\nimport { GetListParams } from 'react-admin';\nimport arrayOf from './arrayOf';\nimport { Configuration, ContainerURI, DataServerKey } from '../types';\n\ntype LDPContainerType = 'ldp:Container' | 'ldp:BasicContainer';\n\ninterface LDPContainerBase {\n '@context': Configuration['jsonContext'];\n id: string;\n 'ldp:contains': Record[];\n}\n\ninterface LDPContainerWithType extends LDPContainerBase {\n type: LDPContainerType | LDPContainerType[];\n}\n\ninterface LDPContainerWithAtType extends LDPContainerBase {\n '@type': LDPContainerType | LDPContainerType[];\n}\n\ntype LDPContainer = LDPContainerWithType | LDPContainerWithAtType;\n\ntype LDPResource = {\n '@context': Configuration['jsonContext'];\n [key: string]: any;\n};\n\ntype ListFilters = Partial<{\n q: string;\n type: string;\n _predicates: string[];\n _servers: DataServerKey[];\n [attribute: string]: any;\n}>;\n\nconst isValidLDPContainer = (container: LDPContainer) => {\n const resourceType = (container as LDPContainerWithType).type || (container as LDPContainerWithAtType)['@type'];\n return Array.isArray(resourceType) ? resourceType.includes('ldp:Container') : resourceType === 'ldp:Container';\n};\n\nconst isObject = (val: any) => {\n return val != null && typeof val === 'object' && !Array.isArray(val);\n};\n\nconst fetchContainers = async (\n containers: Record,\n params: GetListParams,\n { httpClient, jsonContext }: Configuration\n) => {\n const containersUri = Object.values(containers).flat();\n\n const fetchPromises = containersUri.map(containerUri =>\n httpClient(containerUri)\n .then(async ({ json }) => {\n const jsonResponse: LDPContainer = json;\n\n // If container's context is different, compact it to have an uniform result\n // TODO deep compare if the context is an object\n if (jsonResponse['@context'] !== jsonContext) {\n return jsonld.compact(jsonResponse, jsonContext as ContextDefinition) as unknown as Promise;\n }\n\n return jsonResponse;\n })\n .then((json: LDPContainer) => {\n if (!isValidLDPContainer(json)) {\n throw new Error(`${containerUri} is not a LDP container`);\n }\n\n return arrayOf(json['ldp:contains']).map(resource => ({\n '@context': json['@context'],\n ...resource\n }));\n })\n );\n\n // Fetch simultaneously all containers\n const results = await Promise.all(fetchPromises);\n let resources = results.flat();\n\n resources = resources.map(resource => {\n resource.id = resource.id || resource['@id'];\n return resource;\n });\n\n // Apply filter to results\n const filters: ListFilters = params.filter;\n\n // For SPARQL queries, we use \"a\" to filter types, but in containers it must be \"type\"\n if (filters.a) {\n filters.type = filters.a;\n delete filters.a;\n }\n\n // Filter resources attributes according to _predicates list\n if (filters._predicates && Array.isArray(filters._predicates)) {\n const predicates = filters._predicates;\n const mandatoryAttributes = ['id'];\n\n resources = resources.map(resource => {\n return Object.keys(resource)\n .filter(key => predicates.includes(key) || mandatoryAttributes.includes(key))\n .reduce(\n (filteredResource, key) => {\n filteredResource[key] = resource[key];\n return filteredResource;\n },\n { '@context': [] }\n );\n });\n }\n\n if (Object.keys(filters).filter(f => !['_predicates', '_servers'].includes(f)).length > 0) {\n resources = resources.filter(resource => {\n // Full text filtering\n if (filters.q) {\n return Object.values(resource).some(attributeValue => {\n if (!isObject(attributeValue)) {\n const arrayValues = Array.isArray(attributeValue) ? attributeValue : [attributeValue];\n return arrayValues.some(value => {\n if (typeof value === 'string') {\n return value.toLowerCase().normalize('NFD').includes(filters.q!.toLowerCase().normalize('NFD'));\n }\n return false;\n });\n }\n return false;\n });\n }\n\n // Attribute filtering\n const attributesFilters = Object.keys(filters).filter(f => !['_predicates', '_servers', 'q'].includes(f));\n\n return attributesFilters.every(attribute => {\n if (resource[attribute]) {\n const arrayValues: any[] = Array.isArray(resource[attribute]) ? resource[attribute] : [resource[attribute]];\n return arrayValues.some(\n (value: any) => typeof value === 'string' && value.includes(filters[attribute] as string)\n );\n }\n\n return false;\n });\n });\n }\n\n // Sorting\n if (params.sort) {\n resources = resources.sort((a, b) => {\n if (a[params.sort.field] && b[params.sort.field]) {\n if (params.sort.order === 'ASC') {\n return a[params.sort.field].localeCompare(b[params.sort.field]);\n }\n return b[params.sort.field].localeCompare(a[params.sort.field]);\n }\n return true;\n });\n }\n\n // Pagination\n const total = resources.length;\n\n if (params.pagination) {\n resources = resources.slice(\n (params.pagination.page - 1) * params.pagination.perPage,\n params.pagination.page * params.pagination.perPage\n );\n }\n\n return { data: resources, total };\n};\n\nexport default fetchContainers;\n","const arrayOf = (value: T | T[]) => {\n // If the field is null-ish, we suppose there are no values.\n if (!value) {\n return [];\n }\n // Return as is.\n if (Array.isArray(value)) {\n return value;\n }\n // Single value is made an array.\n return [value];\n};\n\nexport default arrayOf;\n","import jsonld from 'jsonld';\nimport getEmbedFrame from './getEmbedFrame';\nimport buildSparqlQuery from './buildSparqlQuery';\n\nconst compare = (a, b) => {\n switch (typeof a) {\n case 'string':\n return a.localeCompare(b);\n case 'number':\n case 'bigint':\n return a - b;\n default:\n return 0;\n }\n};\n\nconst fetchSparqlEndpoints = async (containers, resourceId, params, config) => {\n const { dataServers, resources, httpClient, jsonContext, ontologies } = config;\n const dataModel = resources[resourceId];\n\n const sparqlQueryPromises = Object.keys(containers).map(\n serverKey =>\n new Promise((resolve, reject) => {\n const blankNodes = params.filter?.blankNodes || dataModel.list?.blankNodes;\n\n // When the SPARQL request comes from the browser's URL, it comes as JSON string which must must be parsed\n if (\n params.filter?.sparqlWhere &&\n (typeof params.filter.sparqlWhere === 'string' || params.filter.sparqlWhere instanceof String)\n ) {\n params.filter.sparqlWhere = JSON.parse(decodeURIComponent(params.filter.sparqlWhere));\n }\n const sparqlQuery = buildSparqlQuery({\n containers: containers[serverKey],\n params,\n dataModel,\n ontologies\n });\n\n httpClient(dataServers[serverKey].sparqlEndpoint, {\n method: 'POST',\n body: sparqlQuery\n })\n .then(({ json }) => {\n // If we declared the blank nodes to dereference, embed only those blank nodes\n // This solve problems which can occur when same-type resources are embedded in other resources\n // To increase performances, you can set explicitEmbedOnFraming to false (make sure the result is still OK)\n const frame =\n blankNodes && dataModel.list?.explicitEmbedOnFraming !== false\n ? {\n '@context': jsonContext,\n '@type': dataModel.types,\n '@embed': '@never',\n ...getEmbedFrame(blankNodes)\n }\n : {\n '@context': jsonContext,\n '@type': dataModel.types\n };\n\n // omitGraph option force results to be in a @graph, even if we have a single result\n return jsonld.frame(json, frame, { omitGraph: false });\n })\n .then(compactJson => {\n if (compactJson['@id']) {\n const { '@context': context, ...rest } = compactJson;\n compactJson = {\n '@context': context,\n '@graph': [rest]\n };\n }\n resolve(\n compactJson['@graph'].map(resource => ({ '@context': compactJson['@context'], ...resource })) || []\n );\n })\n .catch(e => reject(e));\n })\n );\n\n // Run simultaneous SPARQL queries\n let results = await Promise.all(sparqlQueryPromises);\n\n if (results.length === 0) {\n return { data: [], total: 0 };\n }\n // Merge all results in one array\n results = [].concat(...results);\n\n // Add id in addition to @id, as this is what React-Admin expects\n let returnData = results.map(item => {\n item.id = item.id || item['@id'];\n return item;\n });\n\n // TODO sort and paginate the results in the SPARQL query to improve performances\n if (params.sort) {\n returnData = returnData.sort((a, b) => {\n if (a[params.sort.field] !== undefined && b[params.sort.field] !== undefined) {\n if (params.sort.order === 'ASC') {\n return compare(a[params.sort.field], b[params.sort.field]);\n }\n return compare(b[params.sort.field], a[params.sort.field]);\n }\n return 0;\n });\n }\n if (params.pagination) {\n returnData = returnData.slice(\n (params.pagination.page - 1) * params.pagination.perPage,\n params.pagination.page * params.pagination.perPage\n );\n }\n\n return { data: returnData, total: results.length };\n};\n\nexport default fetchSparqlEndpoints;\n","const getEmbedFrame = blankNodes => {\n let embedFrame = {};\n let predicates;\n if (blankNodes) {\n for (const blankNode of blankNodes) {\n if (blankNode.includes('/')) {\n predicates = blankNode.split('/').reverse();\n } else {\n predicates = [blankNode];\n }\n embedFrame = {\n ...embedFrame,\n ...predicates.reduce(\n (accumulator, predicate) => ({\n [predicate]: {\n '@embed': '@last',\n ...accumulator\n }\n }),\n {}\n )\n };\n }\n return embedFrame;\n }\n};\n\nexport default getEmbedFrame;\n","import DataFactory from '@rdfjs/data-model';\nimport buildBaseQuery from './buildBaseQuery';\nimport buildBlankNodesQuery from './buildBlankNodesQuery';\nimport buildAutoDetectBlankNodesQuery from './buildAutoDetectBlankNodesQuery';\nimport resolvePrefix from './resolvePrefix';\n\nconst SparqlGenerator = require('sparqljs').Generator;\n\nconst { literal, namedNode, triple, variable } = DataFactory;\n\nconst generator = new SparqlGenerator({\n /* prefixes, baseIRI, factory, sparqlStar */\n});\n\nconst reservedFilterKeys = ['q', 'sparqlWhere', 'blankNodes', 'blankNodesDepth', '_servers', '_predicates'];\n\nconst buildSparqlQuery = ({ containers, params, dataModel, ontologies }) => {\n const blankNodes = params.filter?.blankNodes || dataModel.list?.blankNodes;\n const predicates = params.filter?._predicates || dataModel.list?.predicates;\n const blankNodesDepth = params.filter?.blankNodesDepth ?? dataModel.list?.blankNodesDepth ?? 2;\n const filter = { ...dataModel.list?.filter, ...params.filter };\n const baseQuery = buildBaseQuery(predicates, ontologies);\n\n const sparqlJsParams = {\n queryType: 'CONSTRUCT',\n template: baseQuery.construct,\n where: [],\n type: 'query',\n prefixes: Object.fromEntries(ontologies.map(ontology => [ontology.prefix, ontology.url]))\n };\n\n const containerWhere = [\n {\n type: 'values',\n values: containers.map(containerUri => ({ '?containerUri': namedNode(containerUri) }))\n },\n triple(variable('containerUri'), namedNode('http://www.w3.org/ns/ldp#contains'), variable('s1')),\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isiri',\n args: [variable('s1')]\n }\n }\n ];\n\n let resourceWhere = [];\n\n if (filter && Object.keys(filter).length > 0) {\n const hasSPARQLFilter = filter.sparqlWhere && Object.keys(filter.sparqlWhere).length > 0;\n const hasFullTextSearch = filter.q && filter.q.length > 0;\n\n if (hasSPARQLFilter) {\n /*\n Example of usage :\n {\n \"sparqlWhere\": {\n \"type\": \"bgp\",\n \"triples\": [{\n \"subject\": {\"termType\": \"Variable\", \"value\": \"s1\"},\n \"predicate\": {\"termType\": \"NameNode\", \"value\": \"http://virtual-assembly.org/ontologies/pair#label\"},\n \"object\": {\"termType\": \"Literal\", \"value\": \"My Organization\"}\n }]\n }\n }\n */\n // initialize array in case of single value :\n [].concat(filter.sparqlWhere).forEach(sw => {\n resourceWhere.push(sw);\n });\n }\n\n if (hasFullTextSearch) {\n resourceWhere.push({\n type: 'group',\n patterns: [\n {\n queryType: 'SELECT',\n variables: [variable('s1')],\n where: [\n triple(variable('s1'), variable('p1'), variable('o1')),\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isliteral',\n args: [variable('o1')]\n }\n },\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'regex',\n args: [\n {\n type: 'operation',\n operator: 'lcase',\n args: [\n {\n type: 'operation',\n operator: 'str',\n args: [variable('o1')]\n }\n ]\n },\n literal(filter.q.toLowerCase(), '', namedNode('http://www.w3.org/2001/XMLSchema#string'))\n ]\n }\n }\n ],\n type: 'query'\n }\n ]\n });\n }\n\n // Other filters\n // SPARQL keyword a = filter based on the class of a resource (example => 'a': 'pair:OrganizationType')\n // Other filters are based on a value (example => 'petr:hasAudience': 'http://localhost:3000/audiences/tout-public')\n Object.entries(filter).forEach(([predicate, object]) => {\n if (!reservedFilterKeys.includes(predicate)) {\n resourceWhere.unshift(\n triple(\n variable('s1'),\n namedNode(resolvePrefix(predicate, ontologies)),\n namedNode(resolvePrefix(object, ontologies))\n )\n );\n }\n });\n }\n\n // Blank nodes\n const blankNodesQuery = blankNodes\n ? buildBlankNodesQuery(blankNodes, baseQuery, ontologies)\n : buildAutoDetectBlankNodesQuery(blankNodesDepth, baseQuery);\n\n if (blankNodesQuery && blankNodesQuery.construct) {\n resourceWhere = resourceWhere.concat(blankNodesQuery.where);\n sparqlJsParams.template = sparqlJsParams.template.concat(blankNodesQuery.construct);\n } else {\n resourceWhere.push(baseQuery.where);\n }\n\n sparqlJsParams.where.push(\n {\n type: 'union',\n patterns: [\n containerWhere,\n {\n type: 'graph',\n name: namedNode('http://semapps.org/mirror'),\n patterns: containerWhere\n }\n ]\n },\n {\n type: 'union',\n patterns: [\n resourceWhere,\n {\n type: 'graph',\n name: namedNode('http://semapps.org/mirror'),\n patterns: resourceWhere\n }\n ]\n }\n );\n\n return generator.stringify(sparqlJsParams);\n};\n\nexport default buildSparqlQuery;\n","import { namedNode, triple, variable } from '@rdfjs/data-model';\nimport resolvePrefix from './resolvePrefix';\n\nconst defaultToArray = value => (!value ? [] : Array.isArray(value) ? value : [value]);\n\n// We need to always include the type or React-Admin will not work properly\nconst typeQuery = triple(\n variable('s1'),\n namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),\n variable('type')\n);\n\nconst buildBaseQuery = (predicates, ontologies) => {\n let baseTriples;\n if (predicates) {\n baseTriples = defaultToArray(predicates).map((predicate, i) =>\n triple(variable('s1'), namedNode(resolvePrefix(predicate, ontologies)), variable(`o${i + 1}`))\n );\n return {\n construct: [typeQuery, ...baseTriples],\n where: [typeQuery, ...baseTriples.map(triple => ({ type: 'optional', patterns: [triple] }))]\n };\n }\n baseTriples = [triple(variable('s1'), variable('p1'), variable('o1'))];\n return {\n construct: baseTriples,\n where: baseTriples\n };\n};\n\nexport default buildBaseQuery;\n","const resolvePrefix = (item, ontologies) => {\n if (item.startsWith('http://') || item.startsWith('https://')) {\n // Already resolved, return the URI\n return item;\n }\n if (item === 'a') {\n // Special case\n return 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type';\n }\n const [prefix, value] = item.split(':');\n if (value) {\n const ontology = ontologies.find(ontology => ontology.prefix === prefix);\n if (ontology) {\n return ontology.url + value;\n }\n throw new Error(`No ontology found with prefix ${prefix}`);\n } else {\n throw new Error(`The value \"${item}\" is not correct. It must include a prefix or be a full URI.`);\n }\n};\n\nexport default resolvePrefix;\n","import md5 from 'crypto-js/md5';\nimport { namedNode, triple, variable } from '@rdfjs/data-model';\nimport resolvePrefix from './resolvePrefix';\n\n// Transform ['ont:predicate1/ont:predicate2'] to ['ont:predicate1', 'ont:predicate1/ont:predicate2']\nconst extractNodes = blankNodes => {\n const nodes = [];\n if (blankNodes) {\n for (const predicate of blankNodes) {\n if (predicate.includes('/')) {\n const nodeNames = predicate.split('/');\n for (let i = 1; i <= nodeNames.length; i++) {\n nodes.push(nodeNames.slice(0, i).join('/'));\n }\n } else {\n nodes.push(predicate);\n }\n }\n }\n return nodes;\n};\n\nconst generateSparqlVarName = node => md5(node);\n\nconst getParentNode = node => node.includes('/') && node.split('/')[0];\n\nconst getPredicate = node => (node.includes('/') ? node.split('/')[1] : node);\n\nconst buildUnionQuery = queries =>\n queries.map(q => {\n let triples = q.query;\n const firstTriple = queries.find(q2 => q.parentNode === q2.node);\n if (firstTriple !== undefined) {\n triples = triples.concat(firstTriple.query[0]);\n }\n return {\n type: 'bgp',\n triples\n };\n });\n\nconst buildBlankNodesQuery = (blankNodes, baseQuery, ontologies) => {\n const queries = [];\n const nodes = extractNodes(blankNodes);\n\n if (nodes && ontologies && ontologies.length > 0) {\n for (const node of nodes) {\n const parentNode = getParentNode(node);\n const predicate = getPredicate(node);\n const varName = generateSparqlVarName(node);\n const parentVarName = parentNode ? generateSparqlVarName(parentNode) : '1';\n\n const query = [\n triple(variable(`s${parentVarName}`), namedNode(resolvePrefix(predicate, ontologies)), variable(`s${varName}`)),\n triple(variable(`s${varName}`), variable(`p${varName}`), variable(`o${varName}`))\n ];\n\n queries.push({\n node,\n parentNode,\n query,\n filter: '' // `FILTER(isBLANK(?s${varName})) .`\n });\n }\n\n return {\n construct: queries.length > 0 ? queries.map(q => q.query).reduce((pre, cur) => pre.concat(cur)) : null,\n where: {\n type: 'union',\n patterns: [baseQuery.where, ...buildUnionQuery(queries)]\n }\n };\n }\n return {\n construct: '',\n where: ''\n };\n};\n\nexport default buildBlankNodesQuery;\n","import { triple, variable } from '@rdfjs/data-model';\n\nconst buildAutoDetectBlankNodesQuery = (depth, baseQuery) => {\n const construct = [...baseQuery.construct];\n let where = {};\n if (depth > 0) {\n const whereQueries = [];\n whereQueries.push([baseQuery.where]);\n for (let i = 1; i <= depth; i++) {\n construct.push(triple(variable(`o${i}`), variable(`p${i + 1}`), variable(`o${i + 1}`)));\n whereQueries.push([\n ...whereQueries[whereQueries.length - 1],\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isblank',\n args: [variable(`o${i}`)]\n }\n },\n triple(variable(`o${i}`), variable(`p${i + 1}`), variable(`o${i + 1}`))\n ]);\n }\n where = {\n type: 'union',\n patterns: whereQueries\n };\n } else if (depth === 0) {\n where = baseQuery.where;\n } else {\n throw new Error('The depth of buildAutoDetectBlankNodesQuery should be 0 or more');\n }\n\n return { construct, where };\n};\n\nexport default buildAutoDetectBlankNodesQuery;\n","import urlJoin from 'url-join';\n\nconst findContainersWithPaths = (paths, dataServers) => {\n const containers = {};\n Object.keys(paths).forEach(serverKey => {\n if (dataServers[serverKey]) {\n containers[serverKey] = [];\n paths[serverKey].forEach(path => {\n containers[serverKey].push(urlJoin(dataServers[serverKey].baseUrl, path));\n });\n } else {\n throw new Error(`No server found with key ${serverKey}`);\n }\n });\n return containers;\n};\n\nexport default findContainersWithPaths;\n","import getOne from './getOne';\n\nconst getManyMethod = config => async (resourceId, params) => {\n const { returnFailedResources } = config;\n\n let returnData = await Promise.all(\n params.ids.map(id =>\n getOne(config)(resourceId, { id: typeof id === 'object' ? id['@id'] : id })\n .then(({ data }) => data)\n .catch(() => {\n // Catch if one resource fails to load\n // Otherwise no references will be show if only one is missing\n // See https://github.com/marmelab/react-admin/issues/5190\n if (returnFailedResources) {\n return { id, _error: true };\n }\n // Returning nothing\n })\n )\n );\n\n // We don't want undefined results to appear in the results as it will break with react-admin\n returnData = returnData.filter(e => e);\n\n return { data: returnData };\n};\n\nexport default getManyMethod;\n","import getList from './getList';\n\nconst getManyReferenceMethod = config => async (resourceId, params) => {\n params.filter = { ...params.filter, [params.target]: params.id };\n delete params.target;\n return await getList(config)(resourceId, params);\n};\n\nexport default getManyReferenceMethod;\n","import { RaRecord, UpdateParams } from 'react-admin';\nimport { Configuration } from '../types';\nimport handleFiles from '../utils/handleFiles';\n\nconst updateMethod = (config: Configuration) => async (resourceId: string, params: UpdateParams) => {\n const { httpClient, jsonContext } = config;\n\n // Upload files, if there are any\n const { updatedRecord, filesToDelete } = await handleFiles.upload(params.data, config);\n params.data = updatedRecord;\n\n await httpClient(`${params.id}`, {\n method: 'PUT',\n body: JSON.stringify({\n '@context': jsonContext,\n ...params.data\n })\n });\n\n // Delete files only if update is successful\n await handleFiles.delete(filesToDelete, config);\n\n return { data: params.data };\n};\n\nexport default updateMethod;\n","import jwtDecode from 'jwt-decode';\nimport urlJoin from 'url-join';\nimport getServerKeyFromType from './getServerKeyFromType';\n\nconst fetchUserConfig = async config => {\n const { dataServers, httpClient } = config;\n const token = localStorage.getItem('token');\n const podKey = getServerKeyFromType('pod', dataServers);\n const authServerKey = getServerKeyFromType('authServer', dataServers);\n\n // If the user is logged in\n if (token) {\n const payload = jwtDecode(token);\n const webId = payload.webId || payload.webid; // Currently we must deal with both formats\n let userData;\n\n try {\n const { json } = await httpClient(webId);\n userData = json;\n } catch (e) {\n console.error(e);\n // If the webId cannot be fetched, assume an invalid token and disconnect the user\n localStorage.clear();\n window.location.reload();\n return;\n }\n\n // If we have a POD server\n if (podKey) {\n // Fill the config provided to the data provider\n // We must modify the config object directly\n config.dataServers[podKey].name = 'My Pod';\n config.dataServers[podKey].baseUrl = urlJoin(webId, 'data'); // TODO find POD URI from user profile\n config.dataServers[podKey].sparqlEndpoint =\n userData.endpoints?.['void:sparqlEndpoint'] || urlJoin(webId, 'sparql');\n }\n\n if (authServerKey) {\n // Fill the config provided to the data provider\n // We must modify the config object directly\n config.dataServers[authServerKey].proxyUrl = userData.endpoints?.proxyUrl;\n }\n } else if (podKey) {\n // If the user is not logged in, ignore the POD server\n delete config.dataServers[podKey];\n }\n};\n\nexport default fetchUserConfig;\n","const defaultToArray = value => (!value ? undefined : Array.isArray(value) ? value : [value]);\n\nconst fetchVoidEndpoints = async config => {\n const fetchPromises = Object.entries(config.dataServers)\n .filter(([key, server]) => server.pod !== true && server.void !== false)\n .map(([key, server]) =>\n config\n .httpClient(new URL('/.well-known/void', server.baseUrl).toString())\n .then(result => ({ key, datasets: result.json['@graph'] }))\n .catch(e => {\n if (e.status === 404 || e.status === 401 || e.status === 500) {\n return { key, error: e };\n }\n throw e;\n })\n );\n\n let results = [];\n\n try {\n results = await Promise.all(fetchPromises);\n } catch (e) {\n // Do not throw error if no endpoint found\n }\n\n for (const result of results) {\n config.dataServers[result.key].containers = config.dataServers[result.key].containers || {};\n config.dataServers[result.key].blankNodes = config.dataServers[result.key].blankNodes || {};\n\n // Ignore unfetchable endpoints\n if (result.datasets) {\n for (const dataset of result.datasets) {\n const datasetServerKey = Object.keys(config.dataServers).find(\n key => dataset['void:uriSpace'] === config.dataServers[key].baseUrl\n );\n\n // If the dataset is not part of a server mapped in the dataServers, ignore it\n if (datasetServerKey) {\n // If this is the local dataset, add the base information\n if (datasetServerKey === result.key) {\n config.dataServers[result.key].name = config.dataServers[result.key].name || dataset['dc:title'];\n config.dataServers[result.key].description =\n config.dataServers[result.key].description || dataset['dc:description'];\n config.dataServers[result.key].sparqlEndpoint =\n config.dataServers[result.key].sparqlEndpoint || dataset['void:sparqlEndpoint'];\n }\n\n config.dataServers[result.key].containers[datasetServerKey] =\n config.dataServers[result.key].containers[datasetServerKey] || {};\n\n for (const partition of defaultToArray(dataset['void:classPartition'])) {\n for (const type of defaultToArray(partition['void:class'])) {\n // Set containers by type\n const path = partition['void:uriSpace'].replace(dataset['void:uriSpace'], '/');\n if (config.dataServers[result.key].containers[datasetServerKey][type]) {\n config.dataServers[result.key].containers[datasetServerKey][type].push(path);\n } else {\n config.dataServers[result.key].containers[datasetServerKey][type] = [path];\n }\n }\n }\n }\n }\n }\n }\n};\n\nexport default fetchVoidEndpoints;\n","import { fetchUtils } from 'react-admin';\nimport getServerKeyFromUri from './utils/getServerKeyFromUri';\nimport getServerKeyFromType from './utils/getServerKeyFromType';\n\n/*\n * HTTP client used by all calls in data provider and auth provider\n * Do proxy calls if a proxy endpoint is available and the server is different from the auth server\n */\nconst httpClient =\n dataServers =>\n (url, options = {}) => {\n const authServerKey = getServerKeyFromType('authServer', dataServers);\n const serverKey = getServerKeyFromUri(url, dataServers);\n const useProxy =\n serverKey !== authServerKey && dataServers[authServerKey]?.proxyUrl && dataServers[serverKey]?.noProxy !== true;\n\n if (!options.headers) options.headers = new Headers();\n\n switch (options.method) {\n case 'POST':\n case 'PATCH':\n case 'PUT':\n if (!options.headers.has('Accept')) options.headers.set('Accept', 'application/ld+json');\n if (!options.headers.has('Content-Type')) options.headers.set('Content-Type', 'application/ld+json');\n break;\n\n case 'DELETE':\n break;\n\n case 'GET':\n default:\n if (!options.headers.has('Accept')) options.headers.set('Accept', 'application/ld+json');\n break;\n }\n\n if (useProxy) {\n const formData = new FormData();\n\n formData.append('id', url);\n formData.append('method', options.method || 'GET');\n formData.append('headers', JSON.stringify(Object.fromEntries(options.headers.entries())));\n\n if (options.body) {\n if (options.body instanceof File) {\n formData.append('body', options.body, options.body.name);\n } else {\n formData.append('body', options.body);\n }\n }\n\n // Post to proxy endpoint with multipart/form-data format\n return fetchUtils.fetchJson(dataServers[authServerKey].proxyUrl, {\n method: 'POST',\n headers: new Headers({\n Authorization: `Bearer ${localStorage.getItem('token')}`\n }),\n body: formData\n });\n }\n // Add token if the server is the same as the auth server\n if (serverKey === authServerKey) {\n const token = localStorage.getItem('token');\n if (token) options.headers.set('Authorization', `Bearer ${token}`);\n }\n return fetchUtils.fetchJson(url, options);\n };\n\nexport default httpClient;\n","// Return the first server matching with the baseUrl\nconst getServerKeyFromUri = (uri, dataServers) => {\n if (!uri) throw Error(`No URI provided to getServerKeyFromUri`);\n return Object.keys(dataServers).find(key => {\n if (dataServers[key].pod) {\n // The baseUrl ends with /data so remove this part to match with the webId and webId-related URLs (/inbox, /outbox...)\n return dataServers[key].baseUrl && uri.startsWith(dataServers[key].baseUrl.replace('/data', ''));\n }\n return uri.startsWith(dataServers[key].baseUrl);\n });\n};\n\nexport default getServerKeyFromUri;\n","import { useCallback, useMemo, useContext } from 'react';\nimport { DataProviderContext } from 'react-admin';\n\nconst compute = (externalLinks, record) =>\n typeof externalLinks === 'function' ? externalLinks(record) : externalLinks;\nconst isURL = url => typeof url === 'string' && url.startsWith('http');\n\nconst useGetExternalLink = componentExternalLinks => {\n // Since the externalLinks config is defined only locally, we don't need to wait for VOID endpoints fetching\n const dataProvider = useContext(DataProviderContext);\n const dataServers = dataProvider.getLocalDataServers();\n\n const serversExternalLinks = useMemo(() => {\n if (dataServers) {\n return Object.fromEntries(\n Object.values(dataServers).map(server => {\n // If externalLinks is not defined in the data server, use external links for non-default servers\n const externalLinks = server.externalLinks !== undefined ? server.externalLinks : !server.default;\n return [server.baseUrl, externalLinks];\n })\n );\n }\n }, [dataServers]);\n\n return useCallback(\n record => {\n const computedComponentExternalLinks = compute(componentExternalLinks, record);\n // If the component explicitly asks not to display as external links, use an internal link\n if (computedComponentExternalLinks === false) return false;\n\n if (!record?.id) return false;\n\n const serverBaseUrl = Object.keys(serversExternalLinks).find(baseUrl => record?.id.startsWith(baseUrl));\n // If no matching data servers could be found, assume we have an internal link\n if (!serverBaseUrl) return false;\n\n const computedServerExternalLinks = compute(serversExternalLinks[serverBaseUrl], record);\n // If the data server explicitly asks not to display as external links, use an internal link\n if (computedServerExternalLinks === false) return false;\n\n if (isURL(computedComponentExternalLinks)) {\n return computedComponentExternalLinks;\n }\n if (isURL(computedServerExternalLinks)) {\n return computedServerExternalLinks;\n }\n return record.id;\n },\n [serversExternalLinks, componentExternalLinks]\n );\n};\n\nexport default useGetExternalLink;\n","import { useState, useEffect } from 'react';\nimport useDataModel from './useDataModel';\nimport useDataServers from './useDataServers';\nimport findContainersWithTypes from '../dataProvider/utils/findContainersWithTypes';\nimport { DataServerKey } from '../dataProvider/types';\n\nconst useContainers = (resourceId: string, serverKeys = '@all') => {\n const dataModel = useDataModel(resourceId);\n const dataServers = useDataServers();\n const [containers, setContainers] = useState>();\n\n useEffect(() => {\n if (dataModel && dataServers) {\n setContainers(findContainersWithTypes(dataModel.types, serverKeys, dataServers));\n }\n }, [dataModel, dataServers, serverKeys]);\n\n return containers;\n};\n\nexport default useContainers;\n","import { useContext, useState, useEffect } from 'react';\nimport { DataProviderContext } from 'react-admin';\n\nconst useDataModel = (resourceId: string) => {\n // Get the raw data provider, since useDataProvider returns a wrapper\n const dataProvider = useContext(DataProviderContext);\n const [dataModel, setDataModel] = useState(undefined); // TODO: Type this object\n\n useEffect(() => {\n dataProvider.getDataModels().then((results: any) => setDataModel(results[resourceId]));\n }, [dataProvider, resourceId, setDataModel]);\n\n return dataModel;\n};\n\nexport default useDataModel;\n","import { useState, useEffect } from 'react';\nimport { useDataProvider } from 'react-admin';\nimport { DataProvider, DataServersConfig } from '../dataProvider/types';\n\nconst useDataServers = () => {\n const dataProvider = useDataProvider();\n const [dataServers, setDataServers] = useState();\n\n useEffect(() => {\n dataProvider.getDataServers().then(results => {\n setDataServers(results);\n });\n }, [dataProvider, setDataServers]);\n\n return dataServers;\n};\n\nexport default useDataServers;\n","import { useState, useEffect } from 'react';\nimport urlJoin from 'url-join';\nimport useDataModel from './useDataModel';\nimport useDataServers from './useDataServers';\nimport findCreateContainerWithTypes from '../dataProvider/utils/findCreateContainerWithTypes';\nimport getServerKeyFromType from '../dataProvider/utils/getServerKeyFromType';\n\n/** @deprecated Use \"useCreateContainerUri\" instead */\nconst useCreateContainer = resourceId => {\n const dataModel = useDataModel(resourceId);\n const dataServers = useDataServers();\n const [createContainer, setCreateContainer] = useState();\n\n useEffect(() => {\n if (dataModel && dataServers) {\n if (dataModel.create?.container) {\n const [serverKey, path] = Object.entries(dataModel.create.container)[0];\n if (!serverKey || !dataServers[serverKey]) {\n throw new Error(`Wrong key for the dataModel.create.container config of resource ${resourceId}`);\n }\n setCreateContainer(urlJoin(dataServers[serverKey].baseUrl, path));\n } else if (dataModel.create?.server) {\n setCreateContainer(findCreateContainerWithTypes(dataModel.types, dataModel.create?.server, dataServers));\n } else {\n const defaultServerKey = getServerKeyFromType('default', dataServers);\n setCreateContainer(findCreateContainerWithTypes(dataModel.types, defaultServerKey, dataServers));\n }\n }\n }, [dataModel, dataServers, setCreateContainer]);\n\n return createContainer;\n};\n\nexport default useCreateContainer;\n","import urlJoin from 'url-join';\nimport { DataModel, DataServerKey, DataServersConfig } from '../types';\n\nconst findCreateContainerWithTypes = (\n types: DataModel['types'],\n createServerKey: DataServerKey,\n dataServers: DataServersConfig\n) => {\n const containers: string[] = [];\n\n Object.keys(dataServers[createServerKey].containers?.[createServerKey] || {}).forEach(type => {\n if (types.includes(type)) {\n dataServers[createServerKey].containers![createServerKey][type].forEach(path => {\n const containerUri = urlJoin(dataServers[createServerKey].baseUrl, path);\n if (!containers.includes(containerUri)) {\n containers.push(containerUri);\n }\n });\n }\n });\n\n if (containers.length === 0) {\n throw new Error(\n `No container found matching with types ${JSON.stringify(\n types\n )}. You can set explicitely the create.container property of the resource.`\n );\n } else if (containers.length > 1) {\n throw new Error(\n `More than one container found matching with types ${JSON.stringify(\n types\n )}. You must set the create.server or create.container property for the resource.`\n );\n }\n\n return containers[0];\n};\n\nexport default findCreateContainerWithTypes;\n","import { useCallback } from 'react';\nimport urlJoin from 'url-join';\nimport useDataServers from './useDataServers';\nimport findCreateContainerWithTypes from '../dataProvider/utils/findCreateContainerWithTypes';\nimport getServerKeyFromType from '../dataProvider/utils/getServerKeyFromType';\nimport useDataModels from './useDataModels';\n\nconst useCreateContainerUri = () => {\n const dataModels = useDataModels();\n const dataServers = useDataServers();\n\n const getContainerUri = useCallback(\n (resourceId: string) => {\n if (!dataModels || !dataServers || !dataModels[resourceId]) {\n return undefined;\n }\n\n const dataModel = dataModels[resourceId];\n\n if (dataModel.create?.container) {\n const [serverKey, path] = Object.entries(dataModel.create.container)[0];\n if (!serverKey || !dataServers[serverKey]) {\n throw new Error(`Wrong key for the dataModel.create.container config of resource ${resourceId}`);\n }\n return urlJoin(dataServers[serverKey].baseUrl, path);\n }\n\n if (dataModel.create?.server) {\n return findCreateContainerWithTypes(dataModel.types, dataModel.create?.server, dataServers);\n }\n\n const defaultServerKey = getServerKeyFromType('default', dataServers);\n\n if (!defaultServerKey) {\n throw new Error(\n `No default dataServer found. You can set explicitly one setting the \"default\" attribute to true`\n );\n }\n\n return findCreateContainerWithTypes(dataModel.types, defaultServerKey, dataServers);\n },\n [dataModels, dataServers]\n );\n\n return getContainerUri;\n};\n\nexport default useCreateContainerUri;\n","import { useState, useEffect } from 'react';\nimport { useDataProvider } from 'react-admin';\nimport { DataModel, DataProvider } from '../dataProvider/types';\n\nconst useDataModels = () => {\n const dataProvider = useDataProvider();\n const [dataModels, setDataModels] = useState>();\n\n useEffect(() => {\n dataProvider.getDataModels().then(results => {\n setDataModels(results);\n });\n }, [dataProvider, setDataModels]);\n\n return dataModels;\n};\n\nexport default useDataModels;\n","import React, { useState, useEffect } from 'react';\n\n/**\n * @example\n * \n * \n * \n * \n * \n * \n */\n\nconst FilterHandler = ({ children, record, filter, source, ...otherProps }) => {\n const [filtered, setFiltered] = useState();\n useEffect(() => {\n if (record && source && Array.isArray(record?.[source])) {\n const filteredData = record?.[source].filter(r => {\n let eq = true;\n for (const key in filter) {\n const value = r[key];\n if (Array.isArray(value)) {\n if (!value.includes(filter[key])) {\n eq = false;\n }\n } else if (value !== filter[key]) {\n eq = false;\n }\n }\n return eq;\n });\n const newRecord = {\n ...record\n };\n // undefined setted if no data to obtain no render in RightLabel or equivalent\n newRecord[source] = filteredData.length > 0 ? filteredData : undefined;\n setFiltered(newRecord);\n }\n }, [record, source, filter]);\n\n return (\n <>\n {React.Children.map(children, (child, i) => {\n return React.cloneElement(child, {\n ...otherProps,\n record: filtered,\n source\n });\n })}\n >\n );\n};\nexport default FilterHandler;\n","import React from 'react';\nimport { useGetList, useRecordContext } from 'react-admin';\nimport { default as FilterHandler } from './FilterHandler';\n\n/*\n * @example Label used in examples\n * const Label = ({label, ...otherProps})=>{\n * return
{label}
\n * }\n *\n * @example show header for each group with group property thanks to groupHeader\n * }\n * filterProperty=\"property of source filtered by groupReference\"\n * >\n * // same props as GroupedArrayField source\n * \n * \n * \n * \n *\n * @example call chhildren with label thanks to groupLabel\n * \n * \n *\n * @example conditional show of group if no data in source. Conditionale groupHeader is not possible because GroupedArrayField define group before filter ; need use chhildren.\n * const ConditionalSourceDefinedHandler = ({record,source,children,...otherProps})=>{\n * if (record?.[source] && (!Array.isArray(record[source])||record[source].length>0)){\n * return React.Children.map(children, (child, i) => {\n * return React.cloneElement(child, {...otherProps,record,source});\n * })\n * }else{\n * return <>>\n * }\n * }\n *\n * \n * \n * \n * \n *\n *\n */\nconst GroupedReferenceHandler = ({\n children,\n groupReference,\n groupLabel,\n groupHeader,\n filterProperty,\n ...otherProps\n}) => {\n const record = useRecordContext();\n const { data } = useGetList(groupReference);\n\n return (\n <>\n {data?.map((data, index) => {\n const filter = {};\n filter[filterProperty] = data.id;\n return (\n <>\n {groupHeader && groupHeader({ ...otherProps, group: data })}\n \n {children}\n \n >\n );\n })}\n >\n );\n};\n\nexport default GroupedReferenceHandler;\n","import React, { useEffect, useState } from 'react';\nimport { ArrayInput, SimpleFormIterator, TextInput } from 'react-admin';\nimport makeStyles from '@mui/styles/makeStyles';\n\nconst useReferenceInputStyles = makeStyles({\n form: {\n display: 'flex'\n },\n input: {\n paddingRight: '20px'\n }\n});\n\nconst useHideInputStyles = makeStyles({\n root: {\n display: 'none'\n }\n});\n\nconst ReificationArrayInput = props => {\n const { reificationClass, children, ...otherProps } = props;\n const flexFormClasses = useReferenceInputStyles();\n const hideInputStyles = useHideInputStyles();\n\n return (\n \n \n {React.Children.map(props.children, (child, i) => {\n return React.cloneElement(child, {\n className: flexFormClasses.input\n });\n })}\n \n \n \n );\n};\n\nexport default ReificationArrayInput;\n","import { fetchUtils } from 'react-admin';\nimport arrayOf from '../dataProvider/utils/arrayOf';\n\n/*\n * Utility functions for subscribing to resource update using Solid Notifications.\n * See https://solidproject.org/TR/notifications-protocol for an overview.\n */\n\ntype fetchFn = typeof fetchUtils.fetchJson;\n\ninterface CreateSolidChannelOptions {\n type: string;\n closeAfter?: number;\n startIn?: number;\n startAt?: string;\n endAt?: string;\n rate?: number;\n}\n\n/**\n * Find the solid notification description resource for a given resource URI.\n */\nconst findDescriptionResource = async (fetch: fetchFn, resourceUri: string) => {\n const { headers } = await fetch(resourceUri, { method: 'HEAD' });\n const linkHeader = headers.get('Link');\n\n const matches = linkHeader?.match(\n /<([^>]+)>;\\s*rel=\"(?:describedby|http:\\/\\/www\\.w3\\.org\\/ns\\/solid\\/terms#storageDescription)\"/\n );\n if (!matches?.[1]) {\n return undefined;\n // matches[1] contains the URI of the description resource\n // Further actions can be taken here, such as subscribing to the websocket using the description resource URI\n }\n const { json: descriptionResource } = await fetch(matches[1]);\n return descriptionResource;\n};\n\nconst createSolidNotificationChannel = async (\n fetch: fetchFn,\n resourceUri: string,\n options: CreateSolidChannelOptions = { type: 'WebSocketChannel2023' }\n) => {\n const { type, closeAfter, startIn, rate } = options;\n let { startAt, endAt } = options;\n if (startIn && !startAt) startAt = new Date(Date.now() + startIn).toISOString();\n if (closeAfter && !endAt) endAt = new Date(Date.now() + closeAfter).toISOString();\n\n const descriptionResource = await findDescriptionResource(fetch, resourceUri);\n\n // TODO: use a json-ld parser / ldo in the future for this...\n // Get solid notification subscription service for the given type.\n const subscriptionService = (\n await Promise.all(\n // Get the subscription service resources (that describe a channel type).\n arrayOf(descriptionResource.subscription || descriptionResource['notify:subscription']).map(\n async subscriptionServiceOrUri => {\n // They might not be resolved...\n if (typeof subscriptionServiceOrUri === 'string') {\n const { json } = await fetch(subscriptionServiceOrUri);\n return json;\n }\n return subscriptionServiceOrUri;\n }\n )\n )\n ).find((service: any) => {\n // Find for the correct channel type (e.g. web socket).\n const channelType = service.channelType ?? service['notify:channelType'];\n return channelType === type || channelType === `notify:${type}`;\n });\n\n if (!subscriptionService) {\n throw new Error(`No solid notification subscription service found for type ${type}`);\n }\n\n // Create a new channel.\n const { json: channel } = await fetch(subscriptionService.id || subscriptionService['@id'], {\n method: 'POST',\n body: JSON.stringify({\n '@context': 'https://www.w3.org/ns/solid/notification/v1',\n type: 'WebSocketChannel2023',\n topic: resourceUri,\n startAt,\n endAt,\n rate\n })\n });\n\n return channel;\n};\n\nconst createWsChannel = async (fetch: fetchFn, resourceUri: string, options: CreateSolidChannelOptions) => {\n const channel = await createSolidNotificationChannel(fetch, resourceUri, options);\n const receiveFrom: string = channel.receiveFrom || channel['notify:receiveFrom'];\n\n return new WebSocket(receiveFrom);\n};\n\nconst registeredWebSockets = new Map>();\n\n/**\n * @param fetch A react admin fetch function.\n * @param resourceUri The resource to subscribe to\n * @param options Options to pass to @see createSolidNotificationChannel, if the channel does not exist yet.\n * @returns {WebSocket} A new or existing web socket that subscribed to the given resource.\n */\nconst getOrCreateWsChannel = async (\n fetch: fetchFn,\n resourceUri: string,\n options: CreateSolidChannelOptions = { type: 'WebSocketChannel2023', closeAfter: 1000 * 60 * 60 }\n) => {\n const socket = registeredWebSockets.get(resourceUri);\n if (socket) {\n // Will resolve or is resolved already.\n return socket;\n }\n\n // Create a promise, to return immediately and set the sockets cache.\n // This prevents racing conditions that create multiple channels.\n const wsPromise = createWsChannel(fetch, resourceUri, { ...options, type: 'WebSocketChannel2023' }).then(ws => {\n // Remove the promise from the cache, if it closes.\n ws.addEventListener('close', e => {\n registeredWebSockets.delete(resourceUri);\n });\n // Close the socket, if the endAt / closeAfter time is reached.\n const closeIn = options.closeAfter ?? (options.endAt && new Date(options.endAt).getTime() - Date.now());\n if (closeIn)\n setTimeout(() => {\n ws.close();\n }, closeIn);\n\n return ws;\n });\n\n registeredWebSockets.set(resourceUri, wsPromise);\n return wsPromise;\n};\n\nexport { getOrCreateWsChannel, createWsChannel, createSolidNotificationChannel };\n"],"names":[],"version":3,"file":"index.cjs.js.map"}
\ No newline at end of file
diff --git a/src/frontend/packages/semantic-data-provider/dist/index.d.ts b/src/frontend/packages/semantic-data-provider/dist/index.d.ts
index 277ee0545..04ed7429f 100644
--- a/src/frontend/packages/semantic-data-provider/dist/index.d.ts
+++ b/src/frontend/packages/semantic-data-provider/dist/index.d.ts
@@ -1,3 +1,4 @@
+import { fetchUtils } from "react-admin";
type DataServerKey = string & {
readonly _type?: 'DataServerKey';
};
@@ -126,5 +127,23 @@ export function GroupedReferenceHandler({ children, groupReference, groupLabel,
filterProperty: any;
}): import("react/jsx-runtime").JSX.Element;
export function ReificationArrayInput(props: any): import("react/jsx-runtime").JSX.Element;
+type fetchFn = typeof fetchUtils.fetchJson;
+interface CreateSolidChannelOptions {
+ type: string;
+ closeAfter?: number;
+ startIn?: number;
+ startAt?: string;
+ endAt?: string;
+ rate?: number;
+}
+export const createSolidNotificationChannel: (fetch: fetchFn, resourceUri: string, options?: CreateSolidChannelOptions) => Promise;
+export const createWsChannel: (fetch: fetchFn, resourceUri: string, options: CreateSolidChannelOptions) => Promise;
+/**
+ * @param fetch A react admin fetch function.
+ * @param resourceUri The resource to subscribe to
+ * @param options Options to pass to @see createSolidNotificationChannel, if the channel does not exist yet.
+ * @returns {WebSocket} A new or existing web socket that subscribed to the given resource.
+ */
+export const getOrCreateWsChannel: (fetch: fetchFn, resourceUri: string, options?: CreateSolidChannelOptions) => Promise;
//# sourceMappingURL=index.d.ts.map
diff --git a/src/frontend/packages/semantic-data-provider/dist/index.d.ts.map b/src/frontend/packages/semantic-data-provider/dist/index.d.ts.map
index 67ab78297..f6aaed850 100644
--- a/src/frontend/packages/semantic-data-provider/dist/index.d.ts.map
+++ b/src/frontend/packages/semantic-data-provider/dist/index.d.ts.map
@@ -1 +1 @@
-{"mappings":"AEGA,qBAA4B,MAAM,GAAG;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,eAAe,CAAA;CAAE,CAAC;AAG1E,wBAAwB;IACtB,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;IAEhB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,4CAA4C;IAC5C,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf,kCAAkC;IAClC,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd,wCAAwC;IACxC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,aAAa,CAAC,EAAE,OAAO,CAAC;IAGxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAC7D,UAAU,EAAE,GAAG,CAAC;CACjB,CAAC;AAEF,yBAAgC,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;AAQxE,iBAAwB;IACtB,6EAA6E;IAC7E,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE;QACL,+DAA+D;QAC/D,OAAO,CAAC,EAAE,aAAa,EAAE,GAAG,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;QAE/F,6FAA6F;QAC7F,UAAU,CAAC,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,CAAC;QAE7C,kIAAkI;QAClI,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QAEtB,0HAA0H;QAC1H,UAAU,CAAC,EAAE,EAAE,CAAC;QAEhB,2DAA2D;QAC3D,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QAEtB,2DAA2D;QAC3D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAEjC,iGAAiG;QACjG,cAAc,CAAC,EAAE,OAAO,CAAC;QAEzB,sGAAsG;QACtG,sBAAsB,CAAC,EAAE,OAAO,CAAC;KAClC,CAAC;IACF,MAAM,CAAC,EAAE;QACP,oEAAoE;QACpE,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,aAAa,CAAC;QAEvD,6GAA6G;QAC7G,SAAS,CAAC,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;KAC3C,CAAC;IACF,aAAa,CAAC,EAAE;QACd,iCAAiC;QACjC,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;Ae5CF;;;;;;;;;EAoCC;AE7DD;;;;;QA4JC;AW7JD;;;;;;;;;;;;;;;EAmDC;AC3DD,sFA2CC;AC/CD,OAAA,MAAM,2BAA4B,MAAM,QAUvC,CAAC;ACTF,OAAA,MAAM,mDAWL,CAAC;ACTF,OAAA,MAAM,4BAA6B,MAAM,qEAYxC,CAAC;AEXF,sDAAsD;AACtD,+DAuBC;AC3BD,OAAA,MAAM,0DAWL,CAAC;ACRF,OAAA,MAAM,0CAKW,MAAM,uBAiCtB,CAAC;AC3CF;;;;;;;;;;;;;GAaG;AAEH;;;;;;4CAsCC;ACUD;;;;;;;4CA2BC;ACzED,2FAiBC","sources":["packages/semantic-data-provider/src/src/dataProvider/utils/fetchResource.js","packages/semantic-data-provider/src/src/dataProvider/methods/getOne.js","packages/semantic-data-provider/src/src/dataProvider/types.ts","packages/semantic-data-provider/src/src/dataProvider/utils/handleFiles.ts","packages/semantic-data-provider/src/src/dataProvider/utils/getServerKeyFromType.js","packages/semantic-data-provider/src/src/dataProvider/utils/parseServerKeys.js","packages/semantic-data-provider/src/src/dataProvider/utils/findContainersWithTypes.ts","packages/semantic-data-provider/src/src/dataProvider/methods/create.js","packages/semantic-data-provider/src/src/dataProvider/methods/delete.ts","packages/semantic-data-provider/src/src/dataProvider/methods/deleteMany.js","packages/semantic-data-provider/src/src/dataProvider/methods/getDataServers.js","packages/semantic-data-provider/src/src/dataProvider/methods/getDataModels.js","packages/semantic-data-provider/src/src/dataProvider/utils/arrayOf.ts","packages/semantic-data-provider/src/src/dataProvider/utils/fetchContainers.ts","packages/semantic-data-provider/src/src/dataProvider/utils/getEmbedFrame.js","packages/semantic-data-provider/src/src/dataProvider/utils/resolvePrefix.js","packages/semantic-data-provider/src/src/dataProvider/utils/buildBaseQuery.js","packages/semantic-data-provider/src/src/dataProvider/utils/buildBlankNodesQuery.js","packages/semantic-data-provider/src/src/dataProvider/utils/buildAutoDetectBlankNodesQuery.js","packages/semantic-data-provider/src/src/dataProvider/utils/buildSparqlQuery.js","packages/semantic-data-provider/src/src/dataProvider/utils/fetchSparqlEndpoints.js","packages/semantic-data-provider/src/src/dataProvider/utils/findContainersWithPath.js","packages/semantic-data-provider/src/src/dataProvider/methods/getList.js","packages/semantic-data-provider/src/src/dataProvider/methods/getMany.js","packages/semantic-data-provider/src/src/dataProvider/methods/getManyReference.js","packages/semantic-data-provider/src/src/dataProvider/methods/update.ts","packages/semantic-data-provider/src/src/dataProvider/utils/fetchUserConfig.js","packages/semantic-data-provider/src/src/dataProvider/utils/fetchVoidEndpoints.js","packages/semantic-data-provider/src/src/dataProvider/utils/getServerKeyFromUri.js","packages/semantic-data-provider/src/src/dataProvider/httpClient.js","packages/semantic-data-provider/src/src/dataProvider/dataProvider.js","packages/semantic-data-provider/src/src/hooks/useGetExternalLink.js","packages/semantic-data-provider/src/src/hooks/useDataModel.ts","packages/semantic-data-provider/src/src/hooks/useDataServers.ts","packages/semantic-data-provider/src/src/hooks/useContainers.ts","packages/semantic-data-provider/src/src/dataProvider/utils/findCreateContainerWithTypes.ts","packages/semantic-data-provider/src/src/hooks/useCreateContainer.js","packages/semantic-data-provider/src/src/hooks/useDataModels.ts","packages/semantic-data-provider/src/src/hooks/useCreateContainerUri.ts","packages/semantic-data-provider/src/src/reification/FilterHandler.js","packages/semantic-data-provider/src/src/reification/GroupedReferenceHandler.js","packages/semantic-data-provider/src/src/reification/ReificationArrayInput.js","packages/semantic-data-provider/src/src/index.ts","packages/semantic-data-provider/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"export { default as dataProvider } from './dataProvider/dataProvider';\n\nexport { default as buildSparqlQuery } from './dataProvider/utils/buildSparqlQuery';\nexport { default as buildBlankNodesQuery } from './dataProvider/utils/buildBlankNodesQuery';\n\nexport { default as useGetExternalLink } from './hooks/useGetExternalLink';\nexport { default as useContainers } from './hooks/useContainers';\nexport { default as useCreateContainer } from './hooks/useCreateContainer';\nexport { default as useCreateContainerUri } from './hooks/useCreateContainerUri';\nexport { default as useDataModel } from './hooks/useDataModel';\nexport { default as useDataModels } from './hooks/useDataModels';\nexport { default as useDataServers } from './hooks/useDataServers';\n\nexport { default as FilterHandler } from './reification/FilterHandler';\nexport { default as GroupedReferenceHandler } from './reification/GroupedReferenceHandler';\nexport { default as ReificationArrayInput } from './reification/ReificationArrayInput';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
\ No newline at end of file
+{"mappings":";AEGA,qBAA4B,MAAM,GAAG;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,eAAe,CAAA;CAAE,CAAC;AAG1E,wBAAwB;IACtB,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;IAEhB,0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KG;AACH,OAAA,MAAM,8BACG,OAAO,eACD,MAAM,YACV,yBAAyB,uBA2BnC,CAAC","sources":["packages/semantic-data-provider/src/src/dataProvider/utils/fetchResource.js","packages/semantic-data-provider/src/src/dataProvider/methods/getOne.js","packages/semantic-data-provider/src/src/dataProvider/types.ts","packages/semantic-data-provider/src/src/dataProvider/utils/handleFiles.ts","packages/semantic-data-provider/src/src/dataProvider/utils/getServerKeyFromType.js","packages/semantic-data-provider/src/src/dataProvider/utils/parseServerKeys.js","packages/semantic-data-provider/src/src/dataProvider/utils/findContainersWithTypes.ts","packages/semantic-data-provider/src/src/dataProvider/methods/create.js","packages/semantic-data-provider/src/src/dataProvider/methods/delete.ts","packages/semantic-data-provider/src/src/dataProvider/methods/deleteMany.js","packages/semantic-data-provider/src/src/dataProvider/methods/getDataServers.js","packages/semantic-data-provider/src/src/dataProvider/methods/getDataModels.js","packages/semantic-data-provider/src/src/dataProvider/utils/arrayOf.ts","packages/semantic-data-provider/src/src/dataProvider/utils/fetchContainers.ts","packages/semantic-data-provider/src/src/dataProvider/utils/getEmbedFrame.js","packages/semantic-data-provider/src/src/dataProvider/utils/resolvePrefix.js","packages/semantic-data-provider/src/src/dataProvider/utils/buildBaseQuery.js","packages/semantic-data-provider/src/src/dataProvider/utils/buildBlankNodesQuery.js","packages/semantic-data-provider/src/src/dataProvider/utils/buildAutoDetectBlankNodesQuery.js","packages/semantic-data-provider/src/src/dataProvider/utils/buildSparqlQuery.js","packages/semantic-data-provider/src/src/dataProvider/utils/fetchSparqlEndpoints.js","packages/semantic-data-provider/src/src/dataProvider/utils/findContainersWithPath.js","packages/semantic-data-provider/src/src/dataProvider/methods/getList.js","packages/semantic-data-provider/src/src/dataProvider/methods/getMany.js","packages/semantic-data-provider/src/src/dataProvider/methods/getManyReference.js","packages/semantic-data-provider/src/src/dataProvider/methods/update.ts","packages/semantic-data-provider/src/src/dataProvider/utils/fetchUserConfig.js","packages/semantic-data-provider/src/src/dataProvider/utils/fetchVoidEndpoints.js","packages/semantic-data-provider/src/src/dataProvider/utils/getServerKeyFromUri.js","packages/semantic-data-provider/src/src/dataProvider/httpClient.js","packages/semantic-data-provider/src/src/dataProvider/dataProvider.js","packages/semantic-data-provider/src/src/hooks/useGetExternalLink.js","packages/semantic-data-provider/src/src/hooks/useDataModel.ts","packages/semantic-data-provider/src/src/hooks/useDataServers.ts","packages/semantic-data-provider/src/src/hooks/useContainers.ts","packages/semantic-data-provider/src/src/dataProvider/utils/findCreateContainerWithTypes.ts","packages/semantic-data-provider/src/src/hooks/useCreateContainer.js","packages/semantic-data-provider/src/src/hooks/useDataModels.ts","packages/semantic-data-provider/src/src/hooks/useCreateContainerUri.ts","packages/semantic-data-provider/src/src/reification/FilterHandler.js","packages/semantic-data-provider/src/src/reification/GroupedReferenceHandler.js","packages/semantic-data-provider/src/src/reification/ReificationArrayInput.js","packages/semantic-data-provider/src/src/notificationChannels/subscribeToUpdates.ts","packages/semantic-data-provider/src/src/index.ts","packages/semantic-data-provider/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"export { default as dataProvider } from './dataProvider/dataProvider';\n\nexport { default as buildSparqlQuery } from './dataProvider/utils/buildSparqlQuery';\nexport { default as buildBlankNodesQuery } from './dataProvider/utils/buildBlankNodesQuery';\n\nexport { default as useGetExternalLink } from './hooks/useGetExternalLink';\nexport { default as useContainers } from './hooks/useContainers';\nexport { default as useCreateContainer } from './hooks/useCreateContainer';\nexport { default as useCreateContainerUri } from './hooks/useCreateContainerUri';\nexport { default as useDataModel } from './hooks/useDataModel';\nexport { default as useDataModels } from './hooks/useDataModels';\nexport { default as useDataServers } from './hooks/useDataServers';\n\nexport { default as FilterHandler } from './reification/FilterHandler';\nexport { default as GroupedReferenceHandler } from './reification/GroupedReferenceHandler';\nexport { default as ReificationArrayInput } from './reification/ReificationArrayInput';\n\nexport {\n createWsChannel,\n getOrCreateWsChannel,\n createSolidNotificationChannel\n} from './notificationChannels/subscribeToUpdates';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
\ No newline at end of file
diff --git a/src/frontend/packages/semantic-data-provider/dist/index.es.js b/src/frontend/packages/semantic-data-provider/dist/index.es.js
index e73ffbe14..3489f90af 100644
--- a/src/frontend/packages/semantic-data-provider/dist/index.es.js
+++ b/src/frontend/packages/semantic-data-provider/dist/index.es.js
@@ -1543,6 +1543,97 @@ var $6844bbce0ad66151$export$2e2bcd8739ae039 = $6844bbce0ad66151$var$Reification
+/**
+ * Find the solid notification description resource for a given resource URI.
+ */ const $03d52e691e8dc945$var$findDescriptionResource = async (fetch, resourceUri)=>{
+ const { headers: headers } = await fetch(resourceUri, {
+ method: "HEAD"
+ });
+ const linkHeader = headers.get("Link");
+ const matches = linkHeader?.match(/<([^>]+)>;\s*rel="(?:describedby|http:\/\/www\.w3\.org\/ns\/solid\/terms#storageDescription)"/);
+ if (!matches?.[1]) return undefined;
+ const { json: descriptionResource } = await fetch(matches[1]);
+ return descriptionResource;
+};
+const $03d52e691e8dc945$export$3edfe18db119b920 = async (fetch, resourceUri, options = {
+ type: "WebSocketChannel2023"
+})=>{
+ const { type: type, closeAfter: closeAfter, startIn: startIn, rate: rate } = options;
+ let { startAt: startAt, endAt: endAt } = options;
+ if (startIn && !startAt) startAt = new Date(Date.now() + startIn).toISOString();
+ if (closeAfter && !endAt) endAt = new Date(Date.now() + closeAfter).toISOString();
+ const descriptionResource = await $03d52e691e8dc945$var$findDescriptionResource(fetch, resourceUri);
+ // TODO: use a json-ld parser / ldo in the future for this...
+ // Get solid notification subscription service for the given type.
+ const subscriptionService = (await Promise.all(// Get the subscription service resources (that describe a channel type).
+ (0, $cc8adac4b83414eb$export$2e2bcd8739ae039)(descriptionResource.subscription || descriptionResource["notify:subscription"]).map(async (subscriptionServiceOrUri)=>{
+ // They might not be resolved...
+ if (typeof subscriptionServiceOrUri === "string") {
+ const { json: json } = await fetch(subscriptionServiceOrUri);
+ return json;
+ }
+ return subscriptionServiceOrUri;
+ }))).find((service)=>{
+ // Find for the correct channel type (e.g. web socket).
+ const channelType = service.channelType ?? service["notify:channelType"];
+ return channelType === type || channelType === `notify:${type}`;
+ });
+ if (!subscriptionService) throw new Error(`No solid notification subscription service found for type ${type}`);
+ // Create a new channel.
+ const { json: channel } = await fetch(subscriptionService.id || subscriptionService["@id"], {
+ method: "POST",
+ body: JSON.stringify({
+ "@context": "https://www.w3.org/ns/solid/notification/v1",
+ type: "WebSocketChannel2023",
+ topic: resourceUri,
+ startAt: startAt,
+ endAt: endAt,
+ rate: rate
+ })
+ });
+ return channel;
+};
+const $03d52e691e8dc945$export$28772ab4c256e709 = async (fetch, resourceUri, options)=>{
+ const channel = await $03d52e691e8dc945$export$3edfe18db119b920(fetch, resourceUri, options);
+ const receiveFrom = channel.receiveFrom || channel["notify:receiveFrom"];
+ return new WebSocket(receiveFrom);
+};
+const $03d52e691e8dc945$var$registeredWebSockets = new Map();
+/**
+ * @param fetch A react admin fetch function.
+ * @param resourceUri The resource to subscribe to
+ * @param options Options to pass to @see createSolidNotificationChannel, if the channel does not exist yet.
+ * @returns {WebSocket} A new or existing web socket that subscribed to the given resource.
+ */ const $03d52e691e8dc945$export$8d60734939c59ced = async (fetch, resourceUri, options = {
+ type: "WebSocketChannel2023",
+ closeAfter: 3600000
+})=>{
+ const socket = $03d52e691e8dc945$var$registeredWebSockets.get(resourceUri);
+ if (socket) // Will resolve or is resolved already.
+ return socket;
+ // Create a promise, to return immediately and set the sockets cache.
+ // This prevents racing conditions that create multiple channels.
+ const wsPromise = $03d52e691e8dc945$export$28772ab4c256e709(fetch, resourceUri, {
+ ...options,
+ type: "WebSocketChannel2023"
+ }).then((ws)=>{
+ // Remove the promise from the cache, if it closes.
+ ws.addEventListener("close", (e)=>{
+ $03d52e691e8dc945$var$registeredWebSockets.delete(resourceUri);
+ });
+ // Close the socket, if the endAt / closeAfter time is reached.
+ const closeIn = options.closeAfter ?? (options.endAt && new Date(options.endAt).getTime() - Date.now());
+ if (closeIn) setTimeout(()=>{
+ ws.close();
+ }, closeIn);
+ return ws;
+ });
+ $03d52e691e8dc945$var$registeredWebSockets.set(resourceUri, wsPromise);
+ return wsPromise;
+};
+
+
+
-export {$243bf28fbb1b868f$export$2e2bcd8739ae039 as dataProvider, $6cde9a8fbbde3ffb$export$2e2bcd8739ae039 as buildSparqlQuery, $865f630cc944e818$export$2e2bcd8739ae039 as buildBlankNodesQuery, $87656edf926c0f1f$export$2e2bcd8739ae039 as useGetExternalLink, $586fa0ea9d02fa12$export$2e2bcd8739ae039 as useContainers, $7bd037d7ec9d51f8$export$2e2bcd8739ae039 as useCreateContainer, $35f3e75c86e51f35$export$2e2bcd8739ae039 as useCreateContainerUri, $e5a0eacd756fd1d5$export$2e2bcd8739ae039 as useDataModel, $3a9656756670cb78$export$2e2bcd8739ae039 as useDataModels, $4daf4cf698ee4eed$export$2e2bcd8739ae039 as useDataServers, $406574efa35ec6f1$export$2e2bcd8739ae039 as FilterHandler, $1d8c1cbe606a94ae$export$2e2bcd8739ae039 as GroupedReferenceHandler, $6844bbce0ad66151$export$2e2bcd8739ae039 as ReificationArrayInput};
+export {$243bf28fbb1b868f$export$2e2bcd8739ae039 as dataProvider, $6cde9a8fbbde3ffb$export$2e2bcd8739ae039 as buildSparqlQuery, $865f630cc944e818$export$2e2bcd8739ae039 as buildBlankNodesQuery, $87656edf926c0f1f$export$2e2bcd8739ae039 as useGetExternalLink, $586fa0ea9d02fa12$export$2e2bcd8739ae039 as useContainers, $7bd037d7ec9d51f8$export$2e2bcd8739ae039 as useCreateContainer, $35f3e75c86e51f35$export$2e2bcd8739ae039 as useCreateContainerUri, $e5a0eacd756fd1d5$export$2e2bcd8739ae039 as useDataModel, $3a9656756670cb78$export$2e2bcd8739ae039 as useDataModels, $4daf4cf698ee4eed$export$2e2bcd8739ae039 as useDataServers, $406574efa35ec6f1$export$2e2bcd8739ae039 as FilterHandler, $1d8c1cbe606a94ae$export$2e2bcd8739ae039 as GroupedReferenceHandler, $6844bbce0ad66151$export$2e2bcd8739ae039 as ReificationArrayInput, $03d52e691e8dc945$export$28772ab4c256e709 as createWsChannel, $03d52e691e8dc945$export$8d60734939c59ced as getOrCreateWsChannel, $03d52e691e8dc945$export$3edfe18db119b920 as createSolidNotificationChannel};
//# sourceMappingURL=index.es.js.map
diff --git a/src/frontend/packages/semantic-data-provider/dist/index.es.js.map b/src/frontend/packages/semantic-data-provider/dist/index.es.js.map
index 3a46c573e..f6d4d5759 100644
--- a/src/frontend/packages/semantic-data-provider/dist/index.es.js.map
+++ b/src/frontend/packages/semantic-data-provider/dist/index.es.js.map
@@ -1 +1 @@
-{"mappings":";;;;;;;;;;;;;AIEA,MAAM,sCAAgB,OAAO,aAAa;IACxC,MAAM,cAAE,UAAU,eAAE,WAAW,EAAE,GAAG;IAEpC,IAAI,EAAE,MAAM,IAAI,EAAE,GAAG,MAAM,WAAW;IAEtC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAAC;IAE7D,KAAK,EAAE,GAAG,KAAK,EAAE,IAAI,IAAI,CAAC,MAAM;IAEhC,sFAAsF;IACtF,gDAAgD;IAChD,IAAI,IAAI,CAAC,WAAW,KAAK,aACvB,OAAO,MAAM,CAAA,GAAA,aAAK,EAAE,OAAO,CAAC,MAAM;IAGpC,OAAO;AACT;IAEA,2CAAe;;;ADlBf,MAAM,qCAAe,CAAA,SAAU,OAAO,YAAY;QAChD,MAAM,aAAE,SAAS,EAAE,GAAG;QACtB,MAAM,YAAY,SAAS,CAAC,WAAW;QAEvC,IAAI,CAAC,WAAW,MAAM,IAAI,MAAM,CAAC,SAAS,EAAE,WAAW,gCAAgC,CAAC;QAExF,MAAM,OAAO,MAAM,CAAA,GAAA,wCAAY,EAAE,OAAO,EAAE,EAAE;QAE5C,yDAAyD;QACzD,IAAI,UAAU,IAAI,EAAE,YAAY;YAC9B,KAAK,MAAM,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L,cAAc;IAChB;AACF;AAEA,MAAM,2CAAqB,CAAA,GAAA,0BAAS,EAAE;IACpC,MAAM;QACJ,SAAS;IACX;AACF;AAEA,MAAM,8CAAwB,CAAA;IAC5B,MAAM,oBAAE,gBAAgB,YAAE,QAAQ,EAAE,GAAG,YAAY,GAAG;IACtD,MAAM,kBAAkB;IACxB,MAAM,kBAAkB;IAExB,qBACE,gBAAC,CAAA,GAAA,iBAAS;QAAG,GAAG,UAAU;kBACxB,cAAA,iBAAC,CAAA,GAAA,yBAAiB;YAAE,SAAS;gBAAE,MAAM,gBAAgB,IAAI;YAAC;;gBACvD,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,QAAQ,EAAE,CAAC,OAAO;oBAC1C,qBAAO,CAAA,GAAA,YAAI,EAAE,YAAY,CAAC,OAAO;wBAC/B,WAAW,gBAAgB,KAAK;oBAClC;gBACF;8BACA,gBAAC,CAAA,GAAA,gBAAQ;oBAAE,WAAW,gBAAgB,IAAI;oBAAE,QAAO;oBAAO,cAAc;;;;;AAIhF;IAEA,2CAAe;;","sources":["packages/semantic-data-provider/src/index.ts","packages/semantic-data-provider/src/dataProvider/dataProvider.js","packages/semantic-data-provider/src/dataProvider/methods/create.js","packages/semantic-data-provider/src/dataProvider/methods/getOne.js","packages/semantic-data-provider/src/dataProvider/utils/fetchResource.js","packages/semantic-data-provider/src/dataProvider/utils/handleFiles.ts","packages/semantic-data-provider/src/dataProvider/utils/findContainersWithTypes.ts","packages/semantic-data-provider/src/dataProvider/utils/parseServerKeys.js","packages/semantic-data-provider/src/dataProvider/utils/getServerKeyFromType.js","packages/semantic-data-provider/src/dataProvider/methods/delete.ts","packages/semantic-data-provider/src/dataProvider/methods/deleteMany.js","packages/semantic-data-provider/src/dataProvider/methods/getDataServers.js","packages/semantic-data-provider/src/dataProvider/methods/getDataModels.js","packages/semantic-data-provider/src/dataProvider/methods/getList.js","packages/semantic-data-provider/src/dataProvider/utils/fetchContainers.ts","packages/semantic-data-provider/src/dataProvider/utils/arrayOf.ts","packages/semantic-data-provider/src/dataProvider/utils/fetchSparqlEndpoints.js","packages/semantic-data-provider/src/dataProvider/utils/getEmbedFrame.js","packages/semantic-data-provider/src/dataProvider/utils/buildSparqlQuery.js","packages/semantic-data-provider/src/dataProvider/utils/buildBaseQuery.js","packages/semantic-data-provider/src/dataProvider/utils/resolvePrefix.js","packages/semantic-data-provider/src/dataProvider/utils/buildBlankNodesQuery.js","packages/semantic-data-provider/src/dataProvider/utils/buildAutoDetectBlankNodesQuery.js","packages/semantic-data-provider/src/dataProvider/utils/findContainersWithPath.js","packages/semantic-data-provider/src/dataProvider/methods/getMany.js","packages/semantic-data-provider/src/dataProvider/methods/getManyReference.js","packages/semantic-data-provider/src/dataProvider/methods/update.ts","packages/semantic-data-provider/src/dataProvider/utils/fetchUserConfig.js","packages/semantic-data-provider/src/dataProvider/utils/fetchVoidEndpoints.js","packages/semantic-data-provider/src/dataProvider/httpClient.js","packages/semantic-data-provider/src/dataProvider/utils/getServerKeyFromUri.js","packages/semantic-data-provider/src/hooks/useGetExternalLink.js","packages/semantic-data-provider/src/hooks/useContainers.ts","packages/semantic-data-provider/src/hooks/useDataModel.ts","packages/semantic-data-provider/src/hooks/useDataServers.ts","packages/semantic-data-provider/src/hooks/useCreateContainer.js","packages/semantic-data-provider/src/dataProvider/utils/findCreateContainerWithTypes.ts","packages/semantic-data-provider/src/hooks/useCreateContainerUri.ts","packages/semantic-data-provider/src/hooks/useDataModels.ts","packages/semantic-data-provider/src/reification/FilterHandler.js","packages/semantic-data-provider/src/reification/GroupedReferenceHandler.js","packages/semantic-data-provider/src/reification/ReificationArrayInput.js"],"sourcesContent":["export { default as dataProvider } from './dataProvider/dataProvider';\n\nexport { default as buildSparqlQuery } from './dataProvider/utils/buildSparqlQuery';\nexport { default as buildBlankNodesQuery } from './dataProvider/utils/buildBlankNodesQuery';\n\nexport { default as useGetExternalLink } from './hooks/useGetExternalLink';\nexport { default as useContainers } from './hooks/useContainers';\nexport { default as useCreateContainer } from './hooks/useCreateContainer';\nexport { default as useCreateContainerUri } from './hooks/useCreateContainerUri';\nexport { default as useDataModel } from './hooks/useDataModel';\nexport { default as useDataModels } from './hooks/useDataModels';\nexport { default as useDataServers } from './hooks/useDataServers';\n\nexport { default as FilterHandler } from './reification/FilterHandler';\nexport { default as GroupedReferenceHandler } from './reification/GroupedReferenceHandler';\nexport { default as ReificationArrayInput } from './reification/ReificationArrayInput';\n","import createMethod from './methods/create';\nimport deleteMethod from './methods/delete';\nimport deleteManyMethod from './methods/deleteMany';\nimport getDataServersMethod from './methods/getDataServers';\nimport getDataModelsMethod from './methods/getDataModels';\nimport getListMethod from './methods/getList';\nimport getManyMethod from './methods/getMany';\nimport getManyReferenceMethod from './methods/getManyReference';\nimport getOneMethod from './methods/getOne';\nimport updateMethod from './methods/update';\nimport fetchUserConfig from './utils/fetchUserConfig';\nimport fetchVoidEndpoints from './utils/fetchVoidEndpoints';\nimport getServerKeyFromType from './utils/getServerKeyFromType';\nimport httpClient from './httpClient';\n\nconst dataProvider = config => {\n // TODO verify all data provider config + data models\n if (!getServerKeyFromType('default', config.dataServers))\n throw new Error('You must define a default server in your dataServers config');\n\n if (!config.jsonContext) config.jsonContext = Object.fromEntries(config.ontologies.map(o => [o.prefix, o.url]));\n if (!config.returnFailedResources) config.returnFailedResources = false;\n\n // Configure httpClient with data servers (this is needed for proxy calls)\n config.httpClient = httpClient(config.dataServers);\n\n // Keep in memory for refresh\n const originalConfig = { ...config };\n\n let fetchUserConfigPromise = fetchUserConfig(config);\n let fetchVoidEndpointsPromise = fetchVoidEndpoints(config);\n\n const waitForConfig =\n method =>\n async (...arg) => {\n await fetchUserConfigPromise;\n await fetchVoidEndpointsPromise; // Return immediately if promise is fulfilled\n return await method(...arg);\n };\n\n return {\n getList: waitForConfig(getListMethod(config)),\n getMany: waitForConfig(getManyMethod(config)),\n getManyReference: waitForConfig(getManyReferenceMethod(config)),\n getOne: waitForConfig(getOneMethod(config)),\n create: waitForConfig(createMethod(config)),\n update: waitForConfig(updateMethod(config)),\n updateMany: () => {\n throw new Error('updateMany is not implemented yet');\n },\n delete: waitForConfig(deleteMethod(config)),\n deleteMany: waitForConfig(deleteManyMethod(config)),\n // Custom methods\n getDataModels: waitForConfig(getDataModelsMethod(config)),\n getDataServers: waitForConfig(getDataServersMethod(config)),\n getLocalDataServers: getDataServersMethod(config),\n fetch: waitForConfig(config.httpClient),\n refreshConfig: async () => {\n config = { ...originalConfig };\n fetchUserConfigPromise = fetchUserConfig(config);\n fetchVoidEndpointsPromise = fetchVoidEndpoints(config);\n await fetchUserConfigPromise;\n await fetchVoidEndpointsPromise;\n return config;\n }\n };\n};\n\nexport default dataProvider;\n","import urlJoin from 'url-join';\nimport getOne from './getOne';\nimport handleFiles from '../utils/handleFiles';\nimport findContainersWithTypes from '../utils/findContainersWithTypes';\n\nconst createMethod = config => async (resourceId, params) => {\n const { dataServers, resources, httpClient, jsonContext } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) Error(`Resource ${resourceId} is not mapped in resources file`);\n\n const headers = new Headers();\n\n let containerUri;\n let serverKey;\n if (dataModel.create?.container) {\n serverKey = Object.keys(dataModel.create.container)[0];\n containerUri = urlJoin(dataServers[serverKey].baseUrl, Object.values(dataModel.create.container)[0]);\n } else {\n serverKey = dataModel.create?.server || Object.keys(dataServers).find(key => dataServers[key].default === true);\n if (!serverKey) throw new Error('You must define a server for the creation, or a container, or a default server');\n\n const containers = findContainersWithTypes(dataModel.types, [serverKey], dataServers);\n // Extract the containerUri from the results (and ensure there is only one)\n const serverKeys = Object.keys(containers);\n\n if (!serverKeys || serverKeys.length === 0)\n throw new Error(`No container with types ${JSON.stringify(dataModel.types)} found on server ${serverKey}`);\n if (serverKeys.length > 1 || containers[serverKeys[0]].length > 1)\n throw new Error(\n `More than one container detected with types ${JSON.stringify(dataModel.types)} on server ${serverKey}`\n );\n containerUri = containers[serverKeys[0]][0];\n }\n\n if (params.data) {\n if (dataModel.fieldsMapping?.title) {\n if (Array.isArray(dataModel.fieldsMapping.title)) {\n headers.set('Slug', dataModel.fieldsMapping.title.map(f => params.data[f]).join(' '));\n } else {\n headers.set('Slug', params.data[dataModel.fieldsMapping.title]);\n }\n }\n\n // Upload files, if there are any\n const { updatedRecord } = await handleFiles.upload(params.data, config);\n params.data = updatedRecord;\n\n const { headers: responseHeaders } = await httpClient(containerUri, {\n method: 'POST',\n headers,\n body: JSON.stringify({\n '@context': jsonContext,\n '@type': dataModel.types,\n ...params.data\n })\n });\n\n // Retrieve newly-created resource\n const resourceUri = responseHeaders.get('Location');\n return await getOne(config)(resourceId, { id: resourceUri });\n }\n if (params.id) {\n headers.set('Content-Type', 'application/sparql-update');\n\n await httpClient(containerUri, {\n method: 'PATCH',\n headers,\n body: `\n PREFIX ldp: \n INSERT DATA { <${containerUri}> ldp:contains <${params.id}>. };\n `\n });\n\n // Create must return the new data, so get them from the remote URI\n return await getOne(config)(resourceId, { id: params.id });\n }\n};\n\nexport default createMethod;\n","import fetchResource from '../utils/fetchResource';\n\nconst getOneMethod = config => async (resourceId, params) => {\n const { resources } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) throw new Error(`Resource ${resourceId} is not mapped in resources file`);\n\n const data = await fetchResource(params.id, config);\n\n // Transform single value into array if forceArray is set\n if (dataModel.list?.forceArray) {\n for (const forceArrayItem of dataModel.list?.forceArray || []) {\n if (data[forceArrayItem] && !Array.isArray(data[forceArrayItem])) {\n data[forceArrayItem] = [data[forceArrayItem]];\n }\n }\n }\n\n // TODO activate defaultFetchPlan option\n // if (dataModel.list?.defaultFetchPlan) {\n // for (const node of dataModel.list?.defaultFetchPlan) {\n // if (\n // data[node] &&\n // typeof data[node] === 'string' &&\n // data[node].startsWith('http')\n // ) {\n // try {\n // const dataToEmbed = await fetchResource(data[node], config);\n // delete dataToEmbed['@context'];\n // data[node] = dataToEmbed;\n // } catch (e) {\n // // Ignore errors (this may happen if user does not have rights to see the resource)\n // }\n // }\n // }\n // }\n\n return { data };\n};\n\nexport default getOneMethod;\n","import jsonld from 'jsonld';\n\nconst fetchResource = async (resourceUri, config) => {\n const { httpClient, jsonContext } = config;\n\n let { json: data } = await httpClient(resourceUri);\n\n if (!data) throw new Error(`Not a valid JSON: ${resourceUri}`);\n\n data.id = data.id || data['@id'];\n\n // We compact only if the context is different between the frontend and the middleware\n // TODO deep compare if the context is an object\n if (data['@context'] !== jsonContext) {\n data = await jsonld.compact(data, jsonContext);\n }\n\n return data;\n};\n\nexport default fetchResource;\n","import urlJoin from 'url-join';\nimport { RaRecord } from 'react-admin';\nimport { Configuration } from '../types';\n\nconst isFile = (o: any): o is { rawFile: File } => o?.rawFile && o.rawFile instanceof File;\nconst isFileToDelete = (o: any): o is { fileToDelete: string } =>\n o?.fileToDelete !== undefined && o?.fileToDelete !== null;\n\nconst getUploadsContainerUri = (config: Configuration) => {\n const serverKey = Object.keys(config.dataServers).find(key => config.dataServers[key].uploadsContainer);\n if (serverKey && config.dataServers[serverKey].uploadsContainer) {\n return urlJoin(config.dataServers[serverKey].baseUrl, config.dataServers[serverKey].uploadsContainer!);\n }\n return null;\n};\n\nconst uploadFile = async (rawFile: File, config: Configuration) => {\n const uploadsContainerUri = getUploadsContainerUri(config);\n if (!uploadsContainerUri) throw new Error(\"You must define an uploadsContainer in one of the server's configuration\");\n\n const response = await config.httpClient(uploadsContainerUri, {\n method: 'POST',\n body: rawFile,\n headers: new Headers({\n 'Content-Type': rawFile.type\n })\n });\n\n if (response.status === 201) {\n return response.headers.get('Location');\n }\n return null;\n};\n\nconst deleteFiles = async (filesToDelete: string[], config: Configuration) => {\n return Promise.all(\n filesToDelete.map(file =>\n config.httpClient(file, {\n method: 'DELETE'\n })\n )\n );\n};\n\n/*\n * Look for raw files in the record data.\n * If there are any, upload them and replace the file by its URL.\n */\nconst uploadAllFiles = async (record: Partial, config: Configuration) => {\n const filesToDelete: string[] = [];\n const updatedRecord = { ...record };\n\n for (const property of Object.keys(record)) {\n const value = record[property];\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const itemValue = value[i];\n if (isFile(itemValue)) {\n if (isFileToDelete(itemValue)) {\n filesToDelete.push(itemValue.fileToDelete);\n }\n updatedRecord[property][i] = await uploadFile(itemValue.rawFile, config);\n } else if (isFileToDelete(itemValue)) {\n filesToDelete.push(itemValue.fileToDelete);\n updatedRecord[property][i] = null;\n }\n }\n } else if (isFile(value)) {\n if (isFileToDelete(value)) {\n filesToDelete.push(value.fileToDelete);\n }\n updatedRecord[property] = await uploadFile(value.rawFile, config);\n } else if (isFileToDelete(value)) {\n filesToDelete.push(value.fileToDelete);\n updatedRecord[property] = null;\n }\n }\n\n return {\n updatedRecord,\n filesToDelete\n };\n};\n\nexport default {\n upload: uploadAllFiles,\n delete: deleteFiles\n};\n","import urlJoin from 'url-join';\nimport { Configuration, DataServerKey } from '../types';\nimport parseServerKeys from './parseServerKeys';\n\nconst findContainersWithTypes = (\n types: string[],\n serverKeys: string | string[] | undefined,\n dataServers: Configuration['dataServers']\n) => {\n const containers = {} as Record;\n const existingContainers: string[] = [];\n\n const parsedServerKeys = parseServerKeys(serverKeys, dataServers);\n\n Object.keys(dataServers)\n .filter(dataServerKey => dataServers[dataServerKey].containers)\n .forEach(dataServerKey => {\n Object.keys(dataServers[dataServerKey].containers || {}).forEach(containerKey => {\n if (!parsedServerKeys || parsedServerKeys.includes(containerKey)) {\n Object.keys(dataServers[dataServerKey].containers![containerKey]).forEach(type => {\n if (types.includes(type)) {\n dataServers[dataServerKey].containers![containerKey][type].map(path => {\n const containerUri = urlJoin(dataServers[containerKey].baseUrl, path);\n\n // Avoid returning the same container several times\n if (!existingContainers.includes(containerUri)) {\n existingContainers.push(containerUri);\n\n if (!containers[dataServerKey]) containers[dataServerKey] = [];\n containers[dataServerKey].push(containerUri);\n }\n });\n }\n });\n }\n });\n });\n return containers;\n};\n\nexport default findContainersWithTypes;\n","import getServerKeyFromType from './getServerKeyFromType';\n\nconst parseServerKey = (serverKey, dataServers) => {\n switch (serverKey) {\n case '@default':\n return getServerKeyFromType('default', dataServers);\n case '@pod':\n return getServerKeyFromType('pod', dataServers);\n case '@authServer':\n return getServerKeyFromType('authServer', dataServers);\n default:\n return serverKey;\n }\n};\n\n// Return the list of servers keys in an array\n// parsing keywords like @all, @default, @pod and @authServer\nconst parseServerKeys = (serverKeys, dataServers) => {\n if (Array.isArray(serverKeys)) {\n if (serverKeys.includes('@all')) {\n return Object.keys(dataServers);\n }\n return serverKeys.map(serverKey => parseServerKey(serverKey, dataServers));\n }\n if (typeof serverKeys === 'string') {\n if (serverKeys === '@all') {\n return Object.keys(dataServers);\n }\n if (serverKeys === '@remote') {\n const defaultServerKey = getServerKeyFromType('default', dataServers);\n return Object.keys(dataServers).filter(serverKey => serverKey !== defaultServerKey);\n }\n return [parseServerKey(serverKeys, dataServers)];\n }\n // If server key is empty\n return false;\n};\n\nexport default parseServerKeys;\n","const getServerKeyFromType = (type, dataServers) => {\n return Object.keys(dataServers).find(key => {\n return dataServers[key][type];\n });\n};\n\nexport default getServerKeyFromType;\n","import { DeleteParams, RaRecord } from 'react-admin';\nimport { Configuration } from '../types';\nimport handleFiles from '../utils/handleFiles';\n\nconst deleteMethod = (config: Configuration) => async (resourceId: string, params: DeleteParams) => {\n const { httpClient } = config;\n\n await httpClient(`${params.id}`, {\n method: 'DELETE'\n });\n\n if (params.meta?.filesToDelete) {\n await handleFiles.delete(params.meta.filesToDelete, config);\n }\n\n return { data: { id: params.id } };\n};\n\nexport default deleteMethod;\n","const deleteManyMethod = config => async (resourceId, params) => {\n const { httpClient } = config;\n const ids = [];\n\n for (const id of params.ids) {\n try {\n await httpClient(id, {\n method: 'DELETE'\n });\n ids.push(id);\n } catch (e) {\n // Do nothing if we fail to delete a resource\n }\n }\n\n return { data: ids };\n};\n\nexport default deleteManyMethod;\n","const getDataServers = config => () => {\n return config.dataServers;\n};\n\nexport default getDataServers;\n","const getDataModels = config => () => {\n return config.resources;\n};\n\nexport default getDataModels;\n","import findContainersWithTypes from '../utils/findContainersWithTypes';\nimport fetchContainers from '../utils/fetchContainers';\nimport fetchSparqlEndpoints from '../utils/fetchSparqlEndpoints';\nimport findContainersWithPaths from '../utils/findContainersWithPath';\n\nconst getListMethod =\n config =>\n async (resourceId, params = {}) => {\n const { dataServers, resources } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) throw new Error(`Resource ${resourceId} is not mapped in resources file`);\n\n let containers;\n if (!params.filter?._servers && dataModel.list?.containers) {\n if (Array.isArray(dataModel.list?.containers))\n throw new Error(\n `The list.containers property of ${resourceId} dataModel must be of type object ({ serverKey: [containerUri] })`\n );\n // If containers are set explicitly, use them\n containers = findContainersWithPaths(dataModel.list.containers, dataServers);\n } else {\n // Otherwise find the container URIs on the given servers (either in the filter or the data model)\n containers = findContainersWithTypes(\n dataModel.types,\n params.filter?._servers || dataModel.list?.servers,\n dataServers\n );\n }\n\n if (dataModel.list?.fetchContainer) {\n return fetchContainers(containers, params, config);\n }\n return fetchSparqlEndpoints(containers, resourceId, params, config);\n };\n\nexport default getListMethod;\n","import jsonld, { ContextDefinition } from 'jsonld';\nimport { GetListParams } from 'react-admin';\nimport arrayOf from './arrayOf';\nimport { Configuration, ContainerURI, DataServerKey } from '../types';\n\ntype LDPContainerType = 'ldp:Container' | 'ldp:BasicContainer';\n\ninterface LDPContainerBase {\n '@context': Configuration['jsonContext'];\n id: string;\n 'ldp:contains': Record[];\n}\n\ninterface LDPContainerWithType extends LDPContainerBase {\n type: LDPContainerType | LDPContainerType[];\n}\n\ninterface LDPContainerWithAtType extends LDPContainerBase {\n '@type': LDPContainerType | LDPContainerType[];\n}\n\ntype LDPContainer = LDPContainerWithType | LDPContainerWithAtType;\n\ntype LDPResource = {\n '@context': Configuration['jsonContext'];\n [key: string]: any;\n};\n\ntype ListFilters = Partial<{\n q: string;\n type: string;\n _predicates: string[];\n _servers: DataServerKey[];\n [attribute: string]: any;\n}>;\n\nconst isValidLDPContainer = (container: LDPContainer) => {\n const resourceType = (container as LDPContainerWithType).type || (container as LDPContainerWithAtType)['@type'];\n return Array.isArray(resourceType) ? resourceType.includes('ldp:Container') : resourceType === 'ldp:Container';\n};\n\nconst isObject = (val: any) => {\n return val != null && typeof val === 'object' && !Array.isArray(val);\n};\n\nconst fetchContainers = async (\n containers: Record,\n params: GetListParams,\n { httpClient, jsonContext }: Configuration\n) => {\n const containersUri = Object.values(containers).flat();\n\n const fetchPromises = containersUri.map(containerUri =>\n httpClient(containerUri)\n .then(async ({ json }) => {\n const jsonResponse: LDPContainer = json;\n\n // If container's context is different, compact it to have an uniform result\n // TODO deep compare if the context is an object\n if (jsonResponse['@context'] !== jsonContext) {\n return jsonld.compact(jsonResponse, jsonContext as ContextDefinition) as unknown as Promise;\n }\n\n return jsonResponse;\n })\n .then((json: LDPContainer) => {\n if (!isValidLDPContainer(json)) {\n throw new Error(`${containerUri} is not a LDP container`);\n }\n\n return arrayOf(json['ldp:contains']).map(resource => ({\n '@context': json['@context'],\n ...resource\n }));\n })\n );\n\n // Fetch simultaneously all containers\n const results = await Promise.all(fetchPromises);\n let resources = results.flat();\n\n resources = resources.map(resource => {\n resource.id = resource.id || resource['@id'];\n return resource;\n });\n\n // Apply filter to results\n const filters: ListFilters = params.filter;\n\n // For SPARQL queries, we use \"a\" to filter types, but in containers it must be \"type\"\n if (filters.a) {\n filters.type = filters.a;\n delete filters.a;\n }\n\n // Filter resources attributes according to _predicates list\n if (filters._predicates && Array.isArray(filters._predicates)) {\n const predicates = filters._predicates;\n const mandatoryAttributes = ['id'];\n\n resources = resources.map(resource => {\n return Object.keys(resource)\n .filter(key => predicates.includes(key) || mandatoryAttributes.includes(key))\n .reduce(\n (filteredResource, key) => {\n filteredResource[key] = resource[key];\n return filteredResource;\n },\n { '@context': [] }\n );\n });\n }\n\n if (Object.keys(filters).filter(f => !['_predicates', '_servers'].includes(f)).length > 0) {\n resources = resources.filter(resource => {\n // Full text filtering\n if (filters.q) {\n return Object.values(resource).some(attributeValue => {\n if (!isObject(attributeValue)) {\n const arrayValues = Array.isArray(attributeValue) ? attributeValue : [attributeValue];\n return arrayValues.some(value => {\n if (typeof value === 'string') {\n return value.toLowerCase().normalize('NFD').includes(filters.q!.toLowerCase().normalize('NFD'));\n }\n return false;\n });\n }\n return false;\n });\n }\n\n // Attribute filtering\n const attributesFilters = Object.keys(filters).filter(f => !['_predicates', '_servers', 'q'].includes(f));\n\n return attributesFilters.every(attribute => {\n if (resource[attribute]) {\n const arrayValues: any[] = Array.isArray(resource[attribute]) ? resource[attribute] : [resource[attribute]];\n return arrayValues.some(\n (value: any) => typeof value === 'string' && value.includes(filters[attribute] as string)\n );\n }\n\n return false;\n });\n });\n }\n\n // Sorting\n if (params.sort) {\n resources = resources.sort((a, b) => {\n if (a[params.sort.field] && b[params.sort.field]) {\n if (params.sort.order === 'ASC') {\n return a[params.sort.field].localeCompare(b[params.sort.field]);\n }\n return b[params.sort.field].localeCompare(a[params.sort.field]);\n }\n return true;\n });\n }\n\n // Pagination\n const total = resources.length;\n\n if (params.pagination) {\n resources = resources.slice(\n (params.pagination.page - 1) * params.pagination.perPage,\n params.pagination.page * params.pagination.perPage\n );\n }\n\n return { data: resources, total };\n};\n\nexport default fetchContainers;\n","const arrayOf = (value: T | T[]) => {\n // If the field is null-ish, we suppose there are no values.\n if (!value) {\n return [];\n }\n // Return as is.\n if (Array.isArray(value)) {\n return value;\n }\n // Single value is made an array.\n return [value];\n};\n\nexport default arrayOf;\n","import jsonld from 'jsonld';\nimport getEmbedFrame from './getEmbedFrame';\nimport buildSparqlQuery from './buildSparqlQuery';\n\nconst compare = (a, b) => {\n switch (typeof a) {\n case 'string':\n return a.localeCompare(b);\n case 'number':\n case 'bigint':\n return a - b;\n default:\n return 0;\n }\n};\n\nconst fetchSparqlEndpoints = async (containers, resourceId, params, config) => {\n const { dataServers, resources, httpClient, jsonContext, ontologies } = config;\n const dataModel = resources[resourceId];\n\n const sparqlQueryPromises = Object.keys(containers).map(\n serverKey =>\n new Promise((resolve, reject) => {\n const blankNodes = params.filter?.blankNodes || dataModel.list?.blankNodes;\n\n // When the SPARQL request comes from the browser's URL, it comes as JSON string which must must be parsed\n if (\n params.filter?.sparqlWhere &&\n (typeof params.filter.sparqlWhere === 'string' || params.filter.sparqlWhere instanceof String)\n ) {\n params.filter.sparqlWhere = JSON.parse(decodeURIComponent(params.filter.sparqlWhere));\n }\n const sparqlQuery = buildSparqlQuery({\n containers: containers[serverKey],\n params,\n dataModel,\n ontologies\n });\n\n httpClient(dataServers[serverKey].sparqlEndpoint, {\n method: 'POST',\n body: sparqlQuery\n })\n .then(({ json }) => {\n // If we declared the blank nodes to dereference, embed only those blank nodes\n // This solve problems which can occur when same-type resources are embedded in other resources\n // To increase performances, you can set explicitEmbedOnFraming to false (make sure the result is still OK)\n const frame =\n blankNodes && dataModel.list?.explicitEmbedOnFraming !== false\n ? {\n '@context': jsonContext,\n '@type': dataModel.types,\n '@embed': '@never',\n ...getEmbedFrame(blankNodes)\n }\n : {\n '@context': jsonContext,\n '@type': dataModel.types\n };\n\n // omitGraph option force results to be in a @graph, even if we have a single result\n return jsonld.frame(json, frame, { omitGraph: false });\n })\n .then(compactJson => {\n if (compactJson['@id']) {\n const { '@context': context, ...rest } = compactJson;\n compactJson = {\n '@context': context,\n '@graph': [rest]\n };\n }\n resolve(\n compactJson['@graph'].map(resource => ({ '@context': compactJson['@context'], ...resource })) || []\n );\n })\n .catch(e => reject(e));\n })\n );\n\n // Run simultaneous SPARQL queries\n let results = await Promise.all(sparqlQueryPromises);\n\n if (results.length === 0) {\n return { data: [], total: 0 };\n }\n // Merge all results in one array\n results = [].concat(...results);\n\n // Add id in addition to @id, as this is what React-Admin expects\n let returnData = results.map(item => {\n item.id = item.id || item['@id'];\n return item;\n });\n\n // TODO sort and paginate the results in the SPARQL query to improve performances\n if (params.sort) {\n returnData = returnData.sort((a, b) => {\n if (a[params.sort.field] !== undefined && b[params.sort.field] !== undefined) {\n if (params.sort.order === 'ASC') {\n return compare(a[params.sort.field], b[params.sort.field]);\n }\n return compare(b[params.sort.field], a[params.sort.field]);\n }\n return 0;\n });\n }\n if (params.pagination) {\n returnData = returnData.slice(\n (params.pagination.page - 1) * params.pagination.perPage,\n params.pagination.page * params.pagination.perPage\n );\n }\n\n return { data: returnData, total: results.length };\n};\n\nexport default fetchSparqlEndpoints;\n","const getEmbedFrame = blankNodes => {\n let embedFrame = {};\n let predicates;\n if (blankNodes) {\n for (const blankNode of blankNodes) {\n if (blankNode.includes('/')) {\n predicates = blankNode.split('/').reverse();\n } else {\n predicates = [blankNode];\n }\n embedFrame = {\n ...embedFrame,\n ...predicates.reduce(\n (accumulator, predicate) => ({\n [predicate]: {\n '@embed': '@last',\n ...accumulator\n }\n }),\n {}\n )\n };\n }\n return embedFrame;\n }\n};\n\nexport default getEmbedFrame;\n","import DataFactory from '@rdfjs/data-model';\nimport buildBaseQuery from './buildBaseQuery';\nimport buildBlankNodesQuery from './buildBlankNodesQuery';\nimport buildAutoDetectBlankNodesQuery from './buildAutoDetectBlankNodesQuery';\nimport resolvePrefix from './resolvePrefix';\n\nconst SparqlGenerator = require('sparqljs').Generator;\n\nconst { literal, namedNode, triple, variable } = DataFactory;\n\nconst generator = new SparqlGenerator({\n /* prefixes, baseIRI, factory, sparqlStar */\n});\n\nconst reservedFilterKeys = ['q', 'sparqlWhere', 'blankNodes', 'blankNodesDepth', '_servers', '_predicates'];\n\nconst buildSparqlQuery = ({ containers, params, dataModel, ontologies }) => {\n const blankNodes = params.filter?.blankNodes || dataModel.list?.blankNodes;\n const predicates = params.filter?._predicates || dataModel.list?.predicates;\n const blankNodesDepth = params.filter?.blankNodesDepth ?? dataModel.list?.blankNodesDepth ?? 2;\n const filter = { ...dataModel.list?.filter, ...params.filter };\n const baseQuery = buildBaseQuery(predicates, ontologies);\n\n const sparqlJsParams = {\n queryType: 'CONSTRUCT',\n template: baseQuery.construct,\n where: [],\n type: 'query',\n prefixes: Object.fromEntries(ontologies.map(ontology => [ontology.prefix, ontology.url]))\n };\n\n const containerWhere = [\n {\n type: 'values',\n values: containers.map(containerUri => ({ '?containerUri': namedNode(containerUri) }))\n },\n triple(variable('containerUri'), namedNode('http://www.w3.org/ns/ldp#contains'), variable('s1')),\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isiri',\n args: [variable('s1')]\n }\n }\n ];\n\n let resourceWhere = [];\n\n if (filter && Object.keys(filter).length > 0) {\n const hasSPARQLFilter = filter.sparqlWhere && Object.keys(filter.sparqlWhere).length > 0;\n const hasFullTextSearch = filter.q && filter.q.length > 0;\n\n if (hasSPARQLFilter) {\n /*\n Example of usage :\n {\n \"sparqlWhere\": {\n \"type\": \"bgp\",\n \"triples\": [{\n \"subject\": {\"termType\": \"Variable\", \"value\": \"s1\"},\n \"predicate\": {\"termType\": \"NameNode\", \"value\": \"http://virtual-assembly.org/ontologies/pair#label\"},\n \"object\": {\"termType\": \"Literal\", \"value\": \"My Organization\"}\n }]\n }\n }\n */\n // initialize array in case of single value :\n [].concat(filter.sparqlWhere).forEach(sw => {\n resourceWhere.push(sw);\n });\n }\n\n if (hasFullTextSearch) {\n resourceWhere.push({\n type: 'group',\n patterns: [\n {\n queryType: 'SELECT',\n variables: [variable('s1')],\n where: [\n triple(variable('s1'), variable('p1'), variable('o1')),\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isliteral',\n args: [variable('o1')]\n }\n },\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'regex',\n args: [\n {\n type: 'operation',\n operator: 'lcase',\n args: [\n {\n type: 'operation',\n operator: 'str',\n args: [variable('o1')]\n }\n ]\n },\n literal(filter.q.toLowerCase(), '', namedNode('http://www.w3.org/2001/XMLSchema#string'))\n ]\n }\n }\n ],\n type: 'query'\n }\n ]\n });\n }\n\n // Other filters\n // SPARQL keyword a = filter based on the class of a resource (example => 'a': 'pair:OrganizationType')\n // Other filters are based on a value (example => 'petr:hasAudience': 'http://localhost:3000/audiences/tout-public')\n Object.entries(filter).forEach(([predicate, object]) => {\n if (!reservedFilterKeys.includes(predicate)) {\n resourceWhere.unshift(\n triple(\n variable('s1'),\n namedNode(resolvePrefix(predicate, ontologies)),\n namedNode(resolvePrefix(object, ontologies))\n )\n );\n }\n });\n }\n\n // Blank nodes\n const blankNodesQuery = blankNodes\n ? buildBlankNodesQuery(blankNodes, baseQuery, ontologies)\n : buildAutoDetectBlankNodesQuery(blankNodesDepth, baseQuery);\n\n if (blankNodesQuery && blankNodesQuery.construct) {\n resourceWhere = resourceWhere.concat(blankNodesQuery.where);\n sparqlJsParams.template = sparqlJsParams.template.concat(blankNodesQuery.construct);\n } else {\n resourceWhere.push(baseQuery.where);\n }\n\n sparqlJsParams.where.push(\n {\n type: 'union',\n patterns: [\n containerWhere,\n {\n type: 'graph',\n name: namedNode('http://semapps.org/mirror'),\n patterns: containerWhere\n }\n ]\n },\n {\n type: 'union',\n patterns: [\n resourceWhere,\n {\n type: 'graph',\n name: namedNode('http://semapps.org/mirror'),\n patterns: resourceWhere\n }\n ]\n }\n );\n\n return generator.stringify(sparqlJsParams);\n};\n\nexport default buildSparqlQuery;\n","import { namedNode, triple, variable } from '@rdfjs/data-model';\nimport resolvePrefix from './resolvePrefix';\n\nconst defaultToArray = value => (!value ? [] : Array.isArray(value) ? value : [value]);\n\n// We need to always include the type or React-Admin will not work properly\nconst typeQuery = triple(\n variable('s1'),\n namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),\n variable('type')\n);\n\nconst buildBaseQuery = (predicates, ontologies) => {\n let baseTriples;\n if (predicates) {\n baseTriples = defaultToArray(predicates).map((predicate, i) =>\n triple(variable('s1'), namedNode(resolvePrefix(predicate, ontologies)), variable(`o${i + 1}`))\n );\n return {\n construct: [typeQuery, ...baseTriples],\n where: [typeQuery, ...baseTriples.map(triple => ({ type: 'optional', patterns: [triple] }))]\n };\n }\n baseTriples = [triple(variable('s1'), variable('p1'), variable('o1'))];\n return {\n construct: baseTriples,\n where: baseTriples\n };\n};\n\nexport default buildBaseQuery;\n","const resolvePrefix = (item, ontologies) => {\n if (item.startsWith('http://') || item.startsWith('https://')) {\n // Already resolved, return the URI\n return item;\n }\n if (item === 'a') {\n // Special case\n return 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type';\n }\n const [prefix, value] = item.split(':');\n if (value) {\n const ontology = ontologies.find(ontology => ontology.prefix === prefix);\n if (ontology) {\n return ontology.url + value;\n }\n throw new Error(`No ontology found with prefix ${prefix}`);\n } else {\n throw new Error(`The value \"${item}\" is not correct. It must include a prefix or be a full URI.`);\n }\n};\n\nexport default resolvePrefix;\n","import md5 from 'crypto-js/md5';\nimport { namedNode, triple, variable } from '@rdfjs/data-model';\nimport resolvePrefix from './resolvePrefix';\n\n// Transform ['ont:predicate1/ont:predicate2'] to ['ont:predicate1', 'ont:predicate1/ont:predicate2']\nconst extractNodes = blankNodes => {\n const nodes = [];\n if (blankNodes) {\n for (const predicate of blankNodes) {\n if (predicate.includes('/')) {\n const nodeNames = predicate.split('/');\n for (let i = 1; i <= nodeNames.length; i++) {\n nodes.push(nodeNames.slice(0, i).join('/'));\n }\n } else {\n nodes.push(predicate);\n }\n }\n }\n return nodes;\n};\n\nconst generateSparqlVarName = node => md5(node);\n\nconst getParentNode = node => node.includes('/') && node.split('/')[0];\n\nconst getPredicate = node => (node.includes('/') ? node.split('/')[1] : node);\n\nconst buildUnionQuery = queries =>\n queries.map(q => {\n let triples = q.query;\n const firstTriple = queries.find(q2 => q.parentNode === q2.node);\n if (firstTriple !== undefined) {\n triples = triples.concat(firstTriple.query[0]);\n }\n return {\n type: 'bgp',\n triples\n };\n });\n\nconst buildBlankNodesQuery = (blankNodes, baseQuery, ontologies) => {\n const queries = [];\n const nodes = extractNodes(blankNodes);\n\n if (nodes && ontologies && ontologies.length > 0) {\n for (const node of nodes) {\n const parentNode = getParentNode(node);\n const predicate = getPredicate(node);\n const varName = generateSparqlVarName(node);\n const parentVarName = parentNode ? generateSparqlVarName(parentNode) : '1';\n\n const query = [\n triple(variable(`s${parentVarName}`), namedNode(resolvePrefix(predicate, ontologies)), variable(`s${varName}`)),\n triple(variable(`s${varName}`), variable(`p${varName}`), variable(`o${varName}`))\n ];\n\n queries.push({\n node,\n parentNode,\n query,\n filter: '' // `FILTER(isBLANK(?s${varName})) .`\n });\n }\n\n return {\n construct: queries.length > 0 ? queries.map(q => q.query).reduce((pre, cur) => pre.concat(cur)) : null,\n where: {\n type: 'union',\n patterns: [baseQuery.where, ...buildUnionQuery(queries)]\n }\n };\n }\n return {\n construct: '',\n where: ''\n };\n};\n\nexport default buildBlankNodesQuery;\n","import { triple, variable } from '@rdfjs/data-model';\n\nconst buildAutoDetectBlankNodesQuery = (depth, baseQuery) => {\n const construct = [...baseQuery.construct];\n let where = {};\n if (depth > 0) {\n const whereQueries = [];\n whereQueries.push([baseQuery.where]);\n for (let i = 1; i <= depth; i++) {\n construct.push(triple(variable(`o${i}`), variable(`p${i + 1}`), variable(`o${i + 1}`)));\n whereQueries.push([\n ...whereQueries[whereQueries.length - 1],\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isblank',\n args: [variable(`o${i}`)]\n }\n },\n triple(variable(`o${i}`), variable(`p${i + 1}`), variable(`o${i + 1}`))\n ]);\n }\n where = {\n type: 'union',\n patterns: whereQueries\n };\n } else if (depth === 0) {\n where = baseQuery.where;\n } else {\n throw new Error('The depth of buildAutoDetectBlankNodesQuery should be 0 or more');\n }\n\n return { construct, where };\n};\n\nexport default buildAutoDetectBlankNodesQuery;\n","import urlJoin from 'url-join';\n\nconst findContainersWithPaths = (paths, dataServers) => {\n const containers = {};\n Object.keys(paths).forEach(serverKey => {\n if (dataServers[serverKey]) {\n containers[serverKey] = [];\n paths[serverKey].forEach(path => {\n containers[serverKey].push(urlJoin(dataServers[serverKey].baseUrl, path));\n });\n } else {\n throw new Error(`No server found with key ${serverKey}`);\n }\n });\n return containers;\n};\n\nexport default findContainersWithPaths;\n","import getOne from './getOne';\n\nconst getManyMethod = config => async (resourceId, params) => {\n const { returnFailedResources } = config;\n\n let returnData = await Promise.all(\n params.ids.map(id =>\n getOne(config)(resourceId, { id: typeof id === 'object' ? id['@id'] : id })\n .then(({ data }) => data)\n .catch(() => {\n // Catch if one resource fails to load\n // Otherwise no references will be show if only one is missing\n // See https://github.com/marmelab/react-admin/issues/5190\n if (returnFailedResources) {\n return { id, _error: true };\n }\n // Returning nothing\n })\n )\n );\n\n // We don't want undefined results to appear in the results as it will break with react-admin\n returnData = returnData.filter(e => e);\n\n return { data: returnData };\n};\n\nexport default getManyMethod;\n","import getList from './getList';\n\nconst getManyReferenceMethod = config => async (resourceId, params) => {\n params.filter = { ...params.filter, [params.target]: params.id };\n delete params.target;\n return await getList(config)(resourceId, params);\n};\n\nexport default getManyReferenceMethod;\n","import { RaRecord, UpdateParams } from 'react-admin';\nimport { Configuration } from '../types';\nimport handleFiles from '../utils/handleFiles';\n\nconst updateMethod = (config: Configuration) => async (resourceId: string, params: UpdateParams) => {\n const { httpClient, jsonContext } = config;\n\n // Upload files, if there are any\n const { updatedRecord, filesToDelete } = await handleFiles.upload(params.data, config);\n params.data = updatedRecord;\n\n await httpClient(`${params.id}`, {\n method: 'PUT',\n body: JSON.stringify({\n '@context': jsonContext,\n ...params.data\n })\n });\n\n // Delete files only if update is successful\n await handleFiles.delete(filesToDelete, config);\n\n return { data: params.data };\n};\n\nexport default updateMethod;\n","import jwtDecode from 'jwt-decode';\nimport urlJoin from 'url-join';\nimport getServerKeyFromType from './getServerKeyFromType';\n\nconst fetchUserConfig = async config => {\n const { dataServers, httpClient } = config;\n const token = localStorage.getItem('token');\n const podKey = getServerKeyFromType('pod', dataServers);\n const authServerKey = getServerKeyFromType('authServer', dataServers);\n\n // If the user is logged in\n if (token) {\n const payload = jwtDecode(token);\n const webId = payload.webId || payload.webid; // Currently we must deal with both formats\n let userData;\n\n try {\n const { json } = await httpClient(webId);\n userData = json;\n } catch (e) {\n console.error(e);\n // If the webId cannot be fetched, assume an invalid token and disconnect the user\n localStorage.clear();\n window.location.reload();\n return;\n }\n\n // If we have a POD server\n if (podKey) {\n // Fill the config provided to the data provider\n // We must modify the config object directly\n config.dataServers[podKey].name = 'My Pod';\n config.dataServers[podKey].baseUrl = urlJoin(webId, 'data'); // TODO find POD URI from user profile\n config.dataServers[podKey].sparqlEndpoint =\n userData.endpoints?.['void:sparqlEndpoint'] || urlJoin(webId, 'sparql');\n }\n\n if (authServerKey) {\n // Fill the config provided to the data provider\n // We must modify the config object directly\n config.dataServers[authServerKey].proxyUrl = userData.endpoints?.proxyUrl;\n }\n } else if (podKey) {\n // If the user is not logged in, ignore the POD server\n delete config.dataServers[podKey];\n }\n};\n\nexport default fetchUserConfig;\n","const defaultToArray = value => (!value ? undefined : Array.isArray(value) ? value : [value]);\n\nconst fetchVoidEndpoints = async config => {\n const fetchPromises = Object.entries(config.dataServers)\n .filter(([key, server]) => server.pod !== true && server.void !== false)\n .map(([key, server]) =>\n config\n .httpClient(new URL('/.well-known/void', server.baseUrl).toString())\n .then(result => ({ key, datasets: result.json['@graph'] }))\n .catch(e => {\n if (e.status === 404 || e.status === 401 || e.status === 500) {\n return { key, error: e };\n }\n throw e;\n })\n );\n\n let results = [];\n\n try {\n results = await Promise.all(fetchPromises);\n } catch (e) {\n // Do not throw error if no endpoint found\n }\n\n for (const result of results) {\n config.dataServers[result.key].containers = config.dataServers[result.key].containers || {};\n config.dataServers[result.key].blankNodes = config.dataServers[result.key].blankNodes || {};\n\n // Ignore unfetchable endpoints\n if (result.datasets) {\n for (const dataset of result.datasets) {\n const datasetServerKey = Object.keys(config.dataServers).find(\n key => dataset['void:uriSpace'] === config.dataServers[key].baseUrl\n );\n\n // If the dataset is not part of a server mapped in the dataServers, ignore it\n if (datasetServerKey) {\n // If this is the local dataset, add the base information\n if (datasetServerKey === result.key) {\n config.dataServers[result.key].name = config.dataServers[result.key].name || dataset['dc:title'];\n config.dataServers[result.key].description =\n config.dataServers[result.key].description || dataset['dc:description'];\n config.dataServers[result.key].sparqlEndpoint =\n config.dataServers[result.key].sparqlEndpoint || dataset['void:sparqlEndpoint'];\n }\n\n config.dataServers[result.key].containers[datasetServerKey] =\n config.dataServers[result.key].containers[datasetServerKey] || {};\n\n for (const partition of defaultToArray(dataset['void:classPartition'])) {\n for (const type of defaultToArray(partition['void:class'])) {\n // Set containers by type\n const path = partition['void:uriSpace'].replace(dataset['void:uriSpace'], '/');\n if (config.dataServers[result.key].containers[datasetServerKey][type]) {\n config.dataServers[result.key].containers[datasetServerKey][type].push(path);\n } else {\n config.dataServers[result.key].containers[datasetServerKey][type] = [path];\n }\n }\n }\n }\n }\n }\n }\n};\n\nexport default fetchVoidEndpoints;\n","import { fetchUtils } from 'react-admin';\nimport getServerKeyFromUri from './utils/getServerKeyFromUri';\nimport getServerKeyFromType from './utils/getServerKeyFromType';\n\n/*\n * HTTP client used by all calls in data provider and auth provider\n * Do proxy calls if a proxy endpoint is available and the server is different from the auth server\n */\nconst httpClient =\n dataServers =>\n (url, options = {}) => {\n const authServerKey = getServerKeyFromType('authServer', dataServers);\n const serverKey = getServerKeyFromUri(url, dataServers);\n const useProxy =\n serverKey !== authServerKey && dataServers[authServerKey]?.proxyUrl && dataServers[serverKey]?.noProxy !== true;\n\n if (!options.headers) options.headers = new Headers();\n\n switch (options.method) {\n case 'POST':\n case 'PATCH':\n case 'PUT':\n if (!options.headers.has('Accept')) options.headers.set('Accept', 'application/ld+json');\n if (!options.headers.has('Content-Type')) options.headers.set('Content-Type', 'application/ld+json');\n break;\n\n case 'DELETE':\n break;\n\n case 'GET':\n default:\n if (!options.headers.has('Accept')) options.headers.set('Accept', 'application/ld+json');\n break;\n }\n\n if (useProxy) {\n const formData = new FormData();\n\n formData.append('id', url);\n formData.append('method', options.method || 'GET');\n formData.append('headers', JSON.stringify(Object.fromEntries(options.headers.entries())));\n\n if (options.body) {\n if (options.body instanceof File) {\n formData.append('body', options.body, options.body.name);\n } else {\n formData.append('body', options.body);\n }\n }\n\n // Post to proxy endpoint with multipart/form-data format\n return fetchUtils.fetchJson(dataServers[authServerKey].proxyUrl, {\n method: 'POST',\n headers: new Headers({\n Authorization: `Bearer ${localStorage.getItem('token')}`\n }),\n body: formData\n });\n }\n // Add token if the server is the same as the auth server\n if (serverKey === authServerKey) {\n const token = localStorage.getItem('token');\n if (token) options.headers.set('Authorization', `Bearer ${token}`);\n }\n return fetchUtils.fetchJson(url, options);\n };\n\nexport default httpClient;\n","// Return the first server matching with the baseUrl\nconst getServerKeyFromUri = (uri, dataServers) => {\n if (!uri) throw Error(`No URI provided to getServerKeyFromUri`);\n return Object.keys(dataServers).find(key => {\n if (dataServers[key].pod) {\n // The baseUrl ends with /data so remove this part to match with the webId and webId-related URLs (/inbox, /outbox...)\n return dataServers[key].baseUrl && uri.startsWith(dataServers[key].baseUrl.replace('/data', ''));\n }\n return uri.startsWith(dataServers[key].baseUrl);\n });\n};\n\nexport default getServerKeyFromUri;\n","import { useCallback, useMemo, useContext } from 'react';\nimport { DataProviderContext } from 'react-admin';\n\nconst compute = (externalLinks, record) =>\n typeof externalLinks === 'function' ? externalLinks(record) : externalLinks;\nconst isURL = url => typeof url === 'string' && url.startsWith('http');\n\nconst useGetExternalLink = componentExternalLinks => {\n // Since the externalLinks config is defined only locally, we don't need to wait for VOID endpoints fetching\n const dataProvider = useContext(DataProviderContext);\n const dataServers = dataProvider.getLocalDataServers();\n\n const serversExternalLinks = useMemo(() => {\n if (dataServers) {\n return Object.fromEntries(\n Object.values(dataServers).map(server => {\n // If externalLinks is not defined in the data server, use external links for non-default servers\n const externalLinks = server.externalLinks !== undefined ? server.externalLinks : !server.default;\n return [server.baseUrl, externalLinks];\n })\n );\n }\n }, [dataServers]);\n\n return useCallback(\n record => {\n const computedComponentExternalLinks = compute(componentExternalLinks, record);\n // If the component explicitly asks not to display as external links, use an internal link\n if (computedComponentExternalLinks === false) return false;\n\n if (!record?.id) return false;\n\n const serverBaseUrl = Object.keys(serversExternalLinks).find(baseUrl => record?.id.startsWith(baseUrl));\n // If no matching data servers could be found, assume we have an internal link\n if (!serverBaseUrl) return false;\n\n const computedServerExternalLinks = compute(serversExternalLinks[serverBaseUrl], record);\n // If the data server explicitly asks not to display as external links, use an internal link\n if (computedServerExternalLinks === false) return false;\n\n if (isURL(computedComponentExternalLinks)) {\n return computedComponentExternalLinks;\n }\n if (isURL(computedServerExternalLinks)) {\n return computedServerExternalLinks;\n }\n return record.id;\n },\n [serversExternalLinks, componentExternalLinks]\n );\n};\n\nexport default useGetExternalLink;\n","import { useState, useEffect } from 'react';\nimport useDataModel from './useDataModel';\nimport useDataServers from './useDataServers';\nimport findContainersWithTypes from '../dataProvider/utils/findContainersWithTypes';\nimport { DataServerKey } from '../dataProvider/types';\n\nconst useContainers = (resourceId: string, serverKeys = '@all') => {\n const dataModel = useDataModel(resourceId);\n const dataServers = useDataServers();\n const [containers, setContainers] = useState>();\n\n useEffect(() => {\n if (dataModel && dataServers) {\n setContainers(findContainersWithTypes(dataModel.types, serverKeys, dataServers));\n }\n }, [dataModel, dataServers, serverKeys]);\n\n return containers;\n};\n\nexport default useContainers;\n","import { useContext, useState, useEffect } from 'react';\nimport { DataProviderContext } from 'react-admin';\n\nconst useDataModel = (resourceId: string) => {\n // Get the raw data provider, since useDataProvider returns a wrapper\n const dataProvider = useContext(DataProviderContext);\n const [dataModel, setDataModel] = useState(undefined); // TODO: Type this object\n\n useEffect(() => {\n dataProvider.getDataModels().then((results: any) => setDataModel(results[resourceId]));\n }, [dataProvider, resourceId, setDataModel]);\n\n return dataModel;\n};\n\nexport default useDataModel;\n","import { useState, useEffect } from 'react';\nimport { useDataProvider } from 'react-admin';\nimport { DataProvider, DataServersConfig } from '../dataProvider/types';\n\nconst useDataServers = () => {\n const dataProvider = useDataProvider();\n const [dataServers, setDataServers] = useState();\n\n useEffect(() => {\n dataProvider.getDataServers().then(results => {\n setDataServers(results);\n });\n }, [dataProvider, setDataServers]);\n\n return dataServers;\n};\n\nexport default useDataServers;\n","import { useState, useEffect } from 'react';\nimport urlJoin from 'url-join';\nimport useDataModel from './useDataModel';\nimport useDataServers from './useDataServers';\nimport findCreateContainerWithTypes from '../dataProvider/utils/findCreateContainerWithTypes';\nimport getServerKeyFromType from '../dataProvider/utils/getServerKeyFromType';\n\n/** @deprecated Use \"useCreateContainerUri\" instead */\nconst useCreateContainer = resourceId => {\n const dataModel = useDataModel(resourceId);\n const dataServers = useDataServers();\n const [createContainer, setCreateContainer] = useState();\n\n useEffect(() => {\n if (dataModel && dataServers) {\n if (dataModel.create?.container) {\n const [serverKey, path] = Object.entries(dataModel.create.container)[0];\n if (!serverKey || !dataServers[serverKey]) {\n throw new Error(`Wrong key for the dataModel.create.container config of resource ${resourceId}`);\n }\n setCreateContainer(urlJoin(dataServers[serverKey].baseUrl, path));\n } else if (dataModel.create?.server) {\n setCreateContainer(findCreateContainerWithTypes(dataModel.types, dataModel.create?.server, dataServers));\n } else {\n const defaultServerKey = getServerKeyFromType('default', dataServers);\n setCreateContainer(findCreateContainerWithTypes(dataModel.types, defaultServerKey, dataServers));\n }\n }\n }, [dataModel, dataServers, setCreateContainer]);\n\n return createContainer;\n};\n\nexport default useCreateContainer;\n","import urlJoin from 'url-join';\nimport { DataModel, DataServerKey, DataServersConfig } from '../types';\n\nconst findCreateContainerWithTypes = (\n types: DataModel['types'],\n createServerKey: DataServerKey,\n dataServers: DataServersConfig\n) => {\n const containers: string[] = [];\n\n Object.keys(dataServers[createServerKey].containers?.[createServerKey] || {}).forEach(type => {\n if (types.includes(type)) {\n dataServers[createServerKey].containers![createServerKey][type].forEach(path => {\n const containerUri = urlJoin(dataServers[createServerKey].baseUrl, path);\n if (!containers.includes(containerUri)) {\n containers.push(containerUri);\n }\n });\n }\n });\n\n if (containers.length === 0) {\n throw new Error(\n `No container found matching with types ${JSON.stringify(\n types\n )}. You can set explicitely the create.container property of the resource.`\n );\n } else if (containers.length > 1) {\n throw new Error(\n `More than one container found matching with types ${JSON.stringify(\n types\n )}. You must set the create.server or create.container property for the resource.`\n );\n }\n\n return containers[0];\n};\n\nexport default findCreateContainerWithTypes;\n","import { useCallback } from 'react';\nimport urlJoin from 'url-join';\nimport useDataServers from './useDataServers';\nimport findCreateContainerWithTypes from '../dataProvider/utils/findCreateContainerWithTypes';\nimport getServerKeyFromType from '../dataProvider/utils/getServerKeyFromType';\nimport useDataModels from './useDataModels';\n\nconst useCreateContainerUri = () => {\n const dataModels = useDataModels();\n const dataServers = useDataServers();\n\n const getContainerUri = useCallback(\n (resourceId: string) => {\n if (!dataModels || !dataServers || !dataModels[resourceId]) {\n return undefined;\n }\n\n const dataModel = dataModels[resourceId];\n\n if (dataModel.create?.container) {\n const [serverKey, path] = Object.entries(dataModel.create.container)[0];\n if (!serverKey || !dataServers[serverKey]) {\n throw new Error(`Wrong key for the dataModel.create.container config of resource ${resourceId}`);\n }\n return urlJoin(dataServers[serverKey].baseUrl, path);\n }\n\n if (dataModel.create?.server) {\n return findCreateContainerWithTypes(dataModel.types, dataModel.create?.server, dataServers);\n }\n\n const defaultServerKey = getServerKeyFromType('default', dataServers);\n\n if (!defaultServerKey) {\n throw new Error(\n `No default dataServer found. You can set explicitly one setting the \"default\" attribute to true`\n );\n }\n\n return findCreateContainerWithTypes(dataModel.types, defaultServerKey, dataServers);\n },\n [dataModels, dataServers]\n );\n\n return getContainerUri;\n};\n\nexport default useCreateContainerUri;\n","import { useState, useEffect } from 'react';\nimport { useDataProvider } from 'react-admin';\nimport { DataModel, DataProvider } from '../dataProvider/types';\n\nconst useDataModels = () => {\n const dataProvider = useDataProvider();\n const [dataModels, setDataModels] = useState>();\n\n useEffect(() => {\n dataProvider.getDataModels().then(results => {\n setDataModels(results);\n });\n }, [dataProvider, setDataModels]);\n\n return dataModels;\n};\n\nexport default useDataModels;\n","import React, { useState, useEffect } from 'react';\n\n/**\n * @example\n * \n * \n * \n * \n * \n * \n */\n\nconst FilterHandler = ({ children, record, filter, source, ...otherProps }) => {\n const [filtered, setFiltered] = useState();\n useEffect(() => {\n if (record && source && Array.isArray(record?.[source])) {\n const filteredData = record?.[source].filter(r => {\n let eq = true;\n for (const key in filter) {\n const value = r[key];\n if (Array.isArray(value)) {\n if (!value.includes(filter[key])) {\n eq = false;\n }\n } else if (value !== filter[key]) {\n eq = false;\n }\n }\n return eq;\n });\n const newRecord = {\n ...record\n };\n // undefined setted if no data to obtain no render in RightLabel or equivalent\n newRecord[source] = filteredData.length > 0 ? filteredData : undefined;\n setFiltered(newRecord);\n }\n }, [record, source, filter]);\n\n return (\n <>\n {React.Children.map(children, (child, i) => {\n return React.cloneElement(child, {\n ...otherProps,\n record: filtered,\n source\n });\n })}\n >\n );\n};\nexport default FilterHandler;\n","import React from 'react';\nimport { useGetList, useRecordContext } from 'react-admin';\nimport { default as FilterHandler } from './FilterHandler';\n\n/*\n * @example Label used in examples\n * const Label = ({label, ...otherProps})=>{\n * return
{label}
\n * }\n *\n * @example show header for each group with group property thanks to groupHeader\n * }\n * filterProperty=\"property of source filtered by groupReference\"\n * >\n * // same props as GroupedArrayField source\n * \n * \n * \n * \n *\n * @example call chhildren with label thanks to groupLabel\n * \n * \n *\n * @example conditional show of group if no data in source. Conditionale groupHeader is not possible because GroupedArrayField define group before filter ; need use chhildren.\n * const ConditionalSourceDefinedHandler = ({record,source,children,...otherProps})=>{\n * if (record?.[source] && (!Array.isArray(record[source])||record[source].length>0)){\n * return React.Children.map(children, (child, i) => {\n * return React.cloneElement(child, {...otherProps,record,source});\n * })\n * }else{\n * return <>>\n * }\n * }\n *\n * \n * \n * \n * \n *\n *\n */\nconst GroupedReferenceHandler = ({\n children,\n groupReference,\n groupLabel,\n groupHeader,\n filterProperty,\n ...otherProps\n}) => {\n const record = useRecordContext();\n const { data } = useGetList(groupReference);\n\n return (\n <>\n {data?.map((data, index) => {\n const filter = {};\n filter[filterProperty] = data.id;\n return (\n <>\n {groupHeader && groupHeader({ ...otherProps, group: data })}\n \n {children}\n \n >\n );\n })}\n >\n );\n};\n\nexport default GroupedReferenceHandler;\n","import React, { useEffect, useState } from 'react';\nimport { ArrayInput, SimpleFormIterator, TextInput } from 'react-admin';\nimport makeStyles from '@mui/styles/makeStyles';\n\nconst useReferenceInputStyles = makeStyles({\n form: {\n display: 'flex'\n },\n input: {\n paddingRight: '20px'\n }\n});\n\nconst useHideInputStyles = makeStyles({\n root: {\n display: 'none'\n }\n});\n\nconst ReificationArrayInput = props => {\n const { reificationClass, children, ...otherProps } = props;\n const flexFormClasses = useReferenceInputStyles();\n const hideInputStyles = useHideInputStyles();\n\n return (\n \n \n {React.Children.map(props.children, (child, i) => {\n return React.cloneElement(child, {\n className: flexFormClasses.input\n });\n })}\n \n \n \n );\n};\n\nexport default ReificationArrayInput;\n"],"names":[],"version":3,"file":"index.es.js.map"}
\ No newline at end of file
+{"mappings":";;;;;;;;;;;;;AIEA,MAAM,sCAAgB,OAAO,aAAa;IACxC,MAAM,cAAE,UAAU,eAAE,WAAW,EAAE,GAAG;IAEpC,IAAI,EAAE,MAAM,IAAI,EAAE,GAAG,MAAM,WAAW;IAEtC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAAC;IAE7D,KAAK,EAAE,GAAG,KAAK,EAAE,IAAI,IAAI,CAAC,MAAM;IAEhC,sFAAsF;IACtF,gDAAgD;IAChD,IAAI,IAAI,CAAC,WAAW,KAAK,aACvB,OAAO,MAAM,CAAA,GAAA,aAAK,EAAE,OAAO,CAAC,MAAM;IAGpC,OAAO;AACT;IAEA,2CAAe;;;ADlBf,MAAM,qCAAe,CAAA,SAAU,OAAO,YAAY;QAChD,MAAM,aAAE,SAAS,EAAE,GAAG;QACtB,MAAM,YAAY,SAAS,CAAC,WAAW;QAEvC,IAAI,CAAC,WAAW,MAAM,IAAI,MAAM,CAAC,SAAS,EAAE,WAAW,gCAAgC,CAAC;QAExF,MAAM,OAAO,MAAM,CAAA,GAAA,wCAAY,EAAE,OAAO,EAAE,EAAE;QAE5C,yDAAyD;QACzD,IAAI,UAAU,IAAI,EAAE,YAAY;YAC9B,KAAK,MAAM,kBAAkB,UAA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C;IAAE,MAAM;IAAwB,YAAY;AAAe,CAAC;IAEjG,MAAM,SAAS,2CAAqB,GAAG,CAAC;IACxC,IAAI,QACF,uCAAuC;IACvC,OAAO;IAGT,qEAAqE;IACrE,iEAAiE;IACjE,MAAM,YAAY,0CAAgB,OAAO,aAAa;QAAE,GAAG,OAAO;QAAE,MAAM;IAAuB,GAAG,IAAI,CAAC,CAAA;QACvG,mDAAmD;QACnD,GAAG,gBAAgB,CAAC,SAAS,CAAA;YAC3B,2CAAqB,MAAM,CAAC;QAC9B;QACA,+DAA+D;QAC/D,MAAM,UAAU,QAAQ,UAAU,IAAK,CAAA,QAAQ,KAAK,IAAI,IAAI,KAAK,QAAQ,KAAK,EAAE,OAAO,KAAK,KAAK,GAAG,EAAC;QACrG,IAAI,SACF,WAAW;YACT,GAAG,KAAK;QACV,GAAG;QAEL,OAAO;IACT;IAEA,2CAAqB,GAAG,CAAC,aAAa;IACtC,OAAO;AACT;","sources":["packages/semantic-data-provider/src/index.ts","packages/semantic-data-provider/src/dataProvider/dataProvider.js","packages/semantic-data-provider/src/dataProvider/methods/create.js","packages/semantic-data-provider/src/dataProvider/methods/getOne.js","packages/semantic-data-provider/src/dataProvider/utils/fetchResource.js","packages/semantic-data-provider/src/dataProvider/utils/handleFiles.ts","packages/semantic-data-provider/src/dataProvider/utils/findContainersWithTypes.ts","packages/semantic-data-provider/src/dataProvider/utils/parseServerKeys.js","packages/semantic-data-provider/src/dataProvider/utils/getServerKeyFromType.js","packages/semantic-data-provider/src/dataProvider/methods/delete.ts","packages/semantic-data-provider/src/dataProvider/methods/deleteMany.js","packages/semantic-data-provider/src/dataProvider/methods/getDataServers.js","packages/semantic-data-provider/src/dataProvider/methods/getDataModels.js","packages/semantic-data-provider/src/dataProvider/methods/getList.js","packages/semantic-data-provider/src/dataProvider/utils/fetchContainers.ts","packages/semantic-data-provider/src/dataProvider/utils/arrayOf.ts","packages/semantic-data-provider/src/dataProvider/utils/fetchSparqlEndpoints.js","packages/semantic-data-provider/src/dataProvider/utils/getEmbedFrame.js","packages/semantic-data-provider/src/dataProvider/utils/buildSparqlQuery.js","packages/semantic-data-provider/src/dataProvider/utils/buildBaseQuery.js","packages/semantic-data-provider/src/dataProvider/utils/resolvePrefix.js","packages/semantic-data-provider/src/dataProvider/utils/buildBlankNodesQuery.js","packages/semantic-data-provider/src/dataProvider/utils/buildAutoDetectBlankNodesQuery.js","packages/semantic-data-provider/src/dataProvider/utils/findContainersWithPath.js","packages/semantic-data-provider/src/dataProvider/methods/getMany.js","packages/semantic-data-provider/src/dataProvider/methods/getManyReference.js","packages/semantic-data-provider/src/dataProvider/methods/update.ts","packages/semantic-data-provider/src/dataProvider/utils/fetchUserConfig.js","packages/semantic-data-provider/src/dataProvider/utils/fetchVoidEndpoints.js","packages/semantic-data-provider/src/dataProvider/httpClient.js","packages/semantic-data-provider/src/dataProvider/utils/getServerKeyFromUri.js","packages/semantic-data-provider/src/hooks/useGetExternalLink.js","packages/semantic-data-provider/src/hooks/useContainers.ts","packages/semantic-data-provider/src/hooks/useDataModel.ts","packages/semantic-data-provider/src/hooks/useDataServers.ts","packages/semantic-data-provider/src/hooks/useCreateContainer.js","packages/semantic-data-provider/src/dataProvider/utils/findCreateContainerWithTypes.ts","packages/semantic-data-provider/src/hooks/useCreateContainerUri.ts","packages/semantic-data-provider/src/hooks/useDataModels.ts","packages/semantic-data-provider/src/reification/FilterHandler.js","packages/semantic-data-provider/src/reification/GroupedReferenceHandler.js","packages/semantic-data-provider/src/reification/ReificationArrayInput.js","packages/semantic-data-provider/src/notificationChannels/subscribeToUpdates.ts"],"sourcesContent":["export { default as dataProvider } from './dataProvider/dataProvider';\n\nexport { default as buildSparqlQuery } from './dataProvider/utils/buildSparqlQuery';\nexport { default as buildBlankNodesQuery } from './dataProvider/utils/buildBlankNodesQuery';\n\nexport { default as useGetExternalLink } from './hooks/useGetExternalLink';\nexport { default as useContainers } from './hooks/useContainers';\nexport { default as useCreateContainer } from './hooks/useCreateContainer';\nexport { default as useCreateContainerUri } from './hooks/useCreateContainerUri';\nexport { default as useDataModel } from './hooks/useDataModel';\nexport { default as useDataModels } from './hooks/useDataModels';\nexport { default as useDataServers } from './hooks/useDataServers';\n\nexport { default as FilterHandler } from './reification/FilterHandler';\nexport { default as GroupedReferenceHandler } from './reification/GroupedReferenceHandler';\nexport { default as ReificationArrayInput } from './reification/ReificationArrayInput';\n\nexport {\n createWsChannel,\n getOrCreateWsChannel,\n createSolidNotificationChannel\n} from './notificationChannels/subscribeToUpdates';\n","import createMethod from './methods/create';\nimport deleteMethod from './methods/delete';\nimport deleteManyMethod from './methods/deleteMany';\nimport getDataServersMethod from './methods/getDataServers';\nimport getDataModelsMethod from './methods/getDataModels';\nimport getListMethod from './methods/getList';\nimport getManyMethod from './methods/getMany';\nimport getManyReferenceMethod from './methods/getManyReference';\nimport getOneMethod from './methods/getOne';\nimport updateMethod from './methods/update';\nimport fetchUserConfig from './utils/fetchUserConfig';\nimport fetchVoidEndpoints from './utils/fetchVoidEndpoints';\nimport getServerKeyFromType from './utils/getServerKeyFromType';\nimport httpClient from './httpClient';\n\nconst dataProvider = config => {\n // TODO verify all data provider config + data models\n if (!getServerKeyFromType('default', config.dataServers))\n throw new Error('You must define a default server in your dataServers config');\n\n if (!config.jsonContext) config.jsonContext = Object.fromEntries(config.ontologies.map(o => [o.prefix, o.url]));\n if (!config.returnFailedResources) config.returnFailedResources = false;\n\n // Configure httpClient with data servers (this is needed for proxy calls)\n config.httpClient = httpClient(config.dataServers);\n\n // Keep in memory for refresh\n const originalConfig = { ...config };\n\n let fetchUserConfigPromise = fetchUserConfig(config);\n let fetchVoidEndpointsPromise = fetchVoidEndpoints(config);\n\n const waitForConfig =\n method =>\n async (...arg) => {\n await fetchUserConfigPromise;\n await fetchVoidEndpointsPromise; // Return immediately if promise is fulfilled\n return await method(...arg);\n };\n\n return {\n getList: waitForConfig(getListMethod(config)),\n getMany: waitForConfig(getManyMethod(config)),\n getManyReference: waitForConfig(getManyReferenceMethod(config)),\n getOne: waitForConfig(getOneMethod(config)),\n create: waitForConfig(createMethod(config)),\n update: waitForConfig(updateMethod(config)),\n updateMany: () => {\n throw new Error('updateMany is not implemented yet');\n },\n delete: waitForConfig(deleteMethod(config)),\n deleteMany: waitForConfig(deleteManyMethod(config)),\n // Custom methods\n getDataModels: waitForConfig(getDataModelsMethod(config)),\n getDataServers: waitForConfig(getDataServersMethod(config)),\n getLocalDataServers: getDataServersMethod(config),\n fetch: waitForConfig(config.httpClient),\n refreshConfig: async () => {\n config = { ...originalConfig };\n fetchUserConfigPromise = fetchUserConfig(config);\n fetchVoidEndpointsPromise = fetchVoidEndpoints(config);\n await fetchUserConfigPromise;\n await fetchVoidEndpointsPromise;\n return config;\n }\n };\n};\n\nexport default dataProvider;\n","import urlJoin from 'url-join';\nimport getOne from './getOne';\nimport handleFiles from '../utils/handleFiles';\nimport findContainersWithTypes from '../utils/findContainersWithTypes';\n\nconst createMethod = config => async (resourceId, params) => {\n const { dataServers, resources, httpClient, jsonContext } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) Error(`Resource ${resourceId} is not mapped in resources file`);\n\n const headers = new Headers();\n\n let containerUri;\n let serverKey;\n if (dataModel.create?.container) {\n serverKey = Object.keys(dataModel.create.container)[0];\n containerUri = urlJoin(dataServers[serverKey].baseUrl, Object.values(dataModel.create.container)[0]);\n } else {\n serverKey = dataModel.create?.server || Object.keys(dataServers).find(key => dataServers[key].default === true);\n if (!serverKey) throw new Error('You must define a server for the creation, or a container, or a default server');\n\n const containers = findContainersWithTypes(dataModel.types, [serverKey], dataServers);\n // Extract the containerUri from the results (and ensure there is only one)\n const serverKeys = Object.keys(containers);\n\n if (!serverKeys || serverKeys.length === 0)\n throw new Error(`No container with types ${JSON.stringify(dataModel.types)} found on server ${serverKey}`);\n if (serverKeys.length > 1 || containers[serverKeys[0]].length > 1)\n throw new Error(\n `More than one container detected with types ${JSON.stringify(dataModel.types)} on server ${serverKey}`\n );\n containerUri = containers[serverKeys[0]][0];\n }\n\n if (params.data) {\n if (dataModel.fieldsMapping?.title) {\n if (Array.isArray(dataModel.fieldsMapping.title)) {\n headers.set('Slug', dataModel.fieldsMapping.title.map(f => params.data[f]).join(' '));\n } else {\n headers.set('Slug', params.data[dataModel.fieldsMapping.title]);\n }\n }\n\n // Upload files, if there are any\n const { updatedRecord } = await handleFiles.upload(params.data, config);\n params.data = updatedRecord;\n\n const { headers: responseHeaders } = await httpClient(containerUri, {\n method: 'POST',\n headers,\n body: JSON.stringify({\n '@context': jsonContext,\n '@type': dataModel.types,\n ...params.data\n })\n });\n\n // Retrieve newly-created resource\n const resourceUri = responseHeaders.get('Location');\n return await getOne(config)(resourceId, { id: resourceUri });\n }\n if (params.id) {\n headers.set('Content-Type', 'application/sparql-update');\n\n await httpClient(containerUri, {\n method: 'PATCH',\n headers,\n body: `\n PREFIX ldp: \n INSERT DATA { <${containerUri}> ldp:contains <${params.id}>. };\n `\n });\n\n // Create must return the new data, so get them from the remote URI\n return await getOne(config)(resourceId, { id: params.id });\n }\n};\n\nexport default createMethod;\n","import fetchResource from '../utils/fetchResource';\n\nconst getOneMethod = config => async (resourceId, params) => {\n const { resources } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) throw new Error(`Resource ${resourceId} is not mapped in resources file`);\n\n const data = await fetchResource(params.id, config);\n\n // Transform single value into array if forceArray is set\n if (dataModel.list?.forceArray) {\n for (const forceArrayItem of dataModel.list?.forceArray || []) {\n if (data[forceArrayItem] && !Array.isArray(data[forceArrayItem])) {\n data[forceArrayItem] = [data[forceArrayItem]];\n }\n }\n }\n\n // TODO activate defaultFetchPlan option\n // if (dataModel.list?.defaultFetchPlan) {\n // for (const node of dataModel.list?.defaultFetchPlan) {\n // if (\n // data[node] &&\n // typeof data[node] === 'string' &&\n // data[node].startsWith('http')\n // ) {\n // try {\n // const dataToEmbed = await fetchResource(data[node], config);\n // delete dataToEmbed['@context'];\n // data[node] = dataToEmbed;\n // } catch (e) {\n // // Ignore errors (this may happen if user does not have rights to see the resource)\n // }\n // }\n // }\n // }\n\n return { data };\n};\n\nexport default getOneMethod;\n","import jsonld from 'jsonld';\n\nconst fetchResource = async (resourceUri, config) => {\n const { httpClient, jsonContext } = config;\n\n let { json: data } = await httpClient(resourceUri);\n\n if (!data) throw new Error(`Not a valid JSON: ${resourceUri}`);\n\n data.id = data.id || data['@id'];\n\n // We compact only if the context is different between the frontend and the middleware\n // TODO deep compare if the context is an object\n if (data['@context'] !== jsonContext) {\n data = await jsonld.compact(data, jsonContext);\n }\n\n return data;\n};\n\nexport default fetchResource;\n","import urlJoin from 'url-join';\nimport { RaRecord } from 'react-admin';\nimport { Configuration } from '../types';\n\nconst isFile = (o: any): o is { rawFile: File } => o?.rawFile && o.rawFile instanceof File;\nconst isFileToDelete = (o: any): o is { fileToDelete: string } =>\n o?.fileToDelete !== undefined && o?.fileToDelete !== null;\n\nconst getUploadsContainerUri = (config: Configuration) => {\n const serverKey = Object.keys(config.dataServers).find(key => config.dataServers[key].uploadsContainer);\n if (serverKey && config.dataServers[serverKey].uploadsContainer) {\n return urlJoin(config.dataServers[serverKey].baseUrl, config.dataServers[serverKey].uploadsContainer!);\n }\n return null;\n};\n\nconst uploadFile = async (rawFile: File, config: Configuration) => {\n const uploadsContainerUri = getUploadsContainerUri(config);\n if (!uploadsContainerUri) throw new Error(\"You must define an uploadsContainer in one of the server's configuration\");\n\n const response = await config.httpClient(uploadsContainerUri, {\n method: 'POST',\n body: rawFile,\n headers: new Headers({\n 'Content-Type': rawFile.type\n })\n });\n\n if (response.status === 201) {\n return response.headers.get('Location');\n }\n return null;\n};\n\nconst deleteFiles = async (filesToDelete: string[], config: Configuration) => {\n return Promise.all(\n filesToDelete.map(file =>\n config.httpClient(file, {\n method: 'DELETE'\n })\n )\n );\n};\n\n/*\n * Look for raw files in the record data.\n * If there are any, upload them and replace the file by its URL.\n */\nconst uploadAllFiles = async (record: Partial, config: Configuration) => {\n const filesToDelete: string[] = [];\n const updatedRecord = { ...record };\n\n for (const property of Object.keys(record)) {\n const value = record[property];\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const itemValue = value[i];\n if (isFile(itemValue)) {\n if (isFileToDelete(itemValue)) {\n filesToDelete.push(itemValue.fileToDelete);\n }\n updatedRecord[property][i] = await uploadFile(itemValue.rawFile, config);\n } else if (isFileToDelete(itemValue)) {\n filesToDelete.push(itemValue.fileToDelete);\n updatedRecord[property][i] = null;\n }\n }\n } else if (isFile(value)) {\n if (isFileToDelete(value)) {\n filesToDelete.push(value.fileToDelete);\n }\n updatedRecord[property] = await uploadFile(value.rawFile, config);\n } else if (isFileToDelete(value)) {\n filesToDelete.push(value.fileToDelete);\n updatedRecord[property] = null;\n }\n }\n\n return {\n updatedRecord,\n filesToDelete\n };\n};\n\nexport default {\n upload: uploadAllFiles,\n delete: deleteFiles\n};\n","import urlJoin from 'url-join';\nimport { Configuration, DataServerKey } from '../types';\nimport parseServerKeys from './parseServerKeys';\n\nconst findContainersWithTypes = (\n types: string[],\n serverKeys: string | string[] | undefined,\n dataServers: Configuration['dataServers']\n) => {\n const containers = {} as Record;\n const existingContainers: string[] = [];\n\n const parsedServerKeys = parseServerKeys(serverKeys, dataServers);\n\n Object.keys(dataServers)\n .filter(dataServerKey => dataServers[dataServerKey].containers)\n .forEach(dataServerKey => {\n Object.keys(dataServers[dataServerKey].containers || {}).forEach(containerKey => {\n if (!parsedServerKeys || parsedServerKeys.includes(containerKey)) {\n Object.keys(dataServers[dataServerKey].containers![containerKey]).forEach(type => {\n if (types.includes(type)) {\n dataServers[dataServerKey].containers![containerKey][type].map(path => {\n const containerUri = urlJoin(dataServers[containerKey].baseUrl, path);\n\n // Avoid returning the same container several times\n if (!existingContainers.includes(containerUri)) {\n existingContainers.push(containerUri);\n\n if (!containers[dataServerKey]) containers[dataServerKey] = [];\n containers[dataServerKey].push(containerUri);\n }\n });\n }\n });\n }\n });\n });\n return containers;\n};\n\nexport default findContainersWithTypes;\n","import getServerKeyFromType from './getServerKeyFromType';\n\nconst parseServerKey = (serverKey, dataServers) => {\n switch (serverKey) {\n case '@default':\n return getServerKeyFromType('default', dataServers);\n case '@pod':\n return getServerKeyFromType('pod', dataServers);\n case '@authServer':\n return getServerKeyFromType('authServer', dataServers);\n default:\n return serverKey;\n }\n};\n\n// Return the list of servers keys in an array\n// parsing keywords like @all, @default, @pod and @authServer\nconst parseServerKeys = (serverKeys, dataServers) => {\n if (Array.isArray(serverKeys)) {\n if (serverKeys.includes('@all')) {\n return Object.keys(dataServers);\n }\n return serverKeys.map(serverKey => parseServerKey(serverKey, dataServers));\n }\n if (typeof serverKeys === 'string') {\n if (serverKeys === '@all') {\n return Object.keys(dataServers);\n }\n if (serverKeys === '@remote') {\n const defaultServerKey = getServerKeyFromType('default', dataServers);\n return Object.keys(dataServers).filter(serverKey => serverKey !== defaultServerKey);\n }\n return [parseServerKey(serverKeys, dataServers)];\n }\n // If server key is empty\n return false;\n};\n\nexport default parseServerKeys;\n","const getServerKeyFromType = (type, dataServers) => {\n return Object.keys(dataServers).find(key => {\n return dataServers[key][type];\n });\n};\n\nexport default getServerKeyFromType;\n","import { DeleteParams, RaRecord } from 'react-admin';\nimport { Configuration } from '../types';\nimport handleFiles from '../utils/handleFiles';\n\nconst deleteMethod = (config: Configuration) => async (resourceId: string, params: DeleteParams) => {\n const { httpClient } = config;\n\n await httpClient(`${params.id}`, {\n method: 'DELETE'\n });\n\n if (params.meta?.filesToDelete) {\n await handleFiles.delete(params.meta.filesToDelete, config);\n }\n\n return { data: { id: params.id } };\n};\n\nexport default deleteMethod;\n","const deleteManyMethod = config => async (resourceId, params) => {\n const { httpClient } = config;\n const ids = [];\n\n for (const id of params.ids) {\n try {\n await httpClient(id, {\n method: 'DELETE'\n });\n ids.push(id);\n } catch (e) {\n // Do nothing if we fail to delete a resource\n }\n }\n\n return { data: ids };\n};\n\nexport default deleteManyMethod;\n","const getDataServers = config => () => {\n return config.dataServers;\n};\n\nexport default getDataServers;\n","const getDataModels = config => () => {\n return config.resources;\n};\n\nexport default getDataModels;\n","import findContainersWithTypes from '../utils/findContainersWithTypes';\nimport fetchContainers from '../utils/fetchContainers';\nimport fetchSparqlEndpoints from '../utils/fetchSparqlEndpoints';\nimport findContainersWithPaths from '../utils/findContainersWithPath';\n\nconst getListMethod =\n config =>\n async (resourceId, params = {}) => {\n const { dataServers, resources } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) throw new Error(`Resource ${resourceId} is not mapped in resources file`);\n\n let containers;\n if (!params.filter?._servers && dataModel.list?.containers) {\n if (Array.isArray(dataModel.list?.containers))\n throw new Error(\n `The list.containers property of ${resourceId} dataModel must be of type object ({ serverKey: [containerUri] })`\n );\n // If containers are set explicitly, use them\n containers = findContainersWithPaths(dataModel.list.containers, dataServers);\n } else {\n // Otherwise find the container URIs on the given servers (either in the filter or the data model)\n containers = findContainersWithTypes(\n dataModel.types,\n params.filter?._servers || dataModel.list?.servers,\n dataServers\n );\n }\n\n if (dataModel.list?.fetchContainer) {\n return fetchContainers(containers, params, config);\n }\n return fetchSparqlEndpoints(containers, resourceId, params, config);\n };\n\nexport default getListMethod;\n","import jsonld, { ContextDefinition } from 'jsonld';\nimport { GetListParams } from 'react-admin';\nimport arrayOf from './arrayOf';\nimport { Configuration, ContainerURI, DataServerKey } from '../types';\n\ntype LDPContainerType = 'ldp:Container' | 'ldp:BasicContainer';\n\ninterface LDPContainerBase {\n '@context': Configuration['jsonContext'];\n id: string;\n 'ldp:contains': Record[];\n}\n\ninterface LDPContainerWithType extends LDPContainerBase {\n type: LDPContainerType | LDPContainerType[];\n}\n\ninterface LDPContainerWithAtType extends LDPContainerBase {\n '@type': LDPContainerType | LDPContainerType[];\n}\n\ntype LDPContainer = LDPContainerWithType | LDPContainerWithAtType;\n\ntype LDPResource = {\n '@context': Configuration['jsonContext'];\n [key: string]: any;\n};\n\ntype ListFilters = Partial<{\n q: string;\n type: string;\n _predicates: string[];\n _servers: DataServerKey[];\n [attribute: string]: any;\n}>;\n\nconst isValidLDPContainer = (container: LDPContainer) => {\n const resourceType = (container as LDPContainerWithType).type || (container as LDPContainerWithAtType)['@type'];\n return Array.isArray(resourceType) ? resourceType.includes('ldp:Container') : resourceType === 'ldp:Container';\n};\n\nconst isObject = (val: any) => {\n return val != null && typeof val === 'object' && !Array.isArray(val);\n};\n\nconst fetchContainers = async (\n containers: Record,\n params: GetListParams,\n { httpClient, jsonContext }: Configuration\n) => {\n const containersUri = Object.values(containers).flat();\n\n const fetchPromises = containersUri.map(containerUri =>\n httpClient(containerUri)\n .then(async ({ json }) => {\n const jsonResponse: LDPContainer = json;\n\n // If container's context is different, compact it to have an uniform result\n // TODO deep compare if the context is an object\n if (jsonResponse['@context'] !== jsonContext) {\n return jsonld.compact(jsonResponse, jsonContext as ContextDefinition) as unknown as Promise;\n }\n\n return jsonResponse;\n })\n .then((json: LDPContainer) => {\n if (!isValidLDPContainer(json)) {\n throw new Error(`${containerUri} is not a LDP container`);\n }\n\n return arrayOf(json['ldp:contains']).map(resource => ({\n '@context': json['@context'],\n ...resource\n }));\n })\n );\n\n // Fetch simultaneously all containers\n const results = await Promise.all(fetchPromises);\n let resources = results.flat();\n\n resources = resources.map(resource => {\n resource.id = resource.id || resource['@id'];\n return resource;\n });\n\n // Apply filter to results\n const filters: ListFilters = params.filter;\n\n // For SPARQL queries, we use \"a\" to filter types, but in containers it must be \"type\"\n if (filters.a) {\n filters.type = filters.a;\n delete filters.a;\n }\n\n // Filter resources attributes according to _predicates list\n if (filters._predicates && Array.isArray(filters._predicates)) {\n const predicates = filters._predicates;\n const mandatoryAttributes = ['id'];\n\n resources = resources.map(resource => {\n return Object.keys(resource)\n .filter(key => predicates.includes(key) || mandatoryAttributes.includes(key))\n .reduce(\n (filteredResource, key) => {\n filteredResource[key] = resource[key];\n return filteredResource;\n },\n { '@context': [] }\n );\n });\n }\n\n if (Object.keys(filters).filter(f => !['_predicates', '_servers'].includes(f)).length > 0) {\n resources = resources.filter(resource => {\n // Full text filtering\n if (filters.q) {\n return Object.values(resource).some(attributeValue => {\n if (!isObject(attributeValue)) {\n const arrayValues = Array.isArray(attributeValue) ? attributeValue : [attributeValue];\n return arrayValues.some(value => {\n if (typeof value === 'string') {\n return value.toLowerCase().normalize('NFD').includes(filters.q!.toLowerCase().normalize('NFD'));\n }\n return false;\n });\n }\n return false;\n });\n }\n\n // Attribute filtering\n const attributesFilters = Object.keys(filters).filter(f => !['_predicates', '_servers', 'q'].includes(f));\n\n return attributesFilters.every(attribute => {\n if (resource[attribute]) {\n const arrayValues: any[] = Array.isArray(resource[attribute]) ? resource[attribute] : [resource[attribute]];\n return arrayValues.some(\n (value: any) => typeof value === 'string' && value.includes(filters[attribute] as string)\n );\n }\n\n return false;\n });\n });\n }\n\n // Sorting\n if (params.sort) {\n resources = resources.sort((a, b) => {\n if (a[params.sort.field] && b[params.sort.field]) {\n if (params.sort.order === 'ASC') {\n return a[params.sort.field].localeCompare(b[params.sort.field]);\n }\n return b[params.sort.field].localeCompare(a[params.sort.field]);\n }\n return true;\n });\n }\n\n // Pagination\n const total = resources.length;\n\n if (params.pagination) {\n resources = resources.slice(\n (params.pagination.page - 1) * params.pagination.perPage,\n params.pagination.page * params.pagination.perPage\n );\n }\n\n return { data: resources, total };\n};\n\nexport default fetchContainers;\n","const arrayOf = (value: T | T[]) => {\n // If the field is null-ish, we suppose there are no values.\n if (!value) {\n return [];\n }\n // Return as is.\n if (Array.isArray(value)) {\n return value;\n }\n // Single value is made an array.\n return [value];\n};\n\nexport default arrayOf;\n","import jsonld from 'jsonld';\nimport getEmbedFrame from './getEmbedFrame';\nimport buildSparqlQuery from './buildSparqlQuery';\n\nconst compare = (a, b) => {\n switch (typeof a) {\n case 'string':\n return a.localeCompare(b);\n case 'number':\n case 'bigint':\n return a - b;\n default:\n return 0;\n }\n};\n\nconst fetchSparqlEndpoints = async (containers, resourceId, params, config) => {\n const { dataServers, resources, httpClient, jsonContext, ontologies } = config;\n const dataModel = resources[resourceId];\n\n const sparqlQueryPromises = Object.keys(containers).map(\n serverKey =>\n new Promise((resolve, reject) => {\n const blankNodes = params.filter?.blankNodes || dataModel.list?.blankNodes;\n\n // When the SPARQL request comes from the browser's URL, it comes as JSON string which must must be parsed\n if (\n params.filter?.sparqlWhere &&\n (typeof params.filter.sparqlWhere === 'string' || params.filter.sparqlWhere instanceof String)\n ) {\n params.filter.sparqlWhere = JSON.parse(decodeURIComponent(params.filter.sparqlWhere));\n }\n const sparqlQuery = buildSparqlQuery({\n containers: containers[serverKey],\n params,\n dataModel,\n ontologies\n });\n\n httpClient(dataServers[serverKey].sparqlEndpoint, {\n method: 'POST',\n body: sparqlQuery\n })\n .then(({ json }) => {\n // If we declared the blank nodes to dereference, embed only those blank nodes\n // This solve problems which can occur when same-type resources are embedded in other resources\n // To increase performances, you can set explicitEmbedOnFraming to false (make sure the result is still OK)\n const frame =\n blankNodes && dataModel.list?.explicitEmbedOnFraming !== false\n ? {\n '@context': jsonContext,\n '@type': dataModel.types,\n '@embed': '@never',\n ...getEmbedFrame(blankNodes)\n }\n : {\n '@context': jsonContext,\n '@type': dataModel.types\n };\n\n // omitGraph option force results to be in a @graph, even if we have a single result\n return jsonld.frame(json, frame, { omitGraph: false });\n })\n .then(compactJson => {\n if (compactJson['@id']) {\n const { '@context': context, ...rest } = compactJson;\n compactJson = {\n '@context': context,\n '@graph': [rest]\n };\n }\n resolve(\n compactJson['@graph'].map(resource => ({ '@context': compactJson['@context'], ...resource })) || []\n );\n })\n .catch(e => reject(e));\n })\n );\n\n // Run simultaneous SPARQL queries\n let results = await Promise.all(sparqlQueryPromises);\n\n if (results.length === 0) {\n return { data: [], total: 0 };\n }\n // Merge all results in one array\n results = [].concat(...results);\n\n // Add id in addition to @id, as this is what React-Admin expects\n let returnData = results.map(item => {\n item.id = item.id || item['@id'];\n return item;\n });\n\n // TODO sort and paginate the results in the SPARQL query to improve performances\n if (params.sort) {\n returnData = returnData.sort((a, b) => {\n if (a[params.sort.field] !== undefined && b[params.sort.field] !== undefined) {\n if (params.sort.order === 'ASC') {\n return compare(a[params.sort.field], b[params.sort.field]);\n }\n return compare(b[params.sort.field], a[params.sort.field]);\n }\n return 0;\n });\n }\n if (params.pagination) {\n returnData = returnData.slice(\n (params.pagination.page - 1) * params.pagination.perPage,\n params.pagination.page * params.pagination.perPage\n );\n }\n\n return { data: returnData, total: results.length };\n};\n\nexport default fetchSparqlEndpoints;\n","const getEmbedFrame = blankNodes => {\n let embedFrame = {};\n let predicates;\n if (blankNodes) {\n for (const blankNode of blankNodes) {\n if (blankNode.includes('/')) {\n predicates = blankNode.split('/').reverse();\n } else {\n predicates = [blankNode];\n }\n embedFrame = {\n ...embedFrame,\n ...predicates.reduce(\n (accumulator, predicate) => ({\n [predicate]: {\n '@embed': '@last',\n ...accumulator\n }\n }),\n {}\n )\n };\n }\n return embedFrame;\n }\n};\n\nexport default getEmbedFrame;\n","import DataFactory from '@rdfjs/data-model';\nimport buildBaseQuery from './buildBaseQuery';\nimport buildBlankNodesQuery from './buildBlankNodesQuery';\nimport buildAutoDetectBlankNodesQuery from './buildAutoDetectBlankNodesQuery';\nimport resolvePrefix from './resolvePrefix';\n\nconst SparqlGenerator = require('sparqljs').Generator;\n\nconst { literal, namedNode, triple, variable } = DataFactory;\n\nconst generator = new SparqlGenerator({\n /* prefixes, baseIRI, factory, sparqlStar */\n});\n\nconst reservedFilterKeys = ['q', 'sparqlWhere', 'blankNodes', 'blankNodesDepth', '_servers', '_predicates'];\n\nconst buildSparqlQuery = ({ containers, params, dataModel, ontologies }) => {\n const blankNodes = params.filter?.blankNodes || dataModel.list?.blankNodes;\n const predicates = params.filter?._predicates || dataModel.list?.predicates;\n const blankNodesDepth = params.filter?.blankNodesDepth ?? dataModel.list?.blankNodesDepth ?? 2;\n const filter = { ...dataModel.list?.filter, ...params.filter };\n const baseQuery = buildBaseQuery(predicates, ontologies);\n\n const sparqlJsParams = {\n queryType: 'CONSTRUCT',\n template: baseQuery.construct,\n where: [],\n type: 'query',\n prefixes: Object.fromEntries(ontologies.map(ontology => [ontology.prefix, ontology.url]))\n };\n\n const containerWhere = [\n {\n type: 'values',\n values: containers.map(containerUri => ({ '?containerUri': namedNode(containerUri) }))\n },\n triple(variable('containerUri'), namedNode('http://www.w3.org/ns/ldp#contains'), variable('s1')),\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isiri',\n args: [variable('s1')]\n }\n }\n ];\n\n let resourceWhere = [];\n\n if (filter && Object.keys(filter).length > 0) {\n const hasSPARQLFilter = filter.sparqlWhere && Object.keys(filter.sparqlWhere).length > 0;\n const hasFullTextSearch = filter.q && filter.q.length > 0;\n\n if (hasSPARQLFilter) {\n /*\n Example of usage :\n {\n \"sparqlWhere\": {\n \"type\": \"bgp\",\n \"triples\": [{\n \"subject\": {\"termType\": \"Variable\", \"value\": \"s1\"},\n \"predicate\": {\"termType\": \"NameNode\", \"value\": \"http://virtual-assembly.org/ontologies/pair#label\"},\n \"object\": {\"termType\": \"Literal\", \"value\": \"My Organization\"}\n }]\n }\n }\n */\n // initialize array in case of single value :\n [].concat(filter.sparqlWhere).forEach(sw => {\n resourceWhere.push(sw);\n });\n }\n\n if (hasFullTextSearch) {\n resourceWhere.push({\n type: 'group',\n patterns: [\n {\n queryType: 'SELECT',\n variables: [variable('s1')],\n where: [\n triple(variable('s1'), variable('p1'), variable('o1')),\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isliteral',\n args: [variable('o1')]\n }\n },\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'regex',\n args: [\n {\n type: 'operation',\n operator: 'lcase',\n args: [\n {\n type: 'operation',\n operator: 'str',\n args: [variable('o1')]\n }\n ]\n },\n literal(filter.q.toLowerCase(), '', namedNode('http://www.w3.org/2001/XMLSchema#string'))\n ]\n }\n }\n ],\n type: 'query'\n }\n ]\n });\n }\n\n // Other filters\n // SPARQL keyword a = filter based on the class of a resource (example => 'a': 'pair:OrganizationType')\n // Other filters are based on a value (example => 'petr:hasAudience': 'http://localhost:3000/audiences/tout-public')\n Object.entries(filter).forEach(([predicate, object]) => {\n if (!reservedFilterKeys.includes(predicate)) {\n resourceWhere.unshift(\n triple(\n variable('s1'),\n namedNode(resolvePrefix(predicate, ontologies)),\n namedNode(resolvePrefix(object, ontologies))\n )\n );\n }\n });\n }\n\n // Blank nodes\n const blankNodesQuery = blankNodes\n ? buildBlankNodesQuery(blankNodes, baseQuery, ontologies)\n : buildAutoDetectBlankNodesQuery(blankNodesDepth, baseQuery);\n\n if (blankNodesQuery && blankNodesQuery.construct) {\n resourceWhere = resourceWhere.concat(blankNodesQuery.where);\n sparqlJsParams.template = sparqlJsParams.template.concat(blankNodesQuery.construct);\n } else {\n resourceWhere.push(baseQuery.where);\n }\n\n sparqlJsParams.where.push(\n {\n type: 'union',\n patterns: [\n containerWhere,\n {\n type: 'graph',\n name: namedNode('http://semapps.org/mirror'),\n patterns: containerWhere\n }\n ]\n },\n {\n type: 'union',\n patterns: [\n resourceWhere,\n {\n type: 'graph',\n name: namedNode('http://semapps.org/mirror'),\n patterns: resourceWhere\n }\n ]\n }\n );\n\n return generator.stringify(sparqlJsParams);\n};\n\nexport default buildSparqlQuery;\n","import { namedNode, triple, variable } from '@rdfjs/data-model';\nimport resolvePrefix from './resolvePrefix';\n\nconst defaultToArray = value => (!value ? [] : Array.isArray(value) ? value : [value]);\n\n// We need to always include the type or React-Admin will not work properly\nconst typeQuery = triple(\n variable('s1'),\n namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),\n variable('type')\n);\n\nconst buildBaseQuery = (predicates, ontologies) => {\n let baseTriples;\n if (predicates) {\n baseTriples = defaultToArray(predicates).map((predicate, i) =>\n triple(variable('s1'), namedNode(resolvePrefix(predicate, ontologies)), variable(`o${i + 1}`))\n );\n return {\n construct: [typeQuery, ...baseTriples],\n where: [typeQuery, ...baseTriples.map(triple => ({ type: 'optional', patterns: [triple] }))]\n };\n }\n baseTriples = [triple(variable('s1'), variable('p1'), variable('o1'))];\n return {\n construct: baseTriples,\n where: baseTriples\n };\n};\n\nexport default buildBaseQuery;\n","const resolvePrefix = (item, ontologies) => {\n if (item.startsWith('http://') || item.startsWith('https://')) {\n // Already resolved, return the URI\n return item;\n }\n if (item === 'a') {\n // Special case\n return 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type';\n }\n const [prefix, value] = item.split(':');\n if (value) {\n const ontology = ontologies.find(ontology => ontology.prefix === prefix);\n if (ontology) {\n return ontology.url + value;\n }\n throw new Error(`No ontology found with prefix ${prefix}`);\n } else {\n throw new Error(`The value \"${item}\" is not correct. It must include a prefix or be a full URI.`);\n }\n};\n\nexport default resolvePrefix;\n","import md5 from 'crypto-js/md5';\nimport { namedNode, triple, variable } from '@rdfjs/data-model';\nimport resolvePrefix from './resolvePrefix';\n\n// Transform ['ont:predicate1/ont:predicate2'] to ['ont:predicate1', 'ont:predicate1/ont:predicate2']\nconst extractNodes = blankNodes => {\n const nodes = [];\n if (blankNodes) {\n for (const predicate of blankNodes) {\n if (predicate.includes('/')) {\n const nodeNames = predicate.split('/');\n for (let i = 1; i <= nodeNames.length; i++) {\n nodes.push(nodeNames.slice(0, i).join('/'));\n }\n } else {\n nodes.push(predicate);\n }\n }\n }\n return nodes;\n};\n\nconst generateSparqlVarName = node => md5(node);\n\nconst getParentNode = node => node.includes('/') && node.split('/')[0];\n\nconst getPredicate = node => (node.includes('/') ? node.split('/')[1] : node);\n\nconst buildUnionQuery = queries =>\n queries.map(q => {\n let triples = q.query;\n const firstTriple = queries.find(q2 => q.parentNode === q2.node);\n if (firstTriple !== undefined) {\n triples = triples.concat(firstTriple.query[0]);\n }\n return {\n type: 'bgp',\n triples\n };\n });\n\nconst buildBlankNodesQuery = (blankNodes, baseQuery, ontologies) => {\n const queries = [];\n const nodes = extractNodes(blankNodes);\n\n if (nodes && ontologies && ontologies.length > 0) {\n for (const node of nodes) {\n const parentNode = getParentNode(node);\n const predicate = getPredicate(node);\n const varName = generateSparqlVarName(node);\n const parentVarName = parentNode ? generateSparqlVarName(parentNode) : '1';\n\n const query = [\n triple(variable(`s${parentVarName}`), namedNode(resolvePrefix(predicate, ontologies)), variable(`s${varName}`)),\n triple(variable(`s${varName}`), variable(`p${varName}`), variable(`o${varName}`))\n ];\n\n queries.push({\n node,\n parentNode,\n query,\n filter: '' // `FILTER(isBLANK(?s${varName})) .`\n });\n }\n\n return {\n construct: queries.length > 0 ? queries.map(q => q.query).reduce((pre, cur) => pre.concat(cur)) : null,\n where: {\n type: 'union',\n patterns: [baseQuery.where, ...buildUnionQuery(queries)]\n }\n };\n }\n return {\n construct: '',\n where: ''\n };\n};\n\nexport default buildBlankNodesQuery;\n","import { triple, variable } from '@rdfjs/data-model';\n\nconst buildAutoDetectBlankNodesQuery = (depth, baseQuery) => {\n const construct = [...baseQuery.construct];\n let where = {};\n if (depth > 0) {\n const whereQueries = [];\n whereQueries.push([baseQuery.where]);\n for (let i = 1; i <= depth; i++) {\n construct.push(triple(variable(`o${i}`), variable(`p${i + 1}`), variable(`o${i + 1}`)));\n whereQueries.push([\n ...whereQueries[whereQueries.length - 1],\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isblank',\n args: [variable(`o${i}`)]\n }\n },\n triple(variable(`o${i}`), variable(`p${i + 1}`), variable(`o${i + 1}`))\n ]);\n }\n where = {\n type: 'union',\n patterns: whereQueries\n };\n } else if (depth === 0) {\n where = baseQuery.where;\n } else {\n throw new Error('The depth of buildAutoDetectBlankNodesQuery should be 0 or more');\n }\n\n return { construct, where };\n};\n\nexport default buildAutoDetectBlankNodesQuery;\n","import urlJoin from 'url-join';\n\nconst findContainersWithPaths = (paths, dataServers) => {\n const containers = {};\n Object.keys(paths).forEach(serverKey => {\n if (dataServers[serverKey]) {\n containers[serverKey] = [];\n paths[serverKey].forEach(path => {\n containers[serverKey].push(urlJoin(dataServers[serverKey].baseUrl, path));\n });\n } else {\n throw new Error(`No server found with key ${serverKey}`);\n }\n });\n return containers;\n};\n\nexport default findContainersWithPaths;\n","import getOne from './getOne';\n\nconst getManyMethod = config => async (resourceId, params) => {\n const { returnFailedResources } = config;\n\n let returnData = await Promise.all(\n params.ids.map(id =>\n getOne(config)(resourceId, { id: typeof id === 'object' ? id['@id'] : id })\n .then(({ data }) => data)\n .catch(() => {\n // Catch if one resource fails to load\n // Otherwise no references will be show if only one is missing\n // See https://github.com/marmelab/react-admin/issues/5190\n if (returnFailedResources) {\n return { id, _error: true };\n }\n // Returning nothing\n })\n )\n );\n\n // We don't want undefined results to appear in the results as it will break with react-admin\n returnData = returnData.filter(e => e);\n\n return { data: returnData };\n};\n\nexport default getManyMethod;\n","import getList from './getList';\n\nconst getManyReferenceMethod = config => async (resourceId, params) => {\n params.filter = { ...params.filter, [params.target]: params.id };\n delete params.target;\n return await getList(config)(resourceId, params);\n};\n\nexport default getManyReferenceMethod;\n","import { RaRecord, UpdateParams } from 'react-admin';\nimport { Configuration } from '../types';\nimport handleFiles from '../utils/handleFiles';\n\nconst updateMethod = (config: Configuration) => async (resourceId: string, params: UpdateParams) => {\n const { httpClient, jsonContext } = config;\n\n // Upload files, if there are any\n const { updatedRecord, filesToDelete } = await handleFiles.upload(params.data, config);\n params.data = updatedRecord;\n\n await httpClient(`${params.id}`, {\n method: 'PUT',\n body: JSON.stringify({\n '@context': jsonContext,\n ...params.data\n })\n });\n\n // Delete files only if update is successful\n await handleFiles.delete(filesToDelete, config);\n\n return { data: params.data };\n};\n\nexport default updateMethod;\n","import jwtDecode from 'jwt-decode';\nimport urlJoin from 'url-join';\nimport getServerKeyFromType from './getServerKeyFromType';\n\nconst fetchUserConfig = async config => {\n const { dataServers, httpClient } = config;\n const token = localStorage.getItem('token');\n const podKey = getServerKeyFromType('pod', dataServers);\n const authServerKey = getServerKeyFromType('authServer', dataServers);\n\n // If the user is logged in\n if (token) {\n const payload = jwtDecode(token);\n const webId = payload.webId || payload.webid; // Currently we must deal with both formats\n let userData;\n\n try {\n const { json } = await httpClient(webId);\n userData = json;\n } catch (e) {\n console.error(e);\n // If the webId cannot be fetched, assume an invalid token and disconnect the user\n localStorage.clear();\n window.location.reload();\n return;\n }\n\n // If we have a POD server\n if (podKey) {\n // Fill the config provided to the data provider\n // We must modify the config object directly\n config.dataServers[podKey].name = 'My Pod';\n config.dataServers[podKey].baseUrl = urlJoin(webId, 'data'); // TODO find POD URI from user profile\n config.dataServers[podKey].sparqlEndpoint =\n userData.endpoints?.['void:sparqlEndpoint'] || urlJoin(webId, 'sparql');\n }\n\n if (authServerKey) {\n // Fill the config provided to the data provider\n // We must modify the config object directly\n config.dataServers[authServerKey].proxyUrl = userData.endpoints?.proxyUrl;\n }\n } else if (podKey) {\n // If the user is not logged in, ignore the POD server\n delete config.dataServers[podKey];\n }\n};\n\nexport default fetchUserConfig;\n","const defaultToArray = value => (!value ? undefined : Array.isArray(value) ? value : [value]);\n\nconst fetchVoidEndpoints = async config => {\n const fetchPromises = Object.entries(config.dataServers)\n .filter(([key, server]) => server.pod !== true && server.void !== false)\n .map(([key, server]) =>\n config\n .httpClient(new URL('/.well-known/void', server.baseUrl).toString())\n .then(result => ({ key, datasets: result.json['@graph'] }))\n .catch(e => {\n if (e.status === 404 || e.status === 401 || e.status === 500) {\n return { key, error: e };\n }\n throw e;\n })\n );\n\n let results = [];\n\n try {\n results = await Promise.all(fetchPromises);\n } catch (e) {\n // Do not throw error if no endpoint found\n }\n\n for (const result of results) {\n config.dataServers[result.key].containers = config.dataServers[result.key].containers || {};\n config.dataServers[result.key].blankNodes = config.dataServers[result.key].blankNodes || {};\n\n // Ignore unfetchable endpoints\n if (result.datasets) {\n for (const dataset of result.datasets) {\n const datasetServerKey = Object.keys(config.dataServers).find(\n key => dataset['void:uriSpace'] === config.dataServers[key].baseUrl\n );\n\n // If the dataset is not part of a server mapped in the dataServers, ignore it\n if (datasetServerKey) {\n // If this is the local dataset, add the base information\n if (datasetServerKey === result.key) {\n config.dataServers[result.key].name = config.dataServers[result.key].name || dataset['dc:title'];\n config.dataServers[result.key].description =\n config.dataServers[result.key].description || dataset['dc:description'];\n config.dataServers[result.key].sparqlEndpoint =\n config.dataServers[result.key].sparqlEndpoint || dataset['void:sparqlEndpoint'];\n }\n\n config.dataServers[result.key].containers[datasetServerKey] =\n config.dataServers[result.key].containers[datasetServerKey] || {};\n\n for (const partition of defaultToArray(dataset['void:classPartition'])) {\n for (const type of defaultToArray(partition['void:class'])) {\n // Set containers by type\n const path = partition['void:uriSpace'].replace(dataset['void:uriSpace'], '/');\n if (config.dataServers[result.key].containers[datasetServerKey][type]) {\n config.dataServers[result.key].containers[datasetServerKey][type].push(path);\n } else {\n config.dataServers[result.key].containers[datasetServerKey][type] = [path];\n }\n }\n }\n }\n }\n }\n }\n};\n\nexport default fetchVoidEndpoints;\n","import { fetchUtils } from 'react-admin';\nimport getServerKeyFromUri from './utils/getServerKeyFromUri';\nimport getServerKeyFromType from './utils/getServerKeyFromType';\n\n/*\n * HTTP client used by all calls in data provider and auth provider\n * Do proxy calls if a proxy endpoint is available and the server is different from the auth server\n */\nconst httpClient =\n dataServers =>\n (url, options = {}) => {\n const authServerKey = getServerKeyFromType('authServer', dataServers);\n const serverKey = getServerKeyFromUri(url, dataServers);\n const useProxy =\n serverKey !== authServerKey && dataServers[authServerKey]?.proxyUrl && dataServers[serverKey]?.noProxy !== true;\n\n if (!options.headers) options.headers = new Headers();\n\n switch (options.method) {\n case 'POST':\n case 'PATCH':\n case 'PUT':\n if (!options.headers.has('Accept')) options.headers.set('Accept', 'application/ld+json');\n if (!options.headers.has('Content-Type')) options.headers.set('Content-Type', 'application/ld+json');\n break;\n\n case 'DELETE':\n break;\n\n case 'GET':\n default:\n if (!options.headers.has('Accept')) options.headers.set('Accept', 'application/ld+json');\n break;\n }\n\n if (useProxy) {\n const formData = new FormData();\n\n formData.append('id', url);\n formData.append('method', options.method || 'GET');\n formData.append('headers', JSON.stringify(Object.fromEntries(options.headers.entries())));\n\n if (options.body) {\n if (options.body instanceof File) {\n formData.append('body', options.body, options.body.name);\n } else {\n formData.append('body', options.body);\n }\n }\n\n // Post to proxy endpoint with multipart/form-data format\n return fetchUtils.fetchJson(dataServers[authServerKey].proxyUrl, {\n method: 'POST',\n headers: new Headers({\n Authorization: `Bearer ${localStorage.getItem('token')}`\n }),\n body: formData\n });\n }\n // Add token if the server is the same as the auth server\n if (serverKey === authServerKey) {\n const token = localStorage.getItem('token');\n if (token) options.headers.set('Authorization', `Bearer ${token}`);\n }\n return fetchUtils.fetchJson(url, options);\n };\n\nexport default httpClient;\n","// Return the first server matching with the baseUrl\nconst getServerKeyFromUri = (uri, dataServers) => {\n if (!uri) throw Error(`No URI provided to getServerKeyFromUri`);\n return Object.keys(dataServers).find(key => {\n if (dataServers[key].pod) {\n // The baseUrl ends with /data so remove this part to match with the webId and webId-related URLs (/inbox, /outbox...)\n return dataServers[key].baseUrl && uri.startsWith(dataServers[key].baseUrl.replace('/data', ''));\n }\n return uri.startsWith(dataServers[key].baseUrl);\n });\n};\n\nexport default getServerKeyFromUri;\n","import { useCallback, useMemo, useContext } from 'react';\nimport { DataProviderContext } from 'react-admin';\n\nconst compute = (externalLinks, record) =>\n typeof externalLinks === 'function' ? externalLinks(record) : externalLinks;\nconst isURL = url => typeof url === 'string' && url.startsWith('http');\n\nconst useGetExternalLink = componentExternalLinks => {\n // Since the externalLinks config is defined only locally, we don't need to wait for VOID endpoints fetching\n const dataProvider = useContext(DataProviderContext);\n const dataServers = dataProvider.getLocalDataServers();\n\n const serversExternalLinks = useMemo(() => {\n if (dataServers) {\n return Object.fromEntries(\n Object.values(dataServers).map(server => {\n // If externalLinks is not defined in the data server, use external links for non-default servers\n const externalLinks = server.externalLinks !== undefined ? server.externalLinks : !server.default;\n return [server.baseUrl, externalLinks];\n })\n );\n }\n }, [dataServers]);\n\n return useCallback(\n record => {\n const computedComponentExternalLinks = compute(componentExternalLinks, record);\n // If the component explicitly asks not to display as external links, use an internal link\n if (computedComponentExternalLinks === false) return false;\n\n if (!record?.id) return false;\n\n const serverBaseUrl = Object.keys(serversExternalLinks).find(baseUrl => record?.id.startsWith(baseUrl));\n // If no matching data servers could be found, assume we have an internal link\n if (!serverBaseUrl) return false;\n\n const computedServerExternalLinks = compute(serversExternalLinks[serverBaseUrl], record);\n // If the data server explicitly asks not to display as external links, use an internal link\n if (computedServerExternalLinks === false) return false;\n\n if (isURL(computedComponentExternalLinks)) {\n return computedComponentExternalLinks;\n }\n if (isURL(computedServerExternalLinks)) {\n return computedServerExternalLinks;\n }\n return record.id;\n },\n [serversExternalLinks, componentExternalLinks]\n );\n};\n\nexport default useGetExternalLink;\n","import { useState, useEffect } from 'react';\nimport useDataModel from './useDataModel';\nimport useDataServers from './useDataServers';\nimport findContainersWithTypes from '../dataProvider/utils/findContainersWithTypes';\nimport { DataServerKey } from '../dataProvider/types';\n\nconst useContainers = (resourceId: string, serverKeys = '@all') => {\n const dataModel = useDataModel(resourceId);\n const dataServers = useDataServers();\n const [containers, setContainers] = useState>();\n\n useEffect(() => {\n if (dataModel && dataServers) {\n setContainers(findContainersWithTypes(dataModel.types, serverKeys, dataServers));\n }\n }, [dataModel, dataServers, serverKeys]);\n\n return containers;\n};\n\nexport default useContainers;\n","import { useContext, useState, useEffect } from 'react';\nimport { DataProviderContext } from 'react-admin';\n\nconst useDataModel = (resourceId: string) => {\n // Get the raw data provider, since useDataProvider returns a wrapper\n const dataProvider = useContext(DataProviderContext);\n const [dataModel, setDataModel] = useState(undefined); // TODO: Type this object\n\n useEffect(() => {\n dataProvider.getDataModels().then((results: any) => setDataModel(results[resourceId]));\n }, [dataProvider, resourceId, setDataModel]);\n\n return dataModel;\n};\n\nexport default useDataModel;\n","import { useState, useEffect } from 'react';\nimport { useDataProvider } from 'react-admin';\nimport { DataProvider, DataServersConfig } from '../dataProvider/types';\n\nconst useDataServers = () => {\n const dataProvider = useDataProvider();\n const [dataServers, setDataServers] = useState();\n\n useEffect(() => {\n dataProvider.getDataServers().then(results => {\n setDataServers(results);\n });\n }, [dataProvider, setDataServers]);\n\n return dataServers;\n};\n\nexport default useDataServers;\n","import { useState, useEffect } from 'react';\nimport urlJoin from 'url-join';\nimport useDataModel from './useDataModel';\nimport useDataServers from './useDataServers';\nimport findCreateContainerWithTypes from '../dataProvider/utils/findCreateContainerWithTypes';\nimport getServerKeyFromType from '../dataProvider/utils/getServerKeyFromType';\n\n/** @deprecated Use \"useCreateContainerUri\" instead */\nconst useCreateContainer = resourceId => {\n const dataModel = useDataModel(resourceId);\n const dataServers = useDataServers();\n const [createContainer, setCreateContainer] = useState();\n\n useEffect(() => {\n if (dataModel && dataServers) {\n if (dataModel.create?.container) {\n const [serverKey, path] = Object.entries(dataModel.create.container)[0];\n if (!serverKey || !dataServers[serverKey]) {\n throw new Error(`Wrong key for the dataModel.create.container config of resource ${resourceId}`);\n }\n setCreateContainer(urlJoin(dataServers[serverKey].baseUrl, path));\n } else if (dataModel.create?.server) {\n setCreateContainer(findCreateContainerWithTypes(dataModel.types, dataModel.create?.server, dataServers));\n } else {\n const defaultServerKey = getServerKeyFromType('default', dataServers);\n setCreateContainer(findCreateContainerWithTypes(dataModel.types, defaultServerKey, dataServers));\n }\n }\n }, [dataModel, dataServers, setCreateContainer]);\n\n return createContainer;\n};\n\nexport default useCreateContainer;\n","import urlJoin from 'url-join';\nimport { DataModel, DataServerKey, DataServersConfig } from '../types';\n\nconst findCreateContainerWithTypes = (\n types: DataModel['types'],\n createServerKey: DataServerKey,\n dataServers: DataServersConfig\n) => {\n const containers: string[] = [];\n\n Object.keys(dataServers[createServerKey].containers?.[createServerKey] || {}).forEach(type => {\n if (types.includes(type)) {\n dataServers[createServerKey].containers![createServerKey][type].forEach(path => {\n const containerUri = urlJoin(dataServers[createServerKey].baseUrl, path);\n if (!containers.includes(containerUri)) {\n containers.push(containerUri);\n }\n });\n }\n });\n\n if (containers.length === 0) {\n throw new Error(\n `No container found matching with types ${JSON.stringify(\n types\n )}. You can set explicitely the create.container property of the resource.`\n );\n } else if (containers.length > 1) {\n throw new Error(\n `More than one container found matching with types ${JSON.stringify(\n types\n )}. You must set the create.server or create.container property for the resource.`\n );\n }\n\n return containers[0];\n};\n\nexport default findCreateContainerWithTypes;\n","import { useCallback } from 'react';\nimport urlJoin from 'url-join';\nimport useDataServers from './useDataServers';\nimport findCreateContainerWithTypes from '../dataProvider/utils/findCreateContainerWithTypes';\nimport getServerKeyFromType from '../dataProvider/utils/getServerKeyFromType';\nimport useDataModels from './useDataModels';\n\nconst useCreateContainerUri = () => {\n const dataModels = useDataModels();\n const dataServers = useDataServers();\n\n const getContainerUri = useCallback(\n (resourceId: string) => {\n if (!dataModels || !dataServers || !dataModels[resourceId]) {\n return undefined;\n }\n\n const dataModel = dataModels[resourceId];\n\n if (dataModel.create?.container) {\n const [serverKey, path] = Object.entries(dataModel.create.container)[0];\n if (!serverKey || !dataServers[serverKey]) {\n throw new Error(`Wrong key for the dataModel.create.container config of resource ${resourceId}`);\n }\n return urlJoin(dataServers[serverKey].baseUrl, path);\n }\n\n if (dataModel.create?.server) {\n return findCreateContainerWithTypes(dataModel.types, dataModel.create?.server, dataServers);\n }\n\n const defaultServerKey = getServerKeyFromType('default', dataServers);\n\n if (!defaultServerKey) {\n throw new Error(\n `No default dataServer found. You can set explicitly one setting the \"default\" attribute to true`\n );\n }\n\n return findCreateContainerWithTypes(dataModel.types, defaultServerKey, dataServers);\n },\n [dataModels, dataServers]\n );\n\n return getContainerUri;\n};\n\nexport default useCreateContainerUri;\n","import { useState, useEffect } from 'react';\nimport { useDataProvider } from 'react-admin';\nimport { DataModel, DataProvider } from '../dataProvider/types';\n\nconst useDataModels = () => {\n const dataProvider = useDataProvider();\n const [dataModels, setDataModels] = useState>();\n\n useEffect(() => {\n dataProvider.getDataModels().then(results => {\n setDataModels(results);\n });\n }, [dataProvider, setDataModels]);\n\n return dataModels;\n};\n\nexport default useDataModels;\n","import React, { useState, useEffect } from 'react';\n\n/**\n * @example\n * \n * \n * \n * \n * \n * \n */\n\nconst FilterHandler = ({ children, record, filter, source, ...otherProps }) => {\n const [filtered, setFiltered] = useState();\n useEffect(() => {\n if (record && source && Array.isArray(record?.[source])) {\n const filteredData = record?.[source].filter(r => {\n let eq = true;\n for (const key in filter) {\n const value = r[key];\n if (Array.isArray(value)) {\n if (!value.includes(filter[key])) {\n eq = false;\n }\n } else if (value !== filter[key]) {\n eq = false;\n }\n }\n return eq;\n });\n const newRecord = {\n ...record\n };\n // undefined setted if no data to obtain no render in RightLabel or equivalent\n newRecord[source] = filteredData.length > 0 ? filteredData : undefined;\n setFiltered(newRecord);\n }\n }, [record, source, filter]);\n\n return (\n <>\n {React.Children.map(children, (child, i) => {\n return React.cloneElement(child, {\n ...otherProps,\n record: filtered,\n source\n });\n })}\n >\n );\n};\nexport default FilterHandler;\n","import React from 'react';\nimport { useGetList, useRecordContext } from 'react-admin';\nimport { default as FilterHandler } from './FilterHandler';\n\n/*\n * @example Label used in examples\n * const Label = ({label, ...otherProps})=>{\n * return
{label}
\n * }\n *\n * @example show header for each group with group property thanks to groupHeader\n * }\n * filterProperty=\"property of source filtered by groupReference\"\n * >\n * // same props as GroupedArrayField source\n * \n * \n * \n * \n *\n * @example call chhildren with label thanks to groupLabel\n * \n * \n *\n * @example conditional show of group if no data in source. Conditionale groupHeader is not possible because GroupedArrayField define group before filter ; need use chhildren.\n * const ConditionalSourceDefinedHandler = ({record,source,children,...otherProps})=>{\n * if (record?.[source] && (!Array.isArray(record[source])||record[source].length>0)){\n * return React.Children.map(children, (child, i) => {\n * return React.cloneElement(child, {...otherProps,record,source});\n * })\n * }else{\n * return <>>\n * }\n * }\n *\n * \n * \n * \n * \n *\n *\n */\nconst GroupedReferenceHandler = ({\n children,\n groupReference,\n groupLabel,\n groupHeader,\n filterProperty,\n ...otherProps\n}) => {\n const record = useRecordContext();\n const { data } = useGetList(groupReference);\n\n return (\n <>\n {data?.map((data, index) => {\n const filter = {};\n filter[filterProperty] = data.id;\n return (\n <>\n {groupHeader && groupHeader({ ...otherProps, group: data })}\n \n {children}\n \n >\n );\n })}\n >\n );\n};\n\nexport default GroupedReferenceHandler;\n","import React, { useEffect, useState } from 'react';\nimport { ArrayInput, SimpleFormIterator, TextInput } from 'react-admin';\nimport makeStyles from '@mui/styles/makeStyles';\n\nconst useReferenceInputStyles = makeStyles({\n form: {\n display: 'flex'\n },\n input: {\n paddingRight: '20px'\n }\n});\n\nconst useHideInputStyles = makeStyles({\n root: {\n display: 'none'\n }\n});\n\nconst ReificationArrayInput = props => {\n const { reificationClass, children, ...otherProps } = props;\n const flexFormClasses = useReferenceInputStyles();\n const hideInputStyles = useHideInputStyles();\n\n return (\n \n \n {React.Children.map(props.children, (child, i) => {\n return React.cloneElement(child, {\n className: flexFormClasses.input\n });\n })}\n \n \n \n );\n};\n\nexport default ReificationArrayInput;\n","import { fetchUtils } from 'react-admin';\nimport arrayOf from '../dataProvider/utils/arrayOf';\n\n/*\n * Utility functions for subscribing to resource update using Solid Notifications.\n * See https://solidproject.org/TR/notifications-protocol for an overview.\n */\n\ntype fetchFn = typeof fetchUtils.fetchJson;\n\ninterface CreateSolidChannelOptions {\n type: string;\n closeAfter?: number;\n startIn?: number;\n startAt?: string;\n endAt?: string;\n rate?: number;\n}\n\n/**\n * Find the solid notification description resource for a given resource URI.\n */\nconst findDescriptionResource = async (fetch: fetchFn, resourceUri: string) => {\n const { headers } = await fetch(resourceUri, { method: 'HEAD' });\n const linkHeader = headers.get('Link');\n\n const matches = linkHeader?.match(\n /<([^>]+)>;\\s*rel=\"(?:describedby|http:\\/\\/www\\.w3\\.org\\/ns\\/solid\\/terms#storageDescription)\"/\n );\n if (!matches?.[1]) {\n return undefined;\n // matches[1] contains the URI of the description resource\n // Further actions can be taken here, such as subscribing to the websocket using the description resource URI\n }\n const { json: descriptionResource } = await fetch(matches[1]);\n return descriptionResource;\n};\n\nconst createSolidNotificationChannel = async (\n fetch: fetchFn,\n resourceUri: string,\n options: CreateSolidChannelOptions = { type: 'WebSocketChannel2023' }\n) => {\n const { type, closeAfter, startIn, rate } = options;\n let { startAt, endAt } = options;\n if (startIn && !startAt) startAt = new Date(Date.now() + startIn).toISOString();\n if (closeAfter && !endAt) endAt = new Date(Date.now() + closeAfter).toISOString();\n\n const descriptionResource = await findDescriptionResource(fetch, resourceUri);\n\n // TODO: use a json-ld parser / ldo in the future for this...\n // Get solid notification subscription service for the given type.\n const subscriptionService = (\n await Promise.all(\n // Get the subscription service resources (that describe a channel type).\n arrayOf(descriptionResource.subscription || descriptionResource['notify:subscription']).map(\n async subscriptionServiceOrUri => {\n // They might not be resolved...\n if (typeof subscriptionServiceOrUri === 'string') {\n const { json } = await fetch(subscriptionServiceOrUri);\n return json;\n }\n return subscriptionServiceOrUri;\n }\n )\n )\n ).find((service: any) => {\n // Find for the correct channel type (e.g. web socket).\n const channelType = service.channelType ?? service['notify:channelType'];\n return channelType === type || channelType === `notify:${type}`;\n });\n\n if (!subscriptionService) {\n throw new Error(`No solid notification subscription service found for type ${type}`);\n }\n\n // Create a new channel.\n const { json: channel } = await fetch(subscriptionService.id || subscriptionService['@id'], {\n method: 'POST',\n body: JSON.stringify({\n '@context': 'https://www.w3.org/ns/solid/notification/v1',\n type: 'WebSocketChannel2023',\n topic: resourceUri,\n startAt,\n endAt,\n rate\n })\n });\n\n return channel;\n};\n\nconst createWsChannel = async (fetch: fetchFn, resourceUri: string, options: CreateSolidChannelOptions) => {\n const channel = await createSolidNotificationChannel(fetch, resourceUri, options);\n const receiveFrom: string = channel.receiveFrom || channel['notify:receiveFrom'];\n\n return new WebSocket(receiveFrom);\n};\n\nconst registeredWebSockets = new Map>();\n\n/**\n * @param fetch A react admin fetch function.\n * @param resourceUri The resource to subscribe to\n * @param options Options to pass to @see createSolidNotificationChannel, if the channel does not exist yet.\n * @returns {WebSocket} A new or existing web socket that subscribed to the given resource.\n */\nconst getOrCreateWsChannel = async (\n fetch: fetchFn,\n resourceUri: string,\n options: CreateSolidChannelOptions = { type: 'WebSocketChannel2023', closeAfter: 1000 * 60 * 60 }\n) => {\n const socket = registeredWebSockets.get(resourceUri);\n if (socket) {\n // Will resolve or is resolved already.\n return socket;\n }\n\n // Create a promise, to return immediately and set the sockets cache.\n // This prevents racing conditions that create multiple channels.\n const wsPromise = createWsChannel(fetch, resourceUri, { ...options, type: 'WebSocketChannel2023' }).then(ws => {\n // Remove the promise from the cache, if it closes.\n ws.addEventListener('close', e => {\n registeredWebSockets.delete(resourceUri);\n });\n // Close the socket, if the endAt / closeAfter time is reached.\n const closeIn = options.closeAfter ?? (options.endAt && new Date(options.endAt).getTime() - Date.now());\n if (closeIn)\n setTimeout(() => {\n ws.close();\n }, closeIn);\n\n return ws;\n });\n\n registeredWebSockets.set(resourceUri, wsPromise);\n return wsPromise;\n};\n\nexport { getOrCreateWsChannel, createWsChannel, createSolidNotificationChannel };\n"],"names":[],"version":3,"file":"index.es.js.map"}
\ No newline at end of file
diff --git a/src/frontend/packages/semantic-data-provider/src/index.ts b/src/frontend/packages/semantic-data-provider/src/index.ts
index 4ac6fac5c..c980861f1 100644
--- a/src/frontend/packages/semantic-data-provider/src/index.ts
+++ b/src/frontend/packages/semantic-data-provider/src/index.ts
@@ -14,3 +14,9 @@ export { default as useDataServers } from './hooks/useDataServers';
export { default as FilterHandler } from './reification/FilterHandler';
export { default as GroupedReferenceHandler } from './reification/GroupedReferenceHandler';
export { default as ReificationArrayInput } from './reification/ReificationArrayInput';
+
+export {
+ createWsChannel,
+ getOrCreateWsChannel,
+ createSolidNotificationChannel
+} from './notificationChannels/subscribeToUpdates';
diff --git a/src/frontend/packages/semantic-data-provider/src/notificationChannels/subscribeToUpdates.ts b/src/frontend/packages/semantic-data-provider/src/notificationChannels/subscribeToUpdates.ts
new file mode 100644
index 000000000..11091f590
--- /dev/null
+++ b/src/frontend/packages/semantic-data-provider/src/notificationChannels/subscribeToUpdates.ts
@@ -0,0 +1,140 @@
+import { fetchUtils } from 'react-admin';
+import arrayOf from '../dataProvider/utils/arrayOf';
+
+/*
+ * Utility functions for subscribing to resource update using Solid Notifications.
+ * See https://solidproject.org/TR/notifications-protocol for an overview.
+ */
+
+type fetchFn = typeof fetchUtils.fetchJson;
+
+interface CreateSolidChannelOptions {
+ type: string;
+ closeAfter?: number;
+ startIn?: number;
+ startAt?: string;
+ endAt?: string;
+ rate?: number;
+}
+
+/**
+ * Find the solid notification description resource for a given resource URI.
+ */
+const findDescriptionResource = async (fetch: fetchFn, resourceUri: string) => {
+ const { headers } = await fetch(resourceUri, { method: 'HEAD' });
+ const linkHeader = headers.get('Link');
+
+ const matches = linkHeader?.match(
+ /<([^>]+)>;\s*rel="(?:describedby|http:\/\/www\.w3\.org\/ns\/solid\/terms#storageDescription)"/
+ );
+ if (!matches?.[1]) {
+ return undefined;
+ // matches[1] contains the URI of the description resource
+ // Further actions can be taken here, such as subscribing to the websocket using the description resource URI
+ }
+ const { json: descriptionResource } = await fetch(matches[1]);
+ return descriptionResource;
+};
+
+const createSolidNotificationChannel = async (
+ fetch: fetchFn,
+ resourceUri: string,
+ options: CreateSolidChannelOptions = { type: 'WebSocketChannel2023' }
+) => {
+ const { type, closeAfter, startIn, rate } = options;
+ let { startAt, endAt } = options;
+ if (startIn && !startAt) startAt = new Date(Date.now() + startIn).toISOString();
+ if (closeAfter && !endAt) endAt = new Date(Date.now() + closeAfter).toISOString();
+
+ const descriptionResource = await findDescriptionResource(fetch, resourceUri);
+
+ // TODO: use a json-ld parser / ldo in the future for this...
+ // Get solid notification subscription service for the given type.
+ const subscriptionService = (
+ await Promise.all(
+ // Get the subscription service resources (that describe a channel type).
+ arrayOf(descriptionResource.subscription || descriptionResource['notify:subscription']).map(
+ async subscriptionServiceOrUri => {
+ // They might not be resolved...
+ if (typeof subscriptionServiceOrUri === 'string') {
+ const { json } = await fetch(subscriptionServiceOrUri);
+ return json;
+ }
+ return subscriptionServiceOrUri;
+ }
+ )
+ )
+ ).find((service: any) => {
+ // Find for the correct channel type (e.g. web socket).
+ const channelType = service.channelType ?? service['notify:channelType'];
+ return channelType === type || channelType === `notify:${type}`;
+ });
+
+ if (!subscriptionService) {
+ throw new Error(`No solid notification subscription service found for type ${type}`);
+ }
+
+ // Create a new channel.
+ const { json: channel } = await fetch(subscriptionService.id || subscriptionService['@id'], {
+ method: 'POST',
+ body: JSON.stringify({
+ '@context': 'https://www.w3.org/ns/solid/notification/v1',
+ type: 'WebSocketChannel2023',
+ topic: resourceUri,
+ startAt,
+ endAt,
+ rate
+ })
+ });
+
+ return channel;
+};
+
+const createWsChannel = async (fetch: fetchFn, resourceUri: string, options: CreateSolidChannelOptions) => {
+ const channel = await createSolidNotificationChannel(fetch, resourceUri, options);
+ const receiveFrom: string = channel.receiveFrom || channel['notify:receiveFrom'];
+
+ return new WebSocket(receiveFrom);
+};
+
+const registeredWebSockets = new Map>();
+
+/**
+ * @param fetch A react admin fetch function.
+ * @param resourceUri The resource to subscribe to
+ * @param options Options to pass to @see createSolidNotificationChannel, if the channel does not exist yet.
+ * @returns {WebSocket} A new or existing web socket that subscribed to the given resource.
+ */
+const getOrCreateWsChannel = async (
+ fetch: fetchFn,
+ resourceUri: string,
+ options: CreateSolidChannelOptions = { type: 'WebSocketChannel2023', closeAfter: 1000 * 60 * 60 }
+) => {
+ const socket = registeredWebSockets.get(resourceUri);
+ if (socket) {
+ // Will resolve or is resolved already.
+ return socket;
+ }
+
+ // Create a promise, to return immediately and set the sockets cache.
+ // This prevents racing conditions that create multiple channels.
+ const wsPromise = createWsChannel(fetch, resourceUri, { ...options, type: 'WebSocketChannel2023' }).then(ws => {
+ // Remove the promise from the cache, if it closes.
+ ws.addEventListener('close', e => {
+ registeredWebSockets.delete(resourceUri);
+ });
+ // Close the socket, if the endAt / closeAfter time is reached.
+ const closeIn = options.closeAfter ?? (options.endAt && new Date(options.endAt).getTime() - Date.now());
+ if (closeIn)
+ setTimeout(() => {
+ ws.close();
+ }, closeIn);
+
+ return ws;
+ });
+
+ registeredWebSockets.set(resourceUri, wsPromise);
+ return wsPromise;
+};
+
+export { getOrCreateWsChannel, createWsChannel, createSolidNotificationChannel };
diff --git a/src/middleware/packages/activitypub/constants.js b/src/middleware/packages/activitypub/constants.js
index 143bc9b09..4f627c0bb 100644
--- a/src/middleware/packages/activitypub/constants.js
+++ b/src/middleware/packages/activitypub/constants.js
@@ -29,7 +29,7 @@ const ACTIVITY_TYPES = {
REMOVE: 'Remove',
TENTATIVE_REJECT: 'TentativeReject',
TENTATIVE_ACCEPT: 'TentativeAccept',
- TRAVAL: 'Travel',
+ TRAVEL: 'Travel',
UNDO: 'Undo',
UPDATE: 'Update',
VIEW: 'View'
diff --git a/website/docs/frontend/activitypub-components.md b/website/docs/frontend/activitypub-components.md
index e57c07b9f..ab52946b3 100644
--- a/website/docs/frontend/activitypub-components.md
+++ b/website/docs/frontend/activitypub-components.md
@@ -81,19 +81,30 @@ export const ActorShow = props => (
This hook allows you to load data from an [ActivityStreams Collection](https://www.w3.org/TR/activitystreams-core/#collections).
-It takes as a parameter a full URL or a predicate. In the latter case, it will look for the properties of the logged-in actor. Typically, you could use `useCollection("followers")` to get the list of followers of the logged-in actor.
+As first parameter, it takes a full URL or a predicate. In the latter case, it will look for the properties of the logged-in actor. Typically, you could use `useCollection("followers")` to get the list of followers of the logged-in actor. The second parameter is an options object. See below for the supported options.
```jsx
const {
- items, // an array listing the items of the collection
- loaded, // boolean that is false until the data is available
- loading, // boolean that is true on mount, and false once the data was fetched
- error, // error message if there was an error loading the collection
- refetch, // a callback to refresh the data
- url // url of the loaded collection (useful if only a predicate was passed)
-} = useCollection('http://localhost:3000/alice/followers');
+ items, // An array listing the items of the collection.
+ totalItems, // The total number of items in the collection.
+ refetch, // A callback to refresh the data
+ url, // url of the loaded collection (useful if only a predicate was passed)
+ error, // List of all errors that occurred while fetching the collection and its items or undefined.
+ fetchNextPage, // Callback to fetch the next items in the collection.
+ hasNextPage, // Boolean indicating, if the items list is complete or if there are more items retrievable.
+ isLoading, // True, if items or a page is loading.
+ isFetching, // True, if items or a page is being fetched.
+ isFetchingNextPage, // True, if the next page is being fetched.
+ url: collectionUrl, // The URL of the collection
+ hasLiveUpdates // True if the hook is triggered on Solid Notification WebSocket Channel updates.
+} = useCollection('http://localhost:3000/alice/followers', { dereferenceItems: false, liveUpdates: true });
```
+#### useCollection `options` parameter:
+
+- `dereferenceItems: boolean` Set to true, to force dereferencing of collection items. Note that items may be returned as object, if the server dereferences the items itself.
+- `liveUpdates: boolean` Set to true, to ask the server to notify the client of updates to the collection using a Solid Notifications WebSocket Channel. The hook will automatically trigger in those cases. No updates will be provided, if the server does not support the protocol.
+
### useInbox
This hook allows you to fetch activities from the logged-in user's inbox.
diff --git a/website/docs/frontend/semantic-data-provider/index.md b/website/docs/frontend/semantic-data-provider/index.md
index ad53f1257..8220e6eba 100644
--- a/website/docs/frontend/semantic-data-provider/index.md
+++ b/website/docs/frontend/semantic-data-provider/index.md
@@ -248,3 +248,36 @@ Get the [data servers](data-servers) config, including data fetched through VoID
```js
const dataServers = useDataServers();
```
+
+## Utilities
+
+### `getOrCreateWsChannel`
+
+This function adheres to the [Solid Notification Protocol](https://solidproject.org/TR/notifications-protocol), specifically the [WebSocketChannel2023](https://solid.github.io/notifications/websocket-channel-2023) specification. It creates a WebSocket that conforms to this specification.
+
+#### Parameters
+
+| Param Position | Property | Type | Default | Description |
+| -------------- | ------------- | ---------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| 1 | `fetch` | `Function` | **required** | A React Admin fetch function. You can obtain it using `const { fetch } = useDataProvider()`. |
+| 2 | `resourceUri` | `string` | **required** | The URI of the resource to subscribe to. |
+| 3 | `options` | `object` | | Options to pass to `createSolidNotificationChannel` if the channel does not exist yet. Refer to the [documentation of the features in the spec](https://solidproject.org/TR/notifications-protocol#notification-features) for more details. See `CreateSolidChannelOptions`. |
+
+#### `CreateSolidChannelOptions` Interface
+
+| Property | Type | Default | Description |
+| ------------ | ------------------- | ---------------------- | ------------------------------------------------------------------------------------- |
+| `type` | `string` | `WebSocketChannel2023` | The type of channel. The default and only supported option is `WebSocketChannel2023`. |
+| `closeAfter` | `number` | | Time in milliseconds after which the channel should close. |
+| `startIn` | `number` | | Time in milliseconds to wait before starting the channel. |
+| `startAt` | `string` (ISO 8601) | | ISO 8601 timestamp indicating when to start the channel. |
+| `endAt` | `string` (ISO 8601) | | ISO 8601 timestamp indicating when to end the channel. |
+| `rate` | `number` | | The rate in milliseconds at which notifications should be sent at most. |
+
+### `createWsChannel`
+
+This function operates similarly to `getOrCreateWsChannel` but always creates a new channel, even if a channel for the same resource (but potentially with different options) is already open. The newly created channel is not registered in the cache used by `getOrCreateWsChannel`.
+
+### `createSolidNotificationChannel`
+
+This function is used internally by `getOrCreateWsChannel` and `createWsChannel` to create a WebSocket channel object conforming to the Solid Notification Protocol.