@mailwoman/ogc 0.0.0-stage → 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.
Files changed (82) hide show
  1. package/README.md +288 -2
  2. package/cli/geocoder.ts +50 -0
  3. package/cli/main.ts +407 -0
  4. package/lib/app.ts +107 -0
  5. package/lib/bbox.ts +69 -0
  6. package/lib/collections.ts +213 -0
  7. package/lib/engine.ts +143 -0
  8. package/lib/format.ts +46 -0
  9. package/lib/html.ts +298 -0
  10. package/lib/index.ts +24 -0
  11. package/lib/items.ts +169 -0
  12. package/lib/projection.ts +226 -0
  13. package/lib/provenance.ts +86 -0
  14. package/lib/refusal.ts +34 -0
  15. package/lib/routes.ts +852 -0
  16. package/lib/schema.ts +457 -0
  17. package/out/app.d.ts +41 -0
  18. package/out/app.d.ts.map +1 -0
  19. package/out/app.js +67 -0
  20. package/out/app.js.map +1 -0
  21. package/out/bbox.d.ts +23 -0
  22. package/out/bbox.d.ts.map +1 -0
  23. package/out/bbox.js +54 -0
  24. package/out/bbox.js.map +1 -0
  25. package/out/cli/geocoder.d.ts +24 -0
  26. package/out/cli/geocoder.d.ts.map +1 -0
  27. package/out/cli/geocoder.js +28 -0
  28. package/out/cli/geocoder.js.map +1 -0
  29. package/out/cli/main.d.ts +3 -0
  30. package/out/cli/main.d.ts.map +1 -0
  31. package/out/cli/main.js +297 -0
  32. package/out/cli/main.js.map +1 -0
  33. package/out/collections.d.ts +99 -0
  34. package/out/collections.d.ts.map +1 -0
  35. package/out/collections.js +132 -0
  36. package/out/collections.js.map +1 -0
  37. package/out/engine.d.ts +133 -0
  38. package/out/engine.d.ts.map +1 -0
  39. package/out/engine.js +4 -0
  40. package/out/engine.js.map +1 -0
  41. package/out/format.d.ts +18 -0
  42. package/out/format.d.ts.map +1 -0
  43. package/out/format.js +31 -0
  44. package/out/format.js.map +1 -0
  45. package/out/html.d.ts +52 -0
  46. package/out/html.d.ts.map +1 -0
  47. package/out/html.js +200 -0
  48. package/out/html.js.map +1 -0
  49. package/out/index.d.ts +21 -0
  50. package/out/index.d.ts.map +1 -0
  51. package/out/index.js +23 -0
  52. package/out/index.js.map +1 -0
  53. package/out/items.d.ts +38 -0
  54. package/out/items.d.ts.map +1 -0
  55. package/out/items.js +136 -0
  56. package/out/items.js.map +1 -0
  57. package/out/projection.d.ts +40 -0
  58. package/out/projection.d.ts.map +1 -0
  59. package/out/projection.js +181 -0
  60. package/out/projection.js.map +1 -0
  61. package/out/provenance.d.ts +41 -0
  62. package/out/provenance.d.ts.map +1 -0
  63. package/out/provenance.js +60 -0
  64. package/out/provenance.js.map +1 -0
  65. package/out/refusal.d.ts +18 -0
  66. package/out/refusal.d.ts.map +1 -0
  67. package/out/refusal.js +30 -0
  68. package/out/refusal.js.map +1 -0
  69. package/out/routes.d.ts +95 -0
  70. package/out/routes.d.ts.map +1 -0
  71. package/out/routes.js +624 -0
  72. package/out/routes.js.map +1 -0
  73. package/out/schema.d.ts +422 -0
  74. package/out/schema.d.ts.map +1 -0
  75. package/out/schema.js +378 -0
  76. package/out/schema.js.map +1 -0
  77. package/out/tools/ets.run.d.ts +2 -0
  78. package/out/tools/ets.run.d.ts.map +1 -0
  79. package/out/tools/ets.run.js +187 -0
  80. package/out/tools/ets.run.js.map +1 -0
  81. package/package.json +120 -3
  82. package/tools/ets.run.ts +258 -0
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The forward geocoder behind `mailwoman-ogc serve`: the data layers the server composes,
3
+ * 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
+ /**
10
+ * What `mailwoman-ogc serve` opens to answer `/search` and to list its collections.
11
+ */
12
+ export interface OGCGeocoder extends DropInGeocoder {
13
+ /**
14
+ * Geocodes one query.
15
+ */
16
+ geocode(query: string): Promise<GeocodeResult>;
17
+ }
18
+ /**
19
+ * Opens the gazetteer and the server's session, and ends the process when either is unavailable.
20
+ *
21
+ * @param candidateDBFlag The `--candidate-db` value, or `null` to read the conventional path.
22
+ */
23
+ export declare function openOGCGeocoder(candidateDBFlag: string | null): Promise<OGCGeocoder>;
24
+ //# 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;AAmBlF;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,cAAc;IAClD;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;CAC9C;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAI1F"}
@@ -0,0 +1,28 @@
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 the OGC server composes.
7
+ *
8
+ * The server consults the national open register (BAN) and then the OpenStreetMap tier,
9
+ * as the Photon and Nominatim servers do.
10
+ * It leaves national Overture out, so `/search` reads every collection it lists.
11
+ */
12
+ const OGC_LAYERS = [
13
+ banLayer,
14
+ osmLayer,
15
+ regionDatabases,
16
+ forkEntityProbe,
17
+ observationRoutes,
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 async function openOGCGeocoder(candidateDBFlag) {
25
+ const opened = await openDropInGeocoder(candidateDBFlag, OGC_LAYERS);
26
+ return { ...opened, geocode: async (query) => (await opened.session.geocode(query)).result };
27
+ }
28
+ //# 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;AAElF,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAEvH;;;;;;GAMG;AACH,MAAM,UAAU,GAAiC;IAChD,QAAQ;IACR,QAAQ;IACR,eAAe;IACf,eAAe;IACf,iBAAiB;CACjB,CAAA;AAYD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,eAA8B;IACnE,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;IAEpE,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAA;AAC7F,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../cli/main.ts"],"names":[],"mappings":""}
@@ -0,0 +1,297 @@
1
+ #!/usr/bin/env node
2
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
3
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
4
+ /**
5
+ * `mailwoman-ogc` boots the OGC API surface through the `serve` command
6
+ * and prints its API definition through the `openapi` command.
7
+ *
8
+ * `serve` wires `/search` over `geocodeAddress` (parse, then resolve) with the same
9
+ * gazetteer, classifier and rooftop providers the Photon and Nominatim servers attach,
10
+ * and lists as collections the layers those providers opened.
11
+ */
12
+ import { serveNode } from "@mailwoman/api-kit";
13
+ import { worldCountries } from "@mailwoman/codex/country/sets";
14
+ import { parseArguments } from "@mailwoman/core/scripting/arguments";
15
+ import { parseObligationRefusals } from "@mailwoman/license/refusals";
16
+ import { PostcodePlaceBrowser, wofDatabaseHoldsPostcodes, } from "@mailwoman/resolver-wof-sqlite/candidate/postcode-browse";
17
+ import { WOFPlaceBrowser } from "@mailwoman/resolver-wof-sqlite/lookup/browse";
18
+ import { corsBannerLine, gazetteerBannerLines, gazetteerFreshness, openAPICommand, readListenPort, runDropInCLI, } from "mailwoman/cli/kit/dropin";
19
+ import { readSourceLocations } from "mailwoman/data/terms/source-locations";
20
+ import { ManifestState, readFreshness } from "mailwoman/diagnostics/freshness";
21
+ import { $public } from "mailwoman/env";
22
+ import { openOGCGeocoder } from "#cli/geocoder";
23
+ import { createOGCApp, geocodeSearchHits, OGC_COLLECTION_CATALOG, OGC_DEFAULT_PORT, OGC_DOC_INFO, OGCCollectionID, itemsRefusal, placeItemSource, regionLayerFiles, servedCollections, } from "#index";
24
+ const BINARY_NAME = "mailwoman-ogc";
25
+ /**
26
+ * The engine the `openapi` command documents.
27
+ *
28
+ * It lists every collection the surface can serve, so the printed definition
29
+ * declares each collection's `/search` parameters.
30
+ */
31
+ const DOCUMENTED_ENGINE = {
32
+ collections: Object.keys(OGC_COLLECTION_CATALOG).map((id) => ({ id: id, regions: null })),
33
+ search: async () => [],
34
+ };
35
+ /**
36
+ * The terms an opened artifact's manifest records, under the layer name the manifest gives it.
37
+ *
38
+ * An artifact without a readable manifest keeps the role the server opened it for and records no terms.
39
+ */
40
+ function layerTermsOf(artifact) {
41
+ return {
42
+ name: artifact.version?.split("@")[0] ?? artifact.name,
43
+ license: artifact.license,
44
+ attribution: artifact.attribution,
45
+ source: artifact.sources?.[0] ?? null,
46
+ };
47
+ }
48
+ /**
49
+ * The manifest terms of the region files each street-tier collection reads,
50
+ * and its regions without a readable manifest.
51
+ *
52
+ * A collection lists a layer's terms once, whatever the count of regions that
53
+ * record the same license and source.
54
+ * A file whose `layer_manifest` is absent or unreadable contributes no terms,
55
+ * and its region is counted as unread.
56
+ *
57
+ * @param sourceLocations Every owner's source table, under the provider's own table for each file.
58
+ */
59
+ async function regionLayerTerms(probes, sourceLocations) {
60
+ const files = regionLayerFiles(probes);
61
+ const paths = [...new Set(files.map(({ path }) => path))];
62
+ const { artifacts } = await readFreshness(paths.map((path) => ({ name: path, path })));
63
+ const byPath = new Map(artifacts.map((artifact) => [artifact.path, artifact]));
64
+ const terms = new Map();
65
+ for (const file of files) {
66
+ const entry = terms.get(file.collection) ?? { layers: new Map(), unread: new Set() };
67
+ const artifact = byPath.get(file.path);
68
+ terms.set(file.collection, entry);
69
+ if (artifact?.manifest !== ManifestState.Present) {
70
+ entry.unread.add(file.region);
71
+ continue;
72
+ }
73
+ const layer = { ...layerTermsOf(artifact), sourceLocations: { ...sourceLocations, ...file.sourceLocations } };
74
+ const key = `${layer.license} ${layer.source?.split(":")[0]} ${layer.attribution}`;
75
+ if (!entry.layers.has(key)) {
76
+ entry.layers.set(key, layer);
77
+ }
78
+ }
79
+ return new Map([...terms].map(([collection, { layers, unread }]) => [
80
+ collection,
81
+ { layers: [...layers.values()], ...(unread.size ? { unreadRegions: unread.size } : {}) },
82
+ ]));
83
+ }
84
+ /**
85
+ * Open the admin gazetteer as the `places` collection's item source, when the operator asked for items.
86
+ *
87
+ * The items routes serve the gazetteer in pages, so the operator's `MAILWOMAN_REFUSE_OBLIGATIONS`
88
+ * applies to them as it applies to an OpenStreetMap layer: a refused class in the database's
89
+ * recorded license leaves `places` without items, and the banner states the refusal.
90
+ * A database without the `place_bbox` R*Tree can't answer a box page, so it serves no items either.
91
+ */
92
+ async function openPlaceItems(serveItems, admin, ancestorsOf) {
93
+ if (!serveItems) {
94
+ return {
95
+ source: null,
96
+ bannerLines: [" items: off, because bulk browsing is opt-in; pass --serve-items to serve them"],
97
+ };
98
+ }
99
+ if (!admin) {
100
+ return { source: null, bannerLines: [" places items: none, because no admin gazetteer database was found"] };
101
+ }
102
+ const adminDBPath = admin.path;
103
+ const license = admin.license;
104
+ const refusal = itemsRefusal(license, parseObligationRefusals([$public.MAILWOMAN_REFUSE_OBLIGATIONS ?? ""]));
105
+ if (refusal) {
106
+ return { source: null, bannerLines: [` places items: none, because ${refusal} in ${adminDBPath}`] };
107
+ }
108
+ try {
109
+ const browser = new WOFPlaceBrowser({ databasePath: adminDBPath });
110
+ return {
111
+ source: placeItemSource(browser, ancestorsOf),
112
+ bannerLines: [` places items: ${adminDBPath} (${license ?? "license unrecorded in layer_manifest"})`],
113
+ };
114
+ }
115
+ catch (error) {
116
+ return {
117
+ source: null,
118
+ bannerLines: [
119
+ ` places items: none, because ${adminDBPath} can't be paged: ${error instanceof Error ? error.message : String(error)}`,
120
+ ],
121
+ };
122
+ }
123
+ }
124
+ /**
125
+ * Check whether the gazetteer that `/search` uses holds postcode places.
126
+ *
127
+ * When the operator enables items, open a candidate gazetteer as the `postcodes` collection's item source.
128
+ *
129
+ * The candidate gazetteer holds the postcode places when the server resolves against it.
130
+ * Otherwise they come from the WOF databases it opened.
131
+ * Those databases serve no items.
132
+ *
133
+ * The obligation refusal applies as it does to `places`, from the candidate gazetteer's recorded license.
134
+ */
135
+ function openPostcodeItems(serveItems, gazetteer, candidate, ancestorsOf) {
136
+ if (!gazetteer.candidateDB) {
137
+ const held = gazetteer.wofPaths.some((path) => wofDatabaseHoldsPostcodes(path));
138
+ return {
139
+ held,
140
+ source: null,
141
+ bannerLines: serveItems && held ? [" postcodes items: none, because no candidate gazetteer was opened"] : [],
142
+ };
143
+ }
144
+ let browser;
145
+ try {
146
+ browser = new PostcodePlaceBrowser({ databasePath: gazetteer.candidateDB });
147
+ }
148
+ catch (error) {
149
+ // The gazetteer records postcode places but can't page them, so `/search` still answers postcodes.
150
+ return {
151
+ held: true,
152
+ source: null,
153
+ bannerLines: serveItems
154
+ ? [
155
+ ` postcodes items: none, because ${gazetteer.candidateDB} can't be paged: ${error instanceof Error ? error.message : String(error)}`,
156
+ ]
157
+ : [],
158
+ };
159
+ }
160
+ const held = browser.holdsPostcodes();
161
+ if (!serveItems || !held) {
162
+ browser[Symbol.dispose]();
163
+ return { held, source: null, bannerLines: [] };
164
+ }
165
+ const license = candidate?.license ?? null;
166
+ const refusal = itemsRefusal(license, parseObligationRefusals([$public.MAILWOMAN_REFUSE_OBLIGATIONS ?? ""]));
167
+ if (refusal) {
168
+ browser[Symbol.dispose]();
169
+ return {
170
+ held,
171
+ source: null,
172
+ bannerLines: [` postcodes items: none, because ${refusal} in ${gazetteer.candidateDB}`],
173
+ };
174
+ }
175
+ return {
176
+ held,
177
+ source: placeItemSource(browser, ancestorsOf),
178
+ bannerLines: [` postcodes items: ${gazetteer.candidateDB} (${license ?? "license unrecorded in layer_manifest"})`],
179
+ };
180
+ }
181
+ async function serve(engineStamp) {
182
+ const { values } = parseArguments({
183
+ options: {
184
+ port: { type: "string", default: String(OGC_DEFAULT_PORT) },
185
+ host: { type: "string", default: "0.0.0.0" },
186
+ // The public base URL that link hrefs resolve against, for a deployment behind a reverse proxy.
187
+ "base-url": { type: "string" },
188
+ "candidate-db": { type: "string" },
189
+ // Permissive CORS is on by default because OGC API clients run in browsers too.
190
+ // `--no-cors` turns it off where a reverse proxy already sets the headers.
191
+ cors: { type: "boolean", default: true },
192
+ // Serve the `places` collection's items for bulk browsing.
193
+ // Off by default.
194
+ "serve-items": { type: "boolean", default: false },
195
+ },
196
+ allowNegative: true,
197
+ allowPositionals: true,
198
+ });
199
+ const port = readListenPort(values.port);
200
+ const host = values.host ?? "0.0.0.0";
201
+ const baseURL = values["base-url"];
202
+ const { gazetteer, session, geocode } = await openOGCGeocoder(values["candidate-db"] ?? null);
203
+ // The session owns the gazetteer backend and every provider read below, and closes them with itself.
204
+ const { lookup, regionDatabases, nationalSources, osm } = session.services;
205
+ // The gazetteer's own ancestry reader labels each place match with its region and county.
206
+ const ancestorsOf = lookup.ancestors?.bind(lookup);
207
+ const countries = worldCountries();
208
+ const countryCodeOf = (code) => code.toUpperCase();
209
+ const probes = [
210
+ // The region provider's keys are the ISO 3166-2 codes of the regions it has a file for.
211
+ { provider: regionDatabases, keys: regionDatabases.regions(), regionOf: countryCodeOf },
212
+ ...nationalSources.map((provider) => ({ provider, keys: countries, regionOf: countryCodeOf })),
213
+ ...(osm ? [{ provider: osm, keys: countries, regionOf: countryCodeOf }] : []),
214
+ ];
215
+ // The manifests of the gazetteer databases this process opened: the ones `/search` reads,
216
+ // and the admin gazetteer they derive from.
217
+ // The admin gazetteer also serves the `places` items.
218
+ const { artifacts } = await gazetteerFreshness(gazetteer);
219
+ const admin = artifacts.find((artifact) => artifact.path === gazetteer.adminDBPath);
220
+ const searchLayers = artifacts.filter((artifact) => artifact.name !== "reverse-admin").map(layerTermsOf);
221
+ const placeLayers = artifacts.map(layerTermsOf);
222
+ const placeItems = await openPlaceItems(values["serve-items"], admin, ancestorsOf);
223
+ const candidate = artifacts.find((artifact) => artifact.path === gazetteer.candidateDB);
224
+ const postcodeItems = openPostcodeItems(values["serve-items"], gazetteer, candidate, ancestorsOf);
225
+ const itemsOf = (id) => {
226
+ if (id === OGCCollectionID.Places)
227
+ return placeItems.source;
228
+ if (id === OGCCollectionID.Postcodes)
229
+ return postcodeItems.source;
230
+ return null;
231
+ };
232
+ // The gazetteer collections read the manifests above, and the address and street
233
+ // collections read the manifests of the region files their providers report.
234
+ // Plus codes have no layer.
235
+ const regional = await regionLayerTerms(probes, (await readSourceLocations()).table);
236
+ const layersOf = (id) => {
237
+ switch (id) {
238
+ case OGCCollectionID.Places:
239
+ return { layers: placeLayers };
240
+ case OGCCollectionID.Postcodes:
241
+ return { layers: searchLayers };
242
+ case OGCCollectionID.PlusCodes:
243
+ return { layers: [] };
244
+ case OGCCollectionID.Addresses:
245
+ case OGCCollectionID.Streets:
246
+ return regional.get(id) ?? { layers: [] };
247
+ }
248
+ };
249
+ const engine = {
250
+ collections: servedCollections(probes, { postcodes: postcodeItems.held }).map((collection) => {
251
+ const items = itemsOf(collection.id);
252
+ return { ...collection, ...layersOf(collection.id), ...(items ? { items } : {}) };
253
+ }),
254
+ async search(q) {
255
+ return geocodeSearchHits(await geocode(q), ancestorsOf);
256
+ },
257
+ };
258
+ const app = createOGCApp(engine, {
259
+ cors: values.cors,
260
+ engine: engineStamp.stamp,
261
+ baseURL,
262
+ serveItems: placeItems.source != null || postcodeItems.source != null,
263
+ });
264
+ await serveNode({
265
+ fetch: app.fetch,
266
+ port,
267
+ hostname: host,
268
+ onListen: (info) => {
269
+ console.error(`[@mailwoman/ogc] listening on http://${host}:${info.port}`);
270
+ console.error(` base URL: ${baseURL ?? "(the request's own origin)"}`);
271
+ for (const line of gazetteerBannerLines(gazetteer)) {
272
+ console.error(line);
273
+ }
274
+ for (const { id, regions, items } of engine.collections) {
275
+ console.error(` collection ${id}: ${regions ? regions.join(" ") : "worldwide"}${items ? ", serves items" : ""}`);
276
+ }
277
+ for (const line of [...placeItems.bannerLines, ...postcodeItems.bannerLines]) {
278
+ console.error(line);
279
+ }
280
+ const itemRoutes = engine.collections
281
+ .filter(({ items }) => items)
282
+ .map(({ id }) => ` GET /collections/${id}/items GET /collections/${id}/items/{featureId}`);
283
+ console.error(corsBannerLine(values.cors));
284
+ console.error(` endpoints: GET / GET /conformance GET /api GET /collections GET /search GET /openapi.json${itemRoutes.join("")}`);
285
+ },
286
+ });
287
+ }
288
+ await runDropInCLI({
289
+ binaryName: BINARY_NAME,
290
+ openapi: openAPICommand(BINARY_NAME, createOGCApp, OGC_DOC_INFO, DOCUMENTED_ENGINE),
291
+ serve,
292
+ usage: [
293
+ " serve [--port 8090] [--host 0.0.0.0] [--base-url <url>] [--candidate-db <path>] [--no-cors] [--serve-items]",
294
+ " openapi [--flavor 3.1|3.0] [--out <path>]",
295
+ ],
296
+ });
297
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../cli/main.ts"],"names":[],"mappings":";AACA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAE9D,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AACrE,OAAO,EACN,oBAAoB,EACpB,yBAAyB,GACzB,MAAM,0DAA0D,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAA;AAC9E,OAAO,EACN,cAAc,EAEd,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,YAAY,GACZ,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,mBAAmB,EAAwB,MAAM,uCAAuC,CAAA;AACjG,OAAO,EAA0B,aAAa,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAA;AACtG,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAEN,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EAEf,YAAY,EAGZ,eAAe,EACf,gBAAgB,EAEhB,iBAAiB,GACjB,MAAM,QAAQ,CAAA;AAEf,MAAM,WAAW,GAAG,eAAe,CAAA;AAEnC;;;;;GAKG;AACH,MAAM,iBAAiB,GAAc;IACpC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CA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OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;YAC1C,OAAO,CAAC,KAAK,CACZ,mGAAmG,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CACxH,CAAA;QACF,CAAC;KACD,CAAC,CAAA;AACH,CAAC;AAED,MAAM,YAAY,CAAC;IAClB,UAAU,EAAE,WAAW;IACvB,OAAO,EAAE,cAAc,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,iBAAiB,CAAC;IACnF,KAAK;IACL,KAAK,EAAE;QACN,+GAA+G;QAC/G,6CAA6C;KAC7C;CACD,CAAC,CAAA"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * The collections the OGC surface can describe, and the engine output each one holds.
3
+ *
4
+ * A collection groups the answers one kind of serving layer produces.
5
+ * The geocoder reports which tier placed a coordinate, so the tier decides the collection.
6
+ *
7
+ * The running engine lists only the collections whose layers it opened,
8
+ * and `/collections` serves that list.
9
+ */
10
+ import type { GeocodeResult } from "@mailwoman/core/geocode";
11
+ import type { RegionDatabaseProvider, RegionLayerDatabase } from "@mailwoman/core/resolver";
12
+ import type { OGCServedCollection } from "#engine";
13
+ type ResolutionTier = GeocodeResult["resolution_tier"];
14
+ /**
15
+ * The table maps each collection's name to its id.
16
+ */
17
+ export declare const OGCCollectionID: {
18
+ readonly Addresses: "addresses";
19
+ readonly Streets: "streets";
20
+ readonly Postcodes: "postcodes";
21
+ readonly Places: "places";
22
+ readonly PlusCodes: "plus-codes";
23
+ };
24
+ export type OGCCollectionID = (typeof OGCCollectionID)[keyof typeof OGCCollectionID];
25
+ /**
26
+ * The fixed title and description of one collection.
27
+ */
28
+ export interface OGCCollectionEntry {
29
+ title: string;
30
+ description: string;
31
+ }
32
+ /**
33
+ * The title and description of every collection.
34
+ */
35
+ export declare const OGC_COLLECTION_CATALOG: Readonly<Record<OGCCollectionID, OGCCollectionEntry>>;
36
+ /**
37
+ * The collection that holds an answer the geocoder placed at `tier`.
38
+ *
39
+ * @returns Null for a tier no collection holds, such as `venue`, whose layer the OGC engine doesn't open.
40
+ */
41
+ export declare function collectionOfTier(tier: ResolutionTier): OGCCollectionID | null;
42
+ /**
43
+ * The collection that holds a gazetteer place of `placetype`.
44
+ */
45
+ export declare function collectionOfPlacetype(placetype: string): OGCCollectionID;
46
+ /**
47
+ * One region-keyed provider of street-tier layers, and the keys to ask it for.
48
+ */
49
+ export interface RegionLayerProbe {
50
+ provider: Pick<RegionDatabaseProvider, "for" | "layerDatabases">;
51
+ keys: Iterable<string>;
52
+ /**
53
+ * The region code a key names in a collection description, such as `US-TX` for the key `tx`.
54
+ */
55
+ regionOf: (key: string) => string;
56
+ }
57
+ /**
58
+ * One database file a region's layer reads, and the collection it serves.
59
+ */
60
+ export interface RegionLayerFile extends RegionLayerDatabase {
61
+ collection: OGCCollectionID;
62
+ /**
63
+ * The region code, such as `US-TX`.
64
+ */
65
+ region: string;
66
+ }
67
+ /**
68
+ * The database files every probed region reads, from providers that report them.
69
+ *
70
+ * A provider without `layerDatabases` reports none, and its regions count as unread.
71
+ */
72
+ export declare function regionLayerFiles(probes: readonly RegionLayerProbe[]): RegionLayerFile[];
73
+ /**
74
+ * What the opened gazetteer holds, for the collections it backs.
75
+ */
76
+ export interface GazetteerHoldings {
77
+ /**
78
+ * Whether the gazetteer holds at least one postcode place.
79
+ */
80
+ postcodes: boolean;
81
+ }
82
+ /**
83
+ * The collections an engine serves, from the layers its providers opened.
84
+ *
85
+ * The gazetteer is always open, because the engine refuses to start without one,
86
+ * so places and plus codes are always served.
87
+ * Postcodes are served when the gazetteer holds postcode places.
88
+ *
89
+ * Addresses and streets are served when some region has an address-point, interpolation
90
+ * or street-centroid layer, and their descriptions name those regions.
91
+ *
92
+ * A collection no region has a layer for is left out of the list.
93
+ *
94
+ * A provider opens a region's layers when asked for the region.
95
+ * A query for that region would open them as well.
96
+ */
97
+ export declare function servedCollections(probes: readonly RegionLayerProbe[], gazetteer: GazetteerHoldings): OGCServedCollection[];
98
+ export {};
99
+ //# sourceMappingURL=collections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../lib/collections.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD,KAAK,cAAc,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAA;AAEtD;;GAEG;AACH,eAAO,MAAM,eAAe;aAC3B,SAAS,EAAE,WAAW;aACtB,OAAO,EAAE,SAAS;aAClB,SAAS,EAAE,WAAW;aACtB,MAAM,EAAE,QAAQ;aAChB,SAAS,EAAE,YAAY;CACd,CAAA;AAEV,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAA;AAEpF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAsBxF,CAAA;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,eAAe,GAAG,IAAI,CAgB7E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,CAExE;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,EAAE,IAAI,CAAC,sBAAsB,EAAE,KAAK,GAAG,gBAAgB,CAAC,CAAA;IAChE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACtB;;OAEG;IACH,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAA;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC3D,UAAU,EAAE,eAAe,CAAA;IAC3B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;CACd;AAWD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,GAAG,eAAe,EAAE,CAYvF;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,SAAS,gBAAgB,EAAE,EACnC,SAAS,EAAE,iBAAiB,GAC1B,mBAAmB,EAAE,CAmCvB"}
@@ -0,0 +1,132 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+ /**
4
+ * The table maps each collection's name to its id.
5
+ */
6
+ export const OGCCollectionID = {
7
+ Addresses: "addresses",
8
+ Streets: "streets",
9
+ Postcodes: "postcodes",
10
+ Places: "places",
11
+ PlusCodes: "plus-codes",
12
+ };
13
+ /**
14
+ * The title and description of every collection.
15
+ */
16
+ export const OGC_COLLECTION_CATALOG = {
17
+ [OGCCollectionID.Addresses]: {
18
+ title: "Addresses",
19
+ description: "House-grade coordinates: a matched address point, or a point interpolated along a street's address range.",
20
+ },
21
+ [OGCCollectionID.Streets]: {
22
+ title: "Streets",
23
+ description: "Street centroids, answering a street named without a house number.",
24
+ },
25
+ [OGCCollectionID.Postcodes]: {
26
+ title: "Postcodes",
27
+ description: "Postcode places from the gazetteer, located at the postcode's own coordinate.",
28
+ },
29
+ [OGCCollectionID.Places]: {
30
+ title: "Places",
31
+ description: "Gazetteer places: localities, districts, counties, regions and countries.",
32
+ },
33
+ [OGCCollectionID.PlusCodes]: {
34
+ title: "Plus codes",
35
+ description: "Open Location Codes the engine decodes to the center of their area. No data layer backs it.",
36
+ },
37
+ };
38
+ /**
39
+ * The collection that holds an answer the geocoder placed at `tier`.
40
+ *
41
+ * @returns Null for a tier no collection holds, such as `venue`, whose layer the OGC engine doesn't open.
42
+ */
43
+ export function collectionOfTier(tier) {
44
+ switch (tier) {
45
+ case "address_point":
46
+ case "interpolated":
47
+ return OGCCollectionID.Addresses;
48
+ case "street":
49
+ return OGCCollectionID.Streets;
50
+ case "postcode":
51
+ return OGCCollectionID.Postcodes;
52
+ case "admin":
53
+ return OGCCollectionID.Places;
54
+ case "plus_code":
55
+ return OGCCollectionID.PlusCodes;
56
+ case "venue":
57
+ return null;
58
+ }
59
+ }
60
+ /**
61
+ * The collection that holds a gazetteer place of `placetype`.
62
+ */
63
+ export function collectionOfPlacetype(placetype) {
64
+ return placetype === "postalcode" ? OGCCollectionID.Postcodes : OGCCollectionID.Places;
65
+ }
66
+ /**
67
+ * The collection each street-tier database serves.
68
+ */
69
+ const COLLECTION_OF_TIER = {
70
+ addressPoints: OGCCollectionID.Addresses,
71
+ interpolation: OGCCollectionID.Addresses,
72
+ streetCentroids: OGCCollectionID.Streets,
73
+ };
74
+ /**
75
+ * The database files every probed region reads, from providers that report them.
76
+ *
77
+ * A provider without `layerDatabases` reports none, and its regions count as unread.
78
+ */
79
+ export function regionLayerFiles(probes) {
80
+ const files = [];
81
+ for (const { provider, keys, regionOf } of probes) {
82
+ for (const key of keys) {
83
+ for (const database of provider.layerDatabases?.(key) ?? []) {
84
+ files.push({ ...database, collection: COLLECTION_OF_TIER[database.tier], region: regionOf(key) });
85
+ }
86
+ }
87
+ }
88
+ return files;
89
+ }
90
+ /**
91
+ * The collections an engine serves, from the layers its providers opened.
92
+ *
93
+ * The gazetteer is always open, because the engine refuses to start without one,
94
+ * so places and plus codes are always served.
95
+ * Postcodes are served when the gazetteer holds postcode places.
96
+ *
97
+ * Addresses and streets are served when some region has an address-point, interpolation
98
+ * or street-centroid layer, and their descriptions name those regions.
99
+ *
100
+ * A collection no region has a layer for is left out of the list.
101
+ *
102
+ * A provider opens a region's layers when asked for the region.
103
+ * A query for that region would open them as well.
104
+ */
105
+ export function servedCollections(probes, gazetteer) {
106
+ const addressRegions = new Set();
107
+ const streetRegions = new Set();
108
+ for (const { provider, keys, regionOf } of probes) {
109
+ for (const key of keys) {
110
+ const databases = provider.for(key);
111
+ if (databases.addressPoints || databases.interpolation) {
112
+ addressRegions.add(regionOf(key));
113
+ }
114
+ if (databases.streetCentroids) {
115
+ streetRegions.add(regionOf(key));
116
+ }
117
+ }
118
+ }
119
+ const served = [];
120
+ if (addressRegions.size) {
121
+ served.push({ id: OGCCollectionID.Addresses, regions: [...addressRegions].toSorted() });
122
+ }
123
+ if (streetRegions.size) {
124
+ served.push({ id: OGCCollectionID.Streets, regions: [...streetRegions].toSorted() });
125
+ }
126
+ if (gazetteer.postcodes) {
127
+ served.push({ id: OGCCollectionID.Postcodes, regions: null });
128
+ }
129
+ served.push({ id: OGCCollectionID.Places, regions: null }, { id: OGCCollectionID.PlusCodes, regions: null });
130
+ return served;
131
+ }
132
+ //# sourceMappingURL=collections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collections.js","sourceRoot":"","sources":["../lib/collections.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAmBlE;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,YAAY;CACd,CAAA;AAYV;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAA0D;IAC5F,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE;QAC5B,KAAK,EAAE,WAAW;QAClB,WAAW,EACV,2GAA2G;KAC5G;IACD,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE;QAC1B,KA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