@maschinenlesbar.org/ckan-cli 0.0.1
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/CONTRIBUTING.md +25 -0
- package/LICENSE +661 -0
- package/LICENSING.md +47 -0
- package/README.md +268 -0
- package/dist/src/cli/commands/catalogue.d.ts +4 -0
- package/dist/src/cli/commands/catalogue.d.ts.map +1 -0
- package/dist/src/cli/commands/catalogue.js +103 -0
- package/dist/src/cli/commands/catalogue.js.map +1 -0
- package/dist/src/cli/commands/portal.d.ts +4 -0
- package/dist/src/cli/commands/portal.d.ts.map +1 -0
- package/dist/src/cli/commands/portal.js +61 -0
- package/dist/src/cli/commands/portal.js.map +1 -0
- package/dist/src/cli/index.d.ts +3 -0
- package/dist/src/cli/index.d.ts.map +1 -0
- package/dist/src/cli/index.js +6 -0
- package/dist/src/cli/index.js.map +1 -0
- package/dist/src/cli/io.d.ts +15 -0
- package/dist/src/cli/io.d.ts.map +1 -0
- package/dist/src/cli/io.js +8 -0
- package/dist/src/cli/io.js.map +1 -0
- package/dist/src/cli/program.d.ts +7 -0
- package/dist/src/cli/program.d.ts.map +1 -0
- package/dist/src/cli/program.js +77 -0
- package/dist/src/cli/program.js.map +1 -0
- package/dist/src/cli/run.d.ts +3 -0
- package/dist/src/cli/run.d.ts.map +1 -0
- package/dist/src/cli/run.js +48 -0
- package/dist/src/cli/run.js.map +1 -0
- package/dist/src/cli/shared.d.ts +61 -0
- package/dist/src/cli/shared.d.ts.map +1 -0
- package/dist/src/cli/shared.js +134 -0
- package/dist/src/cli/shared.js.map +1 -0
- package/dist/src/client/client.d.ts +71 -0
- package/dist/src/client/client.d.ts.map +1 -0
- package/dist/src/client/client.js +194 -0
- package/dist/src/client/client.js.map +1 -0
- package/dist/src/client/engine.d.ts +56 -0
- package/dist/src/client/engine.d.ts.map +1 -0
- package/dist/src/client/engine.js +193 -0
- package/dist/src/client/engine.js.map +1 -0
- package/dist/src/client/errors.d.ts +40 -0
- package/dist/src/client/errors.d.ts.map +1 -0
- package/dist/src/client/errors.js +73 -0
- package/dist/src/client/errors.js.map +1 -0
- package/dist/src/client/http.d.ts +31 -0
- package/dist/src/client/http.d.ts.map +1 -0
- package/dist/src/client/http.js +111 -0
- package/dist/src/client/http.js.map +1 -0
- package/dist/src/client/index.d.ts +13 -0
- package/dist/src/client/index.d.ts.map +1 -0
- package/dist/src/client/index.js +10 -0
- package/dist/src/client/index.js.map +1 -0
- package/dist/src/client/portals-list.d.ts +3 -0
- package/dist/src/client/portals-list.d.ts.map +1 -0
- package/dist/src/client/portals-list.js +294 -0
- package/dist/src/client/portals-list.js.map +1 -0
- package/dist/src/client/portals.d.ts +37 -0
- package/dist/src/client/portals.d.ts.map +1 -0
- package/dist/src/client/portals.js +122 -0
- package/dist/src/client/portals.js.map +1 -0
- package/dist/src/client/query.d.ts +9 -0
- package/dist/src/client/query.d.ts.map +1 -0
- package/dist/src/client/query.js +33 -0
- package/dist/src/client/query.js.map +1 -0
- package/dist/src/client/types.d.ts +99 -0
- package/dist/src/client/types.d.ts.map +1 -0
- package/dist/src/client/types.js +8 -0
- package/dist/src/client/types.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
// The known CKAN portals in Germany, maintained with scripts/update-portals.ts.
|
|
2
|
+
//
|
|
3
|
+
// `npm run update-portals` collects candidates from three lists (Wikidata, the CKAN
|
|
4
|
+
// project's instance registry, GovData's harvest sources), checks each live, and
|
|
5
|
+
// rewrites this file. It reads PORTALS from here first, so a hand-added entry is
|
|
6
|
+
// checked and kept, as long as it stays in the same plain JSON as the rest: append
|
|
7
|
+
// { id, title, url, sources: ["curated"], note } plus the other fields (null/false)
|
|
8
|
+
// and run it. `id`, `title` and `note` are kept as written; `working`, `checked`,
|
|
9
|
+
// `problem`, `ckanVersion` and `datasets` come from the last check, and a failing
|
|
10
|
+
// check keeps the last known version and dataset count.
|
|
11
|
+
//
|
|
12
|
+
// This is the list `ckan portals` shows and `--portal <id>` looks up. It is compiled
|
|
13
|
+
// into the CLI, so neither needs any of the upstream lists at run time.
|
|
14
|
+
/**
|
|
15
|
+
* Freeze a list and its entries: `readonly` is compile-time only, and these are the
|
|
16
|
+
* data every CLI run reads, so a JS consumer must not be able to change them.
|
|
17
|
+
*/
|
|
18
|
+
const frozen = (list) => Object.freeze(list.map((entry) => Object.freeze(entry)));
|
|
19
|
+
export const PORTALS = frozen([
|
|
20
|
+
{
|
|
21
|
+
"id": "aachen",
|
|
22
|
+
"title": "Open Data Portal Aachen",
|
|
23
|
+
"url": "https://offenedaten.aachen.de",
|
|
24
|
+
"sources": [
|
|
25
|
+
"curated",
|
|
26
|
+
"wikidata"
|
|
27
|
+
],
|
|
28
|
+
"working": true,
|
|
29
|
+
"checked": "2026-09-19",
|
|
30
|
+
"problem": null,
|
|
31
|
+
"ckanVersion": "2.10.1",
|
|
32
|
+
"datasets": 227,
|
|
33
|
+
"note": null
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"id": "berlin",
|
|
37
|
+
"title": "Berlin Open Data",
|
|
38
|
+
"url": "https://datenregister.berlin.de",
|
|
39
|
+
"sources": [
|
|
40
|
+
"curated",
|
|
41
|
+
"govdata-harvest"
|
|
42
|
+
],
|
|
43
|
+
"working": true,
|
|
44
|
+
"checked": "2026-09-19",
|
|
45
|
+
"problem": null,
|
|
46
|
+
"ckanVersion": null,
|
|
47
|
+
"datasets": 2626,
|
|
48
|
+
"note": "status_show requires a login (HTTP 403); search and the other read actions work."
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": "ble",
|
|
52
|
+
"title": "Bundesministerium für Ernährung und Landwirtschaft",
|
|
53
|
+
"url": "https://open-data.ble.de",
|
|
54
|
+
"sources": [
|
|
55
|
+
"govdata-harvest"
|
|
56
|
+
],
|
|
57
|
+
"working": true,
|
|
58
|
+
"checked": "2026-09-19",
|
|
59
|
+
"problem": null,
|
|
60
|
+
"ckanVersion": "2.11.3",
|
|
61
|
+
"datasets": 38,
|
|
62
|
+
"note": null
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"id": "bw",
|
|
66
|
+
"title": "daten.bw",
|
|
67
|
+
"url": "https://www.daten-bw.de/ckan",
|
|
68
|
+
"sources": [
|
|
69
|
+
"curated",
|
|
70
|
+
"govdata-harvest"
|
|
71
|
+
],
|
|
72
|
+
"working": true,
|
|
73
|
+
"checked": "2026-09-19",
|
|
74
|
+
"problem": null,
|
|
75
|
+
"ckanVersion": "2.10.10",
|
|
76
|
+
"datasets": 2067,
|
|
77
|
+
"note": "CKAN mounted under /ckan."
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"id": "govdata",
|
|
81
|
+
"title": "GovData",
|
|
82
|
+
"url": "https://ckan.govdata.de",
|
|
83
|
+
"sources": [
|
|
84
|
+
"curated",
|
|
85
|
+
"wikidata"
|
|
86
|
+
],
|
|
87
|
+
"working": true,
|
|
88
|
+
"checked": "2026-09-19",
|
|
89
|
+
"problem": null,
|
|
90
|
+
"ckanVersion": "2.10.10",
|
|
91
|
+
"datasets": 167870,
|
|
92
|
+
"note": "The national catalogue; harvests the Länder and federal portals. Also reachable at https://www.govdata.de/ckan."
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"id": "greifswald",
|
|
96
|
+
"title": "Open Data Greifswald",
|
|
97
|
+
"url": "https://opendata.greifswald.de",
|
|
98
|
+
"sources": [
|
|
99
|
+
"curated",
|
|
100
|
+
"govdata-harvest"
|
|
101
|
+
],
|
|
102
|
+
"working": true,
|
|
103
|
+
"checked": "2026-09-19",
|
|
104
|
+
"problem": null,
|
|
105
|
+
"ckanVersion": "2.11.6",
|
|
106
|
+
"datasets": 39,
|
|
107
|
+
"note": null
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"id": "hamburg",
|
|
111
|
+
"title": "Transparenzportal Hamburg",
|
|
112
|
+
"url": "https://suche.transparenz.hamburg.de",
|
|
113
|
+
"sources": [
|
|
114
|
+
"curated",
|
|
115
|
+
"govdata-harvest"
|
|
116
|
+
],
|
|
117
|
+
"working": true,
|
|
118
|
+
"checked": "2026-09-19",
|
|
119
|
+
"problem": null,
|
|
120
|
+
"ckanVersion": "2.10.11",
|
|
121
|
+
"datasets": 245651,
|
|
122
|
+
"note": "The default portal. Mostly documents published under the Hamburg Transparency Act (HmbTG)."
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"id": "hessen",
|
|
126
|
+
"title": "opendata.hessen.de",
|
|
127
|
+
"url": "https://opendata.hessen.de",
|
|
128
|
+
"sources": [
|
|
129
|
+
"curated",
|
|
130
|
+
"govdata-harvest"
|
|
131
|
+
],
|
|
132
|
+
"working": true,
|
|
133
|
+
"checked": "2026-09-19",
|
|
134
|
+
"problem": null,
|
|
135
|
+
"ckanVersion": "2.10.7",
|
|
136
|
+
"datasets": 1559,
|
|
137
|
+
"note": null
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"id": "karlsruhe",
|
|
141
|
+
"title": "Transparenzportal der Stadt Karlsruhe",
|
|
142
|
+
"url": "https://transparenz.karlsruhe.de",
|
|
143
|
+
"sources": [
|
|
144
|
+
"curated",
|
|
145
|
+
"wikidata",
|
|
146
|
+
"ckan-instances"
|
|
147
|
+
],
|
|
148
|
+
"working": true,
|
|
149
|
+
"checked": "2026-09-19",
|
|
150
|
+
"problem": null,
|
|
151
|
+
"ckanVersion": "2.11.3",
|
|
152
|
+
"datasets": 151,
|
|
153
|
+
"note": null
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"id": "leipzig",
|
|
157
|
+
"title": "Open Data-Portal der Stadt Leipzig",
|
|
158
|
+
"url": "https://opendata.leipzig.de",
|
|
159
|
+
"sources": [
|
|
160
|
+
"curated",
|
|
161
|
+
"wikidata"
|
|
162
|
+
],
|
|
163
|
+
"working": true,
|
|
164
|
+
"checked": "2026-09-19",
|
|
165
|
+
"problem": null,
|
|
166
|
+
"ckanVersion": "2.10.7",
|
|
167
|
+
"datasets": 412,
|
|
168
|
+
"note": null
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"id": "muenchen",
|
|
172
|
+
"title": "Open Data Portal München",
|
|
173
|
+
"url": "https://opendata.muenchen.de",
|
|
174
|
+
"sources": [
|
|
175
|
+
"curated",
|
|
176
|
+
"wikidata"
|
|
177
|
+
],
|
|
178
|
+
"working": true,
|
|
179
|
+
"checked": "2026-09-19",
|
|
180
|
+
"problem": null,
|
|
181
|
+
"ckanVersion": "2.9.9",
|
|
182
|
+
"datasets": 337,
|
|
183
|
+
"note": null
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"id": "nrw",
|
|
187
|
+
"title": "Open.NRW",
|
|
188
|
+
"url": "https://open.nrw",
|
|
189
|
+
"sources": [
|
|
190
|
+
"curated",
|
|
191
|
+
"wikidata",
|
|
192
|
+
"govdata-harvest"
|
|
193
|
+
],
|
|
194
|
+
"working": true,
|
|
195
|
+
"checked": "2026-09-19",
|
|
196
|
+
"problem": null,
|
|
197
|
+
"ckanVersion": "2.11.6",
|
|
198
|
+
"datasets": 11099,
|
|
199
|
+
"note": null
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"id": "offenesdatenportal",
|
|
203
|
+
"title": "Offenesdatenportal.de",
|
|
204
|
+
"url": "https://www.offenesdatenportal.de",
|
|
205
|
+
"sources": [
|
|
206
|
+
"curated",
|
|
207
|
+
"wikidata"
|
|
208
|
+
],
|
|
209
|
+
"working": true,
|
|
210
|
+
"checked": "2026-09-19",
|
|
211
|
+
"problem": null,
|
|
212
|
+
"ckanVersion": "2.11.0",
|
|
213
|
+
"datasets": 1118,
|
|
214
|
+
"note": "Shared portal of several municipalities (Moers, Wesel and others), one organization each."
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"id": "rostock",
|
|
218
|
+
"title": "OpenData.HRO",
|
|
219
|
+
"url": "https://www.opendata-hro.de",
|
|
220
|
+
"sources": [
|
|
221
|
+
"curated",
|
|
222
|
+
"wikidata",
|
|
223
|
+
"ckan-instances",
|
|
224
|
+
"govdata-harvest"
|
|
225
|
+
],
|
|
226
|
+
"working": true,
|
|
227
|
+
"checked": "2026-09-19",
|
|
228
|
+
"problem": null,
|
|
229
|
+
"ckanVersion": "2.12.0",
|
|
230
|
+
"datasets": 282,
|
|
231
|
+
"note": null
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"id": "ruhr",
|
|
235
|
+
"title": "Open Data Portal Ruhr",
|
|
236
|
+
"url": "https://opendata.ruhr",
|
|
237
|
+
"sources": [
|
|
238
|
+
"curated",
|
|
239
|
+
"wikidata"
|
|
240
|
+
],
|
|
241
|
+
"working": true,
|
|
242
|
+
"checked": "2026-09-19",
|
|
243
|
+
"problem": null,
|
|
244
|
+
"ckanVersion": "2.10.5",
|
|
245
|
+
"datasets": 3211,
|
|
246
|
+
"note": null
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"id": "schleswig-holstein",
|
|
250
|
+
"title": "Open-Data Schleswig-Holstein",
|
|
251
|
+
"url": "https://opendata.schleswig-holstein.de",
|
|
252
|
+
"sources": [
|
|
253
|
+
"curated",
|
|
254
|
+
"govdata-harvest"
|
|
255
|
+
],
|
|
256
|
+
"working": true,
|
|
257
|
+
"checked": "2026-09-19",
|
|
258
|
+
"problem": null,
|
|
259
|
+
"ckanVersion": "2.11.5",
|
|
260
|
+
"datasets": 32195,
|
|
261
|
+
"note": null
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"id": "uni-hannover",
|
|
265
|
+
"title": "Forschungsdaten-Repositorium der LUH",
|
|
266
|
+
"url": "https://data.uni-hannover.de",
|
|
267
|
+
"sources": [
|
|
268
|
+
"curated",
|
|
269
|
+
"ckan-instances"
|
|
270
|
+
],
|
|
271
|
+
"working": true,
|
|
272
|
+
"checked": "2026-09-19",
|
|
273
|
+
"problem": null,
|
|
274
|
+
"ckanVersion": "2.12.0",
|
|
275
|
+
"datasets": 495,
|
|
276
|
+
"note": "Research data of Leibniz Universität Hannover, not public-sector data."
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"id": "zbw-journaldata",
|
|
280
|
+
"title": "ZBW Journal Data Archive",
|
|
281
|
+
"url": "https://journaldata.zbw.eu",
|
|
282
|
+
"sources": [
|
|
283
|
+
"curated",
|
|
284
|
+
"ckan-instances"
|
|
285
|
+
],
|
|
286
|
+
"working": true,
|
|
287
|
+
"checked": "2026-09-19",
|
|
288
|
+
"problem": null,
|
|
289
|
+
"ckanVersion": "2.9.6",
|
|
290
|
+
"datasets": 2009,
|
|
291
|
+
"note": "Research data of economics journals, not public-sector data."
|
|
292
|
+
}
|
|
293
|
+
]);
|
|
294
|
+
//# sourceMappingURL=portals-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portals-list.js","sourceRoot":"","sources":["../../../src/client/portals-list.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,EAAE;AACF,oFAAoF;AACpF,iFAAiF;AACjF,iFAAiF;AACjF,mFAAmF;AACnF,oFAAoF;AACpF,kFAAkF;AAClF,kFAAkF;AAClF,wDAAwD;AACxD,EAAE;AACF,qFAAqF;AACrF,wEAAwE;AAIxE;;;GAGG;AACH,MAAM,MAAM,GAAG,CAAI,IAAS,EAAgB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAExG,MAAM,CAAC,MAAM,OAAO,GAAsB,MAAM,CAAC;IAC/C;QACE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,yBAAyB;QAClC,KAAK,EAAE,+BAA+B;QACtC,SAAS,EAAE;YACT,SAAS;YACT,UAAU;SACX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anClient } from "./client.js";
|
|
2
|
+
import type { Portal } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* One identity per portal, whatever form its URL was written in: host (without
|
|
5
|
+
* `www.`) plus path, lower-cased, without scheme, trailing slash or a pasted
|
|
6
|
+
* `/api/3/action` suffix. `https://www.daten-bw.de/ckan` → `daten-bw.de/ckan`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function portalKey(url: string): string;
|
|
9
|
+
/** A portal from `list` by its id (any case) or by any form of its URL. */
|
|
10
|
+
export declare function findPortal(idOrUrl: string, list: readonly Portal[]): Portal | undefined;
|
|
11
|
+
/** The outcome of `checkPortal`. */
|
|
12
|
+
export interface PortalCheck {
|
|
13
|
+
working: boolean;
|
|
14
|
+
/** A short reason when not working, e.g. `HTTP 404`, `host not found`. */
|
|
15
|
+
problem: string | null;
|
|
16
|
+
datasets: number | null;
|
|
17
|
+
/** From `status_show`, which some portals lock (Berlin): then null. */
|
|
18
|
+
ckanVersion: string | null;
|
|
19
|
+
siteTitle: string | null;
|
|
20
|
+
siteUrl: string | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A short live check of the CKAN portal a client points at. It works when `package_search?rows=0`
|
|
24
|
+
* answers with a CKAN envelope; `status_show` is then asked for the version and
|
|
25
|
+
* site URL, and a failure there (Berlin answers 403) does not count against it.
|
|
26
|
+
* Never throws: a failure is described in `problem`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function checkPortal(client: CkanClient): Promise<PortalCheck>;
|
|
29
|
+
/**
|
|
30
|
+
* A portal entry updated with a check made on `date` (`YYYY-MM-DD`). A failed
|
|
31
|
+
* check keeps the last known version and dataset count, so an entry that is down
|
|
32
|
+
* still shows what it last served.
|
|
33
|
+
*/
|
|
34
|
+
export declare function withCheck(portal: Portal, check: PortalCheck, date: string): Portal;
|
|
35
|
+
/** Run `fn` over `items` with at most `limit` calls in flight; results keep the input order. */
|
|
36
|
+
export declare function mapLimit<T, R>(items: readonly T[], limit: number, fn: (item: T) => Promise<R>): Promise<R[]>;
|
|
37
|
+
//# sourceMappingURL=portals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portals.d.ts","sourceRoot":"","sources":["../../../src/client/portals.ts"],"names":[],"mappings":"AAGA,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK7C;AAED,2EAA2E;AAC3E,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAWvF;AAED,oCAAoC;AACpC,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,0EAA0E;IAC1E,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,uEAAuE;IACvE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAyB1E;AAyBD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CASlF;AAED,gGAAgG;AAChG,wBAAsB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAWlH"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// Known CKAN portals: lookup and a short live check. The list itself is in
|
|
2
|
+
// portals-list.ts, maintained with scripts/update-portals.ts.
|
|
3
|
+
import { siteRoot } from "./client.js";
|
|
4
|
+
import { CkanApiError, CkanNetworkError, CkanParseError } from "./errors.js";
|
|
5
|
+
/**
|
|
6
|
+
* One identity per portal, whatever form its URL was written in: host (without
|
|
7
|
+
* `www.`) plus path, lower-cased, without scheme, trailing slash or a pasted
|
|
8
|
+
* `/api/3/action` suffix. `https://www.daten-bw.de/ckan` → `daten-bw.de/ckan`.
|
|
9
|
+
*/
|
|
10
|
+
export function portalKey(url) {
|
|
11
|
+
const parsed = new URL(siteRoot(url));
|
|
12
|
+
const host = parsed.host.toLowerCase().replace(/^www\./, "");
|
|
13
|
+
const path = parsed.pathname.replace(/\/+$/, "").toLowerCase();
|
|
14
|
+
return `${host}${path}`;
|
|
15
|
+
}
|
|
16
|
+
/** A portal from `list` by its id (any case) or by any form of its URL. */
|
|
17
|
+
export function findPortal(idOrUrl, list) {
|
|
18
|
+
const wanted = idOrUrl.trim().toLowerCase();
|
|
19
|
+
const byId = list.find((p) => p.id.toLowerCase() === wanted);
|
|
20
|
+
if (byId)
|
|
21
|
+
return byId;
|
|
22
|
+
let key;
|
|
23
|
+
try {
|
|
24
|
+
key = portalKey(idOrUrl);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return undefined; // not a URL either
|
|
28
|
+
}
|
|
29
|
+
return list.find((p) => portalKey(p.url) === key);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A short live check of the CKAN portal a client points at. It works when `package_search?rows=0`
|
|
33
|
+
* answers with a CKAN envelope; `status_show` is then asked for the version and
|
|
34
|
+
* site URL, and a failure there (Berlin answers 403) does not count against it.
|
|
35
|
+
* Never throws: a failure is described in `problem`.
|
|
36
|
+
*/
|
|
37
|
+
export async function checkPortal(client) {
|
|
38
|
+
const result = {
|
|
39
|
+
working: false,
|
|
40
|
+
problem: null,
|
|
41
|
+
datasets: null,
|
|
42
|
+
ckanVersion: null,
|
|
43
|
+
siteTitle: null,
|
|
44
|
+
siteUrl: null,
|
|
45
|
+
};
|
|
46
|
+
try {
|
|
47
|
+
const search = await client.packageSearch({ rows: 0 });
|
|
48
|
+
result.working = true;
|
|
49
|
+
result.datasets = typeof search.count === "number" ? search.count : null;
|
|
50
|
+
try {
|
|
51
|
+
const status = await client.status();
|
|
52
|
+
result.ckanVersion = typeof status.ckan_version === "string" ? status.ckan_version : null;
|
|
53
|
+
result.siteTitle = typeof status.site_title === "string" && status.site_title !== "" ? status.site_title : null;
|
|
54
|
+
result.siteUrl = typeof status.site_url === "string" && status.site_url !== "" ? status.site_url : null;
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// status_show is optional.
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
result.problem = problemOf(err);
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
/** A short, stable reason for a failed check. */
|
|
66
|
+
function problemOf(err) {
|
|
67
|
+
if (err instanceof CkanApiError) {
|
|
68
|
+
return err.detail?.startsWith("stopped after") ? "redirect loop" : `HTTP ${err.status}`;
|
|
69
|
+
}
|
|
70
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
71
|
+
if (err instanceof CkanParseError) {
|
|
72
|
+
const got = /but got (.+)$/.exec(message);
|
|
73
|
+
if (got)
|
|
74
|
+
return `not JSON (${got[1]})`;
|
|
75
|
+
if (/not a CKAN Action API response/.test(message))
|
|
76
|
+
return "not a CKAN Action API";
|
|
77
|
+
return "invalid JSON";
|
|
78
|
+
}
|
|
79
|
+
if (err instanceof CkanNetworkError) {
|
|
80
|
+
const code = err.cause?.code;
|
|
81
|
+
if (code === "ENOTFOUND" || code === "EAI_AGAIN")
|
|
82
|
+
return "host not found";
|
|
83
|
+
if (code === "ECONNREFUSED")
|
|
84
|
+
return "connection refused";
|
|
85
|
+
if (code === "ECONNRESET")
|
|
86
|
+
return "connection reset";
|
|
87
|
+
if (/certificate|CERT|SELF_SIGNED/i.test(`${String(code)} ${message}`))
|
|
88
|
+
return "TLS certificate not verifiable";
|
|
89
|
+
if (/timed out|deadline/.test(message))
|
|
90
|
+
return "timeout";
|
|
91
|
+
}
|
|
92
|
+
return message.slice(0, 80);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A portal entry updated with a check made on `date` (`YYYY-MM-DD`). A failed
|
|
96
|
+
* check keeps the last known version and dataset count, so an entry that is down
|
|
97
|
+
* still shows what it last served.
|
|
98
|
+
*/
|
|
99
|
+
export function withCheck(portal, check, date) {
|
|
100
|
+
return {
|
|
101
|
+
...portal,
|
|
102
|
+
working: check.working,
|
|
103
|
+
checked: date,
|
|
104
|
+
problem: check.problem,
|
|
105
|
+
ckanVersion: check.ckanVersion ?? portal.ckanVersion,
|
|
106
|
+
datasets: check.datasets ?? portal.datasets,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/** Run `fn` over `items` with at most `limit` calls in flight; results keep the input order. */
|
|
110
|
+
export async function mapLimit(items, limit, fn) {
|
|
111
|
+
const results = new Array(items.length);
|
|
112
|
+
let next = 0;
|
|
113
|
+
const worker = async () => {
|
|
114
|
+
while (next < items.length) {
|
|
115
|
+
const i = next++;
|
|
116
|
+
results[i] = await fn(items[i]);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));
|
|
120
|
+
return results;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=portals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portals.js","sourceRoot":"","sources":["../../../src/client/portals.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,8DAA8D;AAE9D,OAAO,EAAE,QAAQ,EAAmB,MAAM,aAAa,CAAC;AACxD,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E,KAAkB,EAAE,IAAY;IACxE,OAAO;QACL,GAAG,MAAM;QACT,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW;QACpD,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ;KAC5C,CAAC;AACJ,CAAC;AAED,gGAAgG;AAChG,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAO,KAAmB,EAAE,KAAa,EAAE,EAA2B;IAClG,MAAM,OAAO,GAAG,IAAI,KAAK,CAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,MAAM,MAAM,GAAG,KAAK,IAAmB,EAAE;QACvC,OAAO,IAAI,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC3B,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;YACjB,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CAAC;IACF,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;IACjF,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type QueryPrimitive = string | number | boolean | Date | null | undefined;
|
|
2
|
+
export type QueryValue = QueryPrimitive | QueryPrimitive[];
|
|
3
|
+
export type QueryParams = Record<string, QueryValue>;
|
|
4
|
+
/**
|
|
5
|
+
* Build a query string (without a leading `?`) from a params object.
|
|
6
|
+
* Returns an empty string when no parameters survive filtering.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildQueryString(params: QueryParams): string;
|
|
9
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/client/query.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;AACjF,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,cAAc,EAAE,CAAC;AAC3D,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAQrD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAe5D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Tiny, dependency-free query-string builder.
|
|
2
|
+
// - `undefined` / `null` values are omitted entirely
|
|
3
|
+
// - arrays are serialised as repeated keys (`?id=a&id=b`)
|
|
4
|
+
// - booleans become the strings "true"/"false"
|
|
5
|
+
// - Date values become full ISO-8601 strings
|
|
6
|
+
// - everything else is coerced with String()
|
|
7
|
+
function serializeScalar(value) {
|
|
8
|
+
if (value instanceof Date)
|
|
9
|
+
return value.toISOString();
|
|
10
|
+
if (typeof value === "boolean")
|
|
11
|
+
return value ? "true" : "false";
|
|
12
|
+
return String(value);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Build a query string (without a leading `?`) from a params object.
|
|
16
|
+
* Returns an empty string when no parameters survive filtering.
|
|
17
|
+
*/
|
|
18
|
+
export function buildQueryString(params) {
|
|
19
|
+
const search = new URLSearchParams();
|
|
20
|
+
for (const [key, raw] of Object.entries(params)) {
|
|
21
|
+
if (raw === undefined || raw === null)
|
|
22
|
+
continue;
|
|
23
|
+
const values = Array.isArray(raw) ? raw : [raw];
|
|
24
|
+
for (const value of values) {
|
|
25
|
+
if (value === undefined || value === null)
|
|
26
|
+
continue;
|
|
27
|
+
search.append(key, serializeScalar(value));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// URLSearchParams encodes spaces as "+"; "%20" is more broadly interoperable.
|
|
31
|
+
return search.toString().replace(/\+/g, "%20");
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/client/query.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,uDAAuD;AACvD,4DAA4D;AAC5D,iDAAiD;AACjD,+CAA+C;AAC/C,+CAA+C;AAM/C,SAAS,eAAe,CAAC,KAAgD;IACvE,IAAI,KAAK,YAAY,IAAI;QAAE,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;IACtD,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAChE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAmB;IAClD,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;IAErC,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAChD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI;YAAE,SAAS;QAEhD,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAChD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;gBAAE,SAAS;YACpD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,8EAA8E;IAC9E,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
2
|
+
[key: string]: JsonValue;
|
|
3
|
+
};
|
|
4
|
+
export type JsonObject = {
|
|
5
|
+
[key: string]: JsonValue;
|
|
6
|
+
};
|
|
7
|
+
/** The envelope CKAN wraps every Action API response in. */
|
|
8
|
+
export interface CkanEnvelope<T> {
|
|
9
|
+
help: string;
|
|
10
|
+
success: boolean;
|
|
11
|
+
result?: T;
|
|
12
|
+
error?: JsonObject;
|
|
13
|
+
}
|
|
14
|
+
/** Result of `status_show`: which CKAN this is and what it has installed. */
|
|
15
|
+
export interface Status {
|
|
16
|
+
site_title?: string;
|
|
17
|
+
site_description?: string;
|
|
18
|
+
site_url?: string;
|
|
19
|
+
ckan_version: string;
|
|
20
|
+
locale_default?: string;
|
|
21
|
+
/** Enabled plugins, e.g. `["dcat", "harvest", "spatial_query"]`. */
|
|
22
|
+
extensions?: string[];
|
|
23
|
+
[key: string]: JsonValue | undefined;
|
|
24
|
+
}
|
|
25
|
+
/** A dataset ("package"). Its fields and extras vary from portal to portal. */
|
|
26
|
+
export type Package = JsonObject;
|
|
27
|
+
/** Result of `package_search`. */
|
|
28
|
+
export interface PackageSearchResult {
|
|
29
|
+
count: number;
|
|
30
|
+
results: Package[];
|
|
31
|
+
facets?: JsonObject;
|
|
32
|
+
search_facets?: JsonObject;
|
|
33
|
+
sort?: string;
|
|
34
|
+
}
|
|
35
|
+
/** Parameters for `package_search`. */
|
|
36
|
+
export interface PackageSearchParams {
|
|
37
|
+
/** Solr query string, e.g. `elbe` or `title:Haushalt`. */
|
|
38
|
+
q?: string;
|
|
39
|
+
/** Filter queries, e.g. `["organization:allris"]`. All must match. */
|
|
40
|
+
fq?: string[];
|
|
41
|
+
/** Page size. CKAN caps it server-side (`ckan.search.rows_max`, 1000 by default). */
|
|
42
|
+
rows?: number;
|
|
43
|
+
/** Offset of the first result, for paging. */
|
|
44
|
+
start?: number;
|
|
45
|
+
/** e.g. `"metadata_modified desc"`. */
|
|
46
|
+
sort?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Facet fields to count, e.g. `["organization", "res_format"]`. Counts come
|
|
49
|
+
* back in `search_facets`.
|
|
50
|
+
*/
|
|
51
|
+
facet_field?: string[];
|
|
52
|
+
/** Maximum number of values returned per facet (CKAN's default is 50; -1 = all). */
|
|
53
|
+
facet_limit?: number;
|
|
54
|
+
}
|
|
55
|
+
/** An organization (a data publisher) or a group (a theme/category). */
|
|
56
|
+
export type Organization = JsonObject;
|
|
57
|
+
export type Group = JsonObject;
|
|
58
|
+
/** A resource (a single distributable file within a dataset). */
|
|
59
|
+
export type Resource = JsonObject;
|
|
60
|
+
/** Paging for the `*_list` endpoints. */
|
|
61
|
+
export interface ListParams {
|
|
62
|
+
limit?: number;
|
|
63
|
+
offset?: number;
|
|
64
|
+
}
|
|
65
|
+
/** Parameters for `organization_list` / `group_list`. */
|
|
66
|
+
export interface GroupListParams extends ListParams {
|
|
67
|
+
/** Return full objects instead of just names. */
|
|
68
|
+
all_fields?: boolean;
|
|
69
|
+
}
|
|
70
|
+
/** Parameters for `tag_list`. */
|
|
71
|
+
export interface TagListParams {
|
|
72
|
+
/** Only tags containing this substring. */
|
|
73
|
+
query?: string;
|
|
74
|
+
}
|
|
75
|
+
/** A licence a portal offers (`license_list`). */
|
|
76
|
+
export type License = JsonObject;
|
|
77
|
+
/** Where a known portal was found (see scripts/update-portals.ts). */
|
|
78
|
+
export type PortalSource = "curated" | "wikidata" | "ckan-instances" | "govdata-harvest";
|
|
79
|
+
/** A known CKAN portal, from the built-in list (`ckan portals`). */
|
|
80
|
+
export interface Portal {
|
|
81
|
+
/** Short name for `--portal`, e.g. `hamburg`. */
|
|
82
|
+
id: string;
|
|
83
|
+
title: string;
|
|
84
|
+
/** Site root; the Action API is at `<url>/api/3/action`. */
|
|
85
|
+
url: string;
|
|
86
|
+
sources: PortalSource[];
|
|
87
|
+
/** Whether the last check could search the portal. */
|
|
88
|
+
working: boolean;
|
|
89
|
+
/** Date of the last check (`YYYY-MM-DD`), or null if never checked. */
|
|
90
|
+
checked: string | null;
|
|
91
|
+
/** Why the last check failed, or null. */
|
|
92
|
+
problem: string | null;
|
|
93
|
+
/** From `status_show`; null when a portal does not expose it (Berlin). */
|
|
94
|
+
ckanVersion: string | null;
|
|
95
|
+
/** Number of datasets `package_search` reported at the last check. */
|
|
96
|
+
datasets: number | null;
|
|
97
|
+
note: string | null;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,EAAE,GACX;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AACjC,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEtD,4DAA4D;AAC5D,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED,6EAA6E;AAC7E,MAAM,WAAW,MAAM;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE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aAAa;IAC5B,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,kDAAkD;AAClD,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC;AAEjC,sEAAsE;AACtE,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAEzF,oEAAoE;AACpE,MAAM,WAAW,MAAM;IACrB,iDAAiD;IACjD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,sDAAsD;IACtD,OAAO,EAAE,OAAO,CAAC;IACjB,uEAAuE;IACvE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,0EAA0E;IAC1E,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,sEAAsE;IACtE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Domain types for the CKAN Action API (v3).
|
|
2
|
+
//
|
|
3
|
+
// CKAN wraps every response in `{ help, success, result }` (or an `error` object
|
|
4
|
+
// when `success` is false). The client unwraps `result`; datasets are deeply
|
|
5
|
+
// nested and differ per portal (every instance adds its own extras), so they are
|
|
6
|
+
// exposed as raw `JsonObject`s.
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,iFAAiF;AACjF,6EAA6E;AAC7E,iFAAiF;AACjF,gCAAgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,mBAAmB,CAAC"}
|