@tileflow/routing 0.0.0-stage → 0.1.0-alpha.1
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 +201 -0
- package/README.md +337 -2
- package/dist/chunk-ECBK2QPL.js +450 -0
- package/dist/chunk-MCATD4FU.js +256 -0
- package/dist/client.d.ts +53 -0
- package/dist/client.js +17 -0
- package/dist/contract.d.ts +708 -0
- package/dist/contract.js +72 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +86 -0
- package/package.json +60 -3
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { RoutingErrorCode, RoutingIsochroneRequest, RoutingIsochroneResponse, RoutingMatchRequest, RoutingMatchResponse, RoutingMatrixRequest, RoutingMatrixResponse, RoutingNearestRequest, RoutingNearestResponse, RoutingRouteRequest, RoutingRouteResponse } from './contract.js';
|
|
2
|
+
import 'zod';
|
|
3
|
+
|
|
4
|
+
type RoutingOptions = Readonly<{
|
|
5
|
+
/** A Tileflow credential with the Routing permission. */
|
|
6
|
+
apiKey: string;
|
|
7
|
+
/** Defaults to `https://api.tileflow.dev`. Plain HTTP is accepted only on loopback. */
|
|
8
|
+
apiUrl?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The native app a publishable credential admits: its iOS bundle ID, or its Android package name
|
|
11
|
+
* with the SHA-256 fingerprint of its signing certificate. Browsers send their origin instead.
|
|
12
|
+
*/
|
|
13
|
+
app?: Readonly<{
|
|
14
|
+
id: string;
|
|
15
|
+
certificateSha256?: string;
|
|
16
|
+
}>;
|
|
17
|
+
fetch?: typeof fetch;
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}>;
|
|
20
|
+
declare class RoutingError extends Error {
|
|
21
|
+
readonly code: RoutingErrorCode | null;
|
|
22
|
+
readonly requestId: string | null;
|
|
23
|
+
readonly status: number;
|
|
24
|
+
readonly retryAfterSeconds: number | null;
|
|
25
|
+
constructor(message: string, input: {
|
|
26
|
+
code?: RoutingErrorCode;
|
|
27
|
+
requestId?: string;
|
|
28
|
+
status: number;
|
|
29
|
+
retryAfterSeconds?: number | null;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The fastest route through two to five positions, with up to two alternatives between two
|
|
34
|
+
* positions. Each route has its line, distance, duration, turn-by-turn steps and whether it uses
|
|
35
|
+
* tolls, highways or ferries.
|
|
36
|
+
*/
|
|
37
|
+
declare function route(request: RoutingRouteRequest, options: RoutingOptions): Promise<RoutingRouteResponse>;
|
|
38
|
+
/** The areas reachable from a position in one to four times, one polygon per time. */
|
|
39
|
+
declare function isochrone(request: RoutingIsochroneRequest, options: RoutingOptions): Promise<RoutingIsochroneResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* Travel times and distances from every source to every target: one row per source, one column
|
|
42
|
+
* per target, in request order, with `null` where no route connects a pair.
|
|
43
|
+
*/
|
|
44
|
+
declare function matrix(request: RoutingMatrixRequest, options: RoutingOptions): Promise<RoutingMatrixResponse>;
|
|
45
|
+
/**
|
|
46
|
+
* The roads a GPS trace followed: the matched line, where each trace position was matched, and
|
|
47
|
+
* each road with what OpenStreetMap records about it, including tagged speed limits.
|
|
48
|
+
*/
|
|
49
|
+
declare function match(request: RoutingMatchRequest, options: RoutingOptions): Promise<RoutingMatchResponse>;
|
|
50
|
+
/** The nearest point of a road the mode can use, its distance and what OpenStreetMap records. */
|
|
51
|
+
declare function nearest(request: RoutingNearestRequest, options: RoutingOptions): Promise<RoutingNearestResponse>;
|
|
52
|
+
|
|
53
|
+
export { RoutingError, type RoutingOptions, isochrone, match, matrix, nearest, route };
|
package/dist/client.js
ADDED