@startinblox/core 2.0.6-beta.24 → 2.0.6-beta.25
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-C655KD6t.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-C655KD6t.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-C655KD6t.js";
|
|
7
|
+
import { A, D } from "./store-C655KD6t.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([
|
|
@@ -4875,6 +4875,426 @@ let __tla = (async () => {
|
|
|
4875
4875
|
return newStore;
|
|
4876
4876
|
}
|
|
4877
4877
|
}
|
|
4878
|
+
class FederatedCatalogueDcpAPIWrapper {
|
|
4879
|
+
constructor(baseUrl, fetchImpl = fetch.bind(globalThis)) {
|
|
4880
|
+
__publicField(this, "baseUrl");
|
|
4881
|
+
__publicField(this, "fetchImpl");
|
|
4882
|
+
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
4883
|
+
this.fetchImpl = fetchImpl;
|
|
4884
|
+
}
|
|
4885
|
+
async getAggregatedCatalog(opts = {}) {
|
|
4886
|
+
const { flatten: flatten2 = true } = opts;
|
|
4887
|
+
const url2 = `${this.baseUrl}/v1alpha/catalog/query${flatten2 ? "?flatten=true" : ""}`;
|
|
4888
|
+
const body = JSON.stringify({
|
|
4889
|
+
"@context": {
|
|
4890
|
+
edc: "https://w3id.org/edc/v0.0.1/ns/"
|
|
4891
|
+
},
|
|
4892
|
+
"@type": "QuerySpec"
|
|
4893
|
+
});
|
|
4894
|
+
const response = await this.fetchImpl(url2, {
|
|
4895
|
+
method: "POST",
|
|
4896
|
+
headers: {
|
|
4897
|
+
"Content-Type": "application/json",
|
|
4898
|
+
Accept: "application/json"
|
|
4899
|
+
},
|
|
4900
|
+
body
|
|
4901
|
+
});
|
|
4902
|
+
if (!response.ok) {
|
|
4903
|
+
throw new Error(`[FederatedCatalogueDcpAPIWrapper] POST /v1alpha/catalog/query failed: ${response.status} ${response.statusText}`, {
|
|
4904
|
+
cause: response
|
|
4905
|
+
});
|
|
4906
|
+
}
|
|
4907
|
+
const payload = await response.json();
|
|
4908
|
+
if (Array.isArray(payload)) return payload;
|
|
4909
|
+
if (payload && typeof payload === "object") {
|
|
4910
|
+
const values = Object.values(payload);
|
|
4911
|
+
return values.filter((v) => typeof v === "object" && v !== null && "@type" in v);
|
|
4912
|
+
}
|
|
4913
|
+
return [];
|
|
4914
|
+
}
|
|
4915
|
+
}
|
|
4916
|
+
const instances = /* @__PURE__ */ new Map();
|
|
4917
|
+
function getFederatedCatalogueDcpAPIWrapper(baseUrl, fetchImpl = fetch.bind(globalThis)) {
|
|
4918
|
+
const key = baseUrl;
|
|
4919
|
+
let inst = instances.get(key);
|
|
4920
|
+
if (!inst) {
|
|
4921
|
+
inst = new FederatedCatalogueDcpAPIWrapper(baseUrl, fetchImpl);
|
|
4922
|
+
instances.set(key, inst);
|
|
4923
|
+
}
|
|
4924
|
+
return inst;
|
|
4925
|
+
}
|
|
4926
|
+
function toArray$1(v) {
|
|
4927
|
+
if (v === void 0 || v === null) return [];
|
|
4928
|
+
return Array.isArray(v) ? v : [
|
|
4929
|
+
v
|
|
4930
|
+
];
|
|
4931
|
+
}
|
|
4932
|
+
function readObjectId(v) {
|
|
4933
|
+
if (typeof v === "string" && v.length > 0) return v;
|
|
4934
|
+
if (v && typeof v === "object" && !Array.isArray(v)) {
|
|
4935
|
+
const id = v["@id"];
|
|
4936
|
+
if (typeof id === "string" && id.length > 0) return id;
|
|
4937
|
+
}
|
|
4938
|
+
return void 0;
|
|
4939
|
+
}
|
|
4940
|
+
function readString(v) {
|
|
4941
|
+
if (typeof v === "string") return v.length > 0 ? v : void 0;
|
|
4942
|
+
if (v && typeof v === "object" && !Array.isArray(v)) {
|
|
4943
|
+
const value = v["@value"];
|
|
4944
|
+
if (typeof value === "string" && value.length > 0) return value;
|
|
4945
|
+
}
|
|
4946
|
+
return void 0;
|
|
4947
|
+
}
|
|
4948
|
+
function readIsoDate(v) {
|
|
4949
|
+
const s = readString(v);
|
|
4950
|
+
return s && /^\d{4}-\d{2}-\d{2}/.test(s) ? s : void 0;
|
|
4951
|
+
}
|
|
4952
|
+
function normalizeUriObjects(v) {
|
|
4953
|
+
return toArray$1(v).map(readObjectId).filter((u) => !!u);
|
|
4954
|
+
}
|
|
4955
|
+
function extractRdfType(ds) {
|
|
4956
|
+
const raw = ds["rdf:type"];
|
|
4957
|
+
const s = typeof raw === "string" ? raw : readObjectId(raw);
|
|
4958
|
+
if (!s) return void 0;
|
|
4959
|
+
const norm = s.replace(/^http:\/\/www\.w3\.org\/ns\/dcat#/, "dcat:");
|
|
4960
|
+
return norm;
|
|
4961
|
+
}
|
|
4962
|
+
const URI_TO_PREFIX = {
|
|
4963
|
+
"http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf:",
|
|
4964
|
+
"http://purl.org/dc/terms/": "dct:",
|
|
4965
|
+
"http://xmlns.com/foaf/0.1/": "foaf:",
|
|
4966
|
+
"http://tems.org/2024/temscore#": "tc:",
|
|
4967
|
+
"http://www.w3.org/ns/dcat#": "dcat:",
|
|
4968
|
+
"http://www.w3.org/2006/vcard/ns#": "vcard:",
|
|
4969
|
+
"http://www.w3.org/ns/odrl/2/": "odrl:"
|
|
4970
|
+
};
|
|
4971
|
+
function normalizeJsonLdKeys(v) {
|
|
4972
|
+
if (Array.isArray(v)) return v.map(normalizeJsonLdKeys);
|
|
4973
|
+
if (!v || typeof v !== "object") return v;
|
|
4974
|
+
const out = {};
|
|
4975
|
+
for (const [k, val] of Object.entries(v)) {
|
|
4976
|
+
let key = k;
|
|
4977
|
+
for (const uri of Object.keys(URI_TO_PREFIX)) {
|
|
4978
|
+
if (k.startsWith(uri)) {
|
|
4979
|
+
key = URI_TO_PREFIX[uri] + k.slice(uri.length);
|
|
4980
|
+
break;
|
|
4981
|
+
}
|
|
4982
|
+
}
|
|
4983
|
+
out[key] = normalizeJsonLdKeys(val);
|
|
4984
|
+
}
|
|
4985
|
+
return out;
|
|
4986
|
+
}
|
|
4987
|
+
class FederatedCatalogueDcpStore {
|
|
4988
|
+
constructor(cfg) {
|
|
4989
|
+
__publicField(this, "cache");
|
|
4990
|
+
__publicField(this, "api", null);
|
|
4991
|
+
__publicField(this, "isFetching", false);
|
|
4992
|
+
__publicField(this, "pendingGetData", null);
|
|
4993
|
+
this.cfg = cfg;
|
|
4994
|
+
if (!this.cfg.endpoint) {
|
|
4995
|
+
throw new Error("Missing required `endpoint` in StoreConfig for FederatedCatalogueDcpStore");
|
|
4996
|
+
}
|
|
4997
|
+
this.api = getFederatedCatalogueDcpAPIWrapper(this.cfg.endpoint);
|
|
4998
|
+
this.cache = new InMemoryCacheManager();
|
|
4999
|
+
}
|
|
5000
|
+
disconnectedCallback() {
|
|
5001
|
+
}
|
|
5002
|
+
buildContainerId(containerType = "default") {
|
|
5003
|
+
return `store://local.${this.cfg.endpoint}.${containerType}`;
|
|
5004
|
+
}
|
|
5005
|
+
resolveTargetType(args) {
|
|
5006
|
+
if (!args || typeof args !== "object") return "";
|
|
5007
|
+
if ("targetType" in args && args.targetType) return String(args.targetType);
|
|
5008
|
+
if ("rdf-type" in args) return String(args["rdf-type"]);
|
|
5009
|
+
return "";
|
|
5010
|
+
}
|
|
5011
|
+
async getData(args) {
|
|
5012
|
+
if (this.isFetching) {
|
|
5013
|
+
if (this.pendingGetData) return this.pendingGetData;
|
|
5014
|
+
return null;
|
|
5015
|
+
}
|
|
5016
|
+
this.isFetching = true;
|
|
5017
|
+
const execute = async () => {
|
|
5018
|
+
var _a2;
|
|
5019
|
+
const targetType = this.resolveTargetType(args);
|
|
5020
|
+
if (!this.api) return this.initLocalDataSourceContainer();
|
|
5021
|
+
let payload = [];
|
|
5022
|
+
try {
|
|
5023
|
+
payload = await this.api.getAggregatedCatalog();
|
|
5024
|
+
} catch (err) {
|
|
5025
|
+
console.error("[FederatedCatalogueDcpStore] Fetch failed; returning empty container.", err);
|
|
5026
|
+
return this.initLocalDataSourceContainer();
|
|
5027
|
+
}
|
|
5028
|
+
const opts = {
|
|
5029
|
+
temsServiceBase: this.cfg.temsServiceBase,
|
|
5030
|
+
temsOfferBase: this.cfg.temsOfferBase,
|
|
5031
|
+
temsCategoryBase: this.cfg.temsCategoryBase,
|
|
5032
|
+
temsImageBase: this.cfg.temsImageBase,
|
|
5033
|
+
temsProviderBase: this.cfg.temsProviderBase
|
|
5034
|
+
};
|
|
5035
|
+
const own = (_a2 = this.cfg.ownParticipantId) == null ? void 0 : _a2.toLowerCase();
|
|
5036
|
+
const items = [];
|
|
5037
|
+
for (const catalog of payload) {
|
|
5038
|
+
if (own && this.isOwnCatalog(catalog, own)) continue;
|
|
5039
|
+
const datasets = this.normalizeDatasets(catalog["dcat:dataset"]);
|
|
5040
|
+
for (const ds of datasets) {
|
|
5041
|
+
const mapped = this.mapDatasetToDestination(ds, catalog, opts);
|
|
5042
|
+
if (!targetType || mapped["@type"].includes(targetType)) {
|
|
5043
|
+
items.push(mapped);
|
|
5044
|
+
}
|
|
5045
|
+
}
|
|
5046
|
+
}
|
|
5047
|
+
const container = {
|
|
5048
|
+
"@context": "https://cdn.startinblox.com/owl/context.jsonld",
|
|
5049
|
+
"@type": "ldp:Container",
|
|
5050
|
+
"@id": this.buildContainerId(targetType || "default"),
|
|
5051
|
+
"ldp:contains": items,
|
|
5052
|
+
permissions: [
|
|
5053
|
+
"view"
|
|
5054
|
+
]
|
|
5055
|
+
};
|
|
5056
|
+
await this.cache.set(container["@id"], container);
|
|
5057
|
+
for (const item of items) {
|
|
5058
|
+
if (item["@id"]) await this.cache.set(item["@id"], item);
|
|
5059
|
+
}
|
|
5060
|
+
this.notifyComponents(container["@id"], container);
|
|
5061
|
+
return container;
|
|
5062
|
+
};
|
|
5063
|
+
this.pendingGetData = execute().finally(() => {
|
|
5064
|
+
this.isFetching = false;
|
|
5065
|
+
this.pendingGetData = null;
|
|
5066
|
+
});
|
|
5067
|
+
return this.pendingGetData;
|
|
5068
|
+
}
|
|
5069
|
+
normalizeDatasets(v) {
|
|
5070
|
+
if (!v) return [];
|
|
5071
|
+
return Array.isArray(v) ? v : [
|
|
5072
|
+
v
|
|
5073
|
+
];
|
|
5074
|
+
}
|
|
5075
|
+
normalizeServices(v) {
|
|
5076
|
+
if (!v) return [];
|
|
5077
|
+
return Array.isArray(v) ? v : [
|
|
5078
|
+
v
|
|
5079
|
+
];
|
|
5080
|
+
}
|
|
5081
|
+
isOwnCatalog(catalog, ownLower) {
|
|
5082
|
+
const pid = String(catalog["dspace:participantId"] ?? "").toLowerCase();
|
|
5083
|
+
return pid !== "" && pid === ownLower;
|
|
5084
|
+
}
|
|
5085
|
+
mapDatasetToDestination(rawDs, catalog, _opts) {
|
|
5086
|
+
var _a2, _b, _c;
|
|
5087
|
+
const ds = normalizeJsonLdKeys(rawDs);
|
|
5088
|
+
const rawId = String(ds["@id"] ?? ds.id ?? "");
|
|
5089
|
+
const bareUuid = rawId.replace(/^urn:uuid:/i, "");
|
|
5090
|
+
const id = bareUuid ? `urn:uuid:${bareUuid}` : rawId;
|
|
5091
|
+
const datasetServices = this.normalizeServices(ds["dcat:service"]);
|
|
5092
|
+
const catalogServices = this.normalizeServices(catalog["dcat:service"]);
|
|
5093
|
+
const serviceForMeta = datasetServices[0] ?? catalogServices[0] ?? {};
|
|
5094
|
+
const title = readString(ds["dcterms:title"] ?? ds["dct:title"] ?? serviceForMeta["dcterms:title"] ?? serviceForMeta["dct:title"]);
|
|
5095
|
+
const description = readString(ds["dcterms:description"] ?? ds["dct:description"] ?? ds["rdfs:comment"] ?? serviceForMeta["dcterms:description"] ?? serviceForMeta["dct:description"] ?? serviceForMeta["rdfs:comment"]);
|
|
5096
|
+
const rawKeywords = ds["dcat:keyword"] ?? serviceForMeta["dcat:keyword"];
|
|
5097
|
+
const keywords = Array.isArray(rawKeywords) ? rawKeywords.map(String) : rawKeywords ? [
|
|
5098
|
+
String(rawKeywords)
|
|
5099
|
+
] : void 0;
|
|
5100
|
+
const version = readString(ds["dcat:version"] ?? serviceForMeta["dcat:version"]);
|
|
5101
|
+
const rdfType = extractRdfType(ds);
|
|
5102
|
+
const publisher = ds["dcterms:publisher"] ?? ds["dct:publisher"];
|
|
5103
|
+
const providerId = (publisher == null ? void 0 : publisher["@id"]) ?? catalog["dspace:participantId"];
|
|
5104
|
+
const providerName = (publisher == null ? void 0 : publisher["foaf:name"]) ?? providerId;
|
|
5105
|
+
const providerLogo = readObjectId(publisher == null ? void 0 : publisher["foaf:depiction"]);
|
|
5106
|
+
const endpointUrl = readObjectId(ds["dcat:endpointURL"]);
|
|
5107
|
+
const endpointDescription = readObjectId(ds["dcat:endpointDescription"]);
|
|
5108
|
+
const providerAddress = endpointUrl ?? ((_a2 = catalogServices[0]) == null ? void 0 : _a2["dcat:endpointURL"]) ?? ((_b = catalogServices[0]) == null ? void 0 : _b["dcat:endpointUrl"]) ?? catalog.originator;
|
|
5109
|
+
const type = [
|
|
5110
|
+
"tems:Object"
|
|
5111
|
+
];
|
|
5112
|
+
if (rdfType === "dcat:DataService") type.push("tems:Service");
|
|
5113
|
+
else if (rdfType === "dcat:Dataset") type.push("tems:DataOffer");
|
|
5114
|
+
const bannerUrl = readObjectId(ds["foaf:depiction"]);
|
|
5115
|
+
const images = [];
|
|
5116
|
+
if (bannerUrl) images.push(bannerUrl);
|
|
5117
|
+
const themes = normalizeUriObjects(ds["dcat:theme"]).map((uri) => ({
|
|
5118
|
+
uri
|
|
5119
|
+
}));
|
|
5120
|
+
const languages = normalizeUriObjects(ds["dcterms:language"] ?? ds["dct:language"]).map((uri) => ({
|
|
5121
|
+
uri
|
|
5122
|
+
}));
|
|
5123
|
+
const conformsTo = toArray$1(ds["dcterms:conformsTo"] ?? ds["dct:conformsTo"]).map((c) => {
|
|
5124
|
+
const cAny = c;
|
|
5125
|
+
const title2 = c["dcterms:title"] ?? cAny["dct:title"];
|
|
5126
|
+
const desc = cAny["dcterms:description"] ?? cAny["dct:description"];
|
|
5127
|
+
return {
|
|
5128
|
+
"@id": String(c["@id"]),
|
|
5129
|
+
...title2 ? {
|
|
5130
|
+
"dcterms:title": String(title2)
|
|
5131
|
+
} : {},
|
|
5132
|
+
...desc ? {
|
|
5133
|
+
"dcterms:description": String(desc)
|
|
5134
|
+
} : {}
|
|
5135
|
+
};
|
|
5136
|
+
});
|
|
5137
|
+
const contact = ds["dcat:contactPoint"];
|
|
5138
|
+
const contactPoint = (contact == null ? void 0 : contact["vcard:fn"]) ? {
|
|
5139
|
+
name: String(contact["vcard:fn"]),
|
|
5140
|
+
email: String(contact["vcard:hasEmail"] ?? "").replace(/^mailto:/i, "")
|
|
5141
|
+
} : void 0;
|
|
5142
|
+
const distributions = rdfType === "dcat:Dataset" ? toArray$1(ds["dcat:distribution"]).map((d) => {
|
|
5143
|
+
const accessUrl = readObjectId(d["dcat:accessURL"]) ?? "";
|
|
5144
|
+
const byteSize = d["dcat:byteSize"];
|
|
5145
|
+
return {
|
|
5146
|
+
accessUrl,
|
|
5147
|
+
...typeof byteSize === "number" ? {
|
|
5148
|
+
byteSize
|
|
5149
|
+
} : {}
|
|
5150
|
+
};
|
|
5151
|
+
}) : void 0;
|
|
5152
|
+
const hostingCountry = (_c = readString(ds["tc:hostingCountry"])) == null ? void 0 : _c.toUpperCase();
|
|
5153
|
+
const issued = readIsoDate(ds["dcterms:issued"] ?? ds["dct:issued"]);
|
|
5154
|
+
const identifier = readString(ds["dcterms:identifier"] ?? ds["dct:identifier"]);
|
|
5155
|
+
return {
|
|
5156
|
+
"@id": id,
|
|
5157
|
+
"@type": type,
|
|
5158
|
+
name: title,
|
|
5159
|
+
description,
|
|
5160
|
+
keywords,
|
|
5161
|
+
version,
|
|
5162
|
+
provider: providerId || providerAddress ? {
|
|
5163
|
+
"@id": providerId,
|
|
5164
|
+
name: providerName ?? providerId,
|
|
5165
|
+
address: providerAddress,
|
|
5166
|
+
...providerLogo ? {
|
|
5167
|
+
logoUrl: providerLogo
|
|
5168
|
+
} : {}
|
|
5169
|
+
} : void 0,
|
|
5170
|
+
images,
|
|
5171
|
+
identifier,
|
|
5172
|
+
rdfType,
|
|
5173
|
+
issued,
|
|
5174
|
+
themes: themes.length > 0 ? themes : void 0,
|
|
5175
|
+
languages: languages.length > 0 ? languages : void 0,
|
|
5176
|
+
hostingCountry,
|
|
5177
|
+
conformsTo: conformsTo.length > 0 ? conformsTo : void 0,
|
|
5178
|
+
contactPoint,
|
|
5179
|
+
distributions: ((distributions == null ? void 0 : distributions.length) ?? 0) > 0 ? distributions : void 0,
|
|
5180
|
+
endpointUrl,
|
|
5181
|
+
endpointDescription,
|
|
5182
|
+
bannerUrl,
|
|
5183
|
+
counterPartyId: providerId,
|
|
5184
|
+
counterPartyAddress: providerAddress,
|
|
5185
|
+
assetId: id,
|
|
5186
|
+
datasetId: id,
|
|
5187
|
+
policy: ds["odrl:hasPolicy"],
|
|
5188
|
+
_rawDataset: rawDs,
|
|
5189
|
+
_rawCatalog: {
|
|
5190
|
+
"@id": catalog["@id"],
|
|
5191
|
+
"dspace:participantId": catalog["dspace:participantId"],
|
|
5192
|
+
originator: catalog.originator
|
|
5193
|
+
}
|
|
5194
|
+
};
|
|
5195
|
+
}
|
|
5196
|
+
async initLocalDataSourceContainer(dataSrc = "", containerType = "default") {
|
|
5197
|
+
if (!dataSrc) dataSrc = this.buildContainerId(containerType);
|
|
5198
|
+
const localContainer = {
|
|
5199
|
+
"@context": "https://cdn.startinblox.com/owl/context.jsonld",
|
|
5200
|
+
"@type": "ldp:Container",
|
|
5201
|
+
"@id": dataSrc,
|
|
5202
|
+
"ldp:contains": [],
|
|
5203
|
+
permissions: [
|
|
5204
|
+
"view"
|
|
5205
|
+
]
|
|
5206
|
+
};
|
|
5207
|
+
await this.setLocalData(localContainer, dataSrc);
|
|
5208
|
+
return localContainer;
|
|
5209
|
+
}
|
|
5210
|
+
async get(id, _serverPagination, _serverSearch) {
|
|
5211
|
+
try {
|
|
5212
|
+
return await this.cache.get(id) || null;
|
|
5213
|
+
} catch (error2) {
|
|
5214
|
+
console.error(`[FederatedCatalogueDcpStore] Error getting resource ${id}:`, error2);
|
|
5215
|
+
return null;
|
|
5216
|
+
}
|
|
5217
|
+
}
|
|
5218
|
+
post(_r, _id, _s) {
|
|
5219
|
+
return Promise.resolve(null);
|
|
5220
|
+
}
|
|
5221
|
+
put(_r, _id, _s) {
|
|
5222
|
+
return Promise.resolve(null);
|
|
5223
|
+
}
|
|
5224
|
+
patch(_r, _id, _s) {
|
|
5225
|
+
return Promise.resolve(null);
|
|
5226
|
+
}
|
|
5227
|
+
delete(_id, _c) {
|
|
5228
|
+
return Promise.resolve(null);
|
|
5229
|
+
}
|
|
5230
|
+
async clearCache(id) {
|
|
5231
|
+
try {
|
|
5232
|
+
if (await this.cache.has(id)) await this.cache.delete(id);
|
|
5233
|
+
} catch (error2) {
|
|
5234
|
+
console.error(`[FederatedCatalogueDcpStore] Error clearing cache for ${id}:`, error2);
|
|
5235
|
+
}
|
|
5236
|
+
}
|
|
5237
|
+
async cacheResource(key, resourceProxy) {
|
|
5238
|
+
try {
|
|
5239
|
+
await this.cache.set(key, resourceProxy);
|
|
5240
|
+
} catch (error2) {
|
|
5241
|
+
console.error(`[FederatedCatalogueDcpStore] Error caching resource ${key}:`, error2);
|
|
5242
|
+
}
|
|
5243
|
+
}
|
|
5244
|
+
_getLanguage() {
|
|
5245
|
+
return "";
|
|
5246
|
+
}
|
|
5247
|
+
selectLanguage(_selectedLanguageCode) {
|
|
5248
|
+
}
|
|
5249
|
+
getExpandedPredicate(_property, _context) {
|
|
5250
|
+
return null;
|
|
5251
|
+
}
|
|
5252
|
+
subscribeResourceTo(_resourceId, _nestedResourceId) {
|
|
5253
|
+
}
|
|
5254
|
+
async fetchAuthn(_iri, _options) {
|
|
5255
|
+
return await Promise.resolve({});
|
|
5256
|
+
}
|
|
5257
|
+
async setLocalData(resource, id) {
|
|
5258
|
+
try {
|
|
5259
|
+
const resourceWithId = {
|
|
5260
|
+
...resource,
|
|
5261
|
+
"@id": id
|
|
5262
|
+
};
|
|
5263
|
+
await this.cache.set(id, resourceWithId);
|
|
5264
|
+
this.notifyComponents(id, resourceWithId);
|
|
5265
|
+
return id;
|
|
5266
|
+
} catch (error2) {
|
|
5267
|
+
console.error(`[FederatedCatalogueDcpStore] Error storing local data for ${id}:`, error2);
|
|
5268
|
+
return null;
|
|
5269
|
+
}
|
|
5270
|
+
}
|
|
5271
|
+
notifyComponents(id, resource) {
|
|
5272
|
+
document.dispatchEvent(new CustomEvent("resoureReady", {
|
|
5273
|
+
detail: {
|
|
5274
|
+
id,
|
|
5275
|
+
resource,
|
|
5276
|
+
fetchedResource: resource
|
|
5277
|
+
},
|
|
5278
|
+
bubbles: true
|
|
5279
|
+
}));
|
|
5280
|
+
}
|
|
5281
|
+
}
|
|
5282
|
+
class FederatedCatalogueDcpStoreAdapter {
|
|
5283
|
+
constructor() {
|
|
5284
|
+
}
|
|
5285
|
+
static validateConfiguration(cfg) {
|
|
5286
|
+
if (!cfg.endpoint) {
|
|
5287
|
+
throw new Error("[FederatedCatalogueDcpStoreAdapter] `endpoint` is required in StoreConfig");
|
|
5288
|
+
}
|
|
5289
|
+
}
|
|
5290
|
+
static getStoreInstance(cfg) {
|
|
5291
|
+
if (!cfg) {
|
|
5292
|
+
throw new Error("[FederatedCatalogueDcpStoreAdapter] configuration is required");
|
|
5293
|
+
}
|
|
5294
|
+
FederatedCatalogueDcpStoreAdapter.validateConfiguration(cfg);
|
|
5295
|
+
return new FederatedCatalogueDcpStore(cfg);
|
|
5296
|
+
}
|
|
5297
|
+
}
|
|
4878
5298
|
const _LocalStorageCacheMetadataManager = class _LocalStorageCacheMetadataManager {
|
|
4879
5299
|
constructor(endpoint, ttlMs = _LocalStorageCacheMetadataManager.DEFAULT_TTL_MS) {
|
|
4880
5300
|
this.endpoint = endpoint;
|
|
@@ -27565,24 +27985,24 @@ let __tla = (async () => {
|
|
|
27565
27985
|
}
|
|
27566
27986
|
msg += "must be ";
|
|
27567
27987
|
const types2 = [];
|
|
27568
|
-
const
|
|
27988
|
+
const instances2 = [];
|
|
27569
27989
|
const other = [];
|
|
27570
27990
|
for (const value of expected) {
|
|
27571
27991
|
assert(typeof value === "string", "All expected entries have to be of type string");
|
|
27572
27992
|
if (kTypes.includes(value)) {
|
|
27573
27993
|
types2.push(value.toLowerCase());
|
|
27574
27994
|
} else if (classRegExp.test(value)) {
|
|
27575
|
-
|
|
27995
|
+
instances2.push(value);
|
|
27576
27996
|
} else {
|
|
27577
27997
|
assert(value !== "object", 'The value "object" should be written as "Object"');
|
|
27578
27998
|
other.push(value);
|
|
27579
27999
|
}
|
|
27580
28000
|
}
|
|
27581
|
-
if (
|
|
28001
|
+
if (instances2.length > 0) {
|
|
27582
28002
|
const pos = types2.indexOf("object");
|
|
27583
28003
|
if (pos !== -1) {
|
|
27584
28004
|
types2.splice(types2, pos, 1);
|
|
27585
|
-
|
|
28005
|
+
instances2.push("Object");
|
|
27586
28006
|
}
|
|
27587
28007
|
}
|
|
27588
28008
|
if (types2.length > 0) {
|
|
@@ -27598,21 +28018,21 @@ let __tla = (async () => {
|
|
|
27598
28018
|
msg += `one of type ${types2.join(", ")}, or ${last}`;
|
|
27599
28019
|
}
|
|
27600
28020
|
}
|
|
27601
|
-
if (
|
|
28021
|
+
if (instances2.length > 0 || other.length > 0) {
|
|
27602
28022
|
msg += " or ";
|
|
27603
28023
|
}
|
|
27604
28024
|
}
|
|
27605
|
-
if (
|
|
27606
|
-
switch (
|
|
28025
|
+
if (instances2.length > 0) {
|
|
28026
|
+
switch (instances2.length) {
|
|
27607
28027
|
case 1:
|
|
27608
|
-
msg += `an instance of ${
|
|
28028
|
+
msg += `an instance of ${instances2[0]}`;
|
|
27609
28029
|
break;
|
|
27610
28030
|
case 2:
|
|
27611
|
-
msg += `an instance of ${
|
|
28031
|
+
msg += `an instance of ${instances2[0]} or ${instances2[1]}`;
|
|
27612
28032
|
break;
|
|
27613
28033
|
default: {
|
|
27614
|
-
const last =
|
|
27615
|
-
msg += `an instance of ${
|
|
28034
|
+
const last = instances2.pop();
|
|
28035
|
+
msg += `an instance of ${instances2.join(", ")}, or ${last}`;
|
|
27616
28036
|
}
|
|
27617
28037
|
}
|
|
27618
28038
|
if (other.length > 0) {
|
|
@@ -33121,7 +33541,7 @@ sh:property [
|
|
|
33121
33541
|
window.dispatchEvent(event);
|
|
33122
33542
|
}
|
|
33123
33543
|
async initGetter() {
|
|
33124
|
-
const { CustomGetter } = await import("./custom-getter-
|
|
33544
|
+
const { CustomGetter } = await import("./custom-getter-CeqxfVXE.js");
|
|
33125
33545
|
return CustomGetter;
|
|
33126
33546
|
}
|
|
33127
33547
|
disconnectedCallback() {
|
|
@@ -33496,6 +33916,7 @@ sh:property [
|
|
|
33496
33916
|
StoreType = ((StoreType2) => {
|
|
33497
33917
|
StoreType2["LDP"] = "ldp";
|
|
33498
33918
|
StoreType2["FederatedCatalogue"] = "federatedCatalogue";
|
|
33919
|
+
StoreType2["FederatedCatalogueDcp"] = "federatedCatalogueDcp";
|
|
33499
33920
|
StoreType2["DataspaceConnector"] = "dataspaceConnector";
|
|
33500
33921
|
return StoreType2;
|
|
33501
33922
|
})(StoreType || {});
|
|
@@ -33514,6 +33935,7 @@ sh:property [
|
|
|
33514
33935
|
})(StoreFactory || (StoreFactory = {}));
|
|
33515
33936
|
StoreFactory.register(StoreType.LDP, LdpStoreAdapter);
|
|
33516
33937
|
StoreFactory.register(StoreType.FederatedCatalogue, FederatedCatalogueStoreAdapter);
|
|
33938
|
+
StoreFactory.register(StoreType.FederatedCatalogueDcp, FederatedCatalogueDcpStoreAdapter);
|
|
33517
33939
|
StoreFactory.register(StoreType.DataspaceConnector, DataspaceConnectorStoreAdapter);
|
|
33518
33940
|
StoreService = (_a = class {
|
|
33519
33941
|
static addStore(name, config) {
|
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.25",
|
|
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",
|