@startinblox/core 2.0.6-beta.21 → 2.0.6-beta.23

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-DtCY-jxq.js";
5
- import { S as StoreService } from "./store-CsN3nlRR.js";
5
+ import { S as StoreService } from "./store-CcdngHTz.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,10 +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-CsN3nlRR.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-CcdngHTz.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-DtCY-jxq.js";
6
- import { __tla as __tla_1 } from "./store-CsN3nlRR.js";
7
- import { A, D } from "./store-CsN3nlRR.js";
6
+ import { __tla as __tla_1 } from "./store-CcdngHTz.js";
7
+ import { A, D } from "./store-CcdngHTz.js";
8
8
  import { k } from "./helpers-DtCY-jxq.js";
9
9
  let index$4, BaseWidgetMixin, index$3, CounterMixin, DspCatalogDisplay, EdcAssetsDisplay, 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, b, o$2, newWidgetFactory, D2, o$1, m, widgetFactory;
10
10
  let __tla = Promise.all([
@@ -3750,16 +3750,9 @@ let __tla = (async () => {
3750
3750
  })
3751
3751
  });
3752
3752
  if (!response.ok) {
3753
- const getResponse = await this.fetchAuthn(`${this.config.contractNegotiationEndpoint}?offset=0&limit=1000`, {
3754
- method: "GET",
3755
- headers: this.headers
3756
- });
3757
- if (!getResponse.ok) {
3758
- console.warn(`Failed to fetch contract negotiations: ${getResponse.status} ${getResponse.statusText}`);
3759
- return [];
3760
- }
3761
- const getData = await getResponse.json();
3762
- return Array.isArray(getData) ? getData : getData.items || [];
3753
+ const body = await response.text().catch(() => "");
3754
+ console.warn(`Failed to fetch contract negotiations: ${response.status} ${response.statusText}${body ? ` \u2014 ${body}` : ""}`);
3755
+ return [];
3763
3756
  }
3764
3757
  const data = await response.json();
3765
3758
  return Array.isArray(data) ? data : data.items || [];
@@ -4477,6 +4470,9 @@ let __tla = (async () => {
4477
4470
  properties: assetInput.properties || {},
4478
4471
  dataAddress: assetInput.dataAddress
4479
4472
  };
4473
+ if (assetInput.privateProperties) {
4474
+ assetData.privateProperties = assetInput.privateProperties;
4475
+ }
4480
4476
  const response = await this.fetchAuthn(assetsEndpoint, {
4481
4477
  method: "POST",
4482
4478
  headers: this.headers,
@@ -5529,6 +5525,23 @@ let __tla = (async () => {
5529
5525
  const endpointHash = ((_a2 = this.cfg.endpoint) == null ? void 0 : _a2.replace(/[^a-zA-Z0-9]/g, "")) || "unknown";
5530
5526
  return `store://local.fc-${endpointHash}-${containerType}/`;
5531
5527
  }
5528
+ buildOutputContainer(resource, targetType) {
5529
+ const items = resource == null ? void 0 : resource["ldp:contains"];
5530
+ if (!Array.isArray(items)) return resource;
5531
+ const filtered = items.filter((item) => {
5532
+ const name = item == null ? void 0 : item.name;
5533
+ if (!name || String(name).trim().length === 0) return false;
5534
+ if (!targetType) return true;
5535
+ const t = item == null ? void 0 : item["@type"];
5536
+ const last = Array.isArray(t) ? t[t.length - 1] : t;
5537
+ return last === targetType;
5538
+ });
5539
+ if (filtered.length === items.length) return resource;
5540
+ return {
5541
+ ...resource,
5542
+ "ldp:contains": filtered
5543
+ };
5544
+ }
5532
5545
  async getData(args) {
5533
5546
  if (this.isFetching) {
5534
5547
  if (this.pendingGetData) {
@@ -5599,7 +5612,7 @@ let __tla = (async () => {
5599
5612
  const items = (apiList == null ? void 0 : apiList.items) || [];
5600
5613
  if (!Array.isArray(items)) {
5601
5614
  console.warn("[FederatedCatalogueStore] apiList.items is not an array");
5602
- return resource;
5615
+ return this.buildOutputContainer(resource, targetType);
5603
5616
  }
5604
5617
  const apiHashes = new Set(items.map((item) => item.meta.sdHash));
5605
5618
  const newHashes = [];
@@ -5676,13 +5689,13 @@ let __tla = (async () => {
5676
5689
  },
5677
5690
  bubbles: true
5678
5691
  }));
5679
- return resource;
5692
+ return this.buildOutputContainer(resource, targetType);
5680
5693
  } catch (error2) {
5681
5694
  console.error("[FederatedCatalogueStore] Delta update failed, falling back to full fetch:", error2);
5682
5695
  return await this.getFullData(targetType);
5683
5696
  }
5684
5697
  }
5685
- async getFullData(_targetType) {
5698
+ async getFullData(targetType) {
5686
5699
  if (!this.fcApi) {
5687
5700
  console.warn("[FederatedCatalogueStore] API not initialized yet, waiting for auth");
5688
5701
  return await this.initLocalDataSourceContainer();
@@ -5728,7 +5741,7 @@ let __tla = (async () => {
5728
5741
  },
5729
5742
  bubbles: true
5730
5743
  }));
5731
- return resource;
5744
+ return this.buildOutputContainer(resource, targetType);
5732
5745
  }
5733
5746
  async initLocalDataSourceContainer(dataSrc = "", containerType = "default") {
5734
5747
  if (!dataSrc) {
@@ -5855,54 +5868,82 @@ let __tla = (async () => {
5855
5868
  var _a2, _b, _c, _d;
5856
5869
  const vc = src.verifiableCredential;
5857
5870
  const cs = vc.credentialSubject;
5871
+ const FOAF_THUMBNAIL_KEYS = [
5872
+ "foaf:thumbnail",
5873
+ "http://xmlns.com/foaf/0.1/thumbnail"
5874
+ ];
5875
+ const FOAF_NAME_KEYS = [
5876
+ "foaf:name",
5877
+ "http://xmlns.com/foaf/0.1/name"
5878
+ ];
5879
+ const DCTERMS_CREATOR_KEYS = [
5880
+ "dcterms:creator",
5881
+ "dct:creator",
5882
+ "http://purl.org/dc/terms/creator"
5883
+ ];
5884
+ const RDF_RESOURCE_KEYS = [
5885
+ "rdf:resource",
5886
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#resource"
5887
+ ];
5888
+ const pickKey = (obj, keys) => {
5889
+ if (!obj) return void 0;
5890
+ for (const k of keys) if (obj[k] !== void 0) return obj[k];
5891
+ return void 0;
5892
+ };
5893
+ const getThumbnailUrl = (obj) => pickKey(pickKey(obj, FOAF_THUMBNAIL_KEYS), RDF_RESOURCE_KEYS) || "";
5894
+ const getCreator = (obj) => pickKey(obj, DCTERMS_CREATOR_KEYS);
5858
5895
  let catInfo;
5859
5896
  let usedKey;
5860
5897
  let type;
5898
+ const datasetBlock = cs["dcat:dataset"] && cs["dcat:dataset"].length > 0 ? cs["dcat:dataset"][0] : void 0;
5899
+ const detectIsDataOffer = (block) => {
5900
+ if (!block || typeof block !== "object") return false;
5901
+ const rawType = block["@type"];
5902
+ const types2 = Array.isArray(rawType) ? rawType : rawType ? [
5903
+ rawType
5904
+ ] : [];
5905
+ const datasetTypeHit = types2.some((t) => typeof t === "string" && (t === "dcat:Dataset" || t === "http://www.w3.org/ns/dcat#Dataset" || t === "tems:DataOffer" || t === "temscore:DataOffer" || t === "http://tems.org/2024/temscore#DataOffer"));
5906
+ if (datasetTypeHit) return true;
5907
+ const kind = block["tc:offeringKind"] || block["temscore:offeringKind"] || block["http://tems.org/2024/temscore#offeringKind"];
5908
+ return typeof kind === "string" && /dataoffer/i.test(kind);
5909
+ };
5861
5910
  if (cs["dcat:service"]) {
5862
5911
  catInfo = cs["dcat:service"];
5863
5912
  usedKey = "service";
5864
- type = "tems:Service";
5865
- } else if (cs["dcat:dataset"] && cs["dcat:dataset"].length > 0) {
5866
- const dataset2 = cs["dcat:dataset"][0];
5867
- if (dataset2["dcat:service"]) {
5868
- catInfo = dataset2["dcat:service"];
5913
+ type = detectIsDataOffer(catInfo) ? "tems:DataOffer" : "tems:Service";
5914
+ } else if (datasetBlock) {
5915
+ const nestedDataset = datasetBlock["dcat:dataset"];
5916
+ const firstNestedDataset = Array.isArray(nestedDataset) ? nestedDataset[0] : nestedDataset;
5917
+ if (firstNestedDataset) {
5918
+ catInfo = firstNestedDataset;
5919
+ usedKey = "nested-dataset";
5920
+ type = "tems:DataOffer";
5921
+ } else if (datasetBlock["dcat:service"]) {
5922
+ catInfo = datasetBlock["dcat:service"];
5869
5923
  usedKey = "nested-service";
5870
- type = "tems:Service";
5924
+ type = detectIsDataOffer(catInfo) ? "tems:DataOffer" : "tems:Service";
5871
5925
  } else {
5872
- catInfo = dataset2;
5926
+ catInfo = datasetBlock;
5873
5927
  usedKey = "dataset";
5874
5928
  type = "tems:DataOffer";
5875
5929
  }
5876
5930
  } else {
5877
5931
  throw new Error("Expected either credentialSubject['dcat:service'] or a non-empty array in ['dcat:dataset']");
5878
5932
  }
5933
+ if (!catInfo) {
5934
+ throw new Error(`Could not locate an offering block (used key: ${usedKey}); resolved catInfo is empty`);
5935
+ }
5879
5936
  const resourceId = cs["@id"];
5880
5937
  const slug = resourceId.split("/").pop() || "unknown";
5881
5938
  const serviceId = `${opts.temsServiceBase}${encodeURIComponent(slug)}/`;
5882
- const FOAF_THUMBNAIL_KEYS = [
5883
- "foaf:thumbnail",
5884
- "http://xmlns.com/foaf/0.1/thumbnail"
5885
- ];
5886
- const DCTERMS_CREATOR_KEYS = [
5887
- "dcterms:creator",
5888
- "dct:creator",
5889
- "http://purl.org/dc/terms/creator"
5890
- ];
5891
- const pickKey = (obj, keys) => {
5892
- if (!obj) return void 0;
5893
- for (const k of keys) if (obj[k] !== void 0) return obj[k];
5894
- return void 0;
5895
- };
5896
- const getThumbnailUrl = (obj) => {
5897
- var _a3, _b2;
5898
- return ((_a3 = pickKey(obj, FOAF_THUMBNAIL_KEYS)) == null ? void 0 : _a3["rdf:resource"]) ?? ((_b2 = pickKey(obj, FOAF_THUMBNAIL_KEYS)) == null ? void 0 : _b2["http://www.w3.org/1999/02/22-rdf-syntax-ns#resource"]);
5899
- };
5900
- const getCreator = (obj) => pickKey(obj, DCTERMS_CREATOR_KEYS);
5901
5939
  const creation_date = vc.issuanceDate;
5902
5940
  const update_date = vc.expirationDate;
5903
5941
  const name = catInfo["dcterms:title"] || catInfo["dct:title"];
5904
5942
  const description = catInfo["rdfs:comment"];
5905
- const keywords = catInfo["dcat:keyword"] || [];
5943
+ const rawKeywords = catInfo["dcat:keyword"];
5944
+ const keywords = Array.isArray(rawKeywords) ? rawKeywords : rawKeywords != null ? [
5945
+ rawKeywords
5946
+ ] : [];
5906
5947
  const long_description = keywords.length > 0 ? `Keywords: ${keywords.join(", ")}` : "";
5907
5948
  const categories = {
5908
5949
  "@id": `${serviceId}categories/`,
@@ -5937,7 +5978,7 @@ let __tla = (async () => {
5937
5978
  };
5938
5979
  const contact_url = catInfo["dcat:endpointDescription"] || "";
5939
5980
  const documentation_url = contact_url || "";
5940
- let service_url = catInfo["dcat:endpointURL"] || "";
5981
+ let service_url = endpointURL;
5941
5982
  if (!service_url) {
5942
5983
  console.warn("[FederatedCatalogueStore] dcat:endpointURL is missing from dcat:service. Available fields:", Object.keys(catInfo));
5943
5984
  }
@@ -5945,18 +5986,18 @@ let __tla = (async () => {
5945
5986
  let providerRef;
5946
5987
  if (usedKey === "service") {
5947
5988
  providerRef = ((_a2 = cs["gax-core:operatedBy"]) == null ? void 0 : _a2["@id"]) || "";
5948
- } else if (usedKey === "nested-service") {
5989
+ } else if (usedKey === "nested-service" || usedKey === "nested-dataset") {
5949
5990
  providerRef = ((_b = cs["gax-core:operatedBy"]) == null ? void 0 : _b["@id"]) || ((_c = cs["gax-core:offeredBy"]) == null ? void 0 : _c["@id"]) || "";
5950
5991
  } else {
5951
5992
  providerRef = ((_d = cs["gax-core:offeredBy"]) == null ? void 0 : _d["@id"]) || "";
5952
5993
  }
5953
5994
  const providerSlug = providerRef.split(":").pop() + String(Math.random()) || "0";
5954
5995
  const creator = getCreator(catInfo);
5955
- const providerLogo = getThumbnailUrl(creator) || "";
5996
+ const providerLogo = getThumbnailUrl(creator);
5956
5997
  const provider = {
5957
5998
  "@id": `${opts.temsProviderBase}${encodeURIComponent(providerSlug)}/`,
5958
5999
  "@type": "tems:Provider",
5959
- name: (creator == null ? void 0 : creator["foaf:name"]) || (creator == null ? void 0 : creator["http://xmlns.com/foaf/0.1/name"]) || "",
6000
+ name: pickKey(creator, FOAF_NAME_KEYS) || "",
5960
6001
  image: {
5961
6002
  "@id": `${opts.temsImageBase}${encodeURIComponent(providerLogo.split("/").pop() || "0")}/`,
5962
6003
  "@type": "tems:Image",
@@ -32999,7 +33040,8 @@ sh:property [
32999
33040
  acl: "http://www.w3.org/ns/auth/acl#",
33000
33041
  hd: "http://cdn.startinblox.com/owl/ttl/vocab.ttl#",
33001
33042
  sib: "http://cdn.startinblox.com/owl/ttl/vocab.ttl#",
33002
- dcat: "https://www.w3.org/ns/dcat3.jsonld#",
33043
+ dcat: "http://www.w3.org/ns/dcat#",
33044
+ dct: "http://purl.org/dc/terms/",
33003
33045
  tems: "https://cdn.startinblox.com/owl/tems.jsonld#",
33004
33046
  name: "rdfs:label",
33005
33047
  deadline: "xsd:dateTime",
@@ -33078,7 +33120,7 @@ sh:property [
33078
33120
  window.dispatchEvent(event);
33079
33121
  }
33080
33122
  async initGetter() {
33081
- const { CustomGetter } = await import("./custom-getter-TTrh1NFo.js");
33123
+ const { CustomGetter } = await import("./custom-getter-GzeAgss3.js");
33082
33124
  return CustomGetter;
33083
33125
  }
33084
33126
  disconnectedCallback() {
package/dist/store.js CHANGED
@@ -1,4 +1,4 @@
1
- import { s, S, c, b, e, j, h, i } from "./store-CsN3nlRR.js";
1
+ import { s, S, c, b, e, j, h, i } from "./store-CcdngHTz.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.21",
3
+ "version": "2.0.6-beta.23",
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",