@startinblox/core 2.0.6-beta.21 → 2.0.6-beta.22
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-
|
|
5
|
+
import { S as StoreService } from "./store-CsOvawDq.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-
|
|
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-CsOvawDq.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-
|
|
7
|
-
import { A, D } from "./store-
|
|
6
|
+
import { __tla as __tla_1 } from "./store-CsOvawDq.js";
|
|
7
|
+
import { A, D } from "./store-CsOvawDq.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
|
|
3754
|
-
|
|
3755
|
-
|
|
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 || [];
|
|
@@ -5529,6 +5522,23 @@ let __tla = (async () => {
|
|
|
5529
5522
|
const endpointHash = ((_a2 = this.cfg.endpoint) == null ? void 0 : _a2.replace(/[^a-zA-Z0-9]/g, "")) || "unknown";
|
|
5530
5523
|
return `store://local.fc-${endpointHash}-${containerType}/`;
|
|
5531
5524
|
}
|
|
5525
|
+
buildOutputContainer(resource, targetType) {
|
|
5526
|
+
const items = resource == null ? void 0 : resource["ldp:contains"];
|
|
5527
|
+
if (!Array.isArray(items)) return resource;
|
|
5528
|
+
const filtered = items.filter((item) => {
|
|
5529
|
+
const name = item == null ? void 0 : item.name;
|
|
5530
|
+
if (!name || String(name).trim().length === 0) return false;
|
|
5531
|
+
if (!targetType) return true;
|
|
5532
|
+
const t = item == null ? void 0 : item["@type"];
|
|
5533
|
+
const last = Array.isArray(t) ? t[t.length - 1] : t;
|
|
5534
|
+
return last === targetType;
|
|
5535
|
+
});
|
|
5536
|
+
if (filtered.length === items.length) return resource;
|
|
5537
|
+
return {
|
|
5538
|
+
...resource,
|
|
5539
|
+
"ldp:contains": filtered
|
|
5540
|
+
};
|
|
5541
|
+
}
|
|
5532
5542
|
async getData(args) {
|
|
5533
5543
|
if (this.isFetching) {
|
|
5534
5544
|
if (this.pendingGetData) {
|
|
@@ -5599,7 +5609,7 @@ let __tla = (async () => {
|
|
|
5599
5609
|
const items = (apiList == null ? void 0 : apiList.items) || [];
|
|
5600
5610
|
if (!Array.isArray(items)) {
|
|
5601
5611
|
console.warn("[FederatedCatalogueStore] apiList.items is not an array");
|
|
5602
|
-
return resource;
|
|
5612
|
+
return this.buildOutputContainer(resource, targetType);
|
|
5603
5613
|
}
|
|
5604
5614
|
const apiHashes = new Set(items.map((item) => item.meta.sdHash));
|
|
5605
5615
|
const newHashes = [];
|
|
@@ -5676,13 +5686,13 @@ let __tla = (async () => {
|
|
|
5676
5686
|
},
|
|
5677
5687
|
bubbles: true
|
|
5678
5688
|
}));
|
|
5679
|
-
return resource;
|
|
5689
|
+
return this.buildOutputContainer(resource, targetType);
|
|
5680
5690
|
} catch (error2) {
|
|
5681
5691
|
console.error("[FederatedCatalogueStore] Delta update failed, falling back to full fetch:", error2);
|
|
5682
5692
|
return await this.getFullData(targetType);
|
|
5683
5693
|
}
|
|
5684
5694
|
}
|
|
5685
|
-
async getFullData(
|
|
5695
|
+
async getFullData(targetType) {
|
|
5686
5696
|
if (!this.fcApi) {
|
|
5687
5697
|
console.warn("[FederatedCatalogueStore] API not initialized yet, waiting for auth");
|
|
5688
5698
|
return await this.initLocalDataSourceContainer();
|
|
@@ -5728,7 +5738,7 @@ let __tla = (async () => {
|
|
|
5728
5738
|
},
|
|
5729
5739
|
bubbles: true
|
|
5730
5740
|
}));
|
|
5731
|
-
return resource;
|
|
5741
|
+
return this.buildOutputContainer(resource, targetType);
|
|
5732
5742
|
}
|
|
5733
5743
|
async initLocalDataSourceContainer(dataSrc = "", containerType = "default") {
|
|
5734
5744
|
if (!dataSrc) {
|
|
@@ -5855,54 +5865,82 @@ let __tla = (async () => {
|
|
|
5855
5865
|
var _a2, _b, _c, _d;
|
|
5856
5866
|
const vc = src.verifiableCredential;
|
|
5857
5867
|
const cs = vc.credentialSubject;
|
|
5868
|
+
const FOAF_THUMBNAIL_KEYS = [
|
|
5869
|
+
"foaf:thumbnail",
|
|
5870
|
+
"http://xmlns.com/foaf/0.1/thumbnail"
|
|
5871
|
+
];
|
|
5872
|
+
const FOAF_NAME_KEYS = [
|
|
5873
|
+
"foaf:name",
|
|
5874
|
+
"http://xmlns.com/foaf/0.1/name"
|
|
5875
|
+
];
|
|
5876
|
+
const DCTERMS_CREATOR_KEYS = [
|
|
5877
|
+
"dcterms:creator",
|
|
5878
|
+
"dct:creator",
|
|
5879
|
+
"http://purl.org/dc/terms/creator"
|
|
5880
|
+
];
|
|
5881
|
+
const RDF_RESOURCE_KEYS = [
|
|
5882
|
+
"rdf:resource",
|
|
5883
|
+
"http://www.w3.org/1999/02/22-rdf-syntax-ns#resource"
|
|
5884
|
+
];
|
|
5885
|
+
const pickKey = (obj, keys) => {
|
|
5886
|
+
if (!obj) return void 0;
|
|
5887
|
+
for (const k of keys) if (obj[k] !== void 0) return obj[k];
|
|
5888
|
+
return void 0;
|
|
5889
|
+
};
|
|
5890
|
+
const getThumbnailUrl = (obj) => pickKey(pickKey(obj, FOAF_THUMBNAIL_KEYS), RDF_RESOURCE_KEYS) || "";
|
|
5891
|
+
const getCreator = (obj) => pickKey(obj, DCTERMS_CREATOR_KEYS);
|
|
5858
5892
|
let catInfo;
|
|
5859
5893
|
let usedKey;
|
|
5860
5894
|
let type;
|
|
5895
|
+
const datasetBlock = cs["dcat:dataset"] && cs["dcat:dataset"].length > 0 ? cs["dcat:dataset"][0] : void 0;
|
|
5896
|
+
const detectIsDataOffer = (block) => {
|
|
5897
|
+
if (!block || typeof block !== "object") return false;
|
|
5898
|
+
const rawType = block["@type"];
|
|
5899
|
+
const types2 = Array.isArray(rawType) ? rawType : rawType ? [
|
|
5900
|
+
rawType
|
|
5901
|
+
] : [];
|
|
5902
|
+
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"));
|
|
5903
|
+
if (datasetTypeHit) return true;
|
|
5904
|
+
const kind = block["tc:offeringKind"] || block["temscore:offeringKind"] || block["http://tems.org/2024/temscore#offeringKind"];
|
|
5905
|
+
return typeof kind === "string" && /dataoffer/i.test(kind);
|
|
5906
|
+
};
|
|
5861
5907
|
if (cs["dcat:service"]) {
|
|
5862
5908
|
catInfo = cs["dcat:service"];
|
|
5863
5909
|
usedKey = "service";
|
|
5864
|
-
type = "tems:Service";
|
|
5865
|
-
} else if (
|
|
5866
|
-
const
|
|
5867
|
-
|
|
5868
|
-
|
|
5910
|
+
type = detectIsDataOffer(catInfo) ? "tems:DataOffer" : "tems:Service";
|
|
5911
|
+
} else if (datasetBlock) {
|
|
5912
|
+
const nestedDataset = datasetBlock["dcat:dataset"];
|
|
5913
|
+
const firstNestedDataset = Array.isArray(nestedDataset) ? nestedDataset[0] : nestedDataset;
|
|
5914
|
+
if (firstNestedDataset) {
|
|
5915
|
+
catInfo = firstNestedDataset;
|
|
5916
|
+
usedKey = "nested-dataset";
|
|
5917
|
+
type = "tems:DataOffer";
|
|
5918
|
+
} else if (datasetBlock["dcat:service"]) {
|
|
5919
|
+
catInfo = datasetBlock["dcat:service"];
|
|
5869
5920
|
usedKey = "nested-service";
|
|
5870
|
-
type = "tems:Service";
|
|
5921
|
+
type = detectIsDataOffer(catInfo) ? "tems:DataOffer" : "tems:Service";
|
|
5871
5922
|
} else {
|
|
5872
|
-
catInfo =
|
|
5923
|
+
catInfo = datasetBlock;
|
|
5873
5924
|
usedKey = "dataset";
|
|
5874
5925
|
type = "tems:DataOffer";
|
|
5875
5926
|
}
|
|
5876
5927
|
} else {
|
|
5877
5928
|
throw new Error("Expected either credentialSubject['dcat:service'] or a non-empty array in ['dcat:dataset']");
|
|
5878
5929
|
}
|
|
5930
|
+
if (!catInfo) {
|
|
5931
|
+
throw new Error(`Could not locate an offering block (used key: ${usedKey}); resolved catInfo is empty`);
|
|
5932
|
+
}
|
|
5879
5933
|
const resourceId = cs["@id"];
|
|
5880
5934
|
const slug = resourceId.split("/").pop() || "unknown";
|
|
5881
5935
|
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
5936
|
const creation_date = vc.issuanceDate;
|
|
5902
5937
|
const update_date = vc.expirationDate;
|
|
5903
5938
|
const name = catInfo["dcterms:title"] || catInfo["dct:title"];
|
|
5904
5939
|
const description = catInfo["rdfs:comment"];
|
|
5905
|
-
const
|
|
5940
|
+
const rawKeywords = catInfo["dcat:keyword"];
|
|
5941
|
+
const keywords = Array.isArray(rawKeywords) ? rawKeywords : rawKeywords != null ? [
|
|
5942
|
+
rawKeywords
|
|
5943
|
+
] : [];
|
|
5906
5944
|
const long_description = keywords.length > 0 ? `Keywords: ${keywords.join(", ")}` : "";
|
|
5907
5945
|
const categories = {
|
|
5908
5946
|
"@id": `${serviceId}categories/`,
|
|
@@ -5937,7 +5975,7 @@ let __tla = (async () => {
|
|
|
5937
5975
|
};
|
|
5938
5976
|
const contact_url = catInfo["dcat:endpointDescription"] || "";
|
|
5939
5977
|
const documentation_url = contact_url || "";
|
|
5940
|
-
let service_url =
|
|
5978
|
+
let service_url = endpointURL;
|
|
5941
5979
|
if (!service_url) {
|
|
5942
5980
|
console.warn("[FederatedCatalogueStore] dcat:endpointURL is missing from dcat:service. Available fields:", Object.keys(catInfo));
|
|
5943
5981
|
}
|
|
@@ -5945,18 +5983,18 @@ let __tla = (async () => {
|
|
|
5945
5983
|
let providerRef;
|
|
5946
5984
|
if (usedKey === "service") {
|
|
5947
5985
|
providerRef = ((_a2 = cs["gax-core:operatedBy"]) == null ? void 0 : _a2["@id"]) || "";
|
|
5948
|
-
} else if (usedKey === "nested-service") {
|
|
5986
|
+
} else if (usedKey === "nested-service" || usedKey === "nested-dataset") {
|
|
5949
5987
|
providerRef = ((_b = cs["gax-core:operatedBy"]) == null ? void 0 : _b["@id"]) || ((_c = cs["gax-core:offeredBy"]) == null ? void 0 : _c["@id"]) || "";
|
|
5950
5988
|
} else {
|
|
5951
5989
|
providerRef = ((_d = cs["gax-core:offeredBy"]) == null ? void 0 : _d["@id"]) || "";
|
|
5952
5990
|
}
|
|
5953
5991
|
const providerSlug = providerRef.split(":").pop() + String(Math.random()) || "0";
|
|
5954
5992
|
const creator = getCreator(catInfo);
|
|
5955
|
-
const providerLogo = getThumbnailUrl(creator)
|
|
5993
|
+
const providerLogo = getThumbnailUrl(creator);
|
|
5956
5994
|
const provider = {
|
|
5957
5995
|
"@id": `${opts.temsProviderBase}${encodeURIComponent(providerSlug)}/`,
|
|
5958
5996
|
"@type": "tems:Provider",
|
|
5959
|
-
name: (creator
|
|
5997
|
+
name: pickKey(creator, FOAF_NAME_KEYS) || "",
|
|
5960
5998
|
image: {
|
|
5961
5999
|
"@id": `${opts.temsImageBase}${encodeURIComponent(providerLogo.split("/").pop() || "0")}/`,
|
|
5962
6000
|
"@type": "tems:Image",
|
|
@@ -32999,7 +33037,8 @@ sh:property [
|
|
|
32999
33037
|
acl: "http://www.w3.org/ns/auth/acl#",
|
|
33000
33038
|
hd: "http://cdn.startinblox.com/owl/ttl/vocab.ttl#",
|
|
33001
33039
|
sib: "http://cdn.startinblox.com/owl/ttl/vocab.ttl#",
|
|
33002
|
-
dcat: "
|
|
33040
|
+
dcat: "http://www.w3.org/ns/dcat#",
|
|
33041
|
+
dct: "http://purl.org/dc/terms/",
|
|
33003
33042
|
tems: "https://cdn.startinblox.com/owl/tems.jsonld#",
|
|
33004
33043
|
name: "rdfs:label",
|
|
33005
33044
|
deadline: "xsd:dateTime",
|
|
@@ -33078,7 +33117,7 @@ sh:property [
|
|
|
33078
33117
|
window.dispatchEvent(event);
|
|
33079
33118
|
}
|
|
33080
33119
|
async initGetter() {
|
|
33081
|
-
const { CustomGetter } = await import("./custom-getter-
|
|
33120
|
+
const { CustomGetter } = await import("./custom-getter-BKuxi53d.js");
|
|
33082
33121
|
return CustomGetter;
|
|
33083
33122
|
}
|
|
33084
33123
|
disconnectedCallback() {
|
package/dist/store.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startinblox/core",
|
|
3
|
-
"version": "2.0.6-beta.
|
|
3
|
+
"version": "2.0.6-beta.22",
|
|
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",
|