@mailwoman/un-locode-lookup 9.1.0 → 9.3.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/{build.ts → lib/build.ts} +9 -11
- package/{cli.ts → lib/cli.ts} +6 -8
- package/{index.ts → lib/index.ts} +21 -12
- package/lib/schema.ts +28 -0
- package/out/build.d.ts +2 -2
- package/out/build.d.ts.map +1 -1
- package/out/build.js +7 -9
- package/out/build.js.map +1 -1
- package/out/cli.d.ts.map +1 -1
- package/out/cli.js +6 -7
- package/out/cli.js.map +1 -1
- package/out/index.d.ts +7 -6
- package/out/index.d.ts.map +1 -1
- package/out/index.js +15 -7
- package/out/index.js.map +1 -1
- package/out/schema.d.ts +27 -0
- package/out/schema.d.ts.map +1 -0
- package/out/schema.js +10 -0
- package/out/schema.js.map +1 -0
- package/package.json +37 -6
|
@@ -8,12 +8,11 @@
|
|
|
8
8
|
* IATA, Coordinates, Remarks). One row per assigned location; coordinates parsed where present.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
import { DatabaseSync } from "node:sqlite"
|
|
13
|
-
|
|
11
|
+
import { DatabaseClient } from "@mailwoman/sqlite/client"
|
|
14
12
|
import { CSVSpliterator } from "spliterator"
|
|
15
13
|
|
|
16
|
-
import { foldName,
|
|
14
|
+
import { foldName, parseUNLocodeCoords } from "#index"
|
|
15
|
+
import type { UNLocodeDatabase } from "#schema"
|
|
17
16
|
|
|
18
17
|
interface CSVRow {
|
|
19
18
|
Country: string
|
|
@@ -26,17 +25,17 @@ interface CSVRow {
|
|
|
26
25
|
/**
|
|
27
26
|
* Read the code-list CSV at `csvPath` and write the lookup DB to `dbPath`.
|
|
28
27
|
*/
|
|
29
|
-
export function
|
|
28
|
+
export async function buildUNLocodeDB(csvPath: string, dbPath: string): Promise<{ rows: number; withCoords: number }> {
|
|
30
29
|
// `normalizeKeys: false` keeps the UNECE header casing the row shape above is written against
|
|
31
30
|
// (`NameWoDiacritics`, not `name_wo_diacritics`). Location names carry commas, so quote handling
|
|
32
31
|
// is on — it is off by default.
|
|
33
|
-
const records = CSVSpliterator.
|
|
32
|
+
const records = CSVSpliterator.fromAsync<CSVRow>(csvPath, {
|
|
34
33
|
mode: "object",
|
|
35
34
|
normalizeKeys: false,
|
|
36
35
|
enableQuoteHandling: true,
|
|
37
|
-
})
|
|
36
|
+
})
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
using db = new DatabaseClient<UNLocodeDatabase>(dbPath)
|
|
40
39
|
db.exec("DROP TABLE IF EXISTS un_locode")
|
|
41
40
|
|
|
42
41
|
db.exec(
|
|
@@ -49,11 +48,11 @@ export function buildUnLocodeDB(csvPath: string, dbPath: string): { rows: number
|
|
|
49
48
|
let rows = 0
|
|
50
49
|
db.exec("BEGIN")
|
|
51
50
|
|
|
52
|
-
for (const r of records) {
|
|
51
|
+
for await (const r of records) {
|
|
53
52
|
rows++
|
|
54
53
|
|
|
55
54
|
if (!r.Country || !r.Location) continue // header/country rows carry no Location
|
|
56
|
-
const coords = r.Coordinates ?
|
|
55
|
+
const coords = r.Coordinates ? parseUNLocodeCoords(r.Coordinates) : null
|
|
57
56
|
|
|
58
57
|
if (coords) {
|
|
59
58
|
withCoords++
|
|
@@ -66,7 +65,6 @@ export function buildUnLocodeDB(csvPath: string, dbPath: string): { rows: number
|
|
|
66
65
|
db.exec("COMMIT")
|
|
67
66
|
db.exec("CREATE INDEX idx_locode_name ON un_locode (country, nameNorm)")
|
|
68
67
|
db.exec("CREATE INDEX idx_locode_bbox ON un_locode (lat, lon)")
|
|
69
|
-
db.close()
|
|
70
68
|
|
|
71
69
|
return { rows, withCoords }
|
|
72
70
|
}
|
package/{cli.ts → lib/cli.ts}
RENAMED
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
* coordinate form is the nearest-code lookup, formerly `--near`).
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import { parseArguments } from "@mailwoman/core/scripting/arguments"
|
|
20
20
|
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
21
|
+
import { buildUNLocodeDB } from "#build"
|
|
22
|
+
import { UNLocodeLookup } from "#index"
|
|
23
23
|
|
|
24
|
-
const { values, positionals } =
|
|
24
|
+
const { values, positionals } = parseArguments({
|
|
25
25
|
options: {
|
|
26
26
|
csv: { type: "string" },
|
|
27
27
|
out: { type: "string" },
|
|
@@ -39,7 +39,7 @@ if (positionals[0] === "build") {
|
|
|
39
39
|
process.exit(1)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
const { rows, withCoords } =
|
|
42
|
+
const { rows, withCoords } = await buildUNLocodeDB(values.csv, values.out)
|
|
43
43
|
|
|
44
44
|
console.error(`built ${values.out} (${rows} rows, ${withCoords} with coordinates)`)
|
|
45
45
|
} else {
|
|
@@ -54,10 +54,8 @@ if (positionals[0] === "build") {
|
|
|
54
54
|
process.exit(1)
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
using lookup = new UNLocodeLookup({ databasePath: values.db })
|
|
58
58
|
const code = byName ? lookup.byName(values.country!, values.name!) : lookup.nearest(lat, lon)
|
|
59
59
|
|
|
60
60
|
console.log(JSON.stringify({ unLocode: code }))
|
|
61
|
-
|
|
62
|
-
lookup.close()
|
|
63
61
|
}
|
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
* list. An `@mailwoman/annotations` `Annotator`.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { DatabaseSync } from "node:sqlite"
|
|
13
|
-
|
|
14
12
|
import type { AnnotationSet, Annotator } from "@mailwoman/annotations"
|
|
15
13
|
import { haversineKm } from "@mailwoman/spatial"
|
|
14
|
+
import { DatabaseClient } from "@mailwoman/sqlite/client"
|
|
15
|
+
|
|
16
|
+
import type { UNLocodeDatabase } from "#schema"
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Fold a place name to its match key: strip diacritics, lowercase, collapse whitespace.
|
|
@@ -29,7 +30,7 @@ export function foldName(name: string): string {
|
|
|
29
30
|
/**
|
|
30
31
|
* Parse a UN/LOCODE coordinate (`"4923N 01522E"`) to decimal degrees, or null if absent/malformed.
|
|
31
32
|
*/
|
|
32
|
-
export function
|
|
33
|
+
export function parseUNLocodeCoords(raw: string): { lat: number; lon: number } | null {
|
|
33
34
|
const m = raw.trim().match(/^(\d{2})(\d{2})([NS])\s+(\d{3})(\d{2})([EW])$/)
|
|
34
35
|
|
|
35
36
|
if (!m) return null
|
|
@@ -42,13 +43,21 @@ export function parseUnLocodeCoords(raw: string): { lat: number; lon: number } |
|
|
|
42
43
|
/**
|
|
43
44
|
* A UN/LOCODE lookup over a built `node:sqlite` table.
|
|
44
45
|
*/
|
|
45
|
-
export class
|
|
46
|
-
#db:
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
export class UNLocodeLookup implements Disposable {
|
|
47
|
+
#db: DatabaseClient<UNLocodeDatabase>
|
|
48
|
+
/**
|
|
49
|
+
* Resources this instance opened. A connection handed in by a caller is NOT in here, so disposal cannot reach it —
|
|
50
|
+
* ownership is membership rather than a flag a later branch has to check.
|
|
51
|
+
*/
|
|
52
|
+
readonly #resources = new DisposableStack()
|
|
53
|
+
#byName: ReturnType<DatabaseClient["prepare"]>
|
|
54
|
+
#byBox: ReturnType<DatabaseClient["prepare"]>
|
|
49
55
|
|
|
50
|
-
constructor(opts: { databasePath: string } | {
|
|
51
|
-
this.#db =
|
|
56
|
+
constructor(opts: { databasePath: string } | { db: DatabaseClient<UNLocodeDatabase> }) {
|
|
57
|
+
this.#db =
|
|
58
|
+
"db" in opts
|
|
59
|
+
? opts.db
|
|
60
|
+
: this.#resources.use(new DatabaseClient<UNLocodeDatabase>(opts.databasePath, { readOnly: true }))
|
|
52
61
|
|
|
53
62
|
this.#byName = this.#db.prepare(
|
|
54
63
|
"SELECT country, location FROM un_locode WHERE country = ? AND nameNorm = ? LIMIT 1"
|
|
@@ -97,8 +106,8 @@ export class UnLocodeLookup {
|
|
|
97
106
|
return best?.code ?? null
|
|
98
107
|
}
|
|
99
108
|
|
|
100
|
-
|
|
101
|
-
this.#
|
|
109
|
+
[Symbol.dispose](): void {
|
|
110
|
+
this.#resources[Symbol.dispose]()
|
|
102
111
|
}
|
|
103
112
|
}
|
|
104
113
|
|
|
@@ -106,7 +115,7 @@ export class UnLocodeLookup {
|
|
|
106
115
|
* Build an `Annotator` filling `AnnotationSet.unLocode`. Prefers a country + place-name match (when the resolver
|
|
107
116
|
* supplies them via `countryCode` / `placeName`), and falls back to the nearest coordinate.
|
|
108
117
|
*/
|
|
109
|
-
export function
|
|
118
|
+
export function makeUNLocodeAnnotator(lookup: UNLocodeLookup, opts: { maxKm?: number } = {}): Annotator {
|
|
110
119
|
return ({ lat, lon, countryCode, placeName }): Partial<AnnotationSet> => {
|
|
111
120
|
const byName = countryCode && placeName ? lookup.byName(countryCode, placeName) : null
|
|
112
121
|
const code = byName ?? lookup.nearest(lat, lon, opts.maxKm)
|
package/lib/schema.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The `un-locode.db` read contract. Declared beside the reader and the builder that writes it, so a column added to
|
|
7
|
+
* one is a compile error against the other.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* One UN/LOCODE entry: the country and location codes that form its key, the place name in raw and folded form, and the
|
|
12
|
+
* coordinate pair when the source carries one.
|
|
13
|
+
*/
|
|
14
|
+
export interface UNLocodeTable {
|
|
15
|
+
country: string
|
|
16
|
+
location: string
|
|
17
|
+
name: string | null
|
|
18
|
+
nameNorm: string | null
|
|
19
|
+
lat: number | null
|
|
20
|
+
lon: number | null
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The tables `un-locode.db` carries.
|
|
25
|
+
*/
|
|
26
|
+
export interface UNLocodeDatabase {
|
|
27
|
+
un_locode: UNLocodeTable
|
|
28
|
+
}
|
package/out/build.d.ts
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
/**
|
|
11
11
|
* Read the code-list CSV at `csvPath` and write the lookup DB to `dbPath`.
|
|
12
12
|
*/
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function buildUNLocodeDB(csvPath: string, dbPath: string): Promise<{
|
|
14
14
|
rows: number;
|
|
15
15
|
withCoords: number;
|
|
16
|
-
}
|
|
16
|
+
}>;
|
|
17
17
|
//# sourceMappingURL=build.d.ts.map
|
package/out/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../build.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
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,CA0CpH"}
|
package/out/build.js
CHANGED
|
@@ -7,34 +7,33 @@
|
|
|
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
|
-
import {
|
|
11
|
-
import { DatabaseSync } from "node:sqlite";
|
|
10
|
+
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
12
11
|
import { CSVSpliterator } from "spliterator";
|
|
13
|
-
import { foldName,
|
|
12
|
+
import { foldName, parseUNLocodeCoords } from "#index";
|
|
14
13
|
/**
|
|
15
14
|
* Read the code-list CSV at `csvPath` and write the lookup DB to `dbPath`.
|
|
16
15
|
*/
|
|
17
|
-
export function
|
|
16
|
+
export async function buildUNLocodeDB(csvPath, dbPath) {
|
|
18
17
|
// `normalizeKeys: false` keeps the UNECE header casing the row shape above is written against
|
|
19
18
|
// (`NameWoDiacritics`, not `name_wo_diacritics`). Location names carry commas, so quote handling
|
|
20
19
|
// is on — it is off by default.
|
|
21
|
-
const records = CSVSpliterator.
|
|
20
|
+
const records = CSVSpliterator.fromAsync(csvPath, {
|
|
22
21
|
mode: "object",
|
|
23
22
|
normalizeKeys: false,
|
|
24
23
|
enableQuoteHandling: true,
|
|
25
24
|
});
|
|
26
|
-
|
|
25
|
+
using db = new DatabaseClient(dbPath);
|
|
27
26
|
db.exec("DROP TABLE IF EXISTS un_locode");
|
|
28
27
|
db.exec("CREATE TABLE un_locode (country TEXT NOT NULL, location TEXT NOT NULL, name TEXT, nameNorm TEXT, lat REAL, lon REAL)");
|
|
29
28
|
const insert = db.prepare("INSERT INTO un_locode (country, location, name, nameNorm, lat, lon) VALUES (?,?,?,?,?,?)");
|
|
30
29
|
let withCoords = 0;
|
|
31
30
|
let rows = 0;
|
|
32
31
|
db.exec("BEGIN");
|
|
33
|
-
for (const r of records) {
|
|
32
|
+
for await (const r of records) {
|
|
34
33
|
rows++;
|
|
35
34
|
if (!r.Country || !r.Location)
|
|
36
35
|
continue; // header/country rows carry no Location
|
|
37
|
-
const coords = r.Coordinates ?
|
|
36
|
+
const coords = r.Coordinates ? parseUNLocodeCoords(r.Coordinates) : null;
|
|
38
37
|
if (coords) {
|
|
39
38
|
withCoords++;
|
|
40
39
|
}
|
|
@@ -44,7 +43,6 @@ export function buildUnLocodeDB(csvPath, dbPath) {
|
|
|
44
43
|
db.exec("COMMIT");
|
|
45
44
|
db.exec("CREATE INDEX idx_locode_name ON un_locode (country, nameNorm)");
|
|
46
45
|
db.exec("CREATE INDEX idx_locode_bbox ON un_locode (lat, lon)");
|
|
47
|
-
db.close();
|
|
48
46
|
return { rows, withCoords };
|
|
49
47
|
}
|
|
50
48
|
//# sourceMappingURL=build.js.map
|
package/out/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../build.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,
|
|
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,MAAc;IACpE,8FAA8F;IAC9F,iGAAiG;IACjG,gCAAgC;IAChC,MAAM,OAAO,GAAG,cAAc,CAAC,SAAS,CAAS,OAAO,EAAE;QACzD,IAAI,EAAE,QAAQ;QACd,aAAa,EAAE,KAAK;QACpB,mBAAmB,EAAE,IAAI;KACzB,CAAC,CAAA;IAEF,MAAM,EAAE,GAAG,IAAI,cAAc,CAAmB,MAAM,CAAC,CAAA;IACvD,EAAE,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAA;IAEzC,EAAE,CAAC,IAAI,CACN,sHAAsH,CACtH,CAAA;IAED,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,0FAA0F,CAAC,CAAA;IAErH,IAAI,UAAU,GAAG,CAAC,CAAA;IAClB,IAAI,IAAI,GAAG,CAAC,CAAA;IACZ,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAEhB,IAAI,KAAK,EAAE,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QAC/B,IAAI,EAAE,CAAA;QAEN,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,QAAQ;YAAE,SAAQ,CAAC,wCAAwC;QAChF,MAAM,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAExE,IAAI,MAAM,EAAE,CAAC;YACZ,UAAU,EAAE,CAAA;QACb,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,CAAC,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"}
|
package/out/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG"}
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../lib/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG"}
|
package/out/cli.js
CHANGED
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
* The `--` separates flags from coordinates so negative coordinates parse as positionals (the
|
|
16
16
|
* coordinate form is the nearest-code lookup, formerly `--near`).
|
|
17
17
|
*/
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
const { values, positionals } =
|
|
18
|
+
import { parseArguments } from "@mailwoman/core/scripting/arguments";
|
|
19
|
+
import { buildUNLocodeDB } from "#build";
|
|
20
|
+
import { UNLocodeLookup } from "#index";
|
|
21
|
+
const { values, positionals } = parseArguments({
|
|
22
22
|
options: {
|
|
23
23
|
csv: { type: "string" },
|
|
24
24
|
out: { type: "string" },
|
|
@@ -33,7 +33,7 @@ if (positionals[0] === "build") {
|
|
|
33
33
|
console.error("Usage: mailwoman-un-locode build --csv <code-list.csv> --out <db>");
|
|
34
34
|
process.exit(1);
|
|
35
35
|
}
|
|
36
|
-
const { rows, withCoords } =
|
|
36
|
+
const { rows, withCoords } = await buildUNLocodeDB(values.csv, values.out);
|
|
37
37
|
console.error(`built ${values.out} (${rows} rows, ${withCoords} with coordinates)`);
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
@@ -45,9 +45,8 @@ else {
|
|
|
45
45
|
console.error("Usage: mailwoman-un-locode --db <db> (--country CC --name NAME | -- <lat> <lon>)");
|
|
46
46
|
process.exit(1);
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
using lookup = new UNLocodeLookup({ databasePath: values.db });
|
|
49
49
|
const code = byName ? lookup.byName(values.country, values.name) : lookup.nearest(lat, lon);
|
|
50
50
|
console.log(JSON.stringify({ unLocode: code }));
|
|
51
|
-
lookup.close();
|
|
52
51
|
}
|
|
53
52
|
//# sourceMappingURL=cli.js.map
|
package/out/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../lib/cli.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,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IAE5D,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACzC,OAAO,CAAC,KAAK,CAAC,kFAAkF,CAAC,CAAA;QAEjG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAChB,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAA;IAC9D,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAQ,EAAE,MAAM,CAAC,IAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAE7F,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AAChD,CAAC"}
|
package/out/index.d.ts
CHANGED
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
* the ~⅓ of entries that carry one). Backed by a `node:sqlite` table built from the UNECE code
|
|
9
9
|
* list. An `@mailwoman/annotations` `Annotator`.
|
|
10
10
|
*/
|
|
11
|
-
import { DatabaseSync } from "node:sqlite";
|
|
12
11
|
import type { Annotator } from "@mailwoman/annotations";
|
|
12
|
+
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
13
|
+
import type { UNLocodeDatabase } from "#schema";
|
|
13
14
|
/**
|
|
14
15
|
* Fold a place name to its match key: strip diacritics, lowercase, collapse whitespace.
|
|
15
16
|
*/
|
|
@@ -17,19 +18,19 @@ export declare function foldName(name: string): string;
|
|
|
17
18
|
/**
|
|
18
19
|
* Parse a UN/LOCODE coordinate (`"4923N 01522E"`) to decimal degrees, or null if absent/malformed.
|
|
19
20
|
*/
|
|
20
|
-
export declare function
|
|
21
|
+
export declare function parseUNLocodeCoords(raw: string): {
|
|
21
22
|
lat: number;
|
|
22
23
|
lon: number;
|
|
23
24
|
} | null;
|
|
24
25
|
/**
|
|
25
26
|
* A UN/LOCODE lookup over a built `node:sqlite` table.
|
|
26
27
|
*/
|
|
27
|
-
export declare class
|
|
28
|
+
export declare class UNLocodeLookup implements Disposable {
|
|
28
29
|
#private;
|
|
29
30
|
constructor(opts: {
|
|
30
31
|
databasePath: string;
|
|
31
32
|
} | {
|
|
32
|
-
|
|
33
|
+
db: DatabaseClient<UNLocodeDatabase>;
|
|
33
34
|
});
|
|
34
35
|
/**
|
|
35
36
|
* The UN/LOCODE (`"US NYC"`) for a country + place name, or null.
|
|
@@ -39,13 +40,13 @@ export declare class UnLocodeLookup {
|
|
|
39
40
|
* The nearest coordinate-bearing UN/LOCODE within `maxKm`, or null.
|
|
40
41
|
*/
|
|
41
42
|
nearest(lat: number, lon: number, maxKm?: number): string | null;
|
|
42
|
-
|
|
43
|
+
[Symbol.dispose](): void;
|
|
43
44
|
}
|
|
44
45
|
/**
|
|
45
46
|
* Build an `Annotator` filling `AnnotationSet.unLocode`. Prefers a country + place-name match (when the resolver
|
|
46
47
|
* supplies them via `countryCode` / `placeName`), and falls back to the nearest coordinate.
|
|
47
48
|
*/
|
|
48
|
-
export declare function
|
|
49
|
+
export declare function makeUNLocodeAnnotator(lookup: UNLocodeLookup, opts?: {
|
|
49
50
|
maxKm?: number;
|
|
50
51
|
}): Annotator;
|
|
51
52
|
//# sourceMappingURL=index.d.ts.map
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,
|
|
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;AAEtE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEzD,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,qBAAa,cAAe,YAAW,UAAU;;gBAUpC,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAA;KAAE;IAerF;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAQpD;;OAEG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,MAAM,GAAG,IAAI;IAwB5D,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;CAGxB;AAED;;;GAGG;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
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* the ~⅓ of entries that carry one). Backed by a `node:sqlite` table built from the UNECE code
|
|
9
9
|
* list. An `@mailwoman/annotations` `Annotator`.
|
|
10
10
|
*/
|
|
11
|
-
import { DatabaseSync } from "node:sqlite";
|
|
12
11
|
import { haversineKm } from "@mailwoman/spatial";
|
|
12
|
+
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
13
13
|
/**
|
|
14
14
|
* Fold a place name to its match key: strip diacritics, lowercase, collapse whitespace.
|
|
15
15
|
*/
|
|
@@ -24,7 +24,7 @@ export function foldName(name) {
|
|
|
24
24
|
/**
|
|
25
25
|
* Parse a UN/LOCODE coordinate (`"4923N 01522E"`) to decimal degrees, or null if absent/malformed.
|
|
26
26
|
*/
|
|
27
|
-
export function
|
|
27
|
+
export function parseUNLocodeCoords(raw) {
|
|
28
28
|
const m = raw.trim().match(/^(\d{2})(\d{2})([NS])\s+(\d{3})(\d{2})([EW])$/);
|
|
29
29
|
if (!m)
|
|
30
30
|
return null;
|
|
@@ -35,12 +35,20 @@ export function parseUnLocodeCoords(raw) {
|
|
|
35
35
|
/**
|
|
36
36
|
* A UN/LOCODE lookup over a built `node:sqlite` table.
|
|
37
37
|
*/
|
|
38
|
-
export class
|
|
38
|
+
export class UNLocodeLookup {
|
|
39
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();
|
|
40
45
|
#byName;
|
|
41
46
|
#byBox;
|
|
42
47
|
constructor(opts) {
|
|
43
|
-
this.#db =
|
|
48
|
+
this.#db =
|
|
49
|
+
"db" in opts
|
|
50
|
+
? opts.db
|
|
51
|
+
: this.#resources.use(new DatabaseClient(opts.databasePath, { readOnly: true }));
|
|
44
52
|
this.#byName = this.#db.prepare("SELECT country, location FROM un_locode WHERE country = ? AND nameNorm = ? LIMIT 1");
|
|
45
53
|
this.#byBox = this.#db.prepare("SELECT location, country, lat, lon FROM un_locode WHERE lat BETWEEN ? AND ? AND lon BETWEEN ? AND ?");
|
|
46
54
|
}
|
|
@@ -67,15 +75,15 @@ export class UnLocodeLookup {
|
|
|
67
75
|
}
|
|
68
76
|
return best?.code ?? null;
|
|
69
77
|
}
|
|
70
|
-
|
|
71
|
-
this.#
|
|
78
|
+
[Symbol.dispose]() {
|
|
79
|
+
this.#resources[Symbol.dispose]();
|
|
72
80
|
}
|
|
73
81
|
}
|
|
74
82
|
/**
|
|
75
83
|
* Build an `Annotator` filling `AnnotationSet.unLocode`. Prefers a country + place-name match (when the resolver
|
|
76
84
|
* supplies them via `countryCode` / `placeName`), and falls back to the nearest coordinate.
|
|
77
85
|
*/
|
|
78
|
-
export function
|
|
86
|
+
export function makeUNLocodeAnnotator(lookup, opts = {}) {
|
|
79
87
|
return ({ lat, lon, countryCode, placeName }) => {
|
|
80
88
|
const byName = countryCode && placeName ? lookup.byName(countryCode, placeName) : null;
|
|
81
89
|
const code = byName ?? lookup.nearest(lat, lon, opts.maxKm);
|
package/out/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAIzD;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACpC,OAAO,IAAI;SACT,SAAS,CAAC,KAAK,CAAC;SAChB,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC;SACxB,WAAW,EAAE;SACb,IAAI,EAAE;SACN,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC9C,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAA;IAE3E,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAA;IACnB,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,C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D;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAsB,EAAE,OAA2B,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
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The `un-locode.db` read contract. Declared beside the reader and the builder that writes it, so a column added to
|
|
7
|
+
* one is a compile error against the other.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* One UN/LOCODE entry: the country and location codes that form its key, the place name in raw and folded form, and the
|
|
11
|
+
* coordinate pair when the source carries one.
|
|
12
|
+
*/
|
|
13
|
+
export interface UNLocodeTable {
|
|
14
|
+
country: string;
|
|
15
|
+
location: string;
|
|
16
|
+
name: string | null;
|
|
17
|
+
nameNorm: string | null;
|
|
18
|
+
lat: number | null;
|
|
19
|
+
lon: number | null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The tables `un-locode.db` carries.
|
|
23
|
+
*/
|
|
24
|
+
export interface UNLocodeDatabase {
|
|
25
|
+
un_locode: UNLocodeTable;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../lib/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,SAAS,EAAE,aAAa,CAAA;CACxB"}
|
package/out/schema.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The `un-locode.db` read contract. Declared beside the reader and the builder that writes it, so a column added to
|
|
7
|
+
* one is a compile error against the other.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../lib/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/un-locode-lookup",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.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": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/sister-software/mailwoman.git",
|
|
9
|
-
"directory": "un-locode-lookup"
|
|
9
|
+
"directory": "packages/un-locode-lookup"
|
|
10
10
|
},
|
|
11
11
|
"bin": "./out/cli.js",
|
|
12
12
|
"files": [
|
|
@@ -22,18 +22,34 @@
|
|
|
22
22
|
"!*.test.ts",
|
|
23
23
|
"!*.test.tsx",
|
|
24
24
|
"!**/*.test.ts",
|
|
25
|
-
"!**/*.test.tsx"
|
|
25
|
+
"!**/*.test.tsx",
|
|
26
|
+
"!test/**"
|
|
26
27
|
],
|
|
27
28
|
"type": "module",
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"imports": {
|
|
31
|
+
"#*": {
|
|
32
|
+
"types": "./out/*.d.ts",
|
|
33
|
+
"node": "./out/*.js",
|
|
34
|
+
"default": "./out/*.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
28
37
|
"exports": {
|
|
29
38
|
"./package.json": "./package.json",
|
|
30
39
|
".": {
|
|
31
40
|
"types": "./out/index.d.ts",
|
|
41
|
+
"node": "./out/index.js",
|
|
32
42
|
"default": "./out/index.js"
|
|
33
43
|
},
|
|
34
44
|
"./build": {
|
|
35
45
|
"types": "./out/build.d.ts",
|
|
46
|
+
"node": "./out/build.js",
|
|
36
47
|
"default": "./out/build.js"
|
|
48
|
+
},
|
|
49
|
+
"./schema": {
|
|
50
|
+
"types": "./out/schema.d.ts",
|
|
51
|
+
"node": "./out/schema.js",
|
|
52
|
+
"default": "./out/schema.js"
|
|
37
53
|
}
|
|
38
54
|
},
|
|
39
55
|
"publishConfig": {
|
|
@@ -42,17 +58,32 @@
|
|
|
42
58
|
"./package.json": "./package.json",
|
|
43
59
|
".": {
|
|
44
60
|
"types": "./out/index.d.ts",
|
|
61
|
+
"node": "./out/index.js",
|
|
45
62
|
"default": "./out/index.js"
|
|
46
63
|
},
|
|
47
64
|
"./build": {
|
|
48
65
|
"types": "./out/build.d.ts",
|
|
66
|
+
"node": "./out/build.js",
|
|
49
67
|
"default": "./out/build.js"
|
|
68
|
+
},
|
|
69
|
+
"./schema": {
|
|
70
|
+
"types": "./out/schema.d.ts",
|
|
71
|
+
"node": "./out/schema.js",
|
|
72
|
+
"default": "./out/schema.js"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"imports": {
|
|
76
|
+
"#*": {
|
|
77
|
+
"types": "./out/*.d.ts",
|
|
78
|
+
"node": "./out/*.js",
|
|
79
|
+
"default": "./out/*.js"
|
|
50
80
|
}
|
|
51
81
|
}
|
|
52
82
|
},
|
|
53
83
|
"dependencies": {
|
|
54
|
-
"@mailwoman/annotations": "9.
|
|
55
|
-
"@mailwoman/spatial": "9.
|
|
56
|
-
"
|
|
84
|
+
"@mailwoman/annotations": "9.3.0",
|
|
85
|
+
"@mailwoman/spatial": "9.3.0",
|
|
86
|
+
"@mailwoman/sqlite": "9.3.0",
|
|
87
|
+
"spliterator": "^6.4.1"
|
|
57
88
|
}
|
|
58
89
|
}
|