@mailwoman/photon 10.0.0 → 10.2.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.
Files changed (45) hide show
  1. package/README.md +2 -2
  2. package/{lib/cli.ts → cli/main.ts} +42 -56
  3. package/lib/app.ts +12 -34
  4. package/lib/engine.ts +21 -13
  5. package/lib/index.ts +6 -11
  6. package/lib/locality-postcode.ts +13 -17
  7. package/lib/projection.ts +61 -56
  8. package/lib/routes.ts +14 -26
  9. package/lib/schema.ts +31 -24
  10. package/out/app.d.ts +6 -28
  11. package/out/app.d.ts.map +1 -1
  12. package/out/app.js +5 -12
  13. package/out/app.js.map +1 -1
  14. package/out/cli/main.d.ts +12 -0
  15. package/out/cli/main.d.ts.map +1 -0
  16. package/out/{cli.js → cli/main.js} +42 -56
  17. package/out/cli/main.js.map +1 -0
  18. package/out/engine.d.ts +21 -13
  19. package/out/engine.d.ts.map +1 -1
  20. package/out/engine.js +2 -2
  21. package/out/engine.js.map +1 -1
  22. package/out/index.d.ts +6 -11
  23. package/out/index.d.ts.map +1 -1
  24. package/out/index.js +6 -11
  25. package/out/index.js.map +1 -1
  26. package/out/locality-postcode.d.ts +5 -8
  27. package/out/locality-postcode.d.ts.map +1 -1
  28. package/out/locality-postcode.js +11 -15
  29. package/out/locality-postcode.js.map +1 -1
  30. package/out/projection.d.ts +48 -38
  31. package/out/projection.d.ts.map +1 -1
  32. package/out/projection.js +38 -36
  33. package/out/projection.js.map +1 -1
  34. package/out/routes.d.ts +2 -2
  35. package/out/routes.d.ts.map +1 -1
  36. package/out/routes.js +13 -25
  37. package/out/routes.js.map +1 -1
  38. package/out/schema.d.ts +31 -24
  39. package/out/schema.d.ts.map +1 -1
  40. package/out/schema.js +31 -24
  41. package/out/schema.js.map +1 -1
  42. package/package.json +49 -33
  43. package/out/cli.d.ts +0 -17
  44. package/out/cli.d.ts.map +0 -1
  45. package/out/cli.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3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AAG,IAAI,CAAA;IACjE;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAA;CACxC;AA0CD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,cAAc,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAI1G;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,kBAAkB,GAAG,gBAAgB,CAqDnF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,kBAAkB,GAAG,aAAa,CAE7E;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,OAAO,EAAE,kBAAkB,CAAA;IAC3B;;;OAGG;IACH,YAAY,EAAE,kBAAkB,EAAE,CAAA;CAClC;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,GAAG,uBAAuB,CAU3G;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,aAAa,GAAG,cAAc,CAe/E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,uBAAuB,GAAG,cAAc,EAAE,CAEvF"}
package/out/projection.js CHANGED
@@ -3,34 +3,34 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * The RESOLVED-place → Photon-schema projection: decorating a resolved gazetteer place (proper-
7
- * cased names + ancestry + country, house/street grade overrides) into {@link PhotonProperties},
8
- * plus the `format=jsonld` schema.org re-serialization. Wire types + feature/collection
9
- * construction live in `engine.ts`.
6
+ * The resolved-place → Photon-schema projection: decorating a resolved gazetteer place (proper-
7
+ * cased names, ancestry, country, house and street grade overrides) into {@link PhotonProperties},
8
+ * plus the `format=jsonld` schema.org re-serialization.
10
9
  */
11
10
  import { composeStreetAddress, toSchemaOrg } from "@mailwoman/annotations";
12
11
  import { photonCollection, photonFeature, } from "#engine";
13
12
  /**
14
- * How a resolved tag projects onto Photon's schema: the property key that holds its name, plus the OSM `key`/`value`/
15
- * `type` a Photon client reads. Kept close to komoot Photon's own values so client label-builders behave.
13
+ * How a resolved tag projects onto Photon's schema: the property key that holds its name,
14
+ * plus the OSM `key`/`value`/ `type` a Photon client reads.
15
+ *
16
+ * Kept close to komoot Photon's own values so client label-builders behave.
16
17
  */
17
18
  const FORWARD_TAG_PROJECTION = {
18
19
  venue: { key: "name", osmKey: "amenity", osmValue: "yes", type: "house" },
19
20
  house: { key: "name", osmKey: "building", osmValue: "yes", type: "house" },
20
21
  street: { key: "street", osmKey: "highway", osmValue: "residential", type: "street" },
21
22
  neighbourhood: { key: "district", osmKey: "place", osmValue: "suburb", type: "district" },
22
- // The finest tier the /reverse descent ladder (resolver-wof-sqlite `DESCENT_TIERS`) can return — without a row
23
- // here a microhood-deepest reverse result fell through to the `place/yes/other` default. #1041 close-out.
23
+ // The finest tier the /reverse descent ladder (resolver-wof-sqlite `DESCENT_TIERS`) can return.
24
24
  microhood: { key: "district", osmKey: "place", osmValue: "neighbourhood", type: "district" },
25
25
  dependent_locality: { key: "district", osmKey: "place", osmValue: "suburb", type: "district" },
26
26
  borough: { key: "district", osmKey: "place", osmValue: "borough", type: "district" },
27
27
  locality: { key: "city", osmKey: "place", osmValue: "city", type: "city" },
28
- // The JP tiers the character-path model emits (#2164): a municipality is Photon's city, a prefecture its state, a
29
- // district (大字 / 町名) its district — the same keys Nominatim assigns those ranks.
28
+ // The JP tiers the character-path model emits: a municipality is Photon's city, a prefecture
29
+ // its state, a district (大字 / 町名) its district, the same keys Nominatim assigns those ranks.
30
30
  municipality: { key: "city", osmKey: "place", osmValue: "city", type: "city" },
31
31
  prefecture: { key: "state", osmKey: "place", osmValue: "state", type: "state" },
32
32
  district: { key: "district", osmKey: "place", osmValue: "suburb", type: "district" },
33
- // WOF placetypes the /reverse hierarchy uses (so both endpoints derive osm tags from ONE table).
33
+ // WOF placetypes the /reverse hierarchy uses (so both endpoints derive osm tags from one table).
34
34
  localadmin: { key: "city", osmKey: "place", osmValue: "city", type: "city" },
35
35
  subregion: { key: "county", osmKey: "place", osmValue: "county", type: "county" },
36
36
  county: { key: "county", osmKey: "place", osmValue: "county", type: "county" },
@@ -39,25 +39,29 @@ const FORWARD_TAG_PROJECTION = {
39
39
  country: { key: "country", osmKey: "place", osmValue: "country", type: "country" },
40
40
  };
41
41
  /**
42
- * Fallback OSM tags — a Photon client reads `osm_key`/`osm_value`/`type` unconditionally, so they must never be absent.
42
+ * Fallback OSM tags.
43
+ *
44
+ * A Photon client reads `osm_key`/`osm_value`/`type` unconditionally, so they must never be absent.
43
45
  */
44
46
  const DEFAULT_OSM_TAGS = { osm_key: "place", osm_value: "yes", type: "other" };
45
47
  /**
46
- * The Photon `osm_key`/`osm_value`/`type` for a resolved tag or WOF placetype (`locality`, `region`, `country`, …),
47
- * falling back to a safe default so the fields are always present. Shared by the forward projection and `/reverse` so
48
- * the two endpoints report a place the SAME way. #1014.
48
+ * The Photon `osm_key`/`osm_value`/`type` for a resolved tag or WOF placetype
49
+ * (`locality`, `region`, `country`, …), falling back to a safe default so the fields are always present.
50
+ *
51
+ * Shared by the forward projection and `/reverse` so the two endpoints report a place the same way.
49
52
  */
50
53
  export function photonOSMTags(tagOrPlacetype) {
51
54
  const proj = FORWARD_TAG_PROJECTION[tagOrPlacetype];
52
55
  return proj ? { osm_key: proj.osmKey, osm_value: proj.osmValue, type: proj.type } : { ...DEFAULT_OSM_TAGS };
53
56
  }
54
57
  /**
55
- * Project a resolved forward result into Photon properties — decorating from the RESOLVED gazetteer place (proper-cased
56
- * names + ancestry + country), NOT the parsed input span, and ALWAYS emitting `osm_key`/`osm_value`/`type` so Photon
57
- * client libraries (leaflet-control-geocoder, @openrunner/photon-geocoder) never dereference undefined. #1014.
58
+ * Project a resolved forward result into Photon properties, decorating from the resolved
59
+ * gazetteer place (proper-cased names, ancestry, country) rather than the parsed input span.
60
+ *
61
+ * Always emit `osm_key`/`osm_value`/`type` so Photon client libraries
62
+ * (leaflet-control-geocoder, @openrunner/photon-geocoder) never dereference undefined.
58
63
  */
59
64
  export function photonForwardProperties(input) {
60
- // Safe defaults: a Photon client reads osm_key/osm_value/type unconditionally, so they must never be undefined.
61
65
  const props = { ...DEFAULT_OSM_TAGS };
62
66
  const [primary] = input.places;
63
67
  if (primary) {
@@ -73,24 +77,17 @@ export function photonForwardProperties(input) {
73
77
  if (input.postcode) {
74
78
  props.postcode = input.postcode;
75
79
  }
76
- if (input.country?.name && props.country == null) {
80
+ if (input.country?.name && !props.country) {
77
81
  props.country = input.country.name;
78
82
  }
79
83
  if (input.country?.code) {
80
84
  props.countrycode = input.country.code.toLowerCase();
81
85
  }
82
- // #1041: house-grade override. A rooftop / interpolated coordinate is a BUILDING, not the admin locality the
83
- // ancestry above would label it — re-tag the schema so a Photon client renders (and zooms to) a house, and surface
84
- // the parsed housenumber + street. Matches upstream komoot/photon's bare address point (osm_key:place, osm_value:
85
- // house, type:house, with housenumber + street and NO name). Drop the admin-derived `name` — else the QGIS FLF label
86
- // (name + housenumber + street + city + postcode) doubles the city ("Paris 8 Boulevard du Palais Paris 75001"). The
87
- // city/state/postcode/country the ancestry filled stay put (upstream carries them on a house result too).
88
- // #1050: street-grade — the street-centroid tier fired. Re-tag per upstream's street shape (full
89
- // name in `name`, highway/street osm tags); the admin ancestry (city/state/…) stays as context.
90
86
  if (input.street?.name && !input.house) {
91
87
  props.name = input.street.name;
92
88
  Object.assign(props, { osm_key: "highway", osm_value: "residential", type: "street" });
93
89
  }
90
+ // Drop the admin-derived `name`, or a QGIS FLF label doubles the city.
94
91
  if (input.house) {
95
92
  props.osm_key = "place";
96
93
  props.osm_value = "house";
@@ -108,14 +105,16 @@ export function photonForwardProperties(input) {
108
105
  return props;
109
106
  }
110
107
  /**
111
- * {@link photonForwardProperties}, wrapped as a Photon Point `Feature` at the resolved coordinate. #1014.
108
+ * {@link photonForwardProperties}, wrapped as a Photon Point `Feature` at the resolved coordinate.
112
109
  */
113
110
  export function photonForwardFeature(input) {
114
111
  return photonFeature(input.lon, input.lat, photonForwardProperties(input));
115
112
  }
116
113
  /**
117
- * Assemble a Photon `FeatureCollection` honoring `limit` (#1016): the primary feature first, then ranked alternatives,
118
- * capped at `limit`. `limit` floors to 1 (Photon always returns at least the best match).
114
+ * Assemble a Photon `FeatureCollection` honoring `limit`: the primary feature first,
115
+ * then ranked alternatives, capped at `limit`.
116
+ *
117
+ * `limit` floors to 1, since Photon always returns at least the best match.
119
118
  */
120
119
  export function photonForwardCollection(result, limit) {
121
120
  const cap = Math.max(1, Math.floor(limit) || 1);
@@ -128,10 +127,13 @@ export function photonForwardCollection(result, limit) {
128
127
  return photonCollection(features);
129
128
  }
130
129
  /**
131
- * Project a Photon `Feature` into a schema.org `Place` JSON-LD object (`format=jsonld`, #1052) — the OUTPUT-format
132
- * projection. Reads the feature's already-decorated {@link PhotonProperties} (housenumber/street/city/state/postcode/
133
- * countrycode + the coordinate), so it stays a pure re-serialization of the SAME resolved place the FeatureCollection
134
- * carries. `streetAddress` is the plain house-number-first join (the light router has no locale formatter).
130
+ * Project a Photon `Feature` into a schema.org `Place` JSON-LD object (`format=jsonld`),
131
+ * the output-format projection.
132
+ *
133
+ * Reads the feature's already-decorated {@link PhotonProperties}
134
+ * (housenumber/street/city/state/postcode/countrycode and the coordinate), so it stays a
135
+ * pure re-serialization of the same resolved place included in the FeatureCollection.
136
+ * `streetAddress` is the plain house-number-first join, since the light router has no locale formatter.
135
137
  */
136
138
  export function photonFeatureToSchemaOrg(feature) {
137
139
  const p = feature.properties;
@@ -149,7 +151,7 @@ export function photonFeatureToSchemaOrg(feature) {
149
151
  });
150
152
  }
151
153
  /**
152
- * Project a whole Photon `FeatureCollection` into an array of schema.org `Place` objects (`format=jsonld`). #1052.
154
+ * Project a whole Photon `FeatureCollection` into an array of schema.org `Place` objects (`format=jsonld`).
153
155
  */
154
156
  export function photonToSchemaOrg(collection) {
155
157
  return collection.features.map(photonFeatureToSchemaOrg);
@@ -1 +1 @@
1
- {"version":3,"file":"projection.js","sourceRoot":"","sources":["../lib/projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,oBAAoB,EAAuB,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAE/F,OAAO,EAGN,gBAAgB,EAChB,aAAa,GAEb,MAAM,SAAS,CAAA;AAyChB;;;GAGG;AACH,MAAM,sBAAsB,GAGxB;IACH,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE;IACzE,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE;IAC1E,MAAM,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE;IACrF,aAAa,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE;IACzF,+GAA+G;IAC/G,0GAA0G;IAC1G,SAAS,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,EAAE;IAC5F,kBAAkB,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE;IAC9F,OAAO,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,E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AW,CAAA;IAC/C,MAAM,aAAa,GAAG,oBAAoB,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAA;IAE5F,OAAO,WAAW,CAAC;QAClB,GAAG;QACH,GAAG;QACH,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,aAAa,EAAE,aAAa,IAAI,SAAS;QACzC,QAAQ,EAAE,CAAC,CAAC,IAAI;QAChB,MAAM,EAAE,CAAC,CAAC,KAAK;QACf,UAAU,EAAE,CAAC,CAAC,QAAQ;QACtB,WAAW,EAAE,CAAC,CAAC,WAAW;KAC1B,CAAC,CAAA;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAmC;IACpE,OAAO,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;AACzD,CAAC"}
package/out/routes.d.ts CHANGED
@@ -4,8 +4,8 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
6
  * Route definitions + handlers for the Photon-compatible surface. The OpenAPI document is
7
- * emitted from these definitions — no handwritten spec. Handlers parse params from the
8
- * `legacyQuery` express-shaped view; the zod query schemas drive only the emitted document.
7
+ * emitted from these definitions, so no handwritten spec exists. Handlers parse params from
8
+ * the `legacyQuery` express-shaped view. The zod query schemas drive only the emitted document.
9
9
  */
10
10
  import { type OpenAPIHono } from "@hono/zod-openapi";
11
11
  import type { EngineStamp } from "@mailwoman/core/license";
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../lib/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAe,KAAK,WAAW,EAAK,MAAM,mBAAmB,CAAA;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAoE,MAAM,SAAS,CAAA;AAqH7G;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CA6DtG"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../lib/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAe,KAAK,WAAW,EAAK,MAAM,mBAAmB,CAAA;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAoE,MAAM,SAAS,CAAA;AAyG7G;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CA6DtG"}
package/out/routes.js CHANGED
@@ -4,28 +4,16 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
6
  * Route definitions + handlers for the Photon-compatible surface. The OpenAPI document is
7
- * emitted from these definitions — no handwritten spec. Handlers parse params from the
8
- * `legacyQuery` express-shaped view; the zod query schemas drive only the emitted document.
7
+ * emitted from these definitions, so no handwritten spec exists. Handlers parse params from
8
+ * the `legacyQuery` express-shaped view. The zod query schemas drive only the emitted document.
9
9
  */
10
10
  import { createRoute, z } from "@hono/zod-openapi";
11
11
  import { asString, legacyQuery, withEngineStamp } from "@mailwoman/api-kit";
12
12
  import { photonToSchemaOrg } from "#projection";
13
13
  import { PhotonMessageCollectionSchema, PhotonResponseSchema, reverseQueryParams, searchQueryParams } from "#schema";
14
- /**
15
- * Southern limit of latitude in WGS-84 degrees.
16
- */
17
14
  const MIN_LATITUDE = -90;
18
- /**
19
- * Northern limit of latitude in WGS-84 degrees.
20
- */
21
15
  const MAX_LATITUDE = 90;
22
- /**
23
- * Western limit of longitude in WGS-84 degrees.
24
- */
25
16
  const MIN_LONGITUDE = -180;
26
- /**
27
- * Eastern limit of longitude in WGS-84 degrees.
28
- */
29
17
  const MAX_LONGITUDE = 180;
30
18
  const DEFAULT_LIMIT = 15;
31
19
  const EMPTY = { type: "FeatureCollection", features: [] };
@@ -33,13 +21,13 @@ function asStringArray(raw) {
33
21
  if (Array.isArray(raw))
34
22
  return raw.filter((v) => typeof v === "string");
35
23
  const s = asString(raw);
36
- return s ? [s] : undefined;
24
+ return s ? [s] : null;
37
25
  }
38
26
  /**
39
- * A friendly HTML landing page for `GET /` (#1022). Upstream komoot/photon serves no root page, so there's no wire
40
- * contract to match — this is pure courtesy: a browser visitor (or an evaluator kicking the tires) who pastes the bare
41
- * host in gets a one-glance orientation with clickable example queries instead of Express's `Cannot GET /` 404, which
42
- * reads as "the service is broken". Relative example URLs so they resolve against whatever host/port serves this.
27
+ * A friendly html landing page for `GET /`.
28
+ *
29
+ * Upstream komoot/photon serves no root page, so there is no wire interface to match.
30
+ * Relative example URLs resolve against whatever host and port serve this.
43
31
  */
44
32
  const ROOT_HTML = `<!doctype html>
45
33
  <html lang="en">
@@ -61,7 +49,7 @@ footer { margin-top: 2rem; font-size: .9rem; opacity: .8 }
61
49
  </head>
62
50
  <body>
63
51
  <h1>@mailwoman/photon</h1>
64
- <p>A Photon-compatible autocomplete geocoding API — the same <code>/api</code> and <code>/reverse</code> contract, served from a SQLite gazetteer instead of an Elasticsearch cluster.</p>
52
+ <p>A Photon-compatible autocomplete geocoding API — the same <code>/api</code> and <code>/reverse</code> interface, served from a SQLite gazetteer instead of an Elasticsearch cluster.</p>
65
53
  <p>Try a query:</p>
66
54
  <ul>
67
55
  <li><a class="q" href="/api?q=berlin&amp;limit=3">/api?q=berlin&amp;limit=3</a></li>
@@ -127,13 +115,13 @@ export function registerPhotonRoutes(app, engine, stamp) {
127
115
  q: query,
128
116
  limit: Number(q["limit"] ?? DEFAULT_LIMIT) || DEFAULT_LIMIT,
129
117
  lang: asString(q["lang"]),
130
- lat: q["lat"] != null ? Number(q["lat"]) : undefined,
131
- lon: q["lon"] != null ? Number(q["lon"]) : undefined,
118
+ lat: q["lat"] ? Number(q["lat"]) : undefined,
119
+ lon: q["lon"] ? Number(q["lon"]) : undefined,
132
120
  osmTag: asStringArray(q["osm_tag"]),
133
121
  layer: asStringArray(q["layer"]),
134
122
  };
135
123
  const collection = await engine.search(params);
136
- // #1052: `format=jsonld` re-serializes the SAME FeatureCollection as schema.org `Place[]` JSON-LD.
124
+ // `format=jsonld` re-serializes the FeatureCollection as schema.org `Place[]` JSON-LD.
137
125
  if (asString(q["format"]) === "jsonld") {
138
126
  return c.json(photonToSchemaOrg(collection), 200);
139
127
  }
@@ -156,10 +144,10 @@ export function registerPhotonRoutes(app, engine, stamp) {
156
144
  lon,
157
145
  limit: Number(q["limit"] ?? DEFAULT_LIMIT) || DEFAULT_LIMIT,
158
146
  lang: asString(q["lang"]),
159
- radius: q["radius"] != null ? Number(q["radius"]) : undefined,
147
+ radius: q["radius"] ? Number(q["radius"]) : undefined,
160
148
  };
161
149
  const collection = await engine.reverse(params);
162
- // #1052: `format=jsonld` re-serializes the reverse FeatureCollection as schema.org `Place[]` JSON-LD.
150
+ // `format=jsonld` re-serializes the reverse FeatureCollection as schema.org `Place[]` JSON-LD.
163
151
  if (asString(q["format"]) === "jsonld") {
164
152
  return c.json(photonToSchemaOrg(collection), 200);
165
153
  }
package/out/routes.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../lib/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAoB,CAAC,EAAE,MAAM,mBAAmB,CAAA;AACpE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAI3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEpH;;GAEG;AACH,MAAM,YAAY,GAAG,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AAA;AACH,CAAC"}
package/out/schema.d.ts CHANGED
@@ -3,14 +3,14 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Zod wire schemas for the Photon-compatible surface. Key names and envelopes are the vendor
7
- * contract — immutable. Query schemas are validator-proof by construction (unions accepting
8
- * string or repeated values) with doc-exact `.openapi()` overrides: validation can never fail,
9
- * and every wire decision stays in the handlers (see routes.ts's legacyQuery adapter).
6
+ * Zod schemas for the Photon-compatible API. Key names and envelopes match Photon and must not
7
+ * change. The query schemas accept any string or string array, so validation never fails. The
8
+ * handlers in `routes.ts` do the actual parsing.
10
9
  */
11
10
  import { z } from "@hono/zod-openapi";
12
11
  /**
13
- * Photon feature properties — OSM-derived keys; tolerant of extras (`[key: string]: unknown` on the wire type).
12
+ * Photon feature properties with OSM-derived keys.
13
+ * Extra keys are allowed.
14
14
  */
15
15
  export declare const PhotonPropertiesSchema: z.ZodObject<{
16
16
  osm_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
@@ -31,7 +31,7 @@ export declare const PhotonPropertiesSchema: z.ZodObject<{
31
31
  extent: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
32
32
  }, z.core.$loose>;
33
33
  /**
34
- * One Photon result feature — GeoJSON geometry plus Photon's property block.
34
+ * One Photon result feature with GeoJSON geometry and Photon's properties.
35
35
  */
36
36
  export declare const PhotonFeatureSchema: z.ZodObject<{
37
37
  type: z.ZodLiteral<"Feature">;
@@ -59,7 +59,7 @@ export declare const PhotonFeatureSchema: z.ZodObject<{
59
59
  }, z.core.$loose>;
60
60
  }, z.core.$strip>;
61
61
  /**
62
- * Response body of `/api`, a GeoJSON FeatureCollection as Photon returns it.
62
+ * A GeoJSON FeatureCollection of Photon features.
63
63
  */
64
64
  export declare const PhotonFeatureCollectionSchema: z.ZodObject<{
65
65
  type: z.ZodLiteral<"FeatureCollection">;
@@ -90,7 +90,8 @@ export declare const PhotonFeatureCollectionSchema: z.ZodObject<{
90
90
  }, z.core.$strip>>;
91
91
  }, z.core.$strip>;
92
92
  /**
93
- * The error/degenerate envelope: an EMPTY FeatureCollection carrying a message. Never `{error}` on this surface.
93
+ * The error envelope is an empty FeatureCollection with a message.
94
+ * Photon does not use an `{ error }` body.
94
95
  */
95
96
  export declare const PhotonMessageCollectionSchema: z.ZodObject<{
96
97
  type: z.ZodLiteral<"FeatureCollection">;
@@ -122,10 +123,10 @@ export declare const PhotonMessageCollectionSchema: z.ZodObject<{
122
123
  message: z.ZodString;
123
124
  }, z.core.$strip>;
124
125
  /**
125
- * The schema.org [`GeoCoordinates`](https://schema.org/GeoCoordinates) node — mirrors `@mailwoman/annotations`'s
126
- * `SchemaOrgGeoCoordinates` interface. Hand-modeled locally (no import from `@mailwoman/annotations`) matching this
127
- * package's existing wire-schema convention: each surface owns its own doc-accuracy schemas rather than sharing a
128
- * schema across the package boundary.
126
+ * The schema.org [`GeoCoordinates`](https://schema.org/GeoCoordinates) node.
127
+ *
128
+ * It mirrors the `SchemaOrgGeoCoordinates` interface in `@mailwoman/annotations`.
129
+ * Each API package defines its own schemas, so this one is written out here.
129
130
  */
130
131
  export declare const SchemaOrgGeoCoordinatesSchema: z.ZodObject<{
131
132
  "@type": z.ZodLiteral<"GeoCoordinates">;
@@ -133,7 +134,8 @@ export declare const SchemaOrgGeoCoordinatesSchema: z.ZodObject<{
133
134
  longitude: z.ZodNumber;
134
135
  }, z.core.$strip>;
135
136
  /**
136
- * The schema.org [`PostalAddress`](https://schema.org/PostalAddress) node — mirrors `SchemaOrgPostalAddress`.
137
+ * The schema.org [`PostalAddress`](https://schema.org/PostalAddress) node.
138
+ * It mirrors `SchemaOrgPostalAddress`.
137
139
  */
138
140
  export declare const SchemaOrgPostalAddressSchema: z.ZodObject<{
139
141
  "@type": z.ZodLiteral<"PostalAddress">;
@@ -145,8 +147,9 @@ export declare const SchemaOrgPostalAddressSchema: z.ZodObject<{
145
147
  addressCountry: z.ZodOptional<z.ZodString>;
146
148
  }, z.core.$strip>;
147
149
  /**
148
- * The `format=jsonld` re-serialization (#1052) — mirrors `@mailwoman/annotations`'s `SchemaOrgPlace` interface, the
149
- * shape `photonToSchemaOrg` actually produces.
150
+ * The `format=jsonld` output.
151
+ *
152
+ * It mirrors the `SchemaOrgPlace` interface that `photonToSchemaOrg` produces.
150
153
  */
151
154
  export declare const SchemaOrgPlaceSchema: z.ZodObject<{
152
155
  "@context": z.ZodLiteral<"https://schema.org">;
@@ -168,8 +171,10 @@ export declare const SchemaOrgPlaceSchema: z.ZodObject<{
168
171
  }, z.core.$strip>>;
169
172
  }, z.core.$strip>;
170
173
  /**
171
- * The FeatureCollection as a route returns it — the collection plus the optional `engine` stamp. Named because it is a
172
- * union arm: an unnamed arm is inlined, and a generated client then names the variant after its position.
174
+ * The FeatureCollection with the optional `engine` stamp.
175
+ *
176
+ * The schema has an OpenAPI name because it is a union member.
177
+ * A generated client would otherwise label an inlined member by its position.
173
178
  */
174
179
  export declare const StampedPhotonFeatureCollectionSchema: z.ZodIntersection<z.ZodObject<{
175
180
  type: z.ZodLiteral<"FeatureCollection">;
@@ -204,13 +209,14 @@ export declare const StampedPhotonFeatureCollectionSchema: z.ZodIntersection<z.Z
204
209
  version: z.ZodString;
205
210
  license: z.ZodString;
206
211
  license_url: z.ZodString;
207
- notice: z.ZodOptional<z.ZodString>;
212
+ notice: z.ZodNullable<z.ZodString>;
208
213
  }, z.core.$strict>>;
209
214
  }, z.core.$strip>>;
210
215
  /**
211
- * The real `/api` + `/reverse` 200 response union (#1052 doc accuracy): a GeoJSON FeatureCollection by default, or an
212
- * array of schema.org `Place` JSON-LD objects when `format=jsonld` — see `routes.ts`'s handlers (`photonToSchemaOrg`).
213
- * Doc-only; the wire behavior is unchanged.
216
+ * The `/api` and `/reverse` 200 response for the OpenAPI document.
217
+ *
218
+ * The response is a GeoJSON FeatureCollection by default or an array of schema.org
219
+ * `Place` objects for `format=jsonld`.
214
220
  */
215
221
  export declare const PhotonResponseSchema: z.ZodUnion<readonly [z.ZodIntersection<z.ZodObject<{
216
222
  type: z.ZodLiteral<"FeatureCollection">;
@@ -245,7 +251,7 @@ export declare const PhotonResponseSchema: z.ZodUnion<readonly [z.ZodIntersectio
245
251
  version: z.ZodString;
246
252
  license: z.ZodString;
247
253
  license_url: z.ZodString;
248
- notice: z.ZodOptional<z.ZodString>;
254
+ notice: z.ZodNullable<z.ZodString>;
249
255
  }, z.core.$strict>>;
250
256
  }, z.core.$strip>>, z.ZodArray<z.ZodObject<{
251
257
  "@context": z.ZodLiteral<"https://schema.org">;
@@ -267,7 +273,8 @@ export declare const PhotonResponseSchema: z.ZodUnion<readonly [z.ZodIntersectio
267
273
  }, z.core.$strip>>;
268
274
  }, z.core.$strip>>]>;
269
275
  /**
270
- * `GET /api` query — documented shape; presence/parsing enforced in-handler.
276
+ * The documented query parameters of `GET /api`.
277
+ * The handler checks and parses them.
271
278
  */
272
279
  export declare const searchQueryParams: z.ZodObject<{
273
280
  q: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
@@ -280,7 +287,7 @@ export declare const searchQueryParams: z.ZodObject<{
280
287
  format: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
281
288
  }, z.core.$strip>;
282
289
  /**
283
- * `GET /reverse` query.
290
+ * The documented query parameters of `GET /reverse`.
284
291
  */
285
292
  export declare const reverseQueryParams: z.ZodObject<{
286
293
  lat: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../lib/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAA;AAGrC;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;iBAoBN,CAAA;AA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;;;;;iBAMN,CAAA;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B;;;;iBAMN,CAAA;AAEpC;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;iBAUN,CAAA;AAEnC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;iBAQN,CAAA;AAE3B;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAGhD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAEN,CAAA;AAQ3B;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;iBAa5B,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;iBAO7B,CAAA"}
package/out/schema.js CHANGED
@@ -3,15 +3,15 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Zod wire schemas for the Photon-compatible surface. Key names and envelopes are the vendor
7
- * contract — immutable. Query schemas are validator-proof by construction (unions accepting
8
- * string or repeated values) with doc-exact `.openapi()` overrides: validation can never fail,
9
- * and every wire decision stays in the handlers (see routes.ts's legacyQuery adapter).
6
+ * Zod schemas for the Photon-compatible API. Key names and envelopes match Photon and must not
7
+ * change. The query schemas accept any string or string array, so validation never fails. The
8
+ * handlers in `routes.ts` do the actual parsing.
10
9
  */
11
10
  import { z } from "@hono/zod-openapi";
12
11
  import { featureCollectionSchema, featureSchema, stampedResponseSchema } from "@mailwoman/api-kit";
13
12
  /**
14
- * Photon feature properties — OSM-derived keys; tolerant of extras (`[key: string]: unknown` on the wire type).
13
+ * Photon feature properties with OSM-derived keys.
14
+ * Extra keys are allowed.
15
15
  */
16
16
  export const PhotonPropertiesSchema = z
17
17
  .object({
@@ -35,15 +35,16 @@ export const PhotonPropertiesSchema = z
35
35
  .loose()
36
36
  .openapi("PhotonProperties");
37
37
  /**
38
- * One Photon result feature — GeoJSON geometry plus Photon's property block.
38
+ * One Photon result feature with GeoJSON geometry and Photon's properties.
39
39
  */
40
40
  export const PhotonFeatureSchema = featureSchema(PhotonPropertiesSchema).openapi("PhotonFeature");
41
41
  /**
42
- * Response body of `/api`, a GeoJSON FeatureCollection as Photon returns it.
42
+ * A GeoJSON FeatureCollection of Photon features.
43
43
  */
44
44
  export const PhotonFeatureCollectionSchema = featureCollectionSchema(PhotonFeatureSchema).openapi("PhotonFeatureCollection");
45
45
  /**
46
- * The error/degenerate envelope: an EMPTY FeatureCollection carrying a message. Never `{error}` on this surface.
46
+ * The error envelope is an empty FeatureCollection with a message.
47
+ * Photon does not use an `{ error }` body.
47
48
  */
48
49
  export const PhotonMessageCollectionSchema = z
49
50
  .object({
@@ -53,10 +54,10 @@ export const PhotonMessageCollectionSchema = z
53
54
  })
54
55
  .openapi("PhotonMessageCollection");
55
56
  /**
56
- * The schema.org [`GeoCoordinates`](https://schema.org/GeoCoordinates) node — mirrors `@mailwoman/annotations`'s
57
- * `SchemaOrgGeoCoordinates` interface. Hand-modeled locally (no import from `@mailwoman/annotations`) matching this
58
- * package's existing wire-schema convention: each surface owns its own doc-accuracy schemas rather than sharing a
59
- * schema across the package boundary.
57
+ * The schema.org [`GeoCoordinates`](https://schema.org/GeoCoordinates) node.
58
+ *
59
+ * It mirrors the `SchemaOrgGeoCoordinates` interface in `@mailwoman/annotations`.
60
+ * Each API package defines its own schemas, so this one is written out here.
60
61
  */
61
62
  export const SchemaOrgGeoCoordinatesSchema = z
62
63
  .object({
@@ -66,7 +67,8 @@ export const SchemaOrgGeoCoordinatesSchema = z
66
67
  })
67
68
  .openapi("SchemaOrgGeoCoordinates");
68
69
  /**
69
- * The schema.org [`PostalAddress`](https://schema.org/PostalAddress) node — mirrors `SchemaOrgPostalAddress`.
70
+ * The schema.org [`PostalAddress`](https://schema.org/PostalAddress) node.
71
+ * It mirrors `SchemaOrgPostalAddress`.
70
72
  */
71
73
  export const SchemaOrgPostalAddressSchema = z
72
74
  .object({
@@ -80,8 +82,9 @@ export const SchemaOrgPostalAddressSchema = z
80
82
  })
81
83
  .openapi("SchemaOrgPostalAddress");
82
84
  /**
83
- * The `format=jsonld` re-serialization (#1052) — mirrors `@mailwoman/annotations`'s `SchemaOrgPlace` interface, the
84
- * shape `photonToSchemaOrg` actually produces.
85
+ * The `format=jsonld` output.
86
+ *
87
+ * It mirrors the `SchemaOrgPlace` interface that `photonToSchemaOrg` produces.
85
88
  */
86
89
  export const SchemaOrgPlaceSchema = z
87
90
  .object({
@@ -93,25 +96,29 @@ export const SchemaOrgPlaceSchema = z
93
96
  })
94
97
  .openapi("SchemaOrgPlace");
95
98
  /**
96
- * The FeatureCollection as a route returns it — the collection plus the optional `engine` stamp. Named because it is a
97
- * union arm: an unnamed arm is inlined, and a generated client then names the variant after its position.
99
+ * The FeatureCollection with the optional `engine` stamp.
100
+ *
101
+ * The schema has an OpenAPI name because it is a union member.
102
+ * A generated client would otherwise label an inlined member by its position.
98
103
  */
99
104
  export const StampedPhotonFeatureCollectionSchema = stampedResponseSchema(PhotonFeatureCollectionSchema, "StampedPhotonFeatureCollection");
100
105
  /**
101
- * The real `/api` + `/reverse` 200 response union (#1052 doc accuracy): a GeoJSON FeatureCollection by default, or an
102
- * array of schema.org `Place` JSON-LD objects when `format=jsonld` — see `routes.ts`'s handlers (`photonToSchemaOrg`).
103
- * Doc-only; the wire behavior is unchanged.
106
+ * The `/api` and `/reverse` 200 response for the OpenAPI document.
107
+ *
108
+ * The response is a GeoJSON FeatureCollection by default or an array of schema.org
109
+ * `Place` objects for `format=jsonld`.
104
110
  */
105
111
  export const PhotonResponseSchema = z
106
112
  .union([StampedPhotonFeatureCollectionSchema, z.array(SchemaOrgPlaceSchema)])
107
113
  .openapi("PhotonResponse");
108
114
  /**
109
- * A query param that may legally repeat (or that a client may repeat without the validator being allowed to answer for
110
- * us). Validator-proof: accepts one value or many; the doc override keeps the emitted parameter schema exact.
115
+ * A query parameter that accepts one value or a repeated value.
116
+ * Each use sets its documented type with `.openapi()`.
111
117
  */
112
118
  const tolerantParam = z.union([z.string(), z.array(z.string())]).optional();
113
119
  /**
114
- * `GET /api` query — documented shape; presence/parsing enforced in-handler.
120
+ * The documented query parameters of `GET /api`.
121
+ * The handler checks and parses them.
115
122
  */
116
123
  export const searchQueryParams = z.object({
117
124
  q: tolerantParam.openapi({ type: "string", description: "The query string to search for." }),
@@ -128,7 +135,7 @@ export const searchQueryParams = z.object({
128
135
  format: tolerantParam.openapi({ type: "string", enum: ["geojson", "jsonld"], description: "Output format." }),
129
136
  });
130
137
  /**
131
- * `GET /reverse` query.
138
+ * The documented query parameters of `GET /reverse`.
132
139
  */
133
140
  export const reverseQueryParams = z.object({
134
141
  lat: tolerantParam.openapi({ type: "number", description: "Latitude." }),