@piveau/dpi 0.1.0-beta.84 → 0.1.0-beta.86
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.
- package/dist/msw/handlers.js +67 -64
- package/package.json +1 -1
package/dist/msw/handlers.js
CHANGED
|
@@ -3,74 +3,75 @@ import g from "./vocabularies-search/access-right.json.js";
|
|
|
3
3
|
import h from "./vocabularies-search/adms.json.js";
|
|
4
4
|
import b from "./vocabularies-search/continent.json.js";
|
|
5
5
|
import v from "./vocabularies-search/contributors.json.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
6
|
+
import M from "./vocabularies-search/corporate-body.json.js";
|
|
7
|
+
import w from "./vocabularies-search/country.json.js";
|
|
8
|
+
import T from "./vocabularies-search/data-theme.json.js";
|
|
9
|
+
import k from "./vocabularies-search/dataset-status.json.js";
|
|
10
|
+
import G from "./vocabularies-search/dataset-type.json.js";
|
|
11
|
+
import S from "./vocabularies-search/dataset-types.json.js";
|
|
12
|
+
import W from "./vocabularies-search/distribution-type.json.js";
|
|
13
|
+
import x from "./vocabularies-search/file-type.json.js";
|
|
14
|
+
import K from "./vocabularies-search/frequency.json.js";
|
|
15
|
+
import L from "./vocabularies-search/hash-algorithms.json.js";
|
|
16
|
+
import R from "./vocabularies-search/hvd-category.json.js";
|
|
17
|
+
import X from "./vocabularies-search/iana-media-types.json.js";
|
|
18
|
+
import $ from "./vocabularies-search/language.json.js";
|
|
19
|
+
import j from "./vocabularies-search/licence.json.js";
|
|
20
|
+
import q from "./vocabularies-search/licenses.json.js";
|
|
21
|
+
import A from "./vocabularies-search/place.json.js";
|
|
22
|
+
import C from "./vocabularies-search/planned-availability.json.js";
|
|
23
|
+
import V from "./vocabularies-search/political-geocoding-district-key.json.js";
|
|
24
|
+
import B from "./vocabularies-search/political-geocoding-government-district-key.json.js";
|
|
25
|
+
import D from "./vocabularies-search/political-geocoding-level.json.js";
|
|
26
|
+
import H from "./vocabularies-search/political-geocoding-municipal-association-key.json.js";
|
|
27
|
+
import P from "./vocabularies-search/political-geocoding-municipality-key.json.js";
|
|
28
|
+
import z from "./vocabularies-search/political-geocoding-regional-key.json.js";
|
|
29
|
+
import O from "./vocabularies-search/political-geocoding-state-key.json.js";
|
|
30
|
+
import U from "./vocabularies-search/spdx-checksum-algorithm.json.js";
|
|
31
31
|
const f = {
|
|
32
32
|
"access-right": g,
|
|
33
33
|
adms: h,
|
|
34
34
|
continent: b,
|
|
35
35
|
contributors: v,
|
|
36
|
-
"corporate-body":
|
|
37
|
-
country:
|
|
38
|
-
"dataset-status":
|
|
39
|
-
"dataset-type":
|
|
40
|
-
"dataset-types":
|
|
41
|
-
"data-theme":
|
|
42
|
-
"file-type":
|
|
43
|
-
frequency:
|
|
44
|
-
"hash-algorithms":
|
|
45
|
-
"hvd-category":
|
|
46
|
-
language:
|
|
47
|
-
licence:
|
|
48
|
-
licenses:
|
|
49
|
-
place:
|
|
50
|
-
"planned-availability":
|
|
51
|
-
"political-geocoding-district-key":
|
|
52
|
-
"political-geocoding-government-district-key":
|
|
53
|
-
"political-geocoding-level":
|
|
54
|
-
"political-geocoding-municipal-association-key":
|
|
55
|
-
"political-geocoding-municipality-key":
|
|
56
|
-
"political-geocoding-regional-key":
|
|
57
|
-
"political-geocoding-state-key":
|
|
58
|
-
"spdx-checksum-algorithm":
|
|
59
|
-
"iana-media-types":
|
|
60
|
-
"distribution-type":
|
|
61
|
-
},
|
|
62
|
-
const
|
|
36
|
+
"corporate-body": M,
|
|
37
|
+
country: w,
|
|
38
|
+
"dataset-status": k,
|
|
39
|
+
"dataset-type": G,
|
|
40
|
+
"dataset-types": S,
|
|
41
|
+
"data-theme": T,
|
|
42
|
+
"file-type": x,
|
|
43
|
+
frequency: K,
|
|
44
|
+
"hash-algorithms": L,
|
|
45
|
+
"hvd-category": R,
|
|
46
|
+
language: $,
|
|
47
|
+
licence: j,
|
|
48
|
+
licenses: q,
|
|
49
|
+
place: A,
|
|
50
|
+
"planned-availability": C,
|
|
51
|
+
"political-geocoding-district-key": V,
|
|
52
|
+
"political-geocoding-government-district-key": B,
|
|
53
|
+
"political-geocoding-level": D,
|
|
54
|
+
"political-geocoding-municipal-association-key": H,
|
|
55
|
+
"political-geocoding-municipality-key": P,
|
|
56
|
+
"political-geocoding-regional-key": z,
|
|
57
|
+
"political-geocoding-state-key": O,
|
|
58
|
+
"spdx-checksum-algorithm": U,
|
|
59
|
+
"iana-media-types": X,
|
|
60
|
+
"distribution-type": W
|
|
61
|
+
}, _ = (c) => {
|
|
62
|
+
const u = c.endsWith("/") ? c.slice(0, -1) : c;
|
|
63
63
|
return [
|
|
64
|
-
d.get(`${
|
|
64
|
+
d.get(`${u}/vocabularies/:vocabulary`, ({ params: n, request: m }) => {
|
|
65
65
|
const { vocabulary: t } = n, e = f[t];
|
|
66
66
|
if (!e)
|
|
67
67
|
return new o(null, {
|
|
68
68
|
status: 404,
|
|
69
|
-
statusText: `Vocabulary '${t}' not found
|
|
69
|
+
statusText: `Vocabulary '${t}' not found`,
|
|
70
|
+
headers: { "X-MSW": "true" }
|
|
70
71
|
});
|
|
71
72
|
const r = new URL(m.url).searchParams.get("q");
|
|
72
73
|
if (!r)
|
|
73
|
-
return o.json(e);
|
|
74
|
+
return o.json(e, { headers: { "X-MSW": "true" } });
|
|
74
75
|
const s = r.toLowerCase(), i = e.result.results.filter((l) => Object.values(l.pref_label).some(
|
|
75
76
|
(y) => y.toLowerCase().includes(s)
|
|
76
77
|
));
|
|
@@ -80,28 +81,30 @@ const f = {
|
|
|
80
81
|
count: i.length,
|
|
81
82
|
results: i
|
|
82
83
|
}
|
|
83
|
-
});
|
|
84
|
+
}, { headers: { "X-MSW": "true" } });
|
|
84
85
|
}),
|
|
85
|
-
d.get(`${
|
|
86
|
+
d.get(`${u}/vocabularies/:vocabulary/vocable`, ({ params: n, request: m }) => {
|
|
86
87
|
var s, i, l;
|
|
87
88
|
const { vocabulary: t } = n, a = new URL(m.url).searchParams.get("resource");
|
|
88
89
|
if (!a)
|
|
89
90
|
return new o(null, {
|
|
90
91
|
status: 404,
|
|
91
|
-
statusText: `Vocabulary '${t}' not found
|
|
92
|
+
statusText: `Vocabulary '${t}' not found`,
|
|
93
|
+
headers: { "X-MSW": "true" }
|
|
92
94
|
});
|
|
93
|
-
const r = (l = (i = (s = f[t]) == null ? void 0 : s.result) == null ? void 0 : i.results) == null ? void 0 : l.find((
|
|
95
|
+
const r = (l = (i = (s = f[t]) == null ? void 0 : s.result) == null ? void 0 : i.results) == null ? void 0 : l.find((p) => p.resource === a);
|
|
94
96
|
return r ? o.json({
|
|
95
97
|
result: r
|
|
96
|
-
}) : new o(null, {
|
|
98
|
+
}, { headers: { "X-MSW": "true" } }) : new o(null, {
|
|
97
99
|
status: 404,
|
|
98
|
-
statusText: `Vocable '${a}' not found in vocabulary '${t}'
|
|
100
|
+
statusText: `Vocable '${a}' not found in vocabulary '${t}'`,
|
|
101
|
+
headers: { "X-MSW": "true" }
|
|
99
102
|
});
|
|
100
103
|
})
|
|
101
104
|
];
|
|
102
|
-
},
|
|
105
|
+
}, Tt = _("http://msw");
|
|
103
106
|
export {
|
|
104
|
-
|
|
105
|
-
|
|
107
|
+
_ as createHandlers,
|
|
108
|
+
Tt as handlers,
|
|
106
109
|
f as vocabularyMap
|
|
107
110
|
};
|