@unmap/sdk 0.15.0 → 0.17.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 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.15.0/unmap.css">
63
+ <link rel="stylesheet" href="https://cdn.unmap.dev/sdk/0.17.0/unmap.css">
64
64
  <div id="map" style="height: 400px"></div>
65
- <script src="https://cdn.unmap.dev/sdk/0.15.0/unmap.js"></script>
65
+ <script src="https://cdn.unmap.dev/sdk/0.17.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.15/` follows patches and `/sdk/latest/` follows everything.
71
+ Everything above is on the `unmap` global: `unmap.Unmap`, `unmap.Geocoder`, `unmap.Router`, `unmap.maplibregl`. Pin the exact version in production; `/sdk/0.17/` follows patches and `/sdk/latest/` follows everything.
72
72
 
73
73
  ## Options
74
74
 
@@ -78,7 +78,6 @@ Everything above is on the `unmap` global: `unmap.Unmap`, `unmap.Geocoder`, `unm
78
78
  | `gateway` | `string` | API base URL. Defaults to `https://api.unmap.dev`. |
79
79
  | `container` | `string \| HTMLElement` | Mount a map here. Omit for geocoding and routing only. |
80
80
  | `style` | `string` | `base` (default), `muted`, `outdoor`, `blueprint`, `blush`, `orchid`, `canopy`, `lagoon`, `tropic`, `sunset`, `bold`, `pastel`, or a full style URL. |
81
- | `flavor` | `string` | Older spelling of `style`: a style name, read only when `style` is omitted. |
82
81
  | `mode` | `string` | `light` or `dark`. Selects the mode of the named style. |
83
82
  | `lang` | `string` | Basemap label language. Supports the 41 Protomaps language tags (including `ja`, `ko`, `zh-Hans`, and `zh-Hant`); omit to follow the browser's `Accept-Language`. |
84
83
  | `theme` | `string` | A theme code (`u…` or `ut1.`) from [unmap.dev/create](https://unmap.dev/create). |
package/dist/index.d.ts CHANGED
@@ -108,7 +108,7 @@ interface RoadsOptions {
108
108
  * Retry policy for `429`, `502`, `503` and transport failures. `false` disables it.
109
109
  *
110
110
  * On by default. `Retry-After` is on a `429` other than `billing_required`, and on a container
111
- * `503`. A `502` has none: routing uses `routing_failed`, and `/elevation` uses
111
+ * `503`. A `502` has none: routing and `/elevation` both use
112
112
  * `upstream_error`. With no header the client backs off itself. A wait longer than
113
113
  * `maxDelayMs` (10 s) is not slept through; the error carries `retryAfterSeconds` instead.
114
114
  * See `RetryPolicy` in `@unmap/core`.
@@ -119,8 +119,8 @@ interface RoadsOptions {
119
119
  * A road events failure.
120
120
  *
121
121
  * Extends `UnmapError`, so `catch (e) { if (e instanceof UnmapError) }` catches this alongside
122
- * every other unmap client's errors. `instanceof RoadsError` keeps working, and `status` and `code`
123
- * are still where they were; `retryAfterSeconds` is new and comes from the header.
122
+ * every other unmap client's errors. `status` and `code` carry the HTTP status and the
123
+ * gateway's error code, and `retryAfterSeconds` comes from the `Retry-After` header.
124
124
  */
125
125
  declare class RoadsError extends UnmapError {
126
126
  constructor(status: number, message: string, code?: string, retryAfterSeconds?: number);
@@ -303,7 +303,7 @@ interface TransitOptions {
303
303
  * Retry policy for `429`, `502`, `503` and transport failures. `false` disables it.
304
304
  *
305
305
  * On by default. `Retry-After` is on a `429` other than `billing_required`, and on a container
306
- * `503`. A `502` has none: routing uses `routing_failed`, and `/elevation` uses
306
+ * `503`. A `502` has none: routing and `/elevation` both use
307
307
  * `upstream_error`. With no header the client backs off itself. A wait longer than
308
308
  * `maxDelayMs` (10 s) is not slept through; the error carries `retryAfterSeconds` instead.
309
309
  * See `RetryPolicy` in `@unmap/core`.
@@ -314,8 +314,8 @@ interface TransitOptions {
314
314
  * A transit failure.
315
315
  *
316
316
  * Extends `UnmapError`, so `catch (e) { if (e instanceof UnmapError) }` catches this alongside
317
- * every other unmap client's errors. `instanceof TransitError` keeps working, and `status` and `code`
318
- * are still where they were; `retryAfterSeconds` is new and comes from the header.
317
+ * every other unmap client's errors. `status` and `code` carry the HTTP status and the
318
+ * gateway's error code, and `retryAfterSeconds` comes from the `Retry-After` header.
319
319
  */
320
320
  declare class TransitError extends UnmapError {
321
321
  constructor(status: number, message: string, code?: string, retryAfterSeconds?: number);
@@ -337,6 +337,26 @@ declare class Transit {
337
337
 
338
338
  /** Freshness of a capability or a source. `unknown` means no cadence was declared. */
339
339
  type CoverageFreshness = "current" | "stale" | "unknown";
340
+ /** How a source's freshness is judged, mirrored from the gateway's `FreshnessPolicy`. */
341
+ interface CoverageFreshnessPolicy {
342
+ /** ISO 8601 duration, `static`, or `unknown`. */
343
+ interval: string;
344
+ basis: string;
345
+ /** When `freshness_status` stops being true, or null when staleness cannot be asked. */
346
+ stale_after: string | null;
347
+ }
348
+ /** Where a source's data came from and when unmap last produced it. */
349
+ interface CoverageProvenance {
350
+ source_updated_at: string | null;
351
+ unmap_updated_at: string | null;
352
+ build_id: string | null;
353
+ version: string;
354
+ content_hash: string | null;
355
+ freshness_policy: CoverageFreshnessPolicy;
356
+ freshness_status: CoverageFreshness;
357
+ /** Counts the producing job measured. Omitted when it measured none. */
358
+ measurements?: Record<string, number>;
359
+ }
340
360
  interface CoverageSource {
341
361
  id: string;
342
362
  provider: string;
@@ -356,17 +376,16 @@ interface CoverageSource {
356
376
  /** ISO 8601 duration, e.g. `P1D`. */
357
377
  refresh_interval: string;
358
378
  last_checked_at: string;
359
- last_success_at: string;
360
- source_version: string;
361
- content_hash: string | null;
362
- freshness: CoverageFreshness;
363
- stale_after: string | null;
379
+ /** Upstream's edition date, when unmap last produced the data, which build did, and how fresh that is. */
380
+ provenance: CoverageProvenance;
364
381
  coverage: string;
365
382
  known_gaps: {
366
383
  en: string;
367
384
  fr: string;
368
385
  };
369
386
  quality_status: string;
387
+ /** A note on the source, in English, present only when there is one. */
388
+ notes?: string;
370
389
  }
371
390
  interface CoverageCapability {
372
391
  /** `tiles`, `geocoding`, `routing`, `places`, `transit`, `roads`, and so on. */
@@ -390,14 +409,21 @@ interface CoverageCapability {
390
409
  };
391
410
  /** ISO 3166-2 subdivisions, or `CA` for national. */
392
411
  jurisdictions: string[];
393
- freshness: CoverageFreshness;
412
+ freshness_status: CoverageFreshness;
394
413
  sources: CoverageSource[];
395
414
  }
396
415
  interface CoverageDocument {
397
416
  generated_at: string;
398
- freshness_basis: string;
417
+ /** How to read the dates below, in both official languages. */
418
+ freshness_basis: {
419
+ en: string;
420
+ fr: string;
421
+ };
422
+ /** Schema tag of the manifests behind `provenance`, so a consumer can pin what it parses. */
423
+ provenance_schema: string;
399
424
  capabilities: CoverageCapability[];
400
- jurisdictions: unknown;
425
+ /** Every jurisdiction code any source claims. */
426
+ jurisdictions: string[];
401
427
  }
402
428
  declare class CoverageError extends UnmapError {
403
429
  constructor(status: number, message: string, code?: string, retryAfterSeconds?: number);
@@ -485,7 +511,6 @@ interface UnmapOptions {
485
511
  /** If provided, a map is mounted in this container. */
486
512
  container?: string | HTMLElement;
487
513
  style?: string;
488
- flavor?: string;
489
514
  /** "light" or "dark". Selects the mode half of the named style. */
490
515
  mode?: string;
491
516
  /** Label language, e.g. "fr". Omit to follow the request's Accept-Language. */
@@ -538,4 +563,4 @@ declare class Unmap {
538
563
  identify(opts: IdentifyOptions): Promise<IdentifyResponse>;
539
564
  }
540
565
 
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 };
566
+ export { type AffectedRoad, Coverage, type CoverageCapability, type CoverageDocument, CoverageError, type CoverageFreshness, type CoverageFreshnessPolicy, type CoverageOptions, type CoverageProvenance, 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.map CHANGED
@@ -1 +1 @@
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,cAAyB,WAAW;AAAA,EACzC,YAAY,QAAgB,SAAiB,MAAe,mBAA4B;AACtF,UAAM,QAAQ,SAAS,MAAM,iBAAiB;AAC9C,SAAK,OAAO;AAAA,EACd;AAC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A,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"]}
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 /** \"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 and `/elevation` both use\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. `status` and `code` carry the HTTP status and the\n * gateway's error code, and `retryAfterSeconds` comes from the `Retry-After` 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 and `/elevation` both use\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. `status` and `code` carry the HTTP status and the\n * gateway's error code, and `retryAfterSeconds` comes from the `Retry-After` 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\n/** How a source's freshness is judged, mirrored from the gateway's `FreshnessPolicy`. */\nexport interface CoverageFreshnessPolicy {\n /** ISO 8601 duration, `static`, or `unknown`. */\n interval: string;\n basis: string;\n /** When `freshness_status` stops being true, or null when staleness cannot be asked. */\n stale_after: string | null;\n}\n\n/** Where a source's data came from and when unmap last produced it. */\nexport interface CoverageProvenance {\n source_updated_at: string | null;\n unmap_updated_at: string | null;\n build_id: string | null;\n version: string;\n content_hash: string | null;\n freshness_policy: CoverageFreshnessPolicy;\n freshness_status: CoverageFreshness;\n /** Counts the producing job measured. Omitted when it measured none. */\n measurements?: Record<string, number>;\n}\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 /** Upstream's edition date, when unmap last produced the data, which build did, and how fresh that is. */\n provenance: CoverageProvenance;\n coverage: string;\n known_gaps: { en: string; fr: string };\n quality_status: string;\n /** A note on the source, in English, present only when there is one. */\n notes?: 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_status: CoverageFreshness;\n sources: CoverageSource[];\n}\n\nexport interface CoverageDocument {\n generated_at: string;\n /** How to read the dates below, in both official languages. */\n freshness_basis: { en: string; fr: string };\n /** Schema tag of the manifests behind `provenance`, so a consumer can pin what it parses. */\n provenance_schema: string;\n capabilities: CoverageCapability[];\n /** Every jurisdiction code any source claims. */\n jurisdictions: string[];\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,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;AAC1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W,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.15.0",
3
+ "version": "0.17.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.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"
43
+ "@unmap/core": "0.17.0",
44
+ "@unmap/elevation": "0.17.0",
45
+ "@unmap/geocoding": "0.17.0",
46
+ "@unmap/maps": "0.17.0",
47
+ "@unmap/routing": "0.17.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "tsup": "^8.3.0",