@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
package/LICENSING.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Licensing
|
|
2
|
+
|
|
3
|
+
`ckan-cli` is **dual-licensed**. You may use it under **either** of the
|
|
4
|
+
following, at your choice:
|
|
5
|
+
|
|
6
|
+
## 1. Open source — AGPL-3.0-or-later (default)
|
|
7
|
+
|
|
8
|
+
Free to use, modify, and distribute under the
|
|
9
|
+
[GNU Affero General Public License v3.0 or later](LICENSE).
|
|
10
|
+
|
|
11
|
+
The key obligation is the AGPL's **§13 network clause**: if you run a modified
|
|
12
|
+
version of this software to provide a service to others over a network, you must
|
|
13
|
+
make the complete corresponding source code of your modified version available
|
|
14
|
+
to the users of that service. The usual copyleft terms also apply when you
|
|
15
|
+
distribute the software or works based on it.
|
|
16
|
+
|
|
17
|
+
This is the right option for open-source projects, internal and personal use,
|
|
18
|
+
evaluation, and anyone able to comply with the AGPL.
|
|
19
|
+
|
|
20
|
+
## 2. Commercial license
|
|
21
|
+
|
|
22
|
+
If the AGPL's obligations do not fit your situation — for example, you want to:
|
|
23
|
+
|
|
24
|
+
- embed `ckan-cli` in a **closed-source / proprietary product**, or
|
|
25
|
+
- run a **modified version as a proprietary network service (SaaS)** without
|
|
26
|
+
disclosing your source, or
|
|
27
|
+
- keep your modifications private,
|
|
28
|
+
|
|
29
|
+
then a separate **commercial license** is available. It grants use of the same
|
|
30
|
+
code without the AGPL's copyleft and network-disclosure obligations, under
|
|
31
|
+
negotiated terms.
|
|
32
|
+
|
|
33
|
+
**To obtain a commercial license, contact:** sebs@2xs.org
|
|
34
|
+
|
|
35
|
+
## Why this is possible
|
|
36
|
+
|
|
37
|
+
The copyright holder owns 100% of the source code in this repository and can
|
|
38
|
+
therefore offer it under more than one license simultaneously. This project does
|
|
39
|
+
**not** accept external code contributions (see [CONTRIBUTING.md](CONTRIBUTING.md)),
|
|
40
|
+
which keeps copyright ownership single and unambiguous — a prerequisite for
|
|
41
|
+
offering the commercial option. The only third-party dependency that ships with
|
|
42
|
+
the package, [`commander`](https://github.com/tj/commander.js), is MIT-licensed
|
|
43
|
+
and compatible with both licensing options.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
Copyright © 2026 Sebastian Schürmann. All rights reserved.
|
package/README.md
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# ckan-cli
|
|
2
|
+
|
|
3
|
+
[](https://github.com/maschinenlesbar-org/ckan-cli/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/maschinenlesbar-org/ckan-cli/actions/workflows/release.yml)
|
|
5
|
+
[](https://www.npmjs.com/package/@maschinenlesbar.org/ckan-cli)
|
|
6
|
+
|
|
7
|
+
**Website:** [English](https://maschinenlesbar-org.github.io/ckan-cli/) · [Deutsch](https://maschinenlesbar-org.github.io/ckan-cli/de/) — command reference, guides and API docs
|
|
8
|
+
|
|
9
|
+
Search any [CKAN](https://ckan.org/) open-data portal from your terminal. `ckan`
|
|
10
|
+
is a command-line tool over the CKAN Action API (`<portal>/api/3/action`), which
|
|
11
|
+
many public-sector catalogues run on. Out of the box it talks to the
|
|
12
|
+
[Hamburg Transparenzportal](https://transparenz.hamburg.de/api-796358)
|
|
13
|
+
(`suche.transparenz.hamburg.de`), and `--base-url` points it at any other CKAN:
|
|
14
|
+
search, inspect, filter and pipe straight into [`jq`](https://jqlang.github.io/jq/).
|
|
15
|
+
|
|
16
|
+
- **Any CKAN portal** — Hamburg by default; 18 known German portals by name
|
|
17
|
+
(`--portal berlin`), and any other CKAN 2.x portal with `--base-url` or
|
|
18
|
+
`CKAN_BASE_URL`.
|
|
19
|
+
- **No account, no API key** — only the open read actions are used.
|
|
20
|
+
- **Clean JSON output** — the CKAN envelope is unwrapped for you; `--compact`
|
|
21
|
+
for one-line/scripting.
|
|
22
|
+
- **Thirteen commands** — `search`, `package`, `packages`, `resource`,
|
|
23
|
+
`organizations`, `organization`, `groups`, `group`, `tags`, `licenses`,
|
|
24
|
+
`status`, `portals`, and a generic `action` escape hatch for everything else.
|
|
25
|
+
|
|
26
|
+
> Want to use this as a TypeScript library or understand how it's built?
|
|
27
|
+
> See **[DEVELOPING.md](DEVELOPING.md)**.
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm i -g @maschinenlesbar.org/ckan-cli
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This installs the **`ckan`** command. Requires **Node.js 20+**.
|
|
36
|
+
|
|
37
|
+
## Quickstart
|
|
38
|
+
|
|
39
|
+
The two examples from Hamburg's API page, as commands. A full-text search:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
ckan search elbe --rows 5
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
All administrative regulations (*Verwaltungsvorschriften*), using a filter
|
|
46
|
+
query on one of Hamburg's own fields:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
ckan search --fq extras_registerobject_type:verwaltungsvorschriften --rows 5
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The result is unwrapped from CKAN's `{ help, success, result }` envelope, so you
|
|
53
|
+
get `{ count, results, … }` directly. Pull out the titles with `jq`, then fetch
|
|
54
|
+
one full record by its `name`:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
ckan search elbe --rows 5 | jq -r '.results[] | "\(.name) \(.title)"'
|
|
58
|
+
ckan package bezirk-wandsbek-drucksache-22-3573-2
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Choosing a portal
|
|
62
|
+
|
|
63
|
+
`--portal <id>` picks a known portal by name, `--base-url` takes any CKAN site
|
|
64
|
+
URL, and `CKAN_BASE_URL` sets a URL for a whole shell session. Either flag wins
|
|
65
|
+
over the variable, and the variable over the Hamburg default.
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
ckan --portal berlin search Radverkehr --rows 3
|
|
69
|
+
ckan --base-url https://ckan.govdata.de search Haushalt --rows 3
|
|
70
|
+
export CKAN_BASE_URL=https://www.opendata-hro.de
|
|
71
|
+
ckan status
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Give the portal's **site URL**. A URL copied from a portal's API docs works too:
|
|
75
|
+
a trailing `/api/3/action` (or `/api/3`) is dropped, and a CKAN mounted under a
|
|
76
|
+
sub-path keeps it (`https://open.canada.ca/data`). `ckan status` is a good first
|
|
77
|
+
call on an unfamiliar portal: it shows the CKAN version and the installed
|
|
78
|
+
extensions.
|
|
79
|
+
|
|
80
|
+
### Known portals
|
|
81
|
+
|
|
82
|
+
`ckan portals` lists the CKAN portals in Germany this version knows, with the
|
|
83
|
+
result of their last check; `ckan portals --check` checks them all live now.
|
|
84
|
+
The list is built into the CLI, so it needs no outside service:
|
|
85
|
+
|
|
86
|
+
| `--portal` | Portal | Datasets |
|
|
87
|
+
| --- | --- | --- |
|
|
88
|
+
| `hamburg` | Transparenzportal Hamburg (default) | 245,651 |
|
|
89
|
+
| `govdata` | GovData, the national catalogue | 167,870 |
|
|
90
|
+
| `schleswig-holstein` | Open-Data Schleswig-Holstein | 32,195 |
|
|
91
|
+
| `nrw` | Open.NRW | 11,099 |
|
|
92
|
+
| `ruhr` | Open Data Portal Ruhr | 3,211 |
|
|
93
|
+
| `berlin` | Berlin Open Data | 2,626 |
|
|
94
|
+
| `bw` | daten.bw | 2,067 |
|
|
95
|
+
| `zbw-journaldata` | ZBW Journal Data Archive | 2,009 |
|
|
96
|
+
| `hessen` | opendata.hessen.de | 1,559 |
|
|
97
|
+
| `offenesdatenportal` | Offenesdatenportal.de (Moers, Wesel, …) | 1,118 |
|
|
98
|
+
| `uni-hannover` | Forschungsdaten-Repositorium der LUH | 495 |
|
|
99
|
+
| `leipzig` | Open Data Leipzig | 412 |
|
|
100
|
+
| `muenchen` | Open Data München | 337 |
|
|
101
|
+
| `rostock` | OpenData.HRO | 282 |
|
|
102
|
+
| `aachen` | Open Data Aachen | 227 |
|
|
103
|
+
| `karlsruhe` | Transparenzportal Karlsruhe | 151 |
|
|
104
|
+
| `greifswald` | Open Data Greifswald | 39 |
|
|
105
|
+
| `ble` | Bundesministerium für Ernährung und Landwirtschaft | 38 |
|
|
106
|
+
|
|
107
|
+
Counts as of the last check, 2026-09-19. The list is refreshed from Wikidata,
|
|
108
|
+
the CKAN project's instance registry and GovData's harvest sources, keeping only
|
|
109
|
+
portals that pass a live check (see [DEVELOPING.md](DEVELOPING.md#the-portal-list)).
|
|
110
|
+
Many portals those lists name have left CKAN (Köln, Düsseldorf, Bonn, …).
|
|
111
|
+
|
|
112
|
+
## Commands
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
search [query] [filters…] search datasets
|
|
116
|
+
package <id> show one dataset by id or name
|
|
117
|
+
packages [--limit <n>] [--offset <n>] list dataset names
|
|
118
|
+
resource <id> show one resource (distribution)
|
|
119
|
+
organizations [--all-fields] [paging] list organizations (publishers)
|
|
120
|
+
organization <id> show one organization
|
|
121
|
+
groups [--all-fields] [paging] list groups (themes/categories)
|
|
122
|
+
group <id> show one group
|
|
123
|
+
tags [--query <substring>] list tags
|
|
124
|
+
licenses list the licences the portal offers
|
|
125
|
+
status site title, CKAN version, extensions
|
|
126
|
+
portals [--check] list (and check) the known portals
|
|
127
|
+
action <name> [--param key=value …] call any CKAN action (generic)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### `search` filters
|
|
131
|
+
|
|
132
|
+
| Flag | Meaning |
|
|
133
|
+
| --- | --- |
|
|
134
|
+
| `[query]` | free-text Solr query, e.g. `elbe` or `title:haushalt` |
|
|
135
|
+
| `--fq <filter>` | Solr filter query, e.g. `organization:allris` (repeatable; every filter must match) |
|
|
136
|
+
| `--facet <field>` | count the values of a field, e.g. `res_format` (repeatable); counts come back in `facets` / `search_facets` |
|
|
137
|
+
| `--facet-limit <n>` | max values per facet (CKAN's default is 50; `-1` for all) |
|
|
138
|
+
| `--rows <n>` | max results to return |
|
|
139
|
+
| `--start <n>` | zero-based offset for paging |
|
|
140
|
+
| `--sort <expr>` | Solr sort expression, e.g. `metadata_modified desc` |
|
|
141
|
+
|
|
142
|
+
> **`--rows` is capped by the server.** CKAN limits one search page
|
|
143
|
+
> (`ckan.search.rows_max`, 1000 by default; Hamburg uses 1000). Asking for more
|
|
144
|
+
> is not an error: you get at most the cap back, while `count` still reports the
|
|
145
|
+
> true total. Page on with `--start`.
|
|
146
|
+
|
|
147
|
+
> **Several `--fq` filters** are sent as CKAN's `fq_list`, never as a repeated
|
|
148
|
+
> `fq` key, which CKAN answers with HTTP 409.
|
|
149
|
+
|
|
150
|
+
> **Blank values are refused.** `ckan search ""`, `--fq ""` or `tags --query ""`
|
|
151
|
+
> exit 1 before any request, instead of silently running an unfiltered search.
|
|
152
|
+
|
|
153
|
+
### Paging and list flags
|
|
154
|
+
|
|
155
|
+
| Command | Flags |
|
|
156
|
+
| --- | --- |
|
|
157
|
+
| `packages` | `--limit <n>`, `--offset <n>` |
|
|
158
|
+
| `organizations`, `groups` | `--all-fields` (full objects instead of names), `--limit <n>`, `--offset <n>` |
|
|
159
|
+
|
|
160
|
+
> **`--all-fields` lists are complete.** CKAN caps them at 25 entries
|
|
161
|
+
> (`ckan.group_and_organization_list_all_fields_max`) and drops the rest
|
|
162
|
+
> silently, even for a larger `--limit`; `ckan` pages through them for you.
|
|
163
|
+
| `tags` | `--query <substring>` |
|
|
164
|
+
|
|
165
|
+
### `action`
|
|
166
|
+
|
|
167
|
+
`ckan action <name> --param key=value …` calls any read action the portal
|
|
168
|
+
exposes, including actions added by extensions, e.g.
|
|
169
|
+
`ckan action package_autocomplete --param q=elbe --param limit=3`. The name must
|
|
170
|
+
match `^[a-z0-9_]+$`, and duplicate `--param` keys are rejected; both are checked
|
|
171
|
+
before any request is sent.
|
|
172
|
+
|
|
173
|
+
## Hamburg: what to know
|
|
174
|
+
|
|
175
|
+
- **Mostly documents, not datasets.** Hamburg publishes what the Hamburg
|
|
176
|
+
Transparency Act (HmbTG) requires: council papers, contracts, reports,
|
|
177
|
+
regulations, geodata. Most records have `type: "document"`.
|
|
178
|
+
- **The *Informationsgegenstand*** is in `extras_registerobject_type`
|
|
179
|
+
(`verwaltungsvorschriften`, `vertraege_oeff_interesse`, `gutachten`,
|
|
180
|
+
`geodaten`, …). Hamburg lists the allowed values at
|
|
181
|
+
<https://suche.transparenz.hamburg.de/api/rest/enums>. That endpoint is
|
|
182
|
+
Hamburg-specific, not part of the CKAN Action API.
|
|
183
|
+
- **Several filters work.** Hamburg's API page says only one filter can be
|
|
184
|
+
used; with `fq_list` (repeat `--fq`) they combine:
|
|
185
|
+
`ckan search --fq extras_registerobject_type:verwaltungsvorschriften --fq organization:workflows`.
|
|
186
|
+
- **Tags are free text.** Many tags are whole keyword lists in a single string,
|
|
187
|
+
so `tags --query` matches substrings of those strings.
|
|
188
|
+
|
|
189
|
+
## Portal quirks
|
|
190
|
+
|
|
191
|
+
Found by running the same commands against many portals:
|
|
192
|
+
|
|
193
|
+
- **Some portals lock `status_show`** (Berlin: HTTP 403). Everything else works.
|
|
194
|
+
- **An unknown `--sort` field is ignored**, not refused: CKAN returns an
|
|
195
|
+
unsorted result and echoes the sort back. A malformed sort expression is refused.
|
|
196
|
+
- **`packages` and `search` count differently**: `package_list` includes records
|
|
197
|
+
that search does not show (a few dozen more on GovData and NRW).
|
|
198
|
+
- **The default sort differs** (ZBW sorts by `metadata_created desc`).
|
|
199
|
+
- **Field types vary**: licence ids are URIs on GovData, and some portals send
|
|
200
|
+
booleans as the strings `"True"`/`"False"`.
|
|
201
|
+
- **Solr syntax errors** come back as HTTP 409; `ckan` prints Solr's own reason,
|
|
202
|
+
e.g. `Search Error: Cannot parse 'title:(': Encountered "<EOF>" …`.
|
|
203
|
+
- **A site that is not (or no longer) a CKAN** answers with a 404, an HTML page or
|
|
204
|
+
a redirect loop; `ckan` says which, e.g.
|
|
205
|
+
`Expected JSON from … but got text/html`.
|
|
206
|
+
|
|
207
|
+
## Output & scripting
|
|
208
|
+
|
|
209
|
+
Every command prints the **unwrapped `result`** as pretty JSON to stdout.
|
|
210
|
+
Errors go to stderr, so piping stdout into `jq` stays clean. `--compact`
|
|
211
|
+
prints one line. Every global option works before or after the command.
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
# How many records a portal has
|
|
215
|
+
ckan search --rows 0 | jq '.count'
|
|
216
|
+
|
|
217
|
+
# Which publishers and formats dominate
|
|
218
|
+
ckan --compact search --rows 0 --facet organization --facet res_format --facet-limit 5 | jq '.facets'
|
|
219
|
+
|
|
220
|
+
# The download URLs of a record
|
|
221
|
+
ckan package bezirk-wandsbek-drucksache-22-3573-2 | jq '.resources[] | {format, url}'
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Exit codes:**
|
|
225
|
+
|
|
226
|
+
| Code | Meaning |
|
|
227
|
+
| --- | --- |
|
|
228
|
+
| `0` | success (also `--help` / `--version`) |
|
|
229
|
+
| `4` | not found (HTTP `404`), e.g. an unknown dataset id |
|
|
230
|
+
| `1` | any other error — bad usage, validation error (`409`), unknown action (`400`), CKAN `success:false`, network failure |
|
|
231
|
+
|
|
232
|
+
CKAN's error text is shown on stderr, e.g.
|
|
233
|
+
`Validation Error: rows: Invalid integer` or
|
|
234
|
+
`Bad request - Action name not known: …`.
|
|
235
|
+
|
|
236
|
+
## Global options
|
|
237
|
+
|
|
238
|
+
| Option | Description |
|
|
239
|
+
| --- | --- |
|
|
240
|
+
| `-V, --version` | Print the version number |
|
|
241
|
+
| `-h, --help` | Show help for the program or a command |
|
|
242
|
+
| `--compact` | Print JSON on a single line instead of pretty-printed |
|
|
243
|
+
| `--base-url <url>` | CKAN site URL (env `CKAN_BASE_URL`; default `https://suche.transparenz.hamburg.de`) |
|
|
244
|
+
| `--portal <id>` | a known portal by id (`ckan portals`); cannot be combined with `--base-url` |
|
|
245
|
+
| `--timeout <ms>` | Per-request timeout (default `30000`; at most `2147483647`) |
|
|
246
|
+
| `--user-agent <ua>` | `User-Agent` header value |
|
|
247
|
+
| `--max-retries <n>` | Retries for transient `429`/`503` responses (default `2`) |
|
|
248
|
+
| `--max-response-bytes <n>` | Cap response body size in bytes (`0` = unlimited; default 100 MiB) |
|
|
249
|
+
|
|
250
|
+
## Data license
|
|
251
|
+
|
|
252
|
+
This CLI is a **client**. It accesses data it does not own or redistribute, and
|
|
253
|
+
the data is licensed **separately from this tool's code**: by each portal, and
|
|
254
|
+
often per dataset. See **[DATA_LICENSE.md](DATA_LICENSE.md)**.
|
|
255
|
+
|
|
256
|
+
## License
|
|
257
|
+
|
|
258
|
+
**Dual-licensed** — use it under **either**:
|
|
259
|
+
|
|
260
|
+
- **[AGPL-3.0-or-later](LICENSE)** (default, free). Note the AGPL's §13 network
|
|
261
|
+
clause: if you run a modified version as a network service, you must offer that
|
|
262
|
+
modified source to the service's users.
|
|
263
|
+
- **Commercial license** (paid), for closed-source / proprietary or SaaS use
|
|
264
|
+
without the AGPL's obligations.
|
|
265
|
+
|
|
266
|
+
See **[LICENSING.md](LICENSING.md)** for details, and **[CONTRIBUTING.md](CONTRIBUTING.md)**
|
|
267
|
+
for the contribution policy (this project does not accept external code
|
|
268
|
+
contributions). Commercial enquiries: **sebs@2xs.org**.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogue.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/catalogue.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAQxC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAwI/E"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Commands over the catalogue: datasets, their resources, publishers, themes
|
|
2
|
+
// and tags.
|
|
3
|
+
import { action, collectNonEmpty, parseIntArg, parseNonEmpty, renderJson } from "../shared.js";
|
|
4
|
+
/** commander value-parser for --facet-limit: a count, or -1 for every value. */
|
|
5
|
+
function parseFacetLimit(value) {
|
|
6
|
+
return value === "-1" ? -1 : parseIntArg(value);
|
|
7
|
+
}
|
|
8
|
+
export function registerCatalogueCommands(program, deps) {
|
|
9
|
+
program
|
|
10
|
+
.command("search")
|
|
11
|
+
.description("Search datasets (Solr query syntax)")
|
|
12
|
+
.argument("[query]", "full-text query, e.g. elbe or title:haushalt", parseNonEmpty)
|
|
13
|
+
.option("--rows <n>", "max results (servers cap this, usually at 1000)", parseIntArg)
|
|
14
|
+
.option("--start <n>", "offset for paging", parseIntArg)
|
|
15
|
+
.option("--sort <expr>", 'e.g. "metadata_modified desc"', parseNonEmpty)
|
|
16
|
+
.option("--fq <filter>", "filter query, e.g. organization:allris (repeatable; all must match)", collectNonEmpty)
|
|
17
|
+
.option("--facet <field>", "count values of a field, e.g. res_format (repeatable)", collectNonEmpty)
|
|
18
|
+
.option("--facet-limit <n>", "max values per facet (default 50; -1 = all)", parseFacetLimit)
|
|
19
|
+
.action(action(deps, async ({ client, global, opts }, [query]) => {
|
|
20
|
+
renderJson(deps, global, await client.packageSearch({
|
|
21
|
+
q: query,
|
|
22
|
+
rows: opts["rows"],
|
|
23
|
+
start: opts["start"],
|
|
24
|
+
sort: opts["sort"],
|
|
25
|
+
fq: opts["fq"],
|
|
26
|
+
facet_field: opts["facet"],
|
|
27
|
+
facet_limit: opts["facetLimit"],
|
|
28
|
+
}));
|
|
29
|
+
}));
|
|
30
|
+
program
|
|
31
|
+
.command("package")
|
|
32
|
+
.description("Show one dataset by id or name")
|
|
33
|
+
.argument("<id>", "id or name", parseNonEmpty)
|
|
34
|
+
.action(action(deps, async ({ client, global }, [id]) => {
|
|
35
|
+
renderJson(deps, global, await client.packageShow(id));
|
|
36
|
+
}));
|
|
37
|
+
program
|
|
38
|
+
.command("resource")
|
|
39
|
+
.description("Show one resource (distribution) by id")
|
|
40
|
+
.argument("<id>", "resource id", parseNonEmpty)
|
|
41
|
+
.action(action(deps, async ({ client, global }, [id]) => {
|
|
42
|
+
renderJson(deps, global, await client.resourceShow(id));
|
|
43
|
+
}));
|
|
44
|
+
program
|
|
45
|
+
.command("organization")
|
|
46
|
+
.description("Show one organization (publisher) by id or name")
|
|
47
|
+
.argument("<id>", "id or name", parseNonEmpty)
|
|
48
|
+
.action(action(deps, async ({ client, global }, [id]) => {
|
|
49
|
+
renderJson(deps, global, await client.organizationShow(id));
|
|
50
|
+
}));
|
|
51
|
+
program
|
|
52
|
+
.command("group")
|
|
53
|
+
.description("Show one group (theme/category) by id or name")
|
|
54
|
+
.argument("<id>", "id or name", parseNonEmpty)
|
|
55
|
+
.action(action(deps, async ({ client, global }, [id]) => {
|
|
56
|
+
renderJson(deps, global, await client.groupShow(id));
|
|
57
|
+
}));
|
|
58
|
+
program
|
|
59
|
+
.command("packages")
|
|
60
|
+
.description("List dataset names")
|
|
61
|
+
.option("--limit <n>", "max names", parseIntArg)
|
|
62
|
+
.option("--offset <n>", "offset for paging", parseIntArg)
|
|
63
|
+
.action(action(deps, async ({ client, global, opts }) => {
|
|
64
|
+
renderJson(deps, global, await client.packageList({
|
|
65
|
+
limit: opts["limit"],
|
|
66
|
+
offset: opts["offset"],
|
|
67
|
+
}));
|
|
68
|
+
}));
|
|
69
|
+
program
|
|
70
|
+
.command("organizations")
|
|
71
|
+
.description("List organizations (data publishers)")
|
|
72
|
+
.option("--all-fields", "return full objects instead of names")
|
|
73
|
+
.option("--limit <n>", "max entries", parseIntArg)
|
|
74
|
+
.option("--offset <n>", "offset for paging", parseIntArg)
|
|
75
|
+
.action(action(deps, async ({ client, global, opts }) => {
|
|
76
|
+
renderJson(deps, global, await client.organizationList({
|
|
77
|
+
all_fields: opts["allFields"],
|
|
78
|
+
limit: opts["limit"],
|
|
79
|
+
offset: opts["offset"],
|
|
80
|
+
}));
|
|
81
|
+
}));
|
|
82
|
+
program
|
|
83
|
+
.command("groups")
|
|
84
|
+
.description("List groups (themes/categories)")
|
|
85
|
+
.option("--all-fields", "return full objects instead of names")
|
|
86
|
+
.option("--limit <n>", "max entries", parseIntArg)
|
|
87
|
+
.option("--offset <n>", "offset for paging", parseIntArg)
|
|
88
|
+
.action(action(deps, async ({ client, global, opts }) => {
|
|
89
|
+
renderJson(deps, global, await client.groupList({
|
|
90
|
+
all_fields: opts["allFields"],
|
|
91
|
+
limit: opts["limit"],
|
|
92
|
+
offset: opts["offset"],
|
|
93
|
+
}));
|
|
94
|
+
}));
|
|
95
|
+
program
|
|
96
|
+
.command("tags")
|
|
97
|
+
.description("List tags")
|
|
98
|
+
.option("--query <substring>", "only tags containing this substring", parseNonEmpty)
|
|
99
|
+
.action(action(deps, async ({ client, global, opts }) => {
|
|
100
|
+
renderJson(deps, global, await client.tagList({ query: opts["query"] }));
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=catalogue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogue.js","sourceRoot":"","sources":["../../../../src/cli/commands/catalogue.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,YAAY;AAIZ,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/F,gFAAgF;AAChF,SAAS,eAAe,CAAC,KAAa;IACpC,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,OAAgB,EAAE,IAAa;IACvE,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,qCAAqC,CAAC;SAClD,QAAQ,CAAC,SAAS,EAAE,8CAA8C,EAAE,aAAa,CAAC;SAClF,MAAM,CAAC,YAAY,EAAE,iDAAiD,EAAE,WAAW,CAAC;SACpF,MAAM,CAAC,aAAa,EAAE,mBAAmB,EAAE,WAAW,CAAC;SACvD,MAAM,CAAC,eAAe,EAAE,+BAA+B,EAAE,aAAa,CAAC;SACvE,MAAM,CAAC,eAAe,EAAE,qEAAqE,EAAE,eAAe,CAAC;SAC/G,MAAM,CAAC,iBAAiB,EAAE,uDAAuD,EAAE,eAAe,CAAC;SACnG,MAAM,CAAC,mBAAmB,EAAE,6CAA6C,EAAE,eAAe,CAAC;SAC3F,MAAM,CACL,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE;QACvD,UAAU,CACR,IAAI,EACJ,MAAM,EACN,MAAM,MAAM,CAAC,aAAa,CAAC;YACzB,CAAC,EAAE,KA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AAC,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;QAC9C,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAuB,EAAE,CAAC,CAAC,CAAC;IACjG,CAAC,CAAC,CACH,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/portal.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AA4BxC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CA+C5E"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Commands about the portal itself rather than its datasets.
|
|
2
|
+
import { InvalidArgumentError } from "commander";
|
|
3
|
+
import { action, renderJson, toEngineOptions } from "../shared.js";
|
|
4
|
+
import { checkPortal, mapLimit, withCheck } from "../../client/portals.js";
|
|
5
|
+
import { PORTALS } from "../../client/portals-list.js";
|
|
6
|
+
/** How many portals `portals --check` checks at once. */
|
|
7
|
+
const CHECK_CONCURRENCY = 6;
|
|
8
|
+
/** commander accumulator for repeatable `key=value` pairs into a record. */
|
|
9
|
+
function collectKeyValue(value, previous = {}) {
|
|
10
|
+
const eq = value.indexOf("=");
|
|
11
|
+
// Throw commander's InvalidArgumentError (not a CkanError) so the failure is
|
|
12
|
+
// formatted as a usage error with `error:` prefix and help, consistent with
|
|
13
|
+
// other parse-time flag validation (e.g. `--rows abc`).
|
|
14
|
+
if (eq <= 0) {
|
|
15
|
+
throw new InvalidArgumentError(`Invalid --param "${value}". Expected key=value.`);
|
|
16
|
+
}
|
|
17
|
+
const key = value.slice(0, eq);
|
|
18
|
+
// Reject a duplicated key rather than silently overwriting the earlier value.
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(previous, key)) {
|
|
20
|
+
throw new InvalidArgumentError(`Duplicate --param key "${key}".`);
|
|
21
|
+
}
|
|
22
|
+
return { ...previous, [key]: value.slice(eq + 1) };
|
|
23
|
+
}
|
|
24
|
+
export function registerPortalCommands(program, deps) {
|
|
25
|
+
program
|
|
26
|
+
.command("status")
|
|
27
|
+
.description("Show the portal's site title, CKAN version and extensions")
|
|
28
|
+
.action(action(deps, async ({ client, global }) => {
|
|
29
|
+
renderJson(deps, global, await client.status());
|
|
30
|
+
}));
|
|
31
|
+
program
|
|
32
|
+
.command("licenses")
|
|
33
|
+
.description("List the licences the portal offers")
|
|
34
|
+
.action(action(deps, async ({ client, global }) => {
|
|
35
|
+
renderJson(deps, global, await client.licenseList());
|
|
36
|
+
}));
|
|
37
|
+
program
|
|
38
|
+
.command("action <name>")
|
|
39
|
+
.description("Call any CKAN action by name (generic escape hatch)")
|
|
40
|
+
.option("--param <key=value>", "query parameter (repeatable)", collectKeyValue)
|
|
41
|
+
.action(action(deps, async ({ client, global, opts }, [name]) => {
|
|
42
|
+
const params = opts["param"] ?? {};
|
|
43
|
+
renderJson(deps, global, await client.action(name, params));
|
|
44
|
+
}));
|
|
45
|
+
program
|
|
46
|
+
.command("portals")
|
|
47
|
+
.description("List the known CKAN portals in Germany (use one with --portal <id>)")
|
|
48
|
+
.option("--check", "check every portal live now and report the result")
|
|
49
|
+
.action(async (opts, command) => {
|
|
50
|
+
const global = command.optsWithGlobals();
|
|
51
|
+
if (!opts.check) {
|
|
52
|
+
renderJson(deps, global, PORTALS);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
56
|
+
const engine = toEngineOptions(global);
|
|
57
|
+
const checked = await mapLimit(PORTALS, CHECK_CONCURRENCY, async (portal) => withCheck(portal, await checkPortal(deps.createClient({ ...engine, baseUrl: portal.url })), today));
|
|
58
|
+
renderJson(deps, global, checked);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=portal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal.js","sourceRoot":"","sources":["../../../../src/cli/commands/portal.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAG7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAsB,MAAM,cAAc,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAEvD,yDAAyD;AACzD,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,4EAA4E;AAC5E,SAAS,eAAe,CACtB,KAAa,EACb,QAAQ,GAA2B,EAAE;IAErC,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC9B,6EAA6E;IAC7E,4EAA4E;IAC5E,wDAAwD;IACxD,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACZ,MAAM,IAAI,oBAAoB,CAAC,oBAAoB,KAAK,wBAAwB,CAAC,CAAC;IACpF,CAAC;IACD,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC/B,8EAA8E;IAC9E,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,oBAAoB,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,EAAE,GAAG,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;A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AM,CAAC,KAAK,EAAE,IAAyB,EAAE,OAAgB,EAAE,EAAE;QAC5D,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,EAAmB,CAAC;QAC1D,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YAClC,OAAO;QACT,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACpD,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAC1E,SAAS,CAAC,MAAM,EAAE,MAAM,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,CACnG,CAAC;QACF,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":";AACA,oFAAoF;AAEpF,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAClD,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CkanClient } from "../client/client.js";
|
|
2
|
+
import type { EngineOptions } from "../client/engine.js";
|
|
3
|
+
export interface CliIO {
|
|
4
|
+
out(text: string): void;
|
|
5
|
+
err(text: string): void;
|
|
6
|
+
}
|
|
7
|
+
export interface CliDeps {
|
|
8
|
+
io: CliIO;
|
|
9
|
+
/** Environment variables (injectable for tests). */
|
|
10
|
+
env: Record<string, string | undefined>;
|
|
11
|
+
/** Build a client from the resolved global options (injectable for tests). */
|
|
12
|
+
createClient(options: EngineOptions): CkanClient;
|
|
13
|
+
}
|
|
14
|
+
export declare const defaultIO: CliIO;
|
|
15
|
+
//# sourceMappingURL=io.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../../../src/cli/io.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,WAAW,KAAK;IACpB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,KAAK,CAAC;IACV,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACxC,8EAA8E;IAC9E,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,UAAU,CAAC;CAClD;AAED,eAAO,MAAM,SAAS,EAAE,KAGvB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// I/O seam for the CLI. Everything the CLI writes goes through a CliIO object so
|
|
2
|
+
// tests can capture output instead of hitting the real stdout/stderr, and the
|
|
3
|
+
// environment is injected so tests never depend on the real process.env.
|
|
4
|
+
export const defaultIO = {
|
|
5
|
+
out: (text) => process.stdout.write(text + "\n"),
|
|
6
|
+
err: (text) => process.stderr.write(text + "\n"),
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=io.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"io.js","sourceRoot":"","sources":["../../../src/cli/io.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,8EAA8E;AAC9E,yEAAyE;AAkBzE,MAAM,CAAC,MAAM,SAAS,GAAU;IAC9B,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;IAChD,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;CACjD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import type { CliDeps } from "./io.js";
|
|
3
|
+
export declare const VERSION: string;
|
|
4
|
+
/** Default dependencies: real client + real stdout/stderr + real environment. */
|
|
5
|
+
export declare const defaultDeps: CliDeps;
|
|
6
|
+
export declare function buildProgram(deps?: CliDeps): Command;
|
|
7
|
+
//# sourceMappingURL=program.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../../src/cli/program.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAgC,MAAM,WAAW,CAAC;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAyBvC,eAAO,MAAM,OAAO,QAAgB,CAAC;AAErC,iFAAiF;AACjF,eAAO,MAAM,WAAW,EAAE,OAIzB,CAAC;AAEF,wBAAgB,YAAY,CAAC,IAAI,GAAE,OAAqB,GAAG,OAAO,CAoDjE"}
|