@startinblox/core 2.0.6-beta.2 → 2.0.6-beta.4

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-DI-dmiKR.js";
5
+ import { S as StoreService } from "./store-BcSuqX-r.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-DI-dmiKR.js";
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-BcSuqX-r.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$f = StoreService.getInstance();
734
- if (!store$f) throw new Error("Store is not available");
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$f.getData(userId["@id"], this.context || base_context) : null;
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$e.getExpandedPredicate(this.arrayField, this.context);
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$e.get(id, serverPagination, serverSearch);
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$e.getData(value, this.context);
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$e.getData(this.resourceId, this.context, void 0, void 0, forceRefetch, serverPagination, serverSearch);
1652
- this._resource = await store$e.get(this.resourceId);
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$e.get(this.resourceId);
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$e.get(this.resourceId);
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$d = StoreService.getInstance();
2495
- if (!store$d) throw new Error("Store is not available");
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$d._getLanguage();
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$c.delete(this.dataSrc, this.context).then((response) => {
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$b = StoreService.getInstance();
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$b.patch(resource, this.valueId);
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$a = StoreService.getInstance();
93737
- if (!store$a) throw new Error("Store is not available");
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$a.fetchAuthn(this.uploadUrl, {
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$9 = StoreService.getInstance();
94168
- if (!store$9) throw new Error("Store is not available");
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$9.get(containerId);
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$9.getData(containerId, this.context, void 0, void 0, true);
94235
+ container = await store$6.getData(containerId, this.context, void 0, void 0, true);
94222
94236
  } else {
94223
- container = await store$9.getData(containerId, this.context);
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$8 = StoreService.getInstance();
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$8.getData(resource["@id"], this.context || base_context);
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$7 = StoreService.getInstance();
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$7)) {
101305
+ if (!hasSetLocalData(store$4)) {
101292
101306
  throw new Error("Store does not support setLocalData method");
101293
101307
  }
101294
- store$7.setLocalData(this.localResources, this.dataSrc, false);
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$7)) {
101323
+ if (!hasQueryIndex(store$4)) {
101310
101324
  throw new Error("Store does not support queryIndex method");
101311
101325
  }
101312
- const results = await store$7.queryIndex(queryOptions);
101326
+ const results = await store$4.queryIndex(queryOptions);
101313
101327
  this.localResources["ldp:contains"] = results;
101314
- if (!hasSetLocalData(store$7)) {
101328
+ if (!hasSetLocalData(store$4)) {
101315
101329
  throw new Error("Store does not support setLocalData method");
101316
101330
  }
101317
- store$7.setLocalData(this.localResources, this.dataSrc, true);
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$7)) {
101366
+ if (!hasSetLocalData(store$4)) {
101353
101367
  throw new Error("Store does not support setLocalData method");
101354
101368
  }
101355
- await store$7.setLocalData(this.localResources, this.dataSrc, true);
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
- await sibStore.setLocalData(data, id);
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$6 = StoreService.getInstance();
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$6.put(resource, this.resourceId) : await store$6.post(resource, this.resourceId);
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$6.patch(resource, this.resourceId);
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$5.selectLanguage(this.lang);
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$4 = StoreService.getInstance();
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$4.patch(currentRes, this.resourceId).then((response) => {
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$4.getExpandedPredicate("user_set", normalizeContext(base_context));
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$3.getData(this.resourceId);
102606
+ this.resource = await this.store.getData(this.resourceId);
102561
102607
  if (!this.resource) return;
102562
- const memberPredicate = store$3.getExpandedPredicate("user_set", normalizeContext(base_context));
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$3.patch(currentRes, this.dataSrc).then((response) => {
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$2.session) return;
102696
- const currentUserSession = await store$2.session;
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$2.getData(this.resourceId);
102755
+ this.resource = await this.store.getData(this.resourceId);
102702
102756
  if (!this.resource) return;
102703
- const memberPredicate = store$2.getExpandedPredicate("user_set", normalizeContext(base_context));
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$2.patch(currentRes, this.dataSrc).then((response) => {
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$2.patch(currentRes, this.dataSrc).then((response) => {
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,
@@ -1278,8 +1278,13 @@ let __tla = (async () => {
1278
1278
  __publicField(this, "fcBaseUrl");
1279
1279
  __publicField(this, "connect");
1280
1280
  this.fcBaseUrl = fcBaseUrl;
1281
- const connection = this.firstConnect(options);
1282
- this.connect = () => connection;
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
+ }
1283
1288
  }
1284
1289
  async firstConnect(options) {
1285
1290
  const body = new URLSearchParams({
@@ -1308,6 +1313,7 @@ let __tla = (async () => {
1308
1313
  return token;
1309
1314
  }
1310
1315
  async getAllSelfDescriptions() {
1316
+ if (!this.connect) return null;
1311
1317
  const token = await this.connect();
1312
1318
  const url2 = `${this.fcBaseUrl}/self-descriptions`;
1313
1319
  const headers = new Headers({
@@ -1319,6 +1325,7 @@ let __tla = (async () => {
1319
1325
  return await response.json();
1320
1326
  }
1321
1327
  async getSelfDescriptionByHash(sdHash) {
1328
+ if (!this.connect) return null;
1322
1329
  const token = await this.connect();
1323
1330
  const url2 = `${this.fcBaseUrl}/self-descriptions/${sdHash}`;
1324
1331
  const headers = new Headers({
@@ -1334,6 +1341,7 @@ let __tla = (async () => {
1334
1341
  return await response.json();
1335
1342
  }
1336
1343
  async postQuery(statement, parameters = {}) {
1344
+ if (!this.connect) return null;
1337
1345
  const token = await this.connect();
1338
1346
  const url2 = `${this.fcBaseUrl}/query`;
1339
1347
  const headers = new Headers({
@@ -1357,6 +1365,7 @@ let __tla = (async () => {
1357
1365
  return await response.json();
1358
1366
  }
1359
1367
  async postQuerySearch(statement, parameters = {}, queryLanguage = "OPENCYPHER", annotations) {
1368
+ if (!this.connect) return null;
1360
1369
  const token = await this.connect();
1361
1370
  const url2 = `${this.fcBaseUrl}/query/search`;
1362
1371
  const headers = new Headers({
@@ -1383,9 +1392,8 @@ let __tla = (async () => {
1383
1392
  return await response.json();
1384
1393
  }
1385
1394
  }
1386
- function getFederatedCatalogueAPIWrapper(baseUrl, optionLogin, optionsServer) {
1387
- const options = Object.assign({}, optionsServer, optionLogin);
1388
- return new FederatedCatalogueAPIWrapper(options, baseUrl);
1395
+ function getFederatedCatalogueAPIWrapper(baseUrl, loginOptions) {
1396
+ return new FederatedCatalogueAPIWrapper(loginOptions, baseUrl);
1389
1397
  }
1390
1398
  class FederatedCatalogueStore {
1391
1399
  constructor(cfg) {
@@ -1399,14 +1407,23 @@ let __tla = (async () => {
1399
1407
  if (!this.cfg.endpoint) {
1400
1408
  throw new Error("Missing required `endpoint` in StoreConfig for FederatedCatalogueStore");
1401
1409
  }
1402
- if (!this.cfg.optionsServer) {
1403
- throw new Error("Missing required `optionsServer` in StoreConfig for FederatedCatalogueStore");
1410
+ try {
1411
+ this.fcApi = getFederatedCatalogueAPIWrapper(this.cfg.endpoint, this.cfg.login);
1412
+ } catch (e) {
1413
+ console.error("[FederatedCatalogueStore] Failed to initialize API wrapper:", e);
1414
+ this.fcApi = null;
1404
1415
  }
1405
- this.fcApi = getFederatedCatalogueAPIWrapper(this.cfg.endpoint, this.cfg.login, this.cfg.optionsServer);
1406
1416
  this.cache = new InMemoryCacheManager();
1407
1417
  }
1418
+ resolveTargetType(args) {
1419
+ if (typeof args === "string") return args;
1420
+ if (typeof args === "object" && args !== null) {
1421
+ return args.targetType ?? args.id ?? "";
1422
+ }
1423
+ return "";
1424
+ }
1408
1425
  async getData(args) {
1409
- const targetType = "targetType" in args ? args.targetType : args.id;
1426
+ const targetType = this.resolveTargetType(args);
1410
1427
  if (!this.fcApi) {
1411
1428
  throw new Error("Federated API not initialized, returning empty data.");
1412
1429
  }
@@ -1414,7 +1431,7 @@ let __tla = (async () => {
1414
1431
  if (!resource || resource["ldp:contains"].length === 0) {
1415
1432
  resource = await this.initLocalDataSourceContainer(targetType);
1416
1433
  const dataset2 = await this.fcApi.getAllSelfDescriptions();
1417
- for (const item in dataset2.items) {
1434
+ if (dataset2) for (const item in dataset2.items) {
1418
1435
  const sd = await this.fcApi.getSelfDescriptionByHash(dataset2.items[item].meta.sdHash);
1419
1436
  if (sd) {
1420
1437
  const mappedResource = this.mapSourceToDestination(sd, {
@@ -1431,7 +1448,7 @@ let __tla = (async () => {
1431
1448
  document.dispatchEvent(new CustomEvent("save", {
1432
1449
  detail: {
1433
1450
  resource: {
1434
- "@id": resource["@id"]
1451
+ "@id": resource == null ? void 0 : resource["@id"]
1435
1452
  }
1436
1453
  },
1437
1454
  bubbles: true
@@ -1507,7 +1524,7 @@ let __tla = (async () => {
1507
1524
  fetchAuthn(_iri, _options) {
1508
1525
  return Promise.resolve({});
1509
1526
  }
1510
- async setLocalData(resource, id, _skipFetch) {
1527
+ async setLocalData(resource, id) {
1511
1528
  try {
1512
1529
  const resourceWithId = {
1513
1530
  ...resource,
@@ -28553,7 +28570,7 @@ sh:property [
28553
28570
  this.searchProvider = new SolidIndexingSearchProvider(this.getData.bind(this));
28554
28571
  }
28555
28572
  async initGetter() {
28556
- const { CustomGetter } = await import("./custom-getter-C9i4kdAJ.js");
28573
+ const { CustomGetter } = await import("./custom-getter-BZ0qtPQ6.js");
28557
28574
  return CustomGetter;
28558
28575
  }
28559
28576
  async getData(id, context2, parentId, localData, forceFetch, serverPagination, serverSearch, headers, bypassLoadingList) {
@@ -28949,37 +28966,89 @@ sh:property [
28949
28966
  StoreFactory.register(StoreType.FederatedCatalogue, FederatedCatalogueStoreAdapter);
28950
28967
  StoreFactory.register(StoreType.DataspaceConnector, DataspaceConnectorStoreAdapter);
28951
28968
  StoreService = (_a = class {
28952
- static init(config) {
28953
- if (StoreService.currentStore) {
28954
- console.warn("[StoreService] Store already initialized. Ignoring duplicate init.");
28955
- return;
28969
+ static addStore(name, config) {
28970
+ const trimmedName = name.trim();
28971
+ if (!trimmedName) {
28972
+ throw new Error("[StoreService] Store name cannot be empty.");
28973
+ }
28974
+ if (!config) {
28975
+ throw new Error("[StoreService] Store configuration is required.");
28976
+ }
28977
+ if (StoreService.stores.has(trimmedName)) {
28978
+ StoreService.logWarning(`Store with name "${trimmedName}" already exists. Overwriting.`);
28956
28979
  }
28957
- StoreService.currentConfig = config ?? {
28980
+ const store2 = StoreFactory.create(config);
28981
+ StoreService.stores.set(trimmedName, {
28982
+ store: store2,
28983
+ config
28984
+ });
28985
+ return store2;
28986
+ }
28987
+ static getStore(name) {
28988
+ const storeName = StoreService.resolveStoreName(name);
28989
+ if (!storeName) {
28990
+ return null;
28991
+ }
28992
+ const instance = StoreService.stores.get(storeName);
28993
+ if (!instance) {
28994
+ if (storeName === StoreService.defaultStoreName) {
28995
+ return StoreService.fallbackInitIfNeeded();
28996
+ }
28997
+ StoreService.logWarning(`Store with name "${storeName}" not found.`);
28998
+ return null;
28999
+ }
29000
+ return instance.store;
29001
+ }
29002
+ static setDefaultStore(name) {
29003
+ if (!(name == null ? void 0 : name.trim())) {
29004
+ throw new Error("[StoreService] Store name cannot be empty.");
29005
+ }
29006
+ if (!StoreService.stores.has(name)) {
29007
+ throw new Error(`[StoreService] Store with name "${name}" not found.`);
29008
+ }
29009
+ StoreService.defaultStoreName = name;
29010
+ }
29011
+ static init(config) {
29012
+ const storeConfig = config ?? {
28958
29013
  type: StoreType.LDP
28959
29014
  };
28960
- const store2 = StoreFactory.create(StoreService.currentConfig);
28961
- StoreService.currentStore = store2;
29015
+ StoreService.addStore(StoreService.defaultStoreName, storeConfig);
29016
+ StoreService.setDefaultStore(StoreService.defaultStoreName);
28962
29017
  }
28963
29018
  static fallbackInitIfNeeded() {
28964
- if (!StoreService.currentStore) {
29019
+ let instance = StoreService.stores.get(StoreService.defaultStoreName);
29020
+ if (!instance) {
28965
29021
  const defaultConfig = {
28966
29022
  type: StoreType.LDP
28967
29023
  };
28968
29024
  const store2 = StoreFactory.create(defaultConfig);
28969
- StoreService.currentStore = store2;
28970
- StoreService.currentConfig = defaultConfig;
29025
+ instance = {
29026
+ store: store2,
29027
+ config: defaultConfig
29028
+ };
29029
+ StoreService.stores.set(StoreService.defaultStoreName, instance);
28971
29030
  }
28972
- return StoreService.currentStore;
29031
+ return instance.store;
28973
29032
  }
28974
29033
  static getInstance() {
28975
- if (StoreService.currentStore) return StoreService.currentStore;
28976
- const store2 = StoreService.fallbackInitIfNeeded();
29034
+ const store2 = StoreService.getStore(StoreService.defaultStoreName);
29035
+ if (!store2) {
29036
+ throw new Error("[StoreService] Failed to get or create default store instance.");
29037
+ }
28977
29038
  return store2;
28978
29039
  }
28979
- static getConfig() {
28980
- return StoreService.currentConfig;
29040
+ static getConfig(name) {
29041
+ const storeName = StoreService.resolveStoreName(name);
29042
+ const instance = StoreService.stores.get(storeName);
29043
+ return (instance == null ? void 0 : instance.config) || null;
29044
+ }
29045
+ static resolveStoreName(name) {
29046
+ return (name == null ? void 0 : name.trim()) || StoreService.defaultStoreName;
29047
+ }
29048
+ static logWarning(message) {
29049
+ console.warn(`[StoreService] ${message}`);
28981
29050
  }
28982
- }, __publicField(_a, "currentStore", null), __publicField(_a, "currentConfig", null), _a);
29051
+ }, __publicField(_a, "stores", /* @__PURE__ */ new Map()), __publicField(_a, "defaultStoreName", "default"), _a);
28983
29052
  var __awaiter$3 = function(thisArg, _arguments, P, generator) {
28984
29053
  function adopt(value) {
28985
29054
  return value instanceof P ? value : new P(function(resolve) {
package/dist/store.js CHANGED
@@ -1,4 +1,4 @@
1
- import { s, S, b, i } from "./store-DI-dmiKR.js";
1
+ import { s, S, b, i } from "./store-BcSuqX-r.js";
2
2
  export {
3
3
  s as SEMANTIZER,
4
4
  S as StoreService,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startinblox/core",
3
- "version": "2.0.6-beta.2",
3
+ "version": "2.0.6-beta.4",
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",