@maschinenlesbar.org/mudab-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 +78 -0
- package/dist/src/cli/commands/list.d.ts +4 -0
- package/dist/src/cli/commands/list.d.ts.map +1 -0
- package/dist/src/cli/commands/list.js +70 -0
- package/dist/src/cli/commands/list.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 +11 -0
- package/dist/src/cli/index.js.map +1 -0
- package/dist/src/cli/io.d.ts +12 -0
- package/dist/src/cli/io.d.ts.map +1 -0
- package/dist/src/cli/io.js +7 -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 +54 -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 +87 -0
- package/dist/src/cli/run.js.map +1 -0
- package/dist/src/cli/shared.d.ts +79 -0
- package/dist/src/cli/shared.d.ts.map +1 -0
- package/dist/src/cli/shared.js +121 -0
- package/dist/src/cli/shared.js.map +1 -0
- package/dist/src/client/client.d.ts +37 -0
- package/dist/src/client/client.d.ts.map +1 -0
- package/dist/src/client/client.js +78 -0
- package/dist/src/client/client.js.map +1 -0
- package/dist/src/client/engine.d.ts +59 -0
- package/dist/src/client/engine.d.ts.map +1 -0
- package/dist/src/client/engine.js +125 -0
- package/dist/src/client/engine.js.map +1 -0
- package/dist/src/client/errors.d.ts +36 -0
- package/dist/src/client/errors.d.ts.map +1 -0
- package/dist/src/client/errors.js +43 -0
- package/dist/src/client/errors.js.map +1 -0
- package/dist/src/client/http.d.ts +26 -0
- package/dist/src/client/http.d.ts.map +1 -0
- package/dist/src/client/http.js +80 -0
- package/dist/src/client/http.js.map +1 -0
- package/dist/src/client/index.d.ts +9 -0
- package/dist/src/client/index.d.ts.map +1 -0
- package/dist/src/client/index.js +7 -0
- package/dist/src/client/index.js.map +1 -0
- package/dist/src/client/types.d.ts +173 -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 +70 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// HTTP transport built on Node's built-in `http`/`https` modules — no axios,
|
|
2
|
+
// no fetch polyfill, no third-party HTTP client.
|
|
3
|
+
//
|
|
4
|
+
// The transport is a plain function so it can be trivially swapped out in tests
|
|
5
|
+
// (inject a `mock.fn()` returning a canned HttpResponse) without touching the
|
|
6
|
+
// network. The default implementation below is exercised against a real local
|
|
7
|
+
// `http.createServer` in the test-suite.
|
|
8
|
+
import http from "node:http";
|
|
9
|
+
import https from "node:https";
|
|
10
|
+
import { MudabNetworkError } from "./errors.js";
|
|
11
|
+
/**
|
|
12
|
+
* Default transport. Resolves with the raw response (including non-2xx) — status
|
|
13
|
+
* interpretation is the client's job. Rejects only on transport-level failures
|
|
14
|
+
* (connection errors, timeouts, malformed URLs).
|
|
15
|
+
*/
|
|
16
|
+
export const nodeHttpTransport = (request) => new Promise((resolve, reject) => {
|
|
17
|
+
let url;
|
|
18
|
+
try {
|
|
19
|
+
url = new URL(request.url);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
reject(new MudabNetworkError(`Invalid URL: ${request.url}`));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// Only http/https are supported. Reject anything else up front with a clear,
|
|
26
|
+
// typed error instead of letting Node throw an opaque ERR_INVALID_PROTOCOL.
|
|
27
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
28
|
+
reject(new MudabNetworkError(`Unsupported protocol "${url.protocol}" in URL: ${request.url}`));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const isHttps = url.protocol === "https:";
|
|
32
|
+
const driver = isHttps ? https : http;
|
|
33
|
+
const maxBytes = request.maxResponseBytes;
|
|
34
|
+
const req = driver.request(url, {
|
|
35
|
+
method: request.method,
|
|
36
|
+
headers: request.headers,
|
|
37
|
+
}, (res) => {
|
|
38
|
+
const chunks = [];
|
|
39
|
+
let received = 0;
|
|
40
|
+
let aborted = false;
|
|
41
|
+
res.on("data", (chunk) => {
|
|
42
|
+
if (aborted)
|
|
43
|
+
return;
|
|
44
|
+
received += chunk.length;
|
|
45
|
+
if (maxBytes !== undefined && received > maxBytes) {
|
|
46
|
+
aborted = true;
|
|
47
|
+
res.destroy();
|
|
48
|
+
reject(new MudabNetworkError(`Response exceeded maxResponseBytes (${maxBytes})`));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
chunks.push(chunk);
|
|
52
|
+
});
|
|
53
|
+
res.on("end", () => {
|
|
54
|
+
if (aborted)
|
|
55
|
+
return;
|
|
56
|
+
resolve({
|
|
57
|
+
status: res.statusCode ?? 0,
|
|
58
|
+
headers: res.headers,
|
|
59
|
+
body: Buffer.concat(chunks),
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
res.on("error", (err) => {
|
|
63
|
+
if (aborted)
|
|
64
|
+
return; // we already rejected with the size-cap error
|
|
65
|
+
reject(new MudabNetworkError(`Response stream error: ${err.message}`, { cause: err }));
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
if (request.timeoutMs && request.timeoutMs > 0) {
|
|
69
|
+
req.setTimeout(request.timeoutMs, () => {
|
|
70
|
+
req.destroy(new MudabNetworkError(`Request timed out after ${request.timeoutMs}ms`));
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
req.on("error", (err) => {
|
|
74
|
+
reject(err instanceof MudabNetworkError ? err : new MudabNetworkError(err.message, { cause: err }));
|
|
75
|
+
});
|
|
76
|
+
if (request.body !== undefined)
|
|
77
|
+
req.write(request.body);
|
|
78
|
+
req.end();
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/client/http.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,iDAAiD;AACjD,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,8EAA8E;AAC9E,yCAAyC;AAEzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAuBhD;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAc,CAAC,OAAO,EAAE,EAAE,CACtD,IAAI,OAAO,CAAe,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC5C,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,CAAC,IAAI,iBAAiB,CAAC,gBAAgB,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC7D,OAAO;IACT,CAAC;IAED,6EAA6E;IAC7E,4EAA4E;IAC5E,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1D,MAAM,CAAC,IAAI,iBAAiB,CAAC,yBAAyB,GAAG,CAAC,QAAQ,aAAa,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC/F,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC;IAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC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,CAAC,IAAI,iBAAiB,CAAC,0BAA0B,GAAG,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QACzF,CAAC,CAAC,CAAC;IACL,CAAC,CACF,CAAC;IAEF,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,GAAG,CAAC,EAAE,CAAC;QAC/C,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE;YACrC,GAAG,CAAC,OAAO,CAAC,IAAI,iBAAiB,CAAC,2BAA2B,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC;QACvF,CAAC,CAAC,CAAC;IACL,CAAC;IAED,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACtB,MAAM,CACJ,GAAG,YAAY,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,iBAAiB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAC5F,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,GAAG,CAAC,GAAG,EAAE,CAAC;AACZ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { MudabClient, extractRows } from "./client.js";
|
|
2
|
+
export type { MudabClientOptions, ParameterCompartment } from "./client.js";
|
|
3
|
+
export { RequestEngine, DEFAULT_BASE_URL } from "./engine.js";
|
|
4
|
+
export type { EngineOptions, RawResponse } from "./engine.js";
|
|
5
|
+
export { nodeHttpTransport } from "./http.js";
|
|
6
|
+
export type { Transport, HttpRequest, HttpResponse } from "./http.js";
|
|
7
|
+
export { MudabError, MudabApiError, MudabNetworkError, MudabValidationError, MudabParseError, } from "./errors.js";
|
|
8
|
+
export * from "./types.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvD,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EACL,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Public entry point for the API client library.
|
|
2
|
+
export { MudabClient, extractRows } from "./client.js";
|
|
3
|
+
export { RequestEngine, DEFAULT_BASE_URL } from "./engine.js";
|
|
4
|
+
export { nodeHttpTransport } from "./http.js";
|
|
5
|
+
export { MudabError, MudabApiError, MudabNetworkError, MudabValidationError, MudabParseError, } from "./errors.js";
|
|
6
|
+
export * from "./types.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,iDAAiD;AAEjD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EACL,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compartment ("Kompartiment") code, from the `COMPT_DS` field. Common values,
|
|
3
|
+
* verified live: `CW` = Wasser (water), `CS` = Sediment, `CF` = Biota,
|
|
4
|
+
* `BL` = Biologie. Typed as an open string on purpose — the spec's enum is NOT
|
|
5
|
+
* exhaustive (e.g. `MM` also occurs), so a fixed union would reject real data.
|
|
6
|
+
*/
|
|
7
|
+
export type Compartment = string;
|
|
8
|
+
/** `PROJECTSTATION_SMALL` item — a project station. */
|
|
9
|
+
export interface ProjectStation {
|
|
10
|
+
metadataid?: number;
|
|
11
|
+
/** Ascending project-station id. */
|
|
12
|
+
PROJECTSTATIONID?: number;
|
|
13
|
+
/** Project-station name. */
|
|
14
|
+
NAME_PS?: string;
|
|
15
|
+
/** Region (e.g. "Nordsee", "Ostsee"). */
|
|
16
|
+
REGION?: string;
|
|
17
|
+
/** Institute the project station belongs to. */
|
|
18
|
+
INSTITUT?: string;
|
|
19
|
+
}
|
|
20
|
+
/** `STATION_SMALL` item — a measurement station. */
|
|
21
|
+
export interface Messstation {
|
|
22
|
+
metadataid?: number;
|
|
23
|
+
/** Measurement-station name. */
|
|
24
|
+
STATNAME_ST?: string;
|
|
25
|
+
/** Name of the project station this station belongs to. */
|
|
26
|
+
NAME_PS?: string;
|
|
27
|
+
/** Station type. */
|
|
28
|
+
STATIONTYPE_ST?: string;
|
|
29
|
+
/** Compartment code (see {@link Compartment}). */
|
|
30
|
+
COMPT_DS?: Compartment;
|
|
31
|
+
}
|
|
32
|
+
/** `MV_PARAMETER` (and the compartment-specific variants) item — a measured parameter. */
|
|
33
|
+
export interface Parameter {
|
|
34
|
+
metadataid?: number;
|
|
35
|
+
COMPT_DS?: Compartment;
|
|
36
|
+
/** Parameter abbreviation (e.g. "24DP"). */
|
|
37
|
+
PARAMETER?: string;
|
|
38
|
+
/** Parameter group code. */
|
|
39
|
+
PARAMETERGRUPPE?: string;
|
|
40
|
+
/** Parameter name (e.g. "Dichloroprop"). */
|
|
41
|
+
PARAM_NAME?: string;
|
|
42
|
+
/** Parameter group code (duplicate of PARAMETERGRUPPE in practice). */
|
|
43
|
+
PARGROUP?: string;
|
|
44
|
+
/** Parameter-group name (e.g. "Pesticides (general)"). */
|
|
45
|
+
PARAMGROUP_NAME?: string;
|
|
46
|
+
}
|
|
47
|
+
/** `MV_STATION_MSMNT` item — a single measured value at a station. */
|
|
48
|
+
export interface ParameterValue {
|
|
49
|
+
metadataid?: number;
|
|
50
|
+
/** Measurement-station name. */
|
|
51
|
+
STATNAME_ST?: string;
|
|
52
|
+
/** Composite "<station> <date> <time>". */
|
|
53
|
+
STATNAME_DATE_TIME?: string;
|
|
54
|
+
PARAMETERID_PM?: string;
|
|
55
|
+
/** Parameter code / name. */
|
|
56
|
+
PARAMCODE_PM?: string;
|
|
57
|
+
/** Measurement date, YYYYMMDD. */
|
|
58
|
+
DATE_STM?: string;
|
|
59
|
+
/** Measurement time, HHMM. */
|
|
60
|
+
TIME_STM?: string;
|
|
61
|
+
/** The measured value (a string in the source data). */
|
|
62
|
+
VALUE_MS?: string;
|
|
63
|
+
}
|
|
64
|
+
/** `V_PLC_STATION` item — a HELCOM PLC (Pollution Load Compilation) station. */
|
|
65
|
+
export interface HelcomPLCStation {
|
|
66
|
+
metadataid?: number;
|
|
67
|
+
/** Station name. */
|
|
68
|
+
STATION_NAME?: string;
|
|
69
|
+
/** Station code. */
|
|
70
|
+
STATION_CODE?: string;
|
|
71
|
+
/** Bundesland (federal state) code of the station. */
|
|
72
|
+
LAND_CD?: string;
|
|
73
|
+
/** Latitude. */
|
|
74
|
+
ST_LAT?: number;
|
|
75
|
+
/** Longitude. */
|
|
76
|
+
ST_LON?: number;
|
|
77
|
+
SUBCM_CODE?: string;
|
|
78
|
+
SUBCM_NAME?: string;
|
|
79
|
+
MON_TYPE?: string;
|
|
80
|
+
}
|
|
81
|
+
/** `V_GEMESSENE_PARA_PLC` item — a parameter measured at a PLC station. */
|
|
82
|
+
export interface ParameterPLC {
|
|
83
|
+
metadataid?: number;
|
|
84
|
+
/** Parameter abbreviation. */
|
|
85
|
+
PARAMETER?: string;
|
|
86
|
+
/** Parameter group. */
|
|
87
|
+
PARAMETERGRUPPE?: string;
|
|
88
|
+
/** Station code. */
|
|
89
|
+
STATION_CODE?: string;
|
|
90
|
+
/** Year of the last measurement. */
|
|
91
|
+
LETZTE_MESSUNG?: string;
|
|
92
|
+
/** Unique id of the measurement, STATION_CODE + PARAMETER. */
|
|
93
|
+
PRKEY?: string;
|
|
94
|
+
STATION_NAME?: string;
|
|
95
|
+
/** Number of measured values. */
|
|
96
|
+
ANZ_MESSWERTE?: number;
|
|
97
|
+
SUBCM_CODE?: string;
|
|
98
|
+
SUBCM_NAME?: string;
|
|
99
|
+
}
|
|
100
|
+
/** `V_MESSWERTE_PLC` item — a measured value at a PLC station. */
|
|
101
|
+
export interface MesswertPLC {
|
|
102
|
+
metadataid?: number;
|
|
103
|
+
/** Running number of the datum. */
|
|
104
|
+
NUMMER?: number;
|
|
105
|
+
/** Measured-value label. */
|
|
106
|
+
NAME?: number | string;
|
|
107
|
+
STATION_CODE?: string;
|
|
108
|
+
STATION_NAME?: string;
|
|
109
|
+
/** The value. */
|
|
110
|
+
VALUE?: number;
|
|
111
|
+
/** Aggregation type, "TOT" or "AVE". */
|
|
112
|
+
PARAM_TYPE?: string;
|
|
113
|
+
/** Numeric code for NAME. */
|
|
114
|
+
PARAM_ID?: string;
|
|
115
|
+
/** Year of measurement (for PERIOD_TYPE "A"). */
|
|
116
|
+
PERIOD_NAME?: string;
|
|
117
|
+
/** Aggregation duration, "A". */
|
|
118
|
+
PERIOD_TYPE?: string;
|
|
119
|
+
/** Bundesland (federal state) code. */
|
|
120
|
+
LAND_CD?: string;
|
|
121
|
+
ST_LAT?: number;
|
|
122
|
+
ST_LON?: number;
|
|
123
|
+
SUBCM_CODE?: string;
|
|
124
|
+
SUBCM_NAME?: string;
|
|
125
|
+
MON_TYPE?: string;
|
|
126
|
+
/** Unit of the value. */
|
|
127
|
+
VAL_UNIT?: string;
|
|
128
|
+
AREA?: number;
|
|
129
|
+
}
|
|
130
|
+
/** One filter condition: a column, an SQL-ish operator, and a value. */
|
|
131
|
+
export interface FilterCondition {
|
|
132
|
+
/** Column name (a field of the endpoint's row schema, e.g. "COMPT_DS"). */
|
|
133
|
+
col: string;
|
|
134
|
+
/** SQL-ish comparison operator (e.g. "=", "like", ">", "<"). */
|
|
135
|
+
op: string;
|
|
136
|
+
/** Comparison value. */
|
|
137
|
+
value: string;
|
|
138
|
+
}
|
|
139
|
+
/** A filter: a single condition, applied as `and` or `or`. */
|
|
140
|
+
export interface Filter {
|
|
141
|
+
and?: FilterCondition;
|
|
142
|
+
or?: FilterCondition;
|
|
143
|
+
}
|
|
144
|
+
/** Result window: skip `from`, return up to `count` rows. */
|
|
145
|
+
export interface Range {
|
|
146
|
+
from?: number;
|
|
147
|
+
count?: number;
|
|
148
|
+
}
|
|
149
|
+
/** Sort order. */
|
|
150
|
+
export interface OrderBy {
|
|
151
|
+
/** Column to sort by. */
|
|
152
|
+
col: string;
|
|
153
|
+
/** Direction (ascending or descending). */
|
|
154
|
+
dir?: "asc" | "desc";
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The request body shared by every MUDAB endpoint. All fields are optional; an
|
|
158
|
+
* empty body returns the whole table (which for measurements is enormous — always
|
|
159
|
+
* send a `range`).
|
|
160
|
+
*
|
|
161
|
+
* IMPORTANT — verified against the live API: only `range` is honoured. Despite the
|
|
162
|
+
* OpenAPI spec advertising every endpoint as a "filterbare Liste", the live server
|
|
163
|
+
* **ignores `filter` and `orderby`** (a filter that should match nothing still
|
|
164
|
+
* returns the full page). They are kept here to mirror the documented schema, but
|
|
165
|
+
* do not rely on them — filter and sort client-side. NB: a `range` MUST include
|
|
166
|
+
* `from` (a count-only range is answered with an HTTP 500).
|
|
167
|
+
*/
|
|
168
|
+
export interface FilterRequest {
|
|
169
|
+
filter?: Filter;
|
|
170
|
+
range?: Range;
|
|
171
|
+
orderby?: OrderBy;
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AAEjC,uDAAuD;AACvD,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,oDAAoD;AACpD,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,WAAW,CAAC;CACxB;AAED,0FAA0F;AAC1F,MAAM,WAAW,SAAS;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,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X,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,8DAA8D;AAC9D,MAAM,WAAW,MAAM;IACrB,GAAG,CAAC,EAAE,eAAe,CAAC;IACtB,EAAE,CAAC,EAAE,eAAe,CAAC;CACtB;AAED,6DAA6D;AAC7D,MAAM,WAAW,KAAK;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,kBAAkB;AAClB,MAAM,WAAW,OAAO;IACtB,yBAAyB;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,2CAA2C;IAC3C,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Response and request types for the MUDAB (Meeresumweltdatenbank) REST API.
|
|
2
|
+
//
|
|
3
|
+
// The API is a set of "FilterElements" POST endpoints. Each takes a FilterRequest
|
|
4
|
+
// body and returns a single-key object wrapping a homogeneous row array. The row
|
|
5
|
+
// item shapes below come from the OpenAPI spec, corrected against the live API
|
|
6
|
+
// (the spec's response wrapper keys and its Compartment enum are both incomplete).
|
|
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,6EAA6E;AAC7E,EAAE;AACF,kFAAkF;AAClF,iFAAiF;AACjF,+EAA+E;AAC/E,mFAAmF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,cAAc,mBAAmB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maschinenlesbar.org/mudab-cli",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "TypeScript API client and CLI for the MUDAB (Meeresumweltdatenbank) API — German marine-monitoring data (stations, parameters, measurements)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"mudab": "dist/src/cli/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "dist/src/index.js",
|
|
10
|
+
"types": "dist/src/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/src/index.d.ts",
|
|
14
|
+
"import": "./dist/src/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist/src",
|
|
19
|
+
"LICENSING.md",
|
|
20
|
+
"CONTRIBUTING.md"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=20"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
27
|
+
"build": "tsc -p tsconfig.json",
|
|
28
|
+
"prepack": "npm run build",
|
|
29
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
30
|
+
"pretest": "npm run build",
|
|
31
|
+
"test": "node --test dist/test/*.test.js",
|
|
32
|
+
"docs": "typedoc src/index.ts --out out",
|
|
33
|
+
"start": "node dist/src/cli/index.js"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"mudab",
|
|
37
|
+
"meeresumweltdatenbank",
|
|
38
|
+
"marine",
|
|
39
|
+
"monitoring",
|
|
40
|
+
"umweltbundesamt",
|
|
41
|
+
"bafg",
|
|
42
|
+
"ozean",
|
|
43
|
+
"nordsee",
|
|
44
|
+
"ostsee",
|
|
45
|
+
"germany",
|
|
46
|
+
"cli",
|
|
47
|
+
"api-client"
|
|
48
|
+
],
|
|
49
|
+
"author": "Sebastian Schürmann <sebs@2xs.org>",
|
|
50
|
+
"license": "AGPL-3.0-or-later",
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "git+https://github.com/maschinenlesbar-org/mudab-cli.git"
|
|
54
|
+
},
|
|
55
|
+
"bugs": {
|
|
56
|
+
"url": "https://github.com/maschinenlesbar-org/mudab-cli/issues"
|
|
57
|
+
},
|
|
58
|
+
"homepage": "https://github.com/maschinenlesbar-org/mudab-cli#readme",
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public"
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"commander": "15.0.0"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@types/node": "^22.19.19",
|
|
67
|
+
"typedoc": "0.28.19",
|
|
68
|
+
"typescript": "6.0.3"
|
|
69
|
+
}
|
|
70
|
+
}
|