@piveau/dpi 0.1.0-beta.76 → 0.1.0-beta.79

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,7 +1,7 @@
1
1
  import { toRef as ee, ref as te, toValue as N, computed as k, watch as q } from "vue";
2
2
  import { useAsyncState as ie } from "@vueuse/core";
3
- import { defineJsonldResolver as re, dcatDatasetTransformer as oe, datasetResolvers as ae } from "@piveau/jsonld";
4
- import { isEmpty as ne } from "lodash-es";
3
+ import { defineJsonldResolver as re, dcatDatasetTransformer as oe, datasetResolvers as ne } from "@piveau/jsonld";
4
+ import { isEmpty as ae } from "lodash-es";
5
5
  function V(e) {
6
6
  return e == null ? [] : Array.isArray(e) ? e : [e];
7
7
  }
@@ -15,14 +15,14 @@ function s(e) {
15
15
  function ce(e) {
16
16
  return Object.fromEntries(
17
17
  Object.entries(e).filter(
18
- ([r, t]) => t != null && !ne(t)
18
+ ([r, t]) => t != null && !ae(t)
19
19
  )
20
20
  );
21
21
  }
22
22
  function De(e, r) {
23
- const { enabled: t, hubSearchUrl: i } = r, n = ee(t), { safeTransform: f } = re({
23
+ const { enabled: t, hubSearchUrl: i } = r, a = ee(t), { safeTransform: f } = re({
24
24
  baseUrl: i,
25
- resolvers: ae(),
25
+ resolvers: ne(),
26
26
  transformer: oe
27
27
  }), c = te([]), {
28
28
  state: m,
@@ -32,7 +32,7 @@ function De(e, r) {
32
32
  execute: B
33
33
  } = ie(
34
34
  async () => {
35
- var T;
35
+ var A;
36
36
  const l = await f(N(e));
37
37
  if (l.error)
38
38
  return c.value.push({
@@ -40,7 +40,7 @@ function De(e, r) {
40
40
  message: l.error.message
41
41
  }), null;
42
42
  const h = l.data;
43
- return (!h || !((T = h["dpi:isDPIv3"]) != null && T["@value"])) && c.value.push({
43
+ return (!h || !((A = h["dpi:isDPIv3"]) != null && A["@value"])) && c.value.push({
44
44
  code: "not_dpi_v3",
45
45
  message: `The dataset is not a DPI v3 dataset. ID ${h["@id"]}`
46
46
  }), {
@@ -51,20 +51,20 @@ function De(e, r) {
51
51
  null,
52
52
  { immediate: !1 }
53
53
  ), R = k(
54
- () => n.value && !y.value && !!g.value
54
+ () => a.value && !y.value && !!g.value
55
55
  ), L = k(
56
- () => n.value && !!R.value
57
- ), v = k(() => L.value), w = k(() => {
56
+ () => a.value && !!R.value
57
+ ), T = k(() => L.value), w = k(() => {
58
58
  var l;
59
59
  return (l = m.value) == null ? void 0 : l.dpiData;
60
- }), P = k(() => {
60
+ }), U = k(() => {
61
61
  var l;
62
62
  return (l = m.value) == null ? void 0 : l.data;
63
63
  });
64
64
  return q(
65
65
  () => N(e),
66
- (l) => l && n.value ? B() : null
67
- ), q(P, (l) => {
66
+ (l) => l && a.value ? B() : null
67
+ ), q(U, (l) => {
68
68
  console.log("jsonld resolved result:", l);
69
69
  }), q(b, (l) => {
70
70
  console.log("jsonld error:", l);
@@ -73,7 +73,7 @@ function De(e, r) {
73
73
  isProcessedInputReady: R,
74
74
  result: w,
75
75
  isMaterialized: L,
76
- isReady: v,
76
+ isReady: T,
77
77
  errors: c
78
78
  };
79
79
  }
@@ -97,7 +97,7 @@ function d(e, r = "de") {
97
97
  return e[r] || Object.values(e)[0] || "";
98
98
  if (Array.isArray(e)) {
99
99
  const t = e.find(
100
- (n) => n["@language"] === r
100
+ (a) => a["@language"] === r
101
101
  );
102
102
  if (t)
103
103
  return t["@value"] || "";
@@ -114,7 +114,7 @@ function C(e) {
114
114
  "@value": e.label
115
115
  };
116
116
  }
117
- function A(e, r) {
117
+ function P(e, r) {
118
118
  const t = e.prefLabel;
119
119
  return C({
120
120
  uri: e["@id"] || e["purl:identifier"] || "",
@@ -157,8 +157,8 @@ function de(e, r) {
157
157
  }
158
158
  function Y(e, r) {
159
159
  const t = { isValid: !0 };
160
- for (const [i, n] of Object.entries(r))
161
- t[i] = u(e == null ? void 0 : e[n]);
160
+ for (const [i, a] of Object.entries(r))
161
+ t[i] = u(e == null ? void 0 : e[a]);
162
162
  return t;
163
163
  }
164
164
  function le(e) {
@@ -211,9 +211,9 @@ function fe(e) {
211
211
  e["dct:modified"],
212
212
  "http://www.w3.org/2001/XMLSchema#date"
213
213
  )), e["dct:publisher"]) {
214
- const n = o(e["dct:publisher"]);
214
+ const a = o(e["dct:publisher"]);
215
215
  t["dct:publisher"] = [
216
- Y(n, {
216
+ Y(a, {
217
217
  "foaf:name": "foaf:name",
218
218
  "foaf:mbox": "foaf:mbox",
219
219
  "foaf:homepage": "foaf:homepage"
@@ -221,9 +221,9 @@ function fe(e) {
221
221
  ];
222
222
  }
223
223
  if (e["dcat:contactPoint"]) {
224
- const n = o(e["dcat:contactPoint"]);
224
+ const a = o(e["dcat:contactPoint"]);
225
225
  t["dcat:contactPoint"] = [
226
- Y(n, {
226
+ Y(a, {
227
227
  "vcard:fn": "vcard:fn",
228
228
  "vcard:hasEmail": "vcard:hasEmail",
229
229
  "vcard:hasTelephone": "vcard:hasTelephone"
@@ -254,8 +254,8 @@ function ue(e) {
254
254
  inVoc: c
255
255
  };
256
256
  }),
257
- "dcat:temporalResolution": (t = e["dct:temporal"]) == null ? void 0 : t.reduce((i, n) => {
258
- const c = o(n["dcat:startDate"]), m = o(n["dcat:endDate"]), g = u(c) || "", y = u(m) || "", b = typeof c != "string" && (c == null ? void 0 : c["@type"]) === "http://www.w3.org/2001/XMLSchema#dateTime" ? "dateTime" : "date", B = b === "date" ? g : g.split("T")[0], R = b === "date" ? y : y.split("T")[0], L = b === "dateTime" ? g.split("T")[1] : "", v = b === "dateTime" ? y.split("T")[1] : "";
257
+ "dcat:temporalResolution": (t = e["dct:temporal"]) == null ? void 0 : t.reduce((i, a) => {
258
+ const c = o(a["dcat:startDate"]), m = o(a["dcat:endDate"]), g = u(c) || "", y = u(m) || "", b = typeof c != "string" && (c == null ? void 0 : c["@type"]) === "http://www.w3.org/2001/XMLSchema#dateTime" ? "dateTime" : "date", B = b === "date" ? g : g.split("T")[0], R = b === "date" ? y : y.split("T")[0], L = b === "dateTime" ? g.split("T")[1] : "", T = b === "dateTime" ? y.split("T")[1] : "";
259
259
  return {
260
260
  isValid: !0,
261
261
  type: "dct:PeriodOfTime",
@@ -265,7 +265,7 @@ function ue(e) {
265
265
  "dcat:startDate": B,
266
266
  "dcat:endDate": R,
267
267
  startTime: L || "",
268
- endTime: v || ""
268
+ endTime: T || ""
269
269
  }
270
270
  ]
271
271
  };
@@ -273,7 +273,7 @@ function ue(e) {
273
273
  };
274
274
  }
275
275
  function pe(e, r) {
276
- var i, n, f, c, m, g, y, b, B, R, L, v, w, P, l, h, U, T, x, F, j, z, M, G, O;
276
+ var i, a, f, c, m, g, y, b, B, R, L, T, w, U, l, h, v, A, x, F, O, j, z, M, G;
277
277
  if (!e)
278
278
  return {};
279
279
  const t = o(e["spdx:checksum"]);
@@ -286,7 +286,7 @@ function pe(e, r) {
286
286
  }))) || [{ "@id": "" }],
287
287
  "dct:format": {
288
288
  // redundancy in label and title for better compatibility
289
- label: ((n = o(e["dct:format"])) == null ? void 0 : n["purl:identifier"]) || "",
289
+ label: ((a = o(e["dct:format"])) == null ? void 0 : a["purl:identifier"]) || "",
290
290
  title: ((f = o(e["dct:format"])) == null ? void 0 : f["purl:identifier"]) || "",
291
291
  uri: ((c = o(e["dct:format"])) == null ? void 0 : c["@id"]) || ""
292
292
  },
@@ -315,12 +315,12 @@ function pe(e, r) {
315
315
  // Redundant label and title for better compatibility
316
316
  label: ((R = o(e["dcatap:availability"])) == null ? void 0 : R.prefLabel) || "",
317
317
  title: ((L = o(e["dcatap:availability"])) == null ? void 0 : L.prefLabel) || "",
318
- uri: ((v = o(e["dcatap:availability"])) == null ? void 0 : v["@id"]) || ""
318
+ uri: ((T = o(e["dcatap:availability"])) == null ? void 0 : T["@id"]) || ""
319
319
  },
320
- "dct:language": ((w = e["dct:language"]) == null ? void 0 : w.map((p) => A(p)).filter(Boolean)) || [],
320
+ "dct:language": ((w = e["dct:language"]) == null ? void 0 : w.map((p) => P(p)).filter(Boolean)) || [],
321
321
  "dcat:mediaType": C({
322
322
  label: d(
323
- (P = o(e["dcat:mediaType"])) == null ? void 0 : P.prefLabel
323
+ (U = o(e["dcat:mediaType"])) == null ? void 0 : U.prefLabel
324
324
  ) || "",
325
325
  uri: ((l = o(e["dcat:mediaType"])) == null ? void 0 : l["@id"]) || ""
326
326
  }),
@@ -328,28 +328,28 @@ function pe(e, r) {
328
328
  label: d(
329
329
  (h = o(e["dcat:compressFormat"])) == null ? void 0 : h.prefLabel
330
330
  ) || "",
331
- uri: ((U = o(e["dcat:compressFormat"])) == null ? void 0 : U["@id"]) || ""
331
+ uri: ((v = o(e["dcat:compressFormat"])) == null ? void 0 : v["@id"]) || ""
332
332
  }),
333
333
  "dcat:packageFormat": C({
334
334
  label: d(
335
- (T = o(e["dcat:packageFormat"])) == null ? void 0 : T.prefLabel
335
+ (A = o(e["dcat:packageFormat"])) == null ? void 0 : A.prefLabel
336
336
  ) || "",
337
337
  uri: ((x = o(e["dcat:packageFormat"])) == null ? void 0 : x["@id"]) || ""
338
338
  }),
339
339
  "adms:status": {
340
340
  uri: ((F = o(e["adms:status"])) == null ? void 0 : F["@id"]) || "",
341
- "@value": d((j = o(e["adms:status"])) == null ? void 0 : j.prefLabel) || ""
341
+ "@value": d((O = o(e["adms:status"])) == null ? void 0 : O.prefLabel) || ""
342
342
  },
343
343
  checksum: {
344
344
  title: u(o(t == null ? void 0 : t["spdx:checksumValue"])),
345
- "spdx:checksum": ((z = u(o(t == null ? void 0 : t["spdx:algorithm"]))) == null ? void 0 : z.split("_").pop()) || "",
346
- uri: (M = u(
345
+ "spdx:checksum": ((j = u(o(t == null ? void 0 : t["spdx:algorithm"]))) == null ? void 0 : j.split("_").pop()) || "",
346
+ uri: (z = u(
347
347
  o(t == null ? void 0 : t["spdx:algorithm"])
348
- )) == null ? void 0 : M.replace("spdx:", "http://spdx.org/rdf/terms#")
348
+ )) == null ? void 0 : z.replace("spdx:", "http://spdx.org/rdf/terms#")
349
349
  },
350
350
  accessServices: he(e["dcat:accessService"] || []),
351
351
  documentations: Re(e["foaf:page"] || []),
352
- conformsToItems: (G = e["dct:conformsTo"]) == null ? void 0 : G.map((p, I) => ({
352
+ conformsToItems: (M = e["dct:conformsTo"]) == null ? void 0 : M.map((p, I) => ({
353
353
  // for some reason dct:conformsTo is different from the one on dcat:dataset level
354
354
  id: I + 1,
355
355
  "dcat:accessURL": p["@id"],
@@ -359,7 +359,7 @@ function pe(e, r) {
359
359
  "rdfs:label": d(p["rdfs:label"]) || "",
360
360
  uri: p["@id"]
361
361
  })).filter(Boolean),
362
- policyItems: ((O = e["odrl:hasPolicy"]) == null ? void 0 : O.map((p, I) => ({
362
+ policyItems: ((G = e["odrl:hasPolicy"]) == null ? void 0 : G.map((p, I) => ({
363
363
  // don't ask
364
364
  id: I + 1,
365
365
  "dcat:downloadURL": p["@id"],
@@ -373,8 +373,8 @@ function me(e) {
373
373
  "dcat:distribution": []
374
374
  };
375
375
  if (e["dcat:distribution"]) {
376
- const n = V(e["dcat:distribution"]);
377
- r["dcat:distribution"] = n.map((f, c) => pe(f, c)).filter((f) => Object.keys(f).length > 0);
376
+ const a = V(e["dcat:distribution"]);
377
+ r["dcat:distribution"] = a.map((f, c) => pe(f, c)).filter((f) => Object.keys(f).length > 0);
378
378
  }
379
379
  return r["dct:license"] = [(i = (t = r["dcat:distribution"]) == null ? void 0 : t[0]) == null ? void 0 : i["dct:license"]], console.log(r), r;
380
380
  }
@@ -384,28 +384,28 @@ function be(e) {
384
384
  };
385
385
  }
386
386
  function ge(e) {
387
- var t, i, n, f, c, m, g, y, b, B, R, L, v, w, P, l, h, U, T, x, F, j, z, M, G, O, p, I;
387
+ var t, i, a, f, c, m, g, y, b, B, R, L, T, w, U, l, h, v, A, x, F, O, j, z, M, G, p, I;
388
388
  const r = {
389
- "dct:language": (t = e["dct:language"]) == null ? void 0 : t.map((a) => A(a)).filter(Boolean),
390
- "dcatde:politicalGeocodingLevelURI": (i = e["dcatapde:politicalGeocodingLevelURI"]) == null ? void 0 : i.map((a) => ({
391
- uri: a["@id"],
392
- "@value": d(a.prefLabel)
389
+ "dct:language": (t = e["dct:language"]) == null ? void 0 : t.map((n) => P(n)).filter(Boolean),
390
+ "dcatde:politicalGeocodingLevelURI": (i = e["dcatapde:politicalGeocodingLevelURI"]) == null ? void 0 : i.map((n) => ({
391
+ uri: n["@id"],
392
+ "@value": d(n.prefLabel)
393
393
  })),
394
- "dct:conformsTo": (n = e["dct:conformsTo"]) == null ? void 0 : n.map((a) => ({
395
- "rdfs:label": d(a["rdfs:label"]) || "",
396
- "@id": a["@id"]
394
+ "dct:conformsTo": (a = e["dct:conformsTo"]) == null ? void 0 : a.map((n) => ({
395
+ "rdfs:label": d(n["rdfs:label"]) || "",
396
+ "@id": n["@id"]
397
397
  })).filter(Boolean),
398
- "dct:accessRights": e["dct:accessRights"] ? s(A(e["dct:accessRights"])) : [],
398
+ "dct:accessRights": e["dct:accessRights"] ? s(P(e["dct:accessRights"])) : [],
399
399
  "dct:issued": V(e["dct:issued"]),
400
- "dct:provenance": (f = e["dct:provenance"]) == null ? void 0 : f.map((a) => ({
401
- "rdfs:label": d(a["rdfs:label"]) || "",
402
- uri: a["@id"]
400
+ "dct:provenance": (f = e["dct:provenance"]) == null ? void 0 : f.map((n) => ({
401
+ "rdfs:label": d(n["rdfs:label"]) || "",
402
+ uri: n["@id"]
403
403
  })).filter(Boolean),
404
- "dct:accrualPeriodicity": e["dct:accrualPeriodicity"] ? s(A(e["dct:accrualPeriodicity"])) : [],
405
- "dct:type": (c = e["dct:type"]) == null ? void 0 : c.map((a) => A(a)).filter(Boolean),
404
+ "dct:accrualPeriodicity": e["dct:accrualPeriodicity"] ? s(P(e["dct:accrualPeriodicity"])) : [],
405
+ "dct:type": (c = e["dct:type"]) == null ? void 0 : c.map((n) => P(n)).filter(Boolean),
406
406
  "dcat:spatialResolutionInMeters": ((m = e["dcat:spatialResolutionInMeters"]) == null ? void 0 : m.map(H)) || void 0,
407
- "dcat:temporalResolution": e["dcat:temporalResolution"] ? e["dcat:temporalResolution"].map(H).map((a) => {
408
- const _ = a["@value"].match(
407
+ "dcat:temporalResolution": e["dcat:temporalResolution"] ? e["dcat:temporalResolution"].map(H).map((n) => {
408
+ const _ = n["@value"].match(
409
409
  /^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/
410
410
  );
411
411
  if (_) {
@@ -425,64 +425,70 @@ function ge(e) {
425
425
  "dcat:qualifiedRelation": (g = s(
426
426
  e["dcat:qualifiedRelation"]
427
427
  )) == null ? void 0 : g.filter(Boolean),
428
- "dct:creator": (y = s(e["dct:creator"])) == null ? void 0 : y.filter(Boolean),
429
- "dct:contributor": (b = s(e["dct:contributor"])) == null ? void 0 : b.filter(Boolean),
430
- "dcatde:contributorID": (B = e["dcatapde:contributorID"]) == null ? void 0 : B.map((a) => A(a)).filter(Boolean),
428
+ "dct:creator": (y = s(e["dct:creator"])) == null ? void 0 : y.filter(Boolean).map((n) => ({
429
+ ...n,
430
+ "rdf:type": (n == null ? void 0 : n["@type"]) === "foaf:Agent" ? "Person" : "Organisation"
431
+ })),
432
+ "dct:contributor": (b = s(e["dct:contributor"])) == null ? void 0 : b.filter(Boolean).map((n) => ({
433
+ ...n,
434
+ "rdf:type": (n == null ? void 0 : n["@type"]) === "foaf:Agent" ? "Person" : "Organisation"
435
+ })),
436
+ "dcatde:contributorID": (B = e["dcatapde:contributorID"]) == null ? void 0 : B.map((n) => P(n)).filter(Boolean),
431
437
  "dcatde:geocodingDescription": (R = s(
432
438
  e["dcatapde:geocodingDescription"]
433
439
  )) == null ? void 0 : R.filter(Boolean),
434
- "dct:identifier": (L = e["dct:identifier"]) == null ? void 0 : L.map((a) => ({
435
- "@value": a
440
+ "dct:identifier": (L = e["dct:identifier"]) == null ? void 0 : L.map((n) => ({
441
+ "@value": n
436
442
  })),
437
- "adms:identifier": (v = s(e["adms:identifier"])) == null ? void 0 : v.filter(Boolean),
438
- "owl:versionInfo": (w = e["owl:versionInfo"]) == null ? void 0 : w.map((a) => ({
439
- "@value": a
443
+ "adms:identifier": (T = s(e["adms:identifier"])) == null ? void 0 : T.filter(Boolean),
444
+ "owl:versionInfo": (w = e["owl:versionInfo"]) == null ? void 0 : w.map((n) => ({
445
+ "@value": n
440
446
  })),
441
447
  "adms:versionNotes": e["adms:versionNotes"],
442
- "dcatde:legalBasis": (P = s(e["dcatapde:legalBasis"])) == null ? void 0 : P.filter(
448
+ "dcatde:legalBasis": (U = s(e["dcatapde:legalBasis"])) == null ? void 0 : U.filter(
443
449
  Boolean
444
450
  ),
445
451
  "dct:relation": (l = s(e["dct:relation"])) == null ? void 0 : l.filter(Boolean),
446
452
  "dcat:landingPage": (h = s(e["dcat:landingPage"])) == null ? void 0 : h.filter(
447
453
  Boolean
448
454
  ),
449
- "prov:wasGeneratedBy": (U = s(e["prov:wasGeneratedBy"])) == null ? void 0 : U.filter(
455
+ "prov:wasGeneratedBy": (v = s(e["prov:wasGeneratedBy"])) == null ? void 0 : v.filter(
450
456
  Boolean
451
457
  ),
452
- "dct:isReferencedBy": (T = s(e["dct:isReferencedBy"])) == null ? void 0 : T.filter(
458
+ "dct:isReferencedBy": (A = s(e["dct:isReferencedBy"])) == null ? void 0 : A.filter(
453
459
  Boolean
454
460
  ),
455
461
  "dct:source": (x = s(e["dct:source"])) == null ? void 0 : x.filter(Boolean),
456
462
  "dct:hasVersion": (F = s(e["dct:hasVersion"])) == null ? void 0 : F.filter(Boolean),
457
- "dct:isVersionOf": (j = s(e["dct:isVersionOf"])) == null ? void 0 : j.filter(Boolean),
458
- "prov:qualifiedAttribution": (z = s(
463
+ "dct:isVersionOf": (O = s(e["dct:isVersionOf"])) == null ? void 0 : O.filter(Boolean),
464
+ "prov:qualifiedAttribution": (j = s(
459
465
  e["prov:qualifiedAttribution"]
460
- )) == null ? void 0 : z.filter(Boolean),
461
- "dcat:keyword": (M = s(e["dcat:keyword"])) == null ? void 0 : M.filter(Boolean),
462
- "dct:spatial": (G = s(e["dct:spatial"])) == null ? void 0 : G.filter((a) => a ? !a["@id"].startsWith(
466
+ )) == null ? void 0 : j.filter(Boolean),
467
+ "dcat:keyword": (z = s(e["dcat:keyword"])) == null ? void 0 : z.filter(Boolean),
468
+ "dct:spatial": (M = s(e["dct:spatial"])) == null ? void 0 : M.filter((n) => n ? !n["@id"].startsWith(
463
469
  "http://dcat-ap.de/def/politicalGeocoding/"
464
470
  ) : !1).filter(Boolean),
465
- "dct:references": (O = s(e["dct:references"])) == null ? void 0 : O.filter(Boolean),
466
- "foaf:page": (p = s(e["foaf:page"])) == null ? void 0 : p.filter(Boolean).map((a) => {
467
- if (!a) return;
468
- const D = o(a["dct:format"]);
471
+ "dct:references": (G = s(e["dct:references"])) == null ? void 0 : G.filter(Boolean),
472
+ "foaf:page": (p = s(e["foaf:page"])) == null ? void 0 : p.filter(Boolean).map((n) => {
473
+ if (!n) return;
474
+ const D = o(n["dct:format"]);
469
475
  return {
470
- "dct:title": o(a["dct:title"]),
471
- "dct:description": o(a["dct:description"]),
476
+ "dct:title": o(n["dct:title"]),
477
+ "dct:description": o(n["dct:description"]),
472
478
  "@value": D ? d(D.prefLabel) : "",
473
479
  uri: D ? D["@id"] : "",
474
- "foaf:homepage": o(a["foaf:homepage"]) || ""
480
+ "foaf:homepage": o(n["foaf:homepage"]) || ""
475
481
  };
476
482
  }),
477
483
  "dcatap:availability": (I = e["dcatap:availability"]) == null ? void 0 : I.map(
478
- (a) => {
484
+ (n) => {
479
485
  var D, _, K, E;
480
486
  return {
481
487
  // Redundant label and title for better compatibility
482
- label: ((D = o(a)) == null ? void 0 : D.prefLabel) || "",
483
- title: ((_ = o(a)) == null ? void 0 : _.prefLabel) || "",
484
- uri: ((K = o(a)) == null ? void 0 : K["@id"]) || "",
485
- "@value": d((E = o(a)) == null ? void 0 : E.prefLabel) || ""
488
+ label: ((D = o(n)) == null ? void 0 : D.prefLabel) || "",
489
+ title: ((_ = o(n)) == null ? void 0 : _.prefLabel) || "",
490
+ uri: ((K = o(n)) == null ? void 0 : K["@id"]) || "",
491
+ "@value": d((E = o(n)) == null ? void 0 : E.prefLabel) || ""
486
492
  };
487
493
  }
488
494
  )
@@ -502,11 +508,11 @@ function ye(e) {
502
508
  }
503
509
  function he(e) {
504
510
  return !e || !Array.isArray(e) || e.length === 0 ? [] : e.map((r, t) => {
505
- var i, n;
511
+ var i, a;
506
512
  return {
507
513
  id: t + 1,
508
514
  "dcat:downloadURL": ((i = o(r["dcat:endpointURL"])) == null ? void 0 : i["@id"]) || "",
509
- "dcat:endpointURL": ((n = o(r["dcat:endpointURL"])) == null ? void 0 : n["@id"]) || "",
515
+ "dcat:endpointURL": ((a = o(r["dcat:endpointURL"])) == null ? void 0 : a["@id"]) || "",
510
516
  "dct:description": d(r["dct:description"]) || "",
511
517
  "dct:title": d(r["dct:title"]) || ""
512
518
  };
@@ -514,15 +520,15 @@ function he(e) {
514
520
  }
515
521
  function Re(e) {
516
522
  return !e || !Array.isArray(e) || e.length === 0 ? [] : e.map((r, t) => {
517
- var i, n, f, c;
523
+ var i, a, f, c;
518
524
  return {
519
525
  id: t + 1,
520
526
  "dcat:downloadURL": ((i = o(r["dcat:accessURL"])) == null ? void 0 : i["@id"]) || "",
521
- "dcat:accessURL": ((n = o(r["dcat:accessURL"])) == null ? void 0 : n["@id"]) || "",
527
+ "dcat:accessURL": ((a = o(r["dcat:accessURL"])) == null ? void 0 : a["@id"]) || "",
522
528
  "dct:description": d(r["dct:description"]) || "",
523
529
  "dct:title": d(r["dct:title"]) || "",
524
- "dct:format": r["dct:format"] && ((f = A(o(r["dct:format"]))) == null ? void 0 : f.label) || "",
525
- formatUri: r["dct:format"] && ((c = A(o(r["dct:format"]))) == null ? void 0 : c.uri) || ""
530
+ "dct:format": r["dct:format"] && ((f = P(o(r["dct:format"]))) == null ? void 0 : f.label) || "",
531
+ formatUri: r["dct:format"] && ((c = P(o(r["dct:format"]))) == null ? void 0 : c.uri) || ""
526
532
  };
527
533
  });
528
534
  }
@@ -1,11 +1,11 @@
1
1
  import "axios";
2
- import { asSomeArray as Rt } from "../../composables/useDpiSimpleLoader.js";
2
+ import { asSomeArray as Ut } from "../../composables/useDpiSimpleLoader.js";
3
3
  let d = { distribution: [], dataset: {}, meta: {} };
4
- function St(t) {
4
+ function Ct(t) {
5
5
  return t.replace(/[^a-z0-9\s]/gi, "").replace(/\s+/g, "-").toLowerCase();
6
6
  }
7
- async function Ut(t, g, l, b) {
8
- var A, f, v, D, k, O, R, j, S, w, I, x, L, B, U, 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, bt, gt, yt, ut, ht, At, ft, vt, Dt, kt;
7
+ async function zt(t, g, l, b) {
8
+ var A, f, v, D, k, O, R, j, S, w, I, x, L, B, U, 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, bt, gt, yt, ut, ht, At, ft, vt, Dt, kt, Ot, Rt, jt, St, wt, It, xt, Lt;
9
9
  const u = g.specification.prefixes;
10
10
  let p = [];
11
11
  const o = Object.keys(t);
@@ -14,7 +14,7 @@ async function Ut(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 jt = new URLSearchParams(window.location.search).get("edit");
17
+ const Pt = 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,18 @@ async function Ut(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 = St(
36
+ Object.keys(t.BasicInfos)[i] === "dct:title" && (d.dataset["dct:title"] = t.BasicInfos["dct:title"][0] || "", y = Ct(
37
37
  t.BasicInfos["dct:title"][0]["@value"]
38
- ), jt === "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" && ((v = t.BasicInfos["dct:modified"]) != null && v[0] ? d.dataset["dct:modified"] = { ...(D = t.BasicInfos["dct:modified"]) == null ? void 0 : D[0], "@type": ((O = (k = t.BasicInfos["dct:modified"]) == null ? void 0 : k[0]) == null ? void 0 : O["@type"]) || "http://www.w3.org/2001/XMLSchema#date" } : d.dataset["dct:modified"] = void 0), Object.keys(t.BasicInfos)[i] === "dct:publisher" && ((R = t.BasicInfos["dct:publisher"]) != null && R[0] ? d.dataset["dct:publisher"] = { ...(j = t.BasicInfos["dct:publisher"]) == null ? void 0 : j[0], "@type": ((w = (S = t.BasicInfos["dct:publisher"]) == null ? void 0 : S[0]) == null ? void 0 : w["@type"]) || "foaf:Agent" } : d.dataset["dct:publisher"] = void 0), Object.keys(t.BasicInfos)[i] === "dcat:contactPoint" && ((I = t.BasicInfos["dcat:contactPoint"]) != null && I[0] ? d.dataset["dcat:contactPoint"] = { ...(x = t.BasicInfos["dcat:contactPoint"]) == null ? void 0 : x[0], "@type": ((B = (L = t.BasicInfos["dcat:contactPoint"]) == null ? void 0 : L[0]) == null ? void 0 : B["@type"]) || "vcard:Organization" } : d.dataset["dcat:contactPoint"] = void 0), d.dataset["@type"] = "dcat:Dataset", d.meta["dcat:catalog"] = l.permissions[0].rsname, d.meta["@type"] = "dcat:CatalogRecord";
38
+ ), Pt === "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" && ((v = t.BasicInfos["dct:modified"]) != null && v[0] ? d.dataset["dct:modified"] = {
39
+ ...(D = t.BasicInfos["dct:modified"]) == null ? void 0 : D[0],
40
+ "@type": ((O = (k = t.BasicInfos["dct:modified"]) == null ? void 0 : k[0]) == null ? void 0 : O["@type"]) || "http://www.w3.org/2001/XMLSchema#date"
41
+ } : d.dataset["dct:modified"] = void 0), Object.keys(t.BasicInfos)[i] === "dct:publisher" && ((R = t.BasicInfos["dct:publisher"]) != null && R[0] ? d.dataset["dct:publisher"] = {
42
+ ...(j = t.BasicInfos["dct:publisher"]) == null ? void 0 : j[0],
43
+ "@type": ((w = (S = t.BasicInfos["dct:publisher"]) == null ? void 0 : S[0]) == null ? void 0 : w["@type"]) || "foaf:Agent"
44
+ } : d.dataset["dct:publisher"] = void 0), Object.keys(t.BasicInfos)[i] === "dcat:contactPoint" && ((I = t.BasicInfos["dcat:contactPoint"]) != null && I[0] ? d.dataset["dcat:contactPoint"] = {
45
+ ...(x = t.BasicInfos["dcat:contactPoint"]) == null ? void 0 : x[0],
46
+ "@type": ((B = (L = t.BasicInfos["dcat:contactPoint"]) == null ? void 0 : L[0]) == null ? void 0 : B["@type"]) || "vcard:Organization"
47
+ } : d.dataset["dcat:contactPoint"] = void 0), d.dataset["@type"] = "dcat:Dataset", d.meta["dcat:catalog"] = l.permissions[0].rsname, d.meta["@type"] = "dcat:CatalogRecord";
39
48
  }
40
49
  if (o[c] === "Covering" && Object.keys(t.Covering).length > 1)
41
50
  for (let i = 0; i < Object.keys(t.Covering).length; i++) {
@@ -110,7 +119,7 @@ async function Ut(t, g, l, b) {
110
119
  "@id": (e == null ? void 0 : e.uri) || ""
111
120
  }), ((Z = (Q = (K = t.DistributionSimple) == null ? void 0 : K["dcat:distribution"]) == null ? void 0 : Q[i]) == null ? void 0 : Z["dcatap:applicableLegislation"]) != null && (d.distribution[i]["dct:format"] = (tt = (V = (m = t.DistributionSimple) == null ? void 0 : m["dcat:distribution"]) == null ? void 0 : V[i]) == null ? void 0 : tt["dcatap:applicableLegislation"]["@id"]);
112
121
  const s = ((et = (dt = (it = t.DistributionSimple) == null ? void 0 : it["dcat:distribution"]) == null ? void 0 : dt[i]) == null ? void 0 : et.conformsToItems) || [];
113
- if (s.length !== 0 && (d.distribution[i]["dct:conformsTo"] = Rt(
122
+ if (s.length !== 0 && (d.distribution[i]["dct:conformsTo"] = Ut(
114
123
  s
115
124
  ).filter(
116
125
  (a) => a && (a["dcat:downloadURL"] || a["dct:title"])
@@ -145,15 +154,15 @@ async function Ut(t, g, l, b) {
145
154
  "@language": "de",
146
155
  "@value": t.DistributionSimple["dcat:distribution"][i]["dct:title"]
147
156
  }), Object.keys(
148
- t.DistributionSimple["dcat:distribution"][i]["dct:accessRights"]
157
+ ((nt = (at = t.DistributionSimple["dcat:distribution"]) == null ? void 0 : at[i]) == null ? void 0 : nt["dct:accessRights"]) || {}
149
158
  ).length !== 0 && (d.distribution[i]["dct:accessRights"] = {
150
159
  "@id": t.DistributionSimple["dcat:distribution"][i]["dct:accessRights"].uri
151
160
  }), t.DistributionSimple["dcat:distribution"][i]["dcat:compressFormat"] != null && Object.keys(
152
- t.DistributionSimple["dcat:distribution"][i]["dcat:compressFormat"]
161
+ ((ct = t.DistributionSimple["dcat:distribution"][i]) == null ? void 0 : ct["dcat:compressFormat"]) || {}
153
162
  ).length !== 0 && t.DistributionSimple["dcat:distribution"][i]["dcat:compressFormat"].uri !== "" && (d.distribution[i]["dcat:compressFormat"] = {
154
163
  "@id": t.DistributionSimple["dcat:distribution"][i]["dcat:compressFormat"].uri || ""
155
164
  }), Object.keys(
156
- t.DistributionSimple["dcat:distribution"][i]["dcat:packageFormat"]
165
+ ((st = (ot = t.DistributionSimple["dcat:distribution"]) == null ? void 0 : ot[i]) == null ? void 0 : st["dcat:packageFormat"]) || {}
157
166
  ).length !== 0 && t.DistributionSimple["dcat:distribution"][i]["dcat:packageFormat"].uri !== "" && (d.distribution[i]["dcat:packageFormat"] = {
158
167
  "@id": t.DistributionSimple["dcat:distribution"][i]["dcat:packageFormat"].uri || ""
159
168
  }), t.DistributionSimple["dcat:distribution"][i].checksum.uri !== "" && (d.distribution[i]["spdx:checksum"] = {
@@ -163,7 +172,7 @@ async function Ut(t, g, l, b) {
163
172
  "@id": t.DistributionSimple["dcat:distribution"][i].checksum.uri || ""
164
173
  }
165
174
  }), Object.keys(
166
- t.DistributionSimple["dcat:distribution"][i]["dct:language"]
175
+ ((rt = (lt = t.DistributionSimple["dcat:distribution"]) == null ? void 0 : lt[i]) == null ? void 0 : rt["dct:language"]) || {}
167
176
  ).length !== 0) {
168
177
  d.distribution[i]["dct:language"] = [];
169
178
  for (let a = 0; a < t.DistributionSimple["dcat:distribution"][i]["dct:language"].length; a++)
@@ -172,12 +181,12 @@ async function Ut(t, g, l, b) {
172
181
  };
173
182
  }
174
183
  t.DistributionSimple["dcat:distribution"][i]["adms:status"].uri !== "" && Object.keys(
175
- t.DistributionSimple["dcat:distribution"][i]["adms:status"]
184
+ ((pt = t.DistributionSimple["dcat:distribution"][i]) == null ? void 0 : pt["adms:status"]) || {}
176
185
  ).length !== 0 && (d.distribution[i]["adms:status"] = {
177
186
  "@id": t.DistributionSimple["dcat:distribution"][i]["adms:status"].uri || ""
178
187
  });
179
- const Ot = ((ct = (nt = (at = t.DistributionSimple) == null ? void 0 : at["dcat:distribution"]) == null ? void 0 : nt[i]) == null ? void 0 : ct.accessServices) || [];
180
- if (Ot.length !== 0 && (d.distribution[i]["dcat:accessService"] = (ot = Rt(Ot)) == null ? void 0 : ot.filter(
188
+ const Bt = ((yt = (gt = (bt = t.DistributionSimple) == null ? void 0 : bt["dcat:distribution"]) == null ? void 0 : gt[i]) == null ? void 0 : yt.accessServices) || [];
189
+ if (Bt.length !== 0 && (d.distribution[i]["dcat:accessService"] = (ut = Ut(Bt)) == null ? void 0 : ut.filter(
181
190
  (a) => a && (a["dct:title"] || a["dct:description"] || a["dcat:downloadURL"] || a["dcat:endpointURL"])
182
191
  ).map((a) => {
183
192
  const n = {
@@ -196,7 +205,7 @@ async function Ut(t, g, l, b) {
196
205
  "@id": r
197
206
  }), n;
198
207
  })), d.distribution[i]["foaf:page"] || (d.distribution[i]["foaf:page"] = []), d.distribution[i]["foaf:page"].length !== 0)
199
- for (let a = 0; a < ((rt = (lt = (st = t.DistributionSimple) == null ? void 0 : st["dcat:distribution"]) == null ? void 0 : lt[i]) == null ? void 0 : rt.documentations.length); a++) {
208
+ for (let a = 0; a < ((ft = (At = (ht = t.DistributionSimple) == null ? void 0 : ht["dcat:distribution"]) == null ? void 0 : At[i]) == null ? void 0 : ft.documentations.length); a++) {
200
209
  const n = t.DistributionSimple["dcat:distribution"][i].documentations[a];
201
210
  if ((n == null ? void 0 : n["dct:title"]) !== void 0) {
202
211
  const r = {
@@ -238,7 +247,7 @@ async function Ut(t, g, l, b) {
238
247
  for (let e = 0; e < t.Additionals["dcat:keyword"].length; e++)
239
248
  d.dataset["dcat:keyword"] === void 0 && (d.dataset["dcat:keyword"] = []), d.dataset["dcat:keyword"].push({
240
249
  "@value": t.Additionals["dcat:keyword"][e]["@value"],
241
- "@language": ((bt = (pt = t.Additionals["dcat:keyword"]) == null ? void 0 : pt[e]) == null ? void 0 : bt["@language"]) || "de"
250
+ "@language": ((Dt = (vt = t.Additionals["dcat:keyword"]) == null ? void 0 : vt[e]) == null ? void 0 : Dt["@language"]) || "de"
242
251
  });
243
252
  }
244
253
  if (Object.keys(t.Additionals)[i] === "dct:references") {
@@ -289,7 +298,14 @@ async function Ut(t, g, l, b) {
289
298
  );
290
299
  for (let e = 0; e < t.Additionals["adms:identifier"].length; e++)
291
300
  d.dataset["adms:identifier"] === void 0 && (d.dataset["adms:identifier"] = []), d.dataset["adms:identifier"].push({
292
- "@id": t.Additionals["adms:identifier"][e]["@id"]
301
+ // "@id":
302
+ // formValues.Additionals["adms:identifier"][admsIdentIndex][
303
+ // "@id"
304
+ // ],
305
+ "@type": "adms:Identifier",
306
+ "skos:notation": {
307
+ "@value": t.Additionals["adms:identifier"][e]["@id"]
308
+ }
293
309
  });
294
310
  }
295
311
  if (Object.keys(t.Additionals)[i] === "dct:language") {
@@ -320,7 +336,7 @@ async function Ut(t, g, l, b) {
320
336
  for (let e = 0; e < t.Additionals["dcatde:legalBasis"].length; e++)
321
337
  d.dataset["dcatde:legalBasis"] === void 0 && (d.dataset["dcatde:legalBasis"] = []), d.dataset["dcatde:legalBasis"].push({
322
338
  "@value": t.Additionals["dcatde:legalBasis"][e]["@value"],
323
- "@language": ((ut = (yt = (gt = t.Additionals) == null ? void 0 : gt["dcatde:legalBasis"]) == null ? void 0 : yt[e]) == null ? void 0 : ut["@language"]) || "de"
339
+ "@language": ((Rt = (Ot = (kt = t.Additionals) == null ? void 0 : kt["dcatde:legalBasis"]) == null ? void 0 : Ot[e]) == null ? void 0 : Rt["@language"]) || "de"
324
340
  });
325
341
  }
326
342
  if (Object.keys(t.Additionals)[i] === "dct:relation") {
@@ -458,7 +474,7 @@ async function Ut(t, g, l, b) {
458
474
  for (let e = 0; e < t.Additionals["foaf:page"].length; e++)
459
475
  d.dataset["foaf:page"] === void 0 && (d.dataset["foaf:page"] = []), d.dataset["foaf:page"].push({
460
476
  "dct:format": {
461
- "@id": (At = (ht = t.Additionals["foaf:page"]) == null ? void 0 : ht[e]) == null ? void 0 : At.uri
477
+ "@id": (St = (jt = t.Additionals["foaf:page"]) == null ? void 0 : jt[e]) == null ? void 0 : St.uri
462
478
  },
463
479
  "dct:title": t.Additionals["foaf:page"][e]["dct:title"],
464
480
  "dct:description": t.Additionals["foaf:page"][e]["dct:description"],
@@ -500,7 +516,7 @@ async function Ut(t, g, l, b) {
500
516
  }), Object.keys(t.Additionals)[i] === "dcatde:politicalGeocodingLevelURI")
501
517
  for (let e = 0; e < t.Additionals["dcatde:politicalGeocodingLevelURI"].length; e++)
502
518
  d.dataset["dcatde:politicalGeocodingLevelURI"] === void 0 && (d.dataset["dcatde:politicalGeocodingLevelURI"] = []), d.dataset["dcatde:politicalGeocodingLevelURI"].push({
503
- "@id": ((vt = (ft = t.Additionals["dcatde:politicalGeocodingLevelURI"]) == null ? void 0 : ft[e]) == null ? void 0 : vt.uri) || ((kt = (Dt = t.Additionals["dcatde:politicalGeocodingLevelURI"]) == null ? void 0 : Dt[e]) == null ? void 0 : kt["@id"]) || ""
519
+ "@id": ((It = (wt = t.Additionals["dcatde:politicalGeocodingLevelURI"]) == null ? void 0 : wt[e]) == null ? void 0 : It.uri) || ((Lt = (xt = t.Additionals["dcatde:politicalGeocodingLevelURI"]) == null ? void 0 : xt[e]) == null ? void 0 : Lt["@id"]) || ""
504
520
  });
505
521
  }
506
522
  } catch (i) {
@@ -508,10 +524,9 @@ async function Ut(t, g, l, b) {
508
524
  }
509
525
  }
510
526
  } catch (c) {
511
- debugger;
512
527
  console.log(c);
513
528
  }
514
- let h = wt(d, u);
529
+ let h = Tt(d, u);
515
530
  return { actionParams: {
516
531
  id: y,
517
532
  catalog: l.permissions[0].rsname,
@@ -520,7 +535,7 @@ async function Ut(t, g, l, b) {
520
535
  description: d.dataset["dct:description"]["@value"]
521
536
  }, body: h };
522
537
  }
523
- function wt(t, g) {
538
+ function Tt(t, g) {
524
539
  const l = {}, b = Object.keys(t);
525
540
  for (let o = 0; o < b.length; o++)
526
541
  b[o], l[b[o]] = t[b[o]];
@@ -540,5 +555,5 @@ function wt(t, g) {
540
555
  return console.log(p), p;
541
556
  }
542
557
  export {
543
- Ut as default
558
+ zt as default
544
559
  };
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.76",
4
+ "version": "0.1.0-beta.79",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "*.css",
@@ -55,7 +55,7 @@
55
55
  "@headlessui/vue": "^1.7.23",
56
56
  "@histoire/plugin-vue": "1.0.0-alpha.2",
57
57
  "@phosphor-icons/vue": "^2.2.1",
58
- "@piveau/jsonld": "file:../../bin/piveau-jsonld-1.0.0-beta.26.tgz",
58
+ "@piveau/jsonld": "file:piveau-jsonld-1.0.0-beta.29.tgz",
59
59
  "@popperjs/core": "^2.11.8",
60
60
  "@types/jsonld": "^1.5.15",
61
61
  "@types/node": "^24.1.0",