ola-map-sdk 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +380 -215
  3. package/dist/chunk-22747AE4.js +978 -0
  4. package/dist/chunk-22747AE4.js.map +1 -0
  5. package/dist/chunk-5YVHNDSA.cjs +282 -0
  6. package/dist/chunk-5YVHNDSA.cjs.map +1 -0
  7. package/dist/chunk-6J7XUGWD.cjs +443 -0
  8. package/dist/chunk-6J7XUGWD.cjs.map +1 -0
  9. package/dist/chunk-7LV3RPED.js +440 -0
  10. package/dist/chunk-7LV3RPED.js.map +1 -0
  11. package/dist/chunk-D5T5ZDIQ.js +268 -0
  12. package/dist/chunk-D5T5ZDIQ.js.map +1 -0
  13. package/dist/chunk-SJJRTEQG.js +94 -0
  14. package/dist/chunk-SJJRTEQG.js.map +1 -0
  15. package/dist/chunk-WLUKC7YU.cjs +991 -0
  16. package/dist/chunk-WLUKC7YU.cjs.map +1 -0
  17. package/dist/chunk-XRJXKY7C.cjs +100 -0
  18. package/dist/chunk-XRJXKY7C.cjs.map +1 -0
  19. package/dist/client-Cd22y5wG.d.cts +782 -0
  20. package/dist/client-DsBMyuG9.d.ts +782 -0
  21. package/dist/common-Bt8xNzhK.d.cts +115 -0
  22. package/dist/common-Bt8xNzhK.d.ts +115 -0
  23. package/dist/index.cjs +115 -0
  24. package/dist/index.cjs.map +1 -0
  25. package/dist/index.d.cts +88 -0
  26. package/dist/index.d.ts +88 -0
  27. package/dist/index.js +12 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/maplibre/index.cjs +29 -0
  30. package/dist/maplibre/index.cjs.map +1 -0
  31. package/dist/maplibre/index.d.cts +63 -0
  32. package/dist/maplibre/index.d.ts +63 -0
  33. package/dist/maplibre/index.js +4 -0
  34. package/dist/maplibre/index.js.map +1 -0
  35. package/dist/next/index.cjs +173 -0
  36. package/dist/next/index.cjs.map +1 -0
  37. package/dist/next/index.d.cts +65 -0
  38. package/dist/next/index.d.ts +65 -0
  39. package/dist/next/index.js +169 -0
  40. package/dist/next/index.js.map +1 -0
  41. package/dist/react/index.cjs +257 -0
  42. package/dist/react/index.cjs.map +1 -0
  43. package/dist/react/index.d.cts +77 -0
  44. package/dist/react/index.d.ts +77 -0
  45. package/dist/react/index.js +251 -0
  46. package/dist/react/index.js.map +1 -0
  47. package/package.json +111 -11
  48. package/src/client.js +0 -95
  49. package/src/endpoints/elevation.js +0 -58
  50. package/src/endpoints/geofencing.js +0 -118
  51. package/src/endpoints/places.js +0 -106
  52. package/src/endpoints/roads.js +0 -57
  53. package/src/endpoints/routing.js +0 -160
  54. package/src/endpoints/tiles.js +0 -115
  55. package/src/index.js +0 -5
@@ -0,0 +1,782 @@
1
+ import { d as OlaMapsClientConfig, F as FetchLike, f as RequestOptions, L as LatLng, C as CoordinateInput, e as OlaMapsClientInput } from './common-Bt8xNzhK.js';
2
+ import { OlaMapStyleName, MapLibreTransformRequest, MapLibreMapOptionsInput, MapLibreMapOptions } from './maplibre/index.js';
3
+
4
+ declare const DEFAULT_BASE_URL = "https://api.olamaps.io";
5
+ declare const DEFAULT_TOKEN_URL = "https://api.olamaps.io/auth/v1/token";
6
+ declare const DEFAULT_OAUTH_SCOPE = "openid";
7
+ type AuthMode = 'apiKey' | 'oauth' | 'accessToken' | 'proxy';
8
+ declare class AuthManager {
9
+ readonly mode: AuthMode;
10
+ private readonly apiKey?;
11
+ private readonly clientId?;
12
+ private readonly clientSecret?;
13
+ private readonly scope;
14
+ private readonly tokenUrl;
15
+ private readonly tokenRefreshBufferMs;
16
+ private readonly accessTokenProvider?;
17
+ private readonly fetchImpl;
18
+ private cachedToken?;
19
+ private inFlightToken?;
20
+ constructor(config: OlaMapsClientConfig, fetchImpl: FetchLike);
21
+ getApiKey(): string | undefined;
22
+ invalidateToken(): void;
23
+ /**
24
+ * Retrieve a valid OAuth 2.0 or Bearer access token.
25
+ * Uses single-flight deduplication and proactive refresh before expiry.
26
+ */
27
+ getAccessToken(forceRefresh?: boolean): Promise<string>;
28
+ /**
29
+ * Attach authentication to an outgoing request URL / headers.
30
+ */
31
+ applyAuth(url: URL, headers: Headers, forceRefresh?: boolean): Promise<void>;
32
+ private fetchOAuthToken;
33
+ }
34
+
35
+ type QueryParamValue = string | number | boolean | readonly (string | number | boolean)[] | null | undefined;
36
+ type QueryParams = Record<string, QueryParamValue>;
37
+ type ResponseFormat = 'json' | 'arrayBuffer' | 'text';
38
+ interface TransportRequest {
39
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
40
+ path: string;
41
+ query?: QueryParams;
42
+ body?: unknown;
43
+ headers?: Record<string, string>;
44
+ responseFormat?: ResponseFormat;
45
+ requestOptions?: RequestOptions;
46
+ }
47
+ declare class HttpTransport {
48
+ readonly baseUrl: string;
49
+ private readonly isRelativeBase;
50
+ private readonly fetchImpl;
51
+ private readonly auth;
52
+ private readonly timeoutMs;
53
+ private readonly retryConfig;
54
+ private readonly cacheConfig;
55
+ private readonly dedupe;
56
+ private readonly defaultHeaders;
57
+ private readonly onRequest?;
58
+ private readonly onResponse?;
59
+ private readonly cache;
60
+ private readonly inFlight;
61
+ constructor(config: OlaMapsClientConfig, auth: AuthManager, fetchImpl: FetchLike);
62
+ clearCache(): void;
63
+ request<T>(req: TransportRequest): Promise<T>;
64
+ private executeWithRetries;
65
+ private buildUrl;
66
+ private serializeUrl;
67
+ private buildCacheKey;
68
+ private getFromCache;
69
+ private setInCache;
70
+ private createAttemptSignal;
71
+ private computeBackoff;
72
+ private parseSuccessBody;
73
+ private parseErrorBody;
74
+ private createHttpError;
75
+ }
76
+
77
+ interface ElevationResult {
78
+ elevation: number;
79
+ location: LatLng;
80
+ }
81
+ interface ElevationResponse {
82
+ status?: string;
83
+ elevation?: number;
84
+ location?: LatLng;
85
+ results?: ElevationResult[];
86
+ [key: string]: unknown;
87
+ }
88
+ interface MultiElevationResponse {
89
+ status?: string;
90
+ results: ElevationResult[];
91
+ [key: string]: unknown;
92
+ }
93
+
94
+ declare class Elevation {
95
+ private readonly transport;
96
+ constructor(transport: HttpTransport);
97
+ /**
98
+ * Get elevation for a single location.
99
+ */
100
+ getElevation(lat: number | string, lng: number | string, requestOptions?: RequestOptions): Promise<ElevationResponse>;
101
+ getElevation(coordinate: CoordinateInput, requestOptions?: RequestOptions): Promise<ElevationResponse>;
102
+ /**
103
+ * Get elevations for multiple locations (max 25 per request).
104
+ */
105
+ getMultiElevation(locations: readonly CoordinateInput[], requestOptions?: RequestOptions): Promise<MultiElevationResponse>;
106
+ }
107
+
108
+ type GeofenceType = 'polygon' | 'circle';
109
+ type GeofenceStatus = 'active' | 'inactive';
110
+ interface GeofenceCreatePayload {
111
+ name: string;
112
+ type: GeofenceType;
113
+ coordinates: number[][][] | number[][];
114
+ radius?: number;
115
+ status: GeofenceStatus;
116
+ projectId: string;
117
+ [key: string]: unknown;
118
+ }
119
+ type GeofenceUpdatePayload = Partial<GeofenceCreatePayload>;
120
+ interface GeofenceRecord {
121
+ id: string;
122
+ name?: string;
123
+ type?: GeofenceType;
124
+ coordinates?: number[][][] | number[][];
125
+ radius?: number;
126
+ status?: GeofenceStatus;
127
+ projectId?: string;
128
+ createdAt?: string;
129
+ updatedAt?: string;
130
+ [key: string]: unknown;
131
+ }
132
+ interface GeofenceListResponse {
133
+ geofences?: GeofenceRecord[];
134
+ data?: GeofenceRecord[];
135
+ page?: number;
136
+ size?: number;
137
+ total?: number;
138
+ [key: string]: unknown;
139
+ }
140
+ interface GeofenceStatusResponse {
141
+ isInside?: boolean;
142
+ status?: string;
143
+ [key: string]: unknown;
144
+ }
145
+
146
+ declare class Geofencing {
147
+ private readonly transport;
148
+ constructor(transport: HttpTransport);
149
+ create(geofenceData: GeofenceCreatePayload, requestOptions?: RequestOptions): Promise<GeofenceRecord>;
150
+ update(id: string, geofenceData: GeofenceUpdatePayload, requestOptions?: RequestOptions): Promise<GeofenceRecord>;
151
+ getById(id: string, requestOptions?: RequestOptions): Promise<GeofenceRecord>;
152
+ deleteById(id: string, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
153
+ list(projectId: string, page?: number, size?: number, requestOptions?: RequestOptions): Promise<GeofenceListResponse>;
154
+ checkStatus(geofenceId: string, coordinates: CoordinateInput, requestOptions?: RequestOptions): Promise<GeofenceStatusResponse>;
155
+ }
156
+
157
+ interface AutocompleteOptions {
158
+ location?: CoordinateInput;
159
+ radius?: number;
160
+ strictbounds?: boolean;
161
+ language?: string;
162
+ types?: string;
163
+ }
164
+ interface PlaceStructuredFormatting {
165
+ main_text: string;
166
+ secondary_text?: string;
167
+ main_text_matched_substrings?: Array<{
168
+ offset: number;
169
+ length: number;
170
+ }>;
171
+ secondary_text_matched_substrings?: Array<{
172
+ offset: number;
173
+ length: number;
174
+ }>;
175
+ }
176
+ interface AutocompletePrediction {
177
+ reference?: string;
178
+ types?: string[];
179
+ matched_substrings?: Array<{
180
+ offset: number;
181
+ length: number;
182
+ }>;
183
+ terms?: Array<{
184
+ offset: number;
185
+ value: string;
186
+ }>;
187
+ distance_meters?: number;
188
+ structured_formatting?: PlaceStructuredFormatting;
189
+ description: string;
190
+ geometry?: {
191
+ location: LatLng;
192
+ };
193
+ place_id: string;
194
+ layer?: string[];
195
+ }
196
+ interface AutocompleteResponse {
197
+ error_message?: string;
198
+ info_messages?: string[];
199
+ predictions: AutocompletePrediction[];
200
+ status?: string;
201
+ }
202
+ interface GeocodeOptions {
203
+ language?: string;
204
+ bounds?: string;
205
+ }
206
+ interface AddressComponent {
207
+ types: string[];
208
+ short_name: string;
209
+ long_name: string;
210
+ }
211
+ interface GeocodeResult {
212
+ formatted_address: string;
213
+ types?: string[];
214
+ name?: string;
215
+ geometry: {
216
+ viewport?: {
217
+ southwest: LatLng;
218
+ northeast: LatLng;
219
+ };
220
+ location: LatLng;
221
+ location_type?: string;
222
+ };
223
+ address_components?: AddressComponent[];
224
+ plus_code?: {
225
+ compound_code?: string;
226
+ global_code?: string;
227
+ };
228
+ place_id: string;
229
+ layer?: string[];
230
+ }
231
+ interface GeocodeResponse {
232
+ geocodingResults: GeocodeResult[];
233
+ status?: string;
234
+ }
235
+ interface ReverseGeocodeOptions {
236
+ language?: string;
237
+ }
238
+ interface ReverseGeocodeResponse {
239
+ error_message?: string;
240
+ info_messages?: string[];
241
+ results: GeocodeResult[];
242
+ plus_code?: {
243
+ compound_code?: string;
244
+ global_code?: string;
245
+ };
246
+ status?: string;
247
+ }
248
+ interface PlaceDetailsResult {
249
+ place_id: string;
250
+ name?: string;
251
+ formatted_address?: string;
252
+ formatted_phone_number?: string;
253
+ international_phone_number?: string;
254
+ website?: string;
255
+ url?: string;
256
+ rating?: number;
257
+ user_ratings_total?: number;
258
+ business_status?: string;
259
+ types?: string[];
260
+ address_components?: AddressComponent[];
261
+ geometry?: {
262
+ location: LatLng;
263
+ viewport?: {
264
+ southwest: LatLng;
265
+ northeast: LatLng;
266
+ };
267
+ };
268
+ opening_hours?: {
269
+ open_now?: boolean;
270
+ weekday_text?: string[];
271
+ periods?: Array<{
272
+ open?: {
273
+ day: number;
274
+ time: string;
275
+ };
276
+ close?: {
277
+ day: number;
278
+ time: string;
279
+ };
280
+ }>;
281
+ };
282
+ photos?: Array<{
283
+ photo_reference: string;
284
+ height?: number;
285
+ width?: number;
286
+ html_attributions?: string[];
287
+ }>;
288
+ reviews?: Array<{
289
+ author_name?: string;
290
+ rating?: number;
291
+ text?: string;
292
+ time?: number;
293
+ }>;
294
+ [key: string]: unknown;
295
+ }
296
+ interface PlaceDetailsResponse {
297
+ error_message?: string;
298
+ info_messages?: string[];
299
+ html_attributions?: string[];
300
+ result: PlaceDetailsResult;
301
+ status?: string;
302
+ }
303
+ type NearbySearchRankBy = 'popular' | 'distance';
304
+ interface NearbySearchOptions {
305
+ /** Search layer filter (e.g. `'venue'`). */
306
+ layers?: string;
307
+ types?: string;
308
+ language?: string;
309
+ radius?: number;
310
+ withCentroid?: boolean;
311
+ rankBy?: NearbySearchRankBy;
312
+ /** Maximum number of results (1–50). */
313
+ limit?: number;
314
+ }
315
+ interface NearbySearchResponse {
316
+ error_message?: string;
317
+ info_messages?: string[];
318
+ predictions: AutocompletePrediction[];
319
+ status?: string;
320
+ }
321
+ interface TextSearchOptions {
322
+ location?: CoordinateInput;
323
+ radius?: number;
324
+ types?: string;
325
+ size?: number;
326
+ }
327
+ interface TextSearchPrediction {
328
+ formatted_address?: string;
329
+ geometry?: {
330
+ location: LatLng;
331
+ };
332
+ place_id: string;
333
+ name?: string;
334
+ types?: string[];
335
+ [key: string]: unknown;
336
+ }
337
+ interface TextSearchResponse {
338
+ error_message?: string;
339
+ info_messages?: string[];
340
+ predictions: TextSearchPrediction[];
341
+ status?: string;
342
+ }
343
+ interface AddressValidationResponse {
344
+ result?: {
345
+ validated?: boolean;
346
+ validated_address?: string;
347
+ address_components?: AddressComponent[];
348
+ [key: string]: unknown;
349
+ };
350
+ status?: string;
351
+ [key: string]: unknown;
352
+ }
353
+ interface PlacePhotoResponse {
354
+ photos?: Array<{
355
+ photoUri?: string;
356
+ [key: string]: unknown;
357
+ }>;
358
+ photoUri?: string;
359
+ status?: string;
360
+ [key: string]: unknown;
361
+ }
362
+
363
+ declare class Places {
364
+ private readonly transport;
365
+ constructor(transport: HttpTransport);
366
+ autocomplete(input: string, options?: AutocompleteOptions, requestOptions?: RequestOptions): Promise<AutocompleteResponse>;
367
+ geocode(address: string, languageOrOptions?: string | GeocodeOptions, requestOptions?: RequestOptions): Promise<GeocodeResponse>;
368
+ reverseGeocode(lat: number | string, lng: number | string, languageOrOptions?: string | ReverseGeocodeOptions, requestOptions?: RequestOptions): Promise<ReverseGeocodeResponse>;
369
+ reverseGeocode(coordinate: Exclude<CoordinateInput, string>, languageOrOptions?: string | ReverseGeocodeOptions, requestOptions?: RequestOptions): Promise<ReverseGeocodeResponse>;
370
+ placeDetails(placeId: string, language?: string, requestOptions?: RequestOptions): Promise<PlaceDetailsResponse>;
371
+ placeDetailsAdvanced(placeId: string, language?: string, requestOptions?: RequestOptions): Promise<PlaceDetailsResponse>;
372
+ nearbySearch(location: CoordinateInput, options?: NearbySearchOptions, requestOptions?: RequestOptions): Promise<NearbySearchResponse>;
373
+ nearbySearchAdvanced(location: CoordinateInput, options?: NearbySearchOptions, requestOptions?: RequestOptions): Promise<NearbySearchResponse>;
374
+ textSearch(input: string, options?: TextSearchOptions, requestOptions?: RequestOptions): Promise<TextSearchResponse>;
375
+ addressValidation(address: string, requestOptions?: RequestOptions): Promise<AddressValidationResponse>;
376
+ photo(photoReference: string, requestOptions?: RequestOptions): Promise<PlacePhotoResponse>;
377
+ private executeNearbySearch;
378
+ }
379
+
380
+ type NearestRoadsMode = 'DRIVING' | 'WALKING' | 'BICYCLING' | 'TRANSIT';
381
+ type SnapStrategy = 'snaptoroad' | 'nearestroad';
382
+ interface SnapToRoadOptions {
383
+ enhancePath?: boolean;
384
+ }
385
+ interface SnappedPoint {
386
+ location: {
387
+ lat: number;
388
+ lng: number;
389
+ };
390
+ original_index?: number;
391
+ place_id?: string;
392
+ }
393
+ interface SnapToRoadResponse {
394
+ status: string;
395
+ snapped_points: SnappedPoint[];
396
+ }
397
+ interface NearestRoadsOptions {
398
+ radius?: number;
399
+ }
400
+ interface NearestRoadResult {
401
+ originalIndex?: number;
402
+ lat: number;
403
+ lng: number;
404
+ distance?: number;
405
+ status?: string;
406
+ }
407
+ interface NearestRoadsResponse {
408
+ status: string;
409
+ results: NearestRoadResult[];
410
+ }
411
+ interface SpeedLimitsOptions {
412
+ snapStrategy?: SnapStrategy;
413
+ }
414
+ interface SpeedLimitSegment {
415
+ speed_limit?: number;
416
+ speed_limit_unit?: string;
417
+ start_index?: number;
418
+ end_index?: number;
419
+ [key: string]: unknown;
420
+ }
421
+ interface SpeedLimitsResponse {
422
+ status: string;
423
+ snapped_points?: SnappedPoint[];
424
+ speed_limits?: SpeedLimitSegment[];
425
+ }
426
+
427
+ declare class Roads {
428
+ private readonly transport;
429
+ constructor(transport: HttpTransport);
430
+ /**
431
+ * Snap up to 50 coordinates to the nearest road segments.
432
+ */
433
+ snapToRoad(points: string | readonly CoordinateInput[], enhancePathOrOptions?: boolean | SnapToRoadOptions, requestOptions?: RequestOptions): Promise<SnapToRoadResponse>;
434
+ /**
435
+ * Find nearest roads for up to 100 coordinates.
436
+ */
437
+ nearestRoads(points: string | readonly CoordinateInput[], mode: NearestRoadsMode, radiusOrOptions?: number | NearestRoadsOptions, requestOptions?: RequestOptions): Promise<NearestRoadsResponse>;
438
+ /**
439
+ * Get speed limits for up to 50 coordinates along snapped road segments.
440
+ */
441
+ speedLimits(points: string | readonly CoordinateInput[], snapStrategyOrOptions?: SnapStrategy | SpeedLimitsOptions, requestOptions?: RequestOptions): Promise<SpeedLimitsResponse>;
442
+ }
443
+
444
+ type RoutingMode = 'driving' | 'walking' | 'auto' | 'two_wheeler' | 'cycling' | (string & {});
445
+ type RouteOverview = 'full' | 'simplified' | 'false';
446
+ interface DirectionsOptions {
447
+ alternatives?: boolean;
448
+ steps?: boolean;
449
+ overview?: RouteOverview;
450
+ language?: string;
451
+ traffic_metadata?: boolean;
452
+ waypoints?: string | readonly CoordinateInput[];
453
+ mode?: RoutingMode;
454
+ route_preference?: string;
455
+ }
456
+ interface DirectionsBasicOptions {
457
+ alternatives?: boolean;
458
+ steps?: boolean;
459
+ overview?: RouteOverview;
460
+ language?: string;
461
+ waypoints?: string | readonly CoordinateInput[];
462
+ route_preference?: string;
463
+ }
464
+ interface RouteStep {
465
+ instructions?: string;
466
+ distance: number;
467
+ readable_distance?: string;
468
+ maneuver?: string;
469
+ duration: number;
470
+ readable_duration?: string;
471
+ start_location: LatLng;
472
+ end_location: LatLng;
473
+ bearing_before?: number;
474
+ bearing_after?: number;
475
+ }
476
+ interface RouteLeg {
477
+ steps?: RouteStep[];
478
+ distance: number;
479
+ readable_distance?: string;
480
+ duration: number;
481
+ readable_duration?: string;
482
+ start_location: LatLng;
483
+ end_location: LatLng;
484
+ start_address?: string;
485
+ end_address?: string;
486
+ }
487
+ interface Route {
488
+ summary?: string;
489
+ legs: RouteLeg[];
490
+ overview_polyline?: string;
491
+ travel_advisory?: string;
492
+ bounds?: Record<string, unknown>;
493
+ copyrights?: string;
494
+ warnings?: string[];
495
+ }
496
+ interface DirectionsResponse {
497
+ status: string;
498
+ geocoded_waypoints?: Array<{
499
+ geocoder_status?: string;
500
+ place_id?: string;
501
+ types?: string[];
502
+ }>;
503
+ routes: Route[];
504
+ source_from?: string;
505
+ }
506
+ interface DistanceMatrixOptions {
507
+ mode?: RoutingMode;
508
+ route_preference?: string;
509
+ }
510
+ interface DistanceMatrixBasicOptions {
511
+ route_preference?: string;
512
+ }
513
+ interface DistanceMatrixElement {
514
+ duration?: number;
515
+ distance?: number;
516
+ polyline?: string;
517
+ status: string;
518
+ }
519
+ interface DistanceMatrixResponse {
520
+ status: string;
521
+ rows: Array<{
522
+ elements: DistanceMatrixElement[];
523
+ }>;
524
+ }
525
+ interface RouteOptimizerOptions {
526
+ source?: 'first' | 'any';
527
+ destination?: 'last' | 'any';
528
+ round_trip?: boolean;
529
+ mode?: RoutingMode;
530
+ steps?: boolean;
531
+ overview?: RouteOverview;
532
+ language?: string;
533
+ traffic_metadata?: boolean;
534
+ route_preference?: string;
535
+ }
536
+ interface RouteOptimizerResponse extends DirectionsResponse {
537
+ waypoints?: Array<{
538
+ waypoint_index?: number;
539
+ trips_index?: number;
540
+ location?: LatLng;
541
+ [key: string]: unknown;
542
+ }>;
543
+ }
544
+ type FleetPlannerStrategy = 'optimal' | 'distance' | 'duration' | (string & {});
545
+ interface FleetPlannerOptions {
546
+ route_preference?: string;
547
+ /** Optional filename used in multipart FormData upload (default: `'input.json'`). */
548
+ filename?: string;
549
+ }
550
+ type FleetPlannerInput = Record<string, unknown> | Blob | Uint8Array | ArrayBuffer | string;
551
+ interface FleetPlannerResponse {
552
+ status?: string;
553
+ routes?: unknown[];
554
+ unassigned?: unknown[];
555
+ [key: string]: unknown;
556
+ }
557
+
558
+ declare class Routing {
559
+ private readonly transport;
560
+ constructor(transport: HttpTransport);
561
+ getDirections(origin: CoordinateInput, destination: CoordinateInput, options?: DirectionsOptions, requestOptions?: RequestOptions): Promise<DirectionsResponse>;
562
+ getDirectionsBasic(origin: CoordinateInput, destination: CoordinateInput, options?: DirectionsBasicOptions, requestOptions?: RequestOptions): Promise<DirectionsResponse>;
563
+ getDistanceMatrix(origins: string | readonly CoordinateInput[], destinations: string | readonly CoordinateInput[], options?: DistanceMatrixOptions, requestOptions?: RequestOptions): Promise<DistanceMatrixResponse>;
564
+ getDistanceMatrixBasic(origins: string | readonly CoordinateInput[], destinations: string | readonly CoordinateInput[], options?: DistanceMatrixBasicOptions, requestOptions?: RequestOptions): Promise<DistanceMatrixResponse>;
565
+ /**
566
+ * Optimize waypoint order for up to 25 locations.
567
+ */
568
+ routeOptimizer(locations: string | readonly CoordinateInput[], options?: RouteOptimizerOptions, requestOptions?: RequestOptions): Promise<RouteOptimizerResponse>;
569
+ /**
570
+ * Plan multi-vehicle fleet routes using browser/Edge/Node-safe Web `FormData` & `Blob`.
571
+ * Accepts a plain JSON object, JSON string, `Blob`/`File`, `Uint8Array`, or `ArrayBuffer`.
572
+ */
573
+ fleetPlanner(inputData: FleetPlannerInput, strategy: FleetPlannerStrategy, options?: FleetPlannerOptions, requestOptions?: RequestOptions): Promise<FleetPlannerResponse>;
574
+ }
575
+
576
+ interface StreetViewCoverageBBox {
577
+ xMin: number;
578
+ yMin: number;
579
+ xMax: number;
580
+ yMax: number;
581
+ }
582
+ interface StreetViewCoverageAltBBox {
583
+ minLng: number;
584
+ minLat: number;
585
+ maxLng: number;
586
+ maxLat: number;
587
+ }
588
+ type StreetViewBBoxInput = StreetViewCoverageBBox | StreetViewCoverageAltBBox;
589
+ interface StreetViewCoverageResponse {
590
+ type?: string;
591
+ coordinates?: unknown[];
592
+ features?: unknown[];
593
+ [key: string]: unknown;
594
+ }
595
+ interface StreetViewImageIdOptions {
596
+ /** Optional search radius in meters. */
597
+ radius?: number;
598
+ }
599
+ interface StreetViewImageIdResponse {
600
+ imageId: string;
601
+ lat?: number;
602
+ lon?: number;
603
+ distance?: number;
604
+ [key: string]: unknown;
605
+ }
606
+ interface StreetViewNeighbor {
607
+ imageId: string;
608
+ bearing?: number;
609
+ lat?: number;
610
+ lon?: number;
611
+ [key: string]: unknown;
612
+ }
613
+ interface StreetViewMetadataResponse {
614
+ imageId: string;
615
+ lat: number;
616
+ lon: number;
617
+ bearing?: number;
618
+ imageUrl?: string;
619
+ capturedAt?: string;
620
+ neighbors?: StreetViewNeighbor[];
621
+ [key: string]: unknown;
622
+ }
623
+
624
+ declare class StreetView {
625
+ private readonly transport;
626
+ constructor(transport: HttpTransport);
627
+ /**
628
+ * Fetch Street View coverage geometry within a bounding box.
629
+ * Accepts `{ xMin, yMin, xMax, yMax }` or `{ minLng, minLat, maxLng, maxLat }`.
630
+ */
631
+ getCoverage(bbox: StreetViewBBoxInput, requestOptions?: RequestOptions): Promise<StreetViewCoverageResponse>;
632
+ /**
633
+ * Fetch the nearest Street View `imageId` for a coordinate.
634
+ */
635
+ getImageId(lat: number | string, lon: number | string, options?: StreetViewImageIdOptions, requestOptions?: RequestOptions): Promise<StreetViewImageIdResponse>;
636
+ getImageId(coordinate: Exclude<CoordinateInput, string>, options?: StreetViewImageIdOptions, requestOptions?: RequestOptions): Promise<StreetViewImageIdResponse>;
637
+ /**
638
+ * Fetch panoramic image metadata (`lat`, `lon`, `bearing`, `imageUrl`, `neighbors`) for an `imageId`.
639
+ */
640
+ getMetadata(imageId: string, requestOptions?: RequestOptions): Promise<StreetViewMetadataResponse>;
641
+ }
642
+
643
+ type StaticMapFormat = 'png' | 'jpg';
644
+ interface StaticMapOptions {
645
+ /** Single marker string or array of markers serialized as repeated `marker=...` query params. */
646
+ marker?: string | readonly string[];
647
+ /** Encoded polyline or path specification string. */
648
+ path?: string;
649
+ }
650
+ interface StaticMapBBox {
651
+ minx: number;
652
+ miny: number;
653
+ maxx: number;
654
+ maxy: number;
655
+ }
656
+ interface TileStyleSummary {
657
+ id?: string;
658
+ name: string;
659
+ url?: string;
660
+ version?: number;
661
+ [key: string]: unknown;
662
+ }
663
+ interface TileStyleDetail {
664
+ version: number;
665
+ name?: string;
666
+ sources: Record<string, unknown>;
667
+ layers: unknown[];
668
+ sprite?: string;
669
+ glyphs?: string;
670
+ [key: string]: unknown;
671
+ }
672
+ interface TileJSONResponse {
673
+ tilejson?: string;
674
+ name?: string;
675
+ tiles?: string[];
676
+ minzoom?: number;
677
+ maxzoom?: number;
678
+ bounds?: [number, number, number, number];
679
+ [key: string]: unknown;
680
+ }
681
+ interface Tileset3DResponse {
682
+ asset?: Record<string, unknown>;
683
+ geometricError?: number;
684
+ root?: Record<string, unknown>;
685
+ [key: string]: unknown;
686
+ }
687
+
688
+ declare class Tiles {
689
+ private readonly transport;
690
+ constructor(transport: HttpTransport);
691
+ /**
692
+ * Fetch TileJSON metadata for a vector tile dataset.
693
+ * Note: Vector tile dataset helpers correspond to Ola's vector tile service endpoints.
694
+ */
695
+ getDataTileJSON(datasetName: string, requestOptions?: RequestOptions): Promise<TileJSONResponse>;
696
+ /**
697
+ * Fetch a raw Mapbox Vector Tile (.pbf) as an `ArrayBuffer`.
698
+ */
699
+ getPBFFile(datasetName: string, z: number, x: number, y: number, requestOptions?: RequestOptions): Promise<ArrayBuffer>;
700
+ /**
701
+ * Fetch a raster map tile image (`/{z}/{x}/{y}.{format}`) as an `ArrayBuffer`.
702
+ */
703
+ getRasterTile(styleName: string, z: number, x: number, y: number, format?: StaticMapFormat, requestOptions?: RequestOptions): Promise<ArrayBuffer>;
704
+ /**
705
+ * List all available Ola Maps vector styles.
706
+ */
707
+ getStyles(requestOptions?: RequestOptions): Promise<TileStyleSummary[]>;
708
+ /**
709
+ * Fetch a MapLibre Style Specification JSON for a named Ola Maps style.
710
+ */
711
+ getStyleDetail(styleName: string, requestOptions?: RequestOptions): Promise<TileStyleDetail>;
712
+ /**
713
+ * Fetch SDF font glyph ranges (.pbf) as an `ArrayBuffer`.
714
+ */
715
+ getFontGlyphs(fontstack: string, start: number, end: number, requestOptions?: RequestOptions): Promise<ArrayBuffer>;
716
+ /**
717
+ * Fetch a static map image centered on `(lon, lat)` at a given `zoom` (0–23).
718
+ * Width and height must be between 1 and 2048 pixels.
719
+ */
720
+ getStaticMapByCenter(styleName: string, lon: number, lat: number, zoom: number, width: number, height: number, format: StaticMapFormat, options?: StaticMapOptions, requestOptions?: RequestOptions): Promise<ArrayBuffer>;
721
+ /**
722
+ * Fetch a static map image bounded by `{ minx, miny, maxx, maxy }`.
723
+ */
724
+ getStaticMapByBBox(styleName: string, bbox: StaticMapBBox, width: number, height: number, format: StaticMapFormat, options?: StaticMapOptions, requestOptions?: RequestOptions): Promise<ArrayBuffer>;
725
+ /**
726
+ * Fetch a static map image with auto-fit bounds.
727
+ * Requires at least one `marker` or `path` in `options`.
728
+ */
729
+ getStaticMapAuto(styleName: string, width: number, height: number, format: StaticMapFormat, options: StaticMapOptions, requestOptions?: RequestOptions): Promise<ArrayBuffer>;
730
+ /**
731
+ * Fetch the 3D buildings tileset JSON.
732
+ */
733
+ get3DTileset(requestOptions?: RequestOptions): Promise<Tileset3DResponse>;
734
+ }
735
+
736
+ declare class OlaMapsClient {
737
+ readonly places: Places;
738
+ readonly tiles: Tiles;
739
+ readonly routing: Routing;
740
+ readonly roads: Roads;
741
+ readonly geofencing: Geofencing;
742
+ readonly elevation: Elevation;
743
+ readonly streetView: StreetView;
744
+ private readonly auth;
745
+ private readonly transport;
746
+ private readonly staticAccessToken?;
747
+ /**
748
+ * Create an Ola Maps client.
749
+ *
750
+ * Supports both the v1 shorthand (`new OlaMapsClient('YOUR_API_KEY')`) and the
751
+ * v2 configuration object supporting API Key, OAuth 2.0 (`client_credentials`),
752
+ * pre-issued Bearer `accessToken`, or Proxy Mode (`{ baseUrl: '/api/ola-maps' }`).
753
+ */
754
+ constructor(configOrApiKey: OlaMapsClientInput);
755
+ /** Active authentication mode (`'apiKey'`, `'oauth'`, `'accessToken'`, or `'proxy'`). */
756
+ get authMode(): AuthMode;
757
+ /** Configured API base URL. */
758
+ get baseUrl(): string;
759
+ /**
760
+ * Fetch or return the cached OAuth 2.0 / Bearer access token.
761
+ */
762
+ getAccessToken(forceRefresh?: boolean): Promise<string>;
763
+ /**
764
+ * Clear any cached in-memory GET responses.
765
+ */
766
+ clearCache(): void;
767
+ /**
768
+ * Get the full MapLibre style URL for a named Ola Maps style.
769
+ */
770
+ getStyleURL(styleName?: OlaMapStyleName): string;
771
+ /**
772
+ * Get a host-safe MapLibre `transformRequest` callback.
773
+ * Credentials are strictly restricted to `*.olamaps.io` hosts and never leak to third-party URLs.
774
+ */
775
+ getTransformRequest(): MapLibreTransformRequest;
776
+ /**
777
+ * Build a ready-to-use MapLibre GL `Map` options object.
778
+ */
779
+ getMapOptions(options?: MapLibreMapOptionsInput): MapLibreMapOptions;
780
+ }
781
+
782
+ export { type RouteOptimizerOptions as $, type AddressComponent as A, type GeofenceType as B, type GeofenceUpdatePayload as C, DEFAULT_BASE_URL as D, Elevation as E, type FleetPlannerInput as F, type GeocodeOptions as G, Geofencing as H, type NearbySearchRankBy as I, type NearbySearchResponse as J, type NearestRoadResult as K, type NearestRoadsMode as L, type MultiElevationResponse as M, type NearbySearchOptions as N, OlaMapsClient as O, type NearestRoadsOptions as P, type NearestRoadsResponse as Q, type PlaceDetailsResponse as R, type PlaceDetailsResult as S, type PlacePhotoResponse as T, type PlaceStructuredFormatting as U, Places as V, type ReverseGeocodeOptions as W, type ReverseGeocodeResponse as X, Roads as Y, type Route as Z, type RouteLeg as _, type AddressValidationResponse as a, type RouteOptimizerResponse as a0, type RouteOverview as a1, type RouteStep as a2, Routing as a3, type RoutingMode as a4, type SnapStrategy as a5, type SnapToRoadOptions as a6, type SnapToRoadResponse as a7, type SnappedPoint as a8, type SpeedLimitSegment as a9, type SpeedLimitsOptions as aa, type SpeedLimitsResponse as ab, type StaticMapBBox as ac, type StaticMapFormat as ad, type StaticMapOptions as ae, StreetView as af, type StreetViewBBoxInput as ag, type StreetViewCoverageAltBBox as ah, type StreetViewCoverageBBox as ai, type StreetViewCoverageResponse as aj, type StreetViewImageIdOptions as ak, type StreetViewImageIdResponse as al, type StreetViewMetadataResponse as am, type StreetViewNeighbor as an, type TextSearchOptions as ao, type TextSearchPrediction as ap, type TextSearchResponse as aq, type TileJSONResponse as ar, type TileStyleDetail as as, type TileStyleSummary as at, Tiles as au, type Tileset3DResponse as av, type AuthMode as b, type AutocompleteOptions as c, type AutocompletePrediction as d, type AutocompleteResponse as e, DEFAULT_OAUTH_SCOPE as f, DEFAULT_TOKEN_URL as g, type DirectionsBasicOptions as h, type DirectionsOptions as i, type DirectionsResponse as j, type DistanceMatrixBasicOptions as k, type DistanceMatrixElement as l, type DistanceMatrixOptions as m, type DistanceMatrixResponse as n, type ElevationResponse as o, type ElevationResult as p, type FleetPlannerOptions as q, type FleetPlannerResponse as r, type FleetPlannerStrategy as s, type GeocodeResponse as t, type GeocodeResult as u, type GeofenceCreatePayload as v, type GeofenceListResponse as w, type GeofenceRecord as x, type GeofenceStatus as y, type GeofenceStatusResponse as z };