@semapps/semantic-data-provider 1.1.4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +271 -175
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.ts +2380 -0
- package/dist/index.d.ts +172 -188
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +266 -170
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.tsx +2439 -0
- package/package.json +14 -8
|
@@ -0,0 +1,2439 @@
|
|
|
1
|
+
import { createConnectedLdoDataset as $fj9kP$createConnectedLdoDataset } from '@ldo/connected';
|
|
2
|
+
import { solidConnectedPlugin as $fj9kP$solidConnectedPlugin } from '@ldo/connected-solid';
|
|
3
|
+
import { createLdoDataset as $fj9kP$createLdoDataset } from '@ldo/ldo';
|
|
4
|
+
import $fj9kP$speakingurl from 'speakingurl';
|
|
5
|
+
import $fj9kP$jsonld from 'jsonld';
|
|
6
|
+
import $fj9kP$rdfjsdatamodel, {
|
|
7
|
+
triple as $fj9kP$triple,
|
|
8
|
+
variable as $fj9kP$variable,
|
|
9
|
+
namedNode as $fj9kP$namedNode
|
|
10
|
+
} from '@rdfjs/data-model';
|
|
11
|
+
import { Generator as $fj9kP$Generator } from 'sparqljs';
|
|
12
|
+
// @ts-expect-error TS(7016): Could not find a declaration file for module 'cryp... Remove this comment to see the full error message
|
|
13
|
+
import $fj9kP$cryptojsmd5 from 'crypto-js/md5';
|
|
14
|
+
import {
|
|
15
|
+
fetchUtils as $fj9kP$fetchUtils,
|
|
16
|
+
useDataProvider as $fj9kP$useDataProvider,
|
|
17
|
+
DataProviderContext as $fj9kP$DataProviderContext,
|
|
18
|
+
useRecordContext as $fj9kP$useRecordContext,
|
|
19
|
+
useGetList as $fj9kP$useGetList,
|
|
20
|
+
ArrayInput as $fj9kP$ArrayInput,
|
|
21
|
+
SimpleFormIterator as $fj9kP$SimpleFormIterator,
|
|
22
|
+
TextInput as $fj9kP$TextInput
|
|
23
|
+
} from 'react-admin';
|
|
24
|
+
import $fj9kP$urljoin from 'url-join';
|
|
25
|
+
import $fj9kP$jwtdecode from 'jwt-decode';
|
|
26
|
+
import $fj9kP$httplinkheader from 'http-link-header';
|
|
27
|
+
import { capitalCase as $fj9kP$capitalCase } from 'change-case';
|
|
28
|
+
import $fj9kP$react, {
|
|
29
|
+
useState as $fj9kP$useState,
|
|
30
|
+
useEffect as $fj9kP$useEffect,
|
|
31
|
+
useMemo as $fj9kP$useMemo,
|
|
32
|
+
useCallback as $fj9kP$useCallback,
|
|
33
|
+
useContext as $fj9kP$useContext
|
|
34
|
+
} from 'react';
|
|
35
|
+
import { jsx as $fj9kP$jsx, Fragment as $fj9kP$Fragment, jsxs as $fj9kP$jsxs } from 'react/jsx-runtime';
|
|
36
|
+
// @ts-expect-error TS(2307): Cannot find module '@mui/styles/makeStyles' or its... Remove this comment to see the full error message
|
|
37
|
+
import { makeStyles } from 'tss-react/mui';
|
|
38
|
+
|
|
39
|
+
const $336b7edf722fe53e$var$fetchResource = async (resourceUri: any, config: any) => {
|
|
40
|
+
const { httpClient: httpClient, jsonContext: jsonContext } = config;
|
|
41
|
+
let { json: data } = await httpClient(resourceUri);
|
|
42
|
+
if (!data) throw new Error(`Not a valid JSON: ${resourceUri}`);
|
|
43
|
+
data.id = data.id || data['@id'];
|
|
44
|
+
// We compact only if the context is different between the frontend and the middleware
|
|
45
|
+
// TODO deep compare if the context is an object
|
|
46
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
47
|
+
if (data['@context'] !== jsonContext) data = await (0, $fj9kP$jsonld).compact(data, jsonContext);
|
|
48
|
+
return data;
|
|
49
|
+
};
|
|
50
|
+
var $336b7edf722fe53e$export$2e2bcd8739ae039 = $336b7edf722fe53e$var$fetchResource;
|
|
51
|
+
|
|
52
|
+
const $ed447224dd38ce82$var$getOneMethod = (config: any) => async (resourceId: any, params: any) => {
|
|
53
|
+
const { resources: resources } = config;
|
|
54
|
+
const dataModel = resources[resourceId];
|
|
55
|
+
if (!dataModel) throw new Error(`Resource ${resourceId} is not mapped in resources file`);
|
|
56
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
57
|
+
const data = await (0, $336b7edf722fe53e$export$2e2bcd8739ae039)(params.id, config);
|
|
58
|
+
// Transform single value into array if forceArray is set
|
|
59
|
+
if (dataModel.list?.forceArray) {
|
|
60
|
+
for (const forceArrayItem of dataModel.list?.forceArray || [])
|
|
61
|
+
if (data[forceArrayItem] && !Array.isArray(data[forceArrayItem])) data[forceArrayItem] = [data[forceArrayItem]];
|
|
62
|
+
}
|
|
63
|
+
// TODO activate defaultFetchPlan option
|
|
64
|
+
// if (dataModel.list?.defaultFetchPlan) {
|
|
65
|
+
// for (const node of dataModel.list?.defaultFetchPlan) {
|
|
66
|
+
// if (
|
|
67
|
+
// data[node] &&
|
|
68
|
+
// typeof data[node] === 'string' &&
|
|
69
|
+
// data[node].startsWith('http')
|
|
70
|
+
// ) {
|
|
71
|
+
// try {
|
|
72
|
+
// const dataToEmbed = await fetchResource(data[node], config);
|
|
73
|
+
// delete dataToEmbed['@context'];
|
|
74
|
+
// data[node] = dataToEmbed;
|
|
75
|
+
// } catch (e) {
|
|
76
|
+
// // Ignore errors (this may happen if user does not have rights to see the resource)
|
|
77
|
+
// }
|
|
78
|
+
// }
|
|
79
|
+
// }
|
|
80
|
+
// }
|
|
81
|
+
return {
|
|
82
|
+
data: data
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
var $ed447224dd38ce82$export$2e2bcd8739ae039 = $ed447224dd38ce82$var$getOneMethod;
|
|
86
|
+
|
|
87
|
+
const $c35ffbda15247c32$var$getUploadsContainerUri = (config: any, serverKey: any) => {
|
|
88
|
+
// If no server key is defined or if the server has no uploads container, find any server with a uploads container
|
|
89
|
+
if (
|
|
90
|
+
!serverKey ||
|
|
91
|
+
!config.dataServers[serverKey].containers ||
|
|
92
|
+
!config.dataServers[serverKey].containers?.find((c: any) => c.binaryResources)
|
|
93
|
+
)
|
|
94
|
+
serverKey = Object.keys(config.dataServers).find(key =>
|
|
95
|
+
config.dataServers[key].containers?.find((c: any) => c.binaryResources)
|
|
96
|
+
);
|
|
97
|
+
if (serverKey)
|
|
98
|
+
return config.dataServers[serverKey].containers?.find((c: any) => c.binaryResources)?.uri; // No server has an uploads container
|
|
99
|
+
else return null;
|
|
100
|
+
};
|
|
101
|
+
var $c35ffbda15247c32$export$2e2bcd8739ae039 = $c35ffbda15247c32$var$getUploadsContainerUri;
|
|
102
|
+
|
|
103
|
+
const $b17c43e3301545ca$var$isFile = (o: any) => o?.rawFile && o.rawFile instanceof File;
|
|
104
|
+
const $b17c43e3301545ca$export$a5575dbeeffdad98 = async (rawFile: any, config: any, serverKey: any) => {
|
|
105
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
106
|
+
const uploadsContainerUri = (0, $c35ffbda15247c32$export$2e2bcd8739ae039)(config, serverKey);
|
|
107
|
+
if (!uploadsContainerUri)
|
|
108
|
+
throw new Error("You must define an container with binaryResources in one of the server's configuration");
|
|
109
|
+
const response = await config.httpClient(uploadsContainerUri, {
|
|
110
|
+
method: 'POST',
|
|
111
|
+
body: rawFile,
|
|
112
|
+
headers: new Headers({
|
|
113
|
+
'Content-Type': rawFile.type
|
|
114
|
+
})
|
|
115
|
+
});
|
|
116
|
+
if (response.status === 201) return response.headers.get('Location');
|
|
117
|
+
return null;
|
|
118
|
+
};
|
|
119
|
+
/*
|
|
120
|
+
* Look for raw files in the record data.
|
|
121
|
+
* If there are any, upload them and replace the file by its URL.
|
|
122
|
+
*/ const $b17c43e3301545ca$var$uploadAllFiles = async (record: any, config: any, serverKey: any) => {
|
|
123
|
+
const updatedRecord = {
|
|
124
|
+
...record
|
|
125
|
+
};
|
|
126
|
+
for (const property of Object.keys(record)) {
|
|
127
|
+
const value = record[property];
|
|
128
|
+
if (Array.isArray(value))
|
|
129
|
+
for (let i = 0; i < value.length; i++) {
|
|
130
|
+
const itemValue = value[i];
|
|
131
|
+
if ($b17c43e3301545ca$var$isFile(itemValue))
|
|
132
|
+
updatedRecord[property][i] = await $b17c43e3301545ca$export$a5575dbeeffdad98(
|
|
133
|
+
itemValue.rawFile,
|
|
134
|
+
config,
|
|
135
|
+
serverKey
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
else if ($b17c43e3301545ca$var$isFile(value))
|
|
139
|
+
updatedRecord[property] = await $b17c43e3301545ca$export$a5575dbeeffdad98(value.rawFile, config, serverKey);
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
updatedRecord: updatedRecord
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
var $b17c43e3301545ca$export$2e2bcd8739ae039 = {
|
|
146
|
+
upload: $b17c43e3301545ca$var$uploadAllFiles
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const $8326b88c1a913ca9$var$getServerKeyFromType = (type: any, dataServers: any) => {
|
|
150
|
+
return (
|
|
151
|
+
dataServers &&
|
|
152
|
+
Object.keys(dataServers).find(key => {
|
|
153
|
+
return dataServers[key][type];
|
|
154
|
+
})
|
|
155
|
+
);
|
|
156
|
+
};
|
|
157
|
+
var $8326b88c1a913ca9$export$2e2bcd8739ae039 = $8326b88c1a913ca9$var$getServerKeyFromType;
|
|
158
|
+
|
|
159
|
+
const $99cc2e4a2a3c100b$var$parseServerKey = (serverKey: any, dataServers: any) => {
|
|
160
|
+
switch (serverKey) {
|
|
161
|
+
case '@default':
|
|
162
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
163
|
+
return (0, $8326b88c1a913ca9$export$2e2bcd8739ae039)('default', dataServers);
|
|
164
|
+
case '@pod':
|
|
165
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
166
|
+
return (0, $8326b88c1a913ca9$export$2e2bcd8739ae039)('pod', dataServers);
|
|
167
|
+
case '@authServer':
|
|
168
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
169
|
+
return (0, $8326b88c1a913ca9$export$2e2bcd8739ae039)('authServer', dataServers);
|
|
170
|
+
default:
|
|
171
|
+
return serverKey;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
// Return the list of servers keys in an array
|
|
175
|
+
// parsing keywords like @all, @default, @pod and @authServer
|
|
176
|
+
const $99cc2e4a2a3c100b$var$parseServerKeys = (serverKeys: any, dataServers: any) => {
|
|
177
|
+
if (Array.isArray(serverKeys)) {
|
|
178
|
+
if (serverKeys.includes('@all')) return Object.keys(dataServers);
|
|
179
|
+
else return serverKeys.map(serverKey => $99cc2e4a2a3c100b$var$parseServerKey(serverKey, dataServers));
|
|
180
|
+
} else if (typeof serverKeys === 'string') {
|
|
181
|
+
if (serverKeys === '@all') return Object.keys(dataServers);
|
|
182
|
+
else if (serverKeys === '@remote') {
|
|
183
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
184
|
+
const defaultServerKey = (0, $8326b88c1a913ca9$export$2e2bcd8739ae039)('default', dataServers);
|
|
185
|
+
return Object.keys(dataServers).filter(serverKey => serverKey !== defaultServerKey);
|
|
186
|
+
} else return [$99cc2e4a2a3c100b$var$parseServerKey(serverKeys, dataServers)];
|
|
187
|
+
} else throw new Error(`The parseServerKeys expect a list of server keys, or keywords`);
|
|
188
|
+
};
|
|
189
|
+
var $99cc2e4a2a3c100b$export$2e2bcd8739ae039 = $99cc2e4a2a3c100b$var$parseServerKeys;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Return all containers matching the given types
|
|
193
|
+
*/ const $15b841e67a1ba752$var$findContainersWithTypes = (types: any, serverKeys: any, dataServers: any) => {
|
|
194
|
+
const matchingContainers: any = [];
|
|
195
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
196
|
+
const parsedServerKeys = (0, $99cc2e4a2a3c100b$export$2e2bcd8739ae039)(serverKeys || '@all', dataServers);
|
|
197
|
+
Object.keys(dataServers).forEach(dataServerKey => {
|
|
198
|
+
if (parsedServerKeys.includes(dataServerKey))
|
|
199
|
+
dataServers[dataServerKey].containers?.forEach((container: any) => {
|
|
200
|
+
if (container.types?.some((t: any) => types.includes(t))) matchingContainers.push(container);
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
return matchingContainers;
|
|
204
|
+
};
|
|
205
|
+
var $15b841e67a1ba752$export$2e2bcd8739ae039 = $15b841e67a1ba752$var$findContainersWithTypes;
|
|
206
|
+
|
|
207
|
+
const $7c772a9c0c25a69d$var$findContainersWithURIs = (containersUris: any, dataServers: any) => {
|
|
208
|
+
const matchingContainers: any = [];
|
|
209
|
+
Object.keys(dataServers).forEach(serverKey => {
|
|
210
|
+
dataServers[serverKey].containers?.forEach((container: any) => {
|
|
211
|
+
if (container.uri && containersUris.includes(container.uri)) matchingContainers.push(container);
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
return matchingContainers;
|
|
215
|
+
};
|
|
216
|
+
var $7c772a9c0c25a69d$export$2e2bcd8739ae039 = $7c772a9c0c25a69d$var$findContainersWithURIs;
|
|
217
|
+
|
|
218
|
+
const $5a7a2f7583392866$var$createMethod = (config: any) => async (resourceId: any, params: any) => {
|
|
219
|
+
const { dataServers: dataServers, resources: resources, httpClient: httpClient, jsonContext: jsonContext } = config;
|
|
220
|
+
const dataModel = resources[resourceId];
|
|
221
|
+
if (!dataModel) Error(`Resource ${resourceId} is not mapped in resources file`);
|
|
222
|
+
const headers = new Headers();
|
|
223
|
+
let containerUri;
|
|
224
|
+
let serverKey;
|
|
225
|
+
if (dataModel.create?.container) {
|
|
226
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
227
|
+
const [container] = (0, $7c772a9c0c25a69d$export$2e2bcd8739ae039)([dataModel.create?.container], dataServers);
|
|
228
|
+
serverKey = container.server;
|
|
229
|
+
containerUri = container.uri;
|
|
230
|
+
} else {
|
|
231
|
+
serverKey = dataModel.create?.server || Object.keys(dataServers).find(key => dataServers[key].default === true);
|
|
232
|
+
if (!serverKey) throw new Error('You must define a server for the creation, or a container, or a default server');
|
|
233
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
234
|
+
const containers = (0, $15b841e67a1ba752$export$2e2bcd8739ae039)(dataModel.types, [serverKey], dataServers);
|
|
235
|
+
if (!containers || containers.length === 0)
|
|
236
|
+
throw new Error(`No container with types ${JSON.stringify(dataModel.types)} found on server ${serverKey}`);
|
|
237
|
+
if (containers.length > 1)
|
|
238
|
+
throw new Error(
|
|
239
|
+
`More than one container detected with types ${JSON.stringify(dataModel.types)} on server ${serverKey}`
|
|
240
|
+
);
|
|
241
|
+
containerUri = containers[0].uri;
|
|
242
|
+
}
|
|
243
|
+
if (params.data) {
|
|
244
|
+
if (dataModel.fieldsMapping?.title) {
|
|
245
|
+
const slug = Array.isArray(dataModel.fieldsMapping.title)
|
|
246
|
+
? dataModel.fieldsMapping.title.map((f: any) => params.data[f]).join(' ')
|
|
247
|
+
: params.data[dataModel.fieldsMapping.title];
|
|
248
|
+
// Generate slug here, otherwise we may get errors with special characters
|
|
249
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
250
|
+
headers.set('Slug', (0, $fj9kP$speakingurl)(slug));
|
|
251
|
+
}
|
|
252
|
+
// Upload files, if there are any
|
|
253
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
254
|
+
const { updatedRecord: updatedRecord } = await (0, $b17c43e3301545ca$export$2e2bcd8739ae039).upload(
|
|
255
|
+
params.data,
|
|
256
|
+
config,
|
|
257
|
+
serverKey
|
|
258
|
+
);
|
|
259
|
+
params.data = updatedRecord;
|
|
260
|
+
const { headers: responseHeaders } = await httpClient(containerUri, {
|
|
261
|
+
method: 'POST',
|
|
262
|
+
headers: headers,
|
|
263
|
+
body: JSON.stringify({
|
|
264
|
+
'@context': jsonContext,
|
|
265
|
+
'@type': dataModel.types,
|
|
266
|
+
...params.data
|
|
267
|
+
})
|
|
268
|
+
});
|
|
269
|
+
// Retrieve newly-created resource
|
|
270
|
+
const resourceUri = responseHeaders.get('Location');
|
|
271
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
272
|
+
return await (0, $ed447224dd38ce82$export$2e2bcd8739ae039)(config)(resourceId, {
|
|
273
|
+
id: resourceUri
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
if (params.id) {
|
|
277
|
+
headers.set('Content-Type', 'application/sparql-update');
|
|
278
|
+
await httpClient(containerUri, {
|
|
279
|
+
method: 'PATCH',
|
|
280
|
+
headers: headers,
|
|
281
|
+
body: `
|
|
282
|
+
PREFIX ldp: <http://www.w3.org/ns/ldp#>
|
|
283
|
+
INSERT DATA { <${containerUri}> ldp:contains <${params.id}>. };
|
|
284
|
+
`
|
|
285
|
+
});
|
|
286
|
+
// Create must return the new data, so get them from the remote URI
|
|
287
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
288
|
+
return await (0, $ed447224dd38ce82$export$2e2bcd8739ae039)(config)(resourceId, {
|
|
289
|
+
id: params.id
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
var $5a7a2f7583392866$export$2e2bcd8739ae039 = $5a7a2f7583392866$var$createMethod;
|
|
294
|
+
|
|
295
|
+
const $9510970b8e7eb9e2$var$deleteMethod = (config: any) => async (resourceId: any, params: any) => {
|
|
296
|
+
const { httpClient: httpClient } = config;
|
|
297
|
+
await httpClient(`${params.id}`, {
|
|
298
|
+
method: 'DELETE'
|
|
299
|
+
});
|
|
300
|
+
return {
|
|
301
|
+
data: {
|
|
302
|
+
id: params.id
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
var $9510970b8e7eb9e2$export$2e2bcd8739ae039 = $9510970b8e7eb9e2$var$deleteMethod;
|
|
307
|
+
|
|
308
|
+
const $298dd1ae21173ea0$var$deleteManyMethod = (config: any) => async (resourceId: any, params: any) => {
|
|
309
|
+
const { httpClient: httpClient } = config;
|
|
310
|
+
const ids = [];
|
|
311
|
+
for (const id of params.ids)
|
|
312
|
+
try {
|
|
313
|
+
await httpClient(id, {
|
|
314
|
+
method: 'DELETE'
|
|
315
|
+
});
|
|
316
|
+
ids.push(id);
|
|
317
|
+
} catch (e) {
|
|
318
|
+
// Do nothing if we fail to delete a resource
|
|
319
|
+
}
|
|
320
|
+
return {
|
|
321
|
+
data: ids
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
var $298dd1ae21173ea0$export$2e2bcd8739ae039 = $298dd1ae21173ea0$var$deleteManyMethod;
|
|
325
|
+
|
|
326
|
+
const $7dd5bf9323d2d9c1$var$getDataServers = (config: any) => () => {
|
|
327
|
+
return config.dataServers;
|
|
328
|
+
};
|
|
329
|
+
var $7dd5bf9323d2d9c1$export$2e2bcd8739ae039 = $7dd5bf9323d2d9c1$var$getDataServers;
|
|
330
|
+
|
|
331
|
+
const $54a3fa40eed06111$var$getDataModels = (config: any) => () => {
|
|
332
|
+
return config.resources;
|
|
333
|
+
};
|
|
334
|
+
var $54a3fa40eed06111$export$2e2bcd8739ae039 = $54a3fa40eed06111$var$getDataModels;
|
|
335
|
+
|
|
336
|
+
const $cc8adac4b83414eb$var$arrayOf = (value: any) => {
|
|
337
|
+
// If the field is null-ish, we suppose there are no values.
|
|
338
|
+
if (!value) return [];
|
|
339
|
+
// Return as is.
|
|
340
|
+
if (Array.isArray(value)) return value;
|
|
341
|
+
// Single value is made an array.
|
|
342
|
+
return [value];
|
|
343
|
+
};
|
|
344
|
+
var $cc8adac4b83414eb$export$2e2bcd8739ae039 = $cc8adac4b83414eb$var$arrayOf;
|
|
345
|
+
|
|
346
|
+
const $aba124ea15ea8bc6$var$isValidLDPContainer = (container: any) => {
|
|
347
|
+
const resourceType = container.type || container['@type'];
|
|
348
|
+
return Array.isArray(resourceType) ? resourceType.includes('ldp:Container') : resourceType === 'ldp:Container';
|
|
349
|
+
};
|
|
350
|
+
const $aba124ea15ea8bc6$var$isObject = (val: any) => {
|
|
351
|
+
return val != null && typeof val === 'object' && !Array.isArray(val);
|
|
352
|
+
};
|
|
353
|
+
// @ts-expect-error TS(7031): Binding element 'httpClient' implicitly has an 'an... Remove this comment to see the full error message
|
|
354
|
+
const $aba124ea15ea8bc6$var$fetchContainers = async (
|
|
355
|
+
containers: any,
|
|
356
|
+
params: any,
|
|
357
|
+
{ httpClient: httpClient, jsonContext: jsonContext }
|
|
358
|
+
) => {
|
|
359
|
+
// @ts-expect-error TS(7031): Binding element 'json' implicitly has an 'any' typ... Remove this comment to see the full error message
|
|
360
|
+
const fetchPromises = containers.map((container: any) =>
|
|
361
|
+
httpClient(container.uri)
|
|
362
|
+
.then(async ({ json: json }) => {
|
|
363
|
+
const jsonResponse = json;
|
|
364
|
+
// If container's context is different, compact it to have an uniform result
|
|
365
|
+
// TODO deep compare if the context is an object
|
|
366
|
+
// This is most likely an array of two strings
|
|
367
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
368
|
+
if (jsonResponse['@context'] !== jsonContext) return (0, $fj9kP$jsonld).compact(jsonResponse, jsonContext);
|
|
369
|
+
return jsonResponse;
|
|
370
|
+
})
|
|
371
|
+
.then((json: any) => {
|
|
372
|
+
if (!$aba124ea15ea8bc6$var$isValidLDPContainer(json))
|
|
373
|
+
throw new Error(`${container.uri} is not a LDP container`);
|
|
374
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
375
|
+
return (0, $cc8adac4b83414eb$export$2e2bcd8739ae039)(json['ldp:contains']).map(resource => ({
|
|
376
|
+
'@context': json['@context'],
|
|
377
|
+
...resource
|
|
378
|
+
}));
|
|
379
|
+
})
|
|
380
|
+
);
|
|
381
|
+
// Fetch simultaneously all containers
|
|
382
|
+
const results = await Promise.all(fetchPromises);
|
|
383
|
+
let resources = results.flat();
|
|
384
|
+
resources = resources.map(resource => {
|
|
385
|
+
resource.id = resource.id || resource['@id'];
|
|
386
|
+
return resource;
|
|
387
|
+
});
|
|
388
|
+
// Apply filter to results
|
|
389
|
+
const filters = params.filter;
|
|
390
|
+
// For SPARQL queries, we use "a" to filter types, but in containers it must be "type"
|
|
391
|
+
if (filters.a) {
|
|
392
|
+
filters.type = filters.a;
|
|
393
|
+
delete filters.a;
|
|
394
|
+
}
|
|
395
|
+
// Filter resources attributes according to _predicates list
|
|
396
|
+
if (filters._predicates && Array.isArray(filters._predicates)) {
|
|
397
|
+
const predicates = filters._predicates;
|
|
398
|
+
const mandatoryAttributes = ['id'];
|
|
399
|
+
resources = resources.map(resource => {
|
|
400
|
+
return Object.keys(resource)
|
|
401
|
+
.filter(key => predicates.includes(key) || mandatoryAttributes.includes(key))
|
|
402
|
+
.reduce(
|
|
403
|
+
(filteredResource, key) => {
|
|
404
|
+
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
|
|
405
|
+
filteredResource[key] = resource[key];
|
|
406
|
+
return filteredResource;
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
'@context': []
|
|
410
|
+
}
|
|
411
|
+
);
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
if (Object.keys(filters).filter(f => !['_predicates', '_servers'].includes(f)).length > 0)
|
|
415
|
+
resources = resources.filter(resource => {
|
|
416
|
+
// Full text filtering
|
|
417
|
+
if (filters.q)
|
|
418
|
+
return Object.values(resource).some(attributeValue => {
|
|
419
|
+
if (!$aba124ea15ea8bc6$var$isObject(attributeValue)) {
|
|
420
|
+
const arrayValues = Array.isArray(attributeValue) ? attributeValue : [attributeValue];
|
|
421
|
+
return arrayValues.some(value => {
|
|
422
|
+
if (typeof value === 'string')
|
|
423
|
+
return value.toLowerCase().normalize('NFD').includes(filters.q.toLowerCase().normalize('NFD'));
|
|
424
|
+
return false;
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
return false;
|
|
428
|
+
});
|
|
429
|
+
// Attribute filtering
|
|
430
|
+
const attributesFilters = Object.keys(filters).filter(f => !['_predicates', '_servers', 'q'].includes(f));
|
|
431
|
+
return attributesFilters.every(attribute => {
|
|
432
|
+
if (resource[attribute]) {
|
|
433
|
+
const arrayValues = Array.isArray(resource[attribute]) ? resource[attribute] : [resource[attribute]];
|
|
434
|
+
return arrayValues.some((value: any) => typeof value === 'string' && value.includes(filters[attribute]));
|
|
435
|
+
}
|
|
436
|
+
return false;
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
// Sorting
|
|
440
|
+
if (params.sort)
|
|
441
|
+
resources = resources.sort((a, b) => {
|
|
442
|
+
if (params.sort.order === 'ASC') return (a[params.sort.field] ?? '').localeCompare(b[params.sort.field] ?? '');
|
|
443
|
+
return (b[params.sort.field] ?? '').localeCompare(a[params.sort.field] ?? '');
|
|
444
|
+
});
|
|
445
|
+
// Pagination
|
|
446
|
+
const total = resources.length;
|
|
447
|
+
if (params.pagination)
|
|
448
|
+
resources = resources.slice(
|
|
449
|
+
(params.pagination.page - 1) * params.pagination.perPage,
|
|
450
|
+
params.pagination.page * params.pagination.perPage
|
|
451
|
+
);
|
|
452
|
+
return {
|
|
453
|
+
data: resources,
|
|
454
|
+
total: total
|
|
455
|
+
};
|
|
456
|
+
};
|
|
457
|
+
var $aba124ea15ea8bc6$export$2e2bcd8739ae039 = $aba124ea15ea8bc6$var$fetchContainers;
|
|
458
|
+
|
|
459
|
+
const $3007d5479dd82d51$var$getEmbedFrame = (blankNodes: any) => {
|
|
460
|
+
let embedFrame = {};
|
|
461
|
+
let predicates;
|
|
462
|
+
if (blankNodes) {
|
|
463
|
+
for (const blankNode of blankNodes) {
|
|
464
|
+
if (blankNode.includes('/')) predicates = blankNode.split('/').reverse();
|
|
465
|
+
else predicates = [blankNode];
|
|
466
|
+
embedFrame = {
|
|
467
|
+
...embedFrame,
|
|
468
|
+
// @ts-expect-error TS(7006): Parameter 'accumulator' implicitly has an 'any' ty... Remove this comment to see the full error message
|
|
469
|
+
...predicates.reduce(
|
|
470
|
+
(accumulator, predicate) => ({
|
|
471
|
+
[predicate]: {
|
|
472
|
+
'@embed': '@last',
|
|
473
|
+
...accumulator
|
|
474
|
+
}
|
|
475
|
+
}),
|
|
476
|
+
{}
|
|
477
|
+
)
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
return embedFrame;
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
var $3007d5479dd82d51$export$2e2bcd8739ae039 = $3007d5479dd82d51$var$getEmbedFrame;
|
|
484
|
+
|
|
485
|
+
const $4872a1c30c1fc60e$var$getUriFromPrefix = (item: any, ontologies: any) => {
|
|
486
|
+
if (item.startsWith('http://') || item.startsWith('https://'))
|
|
487
|
+
// Already resolved, return the URI
|
|
488
|
+
return item;
|
|
489
|
+
else if (item === 'a')
|
|
490
|
+
// Special case
|
|
491
|
+
return 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type';
|
|
492
|
+
else {
|
|
493
|
+
const [prefix, value] = item.split(':');
|
|
494
|
+
if (value) {
|
|
495
|
+
if (ontologies[prefix]) return ontologies[prefix] + value;
|
|
496
|
+
else throw new Error(`No ontology found with prefix ${prefix}`);
|
|
497
|
+
} else throw new Error(`The value "${item}" is not correct. It must include a prefix or be a full URI.`);
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
var $4872a1c30c1fc60e$export$2e2bcd8739ae039 = $4872a1c30c1fc60e$var$getUriFromPrefix;
|
|
501
|
+
|
|
502
|
+
const $47d734d7812e6861$var$defaultToArray = (value: any) => (!value ? [] : Array.isArray(value) ? value : [value]);
|
|
503
|
+
// We need to always include the type or React-Admin will not work properly
|
|
504
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
505
|
+
const $47d734d7812e6861$var$typeQuery = (0, $fj9kP$triple)(
|
|
506
|
+
(0, $fj9kP$variable)('s1'),
|
|
507
|
+
(0, $fj9kP$namedNode)('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
|
|
508
|
+
(0, $fj9kP$variable)('type')
|
|
509
|
+
);
|
|
510
|
+
const $47d734d7812e6861$var$buildBaseQuery = (predicates: any, ontologies: any) => {
|
|
511
|
+
let baseTriples;
|
|
512
|
+
if (predicates) {
|
|
513
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
514
|
+
baseTriples = $47d734d7812e6861$var$defaultToArray(predicates).map((predicate, i) =>
|
|
515
|
+
(0, $fj9kP$triple)(
|
|
516
|
+
(0, $fj9kP$variable)('s1'),
|
|
517
|
+
(0, $fj9kP$namedNode)((0, $4872a1c30c1fc60e$export$2e2bcd8739ae039)(predicate, ontologies)),
|
|
518
|
+
(0, $fj9kP$variable)(`o${i + 1}`)
|
|
519
|
+
)
|
|
520
|
+
);
|
|
521
|
+
return {
|
|
522
|
+
construct: [$47d734d7812e6861$var$typeQuery, ...baseTriples],
|
|
523
|
+
where: [
|
|
524
|
+
$47d734d7812e6861$var$typeQuery,
|
|
525
|
+
...baseTriples.map(triple => ({
|
|
526
|
+
type: 'optional',
|
|
527
|
+
patterns: [triple]
|
|
528
|
+
}))
|
|
529
|
+
]
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
baseTriples = [
|
|
533
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
534
|
+
(0, $fj9kP$triple)((0, $fj9kP$variable)('s1'), (0, $fj9kP$variable)('p1'), (0, $fj9kP$variable)('o1'))
|
|
535
|
+
];
|
|
536
|
+
return {
|
|
537
|
+
construct: baseTriples,
|
|
538
|
+
where: baseTriples
|
|
539
|
+
};
|
|
540
|
+
};
|
|
541
|
+
var $47d734d7812e6861$export$2e2bcd8739ae039 = $47d734d7812e6861$var$buildBaseQuery;
|
|
542
|
+
|
|
543
|
+
// Transform ['ont:predicate1/ont:predicate2'] to ['ont:predicate1', 'ont:predicate1/ont:predicate2']
|
|
544
|
+
const $865f630cc944e818$var$extractNodes = (blankNodes: any) => {
|
|
545
|
+
const nodes = [];
|
|
546
|
+
if (blankNodes) {
|
|
547
|
+
for (const predicate of blankNodes)
|
|
548
|
+
if (predicate.includes('/')) {
|
|
549
|
+
const nodeNames = predicate.split('/');
|
|
550
|
+
for (let i = 1; i <= nodeNames.length; i++) nodes.push(nodeNames.slice(0, i).join('/'));
|
|
551
|
+
} else nodes.push(predicate);
|
|
552
|
+
}
|
|
553
|
+
return nodes;
|
|
554
|
+
};
|
|
555
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
556
|
+
const $865f630cc944e818$var$generateSparqlVarName = (node: any) => (0, $fj9kP$cryptojsmd5)(node);
|
|
557
|
+
const $865f630cc944e818$var$getParentNode = (node: any) => node.includes('/') && node.split('/')[0];
|
|
558
|
+
const $865f630cc944e818$var$getPredicate = (node: any) => (node.includes('/') ? node.split('/')[1] : node);
|
|
559
|
+
const $865f630cc944e818$var$buildUnionQuery = (queries: any) =>
|
|
560
|
+
queries.map((q: any) => {
|
|
561
|
+
let triples = q.query;
|
|
562
|
+
const firstTriple = queries.find((q2: any) => q.parentNode === q2.node);
|
|
563
|
+
if (firstTriple !== undefined) triples = triples.concat(firstTriple.query[0]);
|
|
564
|
+
return {
|
|
565
|
+
type: 'bgp',
|
|
566
|
+
triples: triples
|
|
567
|
+
};
|
|
568
|
+
});
|
|
569
|
+
const $865f630cc944e818$var$buildBlankNodesQuery = (blankNodes: any, baseQuery: any, ontologies: any) => {
|
|
570
|
+
const queries = [];
|
|
571
|
+
const nodes = $865f630cc944e818$var$extractNodes(blankNodes);
|
|
572
|
+
if (nodes && ontologies && ontologies.length > 0) {
|
|
573
|
+
for (const node of nodes) {
|
|
574
|
+
const parentNode = $865f630cc944e818$var$getParentNode(node);
|
|
575
|
+
const predicate = $865f630cc944e818$var$getPredicate(node);
|
|
576
|
+
const varName = $865f630cc944e818$var$generateSparqlVarName(node);
|
|
577
|
+
const parentVarName = parentNode ? $865f630cc944e818$var$generateSparqlVarName(parentNode) : '1';
|
|
578
|
+
const query = [
|
|
579
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
580
|
+
(0, $fj9kP$triple)(
|
|
581
|
+
(0, $fj9kP$variable)(`s${parentVarName}`),
|
|
582
|
+
(0, $fj9kP$namedNode)((0, $4872a1c30c1fc60e$export$2e2bcd8739ae039)(predicate, ontologies)),
|
|
583
|
+
(0, $fj9kP$variable)(`s${varName}`)
|
|
584
|
+
),
|
|
585
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
586
|
+
(0, $fj9kP$triple)(
|
|
587
|
+
(0, $fj9kP$variable)(`s${varName}`),
|
|
588
|
+
(0, $fj9kP$variable)(`p${varName}`),
|
|
589
|
+
(0, $fj9kP$variable)(`o${varName}`)
|
|
590
|
+
)
|
|
591
|
+
];
|
|
592
|
+
queries.push({
|
|
593
|
+
node: node,
|
|
594
|
+
parentNode: parentNode,
|
|
595
|
+
query: query,
|
|
596
|
+
filter: '' // `FILTER(isBLANK(?s${varName})) .`
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
return {
|
|
600
|
+
construct: queries.length > 0 ? queries.map(q => q.query).reduce((pre, cur) => pre.concat(cur)) : null,
|
|
601
|
+
where: {
|
|
602
|
+
type: 'union',
|
|
603
|
+
patterns: [baseQuery.where, ...$865f630cc944e818$var$buildUnionQuery(queries)]
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
return {
|
|
608
|
+
construct: '',
|
|
609
|
+
where: ''
|
|
610
|
+
};
|
|
611
|
+
};
|
|
612
|
+
// @ts-expect-error TS(2742): The inferred type of '$865f630cc944e818$export$2e2... Remove this comment to see the full error message
|
|
613
|
+
var $865f630cc944e818$export$2e2bcd8739ae039 = $865f630cc944e818$var$buildBlankNodesQuery;
|
|
614
|
+
|
|
615
|
+
const $efbe3fa6f1479c06$var$buildAutoDetectBlankNodesQuery = (depth: any, baseQuery: any) => {
|
|
616
|
+
const construct = [...baseQuery.construct];
|
|
617
|
+
let where = {};
|
|
618
|
+
if (depth > 0) {
|
|
619
|
+
const whereQueries = [];
|
|
620
|
+
whereQueries.push([baseQuery.where]);
|
|
621
|
+
for (let i = 1; i <= depth; i++) {
|
|
622
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
623
|
+
construct.push(
|
|
624
|
+
(0, $fj9kP$triple)(
|
|
625
|
+
(0, $fj9kP$variable)(`o${i}`),
|
|
626
|
+
(0, $fj9kP$variable)(`p${i + 1}`),
|
|
627
|
+
(0, $fj9kP$variable)(`o${i + 1}`)
|
|
628
|
+
)
|
|
629
|
+
);
|
|
630
|
+
whereQueries.push([
|
|
631
|
+
...whereQueries[whereQueries.length - 1],
|
|
632
|
+
{
|
|
633
|
+
type: 'filter',
|
|
634
|
+
expression: {
|
|
635
|
+
type: 'operation',
|
|
636
|
+
operator: 'isblank',
|
|
637
|
+
args: [
|
|
638
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
639
|
+
(0, $fj9kP$variable)(`o${i}`)
|
|
640
|
+
]
|
|
641
|
+
}
|
|
642
|
+
},
|
|
643
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
644
|
+
(0, $fj9kP$triple)(
|
|
645
|
+
(0, $fj9kP$variable)(`o${i}`),
|
|
646
|
+
(0, $fj9kP$variable)(`p${i + 1}`),
|
|
647
|
+
(0, $fj9kP$variable)(`o${i + 1}`)
|
|
648
|
+
)
|
|
649
|
+
]);
|
|
650
|
+
}
|
|
651
|
+
where = {
|
|
652
|
+
type: 'union',
|
|
653
|
+
patterns: whereQueries
|
|
654
|
+
};
|
|
655
|
+
} else if (depth === 0) where = baseQuery.where;
|
|
656
|
+
else throw new Error('The depth of buildAutoDetectBlankNodesQuery should be 0 or more');
|
|
657
|
+
return {
|
|
658
|
+
construct: construct,
|
|
659
|
+
where: where
|
|
660
|
+
};
|
|
661
|
+
};
|
|
662
|
+
var $efbe3fa6f1479c06$export$2e2bcd8739ae039 = $efbe3fa6f1479c06$var$buildAutoDetectBlankNodesQuery;
|
|
663
|
+
|
|
664
|
+
var $6cde9a8fbbde3ffb$require$SparqlGenerator = $fj9kP$Generator;
|
|
665
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
666
|
+
const {
|
|
667
|
+
literal: $6cde9a8fbbde3ffb$var$literal,
|
|
668
|
+
namedNode: $6cde9a8fbbde3ffb$var$namedNode,
|
|
669
|
+
triple: $6cde9a8fbbde3ffb$var$triple,
|
|
670
|
+
variable: $6cde9a8fbbde3ffb$var$variable
|
|
671
|
+
} = (0, $fj9kP$rdfjsdatamodel);
|
|
672
|
+
const $6cde9a8fbbde3ffb$var$generator = new $6cde9a8fbbde3ffb$require$SparqlGenerator({});
|
|
673
|
+
const $6cde9a8fbbde3ffb$var$reservedFilterKeys = [
|
|
674
|
+
'q',
|
|
675
|
+
'sparqlWhere',
|
|
676
|
+
'blankNodes',
|
|
677
|
+
'blankNodesDepth',
|
|
678
|
+
'_servers',
|
|
679
|
+
'_predicates'
|
|
680
|
+
];
|
|
681
|
+
// @ts-expect-error TS(7031): Binding element 'containersUris' implicitly has an... Remove this comment to see the full error message
|
|
682
|
+
const $6cde9a8fbbde3ffb$var$buildSparqlQuery = ({
|
|
683
|
+
containersUris: containersUris,
|
|
684
|
+
params: params,
|
|
685
|
+
dataModel: dataModel,
|
|
686
|
+
ontologies: ontologies
|
|
687
|
+
}) => {
|
|
688
|
+
const blankNodes = params.filter?.blankNodes || dataModel.list?.blankNodes;
|
|
689
|
+
const predicates = params.filter?._predicates || dataModel.list?.predicates;
|
|
690
|
+
const blankNodesDepth = params.filter?.blankNodesDepth ?? dataModel.list?.blankNodesDepth ?? 2;
|
|
691
|
+
const filter = {
|
|
692
|
+
...dataModel.list?.filter,
|
|
693
|
+
...params.filter
|
|
694
|
+
};
|
|
695
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
696
|
+
const baseQuery = (0, $47d734d7812e6861$export$2e2bcd8739ae039)(predicates, ontologies);
|
|
697
|
+
const sparqlJsParams = {
|
|
698
|
+
queryType: 'CONSTRUCT',
|
|
699
|
+
template: baseQuery.construct,
|
|
700
|
+
where: [],
|
|
701
|
+
type: 'query',
|
|
702
|
+
prefixes: ontologies
|
|
703
|
+
};
|
|
704
|
+
const containerWhere = [
|
|
705
|
+
{
|
|
706
|
+
type: 'values',
|
|
707
|
+
values: containersUris.map((containerUri: any) => ({
|
|
708
|
+
'?containerUri': $6cde9a8fbbde3ffb$var$namedNode(containerUri)
|
|
709
|
+
}))
|
|
710
|
+
},
|
|
711
|
+
$6cde9a8fbbde3ffb$var$triple(
|
|
712
|
+
$6cde9a8fbbde3ffb$var$variable('containerUri'),
|
|
713
|
+
$6cde9a8fbbde3ffb$var$namedNode('http://www.w3.org/ns/ldp#contains'),
|
|
714
|
+
$6cde9a8fbbde3ffb$var$variable('s1')
|
|
715
|
+
),
|
|
716
|
+
{
|
|
717
|
+
type: 'filter',
|
|
718
|
+
expression: {
|
|
719
|
+
type: 'operation',
|
|
720
|
+
operator: 'isiri',
|
|
721
|
+
args: [$6cde9a8fbbde3ffb$var$variable('s1')]
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
];
|
|
725
|
+
let resourceWhere = [];
|
|
726
|
+
if (filter && Object.keys(filter).length > 0) {
|
|
727
|
+
/*
|
|
728
|
+
Example of usage :
|
|
729
|
+
{
|
|
730
|
+
"sparqlWhere": {
|
|
731
|
+
"type": "bgp",
|
|
732
|
+
"triples": [{
|
|
733
|
+
"subject": {"termType": "Variable", "value": "s1"},
|
|
734
|
+
"predicate": {"termType": "NameNode", "value": "http://virtual-assembly.org/ontologies/pair#label"},
|
|
735
|
+
"object": {"termType": "Literal", "value": "My Organization"}
|
|
736
|
+
}]
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
*/ if (filter.sparqlWhere) {
|
|
740
|
+
// When the SPARQL request comes from the browser's URL, it is a JSON string that must be parsed
|
|
741
|
+
const sparqlWhere =
|
|
742
|
+
filter.sparqlWhere && (typeof filter.sparqlWhere === 'string' || filter.sparqlWhere instanceof String)
|
|
743
|
+
? JSON.parse(decodeURIComponent(filter.sparqlWhere))
|
|
744
|
+
: filter.sparqlWhere;
|
|
745
|
+
if (Object.keys(sparqlWhere).length > 0)
|
|
746
|
+
[].concat(sparqlWhere).forEach(sw => {
|
|
747
|
+
resourceWhere.push(sw);
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
if (filter.q && filter.q.length > 0)
|
|
751
|
+
resourceWhere.push({
|
|
752
|
+
type: 'group',
|
|
753
|
+
patterns: [
|
|
754
|
+
{
|
|
755
|
+
queryType: 'SELECT',
|
|
756
|
+
variables: [$6cde9a8fbbde3ffb$var$variable('s1')],
|
|
757
|
+
where: [
|
|
758
|
+
$6cde9a8fbbde3ffb$var$triple(
|
|
759
|
+
$6cde9a8fbbde3ffb$var$variable('s1'),
|
|
760
|
+
$6cde9a8fbbde3ffb$var$variable('p1'),
|
|
761
|
+
$6cde9a8fbbde3ffb$var$variable('o1')
|
|
762
|
+
),
|
|
763
|
+
{
|
|
764
|
+
type: 'filter',
|
|
765
|
+
expression: {
|
|
766
|
+
type: 'operation',
|
|
767
|
+
operator: 'isliteral',
|
|
768
|
+
args: [$6cde9a8fbbde3ffb$var$variable('o1')]
|
|
769
|
+
}
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
type: 'filter',
|
|
773
|
+
expression: {
|
|
774
|
+
type: 'operation',
|
|
775
|
+
operator: 'regex',
|
|
776
|
+
args: [
|
|
777
|
+
{
|
|
778
|
+
type: 'operation',
|
|
779
|
+
operator: 'lcase',
|
|
780
|
+
args: [
|
|
781
|
+
{
|
|
782
|
+
type: 'operation',
|
|
783
|
+
operator: 'str',
|
|
784
|
+
args: [$6cde9a8fbbde3ffb$var$variable('o1')]
|
|
785
|
+
}
|
|
786
|
+
]
|
|
787
|
+
},
|
|
788
|
+
// @ts-expect-error TS(2554): Expected 1-2 arguments, but got 3.
|
|
789
|
+
$6cde9a8fbbde3ffb$var$literal(
|
|
790
|
+
filter.q.toLowerCase(),
|
|
791
|
+
'',
|
|
792
|
+
$6cde9a8fbbde3ffb$var$namedNode('http://www.w3.org/2001/XMLSchema#string')
|
|
793
|
+
)
|
|
794
|
+
]
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
],
|
|
798
|
+
type: 'query'
|
|
799
|
+
}
|
|
800
|
+
]
|
|
801
|
+
});
|
|
802
|
+
// Other filters
|
|
803
|
+
// SPARQL keyword a = filter based on the class of a resource (example => 'a': 'pair:OrganizationType')
|
|
804
|
+
// Other filters are based on a value (example => 'petr:hasAudience': 'http://localhost:3000/audiences/tout-public')
|
|
805
|
+
Object.entries(filter).forEach(([predicate, object]) => {
|
|
806
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
807
|
+
if (!$6cde9a8fbbde3ffb$var$reservedFilterKeys.includes(predicate))
|
|
808
|
+
resourceWhere.unshift(
|
|
809
|
+
$6cde9a8fbbde3ffb$var$triple(
|
|
810
|
+
$6cde9a8fbbde3ffb$var$variable('s1'),
|
|
811
|
+
$6cde9a8fbbde3ffb$var$namedNode((0, $4872a1c30c1fc60e$export$2e2bcd8739ae039)(predicate, ontologies)),
|
|
812
|
+
$6cde9a8fbbde3ffb$var$namedNode((0, $4872a1c30c1fc60e$export$2e2bcd8739ae039)(object, ontologies))
|
|
813
|
+
)
|
|
814
|
+
);
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
// Blank nodes
|
|
818
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
819
|
+
const blankNodesQuery = blankNodes
|
|
820
|
+
? (0, $865f630cc944e818$export$2e2bcd8739ae039)(blankNodes, baseQuery, ontologies)
|
|
821
|
+
: (0, $efbe3fa6f1479c06$export$2e2bcd8739ae039)(blankNodesDepth, baseQuery);
|
|
822
|
+
if (blankNodesQuery && blankNodesQuery.construct) {
|
|
823
|
+
// @ts-expect-error TS(2769): No overload matches this call.
|
|
824
|
+
resourceWhere = resourceWhere.concat(blankNodesQuery.where);
|
|
825
|
+
// @ts-expect-error TS(2769): No overload matches this call.
|
|
826
|
+
sparqlJsParams.template = sparqlJsParams.template.concat(blankNodesQuery.construct);
|
|
827
|
+
} else resourceWhere.push(baseQuery.where);
|
|
828
|
+
// @ts-expect-error TS(2345): Argument of type '(Quad | { type: string; values: ... Remove this comment to see the full error message
|
|
829
|
+
sparqlJsParams.where.push(containerWhere, resourceWhere);
|
|
830
|
+
// @ts-expect-error TS(2345): Argument of type '{ queryType: string; template: Q... Remove this comment to see the full error message
|
|
831
|
+
return $6cde9a8fbbde3ffb$var$generator.stringify(sparqlJsParams);
|
|
832
|
+
};
|
|
833
|
+
var $6cde9a8fbbde3ffb$export$2e2bcd8739ae039 = $6cde9a8fbbde3ffb$var$buildSparqlQuery;
|
|
834
|
+
|
|
835
|
+
const $05a1b4063d50f1b7$var$compare = (a: any, b: any) => {
|
|
836
|
+
switch (typeof a) {
|
|
837
|
+
case 'string':
|
|
838
|
+
return a.localeCompare(b);
|
|
839
|
+
case 'number':
|
|
840
|
+
return a - b;
|
|
841
|
+
default:
|
|
842
|
+
return 0;
|
|
843
|
+
}
|
|
844
|
+
};
|
|
845
|
+
const $05a1b4063d50f1b7$var$fetchSparqlEndpoints = async (
|
|
846
|
+
containers: any,
|
|
847
|
+
resourceId: any,
|
|
848
|
+
params: any,
|
|
849
|
+
config: any
|
|
850
|
+
) => {
|
|
851
|
+
const {
|
|
852
|
+
dataServers: dataServers,
|
|
853
|
+
resources: resources,
|
|
854
|
+
httpClient: httpClient,
|
|
855
|
+
jsonContext: jsonContext,
|
|
856
|
+
ontologies: ontologies
|
|
857
|
+
} = config;
|
|
858
|
+
const dataModel = resources[resourceId];
|
|
859
|
+
const serversToQuery = containers.reduce((acc: any, cur: any) => {
|
|
860
|
+
if (!acc.includes(cur.server)) acc.push(cur.server);
|
|
861
|
+
return acc;
|
|
862
|
+
}, []);
|
|
863
|
+
const sparqlQueryPromises = serversToQuery.map(
|
|
864
|
+
(serverKey: any) =>
|
|
865
|
+
new Promise((resolve, reject) => {
|
|
866
|
+
const blankNodes = params.filter?.blankNodes || dataModel.list?.blankNodes;
|
|
867
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
868
|
+
const sparqlQuery = (0, $6cde9a8fbbde3ffb$export$2e2bcd8739ae039)({
|
|
869
|
+
containersUris: containers.filter((c: any) => c.server === serverKey).map((c: any) => c.uri),
|
|
870
|
+
params: params,
|
|
871
|
+
dataModel: dataModel,
|
|
872
|
+
ontologies: ontologies
|
|
873
|
+
});
|
|
874
|
+
httpClient(dataServers[serverKey].sparqlEndpoint, {
|
|
875
|
+
method: 'POST',
|
|
876
|
+
body: sparqlQuery
|
|
877
|
+
// @ts-expect-error TS(7031): Binding element 'json' implicitly has an 'any' typ... Remove this comment to see the full error message
|
|
878
|
+
})
|
|
879
|
+
.then(({ json: json }) => {
|
|
880
|
+
// If we declared the blank nodes to dereference, embed only those blank nodes
|
|
881
|
+
// This solve problems which can occur when same-type resources are embedded in other resources
|
|
882
|
+
// To increase performances, you can set explicitEmbedOnFraming to false (make sure the result is still OK)
|
|
883
|
+
const frame =
|
|
884
|
+
blankNodes && dataModel.list?.explicitEmbedOnFraming !== false
|
|
885
|
+
? {
|
|
886
|
+
'@context': jsonContext,
|
|
887
|
+
'@type': dataModel.types,
|
|
888
|
+
'@embed': '@never',
|
|
889
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
890
|
+
...(0, $3007d5479dd82d51$export$2e2bcd8739ae039)(blankNodes)
|
|
891
|
+
}
|
|
892
|
+
: {
|
|
893
|
+
'@context': jsonContext,
|
|
894
|
+
'@type': dataModel.types
|
|
895
|
+
};
|
|
896
|
+
// omitGraph option force results to be in a @graph, even if we have a single result
|
|
897
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
898
|
+
return (0, $fj9kP$jsonld).frame(json, frame, {
|
|
899
|
+
omitGraph: false
|
|
900
|
+
});
|
|
901
|
+
})
|
|
902
|
+
.then((compactJson: any) => {
|
|
903
|
+
if (compactJson['@id']) {
|
|
904
|
+
const { '@context': context, ...rest } = compactJson;
|
|
905
|
+
compactJson = {
|
|
906
|
+
'@context': context,
|
|
907
|
+
'@graph': [rest]
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
resolve(
|
|
911
|
+
compactJson['@graph']?.map((resource: any) => ({
|
|
912
|
+
'@context': compactJson['@context'],
|
|
913
|
+
...resource
|
|
914
|
+
})) || []
|
|
915
|
+
);
|
|
916
|
+
})
|
|
917
|
+
.catch((e: any) => reject(e));
|
|
918
|
+
})
|
|
919
|
+
);
|
|
920
|
+
// Run simultaneous SPARQL queries
|
|
921
|
+
let results = await Promise.all(sparqlQueryPromises);
|
|
922
|
+
if (results.length === 0)
|
|
923
|
+
return {
|
|
924
|
+
data: [],
|
|
925
|
+
total: 0
|
|
926
|
+
};
|
|
927
|
+
// Merge all results in one array
|
|
928
|
+
results = [].concat(...results);
|
|
929
|
+
// Add id in addition to @id, as this is what React-Admin expects
|
|
930
|
+
let returnData = results.map(item => {
|
|
931
|
+
item.id = item.id || item['@id'];
|
|
932
|
+
return item;
|
|
933
|
+
});
|
|
934
|
+
// TODO sort and paginate the results in the SPARQL query to improve performances
|
|
935
|
+
if (params.sort)
|
|
936
|
+
returnData = returnData.sort((a, b) => {
|
|
937
|
+
if (a[params.sort.field] !== undefined && b[params.sort.field] !== undefined) {
|
|
938
|
+
if (params.sort.order === 'ASC')
|
|
939
|
+
return $05a1b4063d50f1b7$var$compare(a[params.sort.field], b[params.sort.field]);
|
|
940
|
+
return $05a1b4063d50f1b7$var$compare(b[params.sort.field], a[params.sort.field]);
|
|
941
|
+
}
|
|
942
|
+
return 0;
|
|
943
|
+
});
|
|
944
|
+
if (params.pagination)
|
|
945
|
+
returnData = returnData.slice(
|
|
946
|
+
(params.pagination.page - 1) * params.pagination.perPage,
|
|
947
|
+
params.pagination.page * params.pagination.perPage
|
|
948
|
+
);
|
|
949
|
+
return {
|
|
950
|
+
data: returnData,
|
|
951
|
+
total: results.length
|
|
952
|
+
};
|
|
953
|
+
};
|
|
954
|
+
var $05a1b4063d50f1b7$export$2e2bcd8739ae039 = $05a1b4063d50f1b7$var$fetchSparqlEndpoints;
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* Return all containers matching the given shape tree
|
|
958
|
+
*/ const $3bcb3ff5a72a9185$var$findContainersWithShapeTree = (
|
|
959
|
+
shapeTreeUri: any,
|
|
960
|
+
serverKeys: any,
|
|
961
|
+
dataServers: any
|
|
962
|
+
) => {
|
|
963
|
+
const matchingContainers: any = [];
|
|
964
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
965
|
+
const parsedServerKeys = (0, $99cc2e4a2a3c100b$export$2e2bcd8739ae039)(serverKeys || '@all', dataServers);
|
|
966
|
+
Object.keys(dataServers).forEach(dataServerKey => {
|
|
967
|
+
if (parsedServerKeys.includes(dataServerKey))
|
|
968
|
+
dataServers[dataServerKey].containers?.forEach((container: any) => {
|
|
969
|
+
if (container.shapeTreeUri === shapeTreeUri) matchingContainers.push(container);
|
|
970
|
+
});
|
|
971
|
+
});
|
|
972
|
+
return matchingContainers;
|
|
973
|
+
};
|
|
974
|
+
var $3bcb3ff5a72a9185$export$2e2bcd8739ae039 = $3bcb3ff5a72a9185$var$findContainersWithShapeTree;
|
|
975
|
+
|
|
976
|
+
const $1caf729dc3ce856d$var$getListMethod = (config: any) => async (resourceId: any, params: any) => {
|
|
977
|
+
const { dataServers: dataServers, resources: resources } = config;
|
|
978
|
+
const dataModel = resources[resourceId];
|
|
979
|
+
if (!dataModel) throw new Error(`Resource ${resourceId} is not mapped in resources file`);
|
|
980
|
+
let containers = [];
|
|
981
|
+
if (!params.filter?._servers && dataModel.list?.containers) {
|
|
982
|
+
if (!Array.isArray(dataModel.list?.containers))
|
|
983
|
+
throw new Error(`The list.containers property of ${resourceId} dataModel must be of type array`);
|
|
984
|
+
// If containers are set explicitly, use them
|
|
985
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
986
|
+
containers = (0, $7c772a9c0c25a69d$export$2e2bcd8739ae039)(dataModel.list.containers, dataServers);
|
|
987
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
988
|
+
} else if (dataModel.shapeTreeUri)
|
|
989
|
+
containers = (0, $3bcb3ff5a72a9185$export$2e2bcd8739ae039)(
|
|
990
|
+
dataModel.shapeTreeUri,
|
|
991
|
+
params?.filter?._servers || dataModel.list?.servers,
|
|
992
|
+
dataServers
|
|
993
|
+
); // Otherwise find the container URIs on the given servers (either in the filter or the data model)
|
|
994
|
+
else
|
|
995
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
996
|
+
containers = (0, $15b841e67a1ba752$export$2e2bcd8739ae039)(
|
|
997
|
+
(0, $cc8adac4b83414eb$export$2e2bcd8739ae039)(dataModel.types),
|
|
998
|
+
params?.filter?._servers || dataModel.list?.servers,
|
|
999
|
+
dataServers
|
|
1000
|
+
);
|
|
1001
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1002
|
+
if (dataModel.list?.fetchContainer) return (0, $aba124ea15ea8bc6$export$2e2bcd8739ae039)(containers, params, config);
|
|
1003
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1004
|
+
else return (0, $05a1b4063d50f1b7$export$2e2bcd8739ae039)(containers, resourceId, params, config);
|
|
1005
|
+
};
|
|
1006
|
+
var $1caf729dc3ce856d$export$2e2bcd8739ae039 = $1caf729dc3ce856d$var$getListMethod;
|
|
1007
|
+
|
|
1008
|
+
const $f1e05270f9a21255$var$getManyMethod = (config: any) => async (resourceId: any, params: any) => {
|
|
1009
|
+
const { returnFailedResources: returnFailedResources } = config;
|
|
1010
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1011
|
+
let returnData = await Promise.all(
|
|
1012
|
+
params.ids.map((id: any) =>
|
|
1013
|
+
(0, $ed447224dd38ce82$export$2e2bcd8739ae039)(config)(resourceId, {
|
|
1014
|
+
id: typeof id === 'object' ? id['@id'] : id
|
|
1015
|
+
})
|
|
1016
|
+
.then(({ data: data }) => data)
|
|
1017
|
+
.catch(() => {
|
|
1018
|
+
// Catch if one resource fails to load
|
|
1019
|
+
// Otherwise no references will be show if only one is missing
|
|
1020
|
+
// See https://github.com/marmelab/react-admin/issues/5190
|
|
1021
|
+
if (returnFailedResources)
|
|
1022
|
+
return {
|
|
1023
|
+
id: id,
|
|
1024
|
+
_error: true
|
|
1025
|
+
};
|
|
1026
|
+
// Returning nothing
|
|
1027
|
+
})
|
|
1028
|
+
)
|
|
1029
|
+
);
|
|
1030
|
+
// We don't want undefined results to appear in the results as it will break with react-admin
|
|
1031
|
+
returnData = returnData.filter(e => e);
|
|
1032
|
+
return {
|
|
1033
|
+
data: returnData
|
|
1034
|
+
};
|
|
1035
|
+
};
|
|
1036
|
+
var $f1e05270f9a21255$export$2e2bcd8739ae039 = $f1e05270f9a21255$var$getManyMethod;
|
|
1037
|
+
|
|
1038
|
+
const $b5979a9678f57756$var$getManyReferenceMethod = (config: any) => async (resourceId: any, params: any) => {
|
|
1039
|
+
params.filter = {
|
|
1040
|
+
...params.filter,
|
|
1041
|
+
[params.target]: params.id
|
|
1042
|
+
};
|
|
1043
|
+
delete params.target;
|
|
1044
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1045
|
+
return await (0, $1caf729dc3ce856d$export$2e2bcd8739ae039)(config)(resourceId, params);
|
|
1046
|
+
};
|
|
1047
|
+
var $b5979a9678f57756$export$2e2bcd8739ae039 = $b5979a9678f57756$var$getManyReferenceMethod;
|
|
1048
|
+
|
|
1049
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1050
|
+
const $cdfdce6efa87baab$var$generator = new (0, $fj9kP$Generator)();
|
|
1051
|
+
const $cdfdce6efa87baab$var$patchMethod = (config: any) => async (resourceId: any, params: any) => {
|
|
1052
|
+
const { httpClient: httpClient } = config;
|
|
1053
|
+
const sparqlUpdate = {
|
|
1054
|
+
type: 'update',
|
|
1055
|
+
prefixes: {},
|
|
1056
|
+
updates: []
|
|
1057
|
+
};
|
|
1058
|
+
if (params.triplesToAdd)
|
|
1059
|
+
sparqlUpdate.updates.push({
|
|
1060
|
+
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'never'.
|
|
1061
|
+
updateType: 'insert',
|
|
1062
|
+
insert: [
|
|
1063
|
+
{
|
|
1064
|
+
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'never'.
|
|
1065
|
+
type: 'bgp',
|
|
1066
|
+
// @ts-expect-error TS(2322): Type 'any' is not assignable to type 'never'.
|
|
1067
|
+
triples: params.triplesToAdd
|
|
1068
|
+
}
|
|
1069
|
+
]
|
|
1070
|
+
});
|
|
1071
|
+
if (params.triplesToRemove)
|
|
1072
|
+
sparqlUpdate.updates.push({
|
|
1073
|
+
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'never'.
|
|
1074
|
+
updateType: 'delete',
|
|
1075
|
+
delete: [
|
|
1076
|
+
{
|
|
1077
|
+
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'never'.
|
|
1078
|
+
type: 'bgp',
|
|
1079
|
+
// @ts-expect-error TS(2322): Type 'any' is not assignable to type 'never'.
|
|
1080
|
+
triples: params.triplesToRemove
|
|
1081
|
+
}
|
|
1082
|
+
]
|
|
1083
|
+
});
|
|
1084
|
+
await httpClient(`${params.id}`, {
|
|
1085
|
+
method: 'PATCH',
|
|
1086
|
+
headers: new Headers({
|
|
1087
|
+
'Content-Type': 'application/sparql-update'
|
|
1088
|
+
}),
|
|
1089
|
+
// @ts-expect-error TS(2345): Argument of type '{ type: string; prefixes: {}; up... Remove this comment to see the full error message
|
|
1090
|
+
body: $cdfdce6efa87baab$var$generator.stringify(sparqlUpdate)
|
|
1091
|
+
});
|
|
1092
|
+
};
|
|
1093
|
+
var $cdfdce6efa87baab$export$2e2bcd8739ae039 = $cdfdce6efa87baab$var$patchMethod;
|
|
1094
|
+
|
|
1095
|
+
// Return the first server matching with the baseUrl
|
|
1096
|
+
const $47e21ee81eed09a6$var$getServerKeyFromUri = (uri: any, dataServers: any) => {
|
|
1097
|
+
if (!uri) throw Error(`No URI provided to getServerKeyFromUri`);
|
|
1098
|
+
return (
|
|
1099
|
+
dataServers &&
|
|
1100
|
+
Object.keys(dataServers).find(key => {
|
|
1101
|
+
if (dataServers[key].pod)
|
|
1102
|
+
// The baseUrl ends with /data so remove this part to match with the webId and webId-related URLs (/inbox, /outbox...)
|
|
1103
|
+
return dataServers[key].baseUrl && uri.startsWith(dataServers[key].baseUrl.replace('/data', ''));
|
|
1104
|
+
return uri.startsWith(dataServers[key].baseUrl);
|
|
1105
|
+
})
|
|
1106
|
+
);
|
|
1107
|
+
};
|
|
1108
|
+
var $47e21ee81eed09a6$export$2e2bcd8739ae039 = $47e21ee81eed09a6$var$getServerKeyFromUri;
|
|
1109
|
+
|
|
1110
|
+
const $c5031381f4dfc62d$var$updateMethod = (config: any) => async (resourceId: any, params: any) => {
|
|
1111
|
+
const { httpClient: httpClient, jsonContext: jsonContext, dataServers: dataServers } = config;
|
|
1112
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1113
|
+
const serverKey = (0, $47e21ee81eed09a6$export$2e2bcd8739ae039)(params.id, dataServers);
|
|
1114
|
+
// Upload files, if there are any
|
|
1115
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1116
|
+
const { updatedRecord: updatedRecord } = await (0, $b17c43e3301545ca$export$2e2bcd8739ae039).upload(
|
|
1117
|
+
params.data,
|
|
1118
|
+
config,
|
|
1119
|
+
serverKey
|
|
1120
|
+
);
|
|
1121
|
+
params.data = updatedRecord;
|
|
1122
|
+
await httpClient(`${params.id}`, {
|
|
1123
|
+
method: 'PUT',
|
|
1124
|
+
body: JSON.stringify({
|
|
1125
|
+
'@context': jsonContext,
|
|
1126
|
+
...params.data
|
|
1127
|
+
})
|
|
1128
|
+
});
|
|
1129
|
+
return {
|
|
1130
|
+
data: params.data
|
|
1131
|
+
};
|
|
1132
|
+
};
|
|
1133
|
+
var $c5031381f4dfc62d$export$2e2bcd8739ae039 = $c5031381f4dfc62d$var$updateMethod;
|
|
1134
|
+
|
|
1135
|
+
/*
|
|
1136
|
+
* HTTP client used by all calls in data provider and auth provider
|
|
1137
|
+
* Do proxy calls if a proxy endpoint is available and the server is different from the auth server
|
|
1138
|
+
*/ const $22b4895a4ca7d626$var$httpClient =
|
|
1139
|
+
(dataServers: any) =>
|
|
1140
|
+
(url: any, options = {}) => {
|
|
1141
|
+
if (!url) throw new Error(`No URL provided on httpClient call`);
|
|
1142
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1143
|
+
const authServerKey = (0, $8326b88c1a913ca9$export$2e2bcd8739ae039)('authServer', dataServers);
|
|
1144
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1145
|
+
const serverKey = (0, $47e21ee81eed09a6$export$2e2bcd8739ae039)(url, dataServers);
|
|
1146
|
+
const useProxy =
|
|
1147
|
+
serverKey !== authServerKey && dataServers[authServerKey]?.proxyUrl && dataServers[serverKey]?.noProxy !== true;
|
|
1148
|
+
// @ts-expect-error TS(2339): Property 'headers' does not exist on type '{}'.
|
|
1149
|
+
if (!options.headers) options.headers = new Headers();
|
|
1150
|
+
// @ts-expect-error TS(2339): Property 'method' does not exist on type '{}'.
|
|
1151
|
+
switch (options.method) {
|
|
1152
|
+
case 'POST':
|
|
1153
|
+
case 'PATCH':
|
|
1154
|
+
case 'PUT':
|
|
1155
|
+
// @ts-expect-error TS(2339): Property 'headers' does not exist on type '{}'.
|
|
1156
|
+
if (!options.headers.has('Accept')) options.headers.set('Accept', 'application/ld+json');
|
|
1157
|
+
// @ts-expect-error TS(2339): Property 'headers' does not exist on type '{}'.
|
|
1158
|
+
if (!options.headers.has('Content-Type')) options.headers.set('Content-Type', 'application/ld+json');
|
|
1159
|
+
break;
|
|
1160
|
+
case 'DELETE':
|
|
1161
|
+
break;
|
|
1162
|
+
case 'GET':
|
|
1163
|
+
default:
|
|
1164
|
+
// @ts-expect-error TS(2339): Property 'headers' does not exist on type '{}'.
|
|
1165
|
+
if (!options.headers.has('Accept')) options.headers.set('Accept', 'application/ld+json');
|
|
1166
|
+
break;
|
|
1167
|
+
}
|
|
1168
|
+
if (useProxy) {
|
|
1169
|
+
const formData = new FormData();
|
|
1170
|
+
formData.append('id', url);
|
|
1171
|
+
// @ts-expect-error TS(2339): Property 'method' does not exist on type '{}'.
|
|
1172
|
+
formData.append('method', options.method || 'GET');
|
|
1173
|
+
// @ts-expect-error TS(2339): Property 'headers' does not exist on type '{}'.
|
|
1174
|
+
formData.append('headers', JSON.stringify(Object.fromEntries(options.headers.entries())));
|
|
1175
|
+
// @ts-expect-error TS(2339): Property 'body' does not exist on type '{}'.
|
|
1176
|
+
if (options.body) {
|
|
1177
|
+
// @ts-expect-error TS(2339): Property 'body' does not exist on type '{}'.
|
|
1178
|
+
if (options.body instanceof File) formData.append('body', options.body, options.body.name);
|
|
1179
|
+
// @ts-expect-error TS(2339): Property 'body' does not exist on type '{}'.
|
|
1180
|
+
else formData.append('body', options.body);
|
|
1181
|
+
}
|
|
1182
|
+
// Post to proxy endpoint with multipart/form-data format
|
|
1183
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1184
|
+
return (0, $fj9kP$fetchUtils).fetchJson(dataServers[authServerKey].proxyUrl, {
|
|
1185
|
+
method: 'POST',
|
|
1186
|
+
headers: new Headers({
|
|
1187
|
+
Authorization: `Bearer ${localStorage.getItem('token')}`
|
|
1188
|
+
}),
|
|
1189
|
+
body: formData
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
// Add token if the server is the same as the auth server
|
|
1193
|
+
if (serverKey === authServerKey) {
|
|
1194
|
+
const token = localStorage.getItem('token');
|
|
1195
|
+
// @ts-expect-error TS(2339): Property 'headers' does not exist on type '{}'.
|
|
1196
|
+
if (token) options.headers.set('Authorization', `Bearer ${token}`);
|
|
1197
|
+
}
|
|
1198
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1199
|
+
return (0, $fj9kP$fetchUtils).fetchJson(url, options);
|
|
1200
|
+
};
|
|
1201
|
+
var $22b4895a4ca7d626$export$2e2bcd8739ae039 = $22b4895a4ca7d626$var$httpClient;
|
|
1202
|
+
|
|
1203
|
+
const $36aa010ec46eaf45$var$isURI = (value: any) =>
|
|
1204
|
+
(typeof value === 'string' || value instanceof String) && (value.startsWith('http') || value.startsWith('urn:'));
|
|
1205
|
+
const $36aa010ec46eaf45$var$expandTypes = async (types: any, context: any) => {
|
|
1206
|
+
// If types are already full URIs, return them immediately
|
|
1207
|
+
if (types.every((type: any) => $36aa010ec46eaf45$var$isURI(type))) return types;
|
|
1208
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1209
|
+
const result = await (0, $fj9kP$jsonld).expand({
|
|
1210
|
+
'@context': context,
|
|
1211
|
+
'@type': types
|
|
1212
|
+
});
|
|
1213
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1214
|
+
const expandedTypes = (0, $cc8adac4b83414eb$export$2e2bcd8739ae039)(result[0]['@type']);
|
|
1215
|
+
if (!expandedTypes.every(type => $36aa010ec46eaf45$var$isURI(type)))
|
|
1216
|
+
throw new Error(`
|
|
1217
|
+
Could not expand all types (${expandedTypes.join(', ')}).
|
|
1218
|
+
Is an ontology missing or not registered yet on the local context ?
|
|
1219
|
+
`);
|
|
1220
|
+
return expandedTypes;
|
|
1221
|
+
};
|
|
1222
|
+
var $36aa010ec46eaf45$export$2e2bcd8739ae039 = $36aa010ec46eaf45$var$expandTypes;
|
|
1223
|
+
|
|
1224
|
+
const $ab7d38fd091ff1b6$var$getTypesFromShapeTree = async (shapeTreeUri: any) => {
|
|
1225
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1226
|
+
let { json: shapeTree } = await (0, $fj9kP$fetchUtils).fetchJson(shapeTreeUri, {
|
|
1227
|
+
headers: new Headers({
|
|
1228
|
+
Accept: 'application/ld+json'
|
|
1229
|
+
})
|
|
1230
|
+
});
|
|
1231
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1232
|
+
shapeTree = await (0, $fj9kP$jsonld).compact(shapeTree, {
|
|
1233
|
+
st: 'http://www.w3.org/ns/shapetrees#',
|
|
1234
|
+
skos: 'http://www.w3.org/2004/02/skos/core#',
|
|
1235
|
+
expectsType: {
|
|
1236
|
+
'@id': 'st:expectsType',
|
|
1237
|
+
'@type': '@id'
|
|
1238
|
+
},
|
|
1239
|
+
shape: {
|
|
1240
|
+
'@id': 'st:shape',
|
|
1241
|
+
'@type': '@id'
|
|
1242
|
+
},
|
|
1243
|
+
describesInstance: {
|
|
1244
|
+
'@id': 'st:describesInstance',
|
|
1245
|
+
'@type': '@id'
|
|
1246
|
+
},
|
|
1247
|
+
label: {
|
|
1248
|
+
'@id': 'skos:prefLabel',
|
|
1249
|
+
'@container': '@language'
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
if (shapeTree.shape) {
|
|
1253
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1254
|
+
const { json: shape } = await (0, $fj9kP$fetchUtils).fetchJson(shapeTree.shape, {
|
|
1255
|
+
headers: new Headers({
|
|
1256
|
+
Accept: 'application/ld+json'
|
|
1257
|
+
})
|
|
1258
|
+
});
|
|
1259
|
+
return shape?.[0]?.['http://www.w3.org/ns/shacl#targetClass']?.map((node: any) => node?.['@id']) || [];
|
|
1260
|
+
} else return [];
|
|
1261
|
+
};
|
|
1262
|
+
var $ab7d38fd091ff1b6$export$2e2bcd8739ae039 = $ab7d38fd091ff1b6$var$getTypesFromShapeTree;
|
|
1263
|
+
|
|
1264
|
+
/**
|
|
1265
|
+
* For data server containers, expands types and adds `uri` and `server` properties.
|
|
1266
|
+
* For resources, expands types (if applicable from shape tree information).
|
|
1267
|
+
*/ const $33bf2a661b5c0cbd$var$normalizeConfig = async (config: any) => {
|
|
1268
|
+
const newConfig = {
|
|
1269
|
+
...config
|
|
1270
|
+
};
|
|
1271
|
+
// Add server and uri key to servers' containers
|
|
1272
|
+
for (const serverKey of Object.keys(newConfig.dataServers))
|
|
1273
|
+
if (newConfig.dataServers[serverKey].containers)
|
|
1274
|
+
newConfig.dataServers[serverKey].containers = await Promise.all(
|
|
1275
|
+
newConfig.dataServers[serverKey].containers?.map(async (container: any) => {
|
|
1276
|
+
return {
|
|
1277
|
+
...container,
|
|
1278
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1279
|
+
types:
|
|
1280
|
+
container.types &&
|
|
1281
|
+
(await (0, $36aa010ec46eaf45$export$2e2bcd8739ae039)(container.types, config.jsonContext)),
|
|
1282
|
+
server: serverKey,
|
|
1283
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1284
|
+
uri: (0, $fj9kP$urljoin)(config.dataServers[serverKey].baseUrl, container.path)
|
|
1285
|
+
};
|
|
1286
|
+
})
|
|
1287
|
+
);
|
|
1288
|
+
// Expand types in data models
|
|
1289
|
+
for (const resourceId of Object.keys(newConfig.resources)) {
|
|
1290
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1291
|
+
if (!newConfig.resources[resourceId].types && newConfig.resources[resourceId].shapeTreeUri)
|
|
1292
|
+
newConfig.resources[resourceId].types = await (0, $ab7d38fd091ff1b6$export$2e2bcd8739ae039)(
|
|
1293
|
+
newConfig.resources[resourceId].shapeTreeUri
|
|
1294
|
+
);
|
|
1295
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1296
|
+
newConfig.resources[resourceId].types = await (0, $36aa010ec46eaf45$export$2e2bcd8739ae039)(
|
|
1297
|
+
(0, $cc8adac4b83414eb$export$2e2bcd8739ae039)(newConfig.resources[resourceId].types),
|
|
1298
|
+
config.jsonContext
|
|
1299
|
+
);
|
|
1300
|
+
}
|
|
1301
|
+
return newConfig;
|
|
1302
|
+
};
|
|
1303
|
+
var $33bf2a661b5c0cbd$export$2e2bcd8739ae039 = $33bf2a661b5c0cbd$var$normalizeConfig;
|
|
1304
|
+
|
|
1305
|
+
const $143de1c1f21344e7$var$isURL = (value: any) =>
|
|
1306
|
+
(typeof value === 'string' || value instanceof String) && value.startsWith('http');
|
|
1307
|
+
const $143de1c1f21344e7$var$getOntologiesFromContextJson = (contextJson: any) => {
|
|
1308
|
+
const ontologies = {};
|
|
1309
|
+
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
|
|
1310
|
+
for (const [key, value] of Object.entries(contextJson))
|
|
1311
|
+
if ($143de1c1f21344e7$var$isURL(value)) ontologies[key] = value;
|
|
1312
|
+
return ontologies;
|
|
1313
|
+
};
|
|
1314
|
+
const $143de1c1f21344e7$var$getOntologiesFromContextUrl = async (contextUrl: any) => {
|
|
1315
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1316
|
+
const { json: json } = await (0, $fj9kP$fetchUtils).fetchJson(contextUrl, {
|
|
1317
|
+
headers: new Headers({
|
|
1318
|
+
Accept: 'application/ld+json'
|
|
1319
|
+
})
|
|
1320
|
+
});
|
|
1321
|
+
return $143de1c1f21344e7$var$getOntologiesFromContextJson(json['@context']);
|
|
1322
|
+
};
|
|
1323
|
+
const $143de1c1f21344e7$var$getOntologiesFromContext = async (context: any) => {
|
|
1324
|
+
let ontologies = {};
|
|
1325
|
+
if (Array.isArray(context))
|
|
1326
|
+
for (const contextUrl of context)
|
|
1327
|
+
ontologies = {
|
|
1328
|
+
...ontologies,
|
|
1329
|
+
...(await $143de1c1f21344e7$var$getOntologiesFromContextUrl(contextUrl))
|
|
1330
|
+
};
|
|
1331
|
+
else if (typeof context === 'string') ontologies = await $143de1c1f21344e7$var$getOntologiesFromContextUrl(context);
|
|
1332
|
+
else ontologies = $143de1c1f21344e7$var$getOntologiesFromContextJson(context);
|
|
1333
|
+
return ontologies;
|
|
1334
|
+
};
|
|
1335
|
+
var $143de1c1f21344e7$export$2e2bcd8739ae039 = $143de1c1f21344e7$var$getOntologiesFromContext;
|
|
1336
|
+
|
|
1337
|
+
/** @type {(originalConfig: Configuration) => SemanticDataProvider} */ const $243bf28fbb1b868f$var$dataProvider = (
|
|
1338
|
+
originalConfig: any
|
|
1339
|
+
) => {
|
|
1340
|
+
// Keep in memory for refresh
|
|
1341
|
+
let config = {
|
|
1342
|
+
...originalConfig
|
|
1343
|
+
};
|
|
1344
|
+
const prepareConfig = async () => {
|
|
1345
|
+
config.dataServers ??= {};
|
|
1346
|
+
// Configure httpClient with initial data servers, so that plugins may use it
|
|
1347
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1348
|
+
config.httpClient = (0, $22b4895a4ca7d626$export$2e2bcd8739ae039)(config.dataServers);
|
|
1349
|
+
for (const plugin of config.plugins) if (plugin.transformConfig) config = await plugin.transformConfig(config);
|
|
1350
|
+
// Configure again httpClient with possibly updated data servers
|
|
1351
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1352
|
+
config.httpClient = (0, $22b4895a4ca7d626$export$2e2bcd8739ae039)(config.dataServers);
|
|
1353
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1354
|
+
const dataset = (0, $fj9kP$createConnectedLdoDataset)([
|
|
1355
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1356
|
+
(0, $fj9kP$solidConnectedPlugin)
|
|
1357
|
+
]);
|
|
1358
|
+
dataset.setContext('solid', {
|
|
1359
|
+
// @ts-expect-error TS(2552): Cannot find name 'fetchFn'. Did you mean 'fetch'?
|
|
1360
|
+
fetch: fetchFn
|
|
1361
|
+
});
|
|
1362
|
+
// Attach httpClient to global document -- useful for debugging.
|
|
1363
|
+
// @ts-expect-error TS(2339): Property 'httpClient' does not exist on type 'Docu... Remove this comment to see the full error message
|
|
1364
|
+
document.httpClient = config.httpClient;
|
|
1365
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1366
|
+
if (!config.ontologies && config.jsonContext)
|
|
1367
|
+
config.ontologies = await (0, $143de1c1f21344e7$export$2e2bcd8739ae039)(config.jsonContext);
|
|
1368
|
+
else if (!config.jsonContext && config.ontologies) config.jsonContext = config.ontologies;
|
|
1369
|
+
else if (!config.jsonContext && !config.ontologies)
|
|
1370
|
+
throw new Error(`Either the JSON context or the ontologies must be set`);
|
|
1371
|
+
if (!config.returnFailedResources) config.returnFailedResources = false;
|
|
1372
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1373
|
+
config = await (0, $33bf2a661b5c0cbd$export$2e2bcd8739ae039)(config);
|
|
1374
|
+
console.log('Config after plugins', config);
|
|
1375
|
+
};
|
|
1376
|
+
// Immediately call the preload plugins
|
|
1377
|
+
const prepareConfigPromise = prepareConfig();
|
|
1378
|
+
const waitForPrepareConfig =
|
|
1379
|
+
(method: any) =>
|
|
1380
|
+
async (...arg: any[]) => {
|
|
1381
|
+
await prepareConfigPromise; // Return immediately if plugins have already been loaded
|
|
1382
|
+
return method(config)(...arg);
|
|
1383
|
+
};
|
|
1384
|
+
return {
|
|
1385
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1386
|
+
getList: waitForPrepareConfig((0, $1caf729dc3ce856d$export$2e2bcd8739ae039)),
|
|
1387
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1388
|
+
getMany: waitForPrepareConfig((0, $f1e05270f9a21255$export$2e2bcd8739ae039)),
|
|
1389
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1390
|
+
getManyReference: waitForPrepareConfig((0, $b5979a9678f57756$export$2e2bcd8739ae039)),
|
|
1391
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1392
|
+
getOne: waitForPrepareConfig((0, $ed447224dd38ce82$export$2e2bcd8739ae039)),
|
|
1393
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1394
|
+
create: waitForPrepareConfig((0, $5a7a2f7583392866$export$2e2bcd8739ae039)),
|
|
1395
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1396
|
+
update: waitForPrepareConfig((0, $c5031381f4dfc62d$export$2e2bcd8739ae039)),
|
|
1397
|
+
updateMany: () => {
|
|
1398
|
+
throw new Error('updateMany is not implemented yet');
|
|
1399
|
+
},
|
|
1400
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1401
|
+
delete: waitForPrepareConfig((0, $9510970b8e7eb9e2$export$2e2bcd8739ae039)),
|
|
1402
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1403
|
+
deleteMany: waitForPrepareConfig((0, $298dd1ae21173ea0$export$2e2bcd8739ae039)),
|
|
1404
|
+
// Custom methods
|
|
1405
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1406
|
+
patch: waitForPrepareConfig((0, $cdfdce6efa87baab$export$2e2bcd8739ae039)),
|
|
1407
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1408
|
+
getDataModels: waitForPrepareConfig((0, $54a3fa40eed06111$export$2e2bcd8739ae039)),
|
|
1409
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1410
|
+
getDataServers: waitForPrepareConfig((0, $7dd5bf9323d2d9c1$export$2e2bcd8739ae039)),
|
|
1411
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1412
|
+
getLocalDataServers: (0, $7dd5bf9323d2d9c1$export$2e2bcd8739ae039)(originalConfig),
|
|
1413
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1414
|
+
fetch: waitForPrepareConfig((c: any) => (0, $22b4895a4ca7d626$export$2e2bcd8739ae039)(c.dataServers)),
|
|
1415
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1416
|
+
ldoDataset: (0, $fj9kP$createLdoDataset)(),
|
|
1417
|
+
// @ts-expect-error TS(2554): Expected 3 arguments, but got 2.
|
|
1418
|
+
uploadFile: waitForPrepareConfig(
|
|
1419
|
+
(c: any) => (rawFile: any) => (0, $b17c43e3301545ca$export$a5575dbeeffdad98)(rawFile, c)
|
|
1420
|
+
),
|
|
1421
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1422
|
+
expandTypes: waitForPrepareConfig(
|
|
1423
|
+
(c: any) => (types: any) => (0, $36aa010ec46eaf45$export$2e2bcd8739ae039)(types, c.jsonContext)
|
|
1424
|
+
),
|
|
1425
|
+
getConfig: waitForPrepareConfig((c: any) => () => c),
|
|
1426
|
+
refreshConfig: async () => {
|
|
1427
|
+
config = {
|
|
1428
|
+
...originalConfig
|
|
1429
|
+
};
|
|
1430
|
+
await prepareConfig();
|
|
1431
|
+
return config;
|
|
1432
|
+
}
|
|
1433
|
+
};
|
|
1434
|
+
};
|
|
1435
|
+
var $243bf28fbb1b868f$export$2e2bcd8739ae039 = $243bf28fbb1b868f$var$dataProvider;
|
|
1436
|
+
|
|
1437
|
+
const $861da9be2c0e62eb$var$getPrefixFromUri = (uri: any, ontologies: any) => {
|
|
1438
|
+
for (const [prefix, namespace] of Object.entries(ontologies)) {
|
|
1439
|
+
if (uri.startsWith(namespace)) return uri.replace(namespace, `${prefix}:`);
|
|
1440
|
+
}
|
|
1441
|
+
return uri;
|
|
1442
|
+
};
|
|
1443
|
+
var $861da9be2c0e62eb$export$2e2bcd8739ae039 = $861da9be2c0e62eb$var$getPrefixFromUri;
|
|
1444
|
+
|
|
1445
|
+
/**
|
|
1446
|
+
* Adds `dataServers.user` properties to configuration (baseUrl, sparqlEndpoint, proxyUrl, ...).
|
|
1447
|
+
*/ const $cdd3c71a628eeefe$var$configureUserStorage = () => ({
|
|
1448
|
+
transformConfig: async (config: any) => {
|
|
1449
|
+
const token = localStorage.getItem('token');
|
|
1450
|
+
// If the user is logged in
|
|
1451
|
+
if (token) {
|
|
1452
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1453
|
+
const payload = (0, $fj9kP$jwtdecode)(token);
|
|
1454
|
+
// @ts-expect-error TS(2571): Object is of type 'unknown'.
|
|
1455
|
+
const webId = payload.webId || payload.webid; // Currently we must deal with both formats
|
|
1456
|
+
const { json: user } = await config.httpClient(webId);
|
|
1457
|
+
if (user) {
|
|
1458
|
+
const newConfig = {
|
|
1459
|
+
...config
|
|
1460
|
+
};
|
|
1461
|
+
newConfig.dataServers.user = {
|
|
1462
|
+
pod: true,
|
|
1463
|
+
default: true,
|
|
1464
|
+
authServer: true,
|
|
1465
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1466
|
+
baseUrl: user['pim:storage'] || (0, $fj9kP$urljoin)(webId, 'data'),
|
|
1467
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1468
|
+
sparqlEndpoint: user.endpoints?.['void:sparqlEndpoint'] || (0, $fj9kP$urljoin)(webId, 'sparql'),
|
|
1469
|
+
proxyUrl: user.endpoints?.proxyUrl,
|
|
1470
|
+
containers: []
|
|
1471
|
+
};
|
|
1472
|
+
if (!newConfig.jsonContext)
|
|
1473
|
+
newConfig.jsonContext = [
|
|
1474
|
+
'https://www.w3.org/ns/activitystreams',
|
|
1475
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1476
|
+
(0, $fj9kP$urljoin)(new URL(webId).origin, '/.well-known/context.jsonld')
|
|
1477
|
+
];
|
|
1478
|
+
return newConfig;
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
// Nothing to change
|
|
1482
|
+
return config;
|
|
1483
|
+
}
|
|
1484
|
+
});
|
|
1485
|
+
var $cdd3c71a628eeefe$export$2e2bcd8739ae039 = $cdd3c71a628eeefe$var$configureUserStorage;
|
|
1486
|
+
|
|
1487
|
+
const $d7a7484a035f15cd$var$getContainerFromDataRegistration = async (dataRegistrationUri: any, config: any) => {
|
|
1488
|
+
const { json: dataRegistration } = await config.httpClient(dataRegistrationUri, {
|
|
1489
|
+
headers: new Headers({
|
|
1490
|
+
Accept: 'application/ld+json',
|
|
1491
|
+
Prefer: 'return=representation; include="http://www.w3.org/ns/ldp#PreferMinimalContainer"'
|
|
1492
|
+
})
|
|
1493
|
+
});
|
|
1494
|
+
const shapeTreeUri = dataRegistration['interop:registeredShapeTree'];
|
|
1495
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1496
|
+
let { json: shapeTree } = await (0, $fj9kP$fetchUtils).fetchJson(shapeTreeUri, {
|
|
1497
|
+
headers: new Headers({
|
|
1498
|
+
Accept: 'application/ld+json'
|
|
1499
|
+
})
|
|
1500
|
+
});
|
|
1501
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1502
|
+
shapeTree = await (0, $fj9kP$jsonld).compact(shapeTree, {
|
|
1503
|
+
st: 'http://www.w3.org/ns/shapetrees#',
|
|
1504
|
+
skos: 'http://www.w3.org/2004/02/skos/core#',
|
|
1505
|
+
expectsType: {
|
|
1506
|
+
'@id': 'st:expectsType',
|
|
1507
|
+
'@type': '@id'
|
|
1508
|
+
},
|
|
1509
|
+
shape: {
|
|
1510
|
+
'@id': 'st:shape',
|
|
1511
|
+
'@type': '@id'
|
|
1512
|
+
},
|
|
1513
|
+
describesInstance: {
|
|
1514
|
+
'@id': 'st:describesInstance',
|
|
1515
|
+
'@type': '@id'
|
|
1516
|
+
},
|
|
1517
|
+
label: {
|
|
1518
|
+
'@id': 'skos:prefLabel',
|
|
1519
|
+
'@container': '@language'
|
|
1520
|
+
}
|
|
1521
|
+
});
|
|
1522
|
+
const { baseUrl: baseUrl } = config.dataServers.user;
|
|
1523
|
+
const containerPath = dataRegistration.id.replace(baseUrl, '');
|
|
1524
|
+
const container = {
|
|
1525
|
+
path: containerPath,
|
|
1526
|
+
shapeTreeUri: shapeTreeUri,
|
|
1527
|
+
label: shapeTree.label,
|
|
1528
|
+
labelPredicate: shapeTree.describesInstance,
|
|
1529
|
+
binaryResources: shapeTree.expectsType === 'st:NonRDFResource'
|
|
1530
|
+
};
|
|
1531
|
+
if (shapeTree.shape) {
|
|
1532
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1533
|
+
const { json: shape } = await (0, $fj9kP$fetchUtils).fetchJson(shapeTree.shape, {
|
|
1534
|
+
headers: new Headers({
|
|
1535
|
+
Accept: 'application/ld+json'
|
|
1536
|
+
})
|
|
1537
|
+
});
|
|
1538
|
+
// @ts-expect-error TS(2339): Property 'types' does not exist on type '{ path: a... Remove this comment to see the full error message
|
|
1539
|
+
container.types = shape?.[0]?.['http://www.w3.org/ns/shacl#targetClass']?.map((node: any) => node?.['@id']);
|
|
1540
|
+
}
|
|
1541
|
+
return container;
|
|
1542
|
+
};
|
|
1543
|
+
var $d7a7484a035f15cd$export$2e2bcd8739ae039 = $d7a7484a035f15cd$var$getContainerFromDataRegistration;
|
|
1544
|
+
|
|
1545
|
+
/**
|
|
1546
|
+
* Return a function that look if an app (clientId) is registered with an user (webId)
|
|
1547
|
+
* If not, it redirects to the endpoint provided by the user's authorization agent
|
|
1548
|
+
* See https://solid.github.io/data-interoperability-panel/specification/#authorization-agent
|
|
1549
|
+
*/ const $2c257b4237cb14ca$var$fetchAppRegistration = () => ({
|
|
1550
|
+
transformConfig: async (config: any) => {
|
|
1551
|
+
const token = localStorage.getItem('token');
|
|
1552
|
+
// If the user is logged in
|
|
1553
|
+
if (token) {
|
|
1554
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1555
|
+
const payload = (0, $fj9kP$jwtdecode)(token);
|
|
1556
|
+
// @ts-expect-error TS(2571): Object is of type 'unknown'.
|
|
1557
|
+
const webId = payload.webId || payload.webid; // Currently we must deal with both formats
|
|
1558
|
+
const { json: user } = await config.httpClient(webId);
|
|
1559
|
+
const authAgentUri = user['interop:hasAuthorizationAgent'];
|
|
1560
|
+
if (authAgentUri) {
|
|
1561
|
+
// Find if an application registration is linked to this user
|
|
1562
|
+
// See https://solid.github.io/data-interoperability-panel/specification/#agent-registration-discovery
|
|
1563
|
+
const { headers: headers } = await config.httpClient(authAgentUri);
|
|
1564
|
+
if (headers.has('Link')) {
|
|
1565
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1566
|
+
const linkHeader = (0, $fj9kP$httplinkheader).parse(headers.get('Link'));
|
|
1567
|
+
const registeredAgentLinkHeader = linkHeader.rel('http://www.w3.org/ns/solid/interop#registeredAgent');
|
|
1568
|
+
if (registeredAgentLinkHeader.length > 0) {
|
|
1569
|
+
const appRegistrationUri = registeredAgentLinkHeader[0].anchor;
|
|
1570
|
+
const { json: appRegistration } = await config.httpClient(appRegistrationUri);
|
|
1571
|
+
const newConfig = {
|
|
1572
|
+
...config
|
|
1573
|
+
};
|
|
1574
|
+
// Load data grants concurrently to improve performances
|
|
1575
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1576
|
+
const results = await Promise.all(
|
|
1577
|
+
(0, $cc8adac4b83414eb$export$2e2bcd8739ae039)(appRegistration['interop:hasAccessGrant']).map(
|
|
1578
|
+
async accessGrantUri => {
|
|
1579
|
+
const { json: accessGrant } = await config.httpClient(accessGrantUri);
|
|
1580
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1581
|
+
return Promise.all(
|
|
1582
|
+
(0, $cc8adac4b83414eb$export$2e2bcd8739ae039)(accessGrant['interop:hasDataGrant']).map(
|
|
1583
|
+
async dataGrantUri => {
|
|
1584
|
+
const { json: dataGrant } = await config.httpClient(dataGrantUri);
|
|
1585
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1586
|
+
return (0, $d7a7484a035f15cd$export$2e2bcd8739ae039)(
|
|
1587
|
+
dataGrant['interop:hasDataRegistration'],
|
|
1588
|
+
config
|
|
1589
|
+
);
|
|
1590
|
+
}
|
|
1591
|
+
)
|
|
1592
|
+
);
|
|
1593
|
+
}
|
|
1594
|
+
)
|
|
1595
|
+
);
|
|
1596
|
+
newConfig.dataServers.user.containers = results.flat();
|
|
1597
|
+
return newConfig;
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
return config;
|
|
1603
|
+
}
|
|
1604
|
+
});
|
|
1605
|
+
var $2c257b4237cb14ca$export$2e2bcd8739ae039 = $2c257b4237cb14ca$var$fetchAppRegistration;
|
|
1606
|
+
|
|
1607
|
+
/**
|
|
1608
|
+
* Plugin to add data registrations to the user containers, by fetching the registry set.
|
|
1609
|
+
*
|
|
1610
|
+
* Requires the `configureUserStorage` plugin.
|
|
1611
|
+
*
|
|
1612
|
+
* @returns {Configuration} The configuration with the data registrations added to `dataServers.user.containers`
|
|
1613
|
+
*/ const $91255e144bb55afc$var$fetchDataRegistry = () => ({
|
|
1614
|
+
transformConfig: async (config: any) => {
|
|
1615
|
+
const token = localStorage.getItem('token');
|
|
1616
|
+
// If the user is logged in
|
|
1617
|
+
if (token) {
|
|
1618
|
+
if (!config.dataServers.user)
|
|
1619
|
+
throw new Error(`You must configure the user storage first with the configureUserStorage plugin`);
|
|
1620
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1621
|
+
const payload = (0, $fj9kP$jwtdecode)(token);
|
|
1622
|
+
// @ts-expect-error TS(2571): Object is of type 'unknown'.
|
|
1623
|
+
const webId = payload.webId || payload.webid; // Currently we must deal with both formats
|
|
1624
|
+
const { json: user } = await config.httpClient(webId);
|
|
1625
|
+
const { json: registrySet } = await config.httpClient(user['interop:hasRegistrySet']);
|
|
1626
|
+
const { json: dataRegistry } = await config.httpClient(registrySet['interop:hasDataRegistry']);
|
|
1627
|
+
if (dataRegistry['interop:hasDataRegistration']) {
|
|
1628
|
+
const results = await Promise.all(
|
|
1629
|
+
dataRegistry['interop:hasDataRegistration'].map((dataRegistrationUri: any) => {
|
|
1630
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1631
|
+
return (0, $d7a7484a035f15cd$export$2e2bcd8739ae039)(dataRegistrationUri, config);
|
|
1632
|
+
})
|
|
1633
|
+
);
|
|
1634
|
+
const newConfig = {
|
|
1635
|
+
...config
|
|
1636
|
+
};
|
|
1637
|
+
newConfig.dataServers.user.containers?.push(...results.flat());
|
|
1638
|
+
return newConfig;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
// Nothing to change
|
|
1642
|
+
return config;
|
|
1643
|
+
}
|
|
1644
|
+
});
|
|
1645
|
+
var $91255e144bb55afc$export$2e2bcd8739ae039 = $91255e144bb55afc$var$fetchDataRegistry;
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* Plugin to add type indexes to the user containers, by fetching the them.
|
|
1649
|
+
*
|
|
1650
|
+
* Requires the `configureUserStorage` plugin.
|
|
1651
|
+
*
|
|
1652
|
+
* @returns {Configuration} The configuration with the data registrations added to `dataServers.user.containers`
|
|
1653
|
+
*/ const $2d5f75df63129ebc$var$fetchTypeIndexes = () => ({
|
|
1654
|
+
transformConfig: async (config: any) => {
|
|
1655
|
+
const token = localStorage.getItem('token');
|
|
1656
|
+
// If the user is logged in
|
|
1657
|
+
if (token) {
|
|
1658
|
+
if (!config.dataServers.user)
|
|
1659
|
+
throw new Error(`You must configure the user storage first with the configureUserStorage plugin`);
|
|
1660
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1661
|
+
const payload = (0, $fj9kP$jwtdecode)(token);
|
|
1662
|
+
// @ts-expect-error TS(2571): Object is of type 'unknown'.
|
|
1663
|
+
const webId = payload.webId || payload.webid; // Currently we must deal with both formats
|
|
1664
|
+
const { json: user } = await config.httpClient(webId);
|
|
1665
|
+
const typeRegistrations = {
|
|
1666
|
+
public: [],
|
|
1667
|
+
private: []
|
|
1668
|
+
};
|
|
1669
|
+
if (user['solid:publicTypeIndex']) {
|
|
1670
|
+
const { json: publicTypeIndex } = await config.httpClient(user['solid:publicTypeIndex']);
|
|
1671
|
+
// @ts-expect-error TS(2322): Type 'any[]' is not assignable to type 'never[]'.
|
|
1672
|
+
if (publicTypeIndex)
|
|
1673
|
+
typeRegistrations.public = (0, $cc8adac4b83414eb$export$2e2bcd8739ae039)(
|
|
1674
|
+
publicTypeIndex['solid:hasTypeRegistration']
|
|
1675
|
+
);
|
|
1676
|
+
}
|
|
1677
|
+
if (user['pim:preferencesFile']) {
|
|
1678
|
+
const { json: preferencesFile } = await config.httpClient(user['pim:preferencesFile']);
|
|
1679
|
+
if (preferencesFile?.['solid:privateTypeIndex']) {
|
|
1680
|
+
const { json: privateTypeIndex } = await config.httpClient(preferencesFile['solid:privateTypeIndex']);
|
|
1681
|
+
// @ts-expect-error TS(2322): Type 'any[]' is not assignable to type 'never[]'.
|
|
1682
|
+
typeRegistrations.private = (0, $cc8adac4b83414eb$export$2e2bcd8739ae039)(
|
|
1683
|
+
privateTypeIndex['solid:hasTypeRegistration']
|
|
1684
|
+
);
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
if (typeRegistrations.public.length > 0 || typeRegistrations.private.length > 0) {
|
|
1688
|
+
const newConfig = {
|
|
1689
|
+
...config
|
|
1690
|
+
};
|
|
1691
|
+
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
|
|
1692
|
+
for (const mode of Object.keys(typeRegistrations))
|
|
1693
|
+
for (const typeRegistration of typeRegistrations[mode]) {
|
|
1694
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1695
|
+
const types = (0, $cc8adac4b83414eb$export$2e2bcd8739ae039)(typeRegistration['solid:forClass']);
|
|
1696
|
+
const container = {
|
|
1697
|
+
label: {
|
|
1698
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1699
|
+
en: (0, $fj9kP$capitalCase)(types[0].split(':')[1], {
|
|
1700
|
+
separateNumbers: true
|
|
1701
|
+
})
|
|
1702
|
+
},
|
|
1703
|
+
path: typeRegistration['solid:instanceContainer'].replace(newConfig.dataServers.user.baseUrl, ''),
|
|
1704
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1705
|
+
types: await (0, $36aa010ec46eaf45$export$2e2bcd8739ae039)(types, user['@context']),
|
|
1706
|
+
private: mode === 'private'
|
|
1707
|
+
};
|
|
1708
|
+
const containerIndex = newConfig.dataServers.user.containers.findIndex(
|
|
1709
|
+
(c: any) => c.path === container.path
|
|
1710
|
+
);
|
|
1711
|
+
if (containerIndex !== -1)
|
|
1712
|
+
// If a container with this URI already exist, add type registration information if they are not set
|
|
1713
|
+
newConfig.dataServers.user.containers[containerIndex] = {
|
|
1714
|
+
...container,
|
|
1715
|
+
...newConfig.dataServers.user.containers[containerIndex]
|
|
1716
|
+
};
|
|
1717
|
+
else newConfig.dataServers.user.containers.push(container);
|
|
1718
|
+
}
|
|
1719
|
+
return newConfig;
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
return config;
|
|
1723
|
+
}
|
|
1724
|
+
});
|
|
1725
|
+
var $2d5f75df63129ebc$export$2e2bcd8739ae039 = $2d5f75df63129ebc$var$fetchTypeIndexes;
|
|
1726
|
+
|
|
1727
|
+
const $a87fd63d8fca0380$var$fetchVoidEndpoints = () => ({
|
|
1728
|
+
transformConfig: async (config: any) => {
|
|
1729
|
+
let results = [];
|
|
1730
|
+
try {
|
|
1731
|
+
// @ts-expect-error TS(2571): Object is of type 'unknown'.
|
|
1732
|
+
results = await Promise.all(
|
|
1733
|
+
Object.entries(config.dataServers)
|
|
1734
|
+
.filter(([_, server]) => server.pod !== true && server.void !== false)
|
|
1735
|
+
.map(async ([key, server]) =>
|
|
1736
|
+
config
|
|
1737
|
+
.httpClient(new URL('/.well-known/void', server.baseUrl).toString())
|
|
1738
|
+
.then((result: any) => ({
|
|
1739
|
+
key: key,
|
|
1740
|
+
context: result.json?.['@context'],
|
|
1741
|
+
datasets: result.json?.['@graph']
|
|
1742
|
+
}))
|
|
1743
|
+
.catch((e: any) => {
|
|
1744
|
+
if (e.status === 404 || e.status === 401 || e.status === 500)
|
|
1745
|
+
return {
|
|
1746
|
+
key: key,
|
|
1747
|
+
error: e.message
|
|
1748
|
+
};
|
|
1749
|
+
throw e;
|
|
1750
|
+
})
|
|
1751
|
+
)
|
|
1752
|
+
);
|
|
1753
|
+
} catch (e) {
|
|
1754
|
+
// Do not throw error if no endpoint found
|
|
1755
|
+
}
|
|
1756
|
+
results = results.filter(result => result.datasets);
|
|
1757
|
+
if (results.length > 0) {
|
|
1758
|
+
const newConfig = {
|
|
1759
|
+
...config
|
|
1760
|
+
};
|
|
1761
|
+
for (const result of results) {
|
|
1762
|
+
// Ignore unfetchable endpoints
|
|
1763
|
+
if (result.datasets)
|
|
1764
|
+
for (const dataset of result.datasets) {
|
|
1765
|
+
newConfig.dataServers[result.key].name ??= dataset['dc:title'];
|
|
1766
|
+
newConfig.dataServers[result.key].description ??= dataset['dc:description'];
|
|
1767
|
+
newConfig.dataServers[result.key].sparqlEndpoint ??= dataset['void:sparqlEndpoint'];
|
|
1768
|
+
newConfig.dataServers[result.key].containers ??= [];
|
|
1769
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1770
|
+
for (const partition of (0, $cc8adac4b83414eb$export$2e2bcd8739ae039)(dataset['void:classPartition']))
|
|
1771
|
+
for (const type of (0, $cc8adac4b83414eb$export$2e2bcd8739ae039)(partition['void:class'])) {
|
|
1772
|
+
const path = partition['void:uriSpace'].replace(dataset['void:uriSpace'], '/');
|
|
1773
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1774
|
+
const expandedTypes = await (0, $36aa010ec46eaf45$export$2e2bcd8739ae039)([type], result.context);
|
|
1775
|
+
const containerIndex = newConfig.dataServers[result.key].containers.findIndex(
|
|
1776
|
+
(c: any) => c.path === path
|
|
1777
|
+
);
|
|
1778
|
+
if (containerIndex !== -1) {
|
|
1779
|
+
// If a container with this path already exist, merge types
|
|
1780
|
+
const mergedTypes = [
|
|
1781
|
+
...newConfig.dataServers[result.key].containers[containerIndex].types,
|
|
1782
|
+
...expandedTypes
|
|
1783
|
+
].filter((v, i, a) => a.indexOf(v) === i);
|
|
1784
|
+
newConfig.dataServers[result.key].containers[containerIndex] = {
|
|
1785
|
+
...newConfig.dataServers[result.key].containers[containerIndex],
|
|
1786
|
+
types: mergedTypes,
|
|
1787
|
+
binaryResources: mergedTypes.includes('http://semapps.org/ns/core#File')
|
|
1788
|
+
};
|
|
1789
|
+
} else
|
|
1790
|
+
newConfig.dataServers[result.key].containers.push({
|
|
1791
|
+
path: path,
|
|
1792
|
+
types: expandedTypes,
|
|
1793
|
+
binaryResources: expandedTypes.includes('http://semapps.org/ns/core#File')
|
|
1794
|
+
});
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
return newConfig;
|
|
1799
|
+
} else return config;
|
|
1800
|
+
}
|
|
1801
|
+
});
|
|
1802
|
+
var $a87fd63d8fca0380$export$2e2bcd8739ae039 = $a87fd63d8fca0380$var$fetchVoidEndpoints;
|
|
1803
|
+
|
|
1804
|
+
const $3677b4de74c3d10d$var$useDataProviderConfig = () => {
|
|
1805
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1806
|
+
const dataProvider = (0, $fj9kP$useDataProvider)();
|
|
1807
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1808
|
+
const [config, setConfig] = (0, $fj9kP$useState)();
|
|
1809
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1810
|
+
const [isLoading, setIsLoading] = (0, $fj9kP$useState)(false);
|
|
1811
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1812
|
+
(0, $fj9kP$useEffect)(() => {
|
|
1813
|
+
if (!isLoading && !config) {
|
|
1814
|
+
setIsLoading(true);
|
|
1815
|
+
dataProvider.getConfig().then((c: any) => {
|
|
1816
|
+
setConfig(c);
|
|
1817
|
+
setIsLoading(false);
|
|
1818
|
+
});
|
|
1819
|
+
}
|
|
1820
|
+
}, [dataProvider, setConfig, config, setIsLoading, isLoading]);
|
|
1821
|
+
return config;
|
|
1822
|
+
};
|
|
1823
|
+
var $3677b4de74c3d10d$export$2e2bcd8739ae039 = $3677b4de74c3d10d$var$useDataProviderConfig;
|
|
1824
|
+
|
|
1825
|
+
const $52b38c5b114c348c$var$compactPredicate = async (predicate: any, context: any) => {
|
|
1826
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1827
|
+
const result = await (0, $fj9kP$jsonld).compact(
|
|
1828
|
+
{
|
|
1829
|
+
[predicate]: ''
|
|
1830
|
+
},
|
|
1831
|
+
context
|
|
1832
|
+
);
|
|
1833
|
+
return Object.keys(result).find(key => key !== '@context');
|
|
1834
|
+
};
|
|
1835
|
+
var $52b38c5b114c348c$export$2e2bcd8739ae039 = $52b38c5b114c348c$var$compactPredicate;
|
|
1836
|
+
|
|
1837
|
+
const $72db0904d77f0f1e$var$useCompactPredicate = (predicate: any, context: any) => {
|
|
1838
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1839
|
+
const config = (0, $3677b4de74c3d10d$export$2e2bcd8739ae039)();
|
|
1840
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1841
|
+
const [result, setResult] = (0, $fj9kP$useState)();
|
|
1842
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1843
|
+
(0, $fj9kP$useEffect)(() => {
|
|
1844
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1845
|
+
if (config && predicate)
|
|
1846
|
+
(0, $52b38c5b114c348c$export$2e2bcd8739ae039)(predicate, context || config.jsonContext).then(r => {
|
|
1847
|
+
// @ts-expect-error TS(2345): Argument of type 'string | undefined' is not assig... Remove this comment to see the full error message
|
|
1848
|
+
setResult(r);
|
|
1849
|
+
});
|
|
1850
|
+
}, [predicate, setResult, config, context]);
|
|
1851
|
+
return result;
|
|
1852
|
+
};
|
|
1853
|
+
var $72db0904d77f0f1e$export$2e2bcd8739ae039 = $72db0904d77f0f1e$var$useCompactPredicate;
|
|
1854
|
+
|
|
1855
|
+
const $3a9656756670cb78$var$useDataModels = () => {
|
|
1856
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1857
|
+
const config = (0, $3677b4de74c3d10d$export$2e2bcd8739ae039)();
|
|
1858
|
+
// @ts-expect-error TS(2339): Property 'resources' does not exist on type 'never... Remove this comment to see the full error message
|
|
1859
|
+
return config?.resources;
|
|
1860
|
+
};
|
|
1861
|
+
var $3a9656756670cb78$export$2e2bcd8739ae039 = $3a9656756670cb78$var$useDataModels;
|
|
1862
|
+
|
|
1863
|
+
const $4daf4cf698ee4eed$var$useDataServers = () => {
|
|
1864
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1865
|
+
const config = (0, $3677b4de74c3d10d$export$2e2bcd8739ae039)();
|
|
1866
|
+
// @ts-expect-error TS(2339): Property 'dataServers' does not exist on type 'nev... Remove this comment to see the full error message
|
|
1867
|
+
return config?.dataServers;
|
|
1868
|
+
};
|
|
1869
|
+
var $4daf4cf698ee4eed$export$2e2bcd8739ae039 = $4daf4cf698ee4eed$var$useDataServers;
|
|
1870
|
+
|
|
1871
|
+
const $586fa0ea9d02fa12$var$useContainers = (resourceId: any, serverKeys: any) => {
|
|
1872
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1873
|
+
const dataModels = (0, $3a9656756670cb78$export$2e2bcd8739ae039)();
|
|
1874
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1875
|
+
const dataServers = (0, $4daf4cf698ee4eed$export$2e2bcd8739ae039)();
|
|
1876
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1877
|
+
const [containers, setContainers] = (0, $fj9kP$useState)([]);
|
|
1878
|
+
// Warning: if serverKeys change, the containers list will not be updated (otherwise we have an infinite re-render loop)
|
|
1879
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1880
|
+
(0, $fj9kP$useEffect)(() => {
|
|
1881
|
+
if (dataServers && dataModels) {
|
|
1882
|
+
if (resourceId) {
|
|
1883
|
+
const dataModel = dataModels[resourceId];
|
|
1884
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1885
|
+
setContainers(
|
|
1886
|
+
(0, $15b841e67a1ba752$export$2e2bcd8739ae039)(
|
|
1887
|
+
(0, $cc8adac4b83414eb$export$2e2bcd8739ae039)(dataModel.types),
|
|
1888
|
+
serverKeys,
|
|
1889
|
+
dataServers
|
|
1890
|
+
)
|
|
1891
|
+
);
|
|
1892
|
+
} else {
|
|
1893
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1894
|
+
const parsedServerKeys = (0, $99cc2e4a2a3c100b$export$2e2bcd8739ae039)(serverKeys || '@all', dataServers);
|
|
1895
|
+
// @ts-expect-error TS(2345): Argument of type 'any[]' is not assignable to para... Remove this comment to see the full error message
|
|
1896
|
+
setContainers(parsedServerKeys.map(serverKey => dataServers[serverKey].containers).flat());
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
}, [dataModels, dataServers, setContainers, resourceId]);
|
|
1900
|
+
return containers;
|
|
1901
|
+
};
|
|
1902
|
+
var $586fa0ea9d02fa12$export$2e2bcd8739ae039 = $586fa0ea9d02fa12$var$useContainers;
|
|
1903
|
+
|
|
1904
|
+
const $9d2c669bd52faa31$var$useContainersByTypes = (types: any) => {
|
|
1905
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1906
|
+
const dataServers = (0, $4daf4cf698ee4eed$export$2e2bcd8739ae039)();
|
|
1907
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1908
|
+
const dataProvider = (0, $fj9kP$useDataProvider)();
|
|
1909
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1910
|
+
const [containers, setContainers] = (0, $fj9kP$useState)([]);
|
|
1911
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1912
|
+
(0, $fj9kP$useEffect)(() => {
|
|
1913
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1914
|
+
if (dataServers && types)
|
|
1915
|
+
dataProvider
|
|
1916
|
+
.expandTypes((0, $cc8adac4b83414eb$export$2e2bcd8739ae039)(types))
|
|
1917
|
+
.then((expandedTypes: any) => {
|
|
1918
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1919
|
+
setContainers((0, $15b841e67a1ba752$export$2e2bcd8739ae039)(expandedTypes, '@all', dataServers));
|
|
1920
|
+
})
|
|
1921
|
+
.catch(() => {
|
|
1922
|
+
// Ignore errors
|
|
1923
|
+
});
|
|
1924
|
+
}, [dataServers, dataProvider, setContainers, types]);
|
|
1925
|
+
return containers;
|
|
1926
|
+
};
|
|
1927
|
+
var $9d2c669bd52faa31$export$2e2bcd8739ae039 = $9d2c669bd52faa31$var$useContainersByTypes;
|
|
1928
|
+
|
|
1929
|
+
const $43097d0b613bd4db$var$useContainerByUri = (containerUri: any) => {
|
|
1930
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1931
|
+
const dataServers = (0, $4daf4cf698ee4eed$export$2e2bcd8739ae039)();
|
|
1932
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1933
|
+
const [container, setContainer] = (0, $fj9kP$useState)();
|
|
1934
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1935
|
+
(0, $fj9kP$useEffect)(() => {
|
|
1936
|
+
if (dataServers && containerUri)
|
|
1937
|
+
Object.keys(dataServers).forEach(serverKey => {
|
|
1938
|
+
dataServers[serverKey].containers?.forEach((c: any) => {
|
|
1939
|
+
if (c.uri === containerUri) setContainer(c);
|
|
1940
|
+
});
|
|
1941
|
+
});
|
|
1942
|
+
}, [dataServers, setContainer, containerUri]);
|
|
1943
|
+
return container;
|
|
1944
|
+
};
|
|
1945
|
+
var $43097d0b613bd4db$export$2e2bcd8739ae039 = $43097d0b613bd4db$var$useContainerByUri;
|
|
1946
|
+
|
|
1947
|
+
const $7d9911a250866af6$var$findCreateContainerWithTypes = (types: any, createServerKey: any, dataServers: any) => {
|
|
1948
|
+
if (!dataServers[createServerKey].containers)
|
|
1949
|
+
throw new Error(`Data server ${createServerKey} has no declared containers`);
|
|
1950
|
+
const matchingContainers = dataServers[createServerKey].containers.filter((container: any) =>
|
|
1951
|
+
container.types?.some((t: any) => types.includes(t))
|
|
1952
|
+
);
|
|
1953
|
+
if (matchingContainers.length === 0)
|
|
1954
|
+
throw new Error(
|
|
1955
|
+
`No container found matching with types ${JSON.stringify(types)}. You can set explicitly the create.container property of the resource.`
|
|
1956
|
+
);
|
|
1957
|
+
else if (matchingContainers.length > 1)
|
|
1958
|
+
throw new Error(
|
|
1959
|
+
`More than one container found matching with types ${JSON.stringify(types)}. You must set the create.server or create.container property for the resource.`
|
|
1960
|
+
);
|
|
1961
|
+
return matchingContainers[0].uri;
|
|
1962
|
+
};
|
|
1963
|
+
var $7d9911a250866af6$export$2e2bcd8739ae039 = $7d9911a250866af6$var$findCreateContainerWithTypes;
|
|
1964
|
+
|
|
1965
|
+
const $8dbb0c8c3814e663$var$useGetCreateContainerUri = () => {
|
|
1966
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1967
|
+
const dataModels = (0, $3a9656756670cb78$export$2e2bcd8739ae039)();
|
|
1968
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1969
|
+
const dataServers = (0, $4daf4cf698ee4eed$export$2e2bcd8739ae039)();
|
|
1970
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1971
|
+
const getCreateContainerUri = (0, $fj9kP$useCallback)(
|
|
1972
|
+
(resourceId: any) => {
|
|
1973
|
+
if (!dataModels || !dataServers || !dataModels[resourceId]) return undefined;
|
|
1974
|
+
const dataModel = dataModels[resourceId];
|
|
1975
|
+
if (dataModel.create?.container) return dataModel.create.container;
|
|
1976
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1977
|
+
else if (dataModel.create?.server)
|
|
1978
|
+
return (0, $7d9911a250866af6$export$2e2bcd8739ae039)(dataModel.types, dataModel.create.server, dataServers);
|
|
1979
|
+
else {
|
|
1980
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1981
|
+
const defaultServerKey = (0, $8326b88c1a913ca9$export$2e2bcd8739ae039)('default', dataServers);
|
|
1982
|
+
if (!defaultServerKey)
|
|
1983
|
+
throw new Error(
|
|
1984
|
+
`No default dataServer found. You can set explicitly one setting the "default" attribute to true`
|
|
1985
|
+
);
|
|
1986
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1987
|
+
return (0, $7d9911a250866af6$export$2e2bcd8739ae039)(dataModel.types, defaultServerKey, dataServers);
|
|
1988
|
+
}
|
|
1989
|
+
},
|
|
1990
|
+
[dataModels, dataServers]
|
|
1991
|
+
);
|
|
1992
|
+
return getCreateContainerUri;
|
|
1993
|
+
};
|
|
1994
|
+
var $8dbb0c8c3814e663$export$2e2bcd8739ae039 = $8dbb0c8c3814e663$var$useGetCreateContainerUri;
|
|
1995
|
+
|
|
1996
|
+
const $35f3e75c86e51f35$var$useCreateContainerUri = (resourceId: any) => {
|
|
1997
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
1998
|
+
const getCreateContainerUri = (0, $8dbb0c8c3814e663$export$2e2bcd8739ae039)();
|
|
1999
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2000
|
+
const createContainerUri = (0, $fj9kP$useMemo)(
|
|
2001
|
+
() => getCreateContainerUri(resourceId),
|
|
2002
|
+
[getCreateContainerUri, resourceId]
|
|
2003
|
+
);
|
|
2004
|
+
return createContainerUri;
|
|
2005
|
+
};
|
|
2006
|
+
var $35f3e75c86e51f35$export$2e2bcd8739ae039 = $35f3e75c86e51f35$var$useCreateContainerUri;
|
|
2007
|
+
|
|
2008
|
+
const $e5a0eacd756fd1d5$var$useDataModel = (resourceId: any) => {
|
|
2009
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2010
|
+
const config = (0, $3677b4de74c3d10d$export$2e2bcd8739ae039)();
|
|
2011
|
+
// @ts-expect-error TS(2339): Property 'resources' does not exist on type 'never... Remove this comment to see the full error message
|
|
2012
|
+
return config?.resources[resourceId];
|
|
2013
|
+
};
|
|
2014
|
+
var $e5a0eacd756fd1d5$export$2e2bcd8739ae039 = $e5a0eacd756fd1d5$var$useDataModel;
|
|
2015
|
+
|
|
2016
|
+
const $87656edf926c0f1f$var$compute = (externalLinks: any, record: any) =>
|
|
2017
|
+
typeof externalLinks === 'function' ? externalLinks(record) : externalLinks;
|
|
2018
|
+
const $87656edf926c0f1f$var$isURL = (url: any) => typeof url === 'string' && url.startsWith('http');
|
|
2019
|
+
const $87656edf926c0f1f$var$useGetExternalLink = (componentExternalLinks: any) => {
|
|
2020
|
+
// Since the externalLinks config is defined only locally, we don't need to wait for VOID endpoints fetching
|
|
2021
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2022
|
+
const dataProvider = (0, $fj9kP$useContext)((0, $fj9kP$DataProviderContext));
|
|
2023
|
+
// @ts-expect-error TS(2531): Object is possibly 'null'.
|
|
2024
|
+
const dataServers = dataProvider.getLocalDataServers();
|
|
2025
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2026
|
+
const serversExternalLinks = (0, $fj9kP$useMemo)(() => {
|
|
2027
|
+
if (dataServers)
|
|
2028
|
+
return Object.fromEntries(
|
|
2029
|
+
Object.values(dataServers).map(server => {
|
|
2030
|
+
// If externalLinks is not defined in the data server, use external links for non-default servers
|
|
2031
|
+
// @ts-expect-error TS(2571): Object is of type 'unknown'.
|
|
2032
|
+
const externalLinks = server.externalLinks !== undefined ? server.externalLinks : !server.default;
|
|
2033
|
+
return [
|
|
2034
|
+
// @ts-expect-error TS(2571): Object is of type 'unknown'.
|
|
2035
|
+
server.baseUrl,
|
|
2036
|
+
externalLinks
|
|
2037
|
+
];
|
|
2038
|
+
})
|
|
2039
|
+
);
|
|
2040
|
+
}, [dataServers]);
|
|
2041
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2042
|
+
return (0, $fj9kP$useCallback)(
|
|
2043
|
+
(record: any) => {
|
|
2044
|
+
const computedComponentExternalLinks = $87656edf926c0f1f$var$compute(componentExternalLinks, record);
|
|
2045
|
+
// If the component explicitly asks not to display as external links, use an internal link
|
|
2046
|
+
if (computedComponentExternalLinks === false) return false;
|
|
2047
|
+
if (!record?.id) return false;
|
|
2048
|
+
const serverBaseUrl = Object.keys(serversExternalLinks).find(baseUrl => record?.id.startsWith(baseUrl));
|
|
2049
|
+
// If no matching data servers could be found, assume we have an internal link
|
|
2050
|
+
if (!serverBaseUrl) return false;
|
|
2051
|
+
const computedServerExternalLinks = $87656edf926c0f1f$var$compute(serversExternalLinks[serverBaseUrl], record);
|
|
2052
|
+
// If the data server explicitly asks not to display as external links, use an internal link
|
|
2053
|
+
if (computedServerExternalLinks === false) return false;
|
|
2054
|
+
if ($87656edf926c0f1f$var$isURL(computedComponentExternalLinks)) return computedComponentExternalLinks;
|
|
2055
|
+
if ($87656edf926c0f1f$var$isURL(computedServerExternalLinks)) return computedServerExternalLinks;
|
|
2056
|
+
return record.id;
|
|
2057
|
+
},
|
|
2058
|
+
[serversExternalLinks, componentExternalLinks]
|
|
2059
|
+
);
|
|
2060
|
+
};
|
|
2061
|
+
var $87656edf926c0f1f$export$2e2bcd8739ae039 = $87656edf926c0f1f$var$useGetExternalLink;
|
|
2062
|
+
|
|
2063
|
+
const $487567a146508c4e$var$useGetPrefixFromUri = () => {
|
|
2064
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2065
|
+
const config = (0, $3677b4de74c3d10d$export$2e2bcd8739ae039)();
|
|
2066
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2067
|
+
return (0, $fj9kP$useCallback)(
|
|
2068
|
+
(uri: any) => (0, $861da9be2c0e62eb$export$2e2bcd8739ae039)(uri, config.ontologies),
|
|
2069
|
+
[
|
|
2070
|
+
// @ts-expect-error TS(2339): Property 'ontologies' does not exist on type 'neve... Remove this comment to see the full error message
|
|
2071
|
+
config?.ontologies
|
|
2072
|
+
]
|
|
2073
|
+
);
|
|
2074
|
+
};
|
|
2075
|
+
var $487567a146508c4e$export$2e2bcd8739ae039 = $487567a146508c4e$var$useGetPrefixFromUri;
|
|
2076
|
+
|
|
2077
|
+
/**
|
|
2078
|
+
* @example
|
|
2079
|
+
* <Show>
|
|
2080
|
+
* <FilterHandler
|
|
2081
|
+
* source="property" // ex pair:organizationOfMembership
|
|
2082
|
+
* filter={{
|
|
2083
|
+
* 'propertyToFilter':'value'
|
|
2084
|
+
* }} // ex {{'pair:membershipRole':'http://localhost:3000/membership-roles/role-1'}}
|
|
2085
|
+
* >
|
|
2086
|
+
* <SingleFieldList>
|
|
2087
|
+
* </SingleFieldList>
|
|
2088
|
+
* </FilterHandler>
|
|
2089
|
+
* </Show>
|
|
2090
|
+
// @ts-expect-error TS(7031): Binding element 'children' implicitly has an 'any'... Remove this comment to see the full error message
|
|
2091
|
+
*/ const $406574efa35ec6f1$var$FilterHandler = ({
|
|
2092
|
+
children: children,
|
|
2093
|
+
record: record,
|
|
2094
|
+
filter: filter,
|
|
2095
|
+
source: source,
|
|
2096
|
+
...otherProps
|
|
2097
|
+
}) => {
|
|
2098
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2099
|
+
const [filtered, setFiltered] = (0, $fj9kP$useState)();
|
|
2100
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2101
|
+
(0, $fj9kP$useEffect)(() => {
|
|
2102
|
+
if (record && source && Array.isArray(record?.[source])) {
|
|
2103
|
+
const filteredData = record?.[source].filter((r: any) => {
|
|
2104
|
+
let eq = true;
|
|
2105
|
+
for (const key in filter) {
|
|
2106
|
+
const value = r[key];
|
|
2107
|
+
if (Array.isArray(value)) {
|
|
2108
|
+
if (!value.includes(filter[key])) eq = false;
|
|
2109
|
+
} else if (value !== filter[key]) eq = false;
|
|
2110
|
+
}
|
|
2111
|
+
return eq;
|
|
2112
|
+
});
|
|
2113
|
+
const newRecord = {
|
|
2114
|
+
...record
|
|
2115
|
+
};
|
|
2116
|
+
// undefined setted if no data to obtain no render in RightLabel or equivalent
|
|
2117
|
+
newRecord[source] = filteredData.length > 0 ? filteredData : undefined;
|
|
2118
|
+
setFiltered(newRecord);
|
|
2119
|
+
}
|
|
2120
|
+
}, [record, source, filter]);
|
|
2121
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2122
|
+
return /*#__PURE__*/ (0, $fj9kP$jsx)((0, $fj9kP$Fragment), {
|
|
2123
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2124
|
+
children: (0, $fj9kP$react).Children.map(children, (child, i) => {
|
|
2125
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2126
|
+
return /*#__PURE__*/ (0, $fj9kP$react).cloneElement(child, {
|
|
2127
|
+
...otherProps,
|
|
2128
|
+
record: filtered,
|
|
2129
|
+
source: source
|
|
2130
|
+
});
|
|
2131
|
+
})
|
|
2132
|
+
});
|
|
2133
|
+
};
|
|
2134
|
+
var $406574efa35ec6f1$export$2e2bcd8739ae039 = $406574efa35ec6f1$var$FilterHandler;
|
|
2135
|
+
|
|
2136
|
+
/*
|
|
2137
|
+
* @example Label used in examples
|
|
2138
|
+
* const Label = ({label, ...otherProps})=>{
|
|
2139
|
+
* return <h2>{label}</h2>
|
|
2140
|
+
* }
|
|
2141
|
+
*
|
|
2142
|
+
* @example show header for each group with group property thanks to groupHeader
|
|
2143
|
+
* <GroupedReferenceHandler
|
|
2144
|
+
* source="property" // predicat of main record to show / ex pair:organizationOfMembership
|
|
2145
|
+
* groupReference="RAresource" // React-Admin resource reference. this is the "group by" ressource. / ex MembershipRole
|
|
2146
|
+
* groupHeader={({group,...otherProps}) => <Label {...otherProps} label={group['pair:label']}></Label> }
|
|
2147
|
+
* filterProperty="property of source filtered by groupReference"
|
|
2148
|
+
* >
|
|
2149
|
+
* <ArrayField source="property"> // same props as GroupedArrayField source
|
|
2150
|
+
* <ImageList>
|
|
2151
|
+
* </ImageList>
|
|
2152
|
+
* </ArrayField>
|
|
2153
|
+
* </GroupedReferenceHandler>
|
|
2154
|
+
*
|
|
2155
|
+
* @example call chhildren with label thanks to groupLabel
|
|
2156
|
+
* <GroupedReferenceHandler
|
|
2157
|
+
* source="property" // predicat of main record to show / ex pair:organizationOfMembership
|
|
2158
|
+
* groupReference="RAresource" // React-Admin resource reference. this is the "group by" ressource. / ex MembershipRole
|
|
2159
|
+
* groupLabel="property of RAresource display" // property of React-Admin resource to display. children call whith props "label" filled by groupLabel property of groupReference
|
|
2160
|
+
* filterProperty="property of source filtered by groupReference"
|
|
2161
|
+
* >
|
|
2162
|
+
* <Label>
|
|
2163
|
+
* <ArrayField source="property"> // same props as GroupedArrayField source
|
|
2164
|
+
* <ImageList>
|
|
2165
|
+
* </ImageList>
|
|
2166
|
+
* </ArrayField>
|
|
2167
|
+
* </GroupedReferenceHandler>
|
|
2168
|
+
*
|
|
2169
|
+
* @example conditional show of group if no data in source. Conditionale groupHeader is not possible because GroupedArrayField define group before filter ; need use chhildren.
|
|
2170
|
+
* const ConditionalSourceDefinedHandler = ({record,source,children,...otherProps})=>{
|
|
2171
|
+
* if (record?.[source] && (!Array.isArray(record[source])||record[source].length>0)){
|
|
2172
|
+
* return React.Children.map(children, (child, i) => {
|
|
2173
|
+
* return React.cloneElement(child, {...otherProps,record,source});
|
|
2174
|
+
* })
|
|
2175
|
+
* }else{
|
|
2176
|
+
* return <></>
|
|
2177
|
+
* }
|
|
2178
|
+
* }
|
|
2179
|
+
*
|
|
2180
|
+
* <GroupedReferenceHandler
|
|
2181
|
+
* source="property" // predicat of main record to show / ex pair:organizationOfMembership
|
|
2182
|
+
* groupReference="RAresource" // React-Admin resource reference. this is the "group by" ressource. / ex MembershipRole
|
|
2183
|
+
* groupLabel="property of RAresource display" // property of React-Admin resource to display. children call whith props "label" filled by groupLabel property of groupReference
|
|
2184
|
+
* filterProperty="property of source filtered by groupReference"
|
|
2185
|
+
* >
|
|
2186
|
+
* <ConditionalSourceDefinedHandler>
|
|
2187
|
+
* <Label>
|
|
2188
|
+
* <ArrayField source="property"> // same props as GroupedArrayField source
|
|
2189
|
+
* <ImageList>
|
|
2190
|
+
* </ImageList>
|
|
2191
|
+
* </ArrayField>
|
|
2192
|
+
* </ConditionalSourceDefinedHandler>
|
|
2193
|
+
* </GroupedReferenceHandler>
|
|
2194
|
+
*
|
|
2195
|
+
*
|
|
2196
|
+
// @ts-expect-error TS(7031): Binding element 'children' implicitly has an 'any'... Remove this comment to see the full error message
|
|
2197
|
+
*/ const $1d8c1cbe606a94ae$var$GroupedReferenceHandler = ({
|
|
2198
|
+
children: children,
|
|
2199
|
+
groupReference: groupReference,
|
|
2200
|
+
groupLabel: groupLabel,
|
|
2201
|
+
groupHeader: groupHeader,
|
|
2202
|
+
filterProperty: filterProperty,
|
|
2203
|
+
...otherProps
|
|
2204
|
+
}) => {
|
|
2205
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2206
|
+
const record = (0, $fj9kP$useRecordContext)();
|
|
2207
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2208
|
+
const { data: data } = (0, $fj9kP$useGetList)(groupReference);
|
|
2209
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2210
|
+
return /*#__PURE__*/ (0, $fj9kP$jsx)((0, $fj9kP$Fragment), {
|
|
2211
|
+
children: data?.map((data, index) => {
|
|
2212
|
+
const filter = {};
|
|
2213
|
+
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
|
|
2214
|
+
filter[filterProperty] = data.id;
|
|
2215
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2216
|
+
return /*#__PURE__*/ (0, $fj9kP$jsxs)((0, $fj9kP$Fragment), {
|
|
2217
|
+
children: [
|
|
2218
|
+
groupHeader &&
|
|
2219
|
+
groupHeader({
|
|
2220
|
+
...otherProps,
|
|
2221
|
+
group: data
|
|
2222
|
+
}),
|
|
2223
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2224
|
+
/*#__PURE__*/ (0, $fj9kP$jsx)((0, $406574efa35ec6f1$export$2e2bcd8739ae039), {
|
|
2225
|
+
...otherProps,
|
|
2226
|
+
record: record,
|
|
2227
|
+
filter: filter,
|
|
2228
|
+
label: data[groupLabel],
|
|
2229
|
+
children: children
|
|
2230
|
+
})
|
|
2231
|
+
]
|
|
2232
|
+
});
|
|
2233
|
+
})
|
|
2234
|
+
});
|
|
2235
|
+
};
|
|
2236
|
+
var $1d8c1cbe606a94ae$export$2e2bcd8739ae039 = $1d8c1cbe606a94ae$var$GroupedReferenceHandler;
|
|
2237
|
+
|
|
2238
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2239
|
+
const $6844bbce0ad66151$var$useReferenceInputStyles = (0, $fj9kP$muistylesmakeStyles)({
|
|
2240
|
+
form: {
|
|
2241
|
+
display: 'flex'
|
|
2242
|
+
},
|
|
2243
|
+
input: {
|
|
2244
|
+
paddingRight: '20px'
|
|
2245
|
+
}
|
|
2246
|
+
});
|
|
2247
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2248
|
+
const $6844bbce0ad66151$var$useHideInputStyles = (0, $fj9kP$muistylesmakeStyles)({
|
|
2249
|
+
root: {
|
|
2250
|
+
display: 'none'
|
|
2251
|
+
}
|
|
2252
|
+
});
|
|
2253
|
+
const $6844bbce0ad66151$var$ReificationArrayInput = (props: any) => {
|
|
2254
|
+
const { reificationClass: reificationClass, children: children, ...otherProps } = props;
|
|
2255
|
+
const flexFormClasses = $6844bbce0ad66151$var$useReferenceInputStyles();
|
|
2256
|
+
const hideInputStyles = $6844bbce0ad66151$var$useHideInputStyles();
|
|
2257
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2258
|
+
return /*#__PURE__*/ (0, $fj9kP$jsx)((0, $fj9kP$ArrayInput), {
|
|
2259
|
+
...otherProps,
|
|
2260
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2261
|
+
children: /*#__PURE__*/ (0, $fj9kP$jsxs)((0, $fj9kP$SimpleFormIterator), {
|
|
2262
|
+
classes: {
|
|
2263
|
+
form: flexFormClasses.form
|
|
2264
|
+
},
|
|
2265
|
+
children: [
|
|
2266
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2267
|
+
(0, $fj9kP$react).Children.map(props.children, (child, i) => {
|
|
2268
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2269
|
+
return /*#__PURE__*/ (0, $fj9kP$react).cloneElement(child, {
|
|
2270
|
+
className: flexFormClasses.input
|
|
2271
|
+
});
|
|
2272
|
+
}),
|
|
2273
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2274
|
+
/*#__PURE__*/ (0, $fj9kP$jsx)((0, $fj9kP$TextInput), {
|
|
2275
|
+
className: hideInputStyles.root,
|
|
2276
|
+
source: 'type',
|
|
2277
|
+
initialValue: reificationClass
|
|
2278
|
+
})
|
|
2279
|
+
]
|
|
2280
|
+
})
|
|
2281
|
+
});
|
|
2282
|
+
};
|
|
2283
|
+
var $6844bbce0ad66151$export$2e2bcd8739ae039 = $6844bbce0ad66151$var$ReificationArrayInput;
|
|
2284
|
+
|
|
2285
|
+
/**
|
|
2286
|
+
* Find the solid notification description resource for a given resource URI.
|
|
2287
|
+
*/ const $03d52e691e8dc945$var$findDescriptionResource = async (authenticatedFetch: any, resourceUri: any) => {
|
|
2288
|
+
const { headers: headers } = await authenticatedFetch(resourceUri, {
|
|
2289
|
+
method: 'HEAD'
|
|
2290
|
+
});
|
|
2291
|
+
const linkHeader = headers.get('Link');
|
|
2292
|
+
const matches = linkHeader?.match(
|
|
2293
|
+
/<([^>]+)>;\s*rel="(?:describedby|http:\/\/www\.w3\.org\/ns\/solid\/terms#storageDescription)"/
|
|
2294
|
+
);
|
|
2295
|
+
if (!matches?.[1]) return undefined;
|
|
2296
|
+
// Don't use authenticatedFetch to get this endpoint
|
|
2297
|
+
const response = await fetch(matches[1], {
|
|
2298
|
+
headers: new Headers({
|
|
2299
|
+
Accept: 'application/ld+json'
|
|
2300
|
+
})
|
|
2301
|
+
});
|
|
2302
|
+
return await response.json();
|
|
2303
|
+
};
|
|
2304
|
+
const $03d52e691e8dc945$export$3edfe18db119b920 = async (
|
|
2305
|
+
authenticatedFetch: any,
|
|
2306
|
+
resourceUri: any,
|
|
2307
|
+
options = {
|
|
2308
|
+
type: 'WebSocketChannel2023'
|
|
2309
|
+
}
|
|
2310
|
+
) => {
|
|
2311
|
+
// @ts-expect-error TS(2339): Property 'closeAfter' does not exist on type '{ ty... Remove this comment to see the full error message
|
|
2312
|
+
const { type: type, closeAfter: closeAfter, startIn: startIn, rate: rate } = options;
|
|
2313
|
+
// @ts-expect-error TS(2339): Property 'startAt' does not exist on type '{ type:... Remove this comment to see the full error message
|
|
2314
|
+
let { startAt: startAt, endAt: endAt } = options;
|
|
2315
|
+
if (startIn && !startAt) startAt = new Date(Date.now() + startIn).toISOString();
|
|
2316
|
+
if (closeAfter && !endAt) endAt = new Date(Date.now() + closeAfter).toISOString();
|
|
2317
|
+
const descriptionResource = await $03d52e691e8dc945$var$findDescriptionResource(authenticatedFetch, resourceUri);
|
|
2318
|
+
// TODO: use a json-ld parser / ldo in the future for this...
|
|
2319
|
+
// Get solid notification subscription service for the given type.
|
|
2320
|
+
const subscriptionService = (
|
|
2321
|
+
await Promise.all(
|
|
2322
|
+
// Get the subscription service resources (that describe a channel type).
|
|
2323
|
+
// @ts-expect-error TS(2695): Left side of comma operator is unused and has no s... Remove this comment to see the full error message
|
|
2324
|
+
(0, $cc8adac4b83414eb$export$2e2bcd8739ae039)(
|
|
2325
|
+
descriptionResource.subscription || descriptionResource['notify:subscription']
|
|
2326
|
+
).map(async subscriptionServiceOrUri => {
|
|
2327
|
+
// They might not be resolved...
|
|
2328
|
+
if (typeof subscriptionServiceOrUri === 'string') {
|
|
2329
|
+
// Don't use authenticatedFetch to get this endpoint
|
|
2330
|
+
const response = await fetch(subscriptionServiceOrUri, {
|
|
2331
|
+
headers: new Headers({
|
|
2332
|
+
Accept: 'application/ld+json'
|
|
2333
|
+
})
|
|
2334
|
+
});
|
|
2335
|
+
return await response.json();
|
|
2336
|
+
}
|
|
2337
|
+
return subscriptionServiceOrUri;
|
|
2338
|
+
})
|
|
2339
|
+
)
|
|
2340
|
+
).find(service => {
|
|
2341
|
+
// Find for the correct channel type (e.g. web socket).
|
|
2342
|
+
const channelType = service.channelType ?? service['notify:channelType'];
|
|
2343
|
+
return channelType === type || channelType === `notify:${type}`;
|
|
2344
|
+
});
|
|
2345
|
+
if (!subscriptionService) throw new Error(`No solid notification subscription service found for type ${type}`);
|
|
2346
|
+
// Create a new channel.
|
|
2347
|
+
const { json: channel } = await authenticatedFetch(subscriptionService.id || subscriptionService['@id'], {
|
|
2348
|
+
method: 'POST',
|
|
2349
|
+
body: JSON.stringify({
|
|
2350
|
+
'@context': 'https://www.w3.org/ns/solid/notifications-context/v1',
|
|
2351
|
+
type: 'WebSocketChannel2023',
|
|
2352
|
+
topic: resourceUri,
|
|
2353
|
+
startAt: startAt,
|
|
2354
|
+
endAt: endAt,
|
|
2355
|
+
rate: rate
|
|
2356
|
+
})
|
|
2357
|
+
});
|
|
2358
|
+
return channel;
|
|
2359
|
+
};
|
|
2360
|
+
const $03d52e691e8dc945$export$28772ab4c256e709 = async (authenticatedFetch: any, resourceUri: any, options: any) => {
|
|
2361
|
+
const channel = await $03d52e691e8dc945$export$3edfe18db119b920(authenticatedFetch, resourceUri, options);
|
|
2362
|
+
const receiveFrom = channel.receiveFrom || channel['notify:receiveFrom'];
|
|
2363
|
+
return new WebSocket(receiveFrom);
|
|
2364
|
+
};
|
|
2365
|
+
const $03d52e691e8dc945$var$registeredWebSockets = new Map();
|
|
2366
|
+
/**
|
|
2367
|
+
* @param authenticatedFetch A react admin fetch function.
|
|
2368
|
+
* @param resourceUri The resource to subscribe to
|
|
2369
|
+
* @param options Options to pass to @see createSolidNotificationChannel, if the channel does not exist yet.
|
|
2370
|
+
* @returns {WebSocket} A new or existing web socket that subscribed to the given resource.
|
|
2371
|
+
*/ const $03d52e691e8dc945$export$8d60734939c59ced = async (
|
|
2372
|
+
authenticatedFetch: any,
|
|
2373
|
+
resourceUri: any,
|
|
2374
|
+
options = {
|
|
2375
|
+
type: 'WebSocketChannel2023',
|
|
2376
|
+
closeAfter: 3600000
|
|
2377
|
+
}
|
|
2378
|
+
) => {
|
|
2379
|
+
const socket = $03d52e691e8dc945$var$registeredWebSockets.get(resourceUri);
|
|
2380
|
+
if (socket)
|
|
2381
|
+
// Will resolve or is resolved already.
|
|
2382
|
+
return socket;
|
|
2383
|
+
// Create a promise, to return immediately and set the sockets cache.
|
|
2384
|
+
// This prevents racing conditions that create multiple channels.
|
|
2385
|
+
const wsPromise = $03d52e691e8dc945$export$28772ab4c256e709(authenticatedFetch, resourceUri, {
|
|
2386
|
+
...options,
|
|
2387
|
+
type: 'WebSocketChannel2023'
|
|
2388
|
+
}).then(ws => {
|
|
2389
|
+
// Remove the promise from the cache, if it closes.
|
|
2390
|
+
ws.addEventListener('close', e => {
|
|
2391
|
+
$03d52e691e8dc945$var$registeredWebSockets.delete(resourceUri);
|
|
2392
|
+
});
|
|
2393
|
+
// Close the socket, if the endAt / closeAfter time is reached.
|
|
2394
|
+
// @ts-expect-error TS(2339): Property 'endAt' does not exist on type '{ type: s... Remove this comment to see the full error message
|
|
2395
|
+
const closeIn = options.closeAfter ?? (options.endAt && new Date(options.endAt).getTime() - Date.now());
|
|
2396
|
+
if (closeIn)
|
|
2397
|
+
setTimeout(() => {
|
|
2398
|
+
ws.close();
|
|
2399
|
+
}, closeIn);
|
|
2400
|
+
return ws;
|
|
2401
|
+
});
|
|
2402
|
+
$03d52e691e8dc945$var$registeredWebSockets.set(resourceUri, wsPromise);
|
|
2403
|
+
return wsPromise;
|
|
2404
|
+
};
|
|
2405
|
+
|
|
2406
|
+
var $11242e90250f263e$exports = {};
|
|
2407
|
+
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
|
|
2408
|
+
|
|
2409
|
+
export {
|
|
2410
|
+
$243bf28fbb1b868f$export$2e2bcd8739ae039 as dataProvider,
|
|
2411
|
+
$6cde9a8fbbde3ffb$export$2e2bcd8739ae039 as buildSparqlQuery,
|
|
2412
|
+
$865f630cc944e818$export$2e2bcd8739ae039 as buildBlankNodesQuery,
|
|
2413
|
+
$4872a1c30c1fc60e$export$2e2bcd8739ae039 as getUriFromPrefix,
|
|
2414
|
+
$861da9be2c0e62eb$export$2e2bcd8739ae039 as getPrefixFromUri,
|
|
2415
|
+
$cdd3c71a628eeefe$export$2e2bcd8739ae039 as configureUserStorage,
|
|
2416
|
+
$2c257b4237cb14ca$export$2e2bcd8739ae039 as fetchAppRegistration,
|
|
2417
|
+
$91255e144bb55afc$export$2e2bcd8739ae039 as fetchDataRegistry,
|
|
2418
|
+
$2d5f75df63129ebc$export$2e2bcd8739ae039 as fetchTypeIndexes,
|
|
2419
|
+
$a87fd63d8fca0380$export$2e2bcd8739ae039 as fetchVoidEndpoints,
|
|
2420
|
+
$72db0904d77f0f1e$export$2e2bcd8739ae039 as useCompactPredicate,
|
|
2421
|
+
$586fa0ea9d02fa12$export$2e2bcd8739ae039 as useContainers,
|
|
2422
|
+
$9d2c669bd52faa31$export$2e2bcd8739ae039 as useContainersByTypes,
|
|
2423
|
+
$43097d0b613bd4db$export$2e2bcd8739ae039 as useContainerByUri,
|
|
2424
|
+
$35f3e75c86e51f35$export$2e2bcd8739ae039 as useCreateContainerUri,
|
|
2425
|
+
$e5a0eacd756fd1d5$export$2e2bcd8739ae039 as useDataModel,
|
|
2426
|
+
$3a9656756670cb78$export$2e2bcd8739ae039 as useDataModels,
|
|
2427
|
+
$3677b4de74c3d10d$export$2e2bcd8739ae039 as useDataProviderConfig,
|
|
2428
|
+
$4daf4cf698ee4eed$export$2e2bcd8739ae039 as useDataServers,
|
|
2429
|
+
$8dbb0c8c3814e663$export$2e2bcd8739ae039 as useGetCreateContainerUri,
|
|
2430
|
+
$87656edf926c0f1f$export$2e2bcd8739ae039 as useGetExternalLink,
|
|
2431
|
+
$487567a146508c4e$export$2e2bcd8739ae039 as useGetPrefixFromUri,
|
|
2432
|
+
$406574efa35ec6f1$export$2e2bcd8739ae039 as FilterHandler,
|
|
2433
|
+
$1d8c1cbe606a94ae$export$2e2bcd8739ae039 as GroupedReferenceHandler,
|
|
2434
|
+
$6844bbce0ad66151$export$2e2bcd8739ae039 as ReificationArrayInput,
|
|
2435
|
+
$03d52e691e8dc945$export$28772ab4c256e709 as createWsChannel,
|
|
2436
|
+
$03d52e691e8dc945$export$8d60734939c59ced as getOrCreateWsChannel,
|
|
2437
|
+
$03d52e691e8dc945$export$3edfe18db119b920 as createSolidNotificationChannel
|
|
2438
|
+
};
|
|
2439
|
+
//# sourceMappingURL=index.es.js.map
|