@mailwoman/photon 11.1.0 → 11.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/README.md +3 -3
- package/cli/geocoder.ts +57 -0
- package/cli/main.ts +12 -39
- package/lib/engine.ts +2 -2
- package/out/cli/geocoder.d.ts +25 -0
- package/out/cli/geocoder.d.ts.map +1 -0
- package/out/cli/geocoder.js +33 -0
- package/out/cli/geocoder.js.map +1 -0
- package/out/cli/main.js +12 -37
- package/out/cli/main.js.map +1 -1
- package/out/engine.d.ts +2 -2
- package/package.json +11 -12
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @mailwoman/photon
|
|
2
2
|
|
|
3
|
-
A **Photon-compatible autocomplete geocoding API** over the [Mailwoman](https://mailwoman.post) engine
|
|
3
|
+
A **Photon-compatible autocomplete geocoding API** over the [Mailwoman](https://mailwoman.post) engine provides search-as-you-type results as GeoJSON `FeatureCollection`s. [`@mailwoman/nominatim`](../nominatim) provides structured lookup. This package provides the type-ahead interface. It runs without Elasticsearch.
|
|
4
4
|
|
|
5
|
-
```
|
|
5
|
+
```sh
|
|
6
6
|
# One-time data fetch (worldwide candidate gazetteer, population-first ranking, ~1.65 GB):
|
|
7
7
|
MAILWOMAN_DATA_ROOT="${MAILWOMAN_DATA_ROOT:-/tmp/mailwoman-data}" npx mailwoman data pull candidate
|
|
8
8
|
|
|
@@ -15,7 +15,7 @@ MAILWOMAN_DATA_ROOT="${MAILWOMAN_DATA_ROOT:-/tmp/mailwoman-data}" \
|
|
|
15
15
|
Prefer to try before self-hosting? A hosted trial endpoint runs at
|
|
16
16
|
**https://photon.mailwoman.post** (`/api` + `/reverse`, conservative rate limits).
|
|
17
17
|
|
|
18
|
-
```
|
|
18
|
+
```sh
|
|
19
19
|
curl "http://localhost:2322/api?q=1600 penn&limit=5&lat=38.9&lon=-77"
|
|
20
20
|
curl "http://localhost:2322/reverse?lat=38.8977&lon=-77.0365"
|
|
21
21
|
```
|
package/cli/geocoder.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The forward geocoder behind `mailwoman-photon serve`: the data layers the server
|
|
6
|
+
* composes, and the geocode of one query through its session.
|
|
7
|
+
*
|
|
8
|
+
* The module is separate from `main.ts` because that file runs the command line when it loads.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { GeocodeResult } from "@mailwoman/core/geocode"
|
|
12
|
+
import { type DropInGeocoder, openDropInGeocoder } from "mailwoman/cli/kit/dropin"
|
|
13
|
+
import type { LayerContribution } from "mailwoman/geocode/layers/contributions"
|
|
14
|
+
import type { GeocodeRequestOptions } from "mailwoman/geocode/session"
|
|
15
|
+
import { banLayer, forkEntityProbe, observationRoutes, osmLayer, regionDatabases } from "mailwoman/services/entry/node"
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The data layers Photon composes.
|
|
19
|
+
*
|
|
20
|
+
* The server consults the national open register (BAN) and then the OpenStreetMap tier.
|
|
21
|
+
* It leaves national Overture out.
|
|
22
|
+
*
|
|
23
|
+
* That order is the one it had before the active selection existed.
|
|
24
|
+
*/
|
|
25
|
+
const PHOTON_LAYERS: readonly LayerContribution[] = [
|
|
26
|
+
banLayer,
|
|
27
|
+
osmLayer,
|
|
28
|
+
regionDatabases,
|
|
29
|
+
forkEntityProbe,
|
|
30
|
+
observationRoutes,
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* What `mailwoman-photon serve` opens to answer `/api`.
|
|
35
|
+
*/
|
|
36
|
+
export interface PhotonGeocoder extends DropInGeocoder {
|
|
37
|
+
/**
|
|
38
|
+
* Geocodes one query as a fragment a person is typing, preferring candidates near `bias`.
|
|
39
|
+
*/
|
|
40
|
+
geocode(query: string, bias?: GeocodeRequestOptions["bias"]): Promise<GeocodeResult>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Opens the gazetteer and the server's session, and ends the process when either is unavailable.
|
|
45
|
+
*
|
|
46
|
+
* @param candidateDBFlag The `--candidate-db` value, or `null` to read the conventional path.
|
|
47
|
+
*/
|
|
48
|
+
export async function openPhotonGeocoder(candidateDBFlag: string | null): Promise<PhotonGeocoder> {
|
|
49
|
+
const opened = await openDropInGeocoder(candidateDBFlag, PHOTON_LAYERS)
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
...opened,
|
|
53
|
+
// Photon is an autocomplete front where a human types fragments.
|
|
54
|
+
geocode: async (query, bias) =>
|
|
55
|
+
(await opened.session.geocode(query, { inputMode: "fragmented", ...(bias ? { bias } : {}) })).result,
|
|
56
|
+
}
|
|
57
|
+
}
|
package/cli/main.ts
CHANGED
|
@@ -10,23 +10,18 @@
|
|
|
10
10
|
|
|
11
11
|
import { serveNode } from "@mailwoman/api-kit"
|
|
12
12
|
import { matchCountry } from "@mailwoman/codex/country"
|
|
13
|
-
import { dataRootPath } from "@mailwoman/core/data-root"
|
|
14
13
|
import { parseArguments } from "@mailwoman/core/scripting/arguments"
|
|
15
|
-
import { createWOFResolver } from "@mailwoman/resolver"
|
|
16
14
|
import {
|
|
17
15
|
corsBannerLine,
|
|
18
16
|
gazetteerBannerLines,
|
|
19
|
-
loadClassifierOrExit,
|
|
20
17
|
openAPICommand,
|
|
21
|
-
|
|
18
|
+
readListenPort,
|
|
22
19
|
runDropInCLI,
|
|
23
20
|
} from "mailwoman/cli/kit/dropin"
|
|
24
21
|
import type { ResolvedEngineStamp } from "mailwoman/cli/kit/engine-stamp"
|
|
25
|
-
import { geocodeAddress, USStateDatabaseProvider } from "mailwoman/geocode"
|
|
26
|
-
import { openServingRooftopProviders } from "mailwoman/geocode/serving-layers"
|
|
27
|
-
import { createResolverBackend } from "mailwoman/resolver-backend"
|
|
28
22
|
import { titleCase } from "spliterator"
|
|
29
23
|
|
|
24
|
+
import { openPhotonGeocoder } from "#cli/geocoder"
|
|
30
25
|
import {
|
|
31
26
|
createPhotonApp,
|
|
32
27
|
PHOTON_DOC_INFO,
|
|
@@ -75,47 +70,25 @@ async function serve(engineStamp: ResolvedEngineStamp): Promise<void> {
|
|
|
75
70
|
allowPositionals: true,
|
|
76
71
|
})
|
|
77
72
|
|
|
78
|
-
const port =
|
|
73
|
+
const port = readListenPort(values.port)
|
|
79
74
|
const host = values.host ?? "0.0.0.0"
|
|
80
75
|
|
|
81
|
-
const
|
|
82
|
-
const gazetteer = await
|
|
83
|
-
const { adminDBPath
|
|
84
|
-
const classifier = await loadClassifierOrExit()
|
|
85
|
-
|
|
86
|
-
const backend = await createResolverBackend(resolverMod, { wofPaths, candidateDB })
|
|
87
|
-
const resolver = createWOFResolver(backend)
|
|
88
|
-
const extracts = await USStateDatabaseProvider.create(resolverMod, dataRootPath())
|
|
76
|
+
const { WOFReverseGeocoder } = await import("@mailwoman/resolver-wof-sqlite")
|
|
77
|
+
const { gazetteer, geocode } = await openPhotonGeocoder(values["candidate-db"] ?? null)
|
|
78
|
+
const { adminDBPath } = gazetteer
|
|
89
79
|
const postcodeOfLocality = await createLocalityPostcodeLookup()
|
|
90
|
-
|
|
91
|
-
// a no-op when the extract is absent.
|
|
92
|
-
// Both read one generation of the active selection, else their conventional paths.
|
|
93
|
-
const rooftops = await openServingRooftopProviders(dataRootPath())
|
|
94
|
-
const banExtracts = rooftops.national
|
|
95
|
-
const osmExtracts = rooftops.osm
|
|
96
|
-
const reverseGeo = adminDBPath ? new resolverMod.WOFReverseGeocoder({ adminDBPath }) : null
|
|
80
|
+
const reverseGeo = adminDBPath ? new WOFReverseGeocoder({ adminDBPath }) : null
|
|
97
81
|
|
|
98
82
|
const engine: PhotonEngine = {
|
|
99
83
|
async search(params) {
|
|
100
84
|
const query = params.q?.trim()
|
|
101
85
|
|
|
102
86
|
if (!query || query.length > MAX_QUERY_LEN) return photonCollection([])
|
|
103
|
-
// Forward the client's viewport as a proximity bias
|
|
104
|
-
// folds into candidate scoring, only when both
|
|
87
|
+
// Forward the client's viewport as a proximity bias and apply a soft re-rank that
|
|
88
|
+
// the resolver folds into candidate scoring, only when both coordinates are present.
|
|
105
89
|
const bias = params.lat != null && params.lon != null ? [{ lat: params.lat, lon: params.lon }] : undefined
|
|
106
90
|
|
|
107
|
-
|
|
108
|
-
// A hard-coded `US` value here would resolve every non-US query to its US namesake.
|
|
109
|
-
const result = await geocodeAddress(query, {
|
|
110
|
-
classifier,
|
|
111
|
-
resolver,
|
|
112
|
-
databases: extracts.for,
|
|
113
|
-
nationalDatabases: banExtracts.for,
|
|
114
|
-
...(osmExtracts ? { osmDatabases: osmExtracts.for } : {}),
|
|
115
|
-
bias,
|
|
116
|
-
// Photon is an autocomplete front where a human types fragments.
|
|
117
|
-
inputMode: "fragmented",
|
|
118
|
-
})
|
|
91
|
+
const result = await geocode(query, bias)
|
|
119
92
|
|
|
120
93
|
if (result.lat == null || result.lon == null) return photonCollection([])
|
|
121
94
|
// Decorate from the resolved place using proper-cased ancestry names,
|
|
@@ -217,8 +190,8 @@ async function serve(engineStamp: ResolvedEngineStamp): Promise<void> {
|
|
|
217
190
|
fetch: app.fetch,
|
|
218
191
|
port,
|
|
219
192
|
hostname: host,
|
|
220
|
-
onListen: () => {
|
|
221
|
-
console.error(`[@mailwoman/photon] listening on http://${host}:${port}`)
|
|
193
|
+
onListen: (info) => {
|
|
194
|
+
console.error(`[@mailwoman/photon] listening on http://${host}:${info.port}`)
|
|
222
195
|
|
|
223
196
|
for (const line of gazetteerBannerLines(gazetteer)) {
|
|
224
197
|
console.error(line)
|
package/lib/engine.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* The Photon engine interface + wire types the router delegates to.
|
|
6
6
|
*
|
|
7
7
|
* Feature/collection construction lives here too (`photonFeature`, `photonCollection`)
|
|
8
|
-
* since every projection builds on them.
|
|
9
|
-
* projection itself lives in `projection.ts`.
|
|
8
|
+
* since every projection builds on them.
|
|
9
|
+
* The resolved-place → {@link PhotonProperties} projection itself lives in `projection.ts`.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import type { CoordinateSource } from "@mailwoman/core/geocode"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The forward geocoder behind `mailwoman-photon serve`: the data layers the server
|
|
3
|
+
* composes, and the geocode of one query through its session.
|
|
4
|
+
*
|
|
5
|
+
* The module is separate from `main.ts` because that file runs the command line when it loads.
|
|
6
|
+
*/
|
|
7
|
+
import type { GeocodeResult } from "@mailwoman/core/geocode";
|
|
8
|
+
import { type DropInGeocoder } from "mailwoman/cli/kit/dropin";
|
|
9
|
+
import type { GeocodeRequestOptions } from "mailwoman/geocode/session";
|
|
10
|
+
/**
|
|
11
|
+
* What `mailwoman-photon serve` opens to answer `/api`.
|
|
12
|
+
*/
|
|
13
|
+
export interface PhotonGeocoder extends DropInGeocoder {
|
|
14
|
+
/**
|
|
15
|
+
* Geocodes one query as a fragment a person is typing, preferring candidates near `bias`.
|
|
16
|
+
*/
|
|
17
|
+
geocode(query: string, bias?: GeocodeRequestOptions["bias"]): Promise<GeocodeResult>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Opens the gazetteer and the server's session, and ends the process when either is unavailable.
|
|
21
|
+
*
|
|
22
|
+
* @param candidateDBFlag The `--candidate-db` value, or `null` to read the conventional path.
|
|
23
|
+
*/
|
|
24
|
+
export declare function openPhotonGeocoder(candidateDBFlag: string | null): Promise<PhotonGeocoder>;
|
|
25
|
+
//# sourceMappingURL=geocoder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geocoder.d.ts","sourceRoot":"","sources":["../../cli/geocoder.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,KAAK,cAAc,EAAsB,MAAM,0BAA0B,CAAA;AAElF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAmBtE;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,cAAc;IACrD;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,qBAAqB,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;CACpF;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,CAShG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
import { openDropInGeocoder } from "mailwoman/cli/kit/dropin";
|
|
4
|
+
import { banLayer, forkEntityProbe, observationRoutes, osmLayer, regionDatabases } from "mailwoman/services/entry/node";
|
|
5
|
+
/**
|
|
6
|
+
* The data layers Photon composes.
|
|
7
|
+
*
|
|
8
|
+
* The server consults the national open register (BAN) and then the OpenStreetMap tier.
|
|
9
|
+
* It leaves national Overture out.
|
|
10
|
+
*
|
|
11
|
+
* That order is the one it had before the active selection existed.
|
|
12
|
+
*/
|
|
13
|
+
const PHOTON_LAYERS = [
|
|
14
|
+
banLayer,
|
|
15
|
+
osmLayer,
|
|
16
|
+
regionDatabases,
|
|
17
|
+
forkEntityProbe,
|
|
18
|
+
observationRoutes,
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* Opens the gazetteer and the server's session, and ends the process when either is unavailable.
|
|
22
|
+
*
|
|
23
|
+
* @param candidateDBFlag The `--candidate-db` value, or `null` to read the conventional path.
|
|
24
|
+
*/
|
|
25
|
+
export async function openPhotonGeocoder(candidateDBFlag) {
|
|
26
|
+
const opened = await openDropInGeocoder(candidateDBFlag, PHOTON_LAYERS);
|
|
27
|
+
return {
|
|
28
|
+
...opened,
|
|
29
|
+
// Photon is an autocomplete front where a human types fragments.
|
|
30
|
+
geocode: async (query, bias) => (await opened.session.geocode(query, { inputMode: "fragmented", ...(bias ? { bias } : {}) })).result,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=geocoder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geocoder.js","sourceRoot":"","sources":["../../cli/geocoder.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAUlE,OAAO,EAAuB,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAGlF,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAEvH;;;;;;;GAOG;AACH,MAAM,aAAa,GAAiC;IACnD,QAAQ;IACR,QAAQ;IACR,eAAe;IACf,eAAe;IACf,iBAAiB;CACjB,CAAA;AAYD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,eAA8B;IACtE,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,eAAe,EAAE,aAAa,CAAC,CAAA;IAEvE,OAAO;QACN,GAAG,MAAM;QACT,iEAAiE;QACjE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAC9B,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;KACrG,CAAA;AACF,CAAC"}
|
package/out/cli/main.js
CHANGED
|
@@ -8,14 +8,10 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { serveNode } from "@mailwoman/api-kit";
|
|
10
10
|
import { matchCountry } from "@mailwoman/codex/country";
|
|
11
|
-
import { dataRootPath } from "@mailwoman/core/data-root";
|
|
12
11
|
import { parseArguments } from "@mailwoman/core/scripting/arguments";
|
|
13
|
-
import {
|
|
14
|
-
import { corsBannerLine, gazetteerBannerLines, loadClassifierOrExit, openAPICommand, resolveGazetteerOrExit, runDropInCLI, } from "mailwoman/cli/kit/dropin";
|
|
15
|
-
import { geocodeAddress, USStateDatabaseProvider } from "mailwoman/geocode";
|
|
16
|
-
import { openServingRooftopProviders } from "mailwoman/geocode/serving-layers";
|
|
17
|
-
import { createResolverBackend } from "mailwoman/resolver-backend";
|
|
12
|
+
import { corsBannerLine, gazetteerBannerLines, openAPICommand, readListenPort, runDropInCLI, } from "mailwoman/cli/kit/dropin";
|
|
18
13
|
import { titleCase } from "spliterator";
|
|
14
|
+
import { openPhotonGeocoder } from "#cli/geocoder";
|
|
19
15
|
import { createPhotonApp, PHOTON_DOC_INFO, photonCollection, photonFeature, photonForwardCollection, photonOSMTags, } from "#index";
|
|
20
16
|
import { createLocalityPostcodeLookup } from "#locality-postcode";
|
|
21
17
|
/**
|
|
@@ -49,43 +45,22 @@ async function serve(engineStamp) {
|
|
|
49
45
|
allowNegative: true,
|
|
50
46
|
allowPositionals: true,
|
|
51
47
|
});
|
|
52
|
-
const port =
|
|
48
|
+
const port = readListenPort(values.port);
|
|
53
49
|
const host = values.host ?? "0.0.0.0";
|
|
54
|
-
const
|
|
55
|
-
const gazetteer = await
|
|
56
|
-
const { adminDBPath
|
|
57
|
-
const classifier = await loadClassifierOrExit();
|
|
58
|
-
const backend = await createResolverBackend(resolverMod, { wofPaths, candidateDB });
|
|
59
|
-
const resolver = createWOFResolver(backend);
|
|
60
|
-
const extracts = await USStateDatabaseProvider.create(resolverMod, dataRootPath());
|
|
50
|
+
const { WOFReverseGeocoder } = await import("@mailwoman/resolver-wof-sqlite");
|
|
51
|
+
const { gazetteer, geocode } = await openPhotonGeocoder(values["candidate-db"] ?? null);
|
|
52
|
+
const { adminDBPath } = gazetteer;
|
|
61
53
|
const postcodeOfLocality = await createLocalityPostcodeLookup();
|
|
62
|
-
|
|
63
|
-
// a no-op when the extract is absent.
|
|
64
|
-
// Both read one generation of the active selection, else their conventional paths.
|
|
65
|
-
const rooftops = await openServingRooftopProviders(dataRootPath());
|
|
66
|
-
const banExtracts = rooftops.national;
|
|
67
|
-
const osmExtracts = rooftops.osm;
|
|
68
|
-
const reverseGeo = adminDBPath ? new resolverMod.WOFReverseGeocoder({ adminDBPath }) : null;
|
|
54
|
+
const reverseGeo = adminDBPath ? new WOFReverseGeocoder({ adminDBPath }) : null;
|
|
69
55
|
const engine = {
|
|
70
56
|
async search(params) {
|
|
71
57
|
const query = params.q?.trim();
|
|
72
58
|
if (!query || query.length > MAX_QUERY_LEN)
|
|
73
59
|
return photonCollection([]);
|
|
74
|
-
// Forward the client's viewport as a proximity bias
|
|
75
|
-
// folds into candidate scoring, only when both
|
|
60
|
+
// Forward the client's viewport as a proximity bias and apply a soft re-rank that
|
|
61
|
+
// the resolver folds into candidate scoring, only when both coordinates are present.
|
|
76
62
|
const bias = params.lat != null && params.lon != null ? [{ lat: params.lat, lon: params.lon }] : undefined;
|
|
77
|
-
|
|
78
|
-
// A hard-coded `US` value here would resolve every non-US query to its US namesake.
|
|
79
|
-
const result = await geocodeAddress(query, {
|
|
80
|
-
classifier,
|
|
81
|
-
resolver,
|
|
82
|
-
databases: extracts.for,
|
|
83
|
-
nationalDatabases: banExtracts.for,
|
|
84
|
-
...(osmExtracts ? { osmDatabases: osmExtracts.for } : {}),
|
|
85
|
-
bias,
|
|
86
|
-
// Photon is an autocomplete front where a human types fragments.
|
|
87
|
-
inputMode: "fragmented",
|
|
88
|
-
});
|
|
63
|
+
const result = await geocode(query, bias);
|
|
89
64
|
if (result.lat == null || result.lon == null)
|
|
90
65
|
return photonCollection([]);
|
|
91
66
|
// Decorate from the resolved place using proper-cased ancestry names,
|
|
@@ -167,8 +142,8 @@ async function serve(engineStamp) {
|
|
|
167
142
|
fetch: app.fetch,
|
|
168
143
|
port,
|
|
169
144
|
hostname: host,
|
|
170
|
-
onListen: () => {
|
|
171
|
-
console.error(`[@mailwoman/photon] listening on http://${host}:${port}`);
|
|
145
|
+
onListen: (info) => {
|
|
146
|
+
console.error(`[@mailwoman/photon] listening on http://${host}:${info.port}`);
|
|
172
147
|
for (const line of gazetteerBannerLines(gazetteer)) {
|
|
173
148
|
console.error(line);
|
|
174
149
|
}
|
package/out/cli/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../cli/main.ts"],"names":[],"mappings":";AACA,kEAAkE;AAClE,kEAAkE;AAElE;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../cli/main.ts"],"names":[],"mappings":";AACA,kEAAkE;AAClE,kEAAkE;AAElE;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,EACN,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,YAAY,GACZ,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EACN,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EAEvB,aAAa,GAGb,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAA;AAEjE;;GAEG;AACH,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AC,IAAI,EAAE,EAAE;YAClB,OAAO,CAAC,KAAK,CAAC,2CAA2C,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;YAE7E,KAAK,MAAM,IAAI,IAAI,oBAAoB,CAAC,SAAS,CAAC,EAAE,CAAC;gBACpD,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YACpB,CAAC;YAED,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;YAC1C,OAAO,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAA;QAC/E,CAAC;KACD,CAAC,CAAA;AACH,CAAC;AAED,MAAM,YAAY,CAAC;IAClB,UAAU,EAAE,WAAW;IACvB,OAAO,EAAE,cAAc,CAAC,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,EAAE,CAAC;IAC1E,KAAK;IACL,KAAK,EAAE;QACN,4EAA4E;QAC5E,6CAA6C;KAC7C;CACD,CAAC,CAAA"}
|
package/out/engine.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* The Photon engine interface + wire types the router delegates to.
|
|
3
3
|
*
|
|
4
4
|
* Feature/collection construction lives here too (`photonFeature`, `photonCollection`)
|
|
5
|
-
* since every projection builds on them.
|
|
6
|
-
* projection itself lives in `projection.ts`.
|
|
5
|
+
* since every projection builds on them.
|
|
6
|
+
* The resolved-place → {@link PhotonProperties} projection itself lives in `projection.ts`.
|
|
7
7
|
*/
|
|
8
8
|
import type { CoordinateSource } from "@mailwoman/core/geocode";
|
|
9
9
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/photon",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.0",
|
|
4
4
|
"description": "Photon drop-in — a Photon-compatible autocomplete/type-ahead geocoding API (GeoJSON FeatureCollection over /api + /reverse) on the Mailwoman engine. Run it with `npx @mailwoman/photon serve`.",
|
|
5
5
|
"license": "AGPL-3.0-only OR LicenseRef-Commercial",
|
|
6
6
|
"repository": {
|
|
@@ -87,18 +87,17 @@
|
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@hono/zod-openapi": "^1.6.3",
|
|
90
|
-
"@mailwoman/annotations": "11.
|
|
91
|
-
"@mailwoman/api-kit": "11.
|
|
92
|
-
"@mailwoman/codex": "11.
|
|
93
|
-
"@mailwoman/core": "11.
|
|
94
|
-
"@mailwoman/gazetteer": "11.
|
|
95
|
-
"@mailwoman/neural": "11.
|
|
96
|
-
"@mailwoman/neural-weights-en-us": "11.
|
|
97
|
-
"@mailwoman/resolver": "11.
|
|
98
|
-
"@mailwoman/
|
|
99
|
-
"@mailwoman/sqlite": "11.1.0",
|
|
90
|
+
"@mailwoman/annotations": "11.3.0",
|
|
91
|
+
"@mailwoman/api-kit": "11.3.0",
|
|
92
|
+
"@mailwoman/codex": "11.3.0",
|
|
93
|
+
"@mailwoman/core": "11.3.0",
|
|
94
|
+
"@mailwoman/gazetteer": "11.3.0",
|
|
95
|
+
"@mailwoman/neural": "11.3.0",
|
|
96
|
+
"@mailwoman/neural-weights-en-us": "11.3.0",
|
|
97
|
+
"@mailwoman/resolver-wof-sqlite": "11.3.0",
|
|
98
|
+
"@mailwoman/sqlite": "11.3.0",
|
|
100
99
|
"hono": "^4.13.14",
|
|
101
|
-
"mailwoman": "11.
|
|
100
|
+
"mailwoman": "11.3.0",
|
|
102
101
|
"zod": "^4.6.7"
|
|
103
102
|
}
|
|
104
103
|
}
|