@piveau/dpi 0.1.0-beta.62 → 0.1.0-beta.64

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,24 +1,24 @@
1
1
  import "axios";
2
- import { asSomeArray as st } from "../../composables/useDpiSimpleLoader.js";
2
+ import { asSomeArray as lt } from "../../composables/useDpiSimpleLoader.js";
3
3
  let d = { distribution: [], dataset: {}, meta: {} };
4
- function rt(t) {
4
+ function pt(t) {
5
5
  return t.replace(/[^a-z0-9\s]/gi, "").replace(/\s+/g, "-").toLowerCase();
6
6
  }
7
- async function At(t, g, l, b) {
8
- var h, v, f, D, k, O, j, R, w, S, I, x, L, B, U, P, C, T, M, G, q, X, z, F, $, N, E, H, W, Y, _, J, K, Q, Z, m, V, tt, it, dt, et, at, nt, ot;
7
+ async function ht(t, g, l, b) {
8
+ var h, v, f, D, k, O, j, R, w, S, I, x, L, B, U, P, C, T, M, G, q, X, z, F, $, N, E, H, W, Y, _, J, K, Q, Z, m, V, tt, it, dt, et, at, nt, ct, ot;
9
9
  const u = g.specification.prefixes;
10
10
  let p = [];
11
- const c = Object.keys(t);
11
+ const o = Object.keys(t);
12
12
  d.dataset["dcat:distribution"] = [];
13
- for (let o = 0; o < t.DistributionSimple["dcat:distribution"].length; o++)
13
+ for (let c = 0; c < t.DistributionSimple["dcat:distribution"].length; c++)
14
14
  p.push(crypto.randomUUID()), d.dataset["dcat:distribution"].push({
15
- "@id": `https://piveau.io/set/distribution/${p[o]}`
15
+ "@id": `https://piveau.io/set/distribution/${p[c]}`
16
16
  });
17
- const lt = new URLSearchParams(window.location.search).get("edit");
17
+ const rt = new URLSearchParams(window.location.search).get("edit");
18
18
  let y = "";
19
19
  try {
20
- for (let o = 0; o < c.length; o++) {
21
- if (c[o] === "Discoverability") {
20
+ for (let c = 0; c < o.length; c++) {
21
+ if (o[c] === "Discoverability") {
22
22
  let i = [];
23
23
  for (let e = 1; e < t.Discoverability.discoverabilityPage.length; e++)
24
24
  i.push({
@@ -30,14 +30,14 @@ async function At(t, g, l, b) {
30
30
  "@id": "http://data.europa.eu/eli/reg_impl/2023/138/oj"
31
31
  });
32
32
  }
33
- if (c[o] === "BasicInfos") {
33
+ if (o[c] === "BasicInfos") {
34
34
  d.dataset["dpi:isDPIv3"] = !0;
35
35
  for (let i = 0; i < Object.keys(t.BasicInfos).length; i++)
36
- Object.keys(t.BasicInfos)[i] === "dct:title" && (d.dataset["dct:title"] = t.BasicInfos["dct:title"][0] || "", y = rt(
36
+ Object.keys(t.BasicInfos)[i] === "dct:title" && (d.dataset["dct:title"] = t.BasicInfos["dct:title"][0] || "", y = pt(
37
37
  t.BasicInfos["dct:title"][0]["@value"]
38
- ), lt === "true" && (y = t.BasicInfos.datasetID)), Object.keys(t.BasicInfos)[i] === "dct:description" && (d.dataset["dct:description"] = t.BasicInfos["dct:description"][0] || ""), Object.keys(t.BasicInfos)[i] === "dct:modified" && (d.dataset["dct:modified"] = t.BasicInfos["dct:modified"][0] || "", d.dataset["dct:modified"]["@type"] = "http://www.w3.org/2001/XMLSchema#date"), Object.keys(t.BasicInfos)[i] === "dct:publisher" && (d.dataset["dct:publisher"] = t.BasicInfos["dct:publisher"][0] || "", d.dataset["dct:publisher"]["@type"] = "foaf:Agent"), Object.keys(t.BasicInfos)[i] === "dcat:contactPoint" && (d.dataset["dcat:contactPoint"] = t.BasicInfos["dcat:contactPoint"][0] || "", d.dataset["dcat:contactPoint"]["@type"] = "vcard:Organization"), d.dataset["@type"] = "dcat:Dataset", d.meta["dcat:catalog"] = l.permissions[0].rsname, d.meta["@type"] = "dcat:CatalogRecord";
38
+ ), rt === "true" && (y = t.BasicInfos.datasetID)), Object.keys(t.BasicInfos)[i] === "dct:description" && (d.dataset["dct:description"] = t.BasicInfos["dct:description"][0] || ""), Object.keys(t.BasicInfos)[i] === "dct:modified" && (d.dataset["dct:modified"] = t.BasicInfos["dct:modified"][0] || "", d.dataset["dct:modified"]["@type"] = "http://www.w3.org/2001/XMLSchema#date"), Object.keys(t.BasicInfos)[i] === "dct:publisher" && (d.dataset["dct:publisher"] = t.BasicInfos["dct:publisher"][0] || "", d.dataset["dct:publisher"]["@type"] = "foaf:Agent"), Object.keys(t.BasicInfos)[i] === "dcat:contactPoint" && (d.dataset["dcat:contactPoint"] = t.BasicInfos["dcat:contactPoint"][0] || "", d.dataset["dcat:contactPoint"]["@type"] = "vcard:Organization"), d.dataset["@type"] = "dcat:Dataset", d.meta["dcat:catalog"] = l.permissions[0].rsname, d.meta["@type"] = "dcat:CatalogRecord";
39
39
  }
40
- if (c[o] === "Covering" && Object.keys(t.Covering).length > 1)
40
+ if (o[c] === "Covering" && Object.keys(t.Covering).length > 1)
41
41
  for (let i = 0; i < Object.keys(t.Covering).length; i++) {
42
42
  if (Object.keys(t.Covering)[i] === "dcat:temporalResolution" && t.Covering["dcat:temporalResolution"] !== void 0 && Object.keys((f = t.Covering) == null ? void 0 : f["dcat:temporalResolution"]).length > 0 && ((k = (D = t.Covering) == null ? void 0 : D["dcat:temporalResolution"]) == null ? void 0 : k.type) !== void 0) {
43
43
  d.dataset["dct:temporal"] = [];
@@ -64,15 +64,15 @@ async function At(t, g, l, b) {
64
64
  }
65
65
  });
66
66
  }
67
- Object.keys(t.Covering)[i] === "dcatde:politicalGeocodingURI" && ((j = (O = t.Covering) == null ? void 0 : O["dcatde:politicalGeocodingURI"]) == null ? void 0 : j.uri) != null && (console.log("hallo?"), d.dataset["dcatde:politicalGeocodingURI"] = {
68
- "@id": ((w = (R = t.Covering["dcatde:politicalGeocodingURI"]) == null ? void 0 : R[0]) == null ? void 0 : w.uri) || ""
67
+ Object.keys(t.Covering)[i] === "dcatde:politicalGeocodingURI" && ((R = (j = (O = t.Covering) == null ? void 0 : O["dcatde:politicalGeocodingURI"]) == null ? void 0 : j[0]) == null ? void 0 : R.uri) != null && (d.dataset["dcatde:politicalGeocodingURI"] = {
68
+ "@id": ((S = (w = t.Covering["dcatde:politicalGeocodingURI"]) == null ? void 0 : w[0]) == null ? void 0 : S.uri) || ""
69
69
  }, d.dataset["dct:spatial"] === void 0 && (d.dataset["dct:spatial"] = []), d.dataset["dct:spatial"].push({
70
- "@id": ((I = (S = t.Covering["dcatde:politicalGeocodingURI"]) == null ? void 0 : S[0]) == null ? void 0 : I.uri) || ""
70
+ "@id": ((x = (I = t.Covering["dcatde:politicalGeocodingURI"]) == null ? void 0 : I[0]) == null ? void 0 : x.uri) || ""
71
71
  }));
72
72
  }
73
- if (c[o] === "DistributionSimple")
73
+ if (o[c] === "DistributionSimple")
74
74
  for (let i = 0; i < t.DistributionSimple["dcat:distribution"].length; i++) {
75
- if (d.distribution[i] = {}, ((L = (x = t.Discoverability) == null ? void 0 : x.hvdPage[0]) == null ? void 0 : L.uri) != null && (d.distribution[i]["dcatap:applicableLegislation"] = {
75
+ if (d.distribution[i] = {}, ((B = (L = t.Discoverability) == null ? void 0 : L.hvdPage[0]) == null ? void 0 : B.uri) != null && (d.distribution[i]["dcatap:applicableLegislation"] = {
76
76
  "@id": "http://data.europa.eu/eli/reg_impl/2023/138/oj"
77
77
  }), d.distribution[i]["@type"] = "dcat:Distribution", d.distribution[i]["@id"] = `https://piveau.io/set/distribution/${p[i]}`, t.DistributionSimple["dcat:distribution"][i]["dcat:accessURL"] && (d.distribution[i]["dcat:accessURL"] = {
78
78
  "@id": t.DistributionSimple["dcat:distribution"][i]["dcat:accessURL"]
@@ -86,8 +86,8 @@ async function At(t, g, l, b) {
86
86
  };
87
87
  }
88
88
  if (Object.keys(
89
- (B = t.DistributionSimple["dcat:distribution"][i]) == null ? void 0 : B.policyItems
90
- ).length !== 0 && ((U = t.DistributionSimple["dcat:distribution"][i]) == null ? void 0 : U.policyItems[0]["dcat:downloadURL"]) !== "") {
89
+ (U = t.DistributionSimple["dcat:distribution"][i]) == null ? void 0 : U.policyItems
90
+ ).length !== 0 && ((P = t.DistributionSimple["dcat:distribution"][i]) == null ? void 0 : P.policyItems[0]["dcat:downloadURL"]) !== "") {
91
91
  d.distribution[i]["odrl:hasPolicy"] = [];
92
92
  for (let a = 0; a < t.DistributionSimple["dcat:distribution"][i].policyItems.length; a++)
93
93
  d.distribution[i]["odrl:hasPolicy"][a] = {
@@ -95,7 +95,7 @@ async function At(t, g, l, b) {
95
95
  };
96
96
  }
97
97
  Object.keys(
98
- (P = t.DistributionSimple["dcat:distribution"][i]) == null ? void 0 : P["dct:license"]
98
+ (C = t.DistributionSimple["dcat:distribution"][i]) == null ? void 0 : C["dct:license"]
99
99
  ).length !== 0 && (d.distribution[i]["dct:license"] = {
100
100
  "@id": t.DistributionSimple["dcat:distribution"][i]["dct:license"].uri || t.DistributionSimple["dct:license"][0].uri
101
101
  }, t.DistributionSimple["dcat:distribution"][i]["dct:license"]["dcterms:license"] === "" && t.DistributionSimple["dct:license"][0].title !== "" && (d.distribution[i]["dcatde:licenseAttributionByText"] = {
@@ -105,12 +105,12 @@ async function At(t, g, l, b) {
105
105
  "@language": "de",
106
106
  "@value": t.DistributionSimple["dcat:distribution"][i]["dct:license"].title
107
107
  }));
108
- const e = (M = (T = (C = t.DistributionSimple) == null ? void 0 : C["dcat:distribution"]) == null ? void 0 : T[i]) == null ? void 0 : M["dct:format"];
108
+ const e = (G = (M = (T = t.DistributionSimple) == null ? void 0 : T["dcat:distribution"]) == null ? void 0 : M[i]) == null ? void 0 : G["dct:format"];
109
109
  e && (d.distribution[i]["dct:format"] = {
110
110
  "@id": (e == null ? void 0 : e.uri) || ""
111
- }), ((X = (q = (G = t.DistributionSimple) == null ? void 0 : G["dcat:distribution"]) == null ? void 0 : q[i]) == null ? void 0 : X["dcatap:applicableLegislation"]) != null && (d.distribution[i]["dct:format"] = ($ = (F = (z = t.DistributionSimple) == null ? void 0 : z["dcat:distribution"]) == null ? void 0 : F[i]) == null ? void 0 : $["dcatap:applicableLegislation"]["@id"]);
112
- const s = ((H = (E = (N = t.DistributionSimple) == null ? void 0 : N["dcat:distribution"]) == null ? void 0 : E[i]) == null ? void 0 : H.conformsToItems) || [];
113
- if (s.length !== 0 && (d.distribution[i]["dct:conformsTo"] = st(
111
+ }), ((z = (X = (q = t.DistributionSimple) == null ? void 0 : q["dcat:distribution"]) == null ? void 0 : X[i]) == null ? void 0 : z["dcatap:applicableLegislation"]) != null && (d.distribution[i]["dct:format"] = (N = ($ = (F = t.DistributionSimple) == null ? void 0 : F["dcat:distribution"]) == null ? void 0 : $[i]) == null ? void 0 : N["dcatap:applicableLegislation"]["@id"]);
112
+ const s = ((W = (H = (E = t.DistributionSimple) == null ? void 0 : E["dcat:distribution"]) == null ? void 0 : H[i]) == null ? void 0 : W.conformsToItems) || [];
113
+ if (s.length !== 0 && (d.distribution[i]["dct:conformsTo"] = lt(
114
114
  s
115
115
  ).filter(
116
116
  (a) => a && (a["dcat:downloadURL"] || a["dct:title"])
@@ -171,8 +171,8 @@ async function At(t, g, l, b) {
171
171
  ).length !== 0 && (d.distribution[i]["adms:status"] = {
172
172
  "@id": t.DistributionSimple["dcat:distribution"][i]["adms:status"].uri || ""
173
173
  });
174
- const ct = ((_ = (Y = (W = t.DistributionSimple) == null ? void 0 : W["dcat:distribution"]) == null ? void 0 : Y[i]) == null ? void 0 : _.accessServices) || [];
175
- if (ct.length !== 0 && (d.distribution[i]["dcat:accessService"] = (J = st(ct)) == null ? void 0 : J.filter(
174
+ const st = ((J = (_ = (Y = t.DistributionSimple) == null ? void 0 : Y["dcat:distribution"]) == null ? void 0 : _[i]) == null ? void 0 : J.accessServices) || [];
175
+ if (st.length !== 0 && (d.distribution[i]["dcat:accessService"] = (K = lt(st)) == null ? void 0 : K.filter(
176
176
  (a) => a && (a["dct:title"] || a["dct:description"] || a["dcat:downloadURL"] || a["dcat:endpointURL"])
177
177
  ).map((a) => {
178
178
  const n = {
@@ -191,7 +191,7 @@ async function At(t, g, l, b) {
191
191
  "@id": r
192
192
  }), n;
193
193
  })), d.distribution[i]["foaf:page"] || (d.distribution[i]["foaf:page"] = []), d.distribution[i]["foaf:page"].length !== 0)
194
- for (let a = 0; a < ((Z = (Q = (K = t.DistributionSimple) == null ? void 0 : K["dcat:distribution"]) == null ? void 0 : Q[i]) == null ? void 0 : Z.documentations.length); a++) {
194
+ for (let a = 0; a < ((m = (Z = (Q = t.DistributionSimple) == null ? void 0 : Q["dcat:distribution"]) == null ? void 0 : Z[i]) == null ? void 0 : m.documentations.length); a++) {
195
195
  const n = t.DistributionSimple["dcat:distribution"][i].documentations[a];
196
196
  if ((n == null ? void 0 : n["dct:title"]) !== void 0) {
197
197
  const r = {
@@ -212,7 +212,7 @@ async function At(t, g, l, b) {
212
212
  }
213
213
  }
214
214
  }
215
- if (c[o], c[o] === "Additionals")
215
+ if (o[c], o[c] === "Additionals")
216
216
  try {
217
217
  for (let i = 0; i < Object.keys(t.Additionals).length; i++) {
218
218
  if (Object.keys(t.Additionals)[i] === "dcat:landingPage" && (d.dataset["dcat:landingPage"] = [
@@ -233,7 +233,7 @@ async function At(t, g, l, b) {
233
233
  for (let e = 0; e < t.Additionals["dcat:keyword"].length; e++)
234
234
  d.dataset["dcat:keyword"] === void 0 && (d.dataset["dcat:keyword"] = []), d.dataset["dcat:keyword"].push({
235
235
  "@value": t.Additionals["dcat:keyword"][e]["@value"],
236
- "@language": ((V = (m = t.Additionals["dcat:keyword"]) == null ? void 0 : m[e]) == null ? void 0 : V["@language"]) || "de"
236
+ "@language": ((tt = (V = t.Additionals["dcat:keyword"]) == null ? void 0 : V[e]) == null ? void 0 : tt["@language"]) || "de"
237
237
  });
238
238
  }
239
239
  if (Object.keys(t.Additionals)[i] === "dct:references") {
@@ -315,7 +315,7 @@ async function At(t, g, l, b) {
315
315
  for (let e = 0; e < t.Additionals["dcatde:legalBasis"].length; e++)
316
316
  d.dataset["dcatde:legalBasis"] === void 0 && (d.dataset["dcatde:legalBasis"] = []), d.dataset["dcatde:legalBasis"].push({
317
317
  "@value": t.Additionals["dcatde:legalBasis"][e]["@value"],
318
- "@language": ((dt = (it = (tt = t.Additionals) == null ? void 0 : tt["dcatde:legalBasis"]) == null ? void 0 : it[e]) == null ? void 0 : dt["@language"]) || "de"
318
+ "@language": ((et = (dt = (it = t.Additionals) == null ? void 0 : it["dcatde:legalBasis"]) == null ? void 0 : dt[e]) == null ? void 0 : et["@language"]) || "de"
319
319
  });
320
320
  }
321
321
  if (Object.keys(t.Additionals)[i] === "dct:relation") {
@@ -453,7 +453,7 @@ async function At(t, g, l, b) {
453
453
  for (let e = 0; e < t.Additionals["foaf:page"].length; e++)
454
454
  d.dataset["foaf:page"] === void 0 && (d.dataset["foaf:page"] = []), d.dataset["foaf:page"].push({
455
455
  "dct:format": {
456
- "@id": (at = (et = t.Additionals["foaf:page"]) == null ? void 0 : et[e]) == null ? void 0 : at.uri
456
+ "@id": (nt = (at = t.Additionals["foaf:page"]) == null ? void 0 : at[e]) == null ? void 0 : nt.uri
457
457
  },
458
458
  "dct:title": t.Additionals["foaf:page"][e]["dct:title"],
459
459
  "dct:description": t.Additionals["foaf:page"][e]["dct:description"],
@@ -495,17 +495,17 @@ async function At(t, g, l, b) {
495
495
  }), Object.keys(t.Additionals)[i] === "dcatde:politicalGeocodingLevelURI")
496
496
  for (let e = 0; e < t.Additionals["dcatde:politicalGeocodingLevelURI"].length; e++)
497
497
  d.dataset["dcatde:politicalGeocodingLevelURI"] === void 0 && (d.dataset["dcatde:politicalGeocodingLevelURI"] = []), d.dataset["dcatde:politicalGeocodingLevelURI"].push({
498
- "@id": ((ot = (nt = t.Additionals["dcatde:politicalGeocodingLevelURI"]) == null ? void 0 : nt[e]) == null ? void 0 : ot.uri) || ""
498
+ "@id": ((ot = (ct = t.Additionals["dcatde:politicalGeocodingLevelURI"]) == null ? void 0 : ct[e]) == null ? void 0 : ot.uri) || ""
499
499
  });
500
500
  }
501
501
  } catch (i) {
502
502
  throw console.error("Validation Error:", i.message), i;
503
503
  }
504
504
  }
505
- } catch (o) {
506
- console.log(o);
505
+ } catch (c) {
506
+ console.log(c);
507
507
  }
508
- let A = pt(d, u);
508
+ let A = bt(d, u);
509
509
  return { actionParams: {
510
510
  id: y,
511
511
  catalog: l.permissions[0].rsname,
@@ -514,10 +514,10 @@ async function At(t, g, l, b) {
514
514
  description: d.dataset["dct:description"]["@value"]
515
515
  }, body: A };
516
516
  }
517
- function pt(t, g) {
517
+ function bt(t, g) {
518
518
  const l = {}, b = Object.keys(t);
519
- for (let c = 0; c < b.length; c++)
520
- b[c], l[b[c]] = t[b[c]];
519
+ for (let o = 0; o < b.length; o++)
520
+ b[o], l[b[o]] = t[b[o]];
521
521
  let p = {
522
522
  "@graph": [
523
523
  {
@@ -534,5 +534,5 @@ function pt(t, g) {
534
534
  return console.log(p), p;
535
535
  }
536
536
  export {
537
- At as default
537
+ ht as default
538
538
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@piveau/dpi",
3
3
  "type": "module",
4
- "version": "0.1.0-beta.62",
4
+ "version": "0.1.0-beta.64",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "*.css",