@startinblox/core 2.0.6-beta.7 → 2.0.6-beta.8

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-pxHgUL4R.js";
5
+ import { S as StoreService } from "./store-D6BkvCFg.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,8 +1,10 @@
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-pxHgUL4R.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-D6BkvCFg.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
+ import { __tla as __tla_1 } from "./store-D6BkvCFg.js";
7
+ import { A, D } from "./store-D6BkvCFg.js";
6
8
  import { k } from "./helpers-vZrb1UDN.js";
7
9
  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;
8
10
  let __tla = Promise.all([
@@ -11,6 +13,12 @@ let __tla = Promise.all([
11
13
  return __tla_0;
12
14
  } catch {
13
15
  }
16
+ })(),
17
+ (() => {
18
+ try {
19
+ return __tla_1;
20
+ } catch {
21
+ }
14
22
  })()
15
23
  ]).then(async () => {
16
24
  var _a2;
@@ -1115,7 +1123,7 @@ Component: ${componentName}
1115
1123
  }, b[d$1("elementProperties")] = /* @__PURE__ */ new Map(), b[d$1("finalized")] = /* @__PURE__ */ new Map(), p$1 == null ? void 0 : p$1({
1116
1124
  ReactiveElement: b
1117
1125
  }), (a$1.reactiveElementVersions ?? (a$1.reactiveElementVersions = [])).push("2.0.4");
1118
- let t$1, i$4, s$2, e$2, h$2, o$3, n$2, r$2, l, c$2, a, u, d, f$2, v, _, m$1, p, g, $, y, T, E, A, C;
1126
+ let t$1, i$4, s$2, e$2, h$2, o$3, n$2, r$2, l, c$2, a, u, d, f$2, v, _, m$1, p, g, $, y, T, E, A2, C;
1119
1127
  t$1 = globalThis;
1120
1128
  i$4 = t$1.trustedTypes;
1121
1129
  s$2 = i$4 ? i$4.createPolicy("lit-html", {
@@ -1147,7 +1155,7 @@ Component: ${componentName}
1147
1155
  x = y(1);
1148
1156
  T = Symbol.for("lit-noChange");
1149
1157
  E = Symbol.for("lit-nothing");
1150
- A = /* @__PURE__ */ new WeakMap();
1158
+ A2 = /* @__PURE__ */ new WeakMap();
1151
1159
  C = r$2.createTreeWalker(r$2, 129);
1152
1160
  function P$1(t2, i2) {
1153
1161
  if (!a(t2) || !t2.hasOwnProperty("raw")) throw Error("invalid template strings array");
@@ -1299,8 +1307,8 @@ Component: ${componentName}
1299
1307
  }
1300
1308
  }
1301
1309
  _$AC(t2) {
1302
- let i2 = A.get(t2.strings);
1303
- return void 0 === i2 && A.set(t2.strings, i2 = new N(t2)), i2;
1310
+ let i2 = A2.get(t2.strings);
1311
+ return void 0 === i2 && A2.set(t2.strings, i2 = new N(t2)), i2;
1304
1312
  }
1305
1313
  k(t2) {
1306
1314
  a(this._$AH) || (this._$AH = [], this._$AR());
@@ -103805,9 +103813,11 @@ ${preview}${JSON.stringify(data).length > 500 ? "..." : ""}`);
103805
103813
  });
103806
103814
  export {
103807
103815
  index$4 as AttributeMixins,
103816
+ A as AuthFetchResolver,
103808
103817
  BaseWidgetMixin,
103809
103818
  index$3 as CallbackMixins,
103810
103819
  CounterMixin,
103820
+ D as DEFAULT_AUTH_SELECTORS,
103811
103821
  EdcAssetsDisplay,
103812
103822
  EdcCatalogDisplay,
103813
103823
  EdcFederatedCatalogDisplay,
@@ -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 { l as isUrlOrRelativePath, m as jsonldContextParserExports, o as getRawContext, n as normalizeContext, q as mergeContexts, c as doesResourceContainList, r as requireJsonldContextParser, v as requireErrorCoded, w as requireLink } from "./helpers-vZrb1UDN.js";
5
- let StoreService, formatAttributesToServerSearchOptions, base_context, StoreType, StoreFactory, hasQueryIndex, formatAttributesToServerPaginationOptions, getDefaultExportFromCjs, hasSetLocalData, sibStore, mergeServerSearchOptions, semantizer;
5
+ let AuthFetchResolver, DEFAULT_AUTH_SELECTORS, StoreService, formatAttributesToServerSearchOptions, base_context, StoreType, StoreFactory, hasQueryIndex, formatAttributesToServerPaginationOptions, getDefaultExportFromCjs, hasSetLocalData, sibStore, mergeServerSearchOptions, semantizer;
6
6
  let __tla = (async () => {
7
7
  var _a;
8
8
  getDefaultExportFromCjs = function(x) {
@@ -1354,6 +1354,78 @@ let __tla = (async () => {
1354
1354
  };
1355
1355
  __publicField(_DataspaceConnectorStoreAdapter, "store");
1356
1356
  let DataspaceConnectorStoreAdapter = _DataspaceConnectorStoreAdapter;
1357
+ DEFAULT_AUTH_SELECTORS = [
1358
+ "sib-auth-oidc",
1359
+ "sib-auth"
1360
+ ];
1361
+ function findAuthElement(selectors = [
1362
+ ...DEFAULT_AUTH_SELECTORS
1363
+ ]) {
1364
+ for (const selector of selectors) {
1365
+ const element = document.querySelector(selector);
1366
+ if (element && typeof element.getFetch === "function") {
1367
+ return element;
1368
+ }
1369
+ }
1370
+ return null;
1371
+ }
1372
+ function getAuthFetch(selectors) {
1373
+ const authElement = findAuthElement(selectors);
1374
+ if (authElement) {
1375
+ try {
1376
+ const authFetch = authElement.getFetch();
1377
+ if (typeof authFetch === "function") {
1378
+ return authFetch;
1379
+ }
1380
+ } catch (error2) {
1381
+ console.warn("[AuthFetchResolver] Error getting auth fetch:", error2);
1382
+ }
1383
+ }
1384
+ return fetch;
1385
+ }
1386
+ function onAuthActivated(callback, eventName = "sib-auth:activated") {
1387
+ const handler2 = (event) => {
1388
+ var _a2;
1389
+ if (((_a2 = event.detail) == null ? void 0 : _a2.fetch) && typeof event.detail.fetch === "function") {
1390
+ callback(event);
1391
+ }
1392
+ };
1393
+ document.addEventListener(eventName, handler2);
1394
+ return () => {
1395
+ document.removeEventListener(eventName, handler2);
1396
+ };
1397
+ }
1398
+ async function waitForAuthElement(selectors = [
1399
+ ...DEFAULT_AUTH_SELECTORS
1400
+ ], timeout = 5e3) {
1401
+ const existing = findAuthElement(selectors);
1402
+ if (existing) {
1403
+ return existing;
1404
+ }
1405
+ return new Promise((resolve, reject) => {
1406
+ const observer = new MutationObserver(() => {
1407
+ const element = findAuthElement(selectors);
1408
+ if (element) {
1409
+ observer.disconnect();
1410
+ resolve(element);
1411
+ }
1412
+ });
1413
+ observer.observe(document.body, {
1414
+ childList: true,
1415
+ subtree: true
1416
+ });
1417
+ setTimeout(() => {
1418
+ observer.disconnect();
1419
+ reject(new Error(`No auth element found with selectors: ${selectors.join(", ")}`));
1420
+ }, timeout);
1421
+ });
1422
+ }
1423
+ AuthFetchResolver = {
1424
+ findAuthElement,
1425
+ getAuthFetch,
1426
+ onAuthActivated,
1427
+ waitForAuthElement
1428
+ };
1357
1429
  const _LocalStorageCacheMetadataManager = class _LocalStorageCacheMetadataManager {
1358
1430
  constructor(endpoint, ttlMs = _LocalStorageCacheMetadataManager.DEFAULT_TTL_MS) {
1359
1431
  this.endpoint = endpoint;
@@ -1539,66 +1611,22 @@ let __tla = (async () => {
1539
1611
  __publicField(_LocalStorageCacheMetadataManager, "DEFAULT_TTL_MS", 2 * 60 * 60 * 1e3);
1540
1612
  let LocalStorageCacheMetadataManager = _LocalStorageCacheMetadataManager;
1541
1613
  class FederatedCatalogueAPIWrapper {
1542
- constructor(options, fcBaseUrl) {
1614
+ constructor(fcBaseUrl, fetchAuth) {
1543
1615
  __publicField(this, "fcBaseUrl");
1544
- __publicField(this, "connect");
1616
+ __publicField(this, "fetch");
1545
1617
  this.fcBaseUrl = fcBaseUrl;
1546
- try {
1547
- const connection = this.firstConnect(options);
1548
- this.connect = () => connection;
1549
- } catch (e) {
1550
- console.log("Error while establishing the first connection", e);
1551
- this.connect = null;
1552
- }
1553
- }
1554
- async firstConnect(options) {
1555
- const body = new URLSearchParams({
1556
- grant_type: options.kc_grant_type,
1557
- client_id: options.kc_client_id,
1558
- client_secret: options.kc_client_secret,
1559
- scope: options.kc_scope,
1560
- username: options.kc_username,
1561
- password: options.kc_password
1562
- });
1563
- const headers = new Headers({
1564
- "Content-Type": "application/x-www-form-urlencoded"
1565
- });
1566
- const response = await fetch(options.kc_url, {
1567
- method: "POST",
1568
- headers,
1569
- body
1570
- });
1571
- const data = await response.json();
1572
- const token = data.access_token;
1573
- if (token == null) {
1574
- throw new Error("connexion fails", {
1575
- cause: data
1576
- });
1577
- }
1578
- return token;
1618
+ const baseFetch = fetchAuth || fetch;
1619
+ this.fetch = baseFetch.bind(globalThis);
1579
1620
  }
1580
1621
  async getAllSelfDescriptions() {
1581
- if (!this.connect) return null;
1582
- const token = await this.connect();
1583
1622
  const url2 = `${this.fcBaseUrl}/self-descriptions`;
1584
- const headers = new Headers({
1585
- Authorization: `Bearer ${token}`
1586
- });
1587
- const response = await fetch(url2, {
1588
- headers
1589
- });
1623
+ const response = await this.fetch(url2);
1590
1624
  return await response.json();
1591
1625
  }
1592
1626
  async getSelfDescriptionByHash(sdHash) {
1593
- if (!this.connect) return null;
1594
- const token = await this.connect();
1595
1627
  const url2 = `${this.fcBaseUrl}/self-descriptions/${sdHash}`;
1596
- const headers = new Headers({
1597
- Authorization: `Bearer ${token}`
1598
- });
1599
- const response = await fetch(url2, {
1600
- method: "GET",
1601
- headers
1628
+ const response = await this.fetch(url2, {
1629
+ method: "GET"
1602
1630
  });
1603
1631
  if (!response.ok) throw new Error(`GET /self-descriptions/${sdHash} failed: ${response.status} ${response.statusText}`, {
1604
1632
  cause: response
@@ -1606,18 +1634,15 @@ let __tla = (async () => {
1606
1634
  return await response.json();
1607
1635
  }
1608
1636
  async postQuery(statement, parameters = {}) {
1609
- if (!this.connect) return null;
1610
- const token = await this.connect();
1611
1637
  const url2 = `${this.fcBaseUrl}/query`;
1612
1638
  const headers = new Headers({
1613
- Authorization: `Bearer ${token}`,
1614
1639
  "Content-Type": "application/json"
1615
1640
  });
1616
1641
  const body = JSON.stringify({
1617
1642
  statement,
1618
1643
  parameters
1619
1644
  });
1620
- const response = await fetch(url2, {
1645
+ const response = await this.fetch(url2, {
1621
1646
  method: "POST",
1622
1647
  headers,
1623
1648
  body
@@ -1630,11 +1655,8 @@ let __tla = (async () => {
1630
1655
  return await response.json();
1631
1656
  }
1632
1657
  async postQuerySearch(statement, parameters = {}, queryLanguage = "OPENCYPHER", annotations) {
1633
- if (!this.connect) return null;
1634
- const token = await this.connect();
1635
1658
  const url2 = `${this.fcBaseUrl}/query/search`;
1636
1659
  const headers = new Headers({
1637
- Authorization: `Bearer ${token}`,
1638
1660
  "Content-Type": "application/json"
1639
1661
  });
1640
1662
  const body = JSON.stringify({
@@ -1644,7 +1666,7 @@ let __tla = (async () => {
1644
1666
  queryLanguage
1645
1667
  }
1646
1668
  });
1647
- const response = await fetch(url2, {
1669
+ const response = await this.fetch(url2, {
1648
1670
  method: "POST",
1649
1671
  headers,
1650
1672
  body
@@ -1657,27 +1679,33 @@ let __tla = (async () => {
1657
1679
  return await response.json();
1658
1680
  }
1659
1681
  }
1660
- function getFederatedCatalogueAPIWrapper(baseUrl, loginOptions) {
1661
- return new FederatedCatalogueAPIWrapper(loginOptions, baseUrl);
1682
+ function getFederatedCatalogueAPIWrapper(baseUrl, fetch2) {
1683
+ return new FederatedCatalogueAPIWrapper(baseUrl, fetch2);
1662
1684
  }
1663
1685
  class FederatedCatalogueStore {
1664
1686
  constructor(cfg) {
1665
1687
  __publicField(this, "cache");
1666
- __publicField(this, "session");
1667
1688
  __publicField(this, "fcApi");
1668
1689
  __publicField(this, "metadataManager");
1669
1690
  __publicField(this, "enableCaching");
1691
+ __publicField(this, "cleanupAuth");
1692
+ __publicField(this, "resolveFetch", (event) => {
1693
+ if (!this.cfg.endpoint) {
1694
+ throw new Error("Missing required `endpoint` in StoreConfig for FederatedCatalogueStore");
1695
+ }
1696
+ if (event.detail.fetch) {
1697
+ this.fcApi = getFederatedCatalogueAPIWrapper(this.cfg.endpoint, event.detail.fetch);
1698
+ }
1699
+ });
1670
1700
  this.cfg = cfg;
1671
- if (!this.cfg.login) {
1672
- throw new Error("Login must be provided for FederatedCatalogueStore");
1673
- }
1674
1701
  if (!this.cfg.endpoint) {
1675
1702
  throw new Error("Missing required `endpoint` in StoreConfig for FederatedCatalogueStore");
1676
1703
  }
1677
- try {
1678
- this.fcApi = getFederatedCatalogueAPIWrapper(this.cfg.endpoint, this.cfg.login);
1679
- } catch (e) {
1680
- console.error("[FederatedCatalogueStore] Failed to initialize API wrapper:", e);
1704
+ const fetchAuth = AuthFetchResolver.getAuthFetch();
1705
+ this.cleanupAuth = AuthFetchResolver.onAuthActivated(this.resolveFetch.bind(this));
1706
+ if (fetchAuth) {
1707
+ this.fcApi = getFederatedCatalogueAPIWrapper(this.cfg.endpoint, fetchAuth);
1708
+ } else {
1681
1709
  this.fcApi = null;
1682
1710
  }
1683
1711
  this.cache = new InMemoryCacheManager();
@@ -1690,6 +1718,10 @@ let __tla = (async () => {
1690
1718
  this.metadataManager = null;
1691
1719
  }
1692
1720
  }
1721
+ disconnectedCallback() {
1722
+ var _a2;
1723
+ (_a2 = this.cleanupAuth) == null ? void 0 : _a2.call(this);
1724
+ }
1693
1725
  handlePageReload() {
1694
1726
  var _a2, _b;
1695
1727
  try {
@@ -1714,6 +1746,11 @@ let __tla = (async () => {
1714
1746
  }
1715
1747
  return "";
1716
1748
  }
1749
+ buildContainerId(containerType = "default") {
1750
+ var _a2;
1751
+ const endpointHash = ((_a2 = this.cfg.endpoint) == null ? void 0 : _a2.replace(/[^a-zA-Z0-9]/g, "")) || "unknown";
1752
+ return `store://local.fc-${endpointHash}-${containerType}/`;
1753
+ }
1717
1754
  async getData(args) {
1718
1755
  var _a2;
1719
1756
  const targetType = this.resolveTargetType(args);
@@ -1759,7 +1796,7 @@ let __tla = (async () => {
1759
1796
  return await this.getFullData(targetType);
1760
1797
  }
1761
1798
  if (!resource["@id"]) {
1762
- resource["@id"] = targetType;
1799
+ resource["@id"] = this.buildContainerId();
1763
1800
  }
1764
1801
  if (!resource["ldp:contains"]) {
1765
1802
  resource["ldp:contains"] = [];
@@ -1851,11 +1888,11 @@ let __tla = (async () => {
1851
1888
  return await this.getFullData(targetType);
1852
1889
  }
1853
1890
  }
1854
- async getFullData(targetType) {
1891
+ async getFullData(_targetType) {
1855
1892
  if (!this.fcApi) {
1856
1893
  throw new Error("Federated API not initialized");
1857
1894
  }
1858
- const resource = await this.initLocalDataSourceContainer(targetType);
1895
+ const resource = await this.initLocalDataSourceContainer();
1859
1896
  const dataset2 = await this.fcApi.getAllSelfDescriptions();
1860
1897
  const newMetadata = [];
1861
1898
  if ((dataset2 == null ? void 0 : dataset2.items) && Array.isArray(dataset2.items)) {
@@ -1899,11 +1936,8 @@ let __tla = (async () => {
1899
1936
  return resource;
1900
1937
  }
1901
1938
  async initLocalDataSourceContainer(dataSrc = "", containerType = "default") {
1902
- var _a2;
1903
- const endpointHash = ((_a2 = this.cfg.endpoint) == null ? void 0 : _a2.replace(/[^a-zA-Z0-9]/g, "")) || "unknown";
1904
- const idField = `fc-${endpointHash}-${containerType}`;
1905
1939
  if (!dataSrc) {
1906
- dataSrc = `store://local.${idField}/`;
1940
+ dataSrc = this.buildContainerId(containerType);
1907
1941
  }
1908
1942
  const localContainer = {
1909
1943
  "@context": "https://cdn.startinblox.com/owl/context.jsonld",
@@ -1964,8 +1998,8 @@ let __tla = (async () => {
1964
1998
  }
1965
1999
  subscribeResourceTo(_resourceId, _nestedResourceId) {
1966
2000
  }
1967
- fetchAuthn(_iri, _options) {
1968
- return Promise.resolve({});
2001
+ async fetchAuthn(_iri, _options) {
2002
+ return await Promise.resolve({});
1969
2003
  }
1970
2004
  async setLocalData(resource, id) {
1971
2005
  try {
@@ -29056,9 +29090,9 @@ sh:property [
29056
29090
  __publicField(this, "loadingList");
29057
29091
  __publicField(this, "headers");
29058
29092
  __publicField(this, "fetch");
29059
- __publicField(this, "session");
29060
29093
  __publicField(this, "contextParser");
29061
29094
  __publicField(this, "searchProvider");
29095
+ __publicField(this, "cleanupAuth");
29062
29096
  __publicField(this, "resolveResource", (id, resolve) => {
29063
29097
  const handler2 = (event) => {
29064
29098
  if (event.detail.id === id) {
@@ -29072,6 +29106,11 @@ sh:property [
29072
29106
  };
29073
29107
  return handler2;
29074
29108
  });
29109
+ __publicField(this, "resolveFetch", (event) => {
29110
+ if (event.detail.fetch) {
29111
+ this.fetch = event.detail.fetch.bind ? event.detail.fetch.bind(globalThis) : event.detail.fetch;
29112
+ }
29113
+ });
29075
29114
  this.storeOptions = storeOptions;
29076
29115
  this.cache = this.storeOptions.cacheManager ?? new InMemoryCacheManager();
29077
29116
  this.subscriptionIndex = /* @__PURE__ */ new Map();
@@ -29082,15 +29121,35 @@ sh:property [
29082
29121
  "Content-Type": "application/ld+json",
29083
29122
  "Cache-Control": "must-revalidate"
29084
29123
  };
29085
- this.fetch = this.storeOptions.fetchMethod;
29086
- this.session = this.storeOptions.session;
29087
29124
  this.contextParser = new jsonldContextParserExports.ContextParser();
29088
29125
  this.searchProvider = new SolidIndexingSearchProvider(this.getData.bind(this));
29126
+ if (this.storeOptions.fetchMethod) {
29127
+ this.fetch = this.storeOptions.fetchMethod.bind(globalThis);
29128
+ } else {
29129
+ const authFetch = AuthFetchResolver.getAuthFetch();
29130
+ this.fetch = authFetch.bind ? authFetch.bind(globalThis) : authFetch;
29131
+ this.cleanupAuth = AuthFetchResolver.onAuthActivated(this.resolveFetch.bind(this));
29132
+ }
29133
+ if (!this.fetch) {
29134
+ this.fetch = fetch;
29135
+ }
29136
+ const event = new CustomEvent("sib-core:loaded", {
29137
+ bubbles: true,
29138
+ composed: true,
29139
+ detail: {
29140
+ store: this
29141
+ }
29142
+ });
29143
+ window.dispatchEvent(event);
29089
29144
  }
29090
29145
  async initGetter() {
29091
- const { CustomGetter } = await import("./custom-getter-DFIdqwHu.js");
29146
+ const { CustomGetter } = await import("./custom-getter-WZPa-O0k.js");
29092
29147
  return CustomGetter;
29093
29148
  }
29149
+ disconnectedCallback() {
29150
+ var _a2;
29151
+ (_a2 = this.cleanupAuth) == null ? void 0 : _a2.call(this);
29152
+ }
29094
29153
  async getData(id, context2, parentId, localData, forceFetch, serverPagination, serverSearch, headers, bypassLoadingList) {
29095
29154
  var _a2;
29096
29155
  let key = id;
@@ -29156,17 +29215,7 @@ sh:property [
29156
29215
  if (!this.fetch) {
29157
29216
  console.warn("No fetch method available");
29158
29217
  }
29159
- let authenticated = false;
29160
- if (this.session) authenticated = await this.session;
29161
- if (this.fetch && authenticated) {
29162
- return this.fetch.then((fn) => {
29163
- return fn(iri, options);
29164
- });
29165
- }
29166
- if (options.headers) {
29167
- options.headers = this._convertHeaders(options.headers);
29168
- }
29169
- return fetch(iri, options).then((response) => response);
29218
+ return await this.fetch(iri, options);
29170
29219
  }
29171
29220
  async fetchData(id, context2 = null, parentId = "", serverPagination, serverSearch, headers) {
29172
29221
  let iri = this._getAbsoluteIri(id, context2, parentId);
@@ -29409,19 +29458,19 @@ sh:property [
29409
29458
  ]);
29410
29459
  }
29411
29460
  _getAbsoluteIri(id, context2, parentId) {
29461
+ var _a2;
29412
29462
  let iri = normalizeContext(context2, base_context).expandTerm(id);
29413
29463
  if (!iri) return "";
29414
- if (parentId && !parentId.startsWith("store://local")) {
29415
- const parentIri = new URL(parentId, document.location.href).href;
29416
- iri = new URL(iri, parentIri).href;
29417
- } else {
29418
- iri = new URL(iri, document.location.href).href;
29464
+ try {
29465
+ const baseHref = ((_a2 = document == null ? void 0 : document.location) == null ? void 0 : _a2.href) || "";
29466
+ const canUseParent = parentId && !parentId.startsWith("store://local");
29467
+ const base = canUseParent ? new URL(parentId, baseHref).href : baseHref;
29468
+ iri = new URL(iri, base).href;
29469
+ } catch (err) {
29470
+ console.log("[LDPStore _getAbsoluteIri()]", err);
29419
29471
  }
29420
29472
  return iri;
29421
29473
  }
29422
- async getSession() {
29423
- return await this.session;
29424
- }
29425
29474
  _getLanguage() {
29426
29475
  return localStorage.getItem("language") || window.navigator.language.slice(0, 2);
29427
29476
  }
@@ -29439,16 +29488,8 @@ sh:property [
29439
29488
  if (window.sibStore) {
29440
29489
  return window.sibStore;
29441
29490
  }
29442
- const storeOptions = {};
29443
- const sibAuth = document.querySelector("sib-auth");
29444
- if (sibAuth) {
29445
- const sibAuthDefined = customElements.whenDefined(sibAuth.localName);
29446
- storeOptions.session = sibAuthDefined.then(() => sibAuth.session);
29447
- storeOptions.fetchMethod = sibAuthDefined.then(() => sibAuth.getFetch());
29448
- }
29449
29491
  const store2 = new LdpStore({
29450
- ..._cfg == null ? void 0 : _cfg.options,
29451
- ...storeOptions
29492
+ ..._cfg == null ? void 0 : _cfg.options
29452
29493
  });
29453
29494
  window.sibStore = store2;
29454
29495
  return store2;
@@ -33622,6 +33663,8 @@ sh:property [
33622
33663
  semantizer = globalThis.SEMANTIZER;
33623
33664
  })();
33624
33665
  export {
33666
+ AuthFetchResolver as A,
33667
+ DEFAULT_AUTH_SELECTORS as D,
33625
33668
  StoreService as S,
33626
33669
  __tla,
33627
33670
  formatAttributesToServerSearchOptions as a,
package/dist/store.js CHANGED
@@ -1,4 +1,4 @@
1
- import { s, S, c, b, i } from "./store-pxHgUL4R.js";
1
+ import { s, S, c, b, i } from "./store-D6BkvCFg.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.7",
3
+ "version": "2.0.6-beta.8",
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",