@piveau/dpi 0.2.0-alpha.58 → 0.2.0-alpha.59

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,11 +1,11 @@
1
1
  import "axios";
2
- import { asSomeArray as pt } from "../../composables/useDpiSimpleLoader.js";
2
+ import { asSomeArray as gt } from "../../composables/useDpiSimpleLoader.js";
3
3
  let d = { distribution: [], dataset: {}, meta: {} };
4
- function gt(t) {
4
+ function ut(t) {
5
5
  return t.replace(/[^a-z0-9\s]/gi, "").replace(/\s+/g, "-").toLowerCase();
6
6
  }
7
- async function ft(t, g, l, b) {
8
- var A, v, f, D, k, O, R, j, S, w, I, x, L, U, B, P, C, T, G, M, q, X, z, F, $, N, E, H, W, Y, _, J, K, Q, Z, m, V, tt, it, dt, et, at, nt, ct, ot, st, lt;
7
+ async function kt(t, g, l, b) {
8
+ var A, v, f, D, k, O, R, j, S, w, I, x, L, U, B, P, C, T, G, M, q, X, z, F, $, N, E, H, W, Y, _, J, K, Q, Z, m, V, tt, it, dt, et, at, nt, ct, ot, st, lt, rt, pt;
9
9
  const u = g.specification.prefixes;
10
10
  let p = [];
11
11
  const o = Object.keys(t);
@@ -14,7 +14,7 @@ async function ft(t, g, l, b) {
14
14
  p.push(crypto.randomUUID()), d.dataset["dcat:distribution"].push({
15
15
  "@id": `https://piveau.io/set/distribution/${p[c]}`
16
16
  });
17
- const bt = new URLSearchParams(window.location.search).get("edit");
17
+ const yt = new URLSearchParams(window.location.search).get("edit");
18
18
  let y = "";
19
19
  try {
20
20
  for (let c = 0; c < o.length; c++) {
@@ -33,9 +33,9 @@ async function ft(t, g, l, b) {
33
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 = gt(
36
+ Object.keys(t.BasicInfos)[i] === "dct:title" && (d.dataset["dct:title"] = t.BasicInfos["dct:title"][0] || "", y = ut(
37
37
  t.BasicInfos["dct:title"][0]["@value"]
38
- ), bt === "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
+ ), yt === "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
40
  if (o[c] === "Covering" && Object.keys(t.Covering).length > 1)
41
41
  for (let i = 0; i < Object.keys(t.Covering).length; i++) {
@@ -110,7 +110,7 @@ async function ft(t, g, l, b) {
110
110
  "@id": (e == null ? void 0 : e.uri) || ""
111
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
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"] = pt(
113
+ if (s.length !== 0 && (d.distribution[i]["dct:conformsTo"] = gt(
114
114
  s
115
115
  ).filter(
116
116
  (a) => a && (a["dcat:downloadURL"] || a["dct:title"])
@@ -175,8 +175,8 @@ async function ft(t, g, l, b) {
175
175
  ).length !== 0 && (d.distribution[i]["adms:status"] = {
176
176
  "@id": t.DistributionSimple["dcat:distribution"][i]["adms:status"].uri || ""
177
177
  });
178
- const rt = ((J = (_ = (Y = t.DistributionSimple) == null ? void 0 : Y["dcat:distribution"]) == null ? void 0 : _[i]) == null ? void 0 : J.accessServices) || [];
179
- if (rt.length !== 0 && (d.distribution[i]["dcat:accessService"] = (K = pt(rt)) == null ? void 0 : K.filter(
178
+ const bt = ((J = (_ = (Y = t.DistributionSimple) == null ? void 0 : Y["dcat:distribution"]) == null ? void 0 : _[i]) == null ? void 0 : J.accessServices) || [];
179
+ if (bt.length !== 0 && (d.distribution[i]["dcat:accessService"] = (K = gt(bt)) == null ? void 0 : K.filter(
180
180
  (a) => a && (a["dct:title"] || a["dct:description"] || a["dcat:downloadURL"] || a["dcat:endpointURL"])
181
181
  ).map((a) => {
182
182
  const n = {
@@ -194,7 +194,7 @@ async function ft(t, g, l, b) {
194
194
  return r !== void 0 && (n["dcat:endpointURL"] = {
195
195
  "@id": r
196
196
  }), n;
197
- })), d.distribution[i]["foaf:page"] || (d.distribution[i]["foaf:page"] = []), d.distribution[i]["foaf:page"].length !== 0)
197
+ })), d.distribution[i]["foaf:page"] || (d.distribution[i]["foaf:page"] = []), d.distribution[i]["foaf:page"].length === 0)
198
198
  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++) {
199
199
  const n = t.DistributionSimple["dcat:distribution"][i].documentations[a];
200
200
  if ((n == null ? void 0 : n["dct:title"]) !== void 0) {
@@ -456,8 +456,10 @@ async function ft(t, g, l, b) {
456
456
  );
457
457
  for (let e = 0; e < t.Additionals["foaf:page"].length; e++)
458
458
  d.dataset["foaf:page"] === void 0 && (d.dataset["foaf:page"] = []), d.dataset["foaf:page"].push({
459
- "dct:format": {
460
- "@id": (nt = (at = t.Additionals["foaf:page"]) == null ? void 0 : at[e]) == null ? void 0 : nt.uri
459
+ ...((nt = (at = t.Additionals["foaf:page"]) == null ? void 0 : at[e]) == null ? void 0 : nt.uri) && {
460
+ "dct:format": {
461
+ "@id": (ot = (ct = t.Additionals["foaf:page"]) == null ? void 0 : ct[e]) == null ? void 0 : ot.uri
462
+ }
461
463
  },
462
464
  "dct:title": t.Additionals["foaf:page"][e]["dct:title"],
463
465
  "dct:description": t.Additionals["foaf:page"][e]["dct:description"],
@@ -499,7 +501,7 @@ async function ft(t, g, l, b) {
499
501
  }), Object.keys(t.Additionals)[i] === "dcatde:politicalGeocodingLevelURI")
500
502
  for (let e = 0; e < t.Additionals["dcatde:politicalGeocodingLevelURI"].length; e++)
501
503
  d.dataset["dcatde:politicalGeocodingLevelURI"] === void 0 && (d.dataset["dcatde:politicalGeocodingLevelURI"] = []), d.dataset["dcatde:politicalGeocodingLevelURI"].push({
502
- "@id": ((ot = (ct = t.Additionals["dcatde:politicalGeocodingLevelURI"]) == null ? void 0 : ct[e]) == null ? void 0 : ot.uri) || ((lt = (st = t.Additionals["dcatde:politicalGeocodingLevelURI"]) == null ? void 0 : st[e]) == null ? void 0 : lt["@id"]) || ""
504
+ "@id": ((lt = (st = t.Additionals["dcatde:politicalGeocodingLevelURI"]) == null ? void 0 : st[e]) == null ? void 0 : lt.uri) || ((pt = (rt = t.Additionals["dcatde:politicalGeocodingLevelURI"]) == null ? void 0 : rt[e]) == null ? void 0 : pt["@id"]) || ""
503
505
  });
504
506
  }
505
507
  } catch (i) {
@@ -509,7 +511,7 @@ async function ft(t, g, l, b) {
509
511
  } catch (c) {
510
512
  console.log(c);
511
513
  }
512
- let h = yt(d, u);
514
+ let h = ht(d, u);
513
515
  return { actionParams: {
514
516
  id: y,
515
517
  catalog: l.permissions[0].rsname,
@@ -518,7 +520,7 @@ async function ft(t, g, l, b) {
518
520
  description: d.dataset["dct:description"]["@value"]
519
521
  }, body: h };
520
522
  }
521
- function yt(t, g) {
523
+ function ht(t, g) {
522
524
  const l = {}, b = Object.keys(t);
523
525
  for (let o = 0; o < b.length; o++)
524
526
  b[o], l[b[o]] = t[b[o]];
@@ -538,5 +540,5 @@ function yt(t, g) {
538
540
  return console.log(p), p;
539
541
  }
540
542
  export {
541
- ft as default
543
+ kt as default
542
544
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@piveau/dpi",
3
3
  "type": "module",
4
- "version": "0.2.0-alpha.58",
4
+ "version": "0.2.0-alpha.59",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "*.css",