@piveau/dpi 0.1.0-beta.71 → 0.1.0-beta.72

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,4 +1,4 @@
1
- import { toRef as ee, ref as te, toValue as N, computed as O, watch as E } from "vue";
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
3
  import { defineJsonldResolver as re, dcatDatasetTransformer as oe, datasetResolvers as ae } from "@piveau/jsonld";
4
4
  import { isEmpty as ne } from "lodash-es";
@@ -32,7 +32,7 @@ function De(e, r) {
32
32
  execute: B
33
33
  } = ie(
34
34
  async () => {
35
- var D;
35
+ var T;
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 || !((D = h["dpi:isDPIv3"]) != null && D["@value"])) && c.value.push({
43
+ return (!h || !((T = h["dpi:isDPIv3"]) != null && T["@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
  }), {
@@ -50,23 +50,23 @@ function De(e, r) {
50
50
  },
51
51
  null,
52
52
  { immediate: !1 }
53
- ), R = O(
53
+ ), R = k(
54
54
  () => n.value && !y.value && !!g.value
55
- ), L = O(
55
+ ), L = k(
56
56
  () => n.value && !!R.value
57
- ), v = O(() => L.value), w = O(() => {
57
+ ), v = k(() => L.value), w = k(() => {
58
58
  var l;
59
59
  return (l = m.value) == null ? void 0 : l.dpiData;
60
- }), P = O(() => {
60
+ }), P = k(() => {
61
61
  var l;
62
62
  return (l = m.value) == null ? void 0 : l.data;
63
63
  });
64
- return E(
64
+ return q(
65
65
  () => N(e),
66
66
  (l) => l && n.value ? B() : null
67
- ), E(P, (l) => {
67
+ ), q(P, (l) => {
68
68
  console.log("jsonld resolved result:", l);
69
- }), E(b, (l) => {
69
+ }), q(b, (l) => {
70
70
  console.log("jsonld error:", l);
71
71
  }), {
72
72
  processedInput: m,
@@ -106,7 +106,7 @@ function d(e, r = "de") {
106
106
  }
107
107
  return e["@language"] && e["@value"] ? e["@value"] : u(e);
108
108
  }
109
- function K(e) {
109
+ function C(e) {
110
110
  return {
111
111
  uri: e.uri,
112
112
  label: e.label,
@@ -114,9 +114,9 @@ function K(e) {
114
114
  "@value": e.label
115
115
  };
116
116
  }
117
- function T(e, r) {
117
+ function A(e, r) {
118
118
  const t = e.prefLabel;
119
- return K({
119
+ return C({
120
120
  uri: e["@id"] || e["purl:identifier"] || "",
121
121
  label: t ? d(t) : e["purl:identifier"] || ""
122
122
  });
@@ -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, D, x, F, j, z, M;
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;
277
277
  if (!e)
278
278
  return {};
279
279
  const t = o(e["spdx:checksum"]);
@@ -307,46 +307,49 @@ function pe(e, r) {
307
307
  ) || "",
308
308
  title: d(e["dcatapde:licenseAttributionByText"]) || ""
309
309
  } : {},
310
- "dct:accessRights": e["dct:accessRights"] ? o(T(e["dct:accessRights"])) : [],
310
+ "dct:accessRights": e["dct:accessRights"] ? o({
311
+ uri: ((b = o(e["dct:accessRights"])) == null ? void 0 : b["@id"]) || "",
312
+ label: ((B = o(e["dct:accessRights"])) == null ? void 0 : B.prefLabel) || { de: "" }
313
+ }) : {},
311
314
  "dcatap:availability": {
312
315
  // Redundant label and title for better compatibility
313
- label: ((b = o(e["dcatap:availability"])) == null ? void 0 : b.prefLabel) || "",
314
- title: ((B = o(e["dcatap:availability"])) == null ? void 0 : B.prefLabel) || "",
315
- uri: ((R = o(e["dcatap:availability"])) == null ? void 0 : R["@id"]) || ""
316
+ label: ((R = o(e["dcatap:availability"])) == null ? void 0 : R.prefLabel) || "",
317
+ title: ((L = o(e["dcatap:availability"])) == null ? void 0 : L.prefLabel) || "",
318
+ uri: ((v = o(e["dcatap:availability"])) == null ? void 0 : v["@id"]) || ""
316
319
  },
317
- "dct:language": ((L = e["dct:language"]) == null ? void 0 : L.map((p) => T(p)).filter(Boolean)) || [],
318
- "dcat:mediaType": K({
320
+ "dct:language": ((w = e["dct:language"]) == null ? void 0 : w.map((p) => A(p)).filter(Boolean)) || [],
321
+ "dcat:mediaType": C({
319
322
  label: d(
320
- (v = o(e["dcat:mediaType"])) == null ? void 0 : v.prefLabel
323
+ (P = o(e["dcat:mediaType"])) == null ? void 0 : P.prefLabel
321
324
  ) || "",
322
- uri: ((w = o(e["dcat:mediaType"])) == null ? void 0 : w["@id"]) || ""
325
+ uri: ((l = o(e["dcat:mediaType"])) == null ? void 0 : l["@id"]) || ""
323
326
  }),
324
- "dcat:compressFormat": K({
327
+ "dcat:compressFormat": C({
325
328
  label: d(
326
- (P = o(e["dcat:compressFormat"])) == null ? void 0 : P.prefLabel
329
+ (h = o(e["dcat:compressFormat"])) == null ? void 0 : h.prefLabel
327
330
  ) || "",
328
- uri: ((l = o(e["dcat:compressFormat"])) == null ? void 0 : l["@id"]) || ""
331
+ uri: ((U = o(e["dcat:compressFormat"])) == null ? void 0 : U["@id"]) || ""
329
332
  }),
330
- "dcat:packageFormat": K({
333
+ "dcat:packageFormat": C({
331
334
  label: d(
332
- (h = o(e["dcat:packageFormat"])) == null ? void 0 : h.prefLabel
335
+ (T = o(e["dcat:packageFormat"])) == null ? void 0 : T.prefLabel
333
336
  ) || "",
334
- uri: ((U = o(e["dcat:packageFormat"])) == null ? void 0 : U["@id"]) || ""
337
+ uri: ((x = o(e["dcat:packageFormat"])) == null ? void 0 : x["@id"]) || ""
335
338
  }),
336
339
  "adms:status": {
337
- uri: ((D = o(e["adms:status"])) == null ? void 0 : D["@id"]) || "",
338
- "@value": d((x = o(e["adms:status"])) == null ? void 0 : x.prefLabel) || ""
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) || ""
339
342
  },
340
343
  checksum: {
341
344
  title: u(o(t == null ? void 0 : t["spdx:checksumValue"])),
342
- "spdx:checksum": ((F = u(o(t == null ? void 0 : t["spdx:algorithm"]))) == null ? void 0 : F.split("_").pop()) || "",
343
- uri: (j = u(
345
+ "spdx:checksum": ((z = u(o(t == null ? void 0 : t["spdx:algorithm"]))) == null ? void 0 : z.split("_").pop()) || "",
346
+ uri: (M = u(
344
347
  o(t == null ? void 0 : t["spdx:algorithm"])
345
- )) == null ? void 0 : j.replace("spdx:", "http://spdx.org/rdf/terms#")
348
+ )) == null ? void 0 : M.replace("spdx:", "http://spdx.org/rdf/terms#")
346
349
  },
347
350
  accessServices: he(e["dcat:accessService"] || []),
348
351
  documentations: Re(e["foaf:page"] || []),
349
- conformsToItems: (z = e["dct:conformsTo"]) == null ? void 0 : z.map((p, I) => ({
352
+ conformsToItems: (G = e["dct:conformsTo"]) == null ? void 0 : G.map((p, I) => ({
350
353
  // for some reason dct:conformsTo is different from the one on dcat:dataset level
351
354
  id: I + 1,
352
355
  "dcat:accessURL": p["@id"],
@@ -356,7 +359,7 @@ function pe(e, r) {
356
359
  "rdfs:label": d(p["rdfs:label"]) || "",
357
360
  uri: p["@id"]
358
361
  })).filter(Boolean),
359
- policyItems: ((M = e["odrl:hasPolicy"]) == null ? void 0 : M.map((p, I) => ({
362
+ policyItems: ((O = e["odrl:hasPolicy"]) == null ? void 0 : O.map((p, I) => ({
360
363
  // don't ask
361
364
  id: I + 1,
362
365
  "dcat:downloadURL": p["@id"],
@@ -381,9 +384,9 @@ function be(e) {
381
384
  };
382
385
  }
383
386
  function ge(e) {
384
- var t, i, n, f, c, m, g, y, b, B, R, L, v, w, P, l, h, U, D, x, F, j, z, M, p, I, C, q;
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;
385
388
  const r = {
386
- "dct:language": (t = e["dct:language"]) == null ? void 0 : t.map((a) => T(a)).filter(Boolean),
389
+ "dct:language": (t = e["dct:language"]) == null ? void 0 : t.map((a) => A(a)).filter(Boolean),
387
390
  "dcatde:politicalGeocodingLevelURI": (i = e["dcatapde:politicalGeocodingLevelURI"]) == null ? void 0 : i.map((a) => ({
388
391
  uri: a["@id"],
389
392
  "@value": d(a.prefLabel)
@@ -392,26 +395,26 @@ function ge(e) {
392
395
  "rdfs:label": d(a["rdfs:label"]) || "",
393
396
  "@id": a["@id"]
394
397
  })).filter(Boolean),
395
- "dct:accessRights": e["dct:accessRights"] ? s(T(e["dct:accessRights"])) : [],
398
+ "dct:accessRights": e["dct:accessRights"] ? s(A(e["dct:accessRights"])) : [],
396
399
  "dct:issued": V(e["dct:issued"]),
397
400
  "dct:provenance": (f = e["dct:provenance"]) == null ? void 0 : f.map((a) => ({
398
401
  "rdfs:label": d(a["rdfs:label"]) || "",
399
402
  uri: a["@id"]
400
403
  })).filter(Boolean),
401
- "dct:accrualPeriodicity": e["dct:accrualPeriodicity"] ? s(T(e["dct:accrualPeriodicity"])) : [],
402
- "dct:type": (c = e["dct:type"]) == null ? void 0 : c.map((a) => T(a)).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),
403
406
  "dcat:spatialResolutionInMeters": ((m = e["dcat:spatialResolutionInMeters"]) == null ? void 0 : m.map(H)) || void 0,
404
407
  "dcat:temporalResolution": e["dcat:temporalResolution"] ? e["dcat:temporalResolution"].map(H).map((a) => {
405
- const G = a["@value"].match(
408
+ const _ = a["@value"].match(
406
409
  /^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/
407
410
  );
408
- if (G) {
409
- const [, _, k, $, J, W, Q] = G.map(
411
+ if (_) {
412
+ const [, K, E, $, J, W, Q] = _.map(
410
413
  (Z) => Z || "0"
411
414
  );
412
415
  return [
413
- { Year: _ },
414
- { Month: k },
416
+ { Year: K },
417
+ { Month: E },
415
418
  { Day: $ },
416
419
  { Hour: J },
417
420
  { Minute: W },
@@ -424,7 +427,7 @@ function ge(e) {
424
427
  )) == null ? void 0 : g.filter(Boolean),
425
428
  "dct:creator": (y = s(e["dct:creator"])) == null ? void 0 : y.filter(Boolean),
426
429
  "dct:contributor": (b = s(e["dct:contributor"])) == null ? void 0 : b.filter(Boolean),
427
- "dcatde:contributorID": (B = e["dcatapde:contributorID"]) == null ? void 0 : B.map((a) => T(a)).filter(Boolean),
430
+ "dcatde:contributorID": (B = e["dcatapde:contributorID"]) == null ? void 0 : B.map((a) => A(a)).filter(Boolean),
428
431
  "dcatde:geocodingDescription": (R = s(
429
432
  e["dcatapde:geocodingDescription"]
430
433
  )) == null ? void 0 : R.filter(Boolean),
@@ -446,7 +449,7 @@ function ge(e) {
446
449
  "prov:wasGeneratedBy": (U = s(e["prov:wasGeneratedBy"])) == null ? void 0 : U.filter(
447
450
  Boolean
448
451
  ),
449
- "dct:isReferencedBy": (D = s(e["dct:isReferencedBy"])) == null ? void 0 : D.filter(
452
+ "dct:isReferencedBy": (T = s(e["dct:isReferencedBy"])) == null ? void 0 : T.filter(
450
453
  Boolean
451
454
  ),
452
455
  "dct:source": (x = s(e["dct:source"])) == null ? void 0 : x.filter(Boolean),
@@ -456,30 +459,30 @@ function ge(e) {
456
459
  e["prov:qualifiedAttribution"]
457
460
  )) == null ? void 0 : z.filter(Boolean),
458
461
  "dcat:keyword": (M = s(e["dcat:keyword"])) == null ? void 0 : M.filter(Boolean),
459
- "dct:spatial": (p = s(e["dct:spatial"])) == null ? void 0 : p.filter((a) => a ? !a["@id"].startsWith(
462
+ "dct:spatial": (G = s(e["dct:spatial"])) == null ? void 0 : G.filter((a) => a ? !a["@id"].startsWith(
460
463
  "http://dcat-ap.de/def/politicalGeocoding/"
461
464
  ) : !1).filter(Boolean),
462
- "dct:references": (I = s(e["dct:references"])) == null ? void 0 : I.filter(Boolean),
463
- "foaf:page": (C = s(e["foaf:page"])) == null ? void 0 : C.filter(Boolean).map((a) => {
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) => {
464
467
  if (!a) return;
465
- const A = o(a["dct:format"]);
468
+ const D = o(a["dct:format"]);
466
469
  return {
467
470
  "dct:title": o(a["dct:title"]),
468
471
  "dct:description": o(a["dct:description"]),
469
- "@value": A ? d(A.prefLabel) : "",
470
- uri: A ? A["@id"] : "",
472
+ "@value": D ? d(D.prefLabel) : "",
473
+ uri: D ? D["@id"] : "",
471
474
  "foaf:homepage": o(a["foaf:homepage"]) || ""
472
475
  };
473
476
  }),
474
- "dcatap:availability": (q = e["dcatap:availability"]) == null ? void 0 : q.map(
477
+ "dcatap:availability": (I = e["dcatap:availability"]) == null ? void 0 : I.map(
475
478
  (a) => {
476
- var A, G, _, k;
479
+ var D, _, K, E;
477
480
  return {
478
481
  // Redundant label and title for better compatibility
479
- label: ((A = o(a)) == null ? void 0 : A.prefLabel) || "",
480
- title: ((G = o(a)) == null ? void 0 : G.prefLabel) || "",
481
- uri: ((_ = o(a)) == null ? void 0 : _["@id"]) || "",
482
- "@value": d((k = o(a)) == null ? void 0 : k.prefLabel) || ""
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) || ""
483
486
  };
484
487
  }
485
488
  )
@@ -518,8 +521,8 @@ function Re(e) {
518
521
  "dcat:accessURL": ((n = o(r["dcat:accessURL"])) == null ? void 0 : n["@id"]) || "",
519
522
  "dct:description": d(r["dct:description"]) || "",
520
523
  "dct:title": d(r["dct:title"]) || "",
521
- "dct:format": r["dct:format"] && ((f = T(o(r["dct:format"]))) == null ? void 0 : f.label) || "",
522
- formatUri: r["dct:format"] && ((c = T(o(r["dct:format"]))) == null ? void 0 : c.uri) || ""
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) || ""
523
526
  };
524
527
  });
525
528
  }
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.71",
4
+ "version": "0.1.0-beta.72",
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.21.tgz",
58
+ "@piveau/jsonld": "file:../../bin/piveau-jsonld-1.0.0-beta.22.tgz",
59
59
  "@popperjs/core": "^2.11.8",
60
60
  "@types/jsonld": "^1.5.15",
61
61
  "@types/node": "^24.1.0",