@startinblox/core 2.0.0 → 2.0.1-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/index.js +72 -36
- package/dist/{store-D1e5vOG_.js → store-Clion-HD.js} +145 -110
- package/dist/store.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
var _a2;
|
|
5
|
-
import { g as getDefaultExportFromCjs, s as store, b as base_context, f as formatAttributesToServerPaginationOptions, m as mergeServerSearchOptions, a as formatAttributesToServerSearchOptions, c as commonjsGlobal } from "./store-
|
|
5
|
+
import { g as getDefaultExportFromCjs, s as store, b as base_context, f as formatAttributesToServerPaginationOptions, m as mergeServerSearchOptions, a as formatAttributesToServerSearchOptions, c as commonjsGlobal } from "./store-Clion-HD.js";
|
|
6
6
|
import { d as defineComponent, n as normalizeContext, u as uniqID, e as evalTemplateString, a as doesResourceContainList, c as compare, p as parseFieldsString, f as findClosingBracketMatchIndex, g as generalComparator, b as fuzzyCompare, h as asyncQuerySelector, i as importInlineCSS, j as importCSS, t as transformArrayToContainer, s as setDeepProperty } from "./helpers-4GFJ8HI8.js";
|
|
7
7
|
import { k } from "./helpers-4GFJ8HI8.js";
|
|
8
8
|
if (!("flat" in Array.prototype)) {
|
|
@@ -1593,11 +1593,15 @@ const StoreMixin = {
|
|
|
1593
1593
|
},
|
|
1594
1594
|
created() {
|
|
1595
1595
|
if (this.element.closest("[no-render]")) this.noRender = "";
|
|
1596
|
+
this.loadResource();
|
|
1596
1597
|
},
|
|
1597
1598
|
detached() {
|
|
1598
1599
|
if (this.subscription) PubSub.unsubscribe(this.subscription);
|
|
1599
1600
|
},
|
|
1600
1601
|
get resource() {
|
|
1602
|
+
return this._resource;
|
|
1603
|
+
},
|
|
1604
|
+
async loadResource() {
|
|
1601
1605
|
var _a3;
|
|
1602
1606
|
const id = this.resourceId;
|
|
1603
1607
|
const serverPagination = formatAttributesToServerPaginationOptions(
|
|
@@ -1608,7 +1612,16 @@ const StoreMixin = {
|
|
|
1608
1612
|
(_a3 = this.getDynamicServerSearch) == null ? void 0 : _a3.call(this)
|
|
1609
1613
|
// from `filterMixin`
|
|
1610
1614
|
);
|
|
1611
|
-
|
|
1615
|
+
if (id) {
|
|
1616
|
+
const fetched = await store.get(
|
|
1617
|
+
id,
|
|
1618
|
+
serverPagination,
|
|
1619
|
+
serverSearch
|
|
1620
|
+
);
|
|
1621
|
+
this._resource = fetched;
|
|
1622
|
+
return this._resource;
|
|
1623
|
+
}
|
|
1624
|
+
return null;
|
|
1612
1625
|
},
|
|
1613
1626
|
get loader() {
|
|
1614
1627
|
return this.loaderId ? document.getElementById(this.loaderId) : null;
|
|
@@ -1616,7 +1629,8 @@ const StoreMixin = {
|
|
|
1616
1629
|
async fetchData(value) {
|
|
1617
1630
|
var _a3;
|
|
1618
1631
|
this.empty();
|
|
1619
|
-
if (this.
|
|
1632
|
+
if (this.sub1) PubSub.unsubscribe(this.sub1);
|
|
1633
|
+
if (this.sub2) PubSub.unsubscribe(this.sub2);
|
|
1620
1634
|
if (!value || value === "undefined") return;
|
|
1621
1635
|
this.resourceId = value;
|
|
1622
1636
|
if (this.nestedField) {
|
|
@@ -1627,13 +1641,14 @@ const StoreMixin = {
|
|
|
1627
1641
|
for (const property in await resource) {
|
|
1628
1642
|
console.log(`${property}: ${await resource[property]}`);
|
|
1629
1643
|
}
|
|
1630
|
-
throw `Error: the key "${this.nestedField}" does not exist on the resource at id "${
|
|
1644
|
+
throw `Error: the key "${this.nestedField}" does not exist on the resource at id "${resource["@id"]}"`;
|
|
1631
1645
|
}
|
|
1632
1646
|
}
|
|
1633
1647
|
this.updateNavigateSubscription();
|
|
1634
|
-
this.
|
|
1648
|
+
this.sub1 = PubSub.subscribe(this.resourceId, this.updateDOM.bind(this));
|
|
1649
|
+
this.sub2 = PubSub.subscribe(
|
|
1635
1650
|
this.resourceId,
|
|
1636
|
-
this.
|
|
1651
|
+
this.syncResourceWithCache.bind(this)
|
|
1637
1652
|
);
|
|
1638
1653
|
const serverPagination = formatAttributesToServerPaginationOptions(
|
|
1639
1654
|
this.element.attributes
|
|
@@ -1653,14 +1668,19 @@ const StoreMixin = {
|
|
|
1653
1668
|
serverPagination,
|
|
1654
1669
|
serverSearch
|
|
1655
1670
|
);
|
|
1671
|
+
this._resource = await store.get(this.resourceId);
|
|
1656
1672
|
this.updateDOM();
|
|
1657
1673
|
},
|
|
1674
|
+
async syncResourceWithCache() {
|
|
1675
|
+
this._resource = await store.get(this.resourceId);
|
|
1676
|
+
},
|
|
1658
1677
|
toggleLoaderHidden(toggle) {
|
|
1659
1678
|
if (this.loader) this.loader.toggleAttribute("hidden", toggle);
|
|
1660
1679
|
},
|
|
1661
1680
|
updateNavigateSubscription() {
|
|
1662
1681
|
},
|
|
1663
1682
|
async updateDOM() {
|
|
1683
|
+
this._resource = await store.get(this.resourceId);
|
|
1664
1684
|
this.toggleLoaderHidden(false);
|
|
1665
1685
|
this.empty();
|
|
1666
1686
|
await this.replaceAttributesData();
|
|
@@ -2853,24 +2873,34 @@ const FederationMixin = {
|
|
|
2853
2873
|
if (!this.containerFetched.includes(containerId)) {
|
|
2854
2874
|
this.containerFetched.push(containerId);
|
|
2855
2875
|
const resourcesFetched = await this.fetchSource(containerId);
|
|
2856
|
-
if (resourcesFetched)
|
|
2857
|
-
|
|
2876
|
+
if (resourcesFetched) {
|
|
2877
|
+
const t2 = await this.getResources(resourcesFetched);
|
|
2878
|
+
newResources.push(...t2);
|
|
2879
|
+
}
|
|
2858
2880
|
}
|
|
2859
2881
|
} else {
|
|
2860
2882
|
newResources.push(res);
|
|
2861
2883
|
}
|
|
2862
2884
|
};
|
|
2863
2885
|
if (!Array.isArray(resources)) resources = [resources];
|
|
2864
|
-
await Promise.all(resources.map((res) => getChildResources(res)));
|
|
2886
|
+
await Promise.all(resources.map(async (res) => await getChildResources(res)));
|
|
2865
2887
|
return newResources;
|
|
2866
2888
|
},
|
|
2867
2889
|
async fetchSource(containerId) {
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2890
|
+
let container = await store.get(containerId);
|
|
2891
|
+
const isMissingOrEmpty = !container || await container.getContainerList() === null;
|
|
2892
|
+
if (isMissingOrEmpty) {
|
|
2893
|
+
container = await store.getData(
|
|
2894
|
+
containerId,
|
|
2895
|
+
this.context,
|
|
2896
|
+
void 0,
|
|
2897
|
+
void 0,
|
|
2898
|
+
true
|
|
2899
|
+
);
|
|
2900
|
+
} else {
|
|
2901
|
+
container = await store.getData(containerId, this.context);
|
|
2871
2902
|
}
|
|
2872
|
-
|
|
2873
|
-
return container == null ? void 0 : container["listPredicate"];
|
|
2903
|
+
return await (container == null ? void 0 : container["listPredicate"]);
|
|
2874
2904
|
}
|
|
2875
2905
|
};
|
|
2876
2906
|
const isSet$1 = (field, fields) => {
|
|
@@ -2916,7 +2946,8 @@ const matchValue = async (val, query, throwOn) => {
|
|
|
2916
2946
|
}
|
|
2917
2947
|
if ((_a3 = subject.isContainer) == null ? void 0 : _a3.call(subject)) {
|
|
2918
2948
|
let ret = Promise.resolve(query.value === "");
|
|
2919
|
-
|
|
2949
|
+
const subjectList = await subject["listPredicate"];
|
|
2950
|
+
for (const value of subjectList) {
|
|
2920
2951
|
ret = await ret || await matchValue(value, query);
|
|
2921
2952
|
if (ret) return orThrow(throwOn, true);
|
|
2922
2953
|
}
|
|
@@ -2964,7 +2995,7 @@ const traversePath = async (resource, path, targetedType) => {
|
|
|
2964
2995
|
let targetsRes = await res[remainingPath[0]];
|
|
2965
2996
|
if (!targetsRes) return [];
|
|
2966
2997
|
if ((_a3 = targetsRes.isContainer) == null ? void 0 : _a3.call(targetsRes)) {
|
|
2967
|
-
targetsRes = targetsRes["listPredicate"];
|
|
2998
|
+
targetsRes = await targetsRes["listPredicate"];
|
|
2968
2999
|
}
|
|
2969
3000
|
if (!Array.isArray(targetsRes)) targetsRes = [targetsRes];
|
|
2970
3001
|
for (const targetRes of targetsRes) {
|
|
@@ -3076,11 +3107,11 @@ const FilterMixin = {
|
|
|
3076
3107
|
filteredBy: {
|
|
3077
3108
|
type: String,
|
|
3078
3109
|
default: null,
|
|
3079
|
-
callback(newValue) {
|
|
3110
|
+
async callback(newValue) {
|
|
3080
3111
|
if (newValue && this.searchForm && newValue !== this.searchForm.getAttribute("id")) {
|
|
3081
3112
|
this.searchForm.component.detach(this);
|
|
3082
3113
|
this.searchForm = null;
|
|
3083
|
-
this.populate();
|
|
3114
|
+
await this.populate();
|
|
3084
3115
|
}
|
|
3085
3116
|
}
|
|
3086
3117
|
},
|
|
@@ -3173,7 +3204,7 @@ const FilterMixin = {
|
|
|
3173
3204
|
await this.populate();
|
|
3174
3205
|
},
|
|
3175
3206
|
async getValuesOfField(field) {
|
|
3176
|
-
const arrayOfDataObjects = this.resource["listPredicate"];
|
|
3207
|
+
const arrayOfDataObjects = await this.resource["listPredicate"];
|
|
3177
3208
|
const arrayOfDataIds = [];
|
|
3178
3209
|
for (const obj of arrayOfDataObjects) {
|
|
3179
3210
|
const nextArrayOfObjects = await obj[field];
|
|
@@ -3188,7 +3219,7 @@ const FilterMixin = {
|
|
|
3188
3219
|
arrayOfDataIds.push(nextArrayOfObjects["@id"]);
|
|
3189
3220
|
continue;
|
|
3190
3221
|
}
|
|
3191
|
-
const children = nextArrayOfObjects["listPredicate"];
|
|
3222
|
+
const children = await nextArrayOfObjects["listPredicate"];
|
|
3192
3223
|
if (!children) continue;
|
|
3193
3224
|
arrayOfDataIds.push(...children.map((child) => child["@id"]));
|
|
3194
3225
|
}
|
|
@@ -3447,7 +3478,10 @@ const ListMixin = {
|
|
|
3447
3478
|
var _a3, _b, _c, _d;
|
|
3448
3479
|
const listPostProcessorsCopy = this.listPostProcessors.deepCopy();
|
|
3449
3480
|
const div = this.div;
|
|
3450
|
-
if (!this.resource)
|
|
3481
|
+
if (!await this.resource) {
|
|
3482
|
+
console.warn("[ListMixin] No resource to populate");
|
|
3483
|
+
return;
|
|
3484
|
+
}
|
|
3451
3485
|
if (!((_b = (_a3 = this.resource).isContainer) == null ? void 0 : _b.call(_a3)) && !this.arrayField && !this.predicateName) {
|
|
3452
3486
|
this.setElementAttribute("resource");
|
|
3453
3487
|
this.appendSingleElt(div);
|
|
@@ -3465,13 +3499,14 @@ const ListMixin = {
|
|
|
3465
3499
|
"ListMixin:handleEmptyWidget"
|
|
3466
3500
|
);
|
|
3467
3501
|
const nextProcessor = listPostProcessorsCopy.shift();
|
|
3502
|
+
const listPredicate = await this.resource["listPredicate"];
|
|
3468
3503
|
await nextProcessor(
|
|
3469
|
-
|
|
3504
|
+
listPredicate,
|
|
3470
3505
|
listPostProcessorsCopy,
|
|
3471
3506
|
div,
|
|
3472
3507
|
this.dataSrc
|
|
3473
3508
|
);
|
|
3474
|
-
} else if (this.arrayField && this.predicateName && this.resource[this.predicateName]) {
|
|
3509
|
+
} else if (this.arrayField && this.predicateName && await this.resource[this.predicateName]) {
|
|
3475
3510
|
this.setElementAttribute("container");
|
|
3476
3511
|
this.renderCallbacks = [];
|
|
3477
3512
|
listPostProcessorsCopy.attach(
|
|
@@ -3705,10 +3740,10 @@ const SorterMixin = {
|
|
|
3705
3740
|
sortedBy: {
|
|
3706
3741
|
type: String,
|
|
3707
3742
|
default: null,
|
|
3708
|
-
callback(newValue) {
|
|
3743
|
+
async callback(newValue) {
|
|
3709
3744
|
if (newValue && this.sortForm && newValue !== this.sortForm.getAttribute("id")) {
|
|
3710
3745
|
this.sortForm = null;
|
|
3711
|
-
this.populate();
|
|
3746
|
+
await this.populate();
|
|
3712
3747
|
}
|
|
3713
3748
|
}
|
|
3714
3749
|
}
|
|
@@ -91379,9 +91414,9 @@ const MultipleFormMixin = {
|
|
|
91379
91414
|
const nextProcessor = listValueTransformations.shift();
|
|
91380
91415
|
if (nextProcessor) nextProcessor(value, listValueTransformations);
|
|
91381
91416
|
},
|
|
91382
|
-
populate() {
|
|
91417
|
+
async populate() {
|
|
91383
91418
|
var _a3;
|
|
91384
|
-
const resources = (_a3 = this.resource) == null ? void 0 : _a3["listPredicate"];
|
|
91419
|
+
const resources = await ((_a3 = this.resource) == null ? void 0 : _a3["listPredicate"]);
|
|
91385
91420
|
if (!resources) return;
|
|
91386
91421
|
this.listAttributes.children = [];
|
|
91387
91422
|
for (const resource of resources) {
|
|
@@ -91484,9 +91519,9 @@ const MultipleselectFormMixin = {
|
|
|
91484
91519
|
const nextProcessor = listValueTransformations.shift();
|
|
91485
91520
|
if (nextProcessor) nextProcessor(value, listValueTransformations);
|
|
91486
91521
|
},
|
|
91487
|
-
populate() {
|
|
91522
|
+
async populate() {
|
|
91488
91523
|
var _a3;
|
|
91489
|
-
const resources = (_a3 = this.resource) == null ? void 0 : _a3["listPredicate"];
|
|
91524
|
+
const resources = await ((_a3 = this.resource) == null ? void 0 : _a3["listPredicate"]);
|
|
91490
91525
|
if (!this.resource || !resources && !Array.isArray(this.resource)) return;
|
|
91491
91526
|
this.setValue(resources);
|
|
91492
91527
|
this.planRender();
|
|
@@ -91579,7 +91614,7 @@ const RangeMixin = {
|
|
|
91579
91614
|
this.listAttributes.optionValue = this.optionValue;
|
|
91580
91615
|
},
|
|
91581
91616
|
async populate() {
|
|
91582
|
-
const resources = this.resource ? this.resource["listPredicate"] : [];
|
|
91617
|
+
const resources = this.resource ? await this.resource["listPredicate"] : [];
|
|
91583
91618
|
const listPostProcessorsCopy = this.listPostProcessors.deepCopy();
|
|
91584
91619
|
listPostProcessorsCopy.attach(
|
|
91585
91620
|
this.setRangeAttribute.bind(this),
|
|
@@ -91608,7 +91643,7 @@ const RangeMixin = {
|
|
|
91608
91643
|
return { value, label, selectedValue };
|
|
91609
91644
|
};
|
|
91610
91645
|
this.listAttributes.range = await Promise.all(
|
|
91611
|
-
resources.filter((el) => el !== null).map((r3) => getRangeValue(r3))
|
|
91646
|
+
resources.filter((el) => el !== null).map(async (r3) => await getRangeValue(r3))
|
|
91612
91647
|
);
|
|
91613
91648
|
}
|
|
91614
91649
|
this.planRender();
|
|
@@ -96436,7 +96471,7 @@ const WidgetMixin = {
|
|
|
96436
96471
|
if (attr) return parseFieldsString(attr);
|
|
96437
96472
|
let resource = this.resource;
|
|
96438
96473
|
if ((_a3 = resource == null ? void 0 : resource.isContainer) == null ? void 0 : _a3.call(resource)) {
|
|
96439
|
-
const resources = resource["listPredicate"];
|
|
96474
|
+
const resources = await resource["listPredicate"];
|
|
96440
96475
|
for (const res of resources) {
|
|
96441
96476
|
resource = res;
|
|
96442
96477
|
break;
|
|
@@ -97083,7 +97118,7 @@ const SolidFormSearch = {
|
|
|
97083
97118
|
"@context": this.context,
|
|
97084
97119
|
"ldp:contains": ldpContains
|
|
97085
97120
|
};
|
|
97086
|
-
sibStore.setLocalData(data, id);
|
|
97121
|
+
await sibStore.setLocalData(data, id);
|
|
97087
97122
|
}
|
|
97088
97123
|
},
|
|
97089
97124
|
change(resource, eventOptions) {
|
|
@@ -98590,7 +98625,7 @@ class BaseWidget extends HTMLElement {
|
|
|
98590
98625
|
}
|
|
98591
98626
|
async fetchSources(resource) {
|
|
98592
98627
|
var _a3;
|
|
98593
|
-
const data = resource["listPredicate"];
|
|
98628
|
+
const data = await resource["listPredicate"];
|
|
98594
98629
|
if (!data) return null;
|
|
98595
98630
|
const resources = [];
|
|
98596
98631
|
let index2 = 0;
|
|
@@ -98610,7 +98645,7 @@ class BaseWidget extends HTMLElement {
|
|
|
98610
98645
|
);
|
|
98611
98646
|
this._listen(res["@id"]);
|
|
98612
98647
|
if (resourcesFromContainer) {
|
|
98613
|
-
resources.push(...resourcesFromContainer["listPredicate"]);
|
|
98648
|
+
resources.push(...await resourcesFromContainer["listPredicate"]);
|
|
98614
98649
|
}
|
|
98615
98650
|
} else {
|
|
98616
98651
|
resources.push(res);
|
|
@@ -98630,7 +98665,8 @@ class BaseWidget extends HTMLElement {
|
|
|
98630
98665
|
let selected;
|
|
98631
98666
|
if ((_b = (_a3 = this._value) == null ? void 0 : _a3.isContainer) == null ? void 0 : _b.call(_a3)) {
|
|
98632
98667
|
selected = false;
|
|
98633
|
-
|
|
98668
|
+
const listPredicate = await this._value["listPredicate"];
|
|
98669
|
+
for await (const value of listPredicate) {
|
|
98634
98670
|
if (value["@id"] === element["@id"]) {
|
|
98635
98671
|
selected = true;
|
|
98636
98672
|
break;
|
|
@@ -8851,23 +8851,25 @@ class CustomGetter {
|
|
|
8851
8851
|
if (!isUrl.protocol.startsWith("http"))
|
|
8852
8852
|
throw new Error("Not a valid HTTP url");
|
|
8853
8853
|
if (isUrl) {
|
|
8854
|
-
let resources = this.getList(path);
|
|
8854
|
+
let resources = await this.getList(path);
|
|
8855
8855
|
if (!resources || Array.isArray(resources) && resources.length === 0)
|
|
8856
8856
|
return void 0;
|
|
8857
8857
|
if (!Array.isArray(resources)) resources = [resources];
|
|
8858
|
-
const result = resources ?
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8858
|
+
const result = resources ? Promise.all(
|
|
8859
|
+
resources.map(async (res) => {
|
|
8860
|
+
let resource = await store.get(res["@id"]);
|
|
8861
|
+
if (resource) return resource;
|
|
8862
|
+
resource = new CustomGetter(
|
|
8863
|
+
res["@id"],
|
|
8864
|
+
{ "@id": res["@id"] },
|
|
8865
|
+
this.clientContext,
|
|
8866
|
+
this.serverContext,
|
|
8867
|
+
this.parentId
|
|
8868
|
+
).getProxy();
|
|
8869
|
+
await store.cacheResource(res["@id"], resource);
|
|
8870
|
+
return resource;
|
|
8871
|
+
})
|
|
8872
|
+
) : [];
|
|
8871
8873
|
return result;
|
|
8872
8874
|
}
|
|
8873
8875
|
} catch {
|
|
@@ -8943,7 +8945,7 @@ class CustomGetter {
|
|
|
8943
8945
|
*/
|
|
8944
8946
|
async getResource(id, context2, iriParent, forceFetch = false) {
|
|
8945
8947
|
if (id.startsWith("_:b")) return await store.get(id + iriParent);
|
|
8946
|
-
return store.getData(id, context2, iriParent, void 0, forceFetch);
|
|
8948
|
+
return await store.getData(id, context2, iriParent, void 0, forceFetch);
|
|
8947
8949
|
}
|
|
8948
8950
|
/**
|
|
8949
8951
|
* Return true if the resource is a container
|
|
@@ -8979,12 +8981,12 @@ class CustomGetter {
|
|
|
8979
8981
|
/**
|
|
8980
8982
|
* Get children of container as objects
|
|
8981
8983
|
*/
|
|
8982
|
-
getList(predicateName) {
|
|
8983
|
-
let value = this.resource[predicateName];
|
|
8984
|
+
async getList(predicateName) {
|
|
8985
|
+
let value = await this.resource[predicateName];
|
|
8984
8986
|
if (!value) {
|
|
8985
8987
|
const index = this.getExpandedPredicate(predicateName);
|
|
8986
8988
|
if (index) {
|
|
8987
|
-
value = this.resource[index];
|
|
8989
|
+
value = await this.resource[index];
|
|
8988
8990
|
}
|
|
8989
8991
|
}
|
|
8990
8992
|
if (value === void 0 || value === null) {
|
|
@@ -8992,33 +8994,35 @@ class CustomGetter {
|
|
|
8992
8994
|
}
|
|
8993
8995
|
return value;
|
|
8994
8996
|
}
|
|
8995
|
-
getListAndCacheIt(predicate) {
|
|
8996
|
-
let children = this.getList(predicate);
|
|
8997
|
+
async getListAndCacheIt(predicate) {
|
|
8998
|
+
let children = await this.getList(predicate);
|
|
8997
8999
|
if (!children) return null;
|
|
8998
9000
|
if (!Array.isArray(children)) children = [children];
|
|
8999
|
-
const result = children ?
|
|
9000
|
-
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9001
|
+
const result = children ? await Promise.all(
|
|
9002
|
+
children.map(async (res) => {
|
|
9003
|
+
let resource = await store.get(res["@id"]);
|
|
9004
|
+
if (resource) return resource;
|
|
9005
|
+
resource = new CustomGetter(
|
|
9006
|
+
res["@id"],
|
|
9007
|
+
{ "@id": res["@id"] },
|
|
9008
|
+
this.clientContext,
|
|
9009
|
+
this.serverContext,
|
|
9010
|
+
this.parentId
|
|
9011
|
+
).getProxy();
|
|
9012
|
+
await store.cacheResource(res["@id"], resource);
|
|
9013
|
+
return resource;
|
|
9014
|
+
})
|
|
9015
|
+
) : [];
|
|
9012
9016
|
return result;
|
|
9013
9017
|
}
|
|
9014
|
-
getDcatDataset() {
|
|
9015
|
-
return this.getListAndCacheIt("dcat:dataset");
|
|
9018
|
+
async getDcatDataset() {
|
|
9019
|
+
return await this.getListAndCacheIt("dcat:dataset");
|
|
9016
9020
|
}
|
|
9017
9021
|
/**
|
|
9018
9022
|
* Get children of container as Proxys
|
|
9019
9023
|
*/
|
|
9020
|
-
getLdpContains() {
|
|
9021
|
-
return this.getListAndCacheIt("ldp:contains");
|
|
9024
|
+
async getLdpContains() {
|
|
9025
|
+
return await this.getListAndCacheIt("ldp:contains");
|
|
9022
9026
|
}
|
|
9023
9027
|
merge(resource) {
|
|
9024
9028
|
this.resource = {
|
|
@@ -9036,12 +9040,12 @@ class CustomGetter {
|
|
|
9036
9040
|
* If the resource is not a container or a catalog, it will return null
|
|
9037
9041
|
* @returns object[] | null
|
|
9038
9042
|
*/
|
|
9039
|
-
getContainerList() {
|
|
9043
|
+
async getContainerList() {
|
|
9040
9044
|
if (this.hasType("ldp:Container")) {
|
|
9041
|
-
return this.getLdpContains();
|
|
9045
|
+
return await this.getLdpContains();
|
|
9042
9046
|
}
|
|
9043
9047
|
if (this.getType() === "dcat:Catalog") {
|
|
9044
|
-
return this.getDcatDataset();
|
|
9048
|
+
return await this.getDcatDataset();
|
|
9045
9049
|
}
|
|
9046
9050
|
return null;
|
|
9047
9051
|
}
|
|
@@ -9104,8 +9108,8 @@ class CustomGetter {
|
|
|
9104
9108
|
/**
|
|
9105
9109
|
* Remove the resource from the cache
|
|
9106
9110
|
*/
|
|
9107
|
-
clearCache() {
|
|
9108
|
-
store.clearCache(this.resourceId);
|
|
9111
|
+
async clearCache() {
|
|
9112
|
+
await store.clearCache(this.resourceId);
|
|
9109
9113
|
}
|
|
9110
9114
|
getExpandedPredicate(property) {
|
|
9111
9115
|
const context2 = normalizeContext(
|
|
@@ -9172,7 +9176,7 @@ class CustomGetter {
|
|
|
9172
9176
|
});
|
|
9173
9177
|
}
|
|
9174
9178
|
}
|
|
9175
|
-
class
|
|
9179
|
+
class InMemoryCacheManager {
|
|
9176
9180
|
constructor() {
|
|
9177
9181
|
__publicField(this, "resourceCache", /* @__PURE__ */ new Map());
|
|
9178
9182
|
__publicField(this, "urlToIdMap", /* @__PURE__ */ new Map());
|
|
@@ -9184,7 +9188,8 @@ class CacheManager {
|
|
|
9184
9188
|
* @param url - The original URL used to fetch the resource.
|
|
9185
9189
|
* @returns The cached resource, or undefined if not found.
|
|
9186
9190
|
*/
|
|
9187
|
-
|
|
9191
|
+
// biome-ignore lint/suspicious/useAwait: necessary for interface compatibility
|
|
9192
|
+
async getByUrl(url2) {
|
|
9188
9193
|
const id = this.urlToIdMap.get(url2);
|
|
9189
9194
|
if (!id) return void 0;
|
|
9190
9195
|
return this.resourceCache.get(id);
|
|
@@ -9199,7 +9204,8 @@ class CacheManager {
|
|
|
9199
9204
|
* @param id - The @id of the resource (can be a URI, URN, or UUID).
|
|
9200
9205
|
* @returns The cached resource, or undefined if not found.
|
|
9201
9206
|
*/
|
|
9202
|
-
|
|
9207
|
+
// biome-ignore lint/suspicious/useAwait: necessary for interface compatibility
|
|
9208
|
+
async getById(id) {
|
|
9203
9209
|
return this.resourceCache.get(id);
|
|
9204
9210
|
}
|
|
9205
9211
|
/**
|
|
@@ -9210,7 +9216,8 @@ class CacheManager {
|
|
|
9210
9216
|
* @param idOrUrl - A resource @id or its original fetch URL.
|
|
9211
9217
|
* @returns The cached resource, or undefined if not found.
|
|
9212
9218
|
*/
|
|
9213
|
-
|
|
9219
|
+
// biome-ignore lint/suspicious/useAwait: necessary for interface compatibility
|
|
9220
|
+
async get(ref) {
|
|
9214
9221
|
if (this.resourceCache.has(ref)) {
|
|
9215
9222
|
return this.resourceCache.get(ref);
|
|
9216
9223
|
}
|
|
@@ -9220,7 +9227,8 @@ class CacheManager {
|
|
|
9220
9227
|
}
|
|
9221
9228
|
return void 0;
|
|
9222
9229
|
}
|
|
9223
|
-
|
|
9230
|
+
// biome-ignore lint/suspicious/useAwait: necessary for interface compatibility
|
|
9231
|
+
async length() {
|
|
9224
9232
|
return this.resourceCache.size;
|
|
9225
9233
|
}
|
|
9226
9234
|
/**
|
|
@@ -9229,7 +9237,8 @@ class CacheManager {
|
|
|
9229
9237
|
* @param url - The URL from which the resource was fetched.
|
|
9230
9238
|
* @param resource - The JSON-LD resource to store. Must contain a valid @id.
|
|
9231
9239
|
*/
|
|
9232
|
-
|
|
9240
|
+
// biome-ignore lint/suspicious/useAwait: necessary for interface compatibility
|
|
9241
|
+
async set(url2, resource) {
|
|
9233
9242
|
const id = resource == null ? void 0 : resource["@id"];
|
|
9234
9243
|
if (!id) {
|
|
9235
9244
|
console.warn("[CacheManager] Resource has no @id", resource);
|
|
@@ -9247,10 +9256,11 @@ class CacheManager {
|
|
|
9247
9256
|
* @param url - Data source (absolute or relative path).
|
|
9248
9257
|
* @param emptyResource - The resource to associate with this URL. Must include a valid `@id`.
|
|
9249
9258
|
*/
|
|
9250
|
-
|
|
9259
|
+
// biome-ignore lint/suspicious/useAwait: necessary for interface compatibility
|
|
9260
|
+
async linkUrlWithId(url2, emptyResource) {
|
|
9251
9261
|
if (!isUrlOrRelativePath(url2)) return;
|
|
9252
9262
|
if (this.hasUrlMatch(url2)) return;
|
|
9253
|
-
this.set(url2, emptyResource);
|
|
9263
|
+
await this.set(url2, emptyResource);
|
|
9254
9264
|
}
|
|
9255
9265
|
/**
|
|
9256
9266
|
* Checks if a resource is cached.
|
|
@@ -9259,7 +9269,8 @@ class CacheManager {
|
|
|
9259
9269
|
* @param urlOrId - The @id or URL to check for.
|
|
9260
9270
|
* @returns True if the resource exists in cache, false otherwise.
|
|
9261
9271
|
*/
|
|
9262
|
-
|
|
9272
|
+
// biome-ignore lint/suspicious/useAwait: necessary for interface compatibility
|
|
9273
|
+
async has(urlOrId) {
|
|
9263
9274
|
if (this.resourceCache.has(urlOrId)) return true;
|
|
9264
9275
|
const id = this.urlToIdMap.get(urlOrId);
|
|
9265
9276
|
return id ? this.resourceCache.has(id) : false;
|
|
@@ -9270,13 +9281,15 @@ class CacheManager {
|
|
|
9270
9281
|
* @param url - The original fetch URL.
|
|
9271
9282
|
* @returns The associated @id, or undefined if no mapping exists.
|
|
9272
9283
|
*/
|
|
9273
|
-
|
|
9284
|
+
// biome-ignore lint/suspicious/useAwait: necessary for interface compatibility
|
|
9285
|
+
async getIdByUrl(url2) {
|
|
9274
9286
|
return this.urlToIdMap.get(url2);
|
|
9275
9287
|
}
|
|
9276
9288
|
/**
|
|
9277
9289
|
* Clears the entire cache and all URL-to-ID mappings.
|
|
9278
9290
|
*/
|
|
9279
|
-
|
|
9291
|
+
// biome-ignore lint/suspicious/useAwait: necessary for interface compatibility
|
|
9292
|
+
async clear() {
|
|
9280
9293
|
this.resourceCache.clear();
|
|
9281
9294
|
this.urlToIdMap.clear();
|
|
9282
9295
|
}
|
|
@@ -9287,7 +9300,8 @@ class CacheManager {
|
|
|
9287
9300
|
* @param idOrUrl - The @id or URL of the resource to delete.
|
|
9288
9301
|
* @returns True if the resource was found and deleted, false otherwise.
|
|
9289
9302
|
*/
|
|
9290
|
-
|
|
9303
|
+
// biome-ignore lint/suspicious/useAwait: necessary for interface compatibility
|
|
9304
|
+
async delete(idOrUrl) {
|
|
9291
9305
|
if (this.resourceCache.has(idOrUrl)) {
|
|
9292
9306
|
this.resourceCache.delete(idOrUrl);
|
|
9293
9307
|
for (const [url2, id2] of this.urlToIdMap.entries()) {
|
|
@@ -9359,7 +9373,7 @@ class Store {
|
|
|
9359
9373
|
return handler;
|
|
9360
9374
|
});
|
|
9361
9375
|
this.storeOptions = storeOptions;
|
|
9362
|
-
this.cache = new
|
|
9376
|
+
this.cache = this.storeOptions.cacheManager ?? new InMemoryCacheManager();
|
|
9363
9377
|
this.subscriptionIndex = /* @__PURE__ */ new Map();
|
|
9364
9378
|
this.subscriptionVirtualContainersIndex = /* @__PURE__ */ new Map();
|
|
9365
9379
|
this.loadingList = /* @__PURE__ */ new Set();
|
|
@@ -9396,8 +9410,8 @@ class Store {
|
|
|
9396
9410
|
if (serverSearch) {
|
|
9397
9411
|
key = appendServerSearchToIri(key, serverSearch);
|
|
9398
9412
|
}
|
|
9399
|
-
if (localData == null && this.cache.has(key) && !this.loadingList.has(key)) {
|
|
9400
|
-
const resource = this.get(key);
|
|
9413
|
+
if (localData == null && await this.cache.has(key) && !this.loadingList.has(key)) {
|
|
9414
|
+
const resource = await this.get(key);
|
|
9401
9415
|
if (((_a = resource == null ? void 0 : resource.isFullResource) == null ? void 0 : _a.call(resource)) && !forceFetch) return await resource;
|
|
9402
9416
|
}
|
|
9403
9417
|
return new Promise(async (resolve) => {
|
|
@@ -9407,7 +9421,7 @@ class Store {
|
|
|
9407
9421
|
);
|
|
9408
9422
|
if (this.loadingList.has(key)) return;
|
|
9409
9423
|
this.loadingList.add(key);
|
|
9410
|
-
|
|
9424
|
+
let clientContext = await this.contextParser.parse(
|
|
9411
9425
|
getRawContext(context2)
|
|
9412
9426
|
);
|
|
9413
9427
|
let resource = null;
|
|
@@ -9436,6 +9450,14 @@ class Store {
|
|
|
9436
9450
|
);
|
|
9437
9451
|
return;
|
|
9438
9452
|
}
|
|
9453
|
+
const rawCtx = resource["@context"] || base_context;
|
|
9454
|
+
const normalizedRawContext = await this.contextParser.parse(
|
|
9455
|
+
Array.isArray(rawCtx) ? rawCtx : [rawCtx]
|
|
9456
|
+
);
|
|
9457
|
+
if (resource)
|
|
9458
|
+
clientContext = normalizeContext(
|
|
9459
|
+
mergeContexts(clientContext, normalizedRawContext)
|
|
9460
|
+
);
|
|
9439
9461
|
const serverContext = await this.contextParser.parse([
|
|
9440
9462
|
resource["@context"] || base_context
|
|
9441
9463
|
]);
|
|
@@ -9448,11 +9470,12 @@ class Store {
|
|
|
9448
9470
|
serverSearch
|
|
9449
9471
|
);
|
|
9450
9472
|
this.loadingList.delete(key);
|
|
9473
|
+
const finalResource = await this.get(key);
|
|
9451
9474
|
document.dispatchEvent(
|
|
9452
9475
|
new CustomEvent("resourceReady", {
|
|
9453
9476
|
detail: {
|
|
9454
9477
|
id: key,
|
|
9455
|
-
resource:
|
|
9478
|
+
resource: finalResource,
|
|
9456
9479
|
fetchedResource: resource
|
|
9457
9480
|
}
|
|
9458
9481
|
})
|
|
@@ -9507,8 +9530,7 @@ class Store {
|
|
|
9507
9530
|
* @param serverSearch - Server search query params
|
|
9508
9531
|
*/
|
|
9509
9532
|
async cacheGraph(resources, clientContext, parentContext, parentId, serverPagination, serverSearch) {
|
|
9510
|
-
|
|
9511
|
-
this.cache.linkUrlWithId(
|
|
9533
|
+
await this.cache.linkUrlWithId(
|
|
9512
9534
|
parentId,
|
|
9513
9535
|
CustomGetter.getEmptyResource(
|
|
9514
9536
|
resources["@id"],
|
|
@@ -9518,7 +9540,7 @@ class Store {
|
|
|
9518
9540
|
);
|
|
9519
9541
|
const flattenedResources = await jsonld.flatten(resources);
|
|
9520
9542
|
const compactedResources = await Promise.all(
|
|
9521
|
-
flattenedResources.map((r) => jsonld.compact(r, {}))
|
|
9543
|
+
flattenedResources.map(async (r) => jsonld.compact(await r, {}))
|
|
9522
9544
|
);
|
|
9523
9545
|
for (const resource of compactedResources) {
|
|
9524
9546
|
const id = resource["@id"] || resource.id;
|
|
@@ -9541,11 +9563,14 @@ class Store {
|
|
|
9541
9563
|
serverSearch
|
|
9542
9564
|
).getProxy();
|
|
9543
9565
|
if (resourceProxy.isContainer())
|
|
9544
|
-
this.subscribeChildren(resourceProxy, id);
|
|
9545
|
-
if (this.get(key)) {
|
|
9546
|
-
|
|
9566
|
+
await this.subscribeChildren(resourceProxy, id);
|
|
9567
|
+
if (await this.get(key)) {
|
|
9568
|
+
const resourceFromCache = await this.cache.get(key);
|
|
9569
|
+
if (resourceFromCache) {
|
|
9570
|
+
resourceFromCache.merge(resourceProxy);
|
|
9571
|
+
}
|
|
9547
9572
|
} else {
|
|
9548
|
-
this.cacheResource(key, resourceProxy);
|
|
9573
|
+
await this.cacheResource(key, resourceProxy);
|
|
9549
9574
|
}
|
|
9550
9575
|
}
|
|
9551
9576
|
}
|
|
@@ -9554,8 +9579,8 @@ class Store {
|
|
|
9554
9579
|
* @param key
|
|
9555
9580
|
* @param resourceProxy
|
|
9556
9581
|
*/
|
|
9557
|
-
cacheResource(key, resourceProxy) {
|
|
9558
|
-
this.cache.set(key, resourceProxy);
|
|
9582
|
+
async cacheResource(key, resourceProxy) {
|
|
9583
|
+
await this.cache.set(key, resourceProxy);
|
|
9559
9584
|
}
|
|
9560
9585
|
/**
|
|
9561
9586
|
* Update fetch
|
|
@@ -9572,18 +9597,18 @@ class Store {
|
|
|
9572
9597
|
body: JSON.stringify(resource),
|
|
9573
9598
|
credentials: "include"
|
|
9574
9599
|
});
|
|
9575
|
-
const resourceProxy =
|
|
9600
|
+
const resourceProxy = await this.get(id);
|
|
9576
9601
|
const clientContext = resourceProxy ? mergeContexts(resourceProxy.clientContext, resource["@context"]) : resource["@context"];
|
|
9577
|
-
this.clearCache(id);
|
|
9578
|
-
await this.getData(id, clientContext, "", resource);
|
|
9602
|
+
await this.clearCache(id);
|
|
9603
|
+
await this.getData(id, clientContext, "", resource, true);
|
|
9579
9604
|
return { ok: true };
|
|
9580
9605
|
}
|
|
9581
9606
|
/**
|
|
9582
9607
|
* Subscribe all the children of a container to its parent
|
|
9583
9608
|
* @param container
|
|
9584
9609
|
*/
|
|
9585
|
-
subscribeChildren(container, containerId) {
|
|
9586
|
-
const children = container["listPredicate"];
|
|
9610
|
+
async subscribeChildren(container, containerId) {
|
|
9611
|
+
const children = await container["listPredicate"];
|
|
9587
9612
|
if (!children) return;
|
|
9588
9613
|
for (const res of children) {
|
|
9589
9614
|
this.subscribeResourceTo(containerId, res["@id"] || res.id);
|
|
@@ -9596,7 +9621,7 @@ class Store {
|
|
|
9596
9621
|
* @param id - id of the resource to update
|
|
9597
9622
|
* @returns void
|
|
9598
9623
|
*/
|
|
9599
|
-
async _updateResource(method, resource, id) {
|
|
9624
|
+
async _updateResource(method, resource, id, skipFetch = false) {
|
|
9600
9625
|
if (!["POST", "PUT", "PATCH", "_LOCAL"].includes(method))
|
|
9601
9626
|
throw new Error("Error: method not allowed");
|
|
9602
9627
|
const context2 = await this.contextParser.parse([
|
|
@@ -9607,14 +9632,15 @@ class Store {
|
|
|
9607
9632
|
return this._fetch(method, resource, id).then(async (response) => {
|
|
9608
9633
|
var _a;
|
|
9609
9634
|
if (response.ok) {
|
|
9610
|
-
if (
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9635
|
+
if (!skipFetch) {
|
|
9636
|
+
if (method !== "_LOCAL") {
|
|
9637
|
+
await this.clearCache(expandedId);
|
|
9638
|
+
}
|
|
9639
|
+
await this.getData(expandedId, resource["@context"]);
|
|
9614
9640
|
const nestedResources = await this.getNestedResources(resource, id);
|
|
9615
9641
|
const resourcesToRefresh = this.subscriptionVirtualContainersIndex.get(expandedId) || [];
|
|
9616
9642
|
const resourcesToNotify = this.subscriptionIndex.get(expandedId) || [];
|
|
9617
|
-
|
|
9643
|
+
await this.refreshResources([
|
|
9618
9644
|
...nestedResources,
|
|
9619
9645
|
...resourcesToRefresh
|
|
9620
9646
|
]).then(
|
|
@@ -9624,7 +9650,7 @@ class Store {
|
|
|
9624
9650
|
...resourcesToNotify
|
|
9625
9651
|
])
|
|
9626
9652
|
);
|
|
9627
|
-
}
|
|
9653
|
+
}
|
|
9628
9654
|
return ((_a = response.headers) == null ? void 0 : _a.get("Location")) || null;
|
|
9629
9655
|
}
|
|
9630
9656
|
throw response;
|
|
@@ -9636,21 +9662,29 @@ class Store {
|
|
|
9636
9662
|
* @returns - all the resource ids
|
|
9637
9663
|
*/
|
|
9638
9664
|
async refreshResources(resourceIds) {
|
|
9639
|
-
|
|
9640
|
-
const
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9665
|
+
const uniqueIds = Array.from(new Set(resourceIds));
|
|
9666
|
+
const maybe = await Promise.all(
|
|
9667
|
+
uniqueIds.map(
|
|
9668
|
+
async (id) => await this.cache.has(id).then((ok) => ok ? id : null)
|
|
9669
|
+
)
|
|
9670
|
+
);
|
|
9671
|
+
resourceIds = maybe.filter((id) => id !== null);
|
|
9672
|
+
const resourceWithContexts = await Promise.all(
|
|
9673
|
+
resourceIds.map(async (resourceId) => {
|
|
9674
|
+
const res = await this.get(resourceId);
|
|
9675
|
+
return {
|
|
9676
|
+
id: resourceId,
|
|
9677
|
+
context: res == null ? void 0 : res.clientContext
|
|
9678
|
+
};
|
|
9679
|
+
})
|
|
9680
|
+
);
|
|
9647
9681
|
for (const resource of resourceWithContexts) {
|
|
9648
|
-
if (!this._isLocalId(resource.id)) this.clearCache(resource.id);
|
|
9682
|
+
if (!this._isLocalId(resource.id)) await this.clearCache(resource.id);
|
|
9649
9683
|
}
|
|
9650
9684
|
await Promise.all(
|
|
9651
|
-
resourceWithContexts.map(
|
|
9652
|
-
|
|
9653
|
-
)
|
|
9685
|
+
resourceWithContexts.map(async ({ id, context: context2 }) => {
|
|
9686
|
+
await this.getData(id, context2 || base_context);
|
|
9687
|
+
})
|
|
9654
9688
|
);
|
|
9655
9689
|
return resourceIds;
|
|
9656
9690
|
}
|
|
@@ -9667,9 +9701,9 @@ class Store {
|
|
|
9667
9701
|
* @param resource - object
|
|
9668
9702
|
* @param id - string
|
|
9669
9703
|
*/
|
|
9670
|
-
getNestedResources(resource, id) {
|
|
9704
|
+
async getNestedResources(resource, id) {
|
|
9671
9705
|
var _a;
|
|
9672
|
-
const cachedResource =
|
|
9706
|
+
const cachedResource = await this.get(id);
|
|
9673
9707
|
if (!cachedResource || ((_a = cachedResource.isContainer) == null ? void 0 : _a.call(cachedResource))) return [];
|
|
9674
9708
|
const nestedProperties = [];
|
|
9675
9709
|
const excludeKeys = ["@context"];
|
|
@@ -9686,30 +9720,31 @@ class Store {
|
|
|
9686
9720
|
*
|
|
9687
9721
|
* @returns Resource (Proxy) if in the cache, null otherwise
|
|
9688
9722
|
*/
|
|
9689
|
-
get(id, serverPagination, serverSearch) {
|
|
9723
|
+
async get(id, serverPagination, serverSearch) {
|
|
9690
9724
|
if (serverPagination) {
|
|
9691
9725
|
id = appendServerPaginationToIri(id, serverPagination);
|
|
9692
9726
|
}
|
|
9693
9727
|
if (serverSearch) {
|
|
9694
9728
|
id = appendServerSearchToIri(id, serverSearch);
|
|
9695
9729
|
}
|
|
9696
|
-
|
|
9730
|
+
const resource = await this.cache.get(id) || null;
|
|
9731
|
+
return resource;
|
|
9697
9732
|
}
|
|
9698
9733
|
/**
|
|
9699
9734
|
* Removes a resource from the cache
|
|
9700
9735
|
* @param id - id of the resource to remove from the cache
|
|
9701
9736
|
*/
|
|
9702
|
-
clearCache(id) {
|
|
9703
|
-
if (this.cache.has(id)) {
|
|
9704
|
-
const resource = this.cache.get(id);
|
|
9705
|
-
const predicate = resource ? resource["listPredicate"] : null;
|
|
9737
|
+
async clearCache(id) {
|
|
9738
|
+
if (await this.cache.has(id)) {
|
|
9739
|
+
const resource = await this.cache.get(id);
|
|
9740
|
+
const predicate = resource ? await resource["listPredicate"] : null;
|
|
9706
9741
|
if (predicate) {
|
|
9707
9742
|
for (const child of predicate) {
|
|
9708
9743
|
if ((child == null ? void 0 : child["@type"]) && doesResourceContainList(child))
|
|
9709
|
-
this.cache.delete(child["@id"]);
|
|
9744
|
+
await this.cache.delete(child["@id"]);
|
|
9710
9745
|
}
|
|
9711
9746
|
}
|
|
9712
|
-
this.cache.delete(id);
|
|
9747
|
+
await this.cache.delete(id);
|
|
9713
9748
|
}
|
|
9714
9749
|
}
|
|
9715
9750
|
/**
|
|
@@ -9719,8 +9754,8 @@ class Store {
|
|
|
9719
9754
|
*
|
|
9720
9755
|
* @returns id of the posted resource
|
|
9721
9756
|
*/
|
|
9722
|
-
setLocalData(resource, id) {
|
|
9723
|
-
return this._updateResource("_LOCAL", resource, id);
|
|
9757
|
+
setLocalData(resource, id, skipFetch = false) {
|
|
9758
|
+
return this._updateResource("_LOCAL", resource, id, skipFetch);
|
|
9724
9759
|
}
|
|
9725
9760
|
/**
|
|
9726
9761
|
* Send a POST request to create a resource in a container
|
|
@@ -9729,8 +9764,8 @@ class Store {
|
|
|
9729
9764
|
*
|
|
9730
9765
|
* @returns id of the posted resource
|
|
9731
9766
|
*/
|
|
9732
|
-
post(resource, id) {
|
|
9733
|
-
return this._updateResource("POST", resource, id);
|
|
9767
|
+
post(resource, id, skipFetch = false) {
|
|
9768
|
+
return this._updateResource("POST", resource, id, skipFetch);
|
|
9734
9769
|
}
|
|
9735
9770
|
/**
|
|
9736
9771
|
* Send a PUT request to edit a resource
|
|
@@ -9739,8 +9774,8 @@ class Store {
|
|
|
9739
9774
|
*
|
|
9740
9775
|
* @returns id of the edited resource
|
|
9741
9776
|
*/
|
|
9742
|
-
put(resource, id) {
|
|
9743
|
-
return this._updateResource("PUT", resource, id);
|
|
9777
|
+
put(resource, id, skipFetch = false) {
|
|
9778
|
+
return this._updateResource("PUT", resource, id, skipFetch);
|
|
9744
9779
|
}
|
|
9745
9780
|
/**
|
|
9746
9781
|
* Send a PATCH request to edit a resource
|
|
@@ -9749,8 +9784,8 @@ class Store {
|
|
|
9749
9784
|
*
|
|
9750
9785
|
* @returns id of the edited resource
|
|
9751
9786
|
*/
|
|
9752
|
-
patch(resource, id) {
|
|
9753
|
-
return this._updateResource("PATCH", resource, id);
|
|
9787
|
+
async patch(resource, id, skipFetch = false) {
|
|
9788
|
+
return await this._updateResource("PATCH", resource, id, skipFetch);
|
|
9754
9789
|
}
|
|
9755
9790
|
/**
|
|
9756
9791
|
* Send a DELETE request to delete a resource
|
package/dist/store.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startinblox/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1-beta.1",
|
|
4
4
|
"description": "This is a series of web component respecting both the web components standards and the Linked Data Platform convention.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|