ola-map-sdk 1.1.5 → 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.
- package/LICENSE +20 -20
- package/README.md +380 -137
- package/dist/chunk-22747AE4.js +978 -0
- package/dist/chunk-22747AE4.js.map +1 -0
- package/dist/chunk-5YVHNDSA.cjs +282 -0
- package/dist/chunk-5YVHNDSA.cjs.map +1 -0
- package/dist/chunk-6J7XUGWD.cjs +443 -0
- package/dist/chunk-6J7XUGWD.cjs.map +1 -0
- package/dist/chunk-7LV3RPED.js +440 -0
- package/dist/chunk-7LV3RPED.js.map +1 -0
- package/dist/chunk-D5T5ZDIQ.js +268 -0
- package/dist/chunk-D5T5ZDIQ.js.map +1 -0
- package/dist/chunk-SJJRTEQG.js +94 -0
- package/dist/chunk-SJJRTEQG.js.map +1 -0
- package/dist/chunk-WLUKC7YU.cjs +991 -0
- package/dist/chunk-WLUKC7YU.cjs.map +1 -0
- package/dist/chunk-XRJXKY7C.cjs +100 -0
- package/dist/chunk-XRJXKY7C.cjs.map +1 -0
- package/dist/client-Cd22y5wG.d.cts +782 -0
- package/dist/client-DsBMyuG9.d.ts +782 -0
- package/dist/common-Bt8xNzhK.d.cts +115 -0
- package/dist/common-Bt8xNzhK.d.ts +115 -0
- package/dist/index.cjs +115 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +88 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/maplibre/index.cjs +29 -0
- package/dist/maplibre/index.cjs.map +1 -0
- package/dist/maplibre/index.d.cts +63 -0
- package/dist/maplibre/index.d.ts +63 -0
- package/dist/maplibre/index.js +4 -0
- package/dist/maplibre/index.js.map +1 -0
- package/dist/next/index.cjs +173 -0
- package/dist/next/index.cjs.map +1 -0
- package/dist/next/index.d.cts +65 -0
- package/dist/next/index.d.ts +65 -0
- package/dist/next/index.js +169 -0
- package/dist/next/index.js.map +1 -0
- package/dist/react/index.cjs +257 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +77 -0
- package/dist/react/index.d.ts +77 -0
- package/dist/react/index.js +251 -0
- package/dist/react/index.js.map +1 -0
- package/package.json +126 -11
- package/src/client.js +0 -37
- package/src/endpoints/places.js +0 -38
- package/src/endpoints/routing.js +0 -39
- package/src/endpoints/tiles.js +0 -55
- package/src/index.js +0 -4
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
interface LatLng {
|
|
2
|
+
lat: number;
|
|
3
|
+
lng: number;
|
|
4
|
+
}
|
|
5
|
+
interface LatLon {
|
|
6
|
+
lat: number;
|
|
7
|
+
lon: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* GeoJSON / MapLibre coordinate tuple in `[longitude, latitude]` order.
|
|
11
|
+
*/
|
|
12
|
+
type LngLatTuple = readonly [lng: number, lat: number];
|
|
13
|
+
/**
|
|
14
|
+
* Flexible coordinate input accepted across all SDK methods.
|
|
15
|
+
* - `{ lat, lng }`
|
|
16
|
+
* - `{ lat, lon }`
|
|
17
|
+
* - `[lng, lat]` (GeoJSON / MapLibre order)
|
|
18
|
+
* - `"lat,lng"` string
|
|
19
|
+
*/
|
|
20
|
+
type CoordinateInput = LatLng | LatLon | LngLatTuple | string;
|
|
21
|
+
type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
22
|
+
interface RetryConfig {
|
|
23
|
+
/** Maximum number of retry attempts after the initial request (default: 2). */
|
|
24
|
+
maxRetries?: number;
|
|
25
|
+
/** Initial backoff delay in milliseconds (default: 300). */
|
|
26
|
+
baseDelayMs?: number;
|
|
27
|
+
/** Maximum backoff delay in milliseconds (default: 10_000). */
|
|
28
|
+
maxDelayMs?: number;
|
|
29
|
+
/** HTTP status codes eligible for retry (default: [408, 429, 500, 502, 503, 504]). */
|
|
30
|
+
retryOnStatuses?: readonly number[];
|
|
31
|
+
}
|
|
32
|
+
interface CacheConfig {
|
|
33
|
+
/** Time-to-live for cached GET responses in milliseconds (default: 30_000). */
|
|
34
|
+
ttlMs?: number;
|
|
35
|
+
/** Maximum number of cached entries kept in LRU order (default: 200). */
|
|
36
|
+
maxEntries?: number;
|
|
37
|
+
}
|
|
38
|
+
interface OAuthTokenResponse {
|
|
39
|
+
access_token: string;
|
|
40
|
+
token_type?: string;
|
|
41
|
+
expires_in?: number;
|
|
42
|
+
scope?: string;
|
|
43
|
+
}
|
|
44
|
+
interface RequestHookContext {
|
|
45
|
+
method: string;
|
|
46
|
+
/** Redacted request URL (credentials stripped). */
|
|
47
|
+
url: string;
|
|
48
|
+
requestId: string;
|
|
49
|
+
correlationId: string;
|
|
50
|
+
attempt: number;
|
|
51
|
+
}
|
|
52
|
+
interface ResponseHookContext extends RequestHookContext {
|
|
53
|
+
status: number;
|
|
54
|
+
durationMs: number;
|
|
55
|
+
fromCache: boolean;
|
|
56
|
+
}
|
|
57
|
+
interface RequestOptions {
|
|
58
|
+
/** AbortSignal to cancel the in-flight request. */
|
|
59
|
+
signal?: AbortSignal;
|
|
60
|
+
/** Per-request timeout override in milliseconds. */
|
|
61
|
+
timeoutMs?: number;
|
|
62
|
+
/** Custom X-Request-Id header value (auto-generated UUIDv4 if omitted). */
|
|
63
|
+
requestId?: string;
|
|
64
|
+
/** Custom X-Correlation-Id header value (auto-generated UUIDv4 if omitted). */
|
|
65
|
+
correlationId?: string;
|
|
66
|
+
/** Additional headers merged onto this request. */
|
|
67
|
+
headers?: Record<string, string>;
|
|
68
|
+
/** Override retry count for this request, or `false` to disable retries. */
|
|
69
|
+
retries?: number | false;
|
|
70
|
+
/** Bypass in-memory response cache for this request. */
|
|
71
|
+
skipCache?: boolean;
|
|
72
|
+
}
|
|
73
|
+
interface OlaMapsClientConfig {
|
|
74
|
+
/** Ola Maps API Key (passed via `api_key` query parameter). */
|
|
75
|
+
apiKey?: string;
|
|
76
|
+
/** OAuth 2.0 Client ID (requires `clientSecret`). */
|
|
77
|
+
clientId?: string;
|
|
78
|
+
/** OAuth 2.0 Client Secret (server-side only; requires `clientId`). */
|
|
79
|
+
clientSecret?: string;
|
|
80
|
+
/** OAuth 2.0 scope (default: `'openid'`). */
|
|
81
|
+
scope?: string;
|
|
82
|
+
/** OAuth 2.0 token endpoint (default: `'https://api.olamaps.io/auth/v1/token'`). */
|
|
83
|
+
tokenUrl?: string;
|
|
84
|
+
/** Refresh OAuth token this many milliseconds before expiry (default: 60_000). */
|
|
85
|
+
tokenRefreshBufferMs?: number;
|
|
86
|
+
/** Pre-issued Bearer access token or async token provider function. */
|
|
87
|
+
accessToken?: string | (() => string | Promise<string>);
|
|
88
|
+
/**
|
|
89
|
+
* API base URL (default: `'https://api.olamaps.io'`).
|
|
90
|
+
* Set to a relative or custom proxy path (e.g. `'/api/ola-maps'`) to enable Proxy Mode
|
|
91
|
+
* without exposing credentials in browser bundles.
|
|
92
|
+
*/
|
|
93
|
+
baseUrl?: string;
|
|
94
|
+
/** Custom `fetch` implementation (e.g. Next.js `fetch` with `next: { revalidate }`, mocks, proxies). */
|
|
95
|
+
fetch?: FetchLike;
|
|
96
|
+
/** Default request timeout in milliseconds (default: 15_000). */
|
|
97
|
+
timeoutMs?: number;
|
|
98
|
+
/** Retry configuration, or `false` to disable retries completely. */
|
|
99
|
+
retries?: RetryConfig | false;
|
|
100
|
+
/** Optional in-memory LRU+TTL cache for idempotent GET requests (disabled by default). */
|
|
101
|
+
cache?: CacheConfig | false;
|
|
102
|
+
/** Deduplicate concurrent identical in-flight GET requests (default: true). */
|
|
103
|
+
dedupe?: boolean;
|
|
104
|
+
/** Extra default headers attached to every API request. */
|
|
105
|
+
defaultHeaders?: Record<string, string>;
|
|
106
|
+
/** Lightweight observability hook invoked before each attempt (URL is redacted). */
|
|
107
|
+
onRequest?: (ctx: RequestHookContext) => void;
|
|
108
|
+
/** Lightweight observability hook invoked after each response (URL is redacted). */
|
|
109
|
+
onResponse?: (ctx: ResponseHookContext) => void;
|
|
110
|
+
/** Suppress the development warning when `clientSecret` is used in a browser environment. */
|
|
111
|
+
suppressBrowserWarning?: boolean;
|
|
112
|
+
}
|
|
113
|
+
type OlaMapsClientInput = string | OlaMapsClientConfig;
|
|
114
|
+
|
|
115
|
+
export type { CoordinateInput as C, FetchLike as F, LatLng as L, OAuthTokenResponse as O, RequestHookContext as R, CacheConfig as a, LatLon as b, LngLatTuple as c, OlaMapsClientConfig as d, OlaMapsClientInput as e, RequestOptions as f, ResponseHookContext as g, RetryConfig as h };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
interface LatLng {
|
|
2
|
+
lat: number;
|
|
3
|
+
lng: number;
|
|
4
|
+
}
|
|
5
|
+
interface LatLon {
|
|
6
|
+
lat: number;
|
|
7
|
+
lon: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* GeoJSON / MapLibre coordinate tuple in `[longitude, latitude]` order.
|
|
11
|
+
*/
|
|
12
|
+
type LngLatTuple = readonly [lng: number, lat: number];
|
|
13
|
+
/**
|
|
14
|
+
* Flexible coordinate input accepted across all SDK methods.
|
|
15
|
+
* - `{ lat, lng }`
|
|
16
|
+
* - `{ lat, lon }`
|
|
17
|
+
* - `[lng, lat]` (GeoJSON / MapLibre order)
|
|
18
|
+
* - `"lat,lng"` string
|
|
19
|
+
*/
|
|
20
|
+
type CoordinateInput = LatLng | LatLon | LngLatTuple | string;
|
|
21
|
+
type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
22
|
+
interface RetryConfig {
|
|
23
|
+
/** Maximum number of retry attempts after the initial request (default: 2). */
|
|
24
|
+
maxRetries?: number;
|
|
25
|
+
/** Initial backoff delay in milliseconds (default: 300). */
|
|
26
|
+
baseDelayMs?: number;
|
|
27
|
+
/** Maximum backoff delay in milliseconds (default: 10_000). */
|
|
28
|
+
maxDelayMs?: number;
|
|
29
|
+
/** HTTP status codes eligible for retry (default: [408, 429, 500, 502, 503, 504]). */
|
|
30
|
+
retryOnStatuses?: readonly number[];
|
|
31
|
+
}
|
|
32
|
+
interface CacheConfig {
|
|
33
|
+
/** Time-to-live for cached GET responses in milliseconds (default: 30_000). */
|
|
34
|
+
ttlMs?: number;
|
|
35
|
+
/** Maximum number of cached entries kept in LRU order (default: 200). */
|
|
36
|
+
maxEntries?: number;
|
|
37
|
+
}
|
|
38
|
+
interface OAuthTokenResponse {
|
|
39
|
+
access_token: string;
|
|
40
|
+
token_type?: string;
|
|
41
|
+
expires_in?: number;
|
|
42
|
+
scope?: string;
|
|
43
|
+
}
|
|
44
|
+
interface RequestHookContext {
|
|
45
|
+
method: string;
|
|
46
|
+
/** Redacted request URL (credentials stripped). */
|
|
47
|
+
url: string;
|
|
48
|
+
requestId: string;
|
|
49
|
+
correlationId: string;
|
|
50
|
+
attempt: number;
|
|
51
|
+
}
|
|
52
|
+
interface ResponseHookContext extends RequestHookContext {
|
|
53
|
+
status: number;
|
|
54
|
+
durationMs: number;
|
|
55
|
+
fromCache: boolean;
|
|
56
|
+
}
|
|
57
|
+
interface RequestOptions {
|
|
58
|
+
/** AbortSignal to cancel the in-flight request. */
|
|
59
|
+
signal?: AbortSignal;
|
|
60
|
+
/** Per-request timeout override in milliseconds. */
|
|
61
|
+
timeoutMs?: number;
|
|
62
|
+
/** Custom X-Request-Id header value (auto-generated UUIDv4 if omitted). */
|
|
63
|
+
requestId?: string;
|
|
64
|
+
/** Custom X-Correlation-Id header value (auto-generated UUIDv4 if omitted). */
|
|
65
|
+
correlationId?: string;
|
|
66
|
+
/** Additional headers merged onto this request. */
|
|
67
|
+
headers?: Record<string, string>;
|
|
68
|
+
/** Override retry count for this request, or `false` to disable retries. */
|
|
69
|
+
retries?: number | false;
|
|
70
|
+
/** Bypass in-memory response cache for this request. */
|
|
71
|
+
skipCache?: boolean;
|
|
72
|
+
}
|
|
73
|
+
interface OlaMapsClientConfig {
|
|
74
|
+
/** Ola Maps API Key (passed via `api_key` query parameter). */
|
|
75
|
+
apiKey?: string;
|
|
76
|
+
/** OAuth 2.0 Client ID (requires `clientSecret`). */
|
|
77
|
+
clientId?: string;
|
|
78
|
+
/** OAuth 2.0 Client Secret (server-side only; requires `clientId`). */
|
|
79
|
+
clientSecret?: string;
|
|
80
|
+
/** OAuth 2.0 scope (default: `'openid'`). */
|
|
81
|
+
scope?: string;
|
|
82
|
+
/** OAuth 2.0 token endpoint (default: `'https://api.olamaps.io/auth/v1/token'`). */
|
|
83
|
+
tokenUrl?: string;
|
|
84
|
+
/** Refresh OAuth token this many milliseconds before expiry (default: 60_000). */
|
|
85
|
+
tokenRefreshBufferMs?: number;
|
|
86
|
+
/** Pre-issued Bearer access token or async token provider function. */
|
|
87
|
+
accessToken?: string | (() => string | Promise<string>);
|
|
88
|
+
/**
|
|
89
|
+
* API base URL (default: `'https://api.olamaps.io'`).
|
|
90
|
+
* Set to a relative or custom proxy path (e.g. `'/api/ola-maps'`) to enable Proxy Mode
|
|
91
|
+
* without exposing credentials in browser bundles.
|
|
92
|
+
*/
|
|
93
|
+
baseUrl?: string;
|
|
94
|
+
/** Custom `fetch` implementation (e.g. Next.js `fetch` with `next: { revalidate }`, mocks, proxies). */
|
|
95
|
+
fetch?: FetchLike;
|
|
96
|
+
/** Default request timeout in milliseconds (default: 15_000). */
|
|
97
|
+
timeoutMs?: number;
|
|
98
|
+
/** Retry configuration, or `false` to disable retries completely. */
|
|
99
|
+
retries?: RetryConfig | false;
|
|
100
|
+
/** Optional in-memory LRU+TTL cache for idempotent GET requests (disabled by default). */
|
|
101
|
+
cache?: CacheConfig | false;
|
|
102
|
+
/** Deduplicate concurrent identical in-flight GET requests (default: true). */
|
|
103
|
+
dedupe?: boolean;
|
|
104
|
+
/** Extra default headers attached to every API request. */
|
|
105
|
+
defaultHeaders?: Record<string, string>;
|
|
106
|
+
/** Lightweight observability hook invoked before each attempt (URL is redacted). */
|
|
107
|
+
onRequest?: (ctx: RequestHookContext) => void;
|
|
108
|
+
/** Lightweight observability hook invoked after each response (URL is redacted). */
|
|
109
|
+
onResponse?: (ctx: ResponseHookContext) => void;
|
|
110
|
+
/** Suppress the development warning when `clientSecret` is used in a browser environment. */
|
|
111
|
+
suppressBrowserWarning?: boolean;
|
|
112
|
+
}
|
|
113
|
+
type OlaMapsClientInput = string | OlaMapsClientConfig;
|
|
114
|
+
|
|
115
|
+
export type { CoordinateInput as C, FetchLike as F, LatLng as L, OAuthTokenResponse as O, RequestHookContext as R, CacheConfig as a, LatLon as b, LngLatTuple as c, OlaMapsClientConfig as d, OlaMapsClientInput as e, RequestOptions as f, ResponseHookContext as g, RetryConfig as h };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var chunkWLUKC7YU_cjs = require('./chunk-WLUKC7YU.cjs');
|
|
6
|
+
var chunkXRJXKY7C_cjs = require('./chunk-XRJXKY7C.cjs');
|
|
7
|
+
require('./chunk-6J7XUGWD.cjs');
|
|
8
|
+
var chunk5YVHNDSA_cjs = require('./chunk-5YVHNDSA.cjs');
|
|
9
|
+
|
|
10
|
+
// src/index.ts
|
|
11
|
+
var src_default = chunkWLUKC7YU_cjs.OlaMapsClient;
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, "Elevation", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunkWLUKC7YU_cjs.Elevation; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "Geofencing", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunkWLUKC7YU_cjs.Geofencing; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "OlaMapsClient", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunkWLUKC7YU_cjs.OlaMapsClient; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "Places", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkWLUKC7YU_cjs.Places; }
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "Roads", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return chunkWLUKC7YU_cjs.Roads; }
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "Routing", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return chunkWLUKC7YU_cjs.Routing; }
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "StreetView", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return chunkWLUKC7YU_cjs.StreetView; }
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(exports, "Tiles", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () { return chunkWLUKC7YU_cjs.Tiles; }
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports, "formatCoordinateList", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () { return chunkWLUKC7YU_cjs.formatCoordinateList; }
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "formatLatLng", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () { return chunkWLUKC7YU_cjs.formatLatLng; }
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(exports, "normalizeCoordinate", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () { return chunkWLUKC7YU_cjs.normalizeCoordinate; }
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(exports, "parseLatLngPair", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function () { return chunkWLUKC7YU_cjs.parseLatLngPair; }
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, "OLA_MAP_STYLES", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () { return chunkXRJXKY7C_cjs.OLA_MAP_STYLES; }
|
|
64
|
+
});
|
|
65
|
+
Object.defineProperty(exports, "DEFAULT_BASE_URL", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () { return chunk5YVHNDSA_cjs.DEFAULT_BASE_URL; }
|
|
68
|
+
});
|
|
69
|
+
Object.defineProperty(exports, "DEFAULT_OAUTH_SCOPE", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function () { return chunk5YVHNDSA_cjs.DEFAULT_OAUTH_SCOPE; }
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(exports, "DEFAULT_TOKEN_URL", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () { return chunk5YVHNDSA_cjs.DEFAULT_TOKEN_URL; }
|
|
76
|
+
});
|
|
77
|
+
Object.defineProperty(exports, "OlaAuthError", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function () { return chunk5YVHNDSA_cjs.OlaAuthError; }
|
|
80
|
+
});
|
|
81
|
+
Object.defineProperty(exports, "OlaMapsError", {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
get: function () { return chunk5YVHNDSA_cjs.OlaMapsError; }
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(exports, "OlaNetworkError", {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function () { return chunk5YVHNDSA_cjs.OlaNetworkError; }
|
|
88
|
+
});
|
|
89
|
+
Object.defineProperty(exports, "OlaRateLimitError", {
|
|
90
|
+
enumerable: true,
|
|
91
|
+
get: function () { return chunk5YVHNDSA_cjs.OlaRateLimitError; }
|
|
92
|
+
});
|
|
93
|
+
Object.defineProperty(exports, "OlaTimeoutError", {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
get: function () { return chunk5YVHNDSA_cjs.OlaTimeoutError; }
|
|
96
|
+
});
|
|
97
|
+
Object.defineProperty(exports, "OlaValidationError", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: function () { return chunk5YVHNDSA_cjs.OlaValidationError; }
|
|
100
|
+
});
|
|
101
|
+
Object.defineProperty(exports, "parseRetryAfterMs", {
|
|
102
|
+
enumerable: true,
|
|
103
|
+
get: function () { return chunk5YVHNDSA_cjs.parseRetryAfterMs; }
|
|
104
|
+
});
|
|
105
|
+
Object.defineProperty(exports, "redactSecrets", {
|
|
106
|
+
enumerable: true,
|
|
107
|
+
get: function () { return chunk5YVHNDSA_cjs.redactSecrets; }
|
|
108
|
+
});
|
|
109
|
+
Object.defineProperty(exports, "redactUrl", {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function () { return chunk5YVHNDSA_cjs.redactUrl; }
|
|
112
|
+
});
|
|
113
|
+
exports.default = src_default;
|
|
114
|
+
//# sourceMappingURL=index.cjs.map
|
|
115
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["OlaMapsClient"],"mappings":";;;;;;;;;;AAGA,IAAO,WAAA,GAAQA","file":"index.cjs","sourcesContent":["import { OlaMapsClient } from './client.js';\n\nexport { OlaMapsClient };\nexport default OlaMapsClient;\n\nexport type { AuthMode } from './core/auth.js';\nexport { DEFAULT_BASE_URL, DEFAULT_OAUTH_SCOPE, DEFAULT_TOKEN_URL } from './core/auth.js';\nexport {\n OlaAuthError,\n OlaMapsError,\n type OlaMapsErrorOptions,\n OlaNetworkError,\n OlaRateLimitError,\n OlaTimeoutError,\n OlaValidationError,\n parseRetryAfterMs,\n redactSecrets,\n redactUrl,\n} from './core/errors.js';\nexport {\n formatCoordinateList,\n formatLatLng,\n normalizeCoordinate,\n parseLatLngPair,\n} from './core/validate.js';\nexport { Elevation } from './endpoints/elevation.js';\nexport { Geofencing } from './endpoints/geofencing.js';\nexport { Places } from './endpoints/places.js';\nexport { Roads } from './endpoints/roads.js';\nexport { Routing } from './endpoints/routing.js';\nexport { StreetView } from './endpoints/streetview.js';\nexport { Tiles } from './endpoints/tiles.js';\nexport type {\n MapLibreMapOptions,\n MapLibreMapOptionsInput,\n MapLibreRequestParameters,\n MapLibreTransformOptions,\n MapLibreTransformRequest,\n OlaMapStyleName,\n} from './maplibre/index.js';\nexport { OLA_MAP_STYLES } from './maplibre/index.js';\nexport * from './types/index.js';\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { O as OlaMapsClient } from './client-Cd22y5wG.cjs';
|
|
2
|
+
export { A as AddressComponent, a as AddressValidationResponse, b as AuthMode, c as AutocompleteOptions, d as AutocompletePrediction, e as AutocompleteResponse, D as DEFAULT_BASE_URL, f as DEFAULT_OAUTH_SCOPE, g as DEFAULT_TOKEN_URL, h as DirectionsBasicOptions, i as DirectionsOptions, j as DirectionsResponse, k as DistanceMatrixBasicOptions, l as DistanceMatrixElement, m as DistanceMatrixOptions, n as DistanceMatrixResponse, E as Elevation, o as ElevationResponse, p as ElevationResult, F as FleetPlannerInput, q as FleetPlannerOptions, r as FleetPlannerResponse, s as FleetPlannerStrategy, G as GeocodeOptions, t as GeocodeResponse, u as GeocodeResult, v as GeofenceCreatePayload, w as GeofenceListResponse, x as GeofenceRecord, y as GeofenceStatus, z as GeofenceStatusResponse, B as GeofenceType, C as GeofenceUpdatePayload, H as Geofencing, M as MultiElevationResponse, N as NearbySearchOptions, I as NearbySearchRankBy, J as NearbySearchResponse, K as NearestRoadResult, L as NearestRoadsMode, P as NearestRoadsOptions, Q as NearestRoadsResponse, R as PlaceDetailsResponse, S as PlaceDetailsResult, T as PlacePhotoResponse, U as PlaceStructuredFormatting, V as Places, W as ReverseGeocodeOptions, X as ReverseGeocodeResponse, Y as Roads, Z as Route, _ as RouteLeg, $ as RouteOptimizerOptions, a0 as RouteOptimizerResponse, a1 as RouteOverview, a2 as RouteStep, a3 as Routing, a4 as RoutingMode, a5 as SnapStrategy, a6 as SnapToRoadOptions, a7 as SnapToRoadResponse, a8 as SnappedPoint, a9 as SpeedLimitSegment, aa as SpeedLimitsOptions, ab as SpeedLimitsResponse, ac as StaticMapBBox, ad as StaticMapFormat, ae as StaticMapOptions, af as StreetView, ag as StreetViewBBoxInput, ah as StreetViewCoverageAltBBox, ai as StreetViewCoverageBBox, aj as StreetViewCoverageResponse, ak as StreetViewImageIdOptions, al as StreetViewImageIdResponse, am as StreetViewMetadataResponse, an as StreetViewNeighbor, ao as TextSearchOptions, ap as TextSearchPrediction, aq as TextSearchResponse, ar as TileJSONResponse, as as TileStyleDetail, at as TileStyleSummary, au as Tiles, av as Tileset3DResponse } from './client-Cd22y5wG.cjs';
|
|
3
|
+
import { C as CoordinateInput, L as LatLng } from './common-Bt8xNzhK.cjs';
|
|
4
|
+
export { a as CacheConfig, F as FetchLike, b as LatLon, c as LngLatTuple, O as OAuthTokenResponse, d as OlaMapsClientConfig, e as OlaMapsClientInput, R as RequestHookContext, f as RequestOptions, g as ResponseHookContext, h as RetryConfig } from './common-Bt8xNzhK.cjs';
|
|
5
|
+
export { MapLibreMapOptions, MapLibreMapOptionsInput, MapLibreRequestParameters, MapLibreTransformOptions, MapLibreTransformRequest, OLA_MAP_STYLES, OlaMapStyleName } from './maplibre/index.cjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Redact API keys, OAuth client secrets, and Bearer tokens from arbitrary text.
|
|
9
|
+
*/
|
|
10
|
+
declare function redactSecrets(input: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Redact sensitive query parameters (`api_key`, `client_secret`, `access_token`) from a URL.
|
|
13
|
+
*/
|
|
14
|
+
declare function redactUrl(rawUrl: string): string;
|
|
15
|
+
interface OlaMapsErrorOptions {
|
|
16
|
+
status?: number;
|
|
17
|
+
code?: string;
|
|
18
|
+
requestId?: string;
|
|
19
|
+
correlationId?: string;
|
|
20
|
+
url?: string;
|
|
21
|
+
body?: unknown;
|
|
22
|
+
retryAfter?: number;
|
|
23
|
+
cause?: unknown;
|
|
24
|
+
}
|
|
25
|
+
declare class OlaMapsError extends Error {
|
|
26
|
+
readonly status?: number;
|
|
27
|
+
readonly code: string;
|
|
28
|
+
readonly requestId?: string;
|
|
29
|
+
readonly correlationId?: string;
|
|
30
|
+
readonly url?: string;
|
|
31
|
+
readonly body?: unknown;
|
|
32
|
+
/** Suggested retry delay in milliseconds, if provided by the server. */
|
|
33
|
+
readonly retryAfter?: number;
|
|
34
|
+
constructor(message: string, options?: OlaMapsErrorOptions);
|
|
35
|
+
toJSON(): Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
declare class OlaAuthError extends OlaMapsError {
|
|
38
|
+
constructor(message: string, options?: OlaMapsErrorOptions);
|
|
39
|
+
}
|
|
40
|
+
declare class OlaRateLimitError extends OlaMapsError {
|
|
41
|
+
constructor(message: string, options?: OlaMapsErrorOptions);
|
|
42
|
+
}
|
|
43
|
+
declare class OlaValidationError extends OlaMapsError {
|
|
44
|
+
constructor(message: string, options?: OlaMapsErrorOptions);
|
|
45
|
+
}
|
|
46
|
+
declare class OlaTimeoutError extends OlaMapsError {
|
|
47
|
+
readonly timeoutMs?: number;
|
|
48
|
+
constructor(message: string, options?: OlaMapsErrorOptions & {
|
|
49
|
+
timeoutMs?: number;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
declare class OlaNetworkError extends OlaMapsError {
|
|
53
|
+
constructor(message: string, options?: OlaMapsErrorOptions);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Parse an HTTP `Retry-After` header (delta-seconds or HTTP-date) into milliseconds.
|
|
57
|
+
*/
|
|
58
|
+
declare function parseRetryAfterMs(headerValue: string | null): number | undefined;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Parse and validate a `(lat, lng)` pair accepting numbers or numeric strings.
|
|
62
|
+
*/
|
|
63
|
+
declare function parseLatLngPair(lat: number | string, lng: number | string, label?: string): LatLng;
|
|
64
|
+
/**
|
|
65
|
+
* Normalize any supported coordinate input into `{ lat, lng }` with range validation.
|
|
66
|
+
*
|
|
67
|
+
* Supported formats:
|
|
68
|
+
* - `{ lat, lng }`
|
|
69
|
+
* - `{ lat, lon }`
|
|
70
|
+
* - `[lng, lat]` (GeoJSON / MapLibre order)
|
|
71
|
+
* - `"lat,lng"` string
|
|
72
|
+
*/
|
|
73
|
+
declare function normalizeCoordinate(input: CoordinateInput, label?: string): LatLng;
|
|
74
|
+
/**
|
|
75
|
+
* Format any supported coordinate input into Ola Maps' `"lat,lng"` wire format.
|
|
76
|
+
*/
|
|
77
|
+
declare function formatLatLng(input: CoordinateInput, label?: string): string;
|
|
78
|
+
interface CoordinateListOptions {
|
|
79
|
+
label: string;
|
|
80
|
+
min?: number;
|
|
81
|
+
max?: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Validate and format a pipe-separated coordinate list (string or array of CoordinateInput).
|
|
85
|
+
*/
|
|
86
|
+
declare function formatCoordinateList(input: string | readonly CoordinateInput[], options: CoordinateListOptions): string;
|
|
87
|
+
|
|
88
|
+
export { CoordinateInput, LatLng, OlaAuthError, OlaMapsClient, OlaMapsError, type OlaMapsErrorOptions, OlaNetworkError, OlaRateLimitError, OlaTimeoutError, OlaValidationError, OlaMapsClient as default, formatCoordinateList, formatLatLng, normalizeCoordinate, parseLatLngPair, parseRetryAfterMs, redactSecrets, redactUrl };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { O as OlaMapsClient } from './client-DsBMyuG9.js';
|
|
2
|
+
export { A as AddressComponent, a as AddressValidationResponse, b as AuthMode, c as AutocompleteOptions, d as AutocompletePrediction, e as AutocompleteResponse, D as DEFAULT_BASE_URL, f as DEFAULT_OAUTH_SCOPE, g as DEFAULT_TOKEN_URL, h as DirectionsBasicOptions, i as DirectionsOptions, j as DirectionsResponse, k as DistanceMatrixBasicOptions, l as DistanceMatrixElement, m as DistanceMatrixOptions, n as DistanceMatrixResponse, E as Elevation, o as ElevationResponse, p as ElevationResult, F as FleetPlannerInput, q as FleetPlannerOptions, r as FleetPlannerResponse, s as FleetPlannerStrategy, G as GeocodeOptions, t as GeocodeResponse, u as GeocodeResult, v as GeofenceCreatePayload, w as GeofenceListResponse, x as GeofenceRecord, y as GeofenceStatus, z as GeofenceStatusResponse, B as GeofenceType, C as GeofenceUpdatePayload, H as Geofencing, M as MultiElevationResponse, N as NearbySearchOptions, I as NearbySearchRankBy, J as NearbySearchResponse, K as NearestRoadResult, L as NearestRoadsMode, P as NearestRoadsOptions, Q as NearestRoadsResponse, R as PlaceDetailsResponse, S as PlaceDetailsResult, T as PlacePhotoResponse, U as PlaceStructuredFormatting, V as Places, W as ReverseGeocodeOptions, X as ReverseGeocodeResponse, Y as Roads, Z as Route, _ as RouteLeg, $ as RouteOptimizerOptions, a0 as RouteOptimizerResponse, a1 as RouteOverview, a2 as RouteStep, a3 as Routing, a4 as RoutingMode, a5 as SnapStrategy, a6 as SnapToRoadOptions, a7 as SnapToRoadResponse, a8 as SnappedPoint, a9 as SpeedLimitSegment, aa as SpeedLimitsOptions, ab as SpeedLimitsResponse, ac as StaticMapBBox, ad as StaticMapFormat, ae as StaticMapOptions, af as StreetView, ag as StreetViewBBoxInput, ah as StreetViewCoverageAltBBox, ai as StreetViewCoverageBBox, aj as StreetViewCoverageResponse, ak as StreetViewImageIdOptions, al as StreetViewImageIdResponse, am as StreetViewMetadataResponse, an as StreetViewNeighbor, ao as TextSearchOptions, ap as TextSearchPrediction, aq as TextSearchResponse, ar as TileJSONResponse, as as TileStyleDetail, at as TileStyleSummary, au as Tiles, av as Tileset3DResponse } from './client-DsBMyuG9.js';
|
|
3
|
+
import { C as CoordinateInput, L as LatLng } from './common-Bt8xNzhK.js';
|
|
4
|
+
export { a as CacheConfig, F as FetchLike, b as LatLon, c as LngLatTuple, O as OAuthTokenResponse, d as OlaMapsClientConfig, e as OlaMapsClientInput, R as RequestHookContext, f as RequestOptions, g as ResponseHookContext, h as RetryConfig } from './common-Bt8xNzhK.js';
|
|
5
|
+
export { MapLibreMapOptions, MapLibreMapOptionsInput, MapLibreRequestParameters, MapLibreTransformOptions, MapLibreTransformRequest, OLA_MAP_STYLES, OlaMapStyleName } from './maplibre/index.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Redact API keys, OAuth client secrets, and Bearer tokens from arbitrary text.
|
|
9
|
+
*/
|
|
10
|
+
declare function redactSecrets(input: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Redact sensitive query parameters (`api_key`, `client_secret`, `access_token`) from a URL.
|
|
13
|
+
*/
|
|
14
|
+
declare function redactUrl(rawUrl: string): string;
|
|
15
|
+
interface OlaMapsErrorOptions {
|
|
16
|
+
status?: number;
|
|
17
|
+
code?: string;
|
|
18
|
+
requestId?: string;
|
|
19
|
+
correlationId?: string;
|
|
20
|
+
url?: string;
|
|
21
|
+
body?: unknown;
|
|
22
|
+
retryAfter?: number;
|
|
23
|
+
cause?: unknown;
|
|
24
|
+
}
|
|
25
|
+
declare class OlaMapsError extends Error {
|
|
26
|
+
readonly status?: number;
|
|
27
|
+
readonly code: string;
|
|
28
|
+
readonly requestId?: string;
|
|
29
|
+
readonly correlationId?: string;
|
|
30
|
+
readonly url?: string;
|
|
31
|
+
readonly body?: unknown;
|
|
32
|
+
/** Suggested retry delay in milliseconds, if provided by the server. */
|
|
33
|
+
readonly retryAfter?: number;
|
|
34
|
+
constructor(message: string, options?: OlaMapsErrorOptions);
|
|
35
|
+
toJSON(): Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
declare class OlaAuthError extends OlaMapsError {
|
|
38
|
+
constructor(message: string, options?: OlaMapsErrorOptions);
|
|
39
|
+
}
|
|
40
|
+
declare class OlaRateLimitError extends OlaMapsError {
|
|
41
|
+
constructor(message: string, options?: OlaMapsErrorOptions);
|
|
42
|
+
}
|
|
43
|
+
declare class OlaValidationError extends OlaMapsError {
|
|
44
|
+
constructor(message: string, options?: OlaMapsErrorOptions);
|
|
45
|
+
}
|
|
46
|
+
declare class OlaTimeoutError extends OlaMapsError {
|
|
47
|
+
readonly timeoutMs?: number;
|
|
48
|
+
constructor(message: string, options?: OlaMapsErrorOptions & {
|
|
49
|
+
timeoutMs?: number;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
declare class OlaNetworkError extends OlaMapsError {
|
|
53
|
+
constructor(message: string, options?: OlaMapsErrorOptions);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Parse an HTTP `Retry-After` header (delta-seconds or HTTP-date) into milliseconds.
|
|
57
|
+
*/
|
|
58
|
+
declare function parseRetryAfterMs(headerValue: string | null): number | undefined;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Parse and validate a `(lat, lng)` pair accepting numbers or numeric strings.
|
|
62
|
+
*/
|
|
63
|
+
declare function parseLatLngPair(lat: number | string, lng: number | string, label?: string): LatLng;
|
|
64
|
+
/**
|
|
65
|
+
* Normalize any supported coordinate input into `{ lat, lng }` with range validation.
|
|
66
|
+
*
|
|
67
|
+
* Supported formats:
|
|
68
|
+
* - `{ lat, lng }`
|
|
69
|
+
* - `{ lat, lon }`
|
|
70
|
+
* - `[lng, lat]` (GeoJSON / MapLibre order)
|
|
71
|
+
* - `"lat,lng"` string
|
|
72
|
+
*/
|
|
73
|
+
declare function normalizeCoordinate(input: CoordinateInput, label?: string): LatLng;
|
|
74
|
+
/**
|
|
75
|
+
* Format any supported coordinate input into Ola Maps' `"lat,lng"` wire format.
|
|
76
|
+
*/
|
|
77
|
+
declare function formatLatLng(input: CoordinateInput, label?: string): string;
|
|
78
|
+
interface CoordinateListOptions {
|
|
79
|
+
label: string;
|
|
80
|
+
min?: number;
|
|
81
|
+
max?: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Validate and format a pipe-separated coordinate list (string or array of CoordinateInput).
|
|
85
|
+
*/
|
|
86
|
+
declare function formatCoordinateList(input: string | readonly CoordinateInput[], options: CoordinateListOptions): string;
|
|
87
|
+
|
|
88
|
+
export { CoordinateInput, LatLng, OlaAuthError, OlaMapsClient, OlaMapsError, type OlaMapsErrorOptions, OlaNetworkError, OlaRateLimitError, OlaTimeoutError, OlaValidationError, OlaMapsClient as default, formatCoordinateList, formatLatLng, normalizeCoordinate, parseLatLngPair, parseRetryAfterMs, redactSecrets, redactUrl };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { OlaMapsClient } from './chunk-22747AE4.js';
|
|
2
|
+
export { Elevation, Geofencing, OlaMapsClient, Places, Roads, Routing, StreetView, Tiles, formatCoordinateList, formatLatLng, normalizeCoordinate, parseLatLngPair } from './chunk-22747AE4.js';
|
|
3
|
+
export { OLA_MAP_STYLES } from './chunk-SJJRTEQG.js';
|
|
4
|
+
import './chunk-7LV3RPED.js';
|
|
5
|
+
export { DEFAULT_BASE_URL, DEFAULT_OAUTH_SCOPE, DEFAULT_TOKEN_URL, OlaAuthError, OlaMapsError, OlaNetworkError, OlaRateLimitError, OlaTimeoutError, OlaValidationError, parseRetryAfterMs, redactSecrets, redactUrl } from './chunk-D5T5ZDIQ.js';
|
|
6
|
+
|
|
7
|
+
// src/index.ts
|
|
8
|
+
var src_default = OlaMapsClient;
|
|
9
|
+
|
|
10
|
+
export { src_default as default };
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;AAGA,IAAO,WAAA,GAAQ","file":"index.js","sourcesContent":["import { OlaMapsClient } from './client.js';\n\nexport { OlaMapsClient };\nexport default OlaMapsClient;\n\nexport type { AuthMode } from './core/auth.js';\nexport { DEFAULT_BASE_URL, DEFAULT_OAUTH_SCOPE, DEFAULT_TOKEN_URL } from './core/auth.js';\nexport {\n OlaAuthError,\n OlaMapsError,\n type OlaMapsErrorOptions,\n OlaNetworkError,\n OlaRateLimitError,\n OlaTimeoutError,\n OlaValidationError,\n parseRetryAfterMs,\n redactSecrets,\n redactUrl,\n} from './core/errors.js';\nexport {\n formatCoordinateList,\n formatLatLng,\n normalizeCoordinate,\n parseLatLngPair,\n} from './core/validate.js';\nexport { Elevation } from './endpoints/elevation.js';\nexport { Geofencing } from './endpoints/geofencing.js';\nexport { Places } from './endpoints/places.js';\nexport { Roads } from './endpoints/roads.js';\nexport { Routing } from './endpoints/routing.js';\nexport { StreetView } from './endpoints/streetview.js';\nexport { Tiles } from './endpoints/tiles.js';\nexport type {\n MapLibreMapOptions,\n MapLibreMapOptionsInput,\n MapLibreRequestParameters,\n MapLibreTransformOptions,\n MapLibreTransformRequest,\n OlaMapStyleName,\n} from './maplibre/index.js';\nexport { OLA_MAP_STYLES } from './maplibre/index.js';\nexport * from './types/index.js';\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkXRJXKY7C_cjs = require('../chunk-XRJXKY7C.cjs');
|
|
4
|
+
require('../chunk-5YVHNDSA.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "OLA_MAP_STYLES", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkXRJXKY7C_cjs.OLA_MAP_STYLES; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "getMapOptions", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunkXRJXKY7C_cjs.getMapOptions; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "getStyleURL", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunkXRJXKY7C_cjs.getStyleURL; }
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "getTransformRequest", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunkXRJXKY7C_cjs.getTransformRequest; }
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "isOlaMapsHost", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return chunkXRJXKY7C_cjs.isOlaMapsHost; }
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=index.cjs.map
|
|
29
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { c as LngLatTuple } from '../common-Bt8xNzhK.cjs';
|
|
2
|
+
|
|
3
|
+
declare const OLA_MAP_STYLES: readonly ["default-light-lite", "default-light-standard", "default-ultra-light-standard", "default-light-full", "default-dark-lite", "default-dark-standard", "default-dark-full", "default-dark-standard-satellite", "eclipse-light-lite", "eclipse-light-standard", "eclipse-light-full", "eclipse-dark-lite", "eclipse-dark-standard", "eclipse-dark-full", "bolt-light", "bolt-dark", "vintage-light", "vintage-dark", "default-earth-lite", "default-earth-standard", "default-earth-full", "positron", "osm-bright", "osm-basic", "dark-matter", "fiord-color", "silver-osm"];
|
|
4
|
+
type OlaMapStyleName = (typeof OLA_MAP_STYLES)[number] | (string & {});
|
|
5
|
+
interface MapLibreRequestParameters {
|
|
6
|
+
url: string;
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
credentials?: 'same-origin' | 'include';
|
|
9
|
+
collectResourceTiming?: boolean;
|
|
10
|
+
}
|
|
11
|
+
type MapLibreTransformRequest = (url: string, resourceType?: string) => MapLibreRequestParameters;
|
|
12
|
+
interface MapLibreTransformOptions {
|
|
13
|
+
/** Ola Maps API key (attached strictly to `*.olamaps.io` URLs). */
|
|
14
|
+
apiKey?: string;
|
|
15
|
+
/** Bearer access token (attached strictly to `*.olamaps.io` URLs via Authorization header). */
|
|
16
|
+
accessToken?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Optional proxy base URL (e.g. `'/api/ola-maps'` or `'https://app.example.com/api/ola-maps'`).
|
|
19
|
+
* When set, `*.olamaps.io` tile/style/font requests are rewritten to route through your proxy
|
|
20
|
+
* without attaching credentials in the browser.
|
|
21
|
+
*/
|
|
22
|
+
proxyBaseUrl?: string;
|
|
23
|
+
}
|
|
24
|
+
interface MapLibreMapOptionsInput extends Record<string, unknown> {
|
|
25
|
+
container?: string | HTMLElement;
|
|
26
|
+
center?: LngLatTuple;
|
|
27
|
+
zoom?: number;
|
|
28
|
+
style?: OlaMapStyleName | Record<string, unknown>;
|
|
29
|
+
/** Override base URL for style resolution (defaults to `proxyBaseUrl` or `https://api.olamaps.io`). */
|
|
30
|
+
baseUrl?: string;
|
|
31
|
+
}
|
|
32
|
+
interface MapLibreMapOptions extends Record<string, unknown> {
|
|
33
|
+
container?: string | HTMLElement;
|
|
34
|
+
style: string | Record<string, unknown>;
|
|
35
|
+
center: LngLatTuple;
|
|
36
|
+
zoom: number;
|
|
37
|
+
transformRequest: MapLibreTransformRequest;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Check whether a hostname belongs strictly to Ola Maps (`olamaps.io` or `*.olamaps.io`).
|
|
41
|
+
*/
|
|
42
|
+
declare function isOlaMapsHost(hostname: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Build the full MapLibre style JSON URL for a named Ola Maps style.
|
|
45
|
+
*/
|
|
46
|
+
declare function getStyleURL(styleName?: OlaMapStyleName, baseUrl?: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Create a host-safe MapLibre `transformRequest` callback.
|
|
49
|
+
*
|
|
50
|
+
* Security guarantees:
|
|
51
|
+
* - Parses URLs via `new URL()` (never naive substring replacement).
|
|
52
|
+
* - Only rewrites `app.olamaps.io` → `api.olamaps.io`.
|
|
53
|
+
* - Strictly restricts `api_key` and `Authorization` attachment to `*.olamaps.io` hosts,
|
|
54
|
+
* preventing credential leakage to third-party sprite, glyph, or overlay domains.
|
|
55
|
+
* - Supports Proxy Mode via `proxyBaseUrl` so browser maps never need raw API keys.
|
|
56
|
+
*/
|
|
57
|
+
declare function getTransformRequest(options?: MapLibreTransformOptions): MapLibreTransformRequest;
|
|
58
|
+
/**
|
|
59
|
+
* Build a complete, ready-to-use MapLibre GL `Map` options object.
|
|
60
|
+
*/
|
|
61
|
+
declare function getMapOptions(auth: MapLibreTransformOptions, options?: MapLibreMapOptionsInput): MapLibreMapOptions;
|
|
62
|
+
|
|
63
|
+
export { type MapLibreMapOptions, type MapLibreMapOptionsInput, type MapLibreRequestParameters, type MapLibreTransformOptions, type MapLibreTransformRequest, OLA_MAP_STYLES, type OlaMapStyleName, getMapOptions, getStyleURL, getTransformRequest, isOlaMapsHost };
|