@startinblox/core 2.0.1 → 2.0.2-beta.1
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/custom-getter-D66QA0eN.js +274 -0
- package/dist/{fr-ClQZ5-J-.js → fr-BZZDTsmw.js} +2 -2
- package/dist/{helpers-4GFJ8HI8.js → helpers-dFpcGbvl.js} +5 -5
- package/dist/helpers.js +4 -4
- package/dist/index.js +95507 -91969
- package/dist/store-BUP_Lw_8.js +9002 -0
- package/dist/store.js +14 -2
- package/package.json +3 -2
- package/dist/store-1t_BHzwg.js +0 -9904
- /package/dist/{en-D7xQ8_VL.js → en-BySYJZMr.js} +0 -0
- /package/dist/{quill.snow-BMrontFB.js → quill.snow-C_A_QkE8.js} +0 -0
- /package/dist/{slimselect-CT2Oyr_0.js → slimselect-NFLzJMfV.js} +0 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { q as mergeContexts, n as normalizeContext, o as getRawContext } from "./helpers-dFpcGbvl.js";
|
|
5
|
+
import { e as getStore, __tla as __tla_0 } from "./store-BUP_Lw_8.js";
|
|
6
|
+
let CustomGetter;
|
|
7
|
+
let __tla = Promise.all([
|
|
8
|
+
(() => {
|
|
9
|
+
try {
|
|
10
|
+
return __tla_0;
|
|
11
|
+
} catch {
|
|
12
|
+
}
|
|
13
|
+
})()
|
|
14
|
+
]).then(async () => {
|
|
15
|
+
const store = getStore();
|
|
16
|
+
CustomGetter = class {
|
|
17
|
+
constructor(resourceId, resource, clientContext, serverContext, parentId = "", serverPagination = {}, serverSearch = {}) {
|
|
18
|
+
__publicField(this, "resource");
|
|
19
|
+
__publicField(this, "resourceId");
|
|
20
|
+
__publicField(this, "clientContext");
|
|
21
|
+
__publicField(this, "serverContext");
|
|
22
|
+
__publicField(this, "parentId");
|
|
23
|
+
__publicField(this, "listTypes");
|
|
24
|
+
__publicField(this, "serverPagination");
|
|
25
|
+
__publicField(this, "serverSearch");
|
|
26
|
+
this.clientContext = clientContext;
|
|
27
|
+
this.serverContext = serverContext;
|
|
28
|
+
this.parentId = parentId;
|
|
29
|
+
this.resource = resource;
|
|
30
|
+
this.resourceId = resourceId;
|
|
31
|
+
this.serverPagination = serverPagination;
|
|
32
|
+
this.serverSearch = serverSearch;
|
|
33
|
+
this.listTypes = [
|
|
34
|
+
this.getExpandedPredicate("ldp:Container"),
|
|
35
|
+
this.getExpandedPredicate("dcat:Catalog"),
|
|
36
|
+
this.getExpandedPredicate("ldp:BasicContainer"),
|
|
37
|
+
this.getExpandedPredicate("ldp:DirectContainer"),
|
|
38
|
+
this.getExpandedPredicate("ldp:IndirectContainer"),
|
|
39
|
+
this.getExpandedPredicate("sib:federatedContainer")
|
|
40
|
+
].filter(Boolean);
|
|
41
|
+
}
|
|
42
|
+
async get(path) {
|
|
43
|
+
if (!path) return;
|
|
44
|
+
try {
|
|
45
|
+
const isUrl = new URL(path);
|
|
46
|
+
if (!isUrl.protocol.startsWith("http")) throw new Error("Not a valid HTTP url");
|
|
47
|
+
if (isUrl) {
|
|
48
|
+
let resources = await this.getList(path);
|
|
49
|
+
if (!resources || Array.isArray(resources) && resources.length === 0) return void 0;
|
|
50
|
+
if (!Array.isArray(resources)) resources = [
|
|
51
|
+
resources
|
|
52
|
+
];
|
|
53
|
+
const result = resources ? Promise.all(resources.map(async (res) => {
|
|
54
|
+
let resource = await store.get(res["@id"]);
|
|
55
|
+
if (resource) return resource;
|
|
56
|
+
resource = new CustomGetter(res["@id"], {
|
|
57
|
+
"@id": res["@id"]
|
|
58
|
+
}, this.clientContext, this.serverContext, this.parentId).getProxy();
|
|
59
|
+
await store.cacheResource(res["@id"], resource);
|
|
60
|
+
return resource;
|
|
61
|
+
})) : [];
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
} catch {
|
|
65
|
+
if (!path.split) return void 0;
|
|
66
|
+
const path1 = path.split(".");
|
|
67
|
+
const path2 = [];
|
|
68
|
+
let value;
|
|
69
|
+
if (!this.isFullResource()) {
|
|
70
|
+
await this.getResource(this.resourceId, {
|
|
71
|
+
...this.clientContext,
|
|
72
|
+
...this.serverContext
|
|
73
|
+
}, this.parentId);
|
|
74
|
+
}
|
|
75
|
+
while (true) {
|
|
76
|
+
value = await this.getList(path1[0]);
|
|
77
|
+
if (path1.length <= 1) break;
|
|
78
|
+
const lastPath1El = path1.pop();
|
|
79
|
+
if (lastPath1El) path2.unshift(lastPath1El);
|
|
80
|
+
}
|
|
81
|
+
if (path2.length === 0) {
|
|
82
|
+
if (!value || !value["@id"]) return this.getLiteralValue(value);
|
|
83
|
+
return await this.getResource(value["@id"], mergeContexts(this.clientContext, this.serverContext), this.parentId || this.resourceId);
|
|
84
|
+
}
|
|
85
|
+
if (!value || !value["@id"]) return void 0;
|
|
86
|
+
const resource = await this.getResource(value["@id"], mergeContexts(this.clientContext, this.serverContext), this.parentId || this.resourceId);
|
|
87
|
+
store.subscribeResourceTo(this.resourceId, value["@id"]);
|
|
88
|
+
return resource ? await resource[path2.join(".")] : void 0;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
static getEmptyResource(id, clientContext, parentContext) {
|
|
92
|
+
return new CustomGetter(id, {
|
|
93
|
+
"@id": id
|
|
94
|
+
}, clientContext, parentContext).getProxy();
|
|
95
|
+
}
|
|
96
|
+
getLiteralValue(value) {
|
|
97
|
+
if (typeof value !== "object" || value === null) return value;
|
|
98
|
+
if (value["@value"]) return value["@value"];
|
|
99
|
+
if (!Array.isArray(value)) return value;
|
|
100
|
+
if (value.length === 0) return null;
|
|
101
|
+
if (!Array.isArray(value[0])) return value;
|
|
102
|
+
const ln = store._getLanguage();
|
|
103
|
+
let translatedValue = value.find((v) => v["@language"] && v["@language"] === ln);
|
|
104
|
+
if (!translatedValue) translatedValue = value.find((v) => v["@language"] && v["@language"] === "en");
|
|
105
|
+
return (translatedValue == null ? void 0 : translatedValue["@value"]) ?? null;
|
|
106
|
+
}
|
|
107
|
+
async getResource(id, context, iriParent, forceFetch = false) {
|
|
108
|
+
if (id.startsWith("_:b")) return await store.get(id + iriParent);
|
|
109
|
+
return await store.getData(id, context, iriParent, void 0, forceFetch);
|
|
110
|
+
}
|
|
111
|
+
isContainer() {
|
|
112
|
+
if (this.resource["@type"]) {
|
|
113
|
+
if (Array.isArray(this.resource["@type"])) return this.listTypes.some((type) => this.resource["@type"].includes(type));
|
|
114
|
+
return this.listTypes.includes(this.resource["@type"]);
|
|
115
|
+
}
|
|
116
|
+
if (!this.resource.type) return false;
|
|
117
|
+
if (Array.isArray(this.resource.type)) return this.listTypes.some((type) => this.resource.type.includes(type));
|
|
118
|
+
return this.listTypes.includes(this.resource.type);
|
|
119
|
+
}
|
|
120
|
+
isArray() {
|
|
121
|
+
if (Array.isArray(this.resource)) return true;
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
getProperties() {
|
|
125
|
+
return Object.keys(this.resource).map((prop) => this.getCompactedPredicate(prop));
|
|
126
|
+
}
|
|
127
|
+
async getList(predicateName) {
|
|
128
|
+
let value = await this.resource[predicateName];
|
|
129
|
+
if (!value) {
|
|
130
|
+
const index = this.getExpandedPredicate(predicateName);
|
|
131
|
+
if (index) {
|
|
132
|
+
value = await this.resource[index];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (value === void 0 || value === null) {
|
|
136
|
+
return [];
|
|
137
|
+
}
|
|
138
|
+
return value;
|
|
139
|
+
}
|
|
140
|
+
async getListAndCacheIt(predicate) {
|
|
141
|
+
let children = await this.getList(predicate);
|
|
142
|
+
if (!children) return null;
|
|
143
|
+
if (!Array.isArray(children)) children = [
|
|
144
|
+
children
|
|
145
|
+
];
|
|
146
|
+
const result = children ? await Promise.all(children.map(async (res) => {
|
|
147
|
+
let resource = await store.get(res["@id"]);
|
|
148
|
+
if (resource) return resource;
|
|
149
|
+
resource = new CustomGetter(res["@id"], {
|
|
150
|
+
"@id": res["@id"]
|
|
151
|
+
}, this.clientContext, this.serverContext, this.parentId).getProxy();
|
|
152
|
+
await store.cacheResource(res["@id"], resource);
|
|
153
|
+
return resource;
|
|
154
|
+
})) : [];
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
async getDcatDataset() {
|
|
158
|
+
return await this.getListAndCacheIt("dcat:dataset");
|
|
159
|
+
}
|
|
160
|
+
async getLdpContains() {
|
|
161
|
+
return await this.getListAndCacheIt("ldp:contains");
|
|
162
|
+
}
|
|
163
|
+
merge(resource) {
|
|
164
|
+
this.resource = {
|
|
165
|
+
...this.getResourceData(),
|
|
166
|
+
...resource.getResourceData()
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
getResourceData() {
|
|
170
|
+
return this.resource;
|
|
171
|
+
}
|
|
172
|
+
async getContainerList() {
|
|
173
|
+
if (this.hasType("ldp:Container")) {
|
|
174
|
+
return await this.getLdpContains();
|
|
175
|
+
}
|
|
176
|
+
if (this.getType() === "dcat:Catalog") {
|
|
177
|
+
return await this.getDcatDataset();
|
|
178
|
+
}
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
isFullResource() {
|
|
182
|
+
const propertiesKeys = Object.keys(this.resource).filter((p) => !p.startsWith("@"));
|
|
183
|
+
if (this.resource["@id"].startsWith("_:b")) return true;
|
|
184
|
+
if (propertiesKeys.length === 1 && propertiesKeys[0] === this.getExpandedPredicate("permissions")) return false;
|
|
185
|
+
if (propertiesKeys.length > 0) return true;
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
async getPermissions() {
|
|
189
|
+
const perms = this.getExpandedPredicate("permissions");
|
|
190
|
+
if (!perms) return [];
|
|
191
|
+
let permissions = this.resource[perms];
|
|
192
|
+
if (!permissions) {
|
|
193
|
+
await this.getResource(this.resourceId, {
|
|
194
|
+
...this.clientContext,
|
|
195
|
+
...this.serverContext
|
|
196
|
+
}, this.parentId, true);
|
|
197
|
+
permissions = this.resource[perms];
|
|
198
|
+
}
|
|
199
|
+
if (!Array.isArray(permissions)) permissions = [
|
|
200
|
+
permissions
|
|
201
|
+
];
|
|
202
|
+
return permissions ? permissions : [];
|
|
203
|
+
}
|
|
204
|
+
getType() {
|
|
205
|
+
if (Array.isArray(this.resource["@type"])) {
|
|
206
|
+
return this.resource["@type"].map((type) => this.getCompactedIri(type));
|
|
207
|
+
}
|
|
208
|
+
return this.resource["@type"] ? this.getCompactedIri(this.resource["@type"]) : "";
|
|
209
|
+
}
|
|
210
|
+
hasType(type) {
|
|
211
|
+
const types = this.getType();
|
|
212
|
+
if (!types) return false;
|
|
213
|
+
if (Array.isArray(types)) {
|
|
214
|
+
return types.includes(this.getCompactedIri(type));
|
|
215
|
+
}
|
|
216
|
+
return types === this.getCompactedIri(type);
|
|
217
|
+
}
|
|
218
|
+
async clearCache() {
|
|
219
|
+
await store.clearCache(this.resourceId);
|
|
220
|
+
}
|
|
221
|
+
getExpandedPredicate(property) {
|
|
222
|
+
const context = normalizeContext(mergeContexts(this.clientContext, this.serverContext));
|
|
223
|
+
return context.expandTerm(property, true);
|
|
224
|
+
}
|
|
225
|
+
getCompactedPredicate(property) {
|
|
226
|
+
const context = normalizeContext(mergeContexts(this.clientContext, this.serverContext));
|
|
227
|
+
return context.compactIri(property, true);
|
|
228
|
+
}
|
|
229
|
+
getCompactedIri(id) {
|
|
230
|
+
const context = normalizeContext(mergeContexts(this.clientContext, this.serverContext));
|
|
231
|
+
return context.compactIri(id);
|
|
232
|
+
}
|
|
233
|
+
toString() {
|
|
234
|
+
return this.getCompactedIri(this.resource["@id"]);
|
|
235
|
+
}
|
|
236
|
+
[Symbol.toPrimitive]() {
|
|
237
|
+
return this.getCompactedIri(this.resource["@id"]);
|
|
238
|
+
}
|
|
239
|
+
getProxy() {
|
|
240
|
+
return new Proxy(this, {
|
|
241
|
+
get: (resource, property) => {
|
|
242
|
+
if (!this.resource) return void 0;
|
|
243
|
+
if (typeof resource[property] === "function") return resource[property].bind(resource);
|
|
244
|
+
switch (property) {
|
|
245
|
+
case "@id":
|
|
246
|
+
if (this.resource["@id"]) return this.getCompactedIri(this.resource["@id"]);
|
|
247
|
+
return;
|
|
248
|
+
case "@type":
|
|
249
|
+
return this.resource["@type"];
|
|
250
|
+
case "properties":
|
|
251
|
+
return this.getProperties();
|
|
252
|
+
case "ldp:contains":
|
|
253
|
+
case "listPredicate":
|
|
254
|
+
return this.getContainerList();
|
|
255
|
+
case "permissions":
|
|
256
|
+
return this.getPermissions();
|
|
257
|
+
case "clientContext":
|
|
258
|
+
return getRawContext(this.clientContext);
|
|
259
|
+
case "serverContext":
|
|
260
|
+
return getRawContext(this.serverContext);
|
|
261
|
+
case "then":
|
|
262
|
+
return;
|
|
263
|
+
default:
|
|
264
|
+
return resource.get(property);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
});
|
|
271
|
+
export {
|
|
272
|
+
CustomGetter,
|
|
273
|
+
__tla
|
|
274
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const fr = {
|
|
2
|
-
"autocompletion.placeholder": "
|
|
2
|
+
"autocompletion.placeholder": "S\xE9lectionner une valeur",
|
|
3
3
|
"autocompletion.searchPlaceholder": "Rechercher",
|
|
4
|
-
"autocompletion.searchText": "Aucun
|
|
4
|
+
"autocompletion.searchText": "Aucun r\xE9sultat",
|
|
5
5
|
"solid-delete.button": "Supprimer",
|
|
6
6
|
"solid-form.submit-button": "Envoyer",
|
|
7
7
|
"solid-form.validation-error": "Erreur de validation.",
|
|
@@ -1861,7 +1861,7 @@ function fuzzyCompare(subject, search) {
|
|
|
1861
1861
|
return compareTransform(subject).includes(compareTransform(String(search)));
|
|
1862
1862
|
}
|
|
1863
1863
|
function compareTransform(str) {
|
|
1864
|
-
return str.normalize("NFD").replaceAll(new RegExp("\\p{Diacritic}", "gu"), "").toLowerCase().replaceAll("
|
|
1864
|
+
return str.normalize("NFD").replaceAll(new RegExp("\\p{Diacritic}", "gu"), "").toLowerCase().replaceAll("\u0153", "oe").replaceAll("\xE6", "ae").replaceAll(/[ ,.!?;:-`"]+/g, " ").trim();
|
|
1865
1865
|
}
|
|
1866
1866
|
const compare = {
|
|
1867
1867
|
string(subject, query) {
|
|
@@ -2089,12 +2089,12 @@ export {
|
|
|
2089
2089
|
importInlineCSS as i,
|
|
2090
2090
|
importCSS as j,
|
|
2091
2091
|
helpers as k,
|
|
2092
|
-
|
|
2093
|
-
|
|
2092
|
+
isUrlOrRelativePath as l,
|
|
2093
|
+
jsonldContextParserExports as m,
|
|
2094
2094
|
normalizeContext as n,
|
|
2095
|
-
|
|
2095
|
+
getRawContext as o,
|
|
2096
2096
|
parseFieldsString as p,
|
|
2097
|
-
|
|
2097
|
+
mergeContexts as q,
|
|
2098
2098
|
stringToDom as r,
|
|
2099
2099
|
setDeepProperty as s,
|
|
2100
2100
|
transformArrayToContainer as t,
|
package/dist/helpers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A, h, y, c, A as A2, d, a, x, e, f, b, g,
|
|
1
|
+
import { A, h, y, c, A as A2, d, a, x, e, f, b, g, o, j, i, v, l, w, q, n, p, s, r, t, u } from "./helpers-dFpcGbvl.js";
|
|
2
2
|
export {
|
|
3
3
|
A as AsyncIterableBuilder,
|
|
4
4
|
h as asyncQuerySelector,
|
|
@@ -12,13 +12,13 @@ export {
|
|
|
12
12
|
f as findClosingBracketMatchIndex,
|
|
13
13
|
b as fuzzyCompare,
|
|
14
14
|
g as generalComparator,
|
|
15
|
-
|
|
15
|
+
o as getRawContext,
|
|
16
16
|
j as importCSS,
|
|
17
17
|
i as importInlineCSS,
|
|
18
18
|
v as importJS,
|
|
19
|
-
|
|
19
|
+
l as isUrlOrRelativePath,
|
|
20
20
|
w as loadScript,
|
|
21
|
-
|
|
21
|
+
q as mergeContexts,
|
|
22
22
|
n as normalizeContext,
|
|
23
23
|
p as parseFieldsString,
|
|
24
24
|
s as setDeepProperty,
|