@mailwoman/un-locode-lookup 9.4.0 → 10.1.0
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/{lib/cli.ts → cli/main.ts} +1 -1
- package/lib/build.ts +5 -8
- package/lib/index.ts +22 -27
- package/lib/schema.ts +4 -4
- package/out/build.d.ts +2 -2
- package/out/build.d.ts.map +1 -1
- package/out/build.js +5 -8
- package/out/build.js.map +1 -1
- package/out/{cli.d.ts → cli/main.d.ts} +2 -2
- package/out/cli/main.d.ts.map +1 -0
- package/out/{cli.js → cli/main.js} +2 -2
- package/out/cli/main.js.map +1 -0
- package/out/index.d.ts +17 -16
- package/out/index.d.ts.map +1 -1
- package/out/index.js +15 -25
- package/out/index.js.map +1 -1
- package/out/schema.d.ts +4 -4
- package/out/schema.js +1 -1
- package/package.json +36 -30
- package/out/cli.d.ts.map +0 -1
- package/out/cli.js.map +0 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @license AGPL-3.0
|
|
5
5
|
* @author Teffen Ellis, et al.
|
|
6
6
|
*
|
|
7
|
-
* `mailwoman-un-locode` — build the lookup DB, or look up a UN/
|
|
7
|
+
* `mailwoman-un-locode` — build the lookup DB, or look up a UN/locode by name or coordinate.
|
|
8
8
|
*
|
|
9
9
|
* ```sh
|
|
10
10
|
* mailwoman-un-locode build --csv code-list.csv --out un-locode.db
|
package/lib/build.ts
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Build the UN/
|
|
6
|
+
* Build the UN/locode lookup DB from the unece code list CSV (datasets/un-locode `code-list.csv`:
|
|
7
7
|
* columns Change, Country, Location, Name, NameWoDiacritics, Subdivision, Status, Function, Date,
|
|
8
|
-
*
|
|
8
|
+
* iata, Coordinates, Remarks). One row per assigned location. coordinates parsed where present.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { DatabaseClient } from "@mailwoman/sqlite/client"
|
|
@@ -26,13 +26,10 @@ interface CSVRow {
|
|
|
26
26
|
* Read the code-list CSV at `csvPath` and write the lookup DB to `dbPath`.
|
|
27
27
|
*/
|
|
28
28
|
export async function buildUNLocodeDB(csvPath: string, dbPath: string): Promise<{ rows: number; withCoords: number }> {
|
|
29
|
-
// `normalizeKeys: false` keeps the
|
|
30
|
-
// (`NameWoDiacritics`, not `name_wo_diacritics`).
|
|
31
|
-
// is on — it is off by default.
|
|
29
|
+
// `normalizeKeys: false` keeps the unece header casing the row shape above is
|
|
30
|
+
// written against (`NameWoDiacritics`, not `name_wo_diacritics`).
|
|
32
31
|
const records = CSVSpliterator.fromAsync<CSVRow>(csvPath, {
|
|
33
|
-
mode: "object",
|
|
34
32
|
normalizeKeys: false,
|
|
35
|
-
enableQuoteHandling: true,
|
|
36
33
|
})
|
|
37
34
|
|
|
38
35
|
using db = new DatabaseClient<UNLocodeDatabase>(dbPath)
|
|
@@ -51,7 +48,7 @@ export async function buildUNLocodeDB(csvPath: string, dbPath: string): Promise<
|
|
|
51
48
|
for await (const r of records) {
|
|
52
49
|
rows++
|
|
53
50
|
|
|
54
|
-
if (!r.Country || !r.Location) continue // header/country rows
|
|
51
|
+
if (!r.Country || !r.Location) continue // header/country rows have no Location
|
|
55
52
|
const coords = r.Coordinates ? parseUNLocodeCoords(r.Coordinates) : null
|
|
56
53
|
|
|
57
54
|
if (coords) {
|
package/lib/index.ts
CHANGED
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* `@mailwoman/un-locode-lookup` — place → UN/
|
|
6
|
+
* `@mailwoman/un-locode-lookup` — place → UN/locode (unece Code for Trade and Transport Locations).
|
|
7
7
|
* Two ways in: by country + place name (exact, diacritic-folded), or by nearest coordinate (for
|
|
8
|
-
* the ~⅓ of entries that
|
|
8
|
+
* the ~⅓ of entries that have one). Backed by a `node:sqlite` table built from the unece code
|
|
9
9
|
* list. An `@mailwoman/annotations` `Annotator`.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import type { AnnotationSet, Annotator } from "@mailwoman/annotations"
|
|
13
13
|
import { haversineKm } from "@mailwoman/spatial"
|
|
14
|
-
import { DatabaseClient } from "@mailwoman/sqlite/client"
|
|
14
|
+
import type { DatabaseClient } from "@mailwoman/sqlite/client"
|
|
15
|
+
import { SQLiteLookup, type SQLiteLookupOptions } from "@mailwoman/sqlite/lookup"
|
|
15
16
|
|
|
16
17
|
import type { UNLocodeDatabase } from "#schema"
|
|
17
18
|
|
|
@@ -28,7 +29,7 @@ export function foldName(name: string): string {
|
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
|
-
* Parse a UN/
|
|
32
|
+
* Parse a UN/locode coordinate (`"4923N 01522E"`) to decimal degrees, or null if absent/malformed.
|
|
32
33
|
*/
|
|
33
34
|
export function parseUNLocodeCoords(raw: string): { lat: number; lon: number } | null {
|
|
34
35
|
const m = raw.trim().match(/^(\d{2})(\d{2})([NS])\s+(\d{3})(\d{2})([EW])$/)
|
|
@@ -41,35 +42,31 @@ export function parseUNLocodeCoords(raw: string): { lat: number; lon: number } |
|
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
+
* Where a {@link UNLocodeLookup} reads from.
|
|
45
46
|
*/
|
|
46
|
-
export
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
readonly #resources = new DisposableStack()
|
|
47
|
+
export type UNLocodeLookupOptions = SQLiteLookupOptions<UNLocodeDatabase>
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A UN/locode lookup over a built `node:sqlite` table.
|
|
51
|
+
*/
|
|
52
|
+
export class UNLocodeLookup extends SQLiteLookup<UNLocodeDatabase> {
|
|
53
53
|
#byName: ReturnType<DatabaseClient["prepare"]>
|
|
54
54
|
#byBox: ReturnType<DatabaseClient["prepare"]>
|
|
55
55
|
|
|
56
|
-
constructor(opts:
|
|
57
|
-
|
|
58
|
-
"db" in opts
|
|
59
|
-
? opts.db
|
|
60
|
-
: this.#resources.use(new DatabaseClient<UNLocodeDatabase>(opts.databasePath, { readOnly: true }))
|
|
56
|
+
constructor(opts: UNLocodeLookupOptions) {
|
|
57
|
+
super(opts)
|
|
61
58
|
|
|
62
|
-
this.#byName = this
|
|
59
|
+
this.#byName = this.database.prepare(
|
|
63
60
|
"SELECT country, location FROM un_locode WHERE country = ? AND nameNorm = ? LIMIT 1"
|
|
64
61
|
)
|
|
65
62
|
|
|
66
|
-
this.#byBox = this
|
|
63
|
+
this.#byBox = this.database.prepare(
|
|
67
64
|
"SELECT location, country, lat, lon FROM un_locode WHERE lat BETWEEN ? AND ? AND lon BETWEEN ? AND ?"
|
|
68
65
|
)
|
|
69
66
|
}
|
|
70
67
|
|
|
71
68
|
/**
|
|
72
|
-
* The UN/
|
|
69
|
+
* The UN/locode (`"US NYC"`) for a country + place name, or null.
|
|
73
70
|
*/
|
|
74
71
|
byName(country: string, name: string): string | null {
|
|
75
72
|
const row = this.#byName.get(country.toUpperCase(), foldName(name)) as
|
|
@@ -80,7 +77,7 @@ export class UNLocodeLookup implements Disposable {
|
|
|
80
77
|
}
|
|
81
78
|
|
|
82
79
|
/**
|
|
83
|
-
* The nearest coordinate-
|
|
80
|
+
* The nearest coordinate-containing UN/locode within `maxKm`, or null.
|
|
84
81
|
*/
|
|
85
82
|
nearest(lat: number, lon: number, maxKm = 25): string | null {
|
|
86
83
|
const dLat = maxKm / 111
|
|
@@ -105,15 +102,13 @@ export class UNLocodeLookup implements Disposable {
|
|
|
105
102
|
|
|
106
103
|
return best?.code ?? null
|
|
107
104
|
}
|
|
108
|
-
|
|
109
|
-
[Symbol.dispose](): void {
|
|
110
|
-
this.#resources[Symbol.dispose]()
|
|
111
|
-
}
|
|
112
105
|
}
|
|
113
106
|
|
|
114
107
|
/**
|
|
115
|
-
* Build an `Annotator` filling `AnnotationSet.unLocode`.
|
|
116
|
-
*
|
|
108
|
+
* Build an `Annotator` filling `AnnotationSet.unLocode`.
|
|
109
|
+
*
|
|
110
|
+
* Prefers a country + place-name match (when the resolver supplies them via `countryCode` / `placeName`),
|
|
111
|
+
* and falls back to the nearest coordinate.
|
|
117
112
|
*/
|
|
118
113
|
export function makeUNLocodeAnnotator(lookup: UNLocodeLookup, opts: { maxKm?: number } = {}): Annotator {
|
|
119
114
|
return ({ lat, lon, countryCode, placeName }): Partial<AnnotationSet> => {
|
package/lib/schema.ts
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* The `un-locode.db` read
|
|
6
|
+
* The `un-locode.db` read interface. Declared beside the reader and the builder that writes it, so a column added to
|
|
7
7
|
* one is a compile error against the other.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* One UN/
|
|
12
|
-
* coordinate pair when the source
|
|
11
|
+
* One UN/locode entry: the country and location codes that form its key, the place name in raw
|
|
12
|
+
* and folded form, plus the coordinate pair when the source provides one.
|
|
13
13
|
*/
|
|
14
14
|
export interface UNLocodeTable {
|
|
15
15
|
country: string
|
|
@@ -21,7 +21,7 @@ export interface UNLocodeTable {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* The tables `un-locode.db
|
|
24
|
+
* The tables in `un-locode.db`.
|
|
25
25
|
*/
|
|
26
26
|
export interface UNLocodeDatabase {
|
|
27
27
|
un_locode: UNLocodeTable
|
package/out/build.d.ts
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Build the UN/
|
|
6
|
+
* Build the UN/locode lookup DB from the unece code list CSV (datasets/un-locode `code-list.csv`:
|
|
7
7
|
* columns Change, Country, Location, Name, NameWoDiacritics, Subdivision, Status, Function, Date,
|
|
8
|
-
*
|
|
8
|
+
* iata, Coordinates, Remarks). One row per assigned location. coordinates parsed where present.
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
11
11
|
* Read the code-list CSV at `csvPath` and write the lookup DB to `dbPath`.
|
package/out/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../lib/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../lib/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAuCpH"}
|
package/out/build.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Build the UN/
|
|
6
|
+
* Build the UN/locode lookup DB from the unece code list CSV (datasets/un-locode `code-list.csv`:
|
|
7
7
|
* columns Change, Country, Location, Name, NameWoDiacritics, Subdivision, Status, Function, Date,
|
|
8
|
-
*
|
|
8
|
+
* iata, Coordinates, Remarks). One row per assigned location. coordinates parsed where present.
|
|
9
9
|
*/
|
|
10
10
|
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
11
11
|
import { CSVSpliterator } from "spliterator";
|
|
@@ -14,13 +14,10 @@ import { foldName, parseUNLocodeCoords } from "#index";
|
|
|
14
14
|
* Read the code-list CSV at `csvPath` and write the lookup DB to `dbPath`.
|
|
15
15
|
*/
|
|
16
16
|
export async function buildUNLocodeDB(csvPath, dbPath) {
|
|
17
|
-
// `normalizeKeys: false` keeps the
|
|
18
|
-
// (`NameWoDiacritics`, not `name_wo_diacritics`).
|
|
19
|
-
// is on — it is off by default.
|
|
17
|
+
// `normalizeKeys: false` keeps the unece header casing the row shape above is
|
|
18
|
+
// written against (`NameWoDiacritics`, not `name_wo_diacritics`).
|
|
20
19
|
const records = CSVSpliterator.fromAsync(csvPath, {
|
|
21
|
-
mode: "object",
|
|
22
20
|
normalizeKeys: false,
|
|
23
|
-
enableQuoteHandling: true,
|
|
24
21
|
});
|
|
25
22
|
using db = new DatabaseClient(dbPath);
|
|
26
23
|
db.exec("DROP TABLE IF EXISTS un_locode");
|
|
@@ -32,7 +29,7 @@ export async function buildUNLocodeDB(csvPath, dbPath) {
|
|
|
32
29
|
for await (const r of records) {
|
|
33
30
|
rows++;
|
|
34
31
|
if (!r.Country || !r.Location)
|
|
35
|
-
continue; // header/country rows
|
|
32
|
+
continue; // header/country rows have no Location
|
|
36
33
|
const coords = r.Coordinates ? parseUNLocodeCoords(r.Coordinates) : null;
|
|
37
34
|
if (coords) {
|
|
38
35
|
withCoords++;
|
package/out/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../lib/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAA;AAWtD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAe,EAAE,MA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,gBAAgB,IAAI,CAAC,CAAC,IAAI,IAAI,EAAE,CAAA;QAC/C,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,CAAA;IAC5G,CAAC;IAED,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACjB,EAAE,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAA;IACxE,EAAE,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAA;IAE/D,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAA;AAC5B,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @license AGPL-3.0
|
|
5
5
|
* @author Teffen Ellis, et al.
|
|
6
6
|
*
|
|
7
|
-
* `mailwoman-un-locode` — build the lookup DB, or look up a UN/
|
|
7
|
+
* `mailwoman-un-locode` — build the lookup DB, or look up a UN/locode by name or coordinate.
|
|
8
8
|
*
|
|
9
9
|
* ```sh
|
|
10
10
|
* mailwoman-un-locode build --csv code-list.csv --out un-locode.db
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
* coordinate form is the nearest-code lookup, formerly `--near`).
|
|
17
17
|
*/
|
|
18
18
|
export {};
|
|
19
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../cli/main.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @license AGPL-3.0
|
|
5
5
|
* @author Teffen Ellis, et al.
|
|
6
6
|
*
|
|
7
|
-
* `mailwoman-un-locode` — build the lookup DB, or look up a UN/
|
|
7
|
+
* `mailwoman-un-locode` — build the lookup DB, or look up a UN/locode by name or coordinate.
|
|
8
8
|
*
|
|
9
9
|
* ```sh
|
|
10
10
|
* mailwoman-un-locode build --csv code-list.csv --out un-locode.db
|
|
@@ -49,4 +49,4 @@ else {
|
|
|
49
49
|
const code = byName ? lookup.byName(values.country, values.name) : lookup.nearest(lat, lon);
|
|
50
50
|
console.log(JSON.stringify({ unLocode: code }));
|
|
51
51
|
}
|
|
52
|
-
//# sourceMappingURL=
|
|
52
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../cli/main.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAEvC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,cAAc,CAAC;IAC9C,OAAO,EAAE;QACR,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACvB,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACvB,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACtB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACxB;IACD,gBAAgB,EAAE,IAAI;CACtB,CAAC,CAAA;AAEF,IAAI,WAAW,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QAChC,OAAO,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAA;QAElF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;I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CHANGED
|
@@ -3,48 +3,49 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* `@mailwoman/un-locode-lookup` — place → UN/
|
|
6
|
+
* `@mailwoman/un-locode-lookup` — place → UN/locode (unece Code for Trade and Transport Locations).
|
|
7
7
|
* Two ways in: by country + place name (exact, diacritic-folded), or by nearest coordinate (for
|
|
8
|
-
* the ~⅓ of entries that
|
|
8
|
+
* the ~⅓ of entries that have one). Backed by a `node:sqlite` table built from the unece code
|
|
9
9
|
* list. An `@mailwoman/annotations` `Annotator`.
|
|
10
10
|
*/
|
|
11
11
|
import type { Annotator } from "@mailwoman/annotations";
|
|
12
|
-
import {
|
|
12
|
+
import { SQLiteLookup, type SQLiteLookupOptions } from "@mailwoman/sqlite/lookup";
|
|
13
13
|
import type { UNLocodeDatabase } from "#schema";
|
|
14
14
|
/**
|
|
15
15
|
* Fold a place name to its match key: strip diacritics, lowercase, collapse whitespace.
|
|
16
16
|
*/
|
|
17
17
|
export declare function foldName(name: string): string;
|
|
18
18
|
/**
|
|
19
|
-
* Parse a UN/
|
|
19
|
+
* Parse a UN/locode coordinate (`"4923N 01522E"`) to decimal degrees, or null if absent/malformed.
|
|
20
20
|
*/
|
|
21
21
|
export declare function parseUNLocodeCoords(raw: string): {
|
|
22
22
|
lat: number;
|
|
23
23
|
lon: number;
|
|
24
24
|
} | null;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Where a {@link UNLocodeLookup} reads from.
|
|
27
27
|
*/
|
|
28
|
-
export
|
|
28
|
+
export type UNLocodeLookupOptions = SQLiteLookupOptions<UNLocodeDatabase>;
|
|
29
|
+
/**
|
|
30
|
+
* A UN/locode lookup over a built `node:sqlite` table.
|
|
31
|
+
*/
|
|
32
|
+
export declare class UNLocodeLookup extends SQLiteLookup<UNLocodeDatabase> {
|
|
29
33
|
#private;
|
|
30
|
-
constructor(opts:
|
|
31
|
-
databasePath: string;
|
|
32
|
-
} | {
|
|
33
|
-
db: DatabaseClient<UNLocodeDatabase>;
|
|
34
|
-
});
|
|
34
|
+
constructor(opts: UNLocodeLookupOptions);
|
|
35
35
|
/**
|
|
36
|
-
* The UN/
|
|
36
|
+
* The UN/locode (`"US NYC"`) for a country + place name, or null.
|
|
37
37
|
*/
|
|
38
38
|
byName(country: string, name: string): string | null;
|
|
39
39
|
/**
|
|
40
|
-
* The nearest coordinate-
|
|
40
|
+
* The nearest coordinate-containing UN/locode within `maxKm`, or null.
|
|
41
41
|
*/
|
|
42
42
|
nearest(lat: number, lon: number, maxKm?: number): string | null;
|
|
43
|
-
[Symbol.dispose](): void;
|
|
44
43
|
}
|
|
45
44
|
/**
|
|
46
|
-
* Build an `Annotator` filling `AnnotationSet.unLocode`.
|
|
47
|
-
*
|
|
45
|
+
* Build an `Annotator` filling `AnnotationSet.unLocode`.
|
|
46
|
+
*
|
|
47
|
+
* Prefers a country + place-name match (when the resolver supplies them via `countryCode` / `placeName`),
|
|
48
|
+
* and falls back to the nearest coordinate.
|
|
48
49
|
*/
|
|
49
50
|
export declare function makeUNLocodeAnnotator(lookup: UNLocodeLookup, opts?: {
|
|
50
51
|
maxKm?: number;
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAGtE,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAEjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO7C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAQpF;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAA;AAEzE;;GAEG;AACH,qBAAa,cAAe,SAAQ,YAAY,CAAC,gBAAgB,CAAC;;IAIjE,YAAY,IAAI,EAAE,qBAAqB,EAUtC;IAED;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMnD;IAED;;OAEG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,MAAM,GAAG,IAAI,CAsB3D;CACD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,SAAS,CAOtG"}
|
package/out/index.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* `@mailwoman/un-locode-lookup` — place → UN/
|
|
6
|
+
* `@mailwoman/un-locode-lookup` — place → UN/locode (unece Code for Trade and Transport Locations).
|
|
7
7
|
* Two ways in: by country + place name (exact, diacritic-folded), or by nearest coordinate (for
|
|
8
|
-
* the ~⅓ of entries that
|
|
8
|
+
* the ~⅓ of entries that have one). Backed by a `node:sqlite` table built from the unece code
|
|
9
9
|
* list. An `@mailwoman/annotations` `Annotator`.
|
|
10
10
|
*/
|
|
11
11
|
import { haversineKm } from "@mailwoman/spatial";
|
|
12
|
-
import {
|
|
12
|
+
import { SQLiteLookup } from "@mailwoman/sqlite/lookup";
|
|
13
13
|
/**
|
|
14
14
|
* Fold a place name to its match key: strip diacritics, lowercase, collapse whitespace.
|
|
15
15
|
*/
|
|
@@ -22,7 +22,7 @@ export function foldName(name) {
|
|
|
22
22
|
.replaceAll(/\s+/g, " ");
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* Parse a UN/
|
|
25
|
+
* Parse a UN/locode coordinate (`"4923N 01522E"`) to decimal degrees, or null if absent/malformed.
|
|
26
26
|
*/
|
|
27
27
|
export function parseUNLocodeCoords(raw) {
|
|
28
28
|
const m = raw.trim().match(/^(\d{2})(\d{2})([NS])\s+(\d{3})(\d{2})([EW])$/);
|
|
@@ -33,34 +33,25 @@ export function parseUNLocodeCoords(raw) {
|
|
|
33
33
|
return { lat, lon };
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* A UN/
|
|
36
|
+
* A UN/locode lookup over a built `node:sqlite` table.
|
|
37
37
|
*/
|
|
38
|
-
export class UNLocodeLookup {
|
|
39
|
-
#db;
|
|
40
|
-
/**
|
|
41
|
-
* Resources this instance opened. A connection handed in by a caller is NOT in here, so disposal cannot reach it —
|
|
42
|
-
* ownership is membership rather than a flag a later branch has to check.
|
|
43
|
-
*/
|
|
44
|
-
#resources = new DisposableStack();
|
|
38
|
+
export class UNLocodeLookup extends SQLiteLookup {
|
|
45
39
|
#byName;
|
|
46
40
|
#byBox;
|
|
47
41
|
constructor(opts) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
: this.#resources.use(new DatabaseClient(opts.databasePath, { readOnly: true }));
|
|
52
|
-
this.#byName = this.#db.prepare("SELECT country, location FROM un_locode WHERE country = ? AND nameNorm = ? LIMIT 1");
|
|
53
|
-
this.#byBox = this.#db.prepare("SELECT location, country, lat, lon FROM un_locode WHERE lat BETWEEN ? AND ? AND lon BETWEEN ? AND ?");
|
|
42
|
+
super(opts);
|
|
43
|
+
this.#byName = this.database.prepare("SELECT country, location FROM un_locode WHERE country = ? AND nameNorm = ? LIMIT 1");
|
|
44
|
+
this.#byBox = this.database.prepare("SELECT location, country, lat, lon FROM un_locode WHERE lat BETWEEN ? AND ? AND lon BETWEEN ? AND ?");
|
|
54
45
|
}
|
|
55
46
|
/**
|
|
56
|
-
* The UN/
|
|
47
|
+
* The UN/locode (`"US NYC"`) for a country + place name, or null.
|
|
57
48
|
*/
|
|
58
49
|
byName(country, name) {
|
|
59
50
|
const row = this.#byName.get(country.toUpperCase(), foldName(name));
|
|
60
51
|
return row ? `${row.country} ${row.location}` : null;
|
|
61
52
|
}
|
|
62
53
|
/**
|
|
63
|
-
* The nearest coordinate-
|
|
54
|
+
* The nearest coordinate-containing UN/locode within `maxKm`, or null.
|
|
64
55
|
*/
|
|
65
56
|
nearest(lat, lon, maxKm = 25) {
|
|
66
57
|
const dLat = maxKm / 111;
|
|
@@ -75,13 +66,12 @@ export class UNLocodeLookup {
|
|
|
75
66
|
}
|
|
76
67
|
return best?.code ?? null;
|
|
77
68
|
}
|
|
78
|
-
[Symbol.dispose]() {
|
|
79
|
-
this.#resources[Symbol.dispose]();
|
|
80
|
-
}
|
|
81
69
|
}
|
|
82
70
|
/**
|
|
83
|
-
* Build an `Annotator` filling `AnnotationSet.unLocode`.
|
|
84
|
-
*
|
|
71
|
+
* Build an `Annotator` filling `AnnotationSet.unLocode`.
|
|
72
|
+
*
|
|
73
|
+
* Prefers a country + place-name match (when the resolver supplies them via `countryCode` / `placeName`),
|
|
74
|
+
* and falls back to the nearest coordinate.
|
|
85
75
|
*/
|
|
86
76
|
export function makeUNLocodeAnnotator(lookup, opts = {}) {
|
|
87
77
|
return ({ lat, lon, countryCode, placeName }) => {
|
package/out/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH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,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAA;YAE9C,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC,IAAI,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;gBAC5C,IAAI,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAA;YAClD,CAAC;QACF,CAAC;QAED,OAAO,IAAI,EAAE,IAAI,IAAI,IAAI,CAAA;IAC1B,CAAC;CACD;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAsB,EAAE,IAAI,GAAuB,EAAE;IAC1F,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,EAA0B,EAAE;QACvE,MAAM,MAAM,GAAG,WAAW,IAAI,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QACtF,MAAM,IAAI,GAAG,MAAM,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;QAE3D,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IACtC,CAAC,CAAA;AACF,CAAC"}
|
package/out/schema.d.ts
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* The `un-locode.db` read
|
|
6
|
+
* The `un-locode.db` read interface. Declared beside the reader and the builder that writes it, so a column added to
|
|
7
7
|
* one is a compile error against the other.
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
|
-
* One UN/
|
|
11
|
-
* coordinate pair when the source
|
|
10
|
+
* One UN/locode entry: the country and location codes that form its key, the place name in raw
|
|
11
|
+
* and folded form, plus the coordinate pair when the source provides one.
|
|
12
12
|
*/
|
|
13
13
|
export interface UNLocodeTable {
|
|
14
14
|
country: string;
|
|
@@ -19,7 +19,7 @@ export interface UNLocodeTable {
|
|
|
19
19
|
lon: number | null;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* The tables `un-locode.db
|
|
22
|
+
* The tables in `un-locode.db`.
|
|
23
23
|
*/
|
|
24
24
|
export interface UNLocodeDatabase {
|
|
25
25
|
un_locode: UNLocodeTable;
|
package/out/schema.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* The `un-locode.db` read
|
|
6
|
+
* The `un-locode.db` read interface. Declared beside the reader and the builder that writes it, so a column added to
|
|
7
7
|
* one is a compile error against the other.
|
|
8
8
|
*/
|
|
9
9
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/un-locode-lookup",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"description": "Place → UN/LOCODE (UNECE Code for Trade and Transport Locations), by country + name or nearest coordinate. node:sqlite over the UNECE code list. An @mailwoman/annotations Annotator.",
|
|
5
5
|
"license": "AGPL-3.0-only OR LicenseRef-Commercial",
|
|
6
6
|
"repository": {
|
|
@@ -8,26 +8,27 @@
|
|
|
8
8
|
"url": "https://github.com/sister-software/mailwoman.git",
|
|
9
9
|
"directory": "packages/un-locode-lookup"
|
|
10
10
|
},
|
|
11
|
-
"bin": "./out/cli.js",
|
|
11
|
+
"bin": "./out/cli/main.js",
|
|
12
12
|
"files": [
|
|
13
13
|
"out/**/*.js",
|
|
14
14
|
"out/**/*.js.map",
|
|
15
15
|
"out/**/*.d.ts",
|
|
16
16
|
"out/**/*.d.ts.map",
|
|
17
17
|
"README.md",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"**/*.tsx",
|
|
22
|
-
"!*.test.ts",
|
|
23
|
-
"!*.test.tsx",
|
|
18
|
+
"lib/**/*.ts",
|
|
19
|
+
"lib/**/*.tsx",
|
|
20
|
+
"cli/**/*.ts",
|
|
24
21
|
"!**/*.test.ts",
|
|
25
|
-
"!**/*.test.tsx"
|
|
26
|
-
"!test/**"
|
|
22
|
+
"!**/*.test.tsx"
|
|
27
23
|
],
|
|
28
24
|
"type": "module",
|
|
29
25
|
"sideEffects": false,
|
|
30
26
|
"imports": {
|
|
27
|
+
"#cli/*": {
|
|
28
|
+
"types": "./out/cli/*.d.ts",
|
|
29
|
+
"node": "./out/cli/*.js",
|
|
30
|
+
"default": "./out/cli/*.js"
|
|
31
|
+
},
|
|
31
32
|
"#*": {
|
|
32
33
|
"types": "./out/*.d.ts",
|
|
33
34
|
"node": "./out/*.js",
|
|
@@ -41,15 +42,15 @@
|
|
|
41
42
|
"node": "./out/index.js",
|
|
42
43
|
"default": "./out/index.js"
|
|
43
44
|
},
|
|
44
|
-
"./
|
|
45
|
-
"types": "./out/
|
|
46
|
-
"node": "./out/
|
|
47
|
-
"default": "./out/
|
|
45
|
+
"./cli/*": {
|
|
46
|
+
"types": "./out/cli/*.d.ts",
|
|
47
|
+
"node": "./out/cli/*.js",
|
|
48
|
+
"default": "./out/cli/*.js"
|
|
48
49
|
},
|
|
49
|
-
"
|
|
50
|
-
"types": "./out
|
|
51
|
-
"node": "./out
|
|
52
|
-
"default": "./out
|
|
50
|
+
"./*": {
|
|
51
|
+
"types": "./out/*.d.ts",
|
|
52
|
+
"node": "./out/*.js",
|
|
53
|
+
"default": "./out/*.js"
|
|
53
54
|
}
|
|
54
55
|
},
|
|
55
56
|
"publishConfig": {
|
|
@@ -61,18 +62,23 @@
|
|
|
61
62
|
"node": "./out/index.js",
|
|
62
63
|
"default": "./out/index.js"
|
|
63
64
|
},
|
|
64
|
-
"./
|
|
65
|
-
"types": "./out/
|
|
66
|
-
"node": "./out/
|
|
67
|
-
"default": "./out/
|
|
65
|
+
"./cli/*": {
|
|
66
|
+
"types": "./out/cli/*.d.ts",
|
|
67
|
+
"node": "./out/cli/*.js",
|
|
68
|
+
"default": "./out/cli/*.js"
|
|
68
69
|
},
|
|
69
|
-
"
|
|
70
|
-
"types": "./out
|
|
71
|
-
"node": "./out
|
|
72
|
-
"default": "./out
|
|
70
|
+
"./*": {
|
|
71
|
+
"types": "./out/*.d.ts",
|
|
72
|
+
"node": "./out/*.js",
|
|
73
|
+
"default": "./out/*.js"
|
|
73
74
|
}
|
|
74
75
|
},
|
|
75
76
|
"imports": {
|
|
77
|
+
"#cli/*": {
|
|
78
|
+
"types": "./out/cli/*.d.ts",
|
|
79
|
+
"node": "./out/cli/*.js",
|
|
80
|
+
"default": "./out/cli/*.js"
|
|
81
|
+
},
|
|
76
82
|
"#*": {
|
|
77
83
|
"types": "./out/*.d.ts",
|
|
78
84
|
"node": "./out/*.js",
|
|
@@ -81,9 +87,9 @@
|
|
|
81
87
|
}
|
|
82
88
|
},
|
|
83
89
|
"dependencies": {
|
|
84
|
-
"@mailwoman/annotations": "
|
|
85
|
-
"@mailwoman/spatial": "
|
|
86
|
-
"@mailwoman/sqlite": "
|
|
87
|
-
"spliterator": "^
|
|
90
|
+
"@mailwoman/annotations": "10.1.0",
|
|
91
|
+
"@mailwoman/spatial": "10.1.0",
|
|
92
|
+
"@mailwoman/sqlite": "10.1.0",
|
|
93
|
+
"spliterator": "^8.1.0"
|
|
88
94
|
}
|
|
89
95
|
}
|
package/out/cli.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../lib/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG"}
|
package/out/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|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