@startinblox/core 2.0.6-beta.1 → 2.0.6-beta.3
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.
|
@@ -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
|
import { q as mergeContexts, o as getRawContext, n as normalizeContext } from "./helpers-vZrb1UDN.js";
|
|
5
|
-
import { S as StoreService } from "./store-
|
|
5
|
+
import { S as StoreService } from "./store-CVBZtibt.js";
|
|
6
6
|
const store = StoreService.getInstance();
|
|
7
7
|
class CustomGetter {
|
|
8
8
|
// search attributes to give to server
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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
|
-
import { g as getDefaultExportFromCjs, S as StoreService, b as base_context, f as formatAttributesToServerPaginationOptions, m as mergeServerSearchOptions, a as formatAttributesToServerSearchOptions, c as StoreType, d as StoreFactory, h as hasSetLocalData, e as hasQueryIndex, __tla as __tla_0 } from "./store-
|
|
4
|
+
import { g as getDefaultExportFromCjs, S as StoreService, b as base_context, f as formatAttributesToServerPaginationOptions, m as mergeServerSearchOptions, a as formatAttributesToServerSearchOptions, c as StoreType, d as StoreFactory, h as hasSetLocalData, e as hasQueryIndex, __tla as __tla_0 } from "./store-CVBZtibt.js";
|
|
5
5
|
import { d as defineComponent, n as normalizeContext, u as uniqID, f as fuzzyCompare, a as asyncQuerySelector, i as importInlineCSS, b as importCSS, c as doesResourceContainList, e as findClosingBracketMatchIndex, p as parseFieldsString, g as evalTemplateString, h as compare, j as generalComparator, t as transformArrayToContainer, s as setDeepProperty } from "./helpers-vZrb1UDN.js";
|
|
6
6
|
import { k } from "./helpers-vZrb1UDN.js";
|
|
7
7
|
let index$4, BaseWidgetMixin, index$3, CounterMixin, EdcAssetsDisplay, EdcCatalogDisplay, EdcFederatedCatalogDisplay, FederationMixin, FilterMixin, GrouperMixin, HighlighterMixin, ListMixin, NextMixin, PaginateMixin, RequiredMixin, Sib, SolidAcChecker, SolidDelete, SolidDisplay, SolidForm, SolidFormSearch, SolidLang, SolidMemberAdd, SolidMemberDelete, SolidMembership, SolidTable, SolidTemplateElement, SolidWidget, SorterMixin, StoreMixin, index$2, index$1, index, TranslationMixin, ValidationMixin, WidgetMixin, x, o$2, newWidgetFactory, B, o$1, m, widgetFactory;
|
|
@@ -730,8 +730,8 @@ Component: ${componentName}
|
|
|
730
730
|
};
|
|
731
731
|
}
|
|
732
732
|
};
|
|
733
|
-
const store$
|
|
734
|
-
if (!store$
|
|
733
|
+
const store$a = StoreService.getInstance();
|
|
734
|
+
if (!store$a) throw new Error("Store is not available");
|
|
735
735
|
const AttributeBinderMixin = {
|
|
736
736
|
name: "attribute-binder-mixin",
|
|
737
737
|
use: [],
|
|
@@ -776,7 +776,7 @@ Component: ${componentName}
|
|
|
776
776
|
attributes[attr] = resource ? await resource[path] : "";
|
|
777
777
|
} else if (value.startsWith("store://user")) {
|
|
778
778
|
const userId = await this.retry(this.getUser.bind(this));
|
|
779
|
-
const user = (userId == null ? void 0 : userId["@id"]) ? await store$
|
|
779
|
+
const user = (userId == null ? void 0 : userId["@id"]) ? await store$a.getData(userId["@id"], this.context || base_context) : null;
|
|
780
780
|
if (!user) {
|
|
781
781
|
attributes[attr] = "";
|
|
782
782
|
continue;
|
|
@@ -1543,8 +1543,6 @@ Component: ${componentName}
|
|
|
1543
1543
|
}
|
|
1544
1544
|
}
|
|
1545
1545
|
};
|
|
1546
|
-
const store$e = StoreService.getInstance();
|
|
1547
|
-
if (!store$e) throw new Error("Store is not available");
|
|
1548
1546
|
StoreMixin = {
|
|
1549
1547
|
name: "store-mixin",
|
|
1550
1548
|
use: [
|
|
@@ -1553,6 +1551,10 @@ Component: ${componentName}
|
|
|
1553
1551
|
ServerPaginationMixin
|
|
1554
1552
|
],
|
|
1555
1553
|
attributes: {
|
|
1554
|
+
store: {
|
|
1555
|
+
type: String,
|
|
1556
|
+
default: null
|
|
1557
|
+
},
|
|
1556
1558
|
noRender: {
|
|
1557
1559
|
type: String,
|
|
1558
1560
|
default: null,
|
|
@@ -1586,7 +1588,7 @@ Component: ${componentName}
|
|
|
1586
1588
|
type: String,
|
|
1587
1589
|
default: null,
|
|
1588
1590
|
callback: function(value) {
|
|
1589
|
-
if (value) this.predicateName = store
|
|
1591
|
+
if (value) this.predicateName = this.store.getExpandedPredicate(this.arrayField, this.context);
|
|
1590
1592
|
}
|
|
1591
1593
|
},
|
|
1592
1594
|
predicateName: {
|
|
@@ -1597,9 +1599,14 @@ Component: ${componentName}
|
|
|
1597
1599
|
initialState: {
|
|
1598
1600
|
resources: [],
|
|
1599
1601
|
resourceId: null,
|
|
1600
|
-
subscription: null
|
|
1602
|
+
subscription: null,
|
|
1603
|
+
store: null
|
|
1601
1604
|
},
|
|
1602
1605
|
created() {
|
|
1606
|
+
this.store = StoreService.getStore(this.element.getAttribute("store"));
|
|
1607
|
+
if (!this.store) {
|
|
1608
|
+
this.store = StoreService.getInstance();
|
|
1609
|
+
}
|
|
1603
1610
|
if (this.element.closest("[no-render]")) this.noRender = "";
|
|
1604
1611
|
this.loadResource();
|
|
1605
1612
|
},
|
|
@@ -1615,7 +1622,7 @@ Component: ${componentName}
|
|
|
1615
1622
|
const serverPagination = formatAttributesToServerPaginationOptions(this.element.attributes);
|
|
1616
1623
|
const serverSearch = mergeServerSearchOptions(formatAttributesToServerSearchOptions(this.element.attributes), (_a3 = this.getDynamicServerSearch) == null ? void 0 : _a3.call(this));
|
|
1617
1624
|
if (id) {
|
|
1618
|
-
const fetched = await store
|
|
1625
|
+
const fetched = await this.store.get(id, serverPagination, serverSearch);
|
|
1619
1626
|
this._resource = fetched;
|
|
1620
1627
|
return this._resource;
|
|
1621
1628
|
}
|
|
@@ -1632,7 +1639,7 @@ Component: ${componentName}
|
|
|
1632
1639
|
if (!value || value === "undefined") return;
|
|
1633
1640
|
this.resourceId = value;
|
|
1634
1641
|
if (this.nestedField) {
|
|
1635
|
-
const resource = await store
|
|
1642
|
+
const resource = await this.store.getData(value, this.context);
|
|
1636
1643
|
const nestedResource = resource ? await resource[this.nestedField] : null;
|
|
1637
1644
|
this.resourceId = nestedResource ? await nestedResource["@id"] : null;
|
|
1638
1645
|
if (resource && !this.resourceId && !nestedResource) {
|
|
@@ -1648,12 +1655,12 @@ Component: ${componentName}
|
|
|
1648
1655
|
const dynamicServerSearch = (_a3 = this.getDynamicServerSearch) == null ? void 0 : _a3.call(this);
|
|
1649
1656
|
const serverSearch = mergeServerSearchOptions(formatAttributesToServerSearchOptions(this.element.attributes), dynamicServerSearch);
|
|
1650
1657
|
const forceRefetch = !!dynamicServerSearch;
|
|
1651
|
-
await store
|
|
1652
|
-
this._resource = await store
|
|
1658
|
+
await this.store.getData(this.resourceId, this.context, void 0, void 0, forceRefetch, serverPagination, serverSearch);
|
|
1659
|
+
this._resource = await this.store.get(this.resourceId);
|
|
1653
1660
|
this.updateDOM();
|
|
1654
1661
|
},
|
|
1655
1662
|
async syncResourceWithCache() {
|
|
1656
|
-
this._resource = await store
|
|
1663
|
+
this._resource = await this.store.get(this.resourceId);
|
|
1657
1664
|
},
|
|
1658
1665
|
toggleLoaderHidden(toggle) {
|
|
1659
1666
|
if (this.loader) this.loader.toggleAttribute("hidden", toggle);
|
|
@@ -1663,7 +1670,7 @@ Component: ${componentName}
|
|
|
1663
1670
|
async updateDOM() {
|
|
1664
1671
|
const indexServerSearch = this.element.getAttribute("filtered-on") === "index" && !!this.element.getAttribute("data-src-index");
|
|
1665
1672
|
if (!indexServerSearch) {
|
|
1666
|
-
this._resource = await store
|
|
1673
|
+
this._resource = await this.store.get(this.resourceId);
|
|
1667
1674
|
this.toggleLoaderHidden(false);
|
|
1668
1675
|
}
|
|
1669
1676
|
this.empty();
|
|
@@ -2491,8 +2498,8 @@ Component: ${componentName}
|
|
|
2491
2498
|
});
|
|
2492
2499
|
return x(finalStrings, ...filterOutNeedlessValues(values, needlessValues));
|
|
2493
2500
|
}
|
|
2494
|
-
const store$
|
|
2495
|
-
if (!store$
|
|
2501
|
+
const store$9 = StoreService.getInstance();
|
|
2502
|
+
if (!store$9) throw new Error("Store is not available");
|
|
2496
2503
|
TranslationMixin = {
|
|
2497
2504
|
name: "translation-mixin",
|
|
2498
2505
|
use: [],
|
|
@@ -2515,7 +2522,7 @@ Component: ${componentName}
|
|
|
2515
2522
|
return module2.default;
|
|
2516
2523
|
},
|
|
2517
2524
|
getLang() {
|
|
2518
|
-
const languageStorage = store$
|
|
2525
|
+
const languageStorage = store$9._getLanguage();
|
|
2519
2526
|
if (languageStorage) {
|
|
2520
2527
|
if (window.fetchTranslationPromise === void 0) {
|
|
2521
2528
|
window.fetchTranslationPromise = this.getTranslationModule(languageStorage);
|
|
@@ -2614,8 +2621,6 @@ Component: ${componentName}
|
|
|
2614
2621
|
`;
|
|
2615
2622
|
}
|
|
2616
2623
|
};
|
|
2617
|
-
const store$c = StoreService.getInstance();
|
|
2618
|
-
if (!store$c) throw new Error("Store is not available");
|
|
2619
2624
|
SolidDelete = {
|
|
2620
2625
|
name: "solid-delete",
|
|
2621
2626
|
use: [
|
|
@@ -2625,6 +2630,10 @@ Component: ${componentName}
|
|
|
2625
2630
|
ContextMixin
|
|
2626
2631
|
],
|
|
2627
2632
|
attributes: {
|
|
2633
|
+
store: {
|
|
2634
|
+
type: String,
|
|
2635
|
+
default: null
|
|
2636
|
+
},
|
|
2628
2637
|
dataSrc: {
|
|
2629
2638
|
type: String,
|
|
2630
2639
|
default: null,
|
|
@@ -2641,9 +2650,14 @@ Component: ${componentName}
|
|
|
2641
2650
|
}
|
|
2642
2651
|
},
|
|
2643
2652
|
initialState: {
|
|
2644
|
-
renderPlanned: false
|
|
2653
|
+
renderPlanned: false,
|
|
2654
|
+
store: null
|
|
2645
2655
|
},
|
|
2646
2656
|
created() {
|
|
2657
|
+
this.store = StoreService.getStore(this.element.getAttribute("store"));
|
|
2658
|
+
if (!this.store) {
|
|
2659
|
+
this.store = StoreService.getInstance();
|
|
2660
|
+
}
|
|
2647
2661
|
this.planRender();
|
|
2648
2662
|
},
|
|
2649
2663
|
planRender() {
|
|
@@ -2661,7 +2675,7 @@ Component: ${componentName}
|
|
|
2661
2675
|
this.performAction();
|
|
2662
2676
|
},
|
|
2663
2677
|
deletion() {
|
|
2664
|
-
return store
|
|
2678
|
+
return this.store.delete(this.dataSrc, this.context).then((response) => {
|
|
2665
2679
|
if (!response.ok) return;
|
|
2666
2680
|
this.goToNext(null);
|
|
2667
2681
|
const eventData = {
|
|
@@ -93493,7 +93507,7 @@ ${escapeText(this.code(index2, length))}
|
|
|
93493
93507
|
}
|
|
93494
93508
|
}
|
|
93495
93509
|
};
|
|
93496
|
-
const store$
|
|
93510
|
+
const store$8 = StoreService.getInstance();
|
|
93497
93511
|
const EditableMixin = {
|
|
93498
93512
|
name: "editable-mixin",
|
|
93499
93513
|
use: [
|
|
@@ -93545,7 +93559,7 @@ ${escapeText(this.code(index2, length))}
|
|
|
93545
93559
|
const resource = {};
|
|
93546
93560
|
resource[this.name] = editableField.innerText;
|
|
93547
93561
|
resource["@context"] = this.context;
|
|
93548
|
-
store$
|
|
93562
|
+
store$8.patch(resource, this.valueId);
|
|
93549
93563
|
}
|
|
93550
93564
|
};
|
|
93551
93565
|
const displayTemplates = {
|
|
@@ -93733,8 +93747,8 @@ ${escapeText(this.code(index2, length))}
|
|
|
93733
93747
|
return this.element.hasAttribute("multiple");
|
|
93734
93748
|
}
|
|
93735
93749
|
};
|
|
93736
|
-
const store$
|
|
93737
|
-
if (!store$
|
|
93750
|
+
const store$7 = StoreService.getInstance();
|
|
93751
|
+
if (!store$7) throw new Error("Store is not available");
|
|
93738
93752
|
const FormFileMixin = {
|
|
93739
93753
|
name: "form-file-mixin",
|
|
93740
93754
|
attributes: {
|
|
@@ -93787,7 +93801,7 @@ ${escapeText(this.code(index2, length))}
|
|
|
93787
93801
|
const file = (_b = filePicker.files) == null ? void 0 : _b[0];
|
|
93788
93802
|
const formData = new FormData();
|
|
93789
93803
|
formData.append("file", file);
|
|
93790
|
-
store$
|
|
93804
|
+
store$7.fetchAuthn(this.uploadUrl, {
|
|
93791
93805
|
method: "POST",
|
|
93792
93806
|
body: formData
|
|
93793
93807
|
}).then((response) => this.updateFile(dataHolder, response)).catch((error2) => {
|
|
@@ -94164,8 +94178,8 @@ ${escapeText(this.code(index2, length))}
|
|
|
94164
94178
|
}
|
|
94165
94179
|
}
|
|
94166
94180
|
};
|
|
94167
|
-
const store$
|
|
94168
|
-
if (!store$
|
|
94181
|
+
const store$6 = StoreService.getInstance();
|
|
94182
|
+
if (!store$6) throw new Error("Store is not available");
|
|
94169
94183
|
FederationMixin = {
|
|
94170
94184
|
name: "federation-mixin",
|
|
94171
94185
|
use: [],
|
|
@@ -94215,12 +94229,12 @@ ${escapeText(this.code(index2, length))}
|
|
|
94215
94229
|
return newResources;
|
|
94216
94230
|
},
|
|
94217
94231
|
async fetchSource(containerId) {
|
|
94218
|
-
let container = await store$
|
|
94232
|
+
let container = await store$6.get(containerId);
|
|
94219
94233
|
const isMissingOrEmpty = !container || await container.getContainerList() === null;
|
|
94220
94234
|
if (isMissingOrEmpty) {
|
|
94221
|
-
container = await store$
|
|
94235
|
+
container = await store$6.getData(containerId, this.context, void 0, void 0, true);
|
|
94222
94236
|
} else {
|
|
94223
|
-
container = await store$
|
|
94237
|
+
container = await store$6.getData(containerId, this.context);
|
|
94224
94238
|
}
|
|
94225
94239
|
return await (container == null ? void 0 : container["listPredicate"]);
|
|
94226
94240
|
}
|
|
@@ -94355,7 +94369,7 @@ ${escapeText(this.code(index2, length))}
|
|
|
94355
94369
|
return this.randomOrder.map((i2) => array2[i2]);
|
|
94356
94370
|
}
|
|
94357
94371
|
};
|
|
94358
|
-
const store$
|
|
94372
|
+
const store$5 = StoreService.getInstance();
|
|
94359
94373
|
const RangeMixin = {
|
|
94360
94374
|
name: "range-mixin",
|
|
94361
94375
|
use: [
|
|
@@ -94426,7 +94440,7 @@ ${escapeText(this.code(index2, length))}
|
|
|
94426
94440
|
async setRangeAttribute(resources) {
|
|
94427
94441
|
if (resources) {
|
|
94428
94442
|
const getRangeValue = async (resource) => {
|
|
94429
|
-
let res = await store$
|
|
94443
|
+
let res = await store$5.getData(resource["@id"], this.context || base_context);
|
|
94430
94444
|
if (res === null) {
|
|
94431
94445
|
res = resource;
|
|
94432
94446
|
}
|
|
@@ -101209,7 +101223,7 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
101209
101223
|
return match2;
|
|
101210
101224
|
}));
|
|
101211
101225
|
};
|
|
101212
|
-
const store$
|
|
101226
|
+
const store$4 = StoreService.getInstance();
|
|
101213
101227
|
SEMANTIZER.getConfiguration().enableLogging();
|
|
101214
101228
|
SEMANTIZER.getConfiguration().registerLoggingEntryCallback((logEntry) => console.log(logEntry.level, logEntry.message));
|
|
101215
101229
|
FilterMixin = {
|
|
@@ -101288,10 +101302,10 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
101288
101302
|
},
|
|
101289
101303
|
onIndexSearch(submitEvent) {
|
|
101290
101304
|
this.localResources["ldp:contains"] = [];
|
|
101291
|
-
if (!hasSetLocalData(store$
|
|
101305
|
+
if (!hasSetLocalData(store$4)) {
|
|
101292
101306
|
throw new Error("Store does not support setLocalData method");
|
|
101293
101307
|
}
|
|
101294
|
-
store$
|
|
101308
|
+
store$4.setLocalData(this.localResources, this.dataSrc, false);
|
|
101295
101309
|
if (this.loader) {
|
|
101296
101310
|
this.loader.toggleAttribute("hidden", false);
|
|
101297
101311
|
}
|
|
@@ -101306,15 +101320,15 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
101306
101320
|
filterValues
|
|
101307
101321
|
};
|
|
101308
101322
|
try {
|
|
101309
|
-
if (!hasQueryIndex(store$
|
|
101323
|
+
if (!hasQueryIndex(store$4)) {
|
|
101310
101324
|
throw new Error("Store does not support queryIndex method");
|
|
101311
101325
|
}
|
|
101312
|
-
const results = await store$
|
|
101326
|
+
const results = await store$4.queryIndex(queryOptions);
|
|
101313
101327
|
this.localResources["ldp:contains"] = results;
|
|
101314
|
-
if (!hasSetLocalData(store$
|
|
101328
|
+
if (!hasSetLocalData(store$4)) {
|
|
101315
101329
|
throw new Error("Store does not support setLocalData method");
|
|
101316
101330
|
}
|
|
101317
|
-
store$
|
|
101331
|
+
store$4.setLocalData(this.localResources, this.dataSrc, true);
|
|
101318
101332
|
this.populate();
|
|
101319
101333
|
if (this.loader) {
|
|
101320
101334
|
this.loader.toggleAttribute("hidden", true);
|
|
@@ -101349,10 +101363,10 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
101349
101363
|
"view"
|
|
101350
101364
|
]
|
|
101351
101365
|
};
|
|
101352
|
-
if (!hasSetLocalData(store$
|
|
101366
|
+
if (!hasSetLocalData(store$4)) {
|
|
101353
101367
|
throw new Error("Store does not support setLocalData method");
|
|
101354
101368
|
}
|
|
101355
|
-
await store$
|
|
101369
|
+
await store$4.setLocalData(this.localResources, this.dataSrc, true);
|
|
101356
101370
|
if (this.loader) this.loader.toggleAttribute("hidden", true);
|
|
101357
101371
|
},
|
|
101358
101372
|
isFilteredOnServer() {
|
|
@@ -101867,6 +101881,10 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
101867
101881
|
}, "SolidDisplay:renderDom"),
|
|
101868
101882
|
getChildAttributes() {
|
|
101869
101883
|
const attributes = {};
|
|
101884
|
+
const storeAttr = this.element.getAttribute("store");
|
|
101885
|
+
if (storeAttr) {
|
|
101886
|
+
attributes["store"] = storeAttr;
|
|
101887
|
+
}
|
|
101870
101888
|
for (const attr of this.element.attributes) {
|
|
101871
101889
|
if (attr.name.startsWith("value-") || attr.name.startsWith("label-") || attr.name.startsWith("placeholder-") || attr.name.startsWith("widget-") || attr.name.startsWith("class-") || attr.name.startsWith("multiple-") || attr.name.startsWith("editable-") || attr.name.startsWith("action-") || attr.name.startsWith("default-") || attr.name.startsWith("link-text-") || attr.name.startsWith("target-src-") || attr.name.startsWith("data-label-") || attr.name === "extra-context") attributes[attr.name] = attr.value;
|
|
101872
101890
|
if (attr.name.startsWith("child-")) attributes[attr.name.replace(/^child-/, "")] = attr.value;
|
|
@@ -101888,6 +101906,10 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
101888
101906
|
],
|
|
101889
101907
|
debounceTimeout: void 0,
|
|
101890
101908
|
attributes: {
|
|
101909
|
+
store: {
|
|
101910
|
+
type: String,
|
|
101911
|
+
default: null
|
|
101912
|
+
},
|
|
101891
101913
|
defaultWidget: {
|
|
101892
101914
|
type: String,
|
|
101893
101915
|
default: "solid-form-label-text"
|
|
@@ -101920,9 +101942,14 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
101920
101942
|
}
|
|
101921
101943
|
},
|
|
101922
101944
|
initialState: {
|
|
101923
|
-
error: ""
|
|
101945
|
+
error: "",
|
|
101946
|
+
store: null
|
|
101924
101947
|
},
|
|
101925
101948
|
created() {
|
|
101949
|
+
this.store = StoreService.getStore(this.element.getAttribute("store"));
|
|
101950
|
+
if (!this.store) {
|
|
101951
|
+
this.store = StoreService.getInstance();
|
|
101952
|
+
}
|
|
101926
101953
|
if (this.element.closest("[no-render]")) this.noRender = "";
|
|
101927
101954
|
this.autoRangeValues = {};
|
|
101928
101955
|
this.rangeId = uniqID();
|
|
@@ -102002,7 +102029,9 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102002
102029
|
"@context": this.context,
|
|
102003
102030
|
"ldp:contains": ldpContains
|
|
102004
102031
|
};
|
|
102005
|
-
|
|
102032
|
+
if (hasSetLocalData(this.store)) {
|
|
102033
|
+
await this.store.setLocalData(data, id);
|
|
102034
|
+
}
|
|
102006
102035
|
}
|
|
102007
102036
|
},
|
|
102008
102037
|
change(resource, eventOptions) {
|
|
@@ -102080,7 +102109,7 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102080
102109
|
}, "SolidFormSearch:populate")
|
|
102081
102110
|
};
|
|
102082
102111
|
Sib.register(SolidFormSearch);
|
|
102083
|
-
const store$
|
|
102112
|
+
const store$3 = StoreService.getInstance();
|
|
102084
102113
|
SolidForm = {
|
|
102085
102114
|
name: "solid-form",
|
|
102086
102115
|
use: [
|
|
@@ -102198,9 +102227,9 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102198
102227
|
let saved;
|
|
102199
102228
|
try {
|
|
102200
102229
|
if (this.partial == null) {
|
|
102201
|
-
saved = resource["@id"] ? await store$
|
|
102230
|
+
saved = resource["@id"] ? await store$3.put(resource, this.resourceId) : await store$3.post(resource, this.resourceId);
|
|
102202
102231
|
} else {
|
|
102203
|
-
saved = await store$
|
|
102232
|
+
saved = await store$3.patch(resource, this.resourceId);
|
|
102204
102233
|
}
|
|
102205
102234
|
} catch (e2) {
|
|
102206
102235
|
this.toggleLoaderHidden(true);
|
|
@@ -102347,12 +102376,14 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102347
102376
|
}, "SolidForm:populate")
|
|
102348
102377
|
};
|
|
102349
102378
|
Sib.register(SolidForm);
|
|
102350
|
-
const store$5 = StoreService.getInstance();
|
|
102351
|
-
if (!store$5) throw new Error("Store is not available");
|
|
102352
102379
|
SolidLang = {
|
|
102353
102380
|
name: "solid-lang",
|
|
102354
102381
|
use: [],
|
|
102355
102382
|
attributes: {
|
|
102383
|
+
store: {
|
|
102384
|
+
type: String,
|
|
102385
|
+
default: null
|
|
102386
|
+
},
|
|
102356
102387
|
lang: {
|
|
102357
102388
|
type: String,
|
|
102358
102389
|
default: null
|
|
@@ -102362,11 +102393,18 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102362
102393
|
default: null
|
|
102363
102394
|
}
|
|
102364
102395
|
},
|
|
102396
|
+
initialState: {
|
|
102397
|
+
store: null
|
|
102398
|
+
},
|
|
102365
102399
|
created() {
|
|
102400
|
+
this.store = StoreService.getStore(this.element.getAttribute("store"));
|
|
102401
|
+
if (!this.store) {
|
|
102402
|
+
this.store = StoreService.getInstance();
|
|
102403
|
+
}
|
|
102366
102404
|
this.render();
|
|
102367
102405
|
},
|
|
102368
102406
|
languageLoader() {
|
|
102369
|
-
store
|
|
102407
|
+
this.store.selectLanguage(this.lang);
|
|
102370
102408
|
location.reload();
|
|
102371
102409
|
},
|
|
102372
102410
|
render() {
|
|
@@ -102375,7 +102413,7 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102375
102413
|
}
|
|
102376
102414
|
};
|
|
102377
102415
|
Sib.register(SolidLang);
|
|
102378
|
-
const store$
|
|
102416
|
+
const store$2 = StoreService.getInstance();
|
|
102379
102417
|
SolidMemberAdd = {
|
|
102380
102418
|
name: "solid-member-add",
|
|
102381
102419
|
use: [
|
|
@@ -102434,7 +102472,7 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102434
102472
|
"@context": this.context,
|
|
102435
102473
|
user_set: this.currentMembers
|
|
102436
102474
|
};
|
|
102437
|
-
return store$
|
|
102475
|
+
return store$2.patch(currentRes, this.resourceId).then((response) => {
|
|
102438
102476
|
if (!response) {
|
|
102439
102477
|
console.warn(`Error while adding user ${this.dataTargetSrc} to group ${this.resourceId}`);
|
|
102440
102478
|
return;
|
|
@@ -102463,7 +102501,7 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102463
102501
|
},
|
|
102464
102502
|
async populate() {
|
|
102465
102503
|
if (!this.resource) return;
|
|
102466
|
-
const memberPredicate = store$
|
|
102504
|
+
const memberPredicate = store$2.getExpandedPredicate("user_set", normalizeContext(base_context));
|
|
102467
102505
|
if (!memberPredicate) return;
|
|
102468
102506
|
this.currentMembers = await this.resource[memberPredicate];
|
|
102469
102507
|
if (!Array.isArray(this.currentMembers)) {
|
|
@@ -102505,7 +102543,6 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102505
102543
|
}
|
|
102506
102544
|
};
|
|
102507
102545
|
Sib.register(SolidMemberAdd);
|
|
102508
|
-
const store$3 = StoreService.getInstance();
|
|
102509
102546
|
SolidMemberDelete = {
|
|
102510
102547
|
name: "solid-member-delete",
|
|
102511
102548
|
use: [
|
|
@@ -102514,6 +102551,10 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102514
102551
|
ContextMixin
|
|
102515
102552
|
],
|
|
102516
102553
|
attributes: {
|
|
102554
|
+
store: {
|
|
102555
|
+
type: String,
|
|
102556
|
+
default: null
|
|
102557
|
+
},
|
|
102517
102558
|
dataSrc: {
|
|
102518
102559
|
type: String,
|
|
102519
102560
|
default: null,
|
|
@@ -102550,16 +102591,21 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102550
102591
|
}
|
|
102551
102592
|
},
|
|
102552
102593
|
initialState: {
|
|
102553
|
-
renderPlanned: false
|
|
102594
|
+
renderPlanned: false,
|
|
102595
|
+
store: null
|
|
102554
102596
|
},
|
|
102555
102597
|
created() {
|
|
102598
|
+
this.store = StoreService.getStore(this.element.getAttribute("store"));
|
|
102599
|
+
if (!this.store) {
|
|
102600
|
+
this.store = StoreService.getInstance();
|
|
102601
|
+
}
|
|
102556
102602
|
this.planRender();
|
|
102557
102603
|
},
|
|
102558
102604
|
async populate() {
|
|
102559
102605
|
if (!this.resourceId) return;
|
|
102560
|
-
this.resource = await store
|
|
102606
|
+
this.resource = await this.store.getData(this.resourceId);
|
|
102561
102607
|
if (!this.resource) return;
|
|
102562
|
-
const memberPredicate = store
|
|
102608
|
+
const memberPredicate = this.store.getExpandedPredicate("user_set", normalizeContext(base_context));
|
|
102563
102609
|
if (!memberPredicate) return;
|
|
102564
102610
|
this.currentMembers = await this.resource[memberPredicate];
|
|
102565
102611
|
if (!Array.isArray(this.currentMembers)) {
|
|
@@ -102598,7 +102644,7 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102598
102644
|
"@context": this.context,
|
|
102599
102645
|
user_set: userSet
|
|
102600
102646
|
};
|
|
102601
|
-
return store
|
|
102647
|
+
return this.store.patch(currentRes, this.dataSrc).then((response) => {
|
|
102602
102648
|
if (!response) {
|
|
102603
102649
|
console.warn(`Error while removing user ${this.dataTargetSrc} from group ${this.dataSrc}`);
|
|
102604
102650
|
return;
|
|
@@ -102646,7 +102692,6 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102646
102692
|
}, "SolidMemberDelete:render")
|
|
102647
102693
|
};
|
|
102648
102694
|
Sib.register(SolidMemberDelete);
|
|
102649
|
-
const store$2 = StoreService.getInstance();
|
|
102650
102695
|
SolidMembership = {
|
|
102651
102696
|
name: "solid-membership",
|
|
102652
102697
|
use: [
|
|
@@ -102655,6 +102700,10 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102655
102700
|
ContextMixin
|
|
102656
102701
|
],
|
|
102657
102702
|
attributes: {
|
|
102703
|
+
store: {
|
|
102704
|
+
type: String,
|
|
102705
|
+
default: null
|
|
102706
|
+
},
|
|
102658
102707
|
dataSrc: {
|
|
102659
102708
|
type: String,
|
|
102660
102709
|
default: null,
|
|
@@ -102686,21 +102735,26 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102686
102735
|
}
|
|
102687
102736
|
},
|
|
102688
102737
|
initialState: {
|
|
102689
|
-
renderPlanned: false
|
|
102738
|
+
renderPlanned: false,
|
|
102739
|
+
store: null
|
|
102690
102740
|
},
|
|
102691
102741
|
created() {
|
|
102742
|
+
this.store = StoreService.getStore(this.element.getAttribute("store"));
|
|
102743
|
+
if (!this.store) {
|
|
102744
|
+
this.store = StoreService.getInstance();
|
|
102745
|
+
}
|
|
102692
102746
|
this.planRender();
|
|
102693
102747
|
},
|
|
102694
102748
|
async populate() {
|
|
102695
|
-
if (!store
|
|
102696
|
-
const currentUserSession = await store
|
|
102749
|
+
if (!this.store.session) return;
|
|
102750
|
+
const currentUserSession = await this.store.session;
|
|
102697
102751
|
if (!currentUserSession) return;
|
|
102698
102752
|
if (!this.dataTargetSrc) this.userId = await currentUserSession.webId;
|
|
102699
102753
|
else this.userId = this.dataTargetSrc;
|
|
102700
102754
|
if (!this.userId) return;
|
|
102701
|
-
this.resource = await store
|
|
102755
|
+
this.resource = await this.store.getData(this.resourceId);
|
|
102702
102756
|
if (!this.resource) return;
|
|
102703
|
-
const memberPredicate = store
|
|
102757
|
+
const memberPredicate = this.store.getExpandedPredicate("user_set", normalizeContext(base_context));
|
|
102704
102758
|
if (!memberPredicate) return;
|
|
102705
102759
|
this.currentMembers = await this.resource[memberPredicate];
|
|
102706
102760
|
if (!Array.isArray(this.currentMembers)) {
|
|
@@ -102737,7 +102791,7 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102737
102791
|
"@context": this.context,
|
|
102738
102792
|
user_set: this.currentMembers
|
|
102739
102793
|
};
|
|
102740
|
-
return store
|
|
102794
|
+
return this.store.patch(currentRes, this.dataSrc).then((response) => {
|
|
102741
102795
|
if (!response) {
|
|
102742
102796
|
console.warn(`Error while joining group ${this.dataSrc} for user ${this.userId}`);
|
|
102743
102797
|
return;
|
|
@@ -102766,7 +102820,7 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
|
|
|
102766
102820
|
"@context": this.context,
|
|
102767
102821
|
user_set: userSet
|
|
102768
102822
|
};
|
|
102769
|
-
return store
|
|
102823
|
+
return this.store.patch(currentRes, this.dataSrc).then((response) => {
|
|
102770
102824
|
if (!response) {
|
|
102771
102825
|
console.warn(`Error while leaving group ${this.dataSrc} for user ${this.userId}`);
|
|
102772
102826
|
return;
|
|
@@ -103587,6 +103641,7 @@ export {
|
|
|
103587
103641
|
SorterMixin,
|
|
103588
103642
|
StoreMixin,
|
|
103589
103643
|
StoreService,
|
|
103644
|
+
StoreType,
|
|
103590
103645
|
index$2 as TemplateAdditionMixins,
|
|
103591
103646
|
index$1 as Templates,
|
|
103592
103647
|
index as TemplatesDependenciesMixins,
|
|
@@ -162,6 +162,20 @@ let __tla = (async () => {
|
|
|
162
162
|
return false;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
+
class AssetValidationError extends Error {
|
|
166
|
+
constructor(message, assetId, validationType, reason, details) {
|
|
167
|
+
super(message);
|
|
168
|
+
__publicField(this, "assetId");
|
|
169
|
+
__publicField(this, "validationType");
|
|
170
|
+
__publicField(this, "reason");
|
|
171
|
+
__publicField(this, "details");
|
|
172
|
+
this.name = "AssetValidationError";
|
|
173
|
+
this.assetId = assetId;
|
|
174
|
+
this.validationType = validationType;
|
|
175
|
+
this.reason = reason;
|
|
176
|
+
this.details = details;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
165
179
|
class DataspaceConnectorStore {
|
|
166
180
|
constructor(config) {
|
|
167
181
|
__publicField(this, "cache");
|
|
@@ -900,39 +914,60 @@ let __tla = (async () => {
|
|
|
900
914
|
}
|
|
901
915
|
async updateAsset(assetId, assetInput) {
|
|
902
916
|
await this.ensureAuthenticated();
|
|
903
|
-
const
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
"
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
917
|
+
const hasAgreement = this.hasValidAgreement(assetId);
|
|
918
|
+
if (hasAgreement) {
|
|
919
|
+
const message = `Cannot update asset ${assetId}: Asset has active contract agreements. Deleting an asset with agreements would invalidate existing contracts. Please terminate or complete all negotiations first.`;
|
|
920
|
+
throw new AssetValidationError(message, assetId, "update", "agreements");
|
|
921
|
+
}
|
|
922
|
+
const negotiations = await this.getAllContractNegotiations();
|
|
923
|
+
const activeNegotiations = negotiations.filter((neg) => neg.state !== "FINALIZED" && neg.state !== "TERMINATED" && neg.assetId === assetId);
|
|
924
|
+
if (activeNegotiations.length > 0) {
|
|
925
|
+
const message = `Cannot update asset ${assetId}: Asset has ${activeNegotiations.length} active contract negotiation(s). Please wait for negotiations to complete or terminate them first.`;
|
|
926
|
+
throw new AssetValidationError(message, assetId, "update", "negotiations", {
|
|
927
|
+
negotiationCount: activeNegotiations.length,
|
|
928
|
+
negotiations: activeNegotiations
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
console.log(`\u26A0\uFE0F Using DELETE + POST pattern to update asset ${assetId}`);
|
|
932
|
+
try {
|
|
933
|
+
const deleted = await this.deleteAsset(assetId, true);
|
|
934
|
+
if (!deleted) {
|
|
935
|
+
throw new Error(`Failed to delete existing asset ${assetId} for update`);
|
|
936
|
+
}
|
|
937
|
+
} catch (deleteError) {
|
|
938
|
+
if (deleteError instanceof AssetValidationError) {
|
|
939
|
+
throw new AssetValidationError(deleteError.message.replace("Cannot delete", "Cannot update"), assetId, "update", deleteError.reason, deleteError.details);
|
|
940
|
+
}
|
|
941
|
+
throw deleteError;
|
|
942
|
+
}
|
|
943
|
+
try {
|
|
944
|
+
const updatedAsset = await this.createAsset(assetInput);
|
|
945
|
+
console.log(`\u2705 Asset ${assetId} updated successfully via DELETE + POST`);
|
|
946
|
+
return updatedAsset;
|
|
947
|
+
} catch (createError) {
|
|
948
|
+
console.error(`\u274C Critical: Failed to recreate asset ${assetId} after deletion`, createError);
|
|
949
|
+
const errorMessage = createError instanceof Error ? createError.message : String(createError);
|
|
950
|
+
throw new Error(`Failed to recreate asset after deletion: ${errorMessage}. Asset ${assetId} has been deleted but not recreated.`);
|
|
923
951
|
}
|
|
924
|
-
const updatedAsset = {
|
|
925
|
-
"@type": "Asset",
|
|
926
|
-
"@id": assetInput["@id"],
|
|
927
|
-
properties: assetInput.properties,
|
|
928
|
-
dataAddress: assetInput.dataAddress,
|
|
929
|
-
createdAt: Date.now()
|
|
930
|
-
};
|
|
931
|
-
await this.cache.set(assetId, updatedAsset);
|
|
932
|
-
return updatedAsset;
|
|
933
952
|
}
|
|
934
|
-
async deleteAsset(assetId) {
|
|
953
|
+
async deleteAsset(assetId, skipAgreementCheck = false) {
|
|
935
954
|
await this.ensureAuthenticated();
|
|
955
|
+
if (!skipAgreementCheck) {
|
|
956
|
+
const hasAgreement = this.hasValidAgreement(assetId);
|
|
957
|
+
if (hasAgreement) {
|
|
958
|
+
const message = `Cannot delete asset ${assetId}: Asset has active contract agreements. Deleting an asset with agreements would invalidate existing contracts. Please terminate or complete all negotiations first.`;
|
|
959
|
+
throw new AssetValidationError(message, assetId, "delete", "agreements");
|
|
960
|
+
}
|
|
961
|
+
const negotiations = await this.getAllContractNegotiations();
|
|
962
|
+
const activeNegotiations = negotiations.filter((neg) => neg.state !== "FINALIZED" && neg.state !== "TERMINATED" && neg.assetId === assetId);
|
|
963
|
+
if (activeNegotiations.length > 0) {
|
|
964
|
+
const message = `Cannot delete asset ${assetId}: Asset has ${activeNegotiations.length} active contract negotiation(s). Please wait for negotiations to complete or terminate them first.`;
|
|
965
|
+
throw new AssetValidationError(message, assetId, "delete", "negotiations", {
|
|
966
|
+
negotiationCount: activeNegotiations.length,
|
|
967
|
+
negotiations: activeNegotiations
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
}
|
|
936
971
|
const apiVersion = this.config.apiVersion || "v3";
|
|
937
972
|
const assetsEndpoint = this.config.assetsEndpoint || this.config.catalogEndpoint.replace("/catalog/request", apiVersion === "v3" ? "/assets" : "/assets");
|
|
938
973
|
const response = await this.fetchAuthn(`${assetsEndpoint}/${assetId}`, {
|
|
@@ -941,9 +976,28 @@ let __tla = (async () => {
|
|
|
941
976
|
});
|
|
942
977
|
if (!response.ok) {
|
|
943
978
|
const errorText = await response.text();
|
|
979
|
+
if (response.status === 409) {
|
|
980
|
+
try {
|
|
981
|
+
const errorDetails = JSON.parse(errorText);
|
|
982
|
+
const errorMessage = Array.isArray(errorDetails) && errorDetails.length > 0 ? errorDetails[0].message : errorText;
|
|
983
|
+
const message = `Cannot delete asset ${assetId}: ${errorMessage}`;
|
|
984
|
+
throw new AssetValidationError(message, assetId, "delete", "agreements", {
|
|
985
|
+
apiResponse: errorDetails
|
|
986
|
+
});
|
|
987
|
+
} catch (parseError) {
|
|
988
|
+
if (parseError instanceof AssetValidationError) {
|
|
989
|
+
throw parseError;
|
|
990
|
+
}
|
|
991
|
+
const message = `Cannot delete asset ${assetId}: ${errorText}`;
|
|
992
|
+
throw new AssetValidationError(message, assetId, "delete", "agreements", {
|
|
993
|
+
rawError: errorText
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
}
|
|
944
997
|
throw new Error(`Failed to delete asset: ${response.status} ${response.statusText} - ${errorText}`);
|
|
945
998
|
}
|
|
946
999
|
await this.cache.delete(assetId);
|
|
1000
|
+
this.assetAgreements.delete(assetId);
|
|
947
1001
|
return true;
|
|
948
1002
|
}
|
|
949
1003
|
async getAllPolicies(querySpec) {
|
|
@@ -1224,8 +1278,13 @@ let __tla = (async () => {
|
|
|
1224
1278
|
__publicField(this, "fcBaseUrl");
|
|
1225
1279
|
__publicField(this, "connect");
|
|
1226
1280
|
this.fcBaseUrl = fcBaseUrl;
|
|
1227
|
-
|
|
1228
|
-
|
|
1281
|
+
try {
|
|
1282
|
+
const connection = this.firstConnect(options);
|
|
1283
|
+
this.connect = () => connection;
|
|
1284
|
+
} catch (e) {
|
|
1285
|
+
console.log("Error while establishing the first connection", e);
|
|
1286
|
+
this.connect = null;
|
|
1287
|
+
}
|
|
1229
1288
|
}
|
|
1230
1289
|
async firstConnect(options) {
|
|
1231
1290
|
const body = new URLSearchParams({
|
|
@@ -1254,6 +1313,7 @@ let __tla = (async () => {
|
|
|
1254
1313
|
return token;
|
|
1255
1314
|
}
|
|
1256
1315
|
async getAllSelfDescriptions() {
|
|
1316
|
+
if (!this.connect) return null;
|
|
1257
1317
|
const token = await this.connect();
|
|
1258
1318
|
const url2 = `${this.fcBaseUrl}/self-descriptions`;
|
|
1259
1319
|
const headers = new Headers({
|
|
@@ -1265,6 +1325,7 @@ let __tla = (async () => {
|
|
|
1265
1325
|
return await response.json();
|
|
1266
1326
|
}
|
|
1267
1327
|
async getSelfDescriptionByHash(sdHash) {
|
|
1328
|
+
if (!this.connect) return null;
|
|
1268
1329
|
const token = await this.connect();
|
|
1269
1330
|
const url2 = `${this.fcBaseUrl}/self-descriptions/${sdHash}`;
|
|
1270
1331
|
const headers = new Headers({
|
|
@@ -1280,6 +1341,7 @@ let __tla = (async () => {
|
|
|
1280
1341
|
return await response.json();
|
|
1281
1342
|
}
|
|
1282
1343
|
async postQuery(statement, parameters = {}) {
|
|
1344
|
+
if (!this.connect) return null;
|
|
1283
1345
|
const token = await this.connect();
|
|
1284
1346
|
const url2 = `${this.fcBaseUrl}/query`;
|
|
1285
1347
|
const headers = new Headers({
|
|
@@ -1303,6 +1365,7 @@ let __tla = (async () => {
|
|
|
1303
1365
|
return await response.json();
|
|
1304
1366
|
}
|
|
1305
1367
|
async postQuerySearch(statement, parameters = {}, queryLanguage = "OPENCYPHER", annotations) {
|
|
1368
|
+
if (!this.connect) return null;
|
|
1306
1369
|
const token = await this.connect();
|
|
1307
1370
|
const url2 = `${this.fcBaseUrl}/query/search`;
|
|
1308
1371
|
const headers = new Headers({
|
|
@@ -1348,11 +1411,23 @@ let __tla = (async () => {
|
|
|
1348
1411
|
if (!this.cfg.optionsServer) {
|
|
1349
1412
|
throw new Error("Missing required `optionsServer` in StoreConfig for FederatedCatalogueStore");
|
|
1350
1413
|
}
|
|
1351
|
-
|
|
1414
|
+
try {
|
|
1415
|
+
this.fcApi = getFederatedCatalogueAPIWrapper(this.cfg.endpoint, this.cfg.login, this.cfg.optionsServer);
|
|
1416
|
+
} catch (e) {
|
|
1417
|
+
console.error("[FederatedCatalogueStore] Failed to initialize API wrapper:", e);
|
|
1418
|
+
this.fcApi = null;
|
|
1419
|
+
}
|
|
1352
1420
|
this.cache = new InMemoryCacheManager();
|
|
1353
1421
|
}
|
|
1422
|
+
resolveTargetType(args) {
|
|
1423
|
+
if (typeof args === "string") return args;
|
|
1424
|
+
if (typeof args === "object" && args !== null) {
|
|
1425
|
+
return args.targetType ?? args.id ?? "";
|
|
1426
|
+
}
|
|
1427
|
+
return "";
|
|
1428
|
+
}
|
|
1354
1429
|
async getData(args) {
|
|
1355
|
-
const targetType =
|
|
1430
|
+
const targetType = this.resolveTargetType(args);
|
|
1356
1431
|
if (!this.fcApi) {
|
|
1357
1432
|
throw new Error("Federated API not initialized, returning empty data.");
|
|
1358
1433
|
}
|
|
@@ -1360,7 +1435,7 @@ let __tla = (async () => {
|
|
|
1360
1435
|
if (!resource || resource["ldp:contains"].length === 0) {
|
|
1361
1436
|
resource = await this.initLocalDataSourceContainer(targetType);
|
|
1362
1437
|
const dataset2 = await this.fcApi.getAllSelfDescriptions();
|
|
1363
|
-
for (const item in dataset2.items) {
|
|
1438
|
+
if (dataset2) for (const item in dataset2.items) {
|
|
1364
1439
|
const sd = await this.fcApi.getSelfDescriptionByHash(dataset2.items[item].meta.sdHash);
|
|
1365
1440
|
if (sd) {
|
|
1366
1441
|
const mappedResource = this.mapSourceToDestination(sd, {
|
|
@@ -1377,7 +1452,7 @@ let __tla = (async () => {
|
|
|
1377
1452
|
document.dispatchEvent(new CustomEvent("save", {
|
|
1378
1453
|
detail: {
|
|
1379
1454
|
resource: {
|
|
1380
|
-
"@id": resource["@id"]
|
|
1455
|
+
"@id": resource == null ? void 0 : resource["@id"]
|
|
1381
1456
|
}
|
|
1382
1457
|
},
|
|
1383
1458
|
bubbles: true
|
|
@@ -1453,7 +1528,7 @@ let __tla = (async () => {
|
|
|
1453
1528
|
fetchAuthn(_iri, _options) {
|
|
1454
1529
|
return Promise.resolve({});
|
|
1455
1530
|
}
|
|
1456
|
-
async setLocalData(resource, id
|
|
1531
|
+
async setLocalData(resource, id) {
|
|
1457
1532
|
try {
|
|
1458
1533
|
const resourceWithId = {
|
|
1459
1534
|
...resource,
|
|
@@ -28499,7 +28574,7 @@ sh:property [
|
|
|
28499
28574
|
this.searchProvider = new SolidIndexingSearchProvider(this.getData.bind(this));
|
|
28500
28575
|
}
|
|
28501
28576
|
async initGetter() {
|
|
28502
|
-
const { CustomGetter } = await import("./custom-getter-
|
|
28577
|
+
const { CustomGetter } = await import("./custom-getter-Dza7na7P.js");
|
|
28503
28578
|
return CustomGetter;
|
|
28504
28579
|
}
|
|
28505
28580
|
async getData(id, context2, parentId, localData, forceFetch, serverPagination, serverSearch, headers, bypassLoadingList) {
|
|
@@ -28895,37 +28970,89 @@ sh:property [
|
|
|
28895
28970
|
StoreFactory.register(StoreType.FederatedCatalogue, FederatedCatalogueStoreAdapter);
|
|
28896
28971
|
StoreFactory.register(StoreType.DataspaceConnector, DataspaceConnectorStoreAdapter);
|
|
28897
28972
|
StoreService = (_a = class {
|
|
28898
|
-
static
|
|
28899
|
-
|
|
28900
|
-
|
|
28901
|
-
|
|
28973
|
+
static addStore(name, config) {
|
|
28974
|
+
const trimmedName = name.trim();
|
|
28975
|
+
if (!trimmedName) {
|
|
28976
|
+
throw new Error("[StoreService] Store name cannot be empty.");
|
|
28977
|
+
}
|
|
28978
|
+
if (!config) {
|
|
28979
|
+
throw new Error("[StoreService] Store configuration is required.");
|
|
28902
28980
|
}
|
|
28903
|
-
StoreService.
|
|
28981
|
+
if (StoreService.stores.has(trimmedName)) {
|
|
28982
|
+
StoreService.logWarning(`Store with name "${trimmedName}" already exists. Overwriting.`);
|
|
28983
|
+
}
|
|
28984
|
+
const store2 = StoreFactory.create(config);
|
|
28985
|
+
StoreService.stores.set(trimmedName, {
|
|
28986
|
+
store: store2,
|
|
28987
|
+
config
|
|
28988
|
+
});
|
|
28989
|
+
return store2;
|
|
28990
|
+
}
|
|
28991
|
+
static getStore(name) {
|
|
28992
|
+
const storeName = StoreService.resolveStoreName(name);
|
|
28993
|
+
if (!storeName) {
|
|
28994
|
+
return null;
|
|
28995
|
+
}
|
|
28996
|
+
const instance = StoreService.stores.get(storeName);
|
|
28997
|
+
if (!instance) {
|
|
28998
|
+
if (storeName === StoreService.defaultStoreName) {
|
|
28999
|
+
return StoreService.fallbackInitIfNeeded();
|
|
29000
|
+
}
|
|
29001
|
+
StoreService.logWarning(`Store with name "${storeName}" not found.`);
|
|
29002
|
+
return null;
|
|
29003
|
+
}
|
|
29004
|
+
return instance.store;
|
|
29005
|
+
}
|
|
29006
|
+
static setDefaultStore(name) {
|
|
29007
|
+
if (!(name == null ? void 0 : name.trim())) {
|
|
29008
|
+
throw new Error("[StoreService] Store name cannot be empty.");
|
|
29009
|
+
}
|
|
29010
|
+
if (!StoreService.stores.has(name)) {
|
|
29011
|
+
throw new Error(`[StoreService] Store with name "${name}" not found.`);
|
|
29012
|
+
}
|
|
29013
|
+
StoreService.defaultStoreName = name;
|
|
29014
|
+
}
|
|
29015
|
+
static init(config) {
|
|
29016
|
+
const storeConfig = config ?? {
|
|
28904
29017
|
type: StoreType.LDP
|
|
28905
29018
|
};
|
|
28906
|
-
|
|
28907
|
-
StoreService.
|
|
29019
|
+
StoreService.addStore(StoreService.defaultStoreName, storeConfig);
|
|
29020
|
+
StoreService.setDefaultStore(StoreService.defaultStoreName);
|
|
28908
29021
|
}
|
|
28909
29022
|
static fallbackInitIfNeeded() {
|
|
28910
|
-
|
|
29023
|
+
let instance = StoreService.stores.get(StoreService.defaultStoreName);
|
|
29024
|
+
if (!instance) {
|
|
28911
29025
|
const defaultConfig = {
|
|
28912
29026
|
type: StoreType.LDP
|
|
28913
29027
|
};
|
|
28914
29028
|
const store2 = StoreFactory.create(defaultConfig);
|
|
28915
|
-
|
|
28916
|
-
|
|
29029
|
+
instance = {
|
|
29030
|
+
store: store2,
|
|
29031
|
+
config: defaultConfig
|
|
29032
|
+
};
|
|
29033
|
+
StoreService.stores.set(StoreService.defaultStoreName, instance);
|
|
28917
29034
|
}
|
|
28918
|
-
return
|
|
29035
|
+
return instance.store;
|
|
28919
29036
|
}
|
|
28920
29037
|
static getInstance() {
|
|
28921
|
-
|
|
28922
|
-
|
|
29038
|
+
const store2 = StoreService.getStore(StoreService.defaultStoreName);
|
|
29039
|
+
if (!store2) {
|
|
29040
|
+
throw new Error("[StoreService] Failed to get or create default store instance.");
|
|
29041
|
+
}
|
|
28923
29042
|
return store2;
|
|
28924
29043
|
}
|
|
28925
|
-
static getConfig() {
|
|
28926
|
-
|
|
29044
|
+
static getConfig(name) {
|
|
29045
|
+
const storeName = StoreService.resolveStoreName(name);
|
|
29046
|
+
const instance = StoreService.stores.get(storeName);
|
|
29047
|
+
return (instance == null ? void 0 : instance.config) || null;
|
|
29048
|
+
}
|
|
29049
|
+
static resolveStoreName(name) {
|
|
29050
|
+
return (name == null ? void 0 : name.trim()) || StoreService.defaultStoreName;
|
|
29051
|
+
}
|
|
29052
|
+
static logWarning(message) {
|
|
29053
|
+
console.warn(`[StoreService] ${message}`);
|
|
28927
29054
|
}
|
|
28928
|
-
}, __publicField(_a, "
|
|
29055
|
+
}, __publicField(_a, "stores", /* @__PURE__ */ new Map()), __publicField(_a, "defaultStoreName", "default"), _a);
|
|
28929
29056
|
var __awaiter$3 = function(thisArg, _arguments, P, generator) {
|
|
28930
29057
|
function adopt(value) {
|
|
28931
29058
|
return value instanceof P ? value : new P(function(resolve) {
|
package/dist/store.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startinblox/core",
|
|
3
|
-
"version": "2.0.6-beta.
|
|
3
|
+
"version": "2.0.6-beta.3",
|
|
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",
|