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

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.
@@ -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 { 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";
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-DtCY-jxq.js";
5
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;
@@ -9,7 +9,7 @@ let __tla = (async () => {
9
9
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
10
10
  };
11
11
  function getAugmentedNamespace(n) {
12
- if (n.__esModule) return n;
12
+ if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n;
13
13
  var f = n.default;
14
14
  if (typeof f == "function") {
15
15
  var a = function a2() {
@@ -268,6 +268,17 @@ let __tla = (async () => {
268
268
  }
269
269
  async negotiateContract(counterPartyAddress, _offerId, policy, counterPartyId) {
270
270
  await this.ensureAuthenticated();
271
+ console.log("[DataspaceConnectorStore] Received policy for negotiation:", policy);
272
+ console.log("[DataspaceConnectorStore] Policy keys:", Object.keys(policy));
273
+ const cleanPolicy = {};
274
+ for (const key in policy) {
275
+ if (!/^\d+$/.test(key)) {
276
+ cleanPolicy[key] = policy[key];
277
+ } else {
278
+ console.warn(`[DataspaceConnectorStore] Removing numeric key "${key}" from policy`);
279
+ }
280
+ }
281
+ console.log("[DataspaceConnectorStore] Cleaned policy keys:", Object.keys(cleanPolicy));
271
282
  const negotiationRequest = {
272
283
  "@context": {
273
284
  "@vocab": "https://w3id.org/edc/v0.0.1/ns/"
@@ -278,13 +289,15 @@ let __tla = (async () => {
278
289
  protocol: "dataspace-protocol-http",
279
290
  policy: {
280
291
  "@context": "http://www.w3.org/ns/odrl.jsonld",
281
- ...policy,
282
- "@type": policy["@type"] || "Offer",
283
- assigner: policy.assigner || counterPartyId || "provider",
284
- target: policy.target
292
+ ...cleanPolicy,
293
+ "@type": cleanPolicy["@type"] || policy["@type"] || "Offer",
294
+ assigner: cleanPolicy.assigner || policy.assigner || counterPartyId || "provider",
295
+ target: cleanPolicy.target || cleanPolicy["odrl:target"] || policy.target || policy["odrl:target"],
296
+ "odrl:target": cleanPolicy["odrl:target"] || cleanPolicy.target || policy["odrl:target"] || policy.target
285
297
  }
286
298
  };
287
299
  console.log("[DataspaceConnectorStore] Contract negotiation request:", JSON.stringify(negotiationRequest, null, 2));
300
+ console.log("[DataspaceConnectorStore] \u{1F50D} POSTing negotiation to consumer connector:", this.config.contractNegotiationEndpoint);
288
301
  const response = await this.fetchAuthn(this.config.contractNegotiationEndpoint, {
289
302
  method: "POST",
290
303
  headers: this.headers,
@@ -705,11 +718,11 @@ let __tla = (async () => {
705
718
  async ensureAuthenticated() {
706
719
  if (this.authToken && this.headers) return;
707
720
  switch (this.config.authMethod) {
708
- case "edc-api-key":
709
- if (!this.config.edcApiKey) {
710
- throw new Error("EDC API key required but not provided. Set edcApiKey in configuration.");
721
+ case "dsp-api-key":
722
+ if (!this.config.dspApiKey) {
723
+ throw new Error("DSP API key required but not provided. Set dspApiKey in configuration.");
711
724
  }
712
- this.authToken = this.config.edcApiKey;
725
+ this.authToken = this.config.dspApiKey;
713
726
  this.headers = {
714
727
  ...this.headers,
715
728
  "X-Api-Key": this.authToken
@@ -1339,21 +1352,28 @@ let __tla = (async () => {
1339
1352
  return property;
1340
1353
  }
1341
1354
  }
1342
- const _DataspaceConnectorStoreAdapter = class _DataspaceConnectorStoreAdapter {
1355
+ class DataspaceConnectorStoreAdapter {
1343
1356
  constructor() {
1344
1357
  }
1345
1358
  static getStoreInstance(cfg) {
1346
- if (!_DataspaceConnectorStoreAdapter.store) {
1347
- if (!cfg) {
1348
- throw new Error("DataspaceConnectorStore configuration is required");
1349
- }
1350
- _DataspaceConnectorStoreAdapter.store = new DataspaceConnectorStore(cfg);
1351
- }
1352
- return _DataspaceConnectorStoreAdapter.store;
1359
+ var _a2;
1360
+ if (!cfg) {
1361
+ throw new Error("DataspaceConnectorStore configuration is required");
1362
+ }
1363
+ const dspConfig = cfg;
1364
+ console.log("\u{1F3ED} [DataspaceConnectorStoreAdapter.getStoreInstance] Creating new store with config:", {
1365
+ endpoint: dspConfig.endpoint,
1366
+ catalogEndpoint: dspConfig.catalogEndpoint,
1367
+ negotiationEndpoint: dspConfig.contractNegotiationEndpoint
1368
+ });
1369
+ const newStore = new DataspaceConnectorStore(dspConfig);
1370
+ console.log("\u2705 [DataspaceConnectorStoreAdapter.getStoreInstance] Created store:", {
1371
+ storeType: typeof newStore,
1372
+ configEndpoint: (_a2 = newStore.config) == null ? void 0 : _a2.endpoint
1373
+ });
1374
+ return newStore;
1353
1375
  }
1354
- };
1355
- __publicField(_DataspaceConnectorStoreAdapter, "store");
1356
- let DataspaceConnectorStoreAdapter = _DataspaceConnectorStoreAdapter;
1376
+ }
1357
1377
  DEFAULT_AUTH_SELECTORS = [
1358
1378
  "sib-auth-oidc",
1359
1379
  "sib-auth"
@@ -1381,7 +1401,7 @@ let __tla = (async () => {
1381
1401
  console.warn("[AuthFetchResolver] Error getting auth fetch:", error2);
1382
1402
  }
1383
1403
  }
1384
- return fetch;
1404
+ return fetch.bind(globalThis);
1385
1405
  }
1386
1406
  function onAuthActivated(callback, eventName = "sib-auth:activated") {
1387
1407
  const handler2 = (event) => {
@@ -1611,21 +1631,218 @@ let __tla = (async () => {
1611
1631
  __publicField(_LocalStorageCacheMetadataManager, "DEFAULT_TTL_MS", 2 * 60 * 60 * 1e3);
1612
1632
  let LocalStorageCacheMetadataManager = _LocalStorageCacheMetadataManager;
1613
1633
  class FederatedCatalogueAPIWrapper {
1614
- constructor(fcBaseUrl, fetchAuth) {
1634
+ constructor(options, fcBaseUrl, fetchAuth) {
1615
1635
  __publicField(this, "fcBaseUrl");
1616
- __publicField(this, "fetch");
1636
+ __publicField(this, "loginOptions");
1637
+ __publicField(this, "tokenState", null);
1638
+ __publicField(this, "tokenRefreshBuffer", 5 * 60 * 1e3);
1639
+ __publicField(this, "isRefreshing", false);
1640
+ __publicField(this, "refreshPromise", null);
1641
+ __publicField(this, "STORAGE_KEY", "fc_token_state");
1642
+ __publicField(this, "_fetch");
1643
+ __publicField(this, "useKeycloakAuth");
1617
1644
  this.fcBaseUrl = fcBaseUrl;
1618
- const baseFetch = fetchAuth || fetch;
1619
- this.fetch = baseFetch.bind(globalThis);
1645
+ this.loginOptions = options;
1646
+ if (fetchAuth && (!options.kc_url || options.kc_url === "")) {
1647
+ this._fetch = fetchAuth;
1648
+ this.useKeycloakAuth = false;
1649
+ } else {
1650
+ this._fetch = fetch.bind(globalThis);
1651
+ this.useKeycloakAuth = true;
1652
+ this.loadTokenState();
1653
+ }
1654
+ if (this.useKeycloakAuth) {
1655
+ try {
1656
+ this.firstConnect(options);
1657
+ } catch (e) {
1658
+ console.log("Error while establishing the first connection", e);
1659
+ }
1660
+ }
1661
+ }
1662
+ saveTokenState() {
1663
+ if (this.tokenState) {
1664
+ try {
1665
+ localStorage.setItem(this.STORAGE_KEY, JSON.stringify(this.tokenState));
1666
+ console.log("\u{1F4BE} [FederatedCatalogueAPIWrapper] Token state saved to localStorage");
1667
+ } catch (error2) {
1668
+ console.error("Failed to save token state to localStorage:", error2);
1669
+ }
1670
+ }
1671
+ }
1672
+ loadTokenState() {
1673
+ var _a2, _b, _c;
1674
+ try {
1675
+ const stored = localStorage.getItem(this.STORAGE_KEY);
1676
+ if (stored) {
1677
+ this.tokenState = JSON.parse(stored);
1678
+ console.log("\u{1F4C2} [FederatedCatalogueAPIWrapper] Token state loaded from localStorage:", {
1679
+ hasAccessToken: !!((_a2 = this.tokenState) == null ? void 0 : _a2.access_token),
1680
+ hasRefreshToken: !!((_b = this.tokenState) == null ? void 0 : _b.refresh_token),
1681
+ expiresAt: (_c = this.tokenState) == null ? void 0 : _c.expires_at,
1682
+ isExpired: this.tokenState ? Date.now() >= this.tokenState.expires_at : "N/A"
1683
+ });
1684
+ }
1685
+ } catch (error2) {
1686
+ console.error("Failed to load token state from localStorage:", error2);
1687
+ this.clearTokenState();
1688
+ }
1689
+ }
1690
+ clearTokenState() {
1691
+ this.tokenState = null;
1692
+ try {
1693
+ localStorage.removeItem(this.STORAGE_KEY);
1694
+ console.log("\u{1F5D1}\uFE0F [FederatedCatalogueAPIWrapper] Token state cleared");
1695
+ } catch (error2) {
1696
+ console.error("Failed to clear token state from localStorage:", error2);
1697
+ }
1698
+ }
1699
+ async firstConnect(options) {
1700
+ const body = new URLSearchParams({
1701
+ grant_type: options.kc_grant_type,
1702
+ client_id: options.kc_client_id,
1703
+ client_secret: options.kc_client_secret,
1704
+ scope: options.kc_scope,
1705
+ username: options.kc_username,
1706
+ password: options.kc_password
1707
+ });
1708
+ const headers = new Headers({
1709
+ "Content-Type": "application/x-www-form-urlencoded"
1710
+ });
1711
+ const response = await this._fetch(options.kc_url, {
1712
+ method: "POST",
1713
+ headers,
1714
+ body
1715
+ });
1716
+ const data = await response.json();
1717
+ const token = data.access_token;
1718
+ if (token == null) {
1719
+ throw new Error("connexion fails", {
1720
+ cause: data
1721
+ });
1722
+ }
1723
+ this.tokenState = {
1724
+ access_token: token,
1725
+ refresh_token: data.refresh_token || null,
1726
+ expires_at: Date.now() + (data.expires_in || 3600) * 1e3
1727
+ };
1728
+ this.saveTokenState();
1729
+ return token;
1730
+ }
1731
+ async refreshToken() {
1732
+ if (this.isRefreshing && this.refreshPromise) {
1733
+ return this.refreshPromise;
1734
+ }
1735
+ this.isRefreshing = true;
1736
+ this.refreshPromise = this._performRefresh();
1737
+ try {
1738
+ const token = await this.refreshPromise;
1739
+ return token;
1740
+ } finally {
1741
+ this.isRefreshing = false;
1742
+ this.refreshPromise = null;
1743
+ }
1744
+ }
1745
+ async _performRefresh() {
1746
+ var _a2;
1747
+ if (!((_a2 = this.tokenState) == null ? void 0 : _a2.refresh_token)) {
1748
+ console.log("No refresh token available, re-authenticating with credentials");
1749
+ return this.firstConnect(this.loginOptions);
1750
+ }
1751
+ try {
1752
+ const body = new URLSearchParams({
1753
+ grant_type: "refresh_token",
1754
+ client_id: this.loginOptions.kc_client_id,
1755
+ client_secret: this.loginOptions.kc_client_secret,
1756
+ refresh_token: this.tokenState.refresh_token
1757
+ });
1758
+ const headers = new Headers({
1759
+ "Content-Type": "application/x-www-form-urlencoded"
1760
+ });
1761
+ const response = await this._fetch(this.loginOptions.kc_url, {
1762
+ method: "POST",
1763
+ headers,
1764
+ body
1765
+ });
1766
+ if (!response.ok) {
1767
+ console.warn("Token refresh failed, re-authenticating with credentials");
1768
+ return this.firstConnect(this.loginOptions);
1769
+ }
1770
+ const data = await response.json();
1771
+ const token = data.access_token;
1772
+ if (token == null) {
1773
+ throw new Error("Token refresh failed: no access_token in response", {
1774
+ cause: data
1775
+ });
1776
+ }
1777
+ this.tokenState = {
1778
+ access_token: token,
1779
+ refresh_token: data.refresh_token || this.tokenState.refresh_token,
1780
+ expires_at: Date.now() + (data.expires_in || 3600) * 1e3
1781
+ };
1782
+ this.saveTokenState();
1783
+ return token;
1784
+ } catch (error2) {
1785
+ console.error("Error refreshing token:", error2);
1786
+ this.clearTokenState();
1787
+ return this.firstConnect(this.loginOptions);
1788
+ }
1789
+ }
1790
+ async getValidToken() {
1791
+ if (!this.tokenState) {
1792
+ return await this.firstConnect(this.loginOptions);
1793
+ }
1794
+ const now = Date.now();
1795
+ const isExpiringSoon = now >= this.tokenState.expires_at - this.tokenRefreshBuffer;
1796
+ if (isExpiringSoon) {
1797
+ return await this.refreshToken();
1798
+ }
1799
+ return this.tokenState.access_token;
1800
+ }
1801
+ async fetchWithAuth(url2, options = {}) {
1802
+ var _a2;
1803
+ if (!this.useKeycloakAuth) {
1804
+ return this._fetch(url2, options);
1805
+ }
1806
+ const token = await this.getValidToken();
1807
+ const headers = new Headers(options.headers);
1808
+ headers.set("Authorization", `Bearer ${token}`);
1809
+ let response = await this._fetch(url2, {
1810
+ ...options,
1811
+ headers
1812
+ });
1813
+ if (response.status === 401 || response.status === 403) {
1814
+ console.log(`\u{1F510} [FederatedCatalogueAPIWrapper] Authentication failed (${response.status}) for ${url2}`);
1815
+ console.log("\u{1F504} [FederatedCatalogueAPIWrapper] Attempting token refresh...", {
1816
+ hasRefreshToken: !!((_a2 = this.tokenState) == null ? void 0 : _a2.refresh_token),
1817
+ tokenExpired: this.tokenState ? Date.now() >= this.tokenState.expires_at : "N/A"
1818
+ });
1819
+ try {
1820
+ const newToken = await this.refreshToken();
1821
+ console.log("\u2705 [FederatedCatalogueAPIWrapper] Token refreshed successfully, retrying request...");
1822
+ headers.set("Authorization", `Bearer ${newToken}`);
1823
+ response = await this._fetch(url2, {
1824
+ ...options,
1825
+ headers
1826
+ });
1827
+ if (response.status === 401 || response.status === 403) {
1828
+ console.error(`\u274C [FederatedCatalogueAPIWrapper] Authentication still failed after token refresh (${response.status}). Please check credentials.`);
1829
+ } else {
1830
+ console.log(`\u2705 [FederatedCatalogueAPIWrapper] Retry succeeded with status ${response.status}`);
1831
+ }
1832
+ } catch (error2) {
1833
+ console.error("\u274C [FederatedCatalogueAPIWrapper] Failed to refresh token:", error2);
1834
+ }
1835
+ }
1836
+ return response;
1620
1837
  }
1621
1838
  async getAllSelfDescriptions() {
1622
1839
  const url2 = `${this.fcBaseUrl}/self-descriptions`;
1623
- const response = await this.fetch(url2);
1840
+ const response = await this.fetchWithAuth(url2);
1624
1841
  return await response.json();
1625
1842
  }
1626
1843
  async getSelfDescriptionByHash(sdHash) {
1627
1844
  const url2 = `${this.fcBaseUrl}/self-descriptions/${sdHash}`;
1628
- const response = await this.fetch(url2, {
1845
+ const response = await this.fetchWithAuth(url2, {
1629
1846
  method: "GET"
1630
1847
  });
1631
1848
  if (!response.ok) throw new Error(`GET /self-descriptions/${sdHash} failed: ${response.status} ${response.statusText}`, {
@@ -1635,16 +1852,15 @@ let __tla = (async () => {
1635
1852
  }
1636
1853
  async postQuery(statement, parameters = {}) {
1637
1854
  const url2 = `${this.fcBaseUrl}/query`;
1638
- const headers = new Headers({
1639
- "Content-Type": "application/json"
1640
- });
1641
1855
  const body = JSON.stringify({
1642
1856
  statement,
1643
1857
  parameters
1644
1858
  });
1645
- const response = await this.fetch(url2, {
1859
+ const response = await this.fetchWithAuth(url2, {
1646
1860
  method: "POST",
1647
- headers,
1861
+ headers: {
1862
+ "Content-Type": "application/json"
1863
+ },
1648
1864
  body
1649
1865
  });
1650
1866
  if (!response.ok) {
@@ -1656,9 +1872,6 @@ let __tla = (async () => {
1656
1872
  }
1657
1873
  async postQuerySearch(statement, parameters = {}, queryLanguage = "OPENCYPHER", annotations) {
1658
1874
  const url2 = `${this.fcBaseUrl}/query/search`;
1659
- const headers = new Headers({
1660
- "Content-Type": "application/json"
1661
- });
1662
1875
  const body = JSON.stringify({
1663
1876
  statement,
1664
1877
  parameters,
@@ -1666,9 +1879,11 @@ let __tla = (async () => {
1666
1879
  queryLanguage
1667
1880
  }
1668
1881
  });
1669
- const response = await this.fetch(url2, {
1882
+ const response = await this.fetchWithAuth(url2, {
1670
1883
  method: "POST",
1671
- headers,
1884
+ headers: {
1885
+ "Content-Type": "application/json"
1886
+ },
1672
1887
  body
1673
1888
  });
1674
1889
  if (!response.ok) {
@@ -1679,8 +1894,8 @@ let __tla = (async () => {
1679
1894
  return await response.json();
1680
1895
  }
1681
1896
  }
1682
- function getFederatedCatalogueAPIWrapper(baseUrl, fetch2) {
1683
- return new FederatedCatalogueAPIWrapper(baseUrl, fetch2);
1897
+ function getFederatedCatalogueAPIWrapper(baseUrl, loginOptions, fetch2) {
1898
+ return new FederatedCatalogueAPIWrapper(loginOptions, baseUrl, fetch2);
1684
1899
  }
1685
1900
  class FederatedCatalogueStore {
1686
1901
  constructor(cfg) {
@@ -1689,6 +1904,8 @@ let __tla = (async () => {
1689
1904
  __publicField(this, "metadataManager");
1690
1905
  __publicField(this, "enableCaching");
1691
1906
  __publicField(this, "cleanupAuth");
1907
+ __publicField(this, "isFetching", false);
1908
+ __publicField(this, "pendingGetData", null);
1692
1909
  __publicField(this, "resolveFetch", (event) => {
1693
1910
  if (!this.cfg.endpoint) {
1694
1911
  throw new Error("Missing required `endpoint` in StoreConfig for FederatedCatalogueStore");
@@ -1703,10 +1920,10 @@ let __tla = (async () => {
1703
1920
  }
1704
1921
  const fetchAuth = AuthFetchResolver.getAuthFetch();
1705
1922
  this.cleanupAuth = AuthFetchResolver.onAuthActivated(this.resolveFetch.bind(this));
1706
- if (fetchAuth) {
1707
- this.fcApi = getFederatedCatalogueAPIWrapper(this.cfg.endpoint, fetchAuth);
1923
+ if (fetchAuth && !this.cfg.login) {
1924
+ this.fcApi = getFederatedCatalogueAPIWrapper(this.cfg.endpoint, {}, fetchAuth);
1708
1925
  } else {
1709
- this.fcApi = null;
1926
+ this.fcApi = getFederatedCatalogueAPIWrapper(this.cfg.endpoint, this.cfg.login, fetchAuth);
1710
1927
  }
1711
1928
  this.cache = new InMemoryCacheManager();
1712
1929
  this.enableCaching = this.cfg.enableLocalStorageMetadata === true;
@@ -1752,20 +1969,34 @@ let __tla = (async () => {
1752
1969
  return `store://local.fc-${endpointHash}-${containerType}/`;
1753
1970
  }
1754
1971
  async getData(args) {
1755
- var _a2;
1756
- const targetType = this.resolveTargetType(args);
1757
- if (!this.fcApi) {
1758
- throw new Error("Federated API not initialized, returning empty data.");
1759
- }
1760
- const cacheIsValid = this.enableCaching && ((_a2 = this.metadataManager) == null ? void 0 : _a2.isCacheValid());
1761
- const hasCached = this.hasCachedData();
1762
- if (cacheIsValid && hasCached) {
1763
- return await this.getDeltaUpdatedData(targetType);
1764
- }
1765
- if (cacheIsValid && !hasCached && this.metadataManager) {
1766
- this.metadataManager.clear();
1972
+ if (this.isFetching) {
1973
+ if (this.pendingGetData) {
1974
+ return this.pendingGetData;
1975
+ }
1976
+ return null;
1767
1977
  }
1768
- return await this.getFullData(targetType);
1978
+ this.isFetching = true;
1979
+ const executeGetData = async () => {
1980
+ var _a2;
1981
+ const targetType = this.resolveTargetType(args);
1982
+ if (!this.fcApi) {
1983
+ throw new Error("Federated API not initialized, returning empty data.");
1984
+ }
1985
+ const cacheIsValid = this.enableCaching && ((_a2 = this.metadataManager) == null ? void 0 : _a2.isCacheValid());
1986
+ const hasCached = this.hasCachedData();
1987
+ if (cacheIsValid && hasCached) {
1988
+ return await this.getDeltaUpdatedData(targetType);
1989
+ }
1990
+ if (cacheIsValid && !hasCached && this.metadataManager) {
1991
+ this.metadataManager.clear();
1992
+ }
1993
+ return await this.getFullData(targetType);
1994
+ };
1995
+ this.pendingGetData = executeGetData().finally(() => {
1996
+ this.isFetching = false;
1997
+ this.pendingGetData = null;
1998
+ });
1999
+ return this.pendingGetData;
1769
2000
  }
1770
2001
  hasCachedData() {
1771
2002
  try {
@@ -2158,18 +2389,44 @@ let __tla = (async () => {
2158
2389
  const assetId = this.stripUrnPrefix(cs["@id"], "urn:uuid:");
2159
2390
  let datasetId;
2160
2391
  let policy;
2392
+ let policies = [];
2161
2393
  if (cs["dcat:dataset"] && cs["dcat:dataset"].length > 0) {
2162
2394
  const dataset2 = cs["dcat:dataset"][0];
2163
2395
  if (dataset2["@id"]) {
2164
2396
  datasetId = this.stripUrnPrefix(dataset2["@id"], "urn:uuid:");
2165
2397
  }
2166
2398
  if (dataset2["odrl:hasPolicy"]) {
2167
- policy = this.stripTemsUrnFromPolicy(JSON.parse(JSON.stringify(dataset2["odrl:hasPolicy"])));
2168
- if (datasetId) {
2169
- policy.target = datasetId;
2399
+ const rawPolicy = dataset2["odrl:hasPolicy"];
2400
+ const processSinglePolicy = (policyObj) => {
2401
+ const processedPolicy = this.stripTemsUrnFromPolicy(JSON.parse(JSON.stringify(policyObj)));
2402
+ if (datasetId) {
2403
+ processedPolicy.target = datasetId;
2404
+ }
2405
+ return processedPolicy;
2406
+ };
2407
+ if (Array.isArray(rawPolicy)) {
2408
+ policies = rawPolicy.map(processSinglePolicy);
2409
+ policy = policies[0];
2410
+ } else {
2411
+ policy = processSinglePolicy(rawPolicy);
2412
+ policies = [
2413
+ policy
2414
+ ];
2170
2415
  }
2171
2416
  }
2172
2417
  }
2418
+ console.log("[FederatedCatalogueStore] \u{1F50D} Policy processing for", name, ":", {
2419
+ hasPolicy: !!policy,
2420
+ policiesCount: policies.length,
2421
+ policy: policy ? {
2422
+ "@id": policy["@id"],
2423
+ hasTarget: !!policy.target
2424
+ } : null,
2425
+ policies: policies.map((p) => ({
2426
+ "@id": p["@id"],
2427
+ hasTarget: !!p.target
2428
+ }))
2429
+ });
2173
2430
  const dest = {
2174
2431
  "@id": serviceId,
2175
2432
  creation_date,
@@ -2208,12 +2465,20 @@ let __tla = (async () => {
2208
2465
  },
2209
2466
  ...policy && {
2210
2467
  policy
2468
+ },
2469
+ ...policies.length > 0 && {
2470
+ policies
2211
2471
  }
2212
2472
  };
2473
+ console.log("[FederatedCatalogueStore] \u{1F50D} Destination object contract fields:", {
2474
+ hasPolicy: "policy" in dest,
2475
+ hasPolicies: "policies" in dest,
2476
+ policiesValue: dest.policies
2477
+ });
2213
2478
  return dest;
2214
2479
  }
2215
2480
  }
2216
- const _FederatedCatalogueStoreAdapter = class _FederatedCatalogueStoreAdapter {
2481
+ class FederatedCatalogueStoreAdapter {
2217
2482
  constructor() {
2218
2483
  }
2219
2484
  static validateConfiguration(cfg) {
@@ -2229,18 +2494,13 @@ let __tla = (async () => {
2229
2494
  }
2230
2495
  }
2231
2496
  static getStoreInstance(cfg) {
2232
- if (!_FederatedCatalogueStoreAdapter.store) {
2233
- if (!cfg) {
2234
- throw new Error("[FederatedCatalogueStoreAdapter] configuration is required");
2235
- }
2236
- _FederatedCatalogueStoreAdapter.validateConfiguration(cfg);
2237
- _FederatedCatalogueStoreAdapter.store = new FederatedCatalogueStore(cfg);
2497
+ if (!cfg) {
2498
+ throw new Error("[FederatedCatalogueStoreAdapter] configuration is required");
2238
2499
  }
2239
- return _FederatedCatalogueStoreAdapter.store;
2500
+ FederatedCatalogueStoreAdapter.validateConfiguration(cfg);
2501
+ return new FederatedCatalogueStore(cfg);
2240
2502
  }
2241
- };
2242
- __publicField(_FederatedCatalogueStoreAdapter, "store");
2243
- let FederatedCatalogueStoreAdapter = _FederatedCatalogueStoreAdapter;
2503
+ }
2244
2504
  var lib = {};
2245
2505
  var IdentifierIssuer_1;
2246
2506
  var hasRequiredIdentifierIssuer;
@@ -3557,7 +3817,7 @@ let __tla = (async () => {
3557
3817
  function requireLib() {
3558
3818
  if (hasRequiredLib) return lib;
3559
3819
  hasRequiredLib = 1;
3560
- (function(exports) {
3820
+ (function(exports$1) {
3561
3821
  const URDNA2015 = requireURDNA2015();
3562
3822
  const URGNA20122 = requireURGNA2012();
3563
3823
  const URDNA2015Sync = requireURDNA2015Sync();
@@ -3569,19 +3829,19 @@ let __tla = (async () => {
3569
3829
  }
3570
3830
  function _inputToDataset(input) {
3571
3831
  if (!Array.isArray(input)) {
3572
- return exports.NQuads.legacyDatasetToQuads(input);
3832
+ return exports$1.NQuads.legacyDatasetToQuads(input);
3573
3833
  }
3574
3834
  return input;
3575
3835
  }
3576
- exports.NQuads = requireNQuads$1();
3577
- exports.IdentifierIssuer = requireIdentifierIssuer();
3578
- exports._rdfCanonizeNative = function(api) {
3836
+ exports$1.NQuads = requireNQuads$1();
3837
+ exports$1.IdentifierIssuer = requireIdentifierIssuer();
3838
+ exports$1._rdfCanonizeNative = function(api) {
3579
3839
  if (api) {
3580
3840
  rdfCanonizeNative = api;
3581
3841
  }
3582
3842
  return rdfCanonizeNative;
3583
3843
  };
3584
- exports.canonize = async function(input, options) {
3844
+ exports$1.canonize = async function(input, options) {
3585
3845
  const dataset2 = _inputToDataset(input);
3586
3846
  if (options.useNative) {
3587
3847
  if (!rdfCanonizeNative) {
@@ -3606,7 +3866,7 @@ let __tla = (async () => {
3606
3866
  }
3607
3867
  throw new Error("Invalid RDF Dataset Canonicalization algorithm: " + options.algorithm);
3608
3868
  };
3609
- exports._canonizeSync = function(input, options) {
3869
+ exports$1._canonizeSync = function(input, options) {
3610
3870
  const dataset2 = _inputToDataset(input);
3611
3871
  if (options.useNative) {
3612
3872
  if (!rdfCanonizeNative) {
@@ -10432,7 +10692,7 @@ let __tla = (async () => {
10432
10692
  function requirePubsub() {
10433
10693
  if (hasRequiredPubsub) return pubsub$1.exports;
10434
10694
  hasRequiredPubsub = 1;
10435
- (function(module, exports) {
10695
+ (function(module, exports$1) {
10436
10696
  (function(root, factory2) {
10437
10697
  var PubSub2 = {};
10438
10698
  if (root.PubSub) {
@@ -10444,10 +10704,10 @@ let __tla = (async () => {
10444
10704
  }
10445
10705
  {
10446
10706
  if (module !== void 0 && module.exports) {
10447
- exports = module.exports = PubSub2;
10707
+ exports$1 = module.exports = PubSub2;
10448
10708
  }
10449
- exports.PubSub = PubSub2;
10450
- module.exports = exports = PubSub2;
10709
+ exports$1.PubSub = PubSub2;
10710
+ module.exports = exports$1 = PubSub2;
10451
10711
  }
10452
10712
  })(typeof window === "object" && window || pubsub || globalThis, function(PubSub2) {
10453
10713
  var messages = {}, lastUid = -1, ALL_SUBSCRIBING_MSG = "*";
@@ -11220,15 +11480,15 @@ let __tla = (async () => {
11220
11480
  function requireBuffer() {
11221
11481
  if (hasRequiredBuffer) return buffer;
11222
11482
  hasRequiredBuffer = 1;
11223
- (function(exports) {
11483
+ (function(exports$1) {
11224
11484
  const base64 = requireBase64Js();
11225
11485
  const ieee7542 = requireIeee754();
11226
11486
  const customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
11227
- exports.Buffer = Buffer2;
11228
- exports.SlowBuffer = SlowBuffer;
11229
- exports.INSPECT_MAX_BYTES = 50;
11487
+ exports$1.Buffer = Buffer2;
11488
+ exports$1.SlowBuffer = SlowBuffer;
11489
+ exports$1.INSPECT_MAX_BYTES = 50;
11230
11490
  const K_MAX_LENGTH = 2147483647;
11231
- exports.kMaxLength = K_MAX_LENGTH;
11491
+ exports$1.kMaxLength = K_MAX_LENGTH;
11232
11492
  Buffer2.TYPED_ARRAY_SUPPORT = typedArraySupport();
11233
11493
  if (!Buffer2.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
11234
11494
  console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
@@ -11642,7 +11902,7 @@ let __tla = (async () => {
11642
11902
  };
11643
11903
  Buffer2.prototype.inspect = function inspect2() {
11644
11904
  let str = "";
11645
- const max = exports.INSPECT_MAX_BYTES;
11905
+ const max = exports$1.INSPECT_MAX_BYTES;
11646
11906
  str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
11647
11907
  if (this.length > max) str += " ... ";
11648
11908
  return "<Buffer " + str + ">";
@@ -12733,7 +12993,7 @@ let __tla = (async () => {
12733
12993
  function numberIsNaN(obj) {
12734
12994
  return obj !== obj;
12735
12995
  }
12736
- const hexSliceLookupTable = function() {
12996
+ const hexSliceLookupTable = (function() {
12737
12997
  const alphabet = "0123456789abcdef";
12738
12998
  const table = new Array(256);
12739
12999
  for (let i = 0; i < 16; ++i) {
@@ -12743,7 +13003,7 @@ let __tla = (async () => {
12743
13003
  }
12744
13004
  }
12745
13005
  return table;
12746
- }();
13006
+ })();
12747
13007
  function defineBigIntMethod(fn) {
12748
13008
  return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn;
12749
13009
  }
@@ -12834,7 +13094,7 @@ let __tla = (async () => {
12834
13094
  function copyBuffer(src, target, offset) {
12835
13095
  Buffer2.prototype.copy.call(src, target, offset);
12836
13096
  }
12837
- buffer_list$1 = function() {
13097
+ buffer_list$1 = (function() {
12838
13098
  function BufferList() {
12839
13099
  _classCallCheck(this, BufferList);
12840
13100
  this.head = null;
@@ -13002,7 +13262,7 @@ let __tla = (async () => {
13002
13262
  }
13003
13263
  ]);
13004
13264
  return BufferList;
13005
- }();
13265
+ })();
13006
13266
  return buffer_list$1;
13007
13267
  }
13008
13268
  var destroy_1$1;
@@ -13116,13 +13376,13 @@ let __tla = (async () => {
13116
13376
  return message(arg1, arg2, arg3);
13117
13377
  }
13118
13378
  }
13119
- var NodeError = function(_Base) {
13379
+ var NodeError = (function(_Base) {
13120
13380
  _inheritsLoose(NodeError2, _Base);
13121
13381
  function NodeError2(arg1, arg2, arg3) {
13122
13382
  return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
13123
13383
  }
13124
13384
  return NodeError2;
13125
- }(Base);
13385
+ })(Base);
13126
13386
  NodeError.prototype.name = Base.name;
13127
13387
  NodeError.prototype.code = code;
13128
13388
  codes[code] = NodeError;
@@ -13817,7 +14077,7 @@ let __tla = (async () => {
13817
14077
  function requireSafeBuffer() {
13818
14078
  if (hasRequiredSafeBuffer) return safeBuffer.exports;
13819
14079
  hasRequiredSafeBuffer = 1;
13820
- (function(module, exports) {
14080
+ (function(module, exports$1) {
13821
14081
  var buffer2 = requireBuffer();
13822
14082
  var Buffer2 = buffer2.Buffer;
13823
14083
  function copyProps(src, dst) {
@@ -13828,8 +14088,8 @@ let __tla = (async () => {
13828
14088
  if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
13829
14089
  module.exports = buffer2;
13830
14090
  } else {
13831
- copyProps(buffer2, exports);
13832
- exports.Buffer = SafeBuffer;
14091
+ copyProps(buffer2, exports$1);
14092
+ exports$1.Buffer = SafeBuffer;
13833
14093
  }
13834
14094
  function SafeBuffer(arg, encodingOrOffset, length) {
13835
14095
  return Buffer2(arg, encodingOrOffset, length);
@@ -15016,11 +15276,11 @@ let __tla = (async () => {
15016
15276
  });
15017
15277
  for (var i in stream2) {
15018
15278
  if (this[i] === void 0 && typeof stream2[i] === "function") {
15019
- this[i] = /* @__PURE__ */ function methodWrap(method) {
15279
+ this[i] = /* @__PURE__ */ (function methodWrap(method) {
15020
15280
  return function methodWrapReturnFunction() {
15021
15281
  return stream2[method].apply(stream2, arguments);
15022
15282
  };
15023
- }(i);
15283
+ })(i);
15024
15284
  }
15025
15285
  }
15026
15286
  for (var n = 0; n < kProxyEvents.length; n++) {
@@ -19786,50 +20046,64 @@ let __tla = (async () => {
19786
20046
  createDebug.namespaces = namespaces2;
19787
20047
  createDebug.names = [];
19788
20048
  createDebug.skips = [];
19789
- let i;
19790
- const split = (typeof namespaces2 === "string" ? namespaces2 : "").split(/[\s,]+/);
19791
- const len = split.length;
19792
- for (i = 0; i < len; i++) {
19793
- if (!split[i]) {
19794
- continue;
20049
+ const split = (typeof namespaces2 === "string" ? namespaces2 : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
20050
+ for (const ns2 of split) {
20051
+ if (ns2[0] === "-") {
20052
+ createDebug.skips.push(ns2.slice(1));
20053
+ } else {
20054
+ createDebug.names.push(ns2);
19795
20055
  }
19796
- namespaces2 = split[i].replace(/\*/g, ".*?");
19797
- if (namespaces2[0] === "-") {
19798
- createDebug.skips.push(new RegExp("^" + namespaces2.slice(1) + "$"));
20056
+ }
20057
+ }
20058
+ function matchesTemplate(search, template) {
20059
+ let searchIndex = 0;
20060
+ let templateIndex = 0;
20061
+ let starIndex = -1;
20062
+ let matchIndex = 0;
20063
+ while (searchIndex < search.length) {
20064
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
20065
+ if (template[templateIndex] === "*") {
20066
+ starIndex = templateIndex;
20067
+ matchIndex = searchIndex;
20068
+ templateIndex++;
20069
+ } else {
20070
+ searchIndex++;
20071
+ templateIndex++;
20072
+ }
20073
+ } else if (starIndex !== -1) {
20074
+ templateIndex = starIndex + 1;
20075
+ matchIndex++;
20076
+ searchIndex = matchIndex;
19799
20077
  } else {
19800
- createDebug.names.push(new RegExp("^" + namespaces2 + "$"));
20078
+ return false;
19801
20079
  }
19802
20080
  }
20081
+ while (templateIndex < template.length && template[templateIndex] === "*") {
20082
+ templateIndex++;
20083
+ }
20084
+ return templateIndex === template.length;
19803
20085
  }
19804
20086
  function disable() {
19805
20087
  const namespaces2 = [
19806
- ...createDebug.names.map(toNamespace),
19807
- ...createDebug.skips.map(toNamespace).map((namespace2) => "-" + namespace2)
20088
+ ...createDebug.names,
20089
+ ...createDebug.skips.map((namespace2) => "-" + namespace2)
19808
20090
  ].join(",");
19809
20091
  createDebug.enable("");
19810
20092
  return namespaces2;
19811
20093
  }
19812
20094
  function enabled(name) {
19813
- if (name[name.length - 1] === "*") {
19814
- return true;
19815
- }
19816
- let i;
19817
- let len;
19818
- for (i = 0, len = createDebug.skips.length; i < len; i++) {
19819
- if (createDebug.skips[i].test(name)) {
20095
+ for (const skip of createDebug.skips) {
20096
+ if (matchesTemplate(name, skip)) {
19820
20097
  return false;
19821
20098
  }
19822
20099
  }
19823
- for (i = 0, len = createDebug.names.length; i < len; i++) {
19824
- if (createDebug.names[i].test(name)) {
20100
+ for (const ns2 of createDebug.names) {
20101
+ if (matchesTemplate(name, ns2)) {
19825
20102
  return true;
19826
20103
  }
19827
20104
  }
19828
20105
  return false;
19829
20106
  }
19830
- function toNamespace(regexp) {
19831
- return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
19832
- }
19833
20107
  function coerce(val) {
19834
20108
  if (val instanceof Error) {
19835
20109
  return val.stack || val.message;
@@ -19849,13 +20123,13 @@ let __tla = (async () => {
19849
20123
  function requireBrowser$3() {
19850
20124
  if (hasRequiredBrowser$3) return browser$3.exports;
19851
20125
  hasRequiredBrowser$3 = 1;
19852
- (function(module, exports) {
19853
- exports.formatArgs = formatArgs;
19854
- exports.save = save;
19855
- exports.load = load;
19856
- exports.useColors = useColors;
19857
- exports.storage = localstorage();
19858
- exports.destroy = /* @__PURE__ */ (() => {
20126
+ (function(module, exports$1) {
20127
+ exports$1.formatArgs = formatArgs;
20128
+ exports$1.save = save;
20129
+ exports$1.load = load;
20130
+ exports$1.useColors = useColors;
20131
+ exports$1.storage = localstorage();
20132
+ exports$1.destroy = /* @__PURE__ */ (() => {
19859
20133
  let warned = false;
19860
20134
  return () => {
19861
20135
  if (!warned) {
@@ -19864,7 +20138,7 @@ let __tla = (async () => {
19864
20138
  }
19865
20139
  };
19866
20140
  })();
19867
- exports.colors = [
20141
+ exports$1.colors = [
19868
20142
  "#0000CC",
19869
20143
  "#0000FF",
19870
20144
  "#0033CC",
@@ -19949,7 +20223,8 @@ let __tla = (async () => {
19949
20223
  if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
19950
20224
  return false;
19951
20225
  }
19952
- return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
20226
+ let m;
20227
+ return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
19953
20228
  }
19954
20229
  function formatArgs(args) {
19955
20230
  args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
@@ -19971,14 +20246,14 @@ let __tla = (async () => {
19971
20246
  });
19972
20247
  args.splice(lastC, 0, c);
19973
20248
  }
19974
- exports.log = console.debug || console.log || (() => {
20249
+ exports$1.log = console.debug || console.log || (() => {
19975
20250
  });
19976
20251
  function save(namespaces2) {
19977
20252
  try {
19978
20253
  if (namespaces2) {
19979
- exports.storage.setItem("debug", namespaces2);
20254
+ exports$1.storage.setItem("debug", namespaces2);
19980
20255
  } else {
19981
- exports.storage.removeItem("debug");
20256
+ exports$1.storage.removeItem("debug");
19982
20257
  }
19983
20258
  } catch (error2) {
19984
20259
  }
@@ -19986,7 +20261,7 @@ let __tla = (async () => {
19986
20261
  function load() {
19987
20262
  let r;
19988
20263
  try {
19989
- r = exports.storage.getItem("debug");
20264
+ r = exports$1.storage.getItem("debug") || exports$1.storage.getItem("DEBUG");
19990
20265
  } catch (error2) {
19991
20266
  }
19992
20267
  if (!r && typeof process !== "undefined" && "env" in process) {
@@ -20000,7 +20275,7 @@ let __tla = (async () => {
20000
20275
  } catch (error2) {
20001
20276
  }
20002
20277
  }
20003
- module.exports = requireCommon()(exports);
20278
+ module.exports = requireCommon()(exports$1);
20004
20279
  const { formatters } = module.exports;
20005
20280
  formatters.j = function(v) {
20006
20281
  try {
@@ -20845,8 +21120,8 @@ let __tla = (async () => {
20845
21120
  function requireRdfDataFactory() {
20846
21121
  if (hasRequiredRdfDataFactory) return rdfDataFactory;
20847
21122
  hasRequiredRdfDataFactory = 1;
20848
- (function(exports) {
20849
- var __createBinding = rdfDataFactory && rdfDataFactory.__createBinding || (Object.create ? function(o, m, k, k2) {
21123
+ (function(exports$1) {
21124
+ var __createBinding = rdfDataFactory && rdfDataFactory.__createBinding || (Object.create ? (function(o, m, k, k2) {
20850
21125
  if (k2 === void 0) k2 = k;
20851
21126
  var desc = Object.getOwnPropertyDescriptor(m, k);
20852
21127
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
@@ -20858,23 +21133,23 @@ let __tla = (async () => {
20858
21133
  };
20859
21134
  }
20860
21135
  Object.defineProperty(o, k2, desc);
20861
- } : function(o, m, k, k2) {
21136
+ }) : (function(o, m, k, k2) {
20862
21137
  if (k2 === void 0) k2 = k;
20863
21138
  o[k2] = m[k];
20864
- });
20865
- var __exportStar = rdfDataFactory && rdfDataFactory.__exportStar || function(m, exports2) {
20866
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
21139
+ }));
21140
+ var __exportStar = rdfDataFactory && rdfDataFactory.__exportStar || function(m, exports$12) {
21141
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$12, p)) __createBinding(exports$12, m, p);
20867
21142
  };
20868
- Object.defineProperty(exports, "__esModule", {
21143
+ Object.defineProperty(exports$1, "__esModule", {
20869
21144
  value: true
20870
21145
  });
20871
- __exportStar(requireBlankNode(), exports);
20872
- __exportStar(requireDataFactory(), exports);
20873
- __exportStar(requireDefaultGraph(), exports);
20874
- __exportStar(requireLiteral(), exports);
20875
- __exportStar(requireNamedNode(), exports);
20876
- __exportStar(requireQuad(), exports);
20877
- __exportStar(requireVariable(), exports);
21146
+ __exportStar(requireBlankNode(), exports$1);
21147
+ __exportStar(requireDataFactory(), exports$1);
21148
+ __exportStar(requireDefaultGraph(), exports$1);
21149
+ __exportStar(requireLiteral(), exports$1);
21150
+ __exportStar(requireNamedNode(), exports$1);
21151
+ __exportStar(requireQuad(), exports$1);
21152
+ __exportStar(requireVariable(), exports$1);
20878
21153
  })(rdfDataFactory);
20879
21154
  return rdfDataFactory;
20880
21155
  }
@@ -21178,8 +21453,8 @@ let __tla = (async () => {
21178
21453
  function requireHandler() {
21179
21454
  if (hasRequiredHandler) return handler;
21180
21455
  hasRequiredHandler = 1;
21181
- (function(exports) {
21182
- var __createBinding = handler && handler.__createBinding || (Object.create ? function(o, m, k, k2) {
21456
+ (function(exports$1) {
21457
+ var __createBinding = handler && handler.__createBinding || (Object.create ? (function(o, m, k, k2) {
21183
21458
  if (k2 === void 0) k2 = k;
21184
21459
  var desc = Object.getOwnPropertyDescriptor(m, k);
21185
21460
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
@@ -21191,21 +21466,21 @@ let __tla = (async () => {
21191
21466
  };
21192
21467
  }
21193
21468
  Object.defineProperty(o, k2, desc);
21194
- } : function(o, m, k, k2) {
21469
+ }) : (function(o, m, k, k2) {
21195
21470
  if (k2 === void 0) k2 = k;
21196
21471
  o[k2] = m[k];
21197
- });
21198
- var __exportStar = handler && handler.__exportStar || function(m, exports2) {
21199
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
21472
+ }));
21473
+ var __exportStar = handler && handler.__exportStar || function(m, exports$12) {
21474
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$12, p)) __createBinding(exports$12, m, p);
21200
21475
  };
21201
- Object.defineProperty(exports, "__esModule", {
21476
+ Object.defineProperty(exports$1, "__esModule", {
21202
21477
  value: true
21203
21478
  });
21204
- __exportStar(requireTypeHandlerBoolean(), exports);
21205
- __exportStar(requireTypeHandlerDate(), exports);
21206
- __exportStar(requireTypeHandlerNumberDouble(), exports);
21207
- __exportStar(requireTypeHandlerNumberInteger(), exports);
21208
- __exportStar(requireTypeHandlerString(), exports);
21479
+ __exportStar(requireTypeHandlerBoolean(), exports$1);
21480
+ __exportStar(requireTypeHandlerDate(), exports$1);
21481
+ __exportStar(requireTypeHandlerNumberDouble(), exports$1);
21482
+ __exportStar(requireTypeHandlerNumberInteger(), exports$1);
21483
+ __exportStar(requireTypeHandlerString(), exports$1);
21209
21484
  })(handler);
21210
21485
  return handler;
21211
21486
  }
@@ -21223,8 +21498,8 @@ let __tla = (async () => {
21223
21498
  function requireRdfLiteral() {
21224
21499
  if (hasRequiredRdfLiteral) return rdfLiteral;
21225
21500
  hasRequiredRdfLiteral = 1;
21226
- (function(exports) {
21227
- var __createBinding = rdfLiteral && rdfLiteral.__createBinding || (Object.create ? function(o, m, k, k2) {
21501
+ (function(exports$1) {
21502
+ var __createBinding = rdfLiteral && rdfLiteral.__createBinding || (Object.create ? (function(o, m, k, k2) {
21228
21503
  if (k2 === void 0) k2 = k;
21229
21504
  var desc = Object.getOwnPropertyDescriptor(m, k);
21230
21505
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
@@ -21236,27 +21511,27 @@ let __tla = (async () => {
21236
21511
  };
21237
21512
  }
21238
21513
  Object.defineProperty(o, k2, desc);
21239
- } : function(o, m, k, k2) {
21514
+ }) : (function(o, m, k, k2) {
21240
21515
  if (k2 === void 0) k2 = k;
21241
21516
  o[k2] = m[k];
21242
- });
21243
- var __exportStar = rdfLiteral && rdfLiteral.__exportStar || function(m, exports2) {
21244
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
21517
+ }));
21518
+ var __exportStar = rdfLiteral && rdfLiteral.__exportStar || function(m, exports$12) {
21519
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$12, p)) __createBinding(exports$12, m, p);
21245
21520
  };
21246
- Object.defineProperty(exports, "__esModule", {
21521
+ Object.defineProperty(exports$1, "__esModule", {
21247
21522
  value: true
21248
21523
  });
21249
- exports.fromRdf = fromRdf2;
21250
- exports.toRdf = toRdf2;
21251
- exports.getTermRaw = getTermRaw;
21252
- exports.getSupportedRdfDatatypes = getSupportedRdfDatatypes;
21253
- exports.getSupportedJavaScriptPrimitives = getSupportedJavaScriptPrimitives;
21524
+ exports$1.fromRdf = fromRdf2;
21525
+ exports$1.toRdf = toRdf2;
21526
+ exports$1.getTermRaw = getTermRaw;
21527
+ exports$1.getSupportedRdfDatatypes = getSupportedRdfDatatypes;
21528
+ exports$1.getSupportedJavaScriptPrimitives = getSupportedJavaScriptPrimitives;
21254
21529
  const rdf_data_factory_1 = requireRdfDataFactory();
21255
21530
  const handler_1 = requireHandler();
21256
21531
  const Translator_1 = requireTranslator();
21257
- __exportStar(requireHandler(), exports);
21258
- __exportStar(requireITypeHandler(), exports);
21259
- __exportStar(requireTranslator(), exports);
21532
+ __exportStar(requireHandler(), exports$1);
21533
+ __exportStar(requireITypeHandler(), exports$1);
21534
+ __exportStar(requireTranslator(), exports$1);
21260
21535
  const DF = new rdf_data_factory_1.DataFactory();
21261
21536
  const translator = new Translator_1.Translator();
21262
21537
  translator.registerHandler(new handler_1.TypeHandlerString(), handler_1.TypeHandlerString.TYPES.map((t) => DF.namedNode(t)), [
@@ -25594,8 +25869,8 @@ let __tla = (async () => {
25594
25869
  this.pipes = [];
25595
25870
  this.flowing = null;
25596
25871
  this[kPaused] = null;
25597
- if (options && options.emitClose === false) this.state &= -2049;
25598
- if (options && options.autoDestroy === false) this.state &= -4097;
25872
+ if (options && options.emitClose === false) this.state &= ~kEmitClose;
25873
+ if (options && options.autoDestroy === false) this.state &= ~kAutoDestroy;
25599
25874
  this.errored = null;
25600
25875
  this.defaultEncoding = options && options.defaultEncoding || "utf8";
25601
25876
  this.awaitDrainWriters = null;
@@ -25676,7 +25951,7 @@ let __tla = (async () => {
25676
25951
  if (err) {
25677
25952
  errorOrDestroy(stream2, err);
25678
25953
  } else if (chunk === null) {
25679
- state2.state &= -9;
25954
+ state2.state &= ~kReading;
25680
25955
  onEofChunk(stream2, state2);
25681
25956
  } else if ((state2.state & kObjectMode) !== 0 || chunk && chunk.length > 0) {
25682
25957
  if (addToFront) {
@@ -25688,7 +25963,7 @@ let __tla = (async () => {
25688
25963
  } else if (state2.destroyed || state2.errored) {
25689
25964
  return false;
25690
25965
  } else {
25691
- state2.state &= -9;
25966
+ state2.state &= ~kReading;
25692
25967
  if (state2.decoder && !encoding) {
25693
25968
  chunk = state2.decoder.write(chunk);
25694
25969
  if (state2.objectMode || chunk.length !== 0) addChunk(stream2, state2, chunk, false);
@@ -25698,7 +25973,7 @@ let __tla = (async () => {
25698
25973
  }
25699
25974
  }
25700
25975
  } else if (!addToFront) {
25701
- state2.state &= -9;
25976
+ state2.state &= ~kReading;
25702
25977
  maybeReadMore(stream2, state2);
25703
25978
  }
25704
25979
  return !state2.ended && (state2.length < state2.highWaterMark || state2.length === 0);
@@ -25773,7 +26048,7 @@ let __tla = (async () => {
25773
26048
  const state2 = this._readableState;
25774
26049
  const nOrig = n;
25775
26050
  if (n > state2.highWaterMark) state2.highWaterMark = computeNewHighWaterMark(n);
25776
- if (n !== 0) state2.state &= -129;
26051
+ if (n !== 0) state2.state &= ~kEmittedReadable;
25777
26052
  if (n === 0 && state2.needReadable && ((state2.highWaterMark !== 0 ? state2.length >= state2.highWaterMark : state2.length > 0) || state2.ended)) {
25778
26053
  debug2("read: emitReadable", state2.length, state2.ended);
25779
26054
  if (state2.length === 0 && state2.ended) endReadable(this);
@@ -25803,7 +26078,7 @@ let __tla = (async () => {
25803
26078
  } catch (err) {
25804
26079
  errorOrDestroy(this, err);
25805
26080
  }
25806
- state2.state &= -33;
26081
+ state2.state &= ~kSync;
25807
26082
  if (!state2.reading) n = howMuchToRead(nOrig, state2);
25808
26083
  }
25809
26084
  let ret;
@@ -27179,7 +27454,7 @@ let __tla = (async () => {
27179
27454
  let { promise, resolve } = createDeferredPromise();
27180
27455
  const ac = new AbortController();
27181
27456
  const signal = ac.signal;
27182
- const value = fn(async function* () {
27457
+ const value = fn((async function* () {
27183
27458
  while (true) {
27184
27459
  const _promise = promise;
27185
27460
  promise = null;
@@ -27192,7 +27467,7 @@ let __tla = (async () => {
27192
27467
  ({ promise, resolve } = createDeferredPromise());
27193
27468
  yield chunk;
27194
27469
  }
27195
- }(), {
27470
+ })(), {
27196
27471
  signal
27197
27472
  });
27198
27473
  return {
@@ -29143,7 +29418,7 @@ sh:property [
29143
29418
  window.dispatchEvent(event);
29144
29419
  }
29145
29420
  async initGetter() {
29146
- const { CustomGetter } = await import("./custom-getter-WZPa-O0k.js");
29421
+ const { CustomGetter } = await import("./custom-getter-4u-Xg-ue.js");
29147
29422
  return CustomGetter;
29148
29423
  }
29149
29424
  disconnectedCallback() {
@@ -29536,6 +29811,7 @@ sh:property [
29536
29811
  StoreFactory.register(StoreType.DataspaceConnector, DataspaceConnectorStoreAdapter);
29537
29812
  StoreService = (_a = class {
29538
29813
  static addStore(name, config) {
29814
+ var _a2;
29539
29815
  const trimmedName = name.trim();
29540
29816
  if (!trimmedName) {
29541
29817
  throw new Error("[StoreService] Store name cannot be empty.");
@@ -29543,10 +29819,20 @@ sh:property [
29543
29819
  if (!config) {
29544
29820
  throw new Error("[StoreService] Store configuration is required.");
29545
29821
  }
29822
+ console.log(`\u{1F527} [StoreService.addStore] Adding store "${trimmedName}":`, {
29823
+ storeType: config.type,
29824
+ endpoint: config.endpoint,
29825
+ alreadyExists: StoreService.stores.has(trimmedName)
29826
+ });
29546
29827
  if (StoreService.stores.has(trimmedName)) {
29547
29828
  StoreService.logWarning(`Store with name "${trimmedName}" already exists. Overwriting.`);
29548
29829
  }
29549
29830
  const store2 = StoreFactory.create(config);
29831
+ console.log(`\u2705 [StoreService.addStore] Created store for "${trimmedName}":`, {
29832
+ storeType: typeof store2,
29833
+ storeConfig: store2.config,
29834
+ storeEndpoint: (_a2 = store2.config) == null ? void 0 : _a2.endpoint
29835
+ });
29550
29836
  StoreService.stores.set(trimmedName, {
29551
29837
  store: store2,
29552
29838
  config
@@ -29554,6 +29840,7 @@ sh:property [
29554
29840
  return store2;
29555
29841
  }
29556
29842
  static getStore(name) {
29843
+ var _a2;
29557
29844
  const storeName = StoreService.resolveStoreName(name);
29558
29845
  if (!storeName) {
29559
29846
  return null;
@@ -29566,6 +29853,11 @@ sh:property [
29566
29853
  StoreService.logWarning(`Store with name "${storeName}" not found.`);
29567
29854
  return null;
29568
29855
  }
29856
+ console.log(`\u{1F4E6} [StoreService.getStore] Retrieving store "${storeName}":`, {
29857
+ found: !!instance,
29858
+ storeEndpoint: (_a2 = instance.store.config) == null ? void 0 : _a2.endpoint,
29859
+ configEndpoint: instance.config.endpoint
29860
+ });
29569
29861
  return instance.store;
29570
29862
  }
29571
29863
  static setDefaultStore(name) {
@@ -33434,8 +33726,8 @@ sh:property [
33434
33726
  function requireJsonldStreamingParser() {
33435
33727
  if (hasRequiredJsonldStreamingParser) return jsonldStreamingParser;
33436
33728
  hasRequiredJsonldStreamingParser = 1;
33437
- (function(exports) {
33438
- var __createBinding = jsonldStreamingParser && jsonldStreamingParser.__createBinding || (Object.create ? function(o, m, k, k2) {
33729
+ (function(exports$1) {
33730
+ var __createBinding = jsonldStreamingParser && jsonldStreamingParser.__createBinding || (Object.create ? (function(o, m, k, k2) {
33439
33731
  if (k2 === void 0) k2 = k;
33440
33732
  var desc = Object.getOwnPropertyDescriptor(m, k);
33441
33733
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
@@ -33447,17 +33739,17 @@ sh:property [
33447
33739
  };
33448
33740
  }
33449
33741
  Object.defineProperty(o, k2, desc);
33450
- } : function(o, m, k, k2) {
33742
+ }) : (function(o, m, k, k2) {
33451
33743
  if (k2 === void 0) k2 = k;
33452
33744
  o[k2] = m[k];
33453
- });
33454
- var __exportStar = jsonldStreamingParser && jsonldStreamingParser.__exportStar || function(m, exports2) {
33455
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
33745
+ }));
33746
+ var __exportStar = jsonldStreamingParser && jsonldStreamingParser.__exportStar || function(m, exports$12) {
33747
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$12, p)) __createBinding(exports$12, m, p);
33456
33748
  };
33457
- Object.defineProperty(exports, "__esModule", {
33749
+ Object.defineProperty(exports$1, "__esModule", {
33458
33750
  value: true
33459
33751
  });
33460
- __exportStar(requireJsonLdParser(), exports);
33752
+ __exportStar(requireJsonLdParser(), exports$1);
33461
33753
  })(jsonldStreamingParser);
33462
33754
  return jsonldStreamingParser;
33463
33755
  }