@jsm-mit/map-routes-package 0.1.0 → 0.2.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.
@@ -1,153 +0,0 @@
1
- import type { Principal } from '@icp-sdk/core/principal';
2
- import type { ActorMethod } from '@icp-sdk/core/agent';
3
- import type { IDL } from '@icp-sdk/core/candid';
4
-
5
- export interface BeginUploadArgs {
6
- /**
7
- * sha256 (hex) of the graph file.
8
- */
9
- 'sha256' : string,
10
- /**
11
- * Bytes of the graph file (`map-routes-build build` output, format TMC3).
12
- */
13
- 'size' : bigint,
14
- 'osmDate' : string,
15
- }
16
- export interface BufferInfo {
17
- 'sha256' : string,
18
- 'size' : bigint,
19
- 'startedAtNs' : bigint,
20
- 'state' : BufferState,
21
- 'buffer' : number,
22
- 'osmDate' : string,
23
- }
24
- export type BufferState = { 'Uploading' : null } |
25
- { 'Active' : null } |
26
- { 'Ready' : null };
27
- /**
28
- * The fastest route by car between two points.
29
- */
30
- export interface Distance {
31
- 'meters' : bigint,
32
- 'snapToMeters' : number,
33
- 'seconds' : bigint,
34
- /**
35
- * Instructions this query took (measurement of the PoC).
36
- */
37
- 'instructions' : bigint,
38
- /**
39
- * sha256 (hex) of the graph, as printed by `map-routes-build build`.
40
- */
41
- 'graphSha256' : string,
42
- /**
43
- * Date of the OpenStreetMap extract the graph was built from.
44
- */
45
- 'osmDate' : string,
46
- /**
47
- * How far each point lies from the junction the route starts or ends at.
48
- */
49
- 'snapFromMeters' : number,
50
- }
51
- export interface DistanceArgs { 'to' : Point, 'from' : Point }
52
- export type Error = {
53
- /**
54
- * No road within `MAX_SNAP_M` of the point named ("from" / "to" / "points[i]").
55
- */
56
- 'OutsideArea' : string
57
- } |
58
- {
59
- /**
60
- * No graph is active yet, or the active one is of an older format.
61
- */
62
- 'NotReady' : null
63
- } |
64
- { 'NotFound' : null } |
65
- { 'NotAuthorized' : string } |
66
- { 'NoRoute' : null } |
67
- { 'InvalidData' : string };
68
- /**
69
- * The fastest route from one point of a `route` query to the next.
70
- */
71
- export interface Leg {
72
- 'meters' : bigint,
73
- /**
74
- * Encoded polyline of precision 5 (as ORS sends it), from the junction the leg starts
75
- * at to the one it ends at; "" when the line was not asked for.
76
- */
77
- 'line' : string,
78
- 'seconds' : bigint,
79
- }
80
- export interface Point { 'lat' : number, 'lon' : number }
81
- export type Result = { 'Ok' : BufferInfo } |
82
- { 'Err' : Error };
83
- export type Result_1 = { 'Ok' : Distance } |
84
- { 'Err' : Error };
85
- export type Result_2 = { 'Ok' : Status } |
86
- { 'Err' : Error };
87
- export type Result_3 = { 'Ok' : RouteAnswer } |
88
- { 'Err' : Error };
89
- export type Result_4 = { 'Ok' : null } |
90
- { 'Err' : Error };
91
- export interface RouteAnswer {
92
- /**
93
- * How far each point lies from the junction its legs start or end at.
94
- */
95
- 'snapMeters' : Uint32Array | number[],
96
- /**
97
- * One leg for each pair of consecutive points.
98
- */
99
- 'legs' : Array<Leg>,
100
- 'instructions' : bigint,
101
- 'graphSha256' : string,
102
- 'osmDate' : string,
103
- }
104
- export interface RouteArgs {
105
- /**
106
- * Whether each leg carries its line.
107
- */
108
- 'line' : boolean,
109
- /**
110
- * 2..=`MAX_ROUTE_POINTS` points, driven in this order.
111
- */
112
- 'points' : Array<Point>,
113
- }
114
- export interface Status {
115
- 'stableBytes' : bigint,
116
- 'heapBytes' : bigint,
117
- /**
118
- * Nodes of the graph that answers `distance`; 0 when none is active.
119
- */
120
- 'nodes' : bigint,
121
- 'buffers' : Array<BufferInfo>,
122
- }
123
- export interface UploadChunkArgs {
124
- 'offset' : bigint,
125
- 'bytes' : Uint8Array | number[],
126
- }
127
- export interface _SERVICE {
128
- /**
129
- * Switches `distance` to the inactive buffer — a new graph, or back to the previous one.
130
- */
131
- 'activate' : ActorMethod<[], Result>,
132
- /**
133
- * Starts an upload into the inactive buffer; whatever was there is dropped.
134
- */
135
- 'beginUpload' : ActorMethod<[BeginUploadArgs], Result>,
136
- /**
137
- * Checks the hash and the header of the uploaded graph; the buffer becomes Ready.
138
- */
139
- 'commitUpload' : ActorMethod<[], Result>,
140
- /**
141
- * The fastest route by car from one point to another. Public.
142
- */
143
- 'distance' : ActorMethod<[DistanceArgs], Result_1>,
144
- 'getStatus' : ActorMethod<[], Result_2>,
145
- /**
146
- * The fastest route by car through 2..=5 points, leg by leg, with each leg's line when
147
- * asked. Public.
148
- */
149
- 'route' : ActorMethod<[RouteArgs], Result_3>,
150
- 'uploadChunk' : ActorMethod<[UploadChunkArgs], Result_4>,
151
- }
152
- export declare const idlFactory: IDL.InterfaceFactory;
153
- export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];