@unmap/sdk 0.14.0 → 0.15.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/dist/index.d.ts +2 -59
- package/dist/index.js +3 -63
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -60,15 +60,15 @@ including service after midnight and `calendar_dates.txt` exceptions; they are n
|
|
|
60
60
|
The same SDK loads from a script tag, with MapLibre already inside it:
|
|
61
61
|
|
|
62
62
|
```html
|
|
63
|
-
<link rel="stylesheet" href="https://cdn.unmap.dev/sdk/0.
|
|
63
|
+
<link rel="stylesheet" href="https://cdn.unmap.dev/sdk/0.15.0/unmap.css">
|
|
64
64
|
<div id="map" style="height: 400px"></div>
|
|
65
|
-
<script src="https://cdn.unmap.dev/sdk/0.
|
|
65
|
+
<script src="https://cdn.unmap.dev/sdk/0.15.0/unmap.js"></script>
|
|
66
66
|
<script>
|
|
67
67
|
unmap.createMap({ key: 'um_live_...', container: '#map', center: [-114.07, 51.05] })
|
|
68
68
|
</script>
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
Everything above is on the `unmap` global: `unmap.Unmap`, `unmap.Geocoder`, `unmap.Router`, `unmap.maplibregl`. Pin the exact version in production; `/sdk/0.
|
|
71
|
+
Everything above is on the `unmap` global: `unmap.Unmap`, `unmap.Geocoder`, `unmap.Router`, `unmap.maplibregl`. Pin the exact version in production; `/sdk/0.15/` follows patches and `/sdk/latest/` follows everything.
|
|
72
72
|
|
|
73
73
|
## Options
|
|
74
74
|
|
package/dist/index.d.ts
CHANGED
|
@@ -466,59 +466,6 @@ declare class Timezone {
|
|
|
466
466
|
lookup(coordinate: [number, number], opts?: TimezoneLookupOptions): Promise<TimezoneResult>;
|
|
467
467
|
}
|
|
468
468
|
|
|
469
|
-
interface GeolocationOptions {
|
|
470
|
-
key: string;
|
|
471
|
-
gateway?: string;
|
|
472
|
-
fetch?: typeof fetch;
|
|
473
|
-
/**
|
|
474
|
-
* Retry policy for `429`, `502`, `503` and transport failures. `false` disables it.
|
|
475
|
-
*
|
|
476
|
-
* On by default. A wait longer than `maxDelayMs` (10 s) is not slept through; the error
|
|
477
|
-
* carries `retryAfterSeconds` instead.
|
|
478
|
-
*/
|
|
479
|
-
retry?: RetryPolicy | false;
|
|
480
|
-
}
|
|
481
|
-
interface IpGeolocationResult {
|
|
482
|
-
ip: string | null;
|
|
483
|
-
location: {
|
|
484
|
-
lat: number | null;
|
|
485
|
-
lng: number | null;
|
|
486
|
-
};
|
|
487
|
-
city: string | null;
|
|
488
|
-
region: string | null;
|
|
489
|
-
regionCode: string | null;
|
|
490
|
-
postalCode: string | null;
|
|
491
|
-
country: string | null;
|
|
492
|
-
continent: string | null;
|
|
493
|
-
timezone: string | null;
|
|
494
|
-
network: {
|
|
495
|
-
asn: number | null;
|
|
496
|
-
organization: string | null;
|
|
497
|
-
};
|
|
498
|
-
precision: "approximate";
|
|
499
|
-
}
|
|
500
|
-
declare class GeolocationError extends UnmapError {
|
|
501
|
-
constructor(status: number, message: string, code?: string, retryAfterSeconds?: number);
|
|
502
|
-
}
|
|
503
|
-
/** Typed client for `GET /ip`. One call, one metered request, on the shared pool. */
|
|
504
|
-
declare class Geolocation {
|
|
505
|
-
private readonly key;
|
|
506
|
-
private readonly base;
|
|
507
|
-
private readonly fetchImpl;
|
|
508
|
-
private readonly retry;
|
|
509
|
-
constructor(opts: GeolocationOptions);
|
|
510
|
-
/**
|
|
511
|
-
* Approximate country, region, city, coordinates, and timezone of this request.
|
|
512
|
-
*
|
|
513
|
-
* const location = await unmap.geolocation.ip();
|
|
514
|
-
*
|
|
515
|
-
* A field the network did not identify is `null`. The call still resolves.
|
|
516
|
-
*/
|
|
517
|
-
ip(opts?: {
|
|
518
|
-
signal?: AbortSignal;
|
|
519
|
-
}): Promise<IpGeolocationResult>;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
469
|
interface UnmapOptions {
|
|
523
470
|
key: string;
|
|
524
471
|
gateway?: string;
|
|
@@ -558,7 +505,7 @@ interface UnmapOptions {
|
|
|
558
505
|
}
|
|
559
506
|
/**
|
|
560
507
|
* One Stripe-style key, the whole platform. With a `container` you get a rendered map.
|
|
561
|
-
* `geocoder`, `router`, `elevation`,
|
|
508
|
+
* `geocoder`, `router`, `elevation`, and `timezone` are always available.
|
|
562
509
|
*
|
|
563
510
|
* const map = new Unmap({ key: "um_live_...", container: "#map", center: [-75.69, 45.42] });
|
|
564
511
|
*/
|
|
@@ -582,10 +529,6 @@ declare class Unmap {
|
|
|
582
529
|
* and road events are one province.
|
|
583
530
|
*/
|
|
584
531
|
readonly coverage: Coverage;
|
|
585
|
-
/**
|
|
586
|
-
* Approximate location of the current request. Not device GPS. One call on the shared pool.
|
|
587
|
-
*/
|
|
588
|
-
readonly geolocation: Geolocation;
|
|
589
532
|
readonly data: {
|
|
590
533
|
query(opts: QueryOptions): Promise<QueryResponse>;
|
|
591
534
|
};
|
|
@@ -595,4 +538,4 @@ declare class Unmap {
|
|
|
595
538
|
identify(opts: IdentifyOptions): Promise<IdentifyResponse>;
|
|
596
539
|
}
|
|
597
540
|
|
|
598
|
-
export { type AffectedRoad, Coverage, type CoverageCapability, type CoverageDocument, CoverageError, type CoverageFreshness, type CoverageOptions, type CoverageSource, type DepartureOptions, Feedback, type FeedbackCategory, type FeedbackProduct, type FeedbackReceipt, type FeedbackReport,
|
|
541
|
+
export { type AffectedRoad, Coverage, type CoverageCapability, type CoverageDocument, CoverageError, type CoverageFreshness, type CoverageOptions, type CoverageSource, type DepartureOptions, Feedback, type FeedbackCategory, type FeedbackProduct, type FeedbackReceipt, type FeedbackReport, type NearbyStopsOptions, type RoadCondition, type RoadEvent, type RoadEventQuery, type RoadEventType, type RoadEventsResponse, type RoadSeverity, Roads, RoadsError, type RoadsOptions, Timezone, TimezoneError, type TimezoneLookupOptions, type TimezoneOptions, type TimezoneResult, Transit, type TransitAgency, type TransitDeparture, TransitError, type TransitMeta, type TransitMetaStatus, type TransitOptions, type TransitResponse, type TransitRoute, type TransitStop, Unmap, type UnmapOptions };
|
package/dist/index.js
CHANGED
|
@@ -279,59 +279,6 @@ async function errorFrom3(res) {
|
|
|
279
279
|
return new TimezoneError(res.status, message, code, retryAfter);
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
// src/geolocation.ts
|
|
283
|
-
import { DEFAULT_GATEWAY as DEFAULT_GATEWAY5, UnmapError as UnmapError5, fetchWithRetry as fetchWithRetry5, parseRetryAfter as parseRetryAfter5 } from "@unmap/core";
|
|
284
|
-
var IP_PATH = "/ip";
|
|
285
|
-
var GeolocationError = class extends UnmapError5 {
|
|
286
|
-
constructor(status, message, code, retryAfterSeconds) {
|
|
287
|
-
super(status, message, code, retryAfterSeconds);
|
|
288
|
-
this.name = "GeolocationError";
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
var Geolocation = class {
|
|
292
|
-
key;
|
|
293
|
-
base;
|
|
294
|
-
fetchImpl;
|
|
295
|
-
retry;
|
|
296
|
-
constructor(opts) {
|
|
297
|
-
this.key = opts.key;
|
|
298
|
-
this.base = (opts.gateway ?? DEFAULT_GATEWAY5).replace(/\/+$/, "");
|
|
299
|
-
this.fetchImpl = opts.fetch ?? globalThis.fetch.bind(globalThis);
|
|
300
|
-
this.retry = opts.retry;
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Approximate country, region, city, coordinates, and timezone of this request.
|
|
304
|
-
*
|
|
305
|
-
* const location = await unmap.geolocation.ip();
|
|
306
|
-
*
|
|
307
|
-
* A field the network did not identify is `null`. The call still resolves.
|
|
308
|
-
*/
|
|
309
|
-
async ip(opts = {}) {
|
|
310
|
-
const q = new URLSearchParams({ key: this.key });
|
|
311
|
-
const res = await fetchWithRetry5(
|
|
312
|
-
this.fetchImpl,
|
|
313
|
-
`${this.base}${IP_PATH}?${q}`,
|
|
314
|
-
{ signal: opts.signal, headers: { accept: "application/json" } },
|
|
315
|
-
this.retry
|
|
316
|
-
);
|
|
317
|
-
if (!res.ok) throw await errorFrom4(res);
|
|
318
|
-
return await res.json();
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
|
-
async function errorFrom4(res) {
|
|
322
|
-
const fallback = `geolocation ${res.status}`;
|
|
323
|
-
let body;
|
|
324
|
-
try {
|
|
325
|
-
body = await res.json();
|
|
326
|
-
} catch {
|
|
327
|
-
body = void 0;
|
|
328
|
-
}
|
|
329
|
-
const reason = typeof body?.error === "string" ? body.error : void 0;
|
|
330
|
-
const code = typeof body?.code === "string" ? body.code : void 0;
|
|
331
|
-
const retryAfter = parseRetryAfter5(res.headers?.get("retry-after") ?? null) ?? void 0;
|
|
332
|
-
return new GeolocationError(res.status, reason ? `${reason} (${fallback})` : fallback, code, retryAfter);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
282
|
// src/index.ts
|
|
336
283
|
import { Router } from "@unmap/routing";
|
|
337
284
|
import { Elevation } from "@unmap/elevation";
|
|
@@ -339,7 +286,7 @@ export * from "@unmap/geocoding";
|
|
|
339
286
|
export * from "@unmap/routing";
|
|
340
287
|
export * from "@unmap/elevation";
|
|
341
288
|
import { createMap as createMap2, unmapStyle, DEMO_CITIES, STYLE_NAMES, maplibregl } from "@unmap/maps";
|
|
342
|
-
import { UnmapError as
|
|
289
|
+
import { UnmapError as UnmapError5, parseRetryAfter as parseRetryAfter5 } from "@unmap/core";
|
|
343
290
|
var Unmap = class {
|
|
344
291
|
geocoder;
|
|
345
292
|
router;
|
|
@@ -360,10 +307,6 @@ var Unmap = class {
|
|
|
360
307
|
* and road events are one province.
|
|
361
308
|
*/
|
|
362
309
|
coverage;
|
|
363
|
-
/**
|
|
364
|
-
* Approximate location of the current request. Not device GPS. One call on the shared pool.
|
|
365
|
-
*/
|
|
366
|
-
geolocation;
|
|
367
310
|
data;
|
|
368
311
|
map;
|
|
369
312
|
constructor(opts) {
|
|
@@ -376,7 +319,6 @@ var Unmap = class {
|
|
|
376
319
|
this.feedback = new Feedback(opts);
|
|
377
320
|
this.transit = new Transit(opts);
|
|
378
321
|
this.coverage = new Coverage(opts);
|
|
379
|
-
this.geolocation = new Geolocation(opts);
|
|
380
322
|
this.data = { query: (queryOpts) => this.geocoder.queryLayer(queryOpts) };
|
|
381
323
|
if (opts.container) {
|
|
382
324
|
this.map = createMap({ ...opts, container: opts.container });
|
|
@@ -392,8 +334,6 @@ export {
|
|
|
392
334
|
CoverageError,
|
|
393
335
|
DEMO_CITIES,
|
|
394
336
|
Feedback,
|
|
395
|
-
Geolocation,
|
|
396
|
-
GeolocationError,
|
|
397
337
|
Roads,
|
|
398
338
|
RoadsError,
|
|
399
339
|
STYLE_NAMES,
|
|
@@ -402,10 +342,10 @@ export {
|
|
|
402
342
|
Transit,
|
|
403
343
|
TransitError,
|
|
404
344
|
Unmap,
|
|
405
|
-
|
|
345
|
+
UnmapError5 as UnmapError,
|
|
406
346
|
createMap2 as createMap,
|
|
407
347
|
maplibregl,
|
|
408
|
-
|
|
348
|
+
parseRetryAfter5 as parseRetryAfter,
|
|
409
349
|
unmapStyle
|
|
410
350
|
};
|
|
411
351
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/roads.ts","../src/transit.ts","../src/coverage.ts","../src/timezone.ts","../src/geolocation.ts"],"sourcesContent":["import {\n createMap,\n type Map as MaplibreMap,\n type MapProfile,\n type UnmapControlsOptions,\n type UnmapMapOptions,\n} from \"@unmap/maps\";\nimport { Geocoder, Places, type IdentifyOptions, type IdentifyResponse, type QueryOptions, type QueryResponse } from \"@unmap/geocoding\";\nimport { Feedback, Roads } from \"./roads\";\nimport { Transit } from \"./transit\";\nimport { Coverage } from \"./coverage\";\nimport { Timezone } from \"./timezone\";\nimport { Geolocation } from \"./geolocation\";\nimport { Router } from \"@unmap/routing\";\nimport { Elevation } from \"@unmap/elevation\";\nimport type { RetryPolicy } from \"@unmap/core\";\n\nexport * from \"@unmap/geocoding\";\nexport * from \"@unmap/routing\";\nexport * from \"@unmap/elevation\";\nexport * from \"./roads\";\nexport * from \"./transit\";\nexport * from \"./coverage\";\nexport * from \"./timezone\";\nexport * from \"./geolocation\";\nexport { createMap, unmapStyle, DEMO_CITIES, STYLE_NAMES, maplibregl } from \"@unmap/maps\";\nexport type {\n Map,\n UnmapMapOptions,\n UnmapControlsOptions,\n DemoCity,\n StyleName,\n StyleInput,\n Projection,\n MapProfile,\n} from \"@unmap/maps\";\n\nexport interface UnmapOptions {\n key: string;\n gateway?: string;\n /** Override the fetch implementation (tests, non-global environments). */\n fetch?: typeof fetch;\n /**\n * Retry policy shared by every client on this instance. `false` disables it.\n *\n * On by default for `429`, `502`, `503` and transport failures. `Retry-After` is on a `429`\n * other than `billing_required`, and on a container `503`. A `502` has none. A wait longer\n * than `maxDelayMs` (10 s) is not slept through; the error carries `retryAfterSeconds`\n * instead, because a cold land or energy container asks for 60 and parking a request handler\n * for a minute is a worse surprise than an error. Feedback submissions are never retried:\n * they create a record and carry no idempotency key.\n */\n retry?: RetryPolicy | false;\n /** If provided, a map is mounted in this container. */\n container?: string | HTMLElement;\n style?: string;\n flavor?: string;\n /** \"light\" or \"dark\". Selects the mode half of the named style. */\n mode?: string;\n /** Label language, e.g. \"fr\". Omit to follow the request's Accept-Language. */\n lang?: string;\n /** Compact `ut1.` theme code from unmap.dev/create. Wins over the path style on the gateway. */\n theme?: string;\n /** Catalog layer ids composed onto the style (`municipalities`, `survey.dls`, …). */\n overlays?: readonly string[];\n /** Composition preset. Not a style. Explicit overlays replace the profile list. */\n profile?: MapProfile;\n /** `\"globe\"` or `\"mercator\"`. See `@unmap/maps` `UnmapMapOptions.projection`. */\n projection?: UnmapMapOptions[\"projection\"];\n center?: [number, number];\n zoom?: number;\n /** On-map controls. `true` (the default) adds zoom and compass buttons; `false` adds none. */\n controls?: boolean | UnmapControlsOptions;\n}\n\n/**\n * One Stripe-style key, the whole platform. With a `container` you get a rendered map.\n * `geocoder`, `router`, `elevation`, `timezone`, and `geolocation` are always available.\n *\n * const map = new Unmap({ key: \"um_live_...\", container: \"#map\", center: [-75.69, 45.42] });\n */\nexport class Unmap {\n readonly geocoder: Geocoder;\n readonly router: Router;\n readonly elevation: Elevation;\n /** IANA timezone and the UTC offset at an instant. One call, anywhere. */\n readonly timezone: Timezone;\n /** Canadian points of interest. Same corpus as the geocoder, in the Place shape. */\n readonly places: Places;\n /** Closures, incidents, construction and road conditions. */\n readonly roads: Roads;\n /** Report wrong data. Never metered. */\n readonly feedback: Feedback;\n /** Scheduled public-transit agencies, stops, routes and departures. */\n readonly transit: Transit;\n /**\n * Where each capability actually works. Unauthenticated and unmetered, so checking costs\n * nothing: read it before promising a user an answer, because transit routing is one agency\n * and road events are one province.\n */\n readonly coverage: Coverage;\n /**\n * Approximate location of the current request. Not device GPS. One call on the shared pool.\n */\n readonly geolocation: Geolocation;\n readonly data: { query(opts: QueryOptions): Promise<QueryResponse> };\n readonly map?: MaplibreMap;\n\n constructor(opts: UnmapOptions) {\n this.geocoder = new Geocoder(opts);\n this.router = new Router(opts);\n this.elevation = new Elevation(opts);\n this.timezone = new Timezone(opts);\n this.places = new Places(opts);\n this.roads = new Roads(opts);\n this.feedback = new Feedback(opts);\n this.transit = new Transit(opts);\n this.coverage = new Coverage(opts);\n this.geolocation = new Geolocation(opts);\n this.data = { query: (queryOpts) => this.geocoder.queryLayer(queryOpts) };\n if (opts.container) {\n this.map = createMap({ ...opts, container: opts.container } as UnmapMapOptions);\n }\n }\n\n /** Which catalog features contain a point. See `Geocoder.identify`. */\n identify(opts: IdentifyOptions): Promise<IdentifyResponse> {\n return this.geocoder.identify(opts);\n }\n}\n\n// The shared error type and retry policy, re-exported so a caller who installed only this\n// package can `catch (e) { if (e instanceof UnmapError) }` without adding @unmap/core.\nexport { UnmapError, parseRetryAfter, type RetryPolicy } from \"@unmap/core\";\n","import { DEFAULT_GATEWAY, UnmapError, fetchWithRetry, parseRetryAfter, type RetryPolicy } from \"@unmap/core\";\n\n/**\n * Typed clients for road events (`/incidents`, `/closures`, `/road-conditions`) and for data\n * correction (`POST /feedback`).\n *\n * These live in `@unmap/sdk` rather than in packages of their own. A twelfth and thirteenth npm\n * package would each need an entry in the changesets fixed group and a trusted publisher\n * configured on npmjs.com, which is founder work, and neither has a framework wrapper the way\n * geocoding and routing do. If a customer ever wants roads without the rest of the SDK, that is\n * the moment to split it out.\n */\n\nexport type RoadEventType =\n | \"closure\"\n | \"incident\"\n | \"construction\"\n | \"weather\"\n | \"restriction\"\n | \"ferry\"\n | \"hazard\"\n | \"special_event\"\n | \"unknown\";\n\nexport type RoadCondition =\n | \"dry\"\n | \"wet\"\n | \"snow\"\n | \"ice\"\n | \"packed_snow\"\n | \"reduced_visibility\"\n | \"travel_not_recommended\"\n | \"closed\"\n | \"unknown\";\n\nexport type RoadSeverity = \"minor\" | \"major\" | \"unknown\";\n\nexport interface AffectedRoad {\n name: string;\n direction: \"north\" | \"south\" | \"east\" | \"west\" | \"both\" | \"unknown\";\n /** True only when the publisher says closed. Never inferred from the description. */\n closed: boolean;\n from?: string;\n to?: string;\n condition: RoadCondition;\n}\n\nexport interface RoadEvent {\n /** `um:road:<jurisdiction>:<publisher id>`. */\n id: string;\n /** The publisher's own id, so a report can be taken back to them. */\n source_id: string;\n /** ISO 3166-2, e.g. `CA-BC`. */\n jurisdiction: string;\n type: RoadEventType;\n /** The publisher's own subtype strings, untranslated. */\n subtypes: string[];\n status: \"active\" | \"planned\" | \"archived\";\n severity: RoadSeverity;\n /**\n * The publisher's description, verbatim.\n *\n * Believe this over `type` when they disagree: our categories are a lossy projection of someone\n * else's taxonomy, and the sentence a driver needs is in the prose.\n */\n description: string;\n headline?: string;\n /** The worst surface condition across this event's roads. */\n condition: RoadCondition;\n roads: AffectedRoad[];\n /** GeoJSON Point or LineString, WGS84. */\n geometry: { type: string; coordinates: unknown } | null;\n starts_at: string | null;\n ends_at: string | null;\n source_updated_at: string | null;\n unmap_updated_at: string;\n source: string;\n}\n\nexport interface RoadEventsResponse {\n data: RoadEvent[];\n meta: {\n status: \"current\" | \"stale\" | \"partial\" | \"unknown\";\n attribution: string;\n unmap_updated_at: string;\n /**\n * Jurisdictions that could not be reached, each with a reason.\n *\n * **Check this.** On `/closures` an empty `data` reads as \"nothing is shut\" to someone\n * deciding whether to drive, and that is a very different answer from \"we could not reach\n * British Columbia\".\n */\n unavailable?: { jurisdiction: string; reason: string }[];\n };\n}\n\nexport interface RoadEventQuery {\n /** Comma-separated ISO 3166-2 codes, or an array. An uncovered code is a 400, not an empty list. */\n jurisdiction?: string | readonly string[];\n bbox?: [number, number, number, number];\n near?: [number, number];\n /** Metres from `near`. Default 25000, max 500000. */\n radius?: number;\n type?: RoadEventType | readonly RoadEventType[];\n severity?: RoadSeverity | readonly RoadSeverity[];\n status?: \"active\" | \"planned\" | \"archived\";\n /** ISO 8601. Only events the publisher changed at or after this time. */\n updated_since?: string;\n /** 1 to 500, default 100. Applied AFTER the endpoint's own narrowing. */\n limit?: number;\n signal?: AbortSignal;\n}\n\nexport interface RoadsOptions {\n key: string;\n gateway?: string;\n fetch?: typeof fetch;\n /**\n * Retry policy for `429`, `502`, `503` and transport failures. `false` disables it.\n *\n * On by default. `Retry-After` is on a `429` other than `billing_required`, and on a container\n * `503`. A `502` has none: routing uses `routing_failed`, and `/elevation` uses\n * `upstream_error`. With no header the client backs off itself. A wait longer than\n * `maxDelayMs` (10 s) is not slept through; the error carries `retryAfterSeconds` instead.\n * See `RetryPolicy` in `@unmap/core`.\n */\n retry?: RetryPolicy | false;\n}\n\n/**\n * A road events failure.\n *\n * Extends `UnmapError`, so `catch (e) { if (e instanceof UnmapError) }` catches this alongside\n * every other unmap client's errors. `instanceof RoadsError` keeps working, and `status` and `code`\n * are still where they were; `retryAfterSeconds` is new and comes from the header.\n */\nexport class RoadsError extends UnmapError {\n constructor(status: number, message: string, code?: string, retryAfterSeconds?: number) {\n super(status, message, code, retryAfterSeconds);\n this.name = \"RoadsError\";\n }\n}\n\nfunction list(value: string | readonly string[] | undefined): string | undefined {\n if (value === undefined) return undefined;\n return Array.isArray(value) ? value.join(\",\") : String(value);\n}\n\nasync function errorFrom(res: Response, path: string, name: string): Promise<RoadsError> {\n const fallback = `${name} ${res.status} on ${path}`;\n let body: { error?: unknown; code?: unknown } | undefined;\n try {\n body = (await res.json()) as { error?: unknown; code?: unknown };\n } catch {\n body = undefined;\n }\n const reason = typeof body?.error === \"string\" ? body.error : undefined;\n const code = typeof body?.code === \"string\" ? body.code : undefined;\n const retryAfter = parseRetryAfter(res.headers?.get(\"retry-after\") ?? null) ?? undefined;\n return new RoadsError(res.status, reason ? `${reason} (${fallback})` : fallback, code, retryAfter);\n}\n\n/**\n * Canadian road events.\n *\n * const { data, meta } = await unmap.roads.closures({ jurisdiction: \"CA-BC\" });\n *\n * A 503 means every requested jurisdiction was unreachable; the body still carries\n * `meta.unavailable`, so the thrown error is the exception rather than the information. Prefer\n * reading `meta.unavailable` on a 200 over treating an empty list as good news.\n */\nexport class Roads {\n private readonly key: string;\n private readonly base: string;\n private readonly fetchImpl: typeof fetch;\n private readonly retry: RetryPolicy | false | undefined;\n\n constructor(opts: RoadsOptions) {\n this.retry = opts.retry;\n this.key = opts.key;\n this.base = (opts.gateway ?? DEFAULT_GATEWAY).replace(/\\/+$/, \"\");\n this.fetchImpl = opts.fetch ?? globalThis.fetch.bind(globalThis);\n }\n\n /** Every current road event. */\n incidents(query: RoadEventQuery = {}): Promise<RoadEventsResponse> {\n return this.request(\"/incidents\", query);\n }\n\n /** The subset where a road is actually shut. Narrowed before `limit` is applied. */\n closures(query: RoadEventQuery = {}): Promise<RoadEventsResponse> {\n return this.request(\"/closures\", query);\n }\n\n /**\n * The subset carrying a surface condition.\n *\n * Thin for British Columbia by design: its feed reports lane availability rather than the\n * surface, so unmap answers `unknown` instead of inferring a dry road from open lanes.\n */\n conditions(query: RoadEventQuery = {}): Promise<RoadEventsResponse> {\n return this.request(\"/road-conditions\", query);\n }\n\n private async request(path: string, query: RoadEventQuery): Promise<RoadEventsResponse> {\n const q = new URLSearchParams({ key: this.key });\n const params: Record<string, string | undefined> = {\n jurisdiction: list(query.jurisdiction),\n bbox: query.bbox?.join(\",\"),\n near: query.near?.join(\",\"),\n radius: query.radius != null ? String(query.radius) : undefined,\n type: list(query.type),\n severity: list(query.severity),\n status: query.status,\n updated_since: query.updated_since,\n limit: query.limit != null ? String(query.limit) : undefined,\n };\n for (const [k, v] of Object.entries(params)) if (v != null && v !== \"\") q.set(k, v);\n\n const res = await fetchWithRetry(\n this.fetchImpl,\n `${this.base}${path}?${q}`,\n { signal: query.signal, headers: { accept: \"application/json\" } },\n this.retry,\n );\n if (!res.ok) throw await errorFrom(res, path, \"roads\");\n return (await res.json()) as RoadEventsResponse;\n }\n}\n\n// ---------------------------------------------------------------------------------------------\n// Feedback\n// ---------------------------------------------------------------------------------------------\n\nexport type FeedbackProduct =\n | \"tiles\"\n | \"terrain\"\n | \"names\"\n | \"geocoding\"\n | \"places\"\n | \"routing\"\n | \"layers\"\n | \"transit\"\n | \"roads\"\n | \"ev\";\n\nexport type FeedbackCategory =\n | \"incorrect_location\"\n | \"incorrect_address\"\n | \"missing_place\"\n | \"wrong_place_name\"\n | \"wrong_category\"\n | \"bad_route\"\n | \"missing_road_closure\"\n | \"incorrect_road_condition\"\n | \"incorrect_transit_result\"\n | \"other\";\n\nexport interface FeedbackReport {\n product: FeedbackProduct;\n category: FeedbackCategory;\n /** Up to 2000 characters, stored exactly as written. One of this or `resultId` is required. */\n description?: string;\n /** The unmap id of the result being reported. */\n resultId?: string;\n /**\n * The request being reported.\n *\n * **Only send this with the reporter's explicit agreement.** The gateway refuses it without\n * `include_context: true`, which this sets whenever `context` is present, and that flag is\n * meant to record a person's choice rather than a client default. unmap redacts query strings\n * from its own logs; a client that attached them here would undo that.\n */\n context?: unknown;\n signal?: AbortSignal;\n}\n\nexport interface FeedbackReceipt {\n /** Quote this in a follow-up. */\n id: string;\n status: string;\n created_at: string;\n /** Whether a request context was actually kept. `false` when none was offered. */\n context_stored: boolean;\n}\n\n/**\n * Report wrong data.\n *\n * await unmap.feedback.submit({\n * product: \"geocoding\",\n * category: \"incorrect_location\",\n * description: \"17 Ave SW returns a street in Edmonton.\",\n * });\n *\n * Authenticated like everything else and **never metered**: telling us our data is wrong does not\n * cost a call. At most 200 reports per account per day.\n */\nexport class Feedback {\n private readonly key: string;\n private readonly base: string;\n private readonly fetchImpl: typeof fetch;\n\n constructor(opts: RoadsOptions) {\n this.key = opts.key;\n this.base = (opts.gateway ?? DEFAULT_GATEWAY).replace(/\\/+$/, \"\");\n this.fetchImpl = opts.fetch ?? globalThis.fetch.bind(globalThis);\n }\n\n submit(report: FeedbackReport): Promise<FeedbackReceipt> {\n return this.post(\"/feedback\", {\n product: report.product,\n category: report.category,\n ...(report.description ? { description: report.description } : {}),\n ...(report.resultId ? { result_id: report.resultId } : {}),\n ...(report.context !== undefined ? { include_context: true, context: report.context } : {}),\n }, report.signal);\n }\n\n /** A report about one place. `product` and `result_id` come from the path. */\n aboutPlace(\n placeId: string,\n report: Omit<FeedbackReport, \"product\" | \"resultId\">,\n ): Promise<FeedbackReceipt> {\n return this.post(`/places/${encodeURIComponent(placeId)}/feedback`, {\n category: report.category,\n ...(report.description ? { description: report.description } : {}),\n ...(report.context !== undefined ? { include_context: true, context: report.context } : {}),\n }, report.signal);\n }\n\n private async post(path: string, body: unknown, signal?: AbortSignal): Promise<FeedbackReceipt> {\n // Deliberately NOT routed through `fetchWithRetry`, unlike every read on this client.\n //\n // A feedback submission creates a record and carries no idempotency key, so a retry after a\n // timeout or a 503 risks filing the same report twice. Retrying a read costs a round trip;\n // retrying this costs the quality programme a duplicate, and the caller is the only one who\n // knows whether their report already landed.\n const res = await this.fetchImpl(`${this.base}${path}`, {\n method: \"POST\",\n signal,\n headers: { \"content-type\": \"application/json\", authorization: `Bearer ${this.key}` },\n body: JSON.stringify(body),\n });\n if (!res.ok) throw await errorFrom(res, path, \"feedback\");\n return (await res.json()) as FeedbackReceipt;\n }\n}\n","import { DEFAULT_GATEWAY, UnmapError, fetchWithRetry, parseRetryAfter, type RetryPolicy } from \"@unmap/core\";\n\nexport type TransitMetaStatus = \"current\" | \"stale\" | \"partial\" | \"unknown\";\n\nexport interface TransitMeta {\n /** Static GTFS is scheduled data. Realtime will use a different value and updated_at. */\n schedule_type: \"scheduled\";\n source?: string;\n source_updated_at?: string | null;\n source_version?: string;\n content_hash?: string | null;\n sources?: readonly {\n id: string;\n source: string;\n source_url: string;\n attribution: string;\n source_updated_at: string | null;\n source_version: string;\n content_hash: string | null;\n status: \"current\" | \"stale\" | \"unknown\";\n }[];\n unmap_updated_at: string;\n data_version?: string;\n status: TransitMetaStatus;\n attribution: string;\n}\n\nexport interface TransitResponse<T> {\n data: T;\n meta: TransitMeta;\n}\n\nexport interface TransitAgency {\n id: string;\n feed: string;\n name: string;\n url?: string;\n timezone: string;\n lang?: string;\n phone?: string;\n fare_url?: string;\n}\n\nexport interface TransitStop {\n id: string;\n feed: string;\n name: string;\n coordinates: [number, number];\n code?: string;\n description?: string;\n zone_id?: string;\n parent_station_id?: string;\n wheelchair_boarding?: 0 | 1 | 2;\n route_ids: string[];\n /** Metres from the requested point. Present only on nearbyStops. */\n distance?: number;\n}\n\nexport interface TransitRoute {\n id: string;\n feed: string;\n agency_id: string;\n short_name?: string;\n long_name?: string;\n description?: string;\n route_type: number;\n colour?: string;\n text_colour?: string;\n url?: string;\n}\n\nexport interface TransitDeparture {\n stop_id: string;\n route_id: string;\n trip_id: string;\n headsign?: string;\n arrival: string;\n departure: string;\n stop_sequence: number;\n /** 2 = phone agency; 3 = coordinate with driver. Omitted for ordinary pickup. */\n pickup_type?: 2 | 3;\n schedule_type: \"scheduled\";\n}\n\nexport interface NearbyStopsOptions {\n /** Metres. Default 1000, range 50 to 10000. */\n radius?: number;\n /** Default 20, maximum 100. */\n limit?: number;\n signal?: AbortSignal;\n}\n\nexport interface DepartureOptions {\n /** An instant. Date values serialize to ISO; strings must include Z or an offset. Default now. */\n at?: Date | string;\n /** Minutes after at. Default 60, maximum 240. */\n window?: number;\n /** Default 50, maximum 200. */\n limit?: number;\n signal?: AbortSignal;\n}\n\nexport interface TransitOptions {\n key: string;\n gateway?: string;\n fetch?: typeof fetch;\n /**\n * Retry policy for `429`, `502`, `503` and transport failures. `false` disables it.\n *\n * On by default. `Retry-After` is on a `429` other than `billing_required`, and on a container\n * `503`. A `502` has none: routing uses `routing_failed`, and `/elevation` uses\n * `upstream_error`. With no header the client backs off itself. A wait longer than\n * `maxDelayMs` (10 s) is not slept through; the error carries `retryAfterSeconds` instead.\n * See `RetryPolicy` in `@unmap/core`.\n */\n retry?: RetryPolicy | false;\n}\n\n/**\n * A transit failure.\n *\n * Extends `UnmapError`, so `catch (e) { if (e instanceof UnmapError) }` catches this alongside\n * every other unmap client's errors. `instanceof TransitError` keeps working, and `status` and `code`\n * are still where they were; `retryAfterSeconds` is new and comes from the header.\n */\nexport class TransitError extends UnmapError {\n constructor(status: number, message: string, code?: string, retryAfterSeconds?: number) {\n super(status, message, code, retryAfterSeconds);\n this.name = \"TransitError\";\n }\n}\n\n/**\n * The gateway's error body, as a `TransitError`.\n *\n * Named rather than inline since 2026-09-20: `fetchWithRetry` needs to inspect the failure to\n * decide whether to wait, and the throw needs to build the same error. Two copies of this would\n * be two chances for the retry predicate and the thrown error to disagree.\n */\nasync function errorFrom(res: Response, path: string): Promise<TransitError> {\n let body: { error?: unknown; code?: unknown } = {};\n try {\n body = (await res.json()) as typeof body;\n } catch {\n /* use the bounded fallback */\n }\n const message = typeof body.error === \"string\" ? body.error : `transit ${res.status} on ${path}`;\n const code = typeof body.code === \"string\" ? body.code : undefined;\n const retryAfter = parseRetryAfter(res.headers?.get(\"retry-after\") ?? null) ?? undefined;\n return new TransitError(res.status, message, code, retryAfter);\n}\n\n/** Static Canadian GTFS data. Scheduled departures ship before realtime. */\nexport class Transit {\n private readonly key: string;\n private readonly base: string;\n private readonly fetchImpl: typeof fetch;\n private readonly retry: RetryPolicy | false | undefined;\n\n constructor(opts: TransitOptions) {\n this.retry = opts.retry;\n this.key = opts.key;\n this.base = (opts.gateway ?? DEFAULT_GATEWAY).replace(/\\/+$/, \"\");\n this.fetchImpl = opts.fetch ?? globalThis.fetch.bind(globalThis);\n }\n\n agencies(signal?: AbortSignal): Promise<TransitResponse<TransitAgency[]>> {\n return this.get(\"/transit/agencies\", undefined, signal);\n }\n\n nearbyStops(near: [number, number], options: NearbyStopsOptions = {}): Promise<TransitResponse<TransitStop[]>> {\n return this.get(\"/transit/stops\", {\n near: near.join(\",\"),\n radius: options.radius,\n limit: options.limit,\n }, options.signal);\n }\n\n getStop(id: string, signal?: AbortSignal): Promise<TransitResponse<TransitStop>> {\n return this.get(`/transit/stops/${encodeURIComponent(id)}`, undefined, signal);\n }\n\n getRoute(id: string, signal?: AbortSignal): Promise<TransitResponse<TransitRoute>> {\n return this.get(`/transit/routes/${encodeURIComponent(id)}`, undefined, signal);\n }\n\n departures(id: string, options: DepartureOptions = {}): Promise<TransitResponse<TransitDeparture[]>> {\n return this.get(`/transit/stops/${encodeURIComponent(id)}/departures`, {\n at: options.at instanceof Date ? options.at.toISOString() : options.at,\n window: options.window,\n limit: options.limit,\n }, options.signal);\n }\n\n private async get<T>(\n path: string,\n values?: Record<string, string | number | undefined>,\n signal?: AbortSignal,\n ): Promise<TransitResponse<T>> {\n const query = new URLSearchParams({ key: this.key });\n for (const [name, value] of Object.entries(values ?? {})) {\n if (value !== undefined) query.set(name, String(value));\n }\n const response = await fetchWithRetry(\n this.fetchImpl,\n `${this.base}${path}?${query}`,\n { signal, headers: { accept: \"application/json\" } },\n this.retry,\n );\n if (!response.ok) throw await errorFrom(response, path);\n return await response.json() as TransitResponse<T>;\n }\n}\n","import { DEFAULT_GATEWAY, UnmapError, fetchWithRetry, parseRetryAfter, type RetryPolicy } from \"@unmap/core\";\n\n/**\n * `GET /coverage.json` — where each capability actually works, and where it does not.\n *\n * The document is generated from the gateway's source registry rather than written by hand, so\n * it cannot claim a capability with no registered source behind it. It is also the only place\n * that answers \"is transit routing live in this city\" before you promise a user an answer:\n * routing is one agency, road events are one province, and Places coverage is OpenStreetMap's,\n * which is thin outside cities.\n *\n * Unauthenticated and unmetered on the gateway, which is why this client takes no key: a\n * developer deciding whether to use unmap has no key yet, and a customer checking whether a gap\n * has closed should not pay a call to be told it has not.\n */\n\n/** The one path this client calls. A literal so the gateway's SDK-parity audit can see it. */\nconst COVERAGE_PATH = \"/coverage.json\";\n\n/** Freshness of a capability or a source. `unknown` means no cadence was declared. */\nexport type CoverageFreshness = \"current\" | \"stale\" | \"unknown\";\n\nexport interface CoverageSource {\n id: string;\n provider: string;\n /** Bilingual, like every human-readable field in this document. */\n dataset_name: { en: string; fr: string };\n canonical_url: string;\n licence: { en: string; fr: string };\n licence_url: string;\n attribution: string;\n jurisdiction: string[];\n /** ISO 8601 duration, e.g. `P1D`. */\n refresh_interval: string;\n last_checked_at: string;\n last_success_at: string;\n source_version: string;\n content_hash: string | null;\n freshness: CoverageFreshness;\n stale_after: string | null;\n coverage: string;\n known_gaps: { en: string; fr: string };\n quality_status: string;\n}\n\nexport interface CoverageCapability {\n /** `tiles`, `geocoding`, `routing`, `places`, `transit`, `roads`, and so on. */\n id: string;\n display_name: { en: string; fr: string };\n /** `planned` is published as honestly as `live`: a capability absent from the page reads as \"not our problem\". */\n availability: \"live\" | \"planned\";\n /** The endpoints that serve it. Empty while planned. */\n endpoints: string[];\n coverage: { en: string; fr: string };\n /** Written to be accurate rather than flattering. Read this before promising coverage to a user. */\n known_gaps: { en: string; fr: string };\n /** ISO 3166-2 subdivisions, or `CA` for national. */\n jurisdictions: string[];\n freshness: CoverageFreshness;\n sources: CoverageSource[];\n}\n\nexport interface CoverageDocument {\n generated_at: string;\n freshness_basis: string;\n capabilities: CoverageCapability[];\n jurisdictions: unknown;\n}\n\nexport class CoverageError extends UnmapError {\n constructor(status: number, message: string, code?: string, retryAfterSeconds?: number) {\n super(status, message, code, retryAfterSeconds);\n this.name = \"CoverageError\";\n }\n}\n\nexport interface CoverageOptions {\n gateway?: string;\n /** Override the fetch implementation (tests, non-global environments). */\n fetch?: typeof fetch;\n retry?: RetryPolicy | false;\n}\n\n/** Where unmap works. Takes no key: the endpoint is unauthenticated and unmetered. */\nexport class Coverage {\n private readonly base: string;\n private readonly fetchImpl: typeof fetch;\n private readonly retry: RetryPolicy | false | undefined;\n\n constructor(opts: CoverageOptions = {}) {\n this.base = (opts.gateway ?? DEFAULT_GATEWAY).replace(/\\/+$/, \"\");\n this.fetchImpl = opts.fetch ?? globalThis.fetch.bind(globalThis);\n this.retry = opts.retry;\n }\n\n /** The whole document. Cached an hour at the edge, so polling it is cheap. */\n async get(opts: { signal?: AbortSignal } = {}): Promise<CoverageDocument> {\n const res = await fetchWithRetry(\n this.fetchImpl,\n `${this.base}${COVERAGE_PATH}`,\n { signal: opts.signal, headers: { accept: \"application/json\" } },\n this.retry,\n );\n if (!res.ok) {\n const retryAfter = parseRetryAfter(res.headers?.get?.(\"retry-after\") ?? null) ?? undefined;\n throw new CoverageError(res.status, `coverage ${res.status}`, undefined, retryAfter);\n }\n return (await res.json()) as CoverageDocument;\n }\n\n /**\n * One capability by id, or `undefined` when the document does not describe it.\n *\n * const transit = await unmap.coverage.capability(\"transit\");\n * if (!transit?.jurisdictions.includes(\"CA-ON\")) return \"not available here yet\";\n */\n async capability(id: string, opts: { signal?: AbortSignal } = {}): Promise<CoverageCapability | undefined> {\n const doc = await this.get(opts);\n return doc.capabilities.find((c) => c.id === id);\n }\n}\n","import { DEFAULT_GATEWAY, UnmapError, fetchWithRetry, parseRetryAfter, type RetryPolicy } from \"@unmap/core\";\n\n/** The one path this client calls. A literal so the gateway's SDK-parity audit can see it. */\nconst TIMEZONE_PATH = \"/timezone\";\n\nexport interface TimezoneResult {\n timezone: string | null;\n offset: string | null;\n offsetSeconds: number | null;\n dst: boolean | null;\n}\n\nexport interface TimezoneLookupOptions {\n /** Instant the offset is evaluated at. Omit it for the current time. */\n at?: Date;\n signal?: AbortSignal;\n}\n\nexport class TimezoneError extends UnmapError {\n constructor(status: number, message: string, code?: string, retryAfterSeconds?: number) {\n super(status, message, code, retryAfterSeconds);\n this.name = \"TimezoneError\";\n }\n}\n\nexport interface TimezoneOptions {\n key: string;\n gateway?: string;\n fetch?: typeof fetch;\n retry?: RetryPolicy | false;\n}\n\n/**\n * IANA timezone for a coordinate.\n *\n * const zone = await unmap.timezone.lookup([-114.0719, 51.0447]);\n *\n * The coordinate is `[longitude, latitude]`, the same order as the rest of the SDK.\n * `at` selects the offset. It does not change which zone the coordinate falls in.\n */\nexport class Timezone {\n private readonly key: string;\n private readonly base: string;\n private readonly fetchImpl: typeof fetch;\n private readonly retry: RetryPolicy | false | undefined;\n\n constructor(opts: TimezoneOptions) {\n this.retry = opts.retry;\n this.key = opts.key;\n this.base = (opts.gateway ?? DEFAULT_GATEWAY).replace(/\\/+$/, \"\");\n this.fetchImpl = opts.fetch ?? globalThis.fetch.bind(globalThis);\n }\n\n async lookup(coordinate: [number, number], opts: TimezoneLookupOptions = {}): Promise<TimezoneResult> {\n const [lon, lat] = coordinate;\n const q = new URLSearchParams({ key: this.key, lon: String(lon), lat: String(lat) });\n if (opts.at) q.set(\"at\", opts.at.toISOString());\n const res = await fetchWithRetry(\n this.fetchImpl,\n `${this.base}${TIMEZONE_PATH}?${q}`,\n { signal: opts.signal, headers: { accept: \"application/json\" } },\n this.retry,\n );\n if (!res.ok) throw await errorFrom(res);\n return (await res.json()) as TimezoneResult;\n }\n}\n\nasync function errorFrom(res: Response): Promise<TimezoneError> {\n const retryAfter = parseRetryAfter(res.headers?.get?.(\"retry-after\") ?? null) ?? undefined;\n let message = res.statusText || `timezone ${res.status}`;\n let code: string | undefined;\n try {\n const body = (await res.json()) as { error?: unknown; code?: unknown };\n if (typeof body.error === \"string\" && body.error) message = body.error;\n if (typeof body.code === \"string\") code = body.code;\n } catch {\n /* a non-JSON failure still carries the status */\n }\n return new TimezoneError(res.status, message, code, retryAfter);\n}\n","import { DEFAULT_GATEWAY, UnmapError, fetchWithRetry, parseRetryAfter, type RetryPolicy } from \"@unmap/core\";\n\n/**\n * Approximate location of the current request (`GET /ip`).\n *\n * This is the network the request arrived on, not a device fix and not a lookup of an\n * address you choose. `precision` is always `\"approximate\"`.\n */\n\n/** The one path this client calls. A literal so the gateway's SDK-parity audit can see it. */\nconst IP_PATH = \"/ip\";\n\nexport interface GeolocationOptions {\n key: string;\n gateway?: string;\n fetch?: typeof fetch;\n /**\n * Retry policy for `429`, `502`, `503` and transport failures. `false` disables it.\n *\n * On by default. A wait longer than `maxDelayMs` (10 s) is not slept through; the error\n * carries `retryAfterSeconds` instead.\n */\n retry?: RetryPolicy | false;\n}\n\nexport interface IpGeolocationResult {\n ip: string | null;\n location: {\n lat: number | null;\n lng: number | null;\n };\n city: string | null;\n region: string | null;\n regionCode: string | null;\n postalCode: string | null;\n country: string | null;\n continent: string | null;\n timezone: string | null;\n network: {\n asn: number | null;\n organization: string | null;\n };\n precision: \"approximate\";\n}\n\nexport class GeolocationError extends UnmapError {\n constructor(status: number, message: string, code?: string, retryAfterSeconds?: number) {\n super(status, message, code, retryAfterSeconds);\n this.name = \"GeolocationError\";\n }\n}\n\n/** Typed client for `GET /ip`. One call, one metered request, on the shared pool. */\nexport class Geolocation {\n private readonly key: string;\n private readonly base: string;\n private readonly fetchImpl: typeof fetch;\n private readonly retry: RetryPolicy | false | undefined;\n\n constructor(opts: GeolocationOptions) {\n this.key = opts.key;\n this.base = (opts.gateway ?? DEFAULT_GATEWAY).replace(/\\/+$/, \"\");\n this.fetchImpl = opts.fetch ?? globalThis.fetch.bind(globalThis);\n this.retry = opts.retry;\n }\n\n /**\n * Approximate country, region, city, coordinates, and timezone of this request.\n *\n * const location = await unmap.geolocation.ip();\n *\n * A field the network did not identify is `null`. The call still resolves.\n */\n async ip(opts: { signal?: AbortSignal } = {}): Promise<IpGeolocationResult> {\n const q = new URLSearchParams({ key: this.key });\n const res = await fetchWithRetry(\n this.fetchImpl,\n `${this.base}${IP_PATH}?${q}`,\n { signal: opts.signal, headers: { accept: \"application/json\" } },\n this.retry,\n );\n if (!res.ok) throw await errorFrom(res);\n return (await res.json()) as IpGeolocationResult;\n }\n}\n\nasync function errorFrom(res: { status: number; headers?: Headers; json(): Promise<unknown> }): Promise<GeolocationError> {\n const fallback = `geolocation ${res.status}`;\n let body: { error?: unknown; code?: unknown } | undefined;\n try {\n body = (await res.json()) as { error?: unknown; code?: unknown };\n } catch {\n body = undefined;\n }\n const reason = typeof body?.error === \"string\" ? body.error : undefined;\n const code = typeof body?.code === \"string\" ? body.code : undefined;\n const retryAfter = parseRetryAfter(res.headers?.get(\"retry-after\") ?? null) ?? undefined;\n return new GeolocationError(res.status, reason ? `${reason} (${fallback})` : fallback, code, retryAfter);\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAKK;AACP,SAAS,UAAU,cAAkG;;;ACPrH,SAAS,iBAAiB,YAAY,gBAAgB,uBAAyC;AAwIxF,IAAM,aAAN,cAAyB,WAAW;AAAA,EACzC,YAAY,QAAgB,SAAiB,MAAe,mBAA4B;AACtF,UAAM,QAAQ,SAAS,MAAM,iBAAiB;AAC9C,SAAK,OAAO;AAAA,EACd;AACF;AAEA,SAAS,KAAK,OAAmE;AAC/E,MAAI,UAAU,OAAW,QAAO;AAChC,SAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,KAAK,GAAG,IAAI,OAAO,KAAK;AAC9D;AAEA,eAAe,UAAU,KAAe,MAAc,MAAmC;AACvF,QAAM,WAAW,GAAG,IAAI,IAAI,IAAI,MAAM,OAAO,IAAI;AACjD,MAAI;AACJ,MAAI;AACF,WAAQ,MAAM,IAAI,KAAK;AAAA,EACzB,QAAQ;AACN,WAAO;AAAA,EACT;AACA,QAAM,SAAS,OAAO,MAAM,UAAU,WAAW,KAAK,QAAQ;AAC9D,QAAM,OAAO,OAAO,MAAM,SAAS,WAAW,KAAK,OAAO;AAC1D,QAAM,aAAa,gBAAgB,I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,WAAW,IAAI,SAAS,IAAI;AACjC,SAAK,SAAS,IAAI,OAAO,IAAI;AAC7B,SAAK,QAAQ,IAAI,MAAM,IAAI;AAC3B,SAAK,WAAW,IAAI,SAAS,IAAI;AACjC,SAAK,UAAU,IAAI,QAAQ,IAAI;AAC/B,SAAK,WAAW,IAAI,SAAS,IAAI;AACjC,SAAK,cAAc,IAAI,YAAY,IAAI;AACvC,SAAK,OAAO,EAAE,OAAO,CAAC,cAAc,KAAK,SAAS,WAAW,SAAS,EAAE;AACxE,QAAI,KAAK,WAAW;AAClB,WAAK,MAAM,UAAU,EAAE,GAAG,MAAM,WAAW,KAAK,UAAU,CAAoB;AAAA,IAChF;AAAA,EACF;AAAA;AAAA,EAGA,SAAS,MAAkD;AACzD,WAAO,KAAK,SAAS,SAAS,IAAI;AAAA,EACpC;AACF;","names":["DEFAULT_GATEWAY","UnmapError","fetchWithRetry","parseRetryAfter","errorFrom","DEFAULT_GATEWAY","UnmapError","fetchWithRetry","parseRetryAfter","DEFAULT_GATEWAY","UnmapError","fetchWithRetry","parseRetryAfter","errorFrom","DEFAULT_GATEWAY","UnmapError","fetchWithRetry","parseRetryAfter","errorFrom","createMap","UnmapError","parseRetryAfter"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/roads.ts","../src/transit.ts","../src/coverage.ts","../src/timezone.ts"],"sourcesContent":["import {\n createMap,\n type Map as MaplibreMap,\n type MapProfile,\n type UnmapControlsOptions,\n type UnmapMapOptions,\n} from \"@unmap/maps\";\nimport { Geocoder, Places, type IdentifyOptions, type IdentifyResponse, type QueryOptions, type QueryResponse } from \"@unmap/geocoding\";\nimport { Feedback, Roads } from \"./roads\";\nimport { Transit } from \"./transit\";\nimport { Coverage } from \"./coverage\";\nimport { Timezone } from \"./timezone\";\nimport { Router } from \"@unmap/routing\";\nimport { Elevation } from \"@unmap/elevation\";\nimport type { RetryPolicy } from \"@unmap/core\";\n\nexport * from \"@unmap/geocoding\";\nexport * from \"@unmap/routing\";\nexport * from \"@unmap/elevation\";\nexport * from \"./roads\";\nexport * from \"./transit\";\nexport * from \"./coverage\";\nexport * from \"./timezone\";\nexport { createMap, unmapStyle, DEMO_CITIES, STYLE_NAMES, maplibregl } from \"@unmap/maps\";\nexport type {\n Map,\n UnmapMapOptions,\n UnmapControlsOptions,\n DemoCity,\n StyleName,\n StyleInput,\n Projection,\n MapProfile,\n} from \"@unmap/maps\";\n\nexport interface UnmapOptions {\n key: string;\n gateway?: string;\n /** Override the fetch implementation (tests, non-global environments). */\n fetch?: typeof fetch;\n /**\n * Retry policy shared by every client on this instance. `false` disables it.\n *\n * On by default for `429`, `502`, `503` and transport failures. `Retry-After` is on a `429`\n * other than `billing_required`, and on a container `503`. A `502` has none. A wait longer\n * than `maxDelayMs` (10 s) is not slept through; the error carries `retryAfterSeconds`\n * instead, because a cold land or energy container asks for 60 and parking a request handler\n * for a minute is a worse surprise than an error. Feedback submissions are never retried:\n * they create a record and carry no idempotency key.\n */\n retry?: RetryPolicy | false;\n /** If provided, a map is mounted in this container. */\n container?: string | HTMLElement;\n style?: string;\n flavor?: string;\n /** \"light\" or \"dark\". Selects the mode half of the named style. */\n mode?: string;\n /** Label language, e.g. \"fr\". Omit to follow the request's Accept-Language. */\n lang?: string;\n /** Compact `ut1.` theme code from unmap.dev/create. Wins over the path style on the gateway. */\n theme?: string;\n /** Catalog layer ids composed onto the style (`municipalities`, `survey.dls`, …). */\n overlays?: readonly string[];\n /** Composition preset. Not a style. Explicit overlays replace the profile list. */\n profile?: MapProfile;\n /** `\"globe\"` or `\"mercator\"`. See `@unmap/maps` `UnmapMapOptions.projection`. */\n projection?: UnmapMapOptions[\"projection\"];\n center?: [number, number];\n zoom?: number;\n /** On-map controls. `true` (the default) adds zoom and compass buttons; `false` adds none. */\n controls?: boolean | UnmapControlsOptions;\n}\n\n/**\n * One Stripe-style key, the whole platform. With a `container` you get a rendered map.\n * `geocoder`, `router`, `elevation`, and `timezone` are always available.\n *\n * const map = new Unmap({ key: \"um_live_...\", container: \"#map\", center: [-75.69, 45.42] });\n */\nexport class Unmap {\n readonly geocoder: Geocoder;\n readonly router: Router;\n readonly elevation: Elevation;\n /** IANA timezone and the UTC offset at an instant. One call, anywhere. */\n readonly timezone: Timezone;\n /** Canadian points of interest. Same corpus as the geocoder, in the Place shape. */\n readonly places: Places;\n /** Closures, incidents, construction and road conditions. */\n readonly roads: Roads;\n /** Report wrong data. Never metered. */\n readonly feedback: Feedback;\n /** Scheduled public-transit agencies, stops, routes and departures. */\n readonly transit: Transit;\n /**\n * Where each capability actually works. Unauthenticated and unmetered, so checking costs\n * nothing: read it before promising a user an answer, because transit routing is one agency\n * and road events are one province.\n */\n readonly coverage: Coverage;\n readonly data: { query(opts: QueryOptions): Promise<QueryResponse> };\n readonly map?: MaplibreMap;\n\n constructor(opts: UnmapOptions) {\n this.geocoder = new Geocoder(opts);\n this.router = new Router(opts);\n this.elevation = new Elevation(opts);\n this.timezone = new Timezone(opts);\n this.places = new Places(opts);\n this.roads = new Roads(opts);\n this.feedback = new Feedback(opts);\n this.transit = new Transit(opts);\n this.coverage = new Coverage(opts);\n this.data = { query: (queryOpts) => this.geocoder.queryLayer(queryOpts) };\n if (opts.container) {\n this.map = createMap({ ...opts, container: opts.container } as UnmapMapOptions);\n }\n }\n\n /** Which catalog features contain a point. See `Geocoder.identify`. */\n identify(opts: IdentifyOptions): Promise<IdentifyResponse> {\n return this.geocoder.identify(opts);\n }\n}\n\n// The shared error type and retry policy, re-exported so a caller who installed only this\n// package can `catch (e) { if (e instanceof UnmapError) }` without adding @unmap/core.\nexport { UnmapError, parseRetryAfter, type RetryPolicy } from \"@unmap/core\";\n","import { DEFAULT_GATEWAY, UnmapError, fetchWithRetry, parseRetryAfter, type RetryPolicy } from \"@unmap/core\";\n\n/**\n * Typed clients for road events (`/incidents`, `/closures`, `/road-conditions`) and for data\n * correction (`POST /feedback`).\n *\n * These live in `@unmap/sdk` rather than in packages of their own. A twelfth and thirteenth npm\n * package would each need an entry in the changesets fixed group and a trusted publisher\n * configured on npmjs.com, which is founder work, and neither has a framework wrapper the way\n * geocoding and routing do. If a customer ever wants roads without the rest of the SDK, that is\n * the moment to split it out.\n */\n\nexport type RoadEventType =\n | \"closure\"\n | \"incident\"\n | \"construction\"\n | \"weather\"\n | \"restriction\"\n | \"ferry\"\n | \"hazard\"\n | \"special_event\"\n | \"unknown\";\n\nexport type RoadCondition =\n | \"dry\"\n | \"wet\"\n | \"snow\"\n | \"ice\"\n | \"packed_snow\"\n | \"reduced_visibility\"\n | \"travel_not_recommended\"\n | \"closed\"\n | \"unknown\";\n\nexport type RoadSeverity = \"minor\" | \"major\" | \"unknown\";\n\nexport interface AffectedRoad {\n name: string;\n direction: \"north\" | \"south\" | \"east\" | \"west\" | \"both\" | \"unknown\";\n /** True only when the publisher says closed. Never inferred from the description. */\n closed: boolean;\n from?: string;\n to?: string;\n condition: RoadCondition;\n}\n\nexport interface RoadEvent {\n /** `um:road:<jurisdiction>:<publisher id>`. */\n id: string;\n /** The publisher's own id, so a report can be taken back to them. */\n source_id: string;\n /** ISO 3166-2, e.g. `CA-BC`. */\n jurisdiction: string;\n type: RoadEventType;\n /** The publisher's own subtype strings, untranslated. */\n subtypes: string[];\n status: \"active\" | \"planned\" | \"archived\";\n severity: RoadSeverity;\n /**\n * The publisher's description, verbatim.\n *\n * Believe this over `type` when they disagree: our categories are a lossy projection of someone\n * else's taxonomy, and the sentence a driver needs is in the prose.\n */\n description: string;\n headline?: string;\n /** The worst surface condition across this event's roads. */\n condition: RoadCondition;\n roads: AffectedRoad[];\n /** GeoJSON Point or LineString, WGS84. */\n geometry: { type: string; coordinates: unknown } | null;\n starts_at: string | null;\n ends_at: string | null;\n source_updated_at: string | null;\n unmap_updated_at: string;\n source: string;\n}\n\nexport interface RoadEventsResponse {\n data: RoadEvent[];\n meta: {\n status: \"current\" | \"stale\" | \"partial\" | \"unknown\";\n attribution: string;\n unmap_updated_at: string;\n /**\n * Jurisdictions that could not be reached, each with a reason.\n *\n * **Check this.** On `/closures` an empty `data` reads as \"nothing is shut\" to someone\n * deciding whether to drive, and that is a very different answer from \"we could not reach\n * British Columbia\".\n */\n unavailable?: { jurisdiction: string; reason: string }[];\n };\n}\n\nexport interface RoadEventQuery {\n /** Comma-separated ISO 3166-2 codes, or an array. An uncovered code is a 400, not an empty list. */\n jurisdiction?: string | readonly string[];\n bbox?: [number, number, number, number];\n near?: [number, number];\n /** Metres from `near`. Default 25000, max 500000. */\n radius?: number;\n type?: RoadEventType | readonly RoadEventType[];\n severity?: RoadSeverity | readonly RoadSeverity[];\n status?: \"active\" | \"planned\" | \"archived\";\n /** ISO 8601. Only events the publisher changed at or after this time. */\n updated_since?: string;\n /** 1 to 500, default 100. Applied AFTER the endpoint's own narrowing. */\n limit?: number;\n signal?: AbortSignal;\n}\n\nexport interface RoadsOptions {\n key: string;\n gateway?: string;\n fetch?: typeof fetch;\n /**\n * Retry policy for `429`, `502`, `503` and transport failures. `false` disables it.\n *\n * On by default. `Retry-After` is on a `429` other than `billing_required`, and on a container\n * `503`. A `502` has none: routing uses `routing_failed`, and `/elevation` uses\n * `upstream_error`. With no header the client backs off itself. A wait longer than\n * `maxDelayMs` (10 s) is not slept through; the error carries `retryAfterSeconds` instead.\n * See `RetryPolicy` in `@unmap/core`.\n */\n retry?: RetryPolicy | false;\n}\n\n/**\n * A road events failure.\n *\n * Extends `UnmapError`, so `catch (e) { if (e instanceof UnmapError) }` catches this alongside\n * every other unmap client's errors. `instanceof RoadsError` keeps working, and `status` and `code`\n * are still where they were; `retryAfterSeconds` is new and comes from the header.\n */\nexport class RoadsError extends UnmapError {\n constructor(status: number, message: string, code?: string, retryAfterSeconds?: number) {\n super(status, message, code, retryAfterSeconds);\n this.name = \"RoadsError\";\n }\n}\n\nfunction list(value: string | readonly string[] | undefined): string | undefined {\n if (value === undefined) return undefined;\n return Array.isArray(value) ? value.join(\",\") : String(value);\n}\n\nasync function errorFrom(res: Response, path: string, name: string): Promise<RoadsError> {\n const fallback = `${name} ${res.status} on ${path}`;\n let body: { error?: unknown; code?: unknown } | undefined;\n try {\n body = (await res.json()) as { error?: unknown; code?: unknown };\n } catch {\n body = undefined;\n }\n const reason = typeof body?.error === \"string\" ? body.error : undefined;\n const code = typeof body?.code === \"string\" ? body.code : undefined;\n const retryAfter = parseRetryAfter(res.headers?.get(\"retry-after\") ?? null) ?? undefined;\n return new RoadsError(res.status, reason ? `${reason} (${fallback})` : fallback, code, retryAfter);\n}\n\n/**\n * Canadian road events.\n *\n * const { data, meta } = await unmap.roads.closures({ jurisdiction: \"CA-BC\" });\n *\n * A 503 means every requested jurisdiction was unreachable; the body still carries\n * `meta.unavailable`, so the thrown error is the exception rather than the information. Prefer\n * reading `meta.unavailable` on a 200 over treating an empty list as good news.\n */\nexport class Roads {\n private readonly key: string;\n private readonly base: string;\n private readonly fetchImpl: typeof fetch;\n private readonly retry: RetryPolicy | false | undefined;\n\n constructor(opts: RoadsOptions) {\n this.retry = opts.retry;\n this.key = opts.key;\n this.base = (opts.gateway ?? DEFAULT_GATEWAY).replace(/\\/+$/, \"\");\n this.fetchImpl = opts.fetch ?? globalThis.fetch.bind(globalThis);\n }\n\n /** Every current road event. */\n incidents(query: RoadEventQuery = {}): Promise<RoadEventsResponse> {\n return this.request(\"/incidents\", query);\n }\n\n /** The subset where a road is actually shut. Narrowed before `limit` is applied. */\n closures(query: RoadEventQuery = {}): Promise<RoadEventsResponse> {\n return this.request(\"/closures\", query);\n }\n\n /**\n * The subset carrying a surface condition.\n *\n * Thin for British Columbia by design: its feed reports lane availability rather than the\n * surface, so unmap answers `unknown` instead of inferring a dry road from open lanes.\n */\n conditions(query: RoadEventQuery = {}): Promise<RoadEventsResponse> {\n return this.request(\"/road-conditions\", query);\n }\n\n private async request(path: string, query: RoadEventQuery): Promise<RoadEventsResponse> {\n const q = new URLSearchParams({ key: this.key });\n const params: Record<string, string | undefined> = {\n jurisdiction: list(query.jurisdiction),\n bbox: query.bbox?.join(\",\"),\n near: query.near?.join(\",\"),\n radius: query.radius != null ? String(query.radius) : undefined,\n type: list(query.type),\n severity: list(query.severity),\n status: query.status,\n updated_since: query.updated_since,\n limit: query.limit != null ? String(query.limit) : undefined,\n };\n for (const [k, v] of Object.entries(params)) if (v != null && v !== \"\") q.set(k, v);\n\n const res = await fetchWithRetry(\n this.fetchImpl,\n `${this.base}${path}?${q}`,\n { signal: query.signal, headers: { accept: \"application/json\" } },\n this.retry,\n );\n if (!res.ok) throw await errorFrom(res, path, \"roads\");\n return (await res.json()) as RoadEventsResponse;\n }\n}\n\n// ---------------------------------------------------------------------------------------------\n// Feedback\n// ---------------------------------------------------------------------------------------------\n\nexport type FeedbackProduct =\n | \"tiles\"\n | \"terrain\"\n | \"names\"\n | \"geocoding\"\n | \"places\"\n | \"routing\"\n | \"layers\"\n | \"transit\"\n | \"roads\"\n | \"ev\";\n\nexport type FeedbackCategory =\n | \"incorrect_location\"\n | \"incorrect_address\"\n | \"missing_place\"\n | \"wrong_place_name\"\n | \"wrong_category\"\n | \"bad_route\"\n | \"missing_road_closure\"\n | \"incorrect_road_condition\"\n | \"incorrect_transit_result\"\n | \"other\";\n\nexport interface FeedbackReport {\n product: FeedbackProduct;\n category: FeedbackCategory;\n /** Up to 2000 characters, stored exactly as written. One of this or `resultId` is required. */\n description?: string;\n /** The unmap id of the result being reported. */\n resultId?: string;\n /**\n * The request being reported.\n *\n * **Only send this with the reporter's explicit agreement.** The gateway refuses it without\n * `include_context: true`, which this sets whenever `context` is present, and that flag is\n * meant to record a person's choice rather than a client default. unmap redacts query strings\n * from its own logs; a client that attached them here would undo that.\n */\n context?: unknown;\n signal?: AbortSignal;\n}\n\nexport interface FeedbackReceipt {\n /** Quote this in a follow-up. */\n id: string;\n status: string;\n created_at: string;\n /** Whether a request context was actually kept. `false` when none was offered. */\n context_stored: boolean;\n}\n\n/**\n * Report wrong data.\n *\n * await unmap.feedback.submit({\n * product: \"geocoding\",\n * category: \"incorrect_location\",\n * description: \"17 Ave SW returns a street in Edmonton.\",\n * });\n *\n * Authenticated like everything else and **never metered**: telling us our data is wrong does not\n * cost a call. At most 200 reports per account per day.\n */\nexport class Feedback {\n private readonly key: string;\n private readonly base: string;\n private readonly fetchImpl: typeof fetch;\n\n constructor(opts: RoadsOptions) {\n this.key = opts.key;\n this.base = (opts.gateway ?? DEFAULT_GATEWAY).replace(/\\/+$/, \"\");\n this.fetchImpl = opts.fetch ?? globalThis.fetch.bind(globalThis);\n }\n\n submit(report: FeedbackReport): Promise<FeedbackReceipt> {\n return this.post(\"/feedback\", {\n product: report.product,\n category: report.category,\n ...(report.description ? { description: report.description } : {}),\n ...(report.resultId ? { result_id: report.resultId } : {}),\n ...(report.context !== undefined ? { include_context: true, context: report.context } : {}),\n }, report.signal);\n }\n\n /** A report about one place. `product` and `result_id` come from the path. */\n aboutPlace(\n placeId: string,\n report: Omit<FeedbackReport, \"product\" | \"resultId\">,\n ): Promise<FeedbackReceipt> {\n return this.post(`/places/${encodeURIComponent(placeId)}/feedback`, {\n category: report.category,\n ...(report.description ? { description: report.description } : {}),\n ...(report.context !== undefined ? { include_context: true, context: report.context } : {}),\n }, report.signal);\n }\n\n private async post(path: string, body: unknown, signal?: AbortSignal): Promise<FeedbackReceipt> {\n // Deliberately NOT routed through `fetchWithRetry`, unlike every read on this client.\n //\n // A feedback submission creates a record and carries no idempotency key, so a retry after a\n // timeout or a 503 risks filing the same report twice. Retrying a read costs a round trip;\n // retrying this costs the quality programme a duplicate, and the caller is the only one who\n // knows whether their report already landed.\n const res = await this.fetchImpl(`${this.base}${path}`, {\n method: \"POST\",\n signal,\n headers: { \"content-type\": \"application/json\", authorization: `Bearer ${this.key}` },\n body: JSON.stringify(body),\n });\n if (!res.ok) throw await errorFrom(res, path, \"feedback\");\n return (await res.json()) as FeedbackReceipt;\n }\n}\n","import { DEFAULT_GATEWAY, UnmapError, fetchWithRetry, parseRetryAfter, type RetryPolicy } from \"@unmap/core\";\n\nexport type TransitMetaStatus = \"current\" | \"stale\" | \"partial\" | \"unknown\";\n\nexport interface TransitMeta {\n /** Static GTFS is scheduled data. Realtime will use a different value and updated_at. */\n schedule_type: \"scheduled\";\n source?: string;\n source_updated_at?: string | null;\n source_version?: string;\n content_hash?: string | null;\n sources?: readonly {\n id: string;\n source: string;\n source_url: string;\n attribution: string;\n source_updated_at: string | null;\n source_version: string;\n content_hash: string | null;\n status: \"current\" | \"stale\" | \"unknown\";\n }[];\n unmap_updated_at: string;\n data_version?: string;\n status: TransitMetaStatus;\n attribution: string;\n}\n\nexport interface TransitResponse<T> {\n data: T;\n meta: TransitMeta;\n}\n\nexport interface TransitAgency {\n id: string;\n feed: string;\n name: string;\n url?: string;\n timezone: string;\n lang?: string;\n phone?: string;\n fare_url?: string;\n}\n\nexport interface TransitStop {\n id: string;\n feed: string;\n name: string;\n coordinates: [number, number];\n code?: string;\n description?: string;\n zone_id?: string;\n parent_station_id?: string;\n wheelchair_boarding?: 0 | 1 | 2;\n route_ids: string[];\n /** Metres from the requested point. Present only on nearbyStops. */\n distance?: number;\n}\n\nexport interface TransitRoute {\n id: string;\n feed: string;\n agency_id: string;\n short_name?: string;\n long_name?: string;\n description?: string;\n route_type: number;\n colour?: string;\n text_colour?: string;\n url?: string;\n}\n\nexport interface TransitDeparture {\n stop_id: string;\n route_id: string;\n trip_id: string;\n headsign?: string;\n arrival: string;\n departure: string;\n stop_sequence: number;\n /** 2 = phone agency; 3 = coordinate with driver. Omitted for ordinary pickup. */\n pickup_type?: 2 | 3;\n schedule_type: \"scheduled\";\n}\n\nexport interface NearbyStopsOptions {\n /** Metres. Default 1000, range 50 to 10000. */\n radius?: number;\n /** Default 20, maximum 100. */\n limit?: number;\n signal?: AbortSignal;\n}\n\nexport interface DepartureOptions {\n /** An instant. Date values serialize to ISO; strings must include Z or an offset. Default now. */\n at?: Date | string;\n /** Minutes after at. Default 60, maximum 240. */\n window?: number;\n /** Default 50, maximum 200. */\n limit?: number;\n signal?: AbortSignal;\n}\n\nexport interface TransitOptions {\n key: string;\n gateway?: string;\n fetch?: typeof fetch;\n /**\n * Retry policy for `429`, `502`, `503` and transport failures. `false` disables it.\n *\n * On by default. `Retry-After` is on a `429` other than `billing_required`, and on a container\n * `503`. A `502` has none: routing uses `routing_failed`, and `/elevation` uses\n * `upstream_error`. With no header the client backs off itself. A wait longer than\n * `maxDelayMs` (10 s) is not slept through; the error carries `retryAfterSeconds` instead.\n * See `RetryPolicy` in `@unmap/core`.\n */\n retry?: RetryPolicy | false;\n}\n\n/**\n * A transit failure.\n *\n * Extends `UnmapError`, so `catch (e) { if (e instanceof UnmapError) }` catches this alongside\n * every other unmap client's errors. `instanceof TransitError` keeps working, and `status` and `code`\n * are still where they were; `retryAfterSeconds` is new and comes from the header.\n */\nexport class TransitError extends UnmapError {\n constructor(status: number, message: string, code?: string, retryAfterSeconds?: number) {\n super(status, message, code, retryAfterSeconds);\n this.name = \"TransitError\";\n }\n}\n\n/**\n * The gateway's error body, as a `TransitError`.\n *\n * Named rather than inline since 2026-09-20: `fetchWithRetry` needs to inspect the failure to\n * decide whether to wait, and the throw needs to build the same error. Two copies of this would\n * be two chances for the retry predicate and the thrown error to disagree.\n */\nasync function errorFrom(res: Response, path: string): Promise<TransitError> {\n let body: { error?: unknown; code?: unknown } = {};\n try {\n body = (await res.json()) as typeof body;\n } catch {\n /* use the bounded fallback */\n }\n const message = typeof body.error === \"string\" ? body.error : `transit ${res.status} on ${path}`;\n const code = typeof body.code === \"string\" ? body.code : undefined;\n const retryAfter = parseRetryAfter(res.headers?.get(\"retry-after\") ?? null) ?? undefined;\n return new TransitError(res.status, message, code, retryAfter);\n}\n\n/** Static Canadian GTFS data. Scheduled departures ship before realtime. */\nexport class Transit {\n private readonly key: string;\n private readonly base: string;\n private readonly fetchImpl: typeof fetch;\n private readonly retry: RetryPolicy | false | undefined;\n\n constructor(opts: TransitOptions) {\n this.retry = opts.retry;\n this.key = opts.key;\n this.base = (opts.gateway ?? DEFAULT_GATEWAY).replace(/\\/+$/, \"\");\n this.fetchImpl = opts.fetch ?? globalThis.fetch.bind(globalThis);\n }\n\n agencies(signal?: AbortSignal): Promise<TransitResponse<TransitAgency[]>> {\n return this.get(\"/transit/agencies\", undefined, signal);\n }\n\n nearbyStops(near: [number, number], options: NearbyStopsOptions = {}): Promise<TransitResponse<TransitStop[]>> {\n return this.get(\"/transit/stops\", {\n near: near.join(\",\"),\n radius: options.radius,\n limit: options.limit,\n }, options.signal);\n }\n\n getStop(id: string, signal?: AbortSignal): Promise<TransitResponse<TransitStop>> {\n return this.get(`/transit/stops/${encodeURIComponent(id)}`, undefined, signal);\n }\n\n getRoute(id: string, signal?: AbortSignal): Promise<TransitResponse<TransitRoute>> {\n return this.get(`/transit/routes/${encodeURIComponent(id)}`, undefined, signal);\n }\n\n departures(id: string, options: DepartureOptions = {}): Promise<TransitResponse<TransitDeparture[]>> {\n return this.get(`/transit/stops/${encodeURIComponent(id)}/departures`, {\n at: options.at instanceof Date ? options.at.toISOString() : options.at,\n window: options.window,\n limit: options.limit,\n }, options.signal);\n }\n\n private async get<T>(\n path: string,\n values?: Record<string, string | number | undefined>,\n signal?: AbortSignal,\n ): Promise<TransitResponse<T>> {\n const query = new URLSearchParams({ key: this.key });\n for (const [name, value] of Object.entries(values ?? {})) {\n if (value !== undefined) query.set(name, String(value));\n }\n const response = await fetchWithRetry(\n this.fetchImpl,\n `${this.base}${path}?${query}`,\n { signal, headers: { accept: \"application/json\" } },\n this.retry,\n );\n if (!response.ok) throw await errorFrom(response, path);\n return await response.json() as TransitResponse<T>;\n }\n}\n","import { DEFAULT_GATEWAY, UnmapError, fetchWithRetry, parseRetryAfter, type RetryPolicy } from \"@unmap/core\";\n\n/**\n * `GET /coverage.json` — where each capability actually works, and where it does not.\n *\n * The document is generated from the gateway's source registry rather than written by hand, so\n * it cannot claim a capability with no registered source behind it. It is also the only place\n * that answers \"is transit routing live in this city\" before you promise a user an answer:\n * routing is one agency, road events are one province, and Places coverage is OpenStreetMap's,\n * which is thin outside cities.\n *\n * Unauthenticated and unmetered on the gateway, which is why this client takes no key: a\n * developer deciding whether to use unmap has no key yet, and a customer checking whether a gap\n * has closed should not pay a call to be told it has not.\n */\n\n/** The one path this client calls. A literal so the gateway's SDK-parity audit can see it. */\nconst COVERAGE_PATH = \"/coverage.json\";\n\n/** Freshness of a capability or a source. `unknown` means no cadence was declared. */\nexport type CoverageFreshness = \"current\" | \"stale\" | \"unknown\";\n\nexport interface CoverageSource {\n id: string;\n provider: string;\n /** Bilingual, like every human-readable field in this document. */\n dataset_name: { en: string; fr: string };\n canonical_url: string;\n licence: { en: string; fr: string };\n licence_url: string;\n attribution: string;\n jurisdiction: string[];\n /** ISO 8601 duration, e.g. `P1D`. */\n refresh_interval: string;\n last_checked_at: string;\n last_success_at: string;\n source_version: string;\n content_hash: string | null;\n freshness: CoverageFreshness;\n stale_after: string | null;\n coverage: string;\n known_gaps: { en: string; fr: string };\n quality_status: string;\n}\n\nexport interface CoverageCapability {\n /** `tiles`, `geocoding`, `routing`, `places`, `transit`, `roads`, and so on. */\n id: string;\n display_name: { en: string; fr: string };\n /** `planned` is published as honestly as `live`: a capability absent from the page reads as \"not our problem\". */\n availability: \"live\" | \"planned\";\n /** The endpoints that serve it. Empty while planned. */\n endpoints: string[];\n coverage: { en: string; fr: string };\n /** Written to be accurate rather than flattering. Read this before promising coverage to a user. */\n known_gaps: { en: string; fr: string };\n /** ISO 3166-2 subdivisions, or `CA` for national. */\n jurisdictions: string[];\n freshness: CoverageFreshness;\n sources: CoverageSource[];\n}\n\nexport interface CoverageDocument {\n generated_at: string;\n freshness_basis: string;\n capabilities: CoverageCapability[];\n jurisdictions: unknown;\n}\n\nexport class CoverageError extends UnmapError {\n constructor(status: number, message: string, code?: string, retryAfterSeconds?: number) {\n super(status, message, code, retryAfterSeconds);\n this.name = \"CoverageError\";\n }\n}\n\nexport interface CoverageOptions {\n gateway?: string;\n /** Override the fetch implementation (tests, non-global environments). */\n fetch?: typeof fetch;\n retry?: RetryPolicy | false;\n}\n\n/** Where unmap works. Takes no key: the endpoint is unauthenticated and unmetered. */\nexport class Coverage {\n private readonly base: string;\n private readonly fetchImpl: typeof fetch;\n private readonly retry: RetryPolicy | false | undefined;\n\n constructor(opts: CoverageOptions = {}) {\n this.base = (opts.gateway ?? DEFAULT_GATEWAY).replace(/\\/+$/, \"\");\n this.fetchImpl = opts.fetch ?? globalThis.fetch.bind(globalThis);\n this.retry = opts.retry;\n }\n\n /** The whole document. Cached an hour at the edge, so polling it is cheap. */\n async get(opts: { signal?: AbortSignal } = {}): Promise<CoverageDocument> {\n const res = await fetchWithRetry(\n this.fetchImpl,\n `${this.base}${COVERAGE_PATH}`,\n { signal: opts.signal, headers: { accept: \"application/json\" } },\n this.retry,\n );\n if (!res.ok) {\n const retryAfter = parseRetryAfter(res.headers?.get?.(\"retry-after\") ?? null) ?? undefined;\n throw new CoverageError(res.status, `coverage ${res.status}`, undefined, retryAfter);\n }\n return (await res.json()) as CoverageDocument;\n }\n\n /**\n * One capability by id, or `undefined` when the document does not describe it.\n *\n * const transit = await unmap.coverage.capability(\"transit\");\n * if (!transit?.jurisdictions.includes(\"CA-ON\")) return \"not available here yet\";\n */\n async capability(id: string, opts: { signal?: AbortSignal } = {}): Promise<CoverageCapability | undefined> {\n const doc = await this.get(opts);\n return doc.capabilities.find((c) => c.id === id);\n }\n}\n","import { DEFAULT_GATEWAY, UnmapError, fetchWithRetry, parseRetryAfter, type RetryPolicy } from \"@unmap/core\";\n\n/** The one path this client calls. A literal so the gateway's SDK-parity audit can see it. */\nconst TIMEZONE_PATH = \"/timezone\";\n\nexport interface TimezoneResult {\n timezone: string | null;\n offset: string | null;\n offsetSeconds: number | null;\n dst: boolean | null;\n}\n\nexport interface TimezoneLookupOptions {\n /** Instant the offset is evaluated at. Omit it for the current time. */\n at?: Date;\n signal?: AbortSignal;\n}\n\nexport class TimezoneError extends UnmapError {\n constructor(status: number, message: string, code?: string, retryAfterSeconds?: number) {\n super(status, message, code, retryAfterSeconds);\n this.name = \"TimezoneError\";\n }\n}\n\nexport interface TimezoneOptions {\n key: string;\n gateway?: string;\n fetch?: typeof fetch;\n retry?: RetryPolicy | false;\n}\n\n/**\n * IANA timezone for a coordinate.\n *\n * const zone = await unmap.timezone.lookup([-114.0719, 51.0447]);\n *\n * The coordinate is `[longitude, latitude]`, the same order as the rest of the SDK.\n * `at` selects the offset. It does not change which zone the coordinate falls in.\n */\nexport class Timezone {\n private readonly key: string;\n private readonly base: string;\n private readonly fetchImpl: typeof fetch;\n private readonly retry: RetryPolicy | false | undefined;\n\n constructor(opts: TimezoneOptions) {\n this.retry = opts.retry;\n this.key = opts.key;\n this.base = (opts.gateway ?? DEFAULT_GATEWAY).replace(/\\/+$/, \"\");\n this.fetchImpl = opts.fetch ?? globalThis.fetch.bind(globalThis);\n }\n\n async lookup(coordinate: [number, number], opts: TimezoneLookupOptions = {}): Promise<TimezoneResult> {\n const [lon, lat] = coordinate;\n const q = new URLSearchParams({ key: this.key, lon: String(lon), lat: String(lat) });\n if (opts.at) q.set(\"at\", opts.at.toISOString());\n const res = await fetchWithRetry(\n this.fetchImpl,\n `${this.base}${TIMEZONE_PATH}?${q}`,\n { signal: opts.signal, headers: { accept: \"application/json\" } },\n this.retry,\n );\n if (!res.ok) throw await errorFrom(res);\n return (await res.json()) as TimezoneResult;\n }\n}\n\nasync function errorFrom(res: Response): Promise<TimezoneError> {\n const retryAfter = parseRetryAfter(res.headers?.get?.(\"retry-after\") ?? null) ?? undefined;\n let message = res.statusText || `timezone ${res.status}`;\n let code: string | undefined;\n try {\n const body = (await res.json()) as { error?: unknown; code?: unknown };\n if (typeof body.error === \"string\" && body.error) message = body.error;\n if (typeof body.code === \"string\") code = body.code;\n } catch {\n /* a non-JSON failure still carries the status */\n }\n return new TimezoneError(res.status, message, code, retryAfter);\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAKK;AACP,SAAS,UAAU,cAAkG;;;ACPrH,SAAS,iBAAiB,YAAY,gBAAgB,uBAAyC;AAwIxF,IAAM,aAAN,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AAC,aAAY,mBAAAC,wBAAyC;AA/CvD,IAAM,QAAN,MAAY;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,MAAoB;AAC9B,SAAK,WAAW,IAAI,SAAS,IAAI;AACjC,SAAK,SAAS,IAAI,OAAO,IAAI;AAC7B,SAAK,YAAY,IAAI,UAAU,IAAI;AACnC,SAAK,WAAW,IAAI,SAAS,IAAI;AACjC,SAAK,SAAS,IAAI,OAAO,IAAI;AAC7B,SAAK,QAAQ,IAAI,MAAM,IAAI;AAC3B,SAAK,WAAW,IAAI,SAAS,IAAI;AACjC,SAAK,UAAU,IAAI,QAAQ,IAAI;AAC/B,SAAK,WAAW,IAAI,SAAS,IAAI;AACjC,SAAK,OAAO,EAAE,OAAO,CAAC,cAAc,KAAK,SAAS,WAAW,SAAS,EAAE;AACxE,QAAI,KAAK,WAAW;AAClB,WAAK,MAAM,UAAU,EAAE,GAAG,MAAM,WAAW,KAAK,UAAU,CAAoB;AAAA,IAChF;AAAA,EACF;AAAA;AAAA,EAGA,SAAS,MAAkD;AACzD,WAAO,KAAK,SAAS,SAAS,IAAI;AAAA,EACpC;AACF;","names":["DEFAULT_GATEWAY","UnmapError","fetchWithRetry","parseRetryAfter","errorFrom","DEFAULT_GATEWAY","UnmapError","fetchWithRetry","parseRetryAfter","DEFAULT_GATEWAY","UnmapError","fetchWithRetry","parseRetryAfter","errorFrom","createMap","UnmapError","parseRetryAfter"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unmap/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "One key, the whole unmap platform: map + geocoder + router",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"maplibre-gl": "^6.7.0",
|
|
43
|
-
"@unmap/core": "0.
|
|
44
|
-
"@unmap/elevation": "0.
|
|
45
|
-
"@unmap/geocoding": "0.
|
|
46
|
-
"@unmap/maps": "0.
|
|
47
|
-
"@unmap/routing": "0.
|
|
43
|
+
"@unmap/core": "0.15.0",
|
|
44
|
+
"@unmap/elevation": "0.15.0",
|
|
45
|
+
"@unmap/geocoding": "0.15.0",
|
|
46
|
+
"@unmap/maps": "0.15.0",
|
|
47
|
+
"@unmap/routing": "0.15.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"tsup": "^8.3.0",
|