@maschinenlesbar.org/ladesaeulenregister-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 +69 -0
- package/dist/src/cli/commands/stations.d.ts +4 -0
- package/dist/src/cli/commands/stations.d.ts.map +1 -0
- package/dist/src/cli/commands/stations.js +91 -0
- package/dist/src/cli/commands/stations.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 +53 -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 +85 -0
- package/dist/src/cli/run.js.map +1 -0
- package/dist/src/cli/shared.d.ts +56 -0
- package/dist/src/cli/shared.d.ts.map +1 -0
- package/dist/src/cli/shared.js +112 -0
- package/dist/src/cli/shared.js.map +1 -0
- package/dist/src/client/client.d.ts +32 -0
- package/dist/src/client/client.d.ts.map +1 -0
- package/dist/src/client/client.js +128 -0
- package/dist/src/client/client.js.map +1 -0
- package/dist/src/client/engine.d.ts +55 -0
- package/dist/src/client/engine.d.ts.map +1 -0
- package/dist/src/client/engine.js +111 -0
- package/dist/src/client/engine.js.map +1 -0
- package/dist/src/client/errors.d.ts +45 -0
- package/dist/src/client/errors.d.ts.map +1 -0
- package/dist/src/client/errors.js +57 -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 +11 -0
- package/dist/src/client/index.d.ts.map +1 -0
- package/dist/src/client/index.js +8 -0
- package/dist/src/client/index.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 +108 -0
- package/dist/src/client/types.d.ts.map +1 -0
- package/dist/src/client/types.js +4 -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 +69 -0
|
@@ -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,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A charging-station record (the `attributes` of a feature). The layer has ~60
|
|
3
|
+
* columns; only the broadly-useful ones are typed, and the index signature carries
|
|
4
|
+
* the rest (per-charge-point connector columns `Steckersystem_Ladepunkt1..10`, the
|
|
5
|
+
* raw `F_response_body` JSON blob, opening-hours columns, ...). German field names
|
|
6
|
+
* with umlauts are quoted.
|
|
7
|
+
*/
|
|
8
|
+
export interface ChargingStation {
|
|
9
|
+
ID?: string;
|
|
10
|
+
OBJECTID?: number;
|
|
11
|
+
/** Operator display name. */
|
|
12
|
+
Betreiber?: string;
|
|
13
|
+
/** Operator full company name. */
|
|
14
|
+
operator_companyName?: string;
|
|
15
|
+
"Straße"?: string;
|
|
16
|
+
Hausnummer?: string;
|
|
17
|
+
Postleitzahl?: string;
|
|
18
|
+
Ort?: string;
|
|
19
|
+
address_addition?: string | null;
|
|
20
|
+
/** Kreis / kreisfreie Stadt. */
|
|
21
|
+
district_independent_city?: string;
|
|
22
|
+
/** Bundesland. */
|
|
23
|
+
state?: string;
|
|
24
|
+
/** "Normalladeeinrichtung" or "Schnellladeeinrichtung". */
|
|
25
|
+
Typ?: string;
|
|
26
|
+
/** Operating status, e.g. "In Betrieb". */
|
|
27
|
+
Status?: string;
|
|
28
|
+
coordinates_latitude?: number;
|
|
29
|
+
coordinates_longitude?: number;
|
|
30
|
+
/** Max electric power of the station, in kW. */
|
|
31
|
+
max_electric_power_station?: number;
|
|
32
|
+
/** Number of charge points. */
|
|
33
|
+
Anzahl_Ladepunkte?: number;
|
|
34
|
+
go_live_date?: string;
|
|
35
|
+
Bezahlsystem?: string;
|
|
36
|
+
/** Any other column the layer carries. */
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
}
|
|
39
|
+
/** An ArcGIS geometry (point) — present when geometry is returned. */
|
|
40
|
+
export interface ArcGisPoint {
|
|
41
|
+
x?: number;
|
|
42
|
+
y?: number;
|
|
43
|
+
}
|
|
44
|
+
/** An ArcGIS feature: attributes plus optional geometry. */
|
|
45
|
+
export interface Feature<T = ChargingStation> {
|
|
46
|
+
attributes: T;
|
|
47
|
+
geometry?: ArcGisPoint;
|
|
48
|
+
}
|
|
49
|
+
/** ArcGIS field metadata (from the layer / a query response). */
|
|
50
|
+
export interface FieldInfo {
|
|
51
|
+
name: string;
|
|
52
|
+
type?: string;
|
|
53
|
+
alias?: string;
|
|
54
|
+
length?: number;
|
|
55
|
+
[key: string]: unknown;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The raw ArcGIS `/query` response envelope. On a logical failure the server still
|
|
59
|
+
* answers HTTP 200 but sets `error` (checked by the client). `count` is present for
|
|
60
|
+
* a `returnCountOnly` query.
|
|
61
|
+
*/
|
|
62
|
+
export interface ArcGisQueryResponse {
|
|
63
|
+
features?: Feature[];
|
|
64
|
+
fields?: FieldInfo[];
|
|
65
|
+
exceededTransferLimit?: boolean;
|
|
66
|
+
count?: number;
|
|
67
|
+
objectIdFieldName?: string;
|
|
68
|
+
geometryType?: string;
|
|
69
|
+
error?: {
|
|
70
|
+
code?: number;
|
|
71
|
+
message?: string;
|
|
72
|
+
details?: string[];
|
|
73
|
+
};
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
}
|
|
76
|
+
/** A page of stations — what the client returns from a feature query. */
|
|
77
|
+
export interface StationPage {
|
|
78
|
+
features: Feature[];
|
|
79
|
+
/** True when more features match than were returned (raise `--limit` or page). */
|
|
80
|
+
exceededTransferLimit: boolean;
|
|
81
|
+
}
|
|
82
|
+
/** One grouped-count row from `countBy` (outStatistics group-by). */
|
|
83
|
+
export interface CountByRow {
|
|
84
|
+
/** The group value (e.g. a Bundesland name). */
|
|
85
|
+
value: string | number | null;
|
|
86
|
+
/** Number of stations in the group. */
|
|
87
|
+
count: number;
|
|
88
|
+
}
|
|
89
|
+
/** Query options for a station search. */
|
|
90
|
+
export interface StationQuery {
|
|
91
|
+
/** SQL `where` filter (default `1=1`). */
|
|
92
|
+
where?: string;
|
|
93
|
+
/** Comma-separated field list, or `*`. Defaults to a curated set. */
|
|
94
|
+
outFields?: string;
|
|
95
|
+
/** Max rows to return (ArcGIS `resultRecordCount`). */
|
|
96
|
+
limit?: number;
|
|
97
|
+
/** Rows to skip (ArcGIS `resultOffset`). */
|
|
98
|
+
offset?: number;
|
|
99
|
+
/** Sort spec, e.g. `"Ort ASC"` (ArcGIS `orderByFields`). */
|
|
100
|
+
orderBy?: string;
|
|
101
|
+
/** Spatial filter: only stations within `radiusKm` of this point. */
|
|
102
|
+
near?: {
|
|
103
|
+
lat: number;
|
|
104
|
+
lon: number;
|
|
105
|
+
radiusKm: number;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,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AAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CACvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,iCAAiC"}
|
|
@@ -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,qFAAqF;AACrF,cAAc,mBAAmB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maschinenlesbar.org/ladesaeulenregister-cli",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "TypeScript API client and CLI for the Ladesäulenregister — the Bundesnetzagentur's register of public EV charging stations in Germany",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"ladesaeulen": "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
|
+
"ladesaeulenregister",
|
|
37
|
+
"ladesaeule",
|
|
38
|
+
"ladestationen",
|
|
39
|
+
"e-mobilitaet",
|
|
40
|
+
"ev-charging",
|
|
41
|
+
"charging-stations",
|
|
42
|
+
"bundesnetzagentur",
|
|
43
|
+
"arcgis",
|
|
44
|
+
"germany",
|
|
45
|
+
"cli",
|
|
46
|
+
"api-client"
|
|
47
|
+
],
|
|
48
|
+
"author": "Sebastian Schürmann <sebs@2xs.org>",
|
|
49
|
+
"license": "AGPL-3.0-or-later",
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/maschinenlesbar-org/ladesaeulenregister-cli.git"
|
|
53
|
+
},
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/maschinenlesbar-org/ladesaeulenregister-cli/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/maschinenlesbar-org/ladesaeulenregister-cli#readme",
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"commander": "15.0.0"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@types/node": "^22.19.19",
|
|
66
|
+
"typedoc": "0.28.19",
|
|
67
|
+
"typescript": "6.0.3"
|
|
68
|
+
}
|
|
69
|
+
}
|