@mountaya/client 0.0.0-stage → 0.1.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 (96) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/LICENCE.fr.txt +280 -0
  3. package/LICENSE.txt +262 -0
  4. package/README.md +1260 -2
  5. package/dist/admin/index.cjs +3521 -0
  6. package/dist/admin/index.cjs.map +1 -0
  7. package/dist/admin/index.d.cts +1070 -0
  8. package/dist/admin/index.d.ts +1070 -0
  9. package/dist/admin/index.js +301 -0
  10. package/dist/admin/index.js.map +1 -0
  11. package/dist/browser.cjs +8073 -0
  12. package/dist/browser.cjs.map +1 -0
  13. package/dist/browser.d.cts +106 -0
  14. package/dist/browser.d.ts +106 -0
  15. package/dist/browser.js +53 -0
  16. package/dist/browser.js.map +1 -0
  17. package/dist/chunk-BM526BHG.js +342 -0
  18. package/dist/chunk-BM526BHG.js.map +1 -0
  19. package/dist/chunk-D2YEVTG7.js +327 -0
  20. package/dist/chunk-D2YEVTG7.js.map +1 -0
  21. package/dist/chunk-OHKVUREN.js +3500 -0
  22. package/dist/chunk-OHKVUREN.js.map +1 -0
  23. package/dist/chunk-TDTK2L5H.js +3842 -0
  24. package/dist/chunk-TDTK2L5H.js.map +1 -0
  25. package/dist/coreOperations.gen-BMYPoBbz.d.ts +1760 -0
  26. package/dist/coreOperations.gen-BxX5xRxw.d.cts +1760 -0
  27. package/dist/errors-B-GqAtQv.d.cts +75960 -0
  28. package/dist/errors-B-GqAtQv.d.ts +75960 -0
  29. package/dist/events/index.cjs +1972 -0
  30. package/dist/events/index.cjs.map +1 -0
  31. package/dist/events/index.d.cts +781 -0
  32. package/dist/events/index.d.ts +781 -0
  33. package/dist/events/index.js +826 -0
  34. package/dist/events/index.js.map +1 -0
  35. package/dist/index.cjs +8072 -0
  36. package/dist/index.cjs.map +1 -0
  37. package/dist/index.d.cts +76 -0
  38. package/dist/index.d.ts +76 -0
  39. package/dist/index.js +52 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/operations.gen-CvTyzKNF.d.cts +3993 -0
  42. package/dist/operations.gen-DUD406TV.d.ts +3993 -0
  43. package/package.json +127 -4
  44. package/src/admin/index.ts +47 -0
  45. package/src/admin/rules/mountayaAdmin.ts +102 -0
  46. package/src/browser.ts +232 -0
  47. package/src/core/engines/sessionToken.ts +870 -0
  48. package/src/core/rules/auth.ts +1017 -0
  49. package/src/core/rules/clientHeader.ts +28 -0
  50. package/src/core/rules/dates.ts +200 -0
  51. package/src/core/rules/decode.ts +154 -0
  52. package/src/core/rules/envelope.ts +41 -0
  53. package/src/core/rules/errors.ts +1486 -0
  54. package/src/core/rules/graphql.ts +576 -0
  55. package/src/core/rules/headerValue.ts +42 -0
  56. package/src/core/rules/idempotencyKey.ts +64 -0
  57. package/src/core/rules/nullMask.ts +127 -0
  58. package/src/core/rules/nullMasks.gen.ts +416 -0
  59. package/src/core/rules/paginate.ts +316 -0
  60. package/src/core/rules/rateLimit.ts +507 -0
  61. package/src/core/rules/redaction.ts +219 -0
  62. package/src/core/rules/resourceRef.ts +110 -0
  63. package/src/core/rules/responseBody.ts +492 -0
  64. package/src/core/rules/retry.ts +386 -0
  65. package/src/core/rules/selection.ts +416 -0
  66. package/src/core/rules/sessionAnswer.ts +90 -0
  67. package/src/core/rules/sessionSchedule.ts +131 -0
  68. package/src/core/rules/sessionWait.ts +112 -0
  69. package/src/core/rules/transport.ts +2386 -0
  70. package/src/core/rules/version.gen.ts +16 -0
  71. package/src/core/rules/webAddress.ts +165 -0
  72. package/src/core/rules/webAddresses.gen.ts +30 -0
  73. package/src/data/operations.gen.ts +603 -0
  74. package/src/data/schema.gen.ts +8078 -0
  75. package/src/data/selection.gen.ts +472 -0
  76. package/src/events/index.ts +67 -0
  77. package/src/events/rules/agent.ts +439 -0
  78. package/src/events/rules/collab.ts +554 -0
  79. package/src/events/rules/collabNulls.gen.ts +17 -0
  80. package/src/events/rules/eventStream.ts +94 -0
  81. package/src/events/rules/openSseStream.ts +594 -0
  82. package/src/events/rules/sse.ts +349 -0
  83. package/src/index.ts +231 -0
  84. package/src/rest/adminOperations.gen.ts +70 -0
  85. package/src/rest/adminResources.gen.ts +136 -0
  86. package/src/rest/coreOperations.gen.ts +74 -0
  87. package/src/rest/coreResources.gen.ts +244 -0
  88. package/src/rest/dates.gen.ts +217 -0
  89. package/src/rest/operations.gen.ts +4341 -0
  90. package/src/rest/resources.gen.ts +369 -0
  91. package/src/rest/schema.gen.ts +56840 -0
  92. package/src/tiles/operations.gen.ts +206 -0
  93. package/src/tiles/schema.gen.ts +8408 -0
  94. package/src/webhooks/rules/constructWebhookEvent.ts +482 -0
  95. package/src/webhooks/rules/webhookEvent.ts +38 -0
  96. package/src/webhooks/rules/webhookEvents.gen.ts +732 -0
@@ -0,0 +1,603 @@
1
+ // GENERATED FILE. DO NOT EDIT.
2
+ //
3
+ // One method per Data API operation, generated from the Data API operation catalog the
4
+ // Mountaya platform builds from the SDL, not from the SDL itself. The catalog carries each
5
+ // operation's full-selection document as the server prints it, which is what the documents
6
+ // below are; the input and result types come from schema.gen.ts, which IS generated from
7
+ // the SDL.
8
+ //
9
+ // Each method takes the operation's input and an optional options bag. Omitting `select`
10
+ // sends the generated full-selection document below, verbatim; passing one prints a
11
+ // narrower document from the tree in selection.gen.ts and narrows the return type to
12
+ // match. `signal` and `retry` in the bag reach the transport as a REST call's would.
13
+ //
14
+ // An operation whose result holds a `DateTime` passes the transport a mask naming those
15
+ // fields, read off the SDL, so they arrive as a Date and no other string does.
16
+ //
17
+ // The SDL is authored in mountaya/schemas (graphql/data); edit it there, not here.
18
+
19
+ import { runOperation } from "../core/rules/graphql.js";
20
+ import {
21
+ type DataOptions,
22
+ type DataResult,
23
+ documentFor,
24
+ type Selection,
25
+ } from "../core/rules/selection.js";
26
+ import type { MountayaTransport } from "../core/rules/transport.js";
27
+ import type {
28
+ AnalyzeGeometryInput,
29
+ AnalyzeGeometryResult,
30
+ DirectionsInput,
31
+ DirectionsResult,
32
+ ExportItineraryInput,
33
+ ExportItineraryResult,
34
+ GeocodeInput,
35
+ GeocodeResult,
36
+ IsochronesInput,
37
+ IsochronesResult,
38
+ ItineraryInput,
39
+ ItineraryResult,
40
+ MatrixInput,
41
+ MatrixResult,
42
+ PoisInput,
43
+ PoisResult,
44
+ ReverseGeocodeInput,
45
+ ReverseGeocodeResult,
46
+ SearchInput,
47
+ SearchResult,
48
+ SuggestionsInput,
49
+ SuggestionsResult,
50
+ TerrainGridInput,
51
+ TerrainGridResult,
52
+ TerrainProfileInput,
53
+ TerrainProfileResult,
54
+ TerrainSamplesInput,
55
+ TerrainSamplesResult,
56
+ } from "./schema.gen.js";
57
+ import {
58
+ analyzeGeometryFields,
59
+ directionsFields,
60
+ exportItineraryFields,
61
+ geocodeFields,
62
+ isochronesFields,
63
+ itineraryFields,
64
+ matrixFields,
65
+ poisFields,
66
+ reverseGeocodeFields,
67
+ searchFields,
68
+ suggestionsFields,
69
+ terrainGridFields,
70
+ terrainProfileFields,
71
+ terrainSamplesFields,
72
+ } from "./selection.gen.js";
73
+
74
+ /**
75
+ * Analyze surface and way type of an existing geometry.
76
+ * An analysis the routing engine failed on in part is answered as `analysis` states.
77
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
78
+ */
79
+ export const analyzeGeometry = <
80
+ S extends Selection<typeof analyzeGeometryFields> | undefined = undefined,
81
+ >(
82
+ transport: MountayaTransport,
83
+ input: AnalyzeGeometryInput,
84
+ options?: DataOptions<S>,
85
+ ): Promise<DataResult<AnalyzeGeometryResult, S>> =>
86
+ runOperation(
87
+ transport,
88
+ "analyzeGeometry",
89
+ documentFor(
90
+ "analyzeGeometry",
91
+ "AnalyzeGeometryInput!",
92
+ analyzeGeometryFields,
93
+ "query AnalyzeGeometry($input: AnalyzeGeometryInput!) {\n analyzeGeometry(input: $input) {\n analysis {\n elevation {\n altitude {\n max\n min\n }\n ascent\n descent\n gradient {\n max\n min\n }\n }\n elevations\n slopeInfo {\n fromIndex\n toIndex\n value\n }\n speedInfo {\n fromIndex\n toIndex\n value\n }\n surfaceInfo {\n fromIndex\n toIndex\n value\n }\n trailDifficultyInfo {\n fromIndex\n toIndex\n value\n }\n wayTypeInfo {\n fromIndex\n toIndex\n value\n }\n advisories {\n tollway\n restrictedAccess\n tollwayInfo {\n fromIndex\n toIndex\n value\n }\n roadAccessInfo {\n fromIndex\n toIndex\n values\n }\n }\n }\n duration\n }\n}\n",
94
+ options?.select,
95
+ ),
96
+ input,
97
+ options,
98
+ );
99
+
100
+ /**
101
+ * Compute directions between waypoints for a given activity.
102
+ * Returns one or more routes with distance, duration, geometry, and analysis.
103
+ * A waypoint the routing engine cannot route is refused as `waypoints` states, and every other failure of the engine is INTERNAL_ERROR.
104
+ * BACKCOUNTRY_SKIING has no routing at all, and GRAVEL_BIKE and MOUNTAIN_BIKE are unavailable: all three are VALIDATION_FAILED at ["input", "activity"].
105
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
106
+ */
107
+ export const directions = <S extends Selection<typeof directionsFields> | undefined = undefined>(
108
+ transport: MountayaTransport,
109
+ input: DirectionsInput,
110
+ options?: DataOptions<S>,
111
+ ): Promise<DataResult<DirectionsResult, S>> =>
112
+ runOperation(
113
+ transport,
114
+ "directions",
115
+ documentFor(
116
+ "directions",
117
+ "DirectionsInput!",
118
+ directionsFields,
119
+ "query Directions($input: DirectionsInput!) {\n directions(input: $input) {\n routes {\n distance\n duration\n elevation {\n altitude {\n max\n min\n }\n ascent\n descent\n gradient {\n max\n min\n }\n }\n geometry\n analysis {\n elevation {\n altitude {\n max\n min\n }\n ascent\n descent\n gradient {\n max\n min\n }\n }\n elevations\n slopeInfo {\n fromIndex\n toIndex\n value\n }\n speedInfo {\n fromIndex\n toIndex\n value\n }\n surfaceInfo {\n fromIndex\n toIndex\n value\n }\n trailDifficultyInfo {\n fromIndex\n toIndex\n value\n }\n wayTypeInfo {\n fromIndex\n toIndex\n value\n }\n advisories {\n tollway\n restrictedAccess\n tollwayInfo {\n fromIndex\n toIndex\n value\n }\n roadAccessInfo {\n fromIndex\n toIndex\n values\n }\n }\n }\n avoidance\n summary\n steps {\n fromIndex\n toIndex\n type\n name\n distance\n duration\n exitNumber\n }\n }\n }\n}\n",
120
+ options?.select,
121
+ ),
122
+ input,
123
+ options,
124
+ );
125
+
126
+ /**
127
+ * Prepare a download of an itinerary in a route file format.
128
+ * It returns a short-lived signed URL rather than the file itself.
129
+ * The bytes of a GPX or FIT are of no use to an assistant reading a response, and inlining them would spend the whole reply on a payload nobody reads; a URL can be handed straight to the user or fetched by a client that wants the file.
130
+ * What may be exported is what `itinerary` serves.
131
+ * An itinerary of your key's own organization, public or private, is exported as its current draft under a session token naming a member, provided the organization holds Map Publishing: the draft of an organization whose agreement does not include it is refused with PAYMENT_REQUIRED, and no URL is minted.
132
+ * Under a session token minted without `user_id`, such as the one an Embedded Studio's read-only viewer runs on, your own organization's itinerary, public or private, is exported as it was last published instead, never as its draft: one never published or taken down, or whose organization's agreement does not include Map Publishing, answers NOT_FOUND.
133
+ * The token Mountaya's MCP server holds for its own requests is the one exception, and exports the draft.
134
+ * Another organization's public itinerary is exported as it was last published, and one that organization has never published, or has taken down, answers NOT_FOUND, as does one whose organization's agreement does not include Map Publishing.
135
+ * An id no itinerary carries and an itinerary your key may not read both answer NOT_FOUND.
136
+ * The URL names one itinerary in one format and nothing else, and stops working ten minutes after it is minted.
137
+ * Every download checks again that the itinerary is still served to the organization the URL was minted for, so a link to another organization's itinerary stops working once that itinerary is made private or taken down, or its organization's agreement stops including Map Publishing.
138
+ * The URL also names the key that minted it, and every download checks again that this key is still active and still of that organization: revoking the key ends every URL it minted.
139
+ * A URL minted under a session token naming a member is downloaded as that member only while they remain one: once they are removed from the organization, the download is served what a URL minted under a session token minted without `user_id` is, the itinerary as it was last published, and 404 when it has no publication.
140
+ * Downloads beyond 60 a minute from one address, an IPv6 address counted by its /64 prefix, answer 429, and so do downloads beyond 6,000 a minute of the URLs one organization's keys minted, or beyond 3,000 a minute of the URLs one person signed in to Mountaya's web application minted, counted once a link is known to be genuine and before the file is rendered.
141
+ * An expired or altered link, or one whose key has been revoked, answers 404.
142
+ * The refusal a mint gives for the itinerary itself is given again by the download when it has come to apply since, as it is rather than as that 404: a plain 402 PAYMENT_REQUIRED for a draft whose organization does not hold Map Publishing.
143
+ * Nothing is stored: this creates no share and leaves no state behind.
144
+ * A personal itinerary, made from an individual account and owned by no organization, is never exported and no URL is minted: your key reads it as published, as it reads another organization's public itinerary, and a personal itinerary is never published, so it answers NOT_FOUND, public or private, like any other itinerary your key may not read.
145
+ * An itinerary of more than 500,000 positions, every position of its segments' geometry, the vias of its routed lines included, plus one per waypoint, is more than one answer carries: it is refused with PAYLOAD_TOO_LARGE at ["input"], naming none of its fields, and no URL is minted.
146
+ * The positions are counted over the whole itinerary, after every other refusal, NOT_FOUND included, and the download refuses it the same way, with a 413, once the itinerary has grown past that since the URL was minted.
147
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
148
+ */
149
+ export const exportItinerary = <
150
+ S extends Selection<typeof exportItineraryFields> | undefined = undefined,
151
+ >(
152
+ transport: MountayaTransport,
153
+ input: ExportItineraryInput,
154
+ options?: DataOptions<S>,
155
+ ): Promise<DataResult<ExportItineraryResult, S>> =>
156
+ runOperation(
157
+ transport,
158
+ "exportItinerary",
159
+ documentFor(
160
+ "exportItinerary",
161
+ "ExportItineraryInput!",
162
+ exportItineraryFields,
163
+ "query ExportItinerary($input: ExportItineraryInput!) {\n exportItinerary(input: $input) {\n url\n filename\n format\n expiresAt\n }\n}\n",
164
+ options?.select,
165
+ ),
166
+ input,
167
+ options,
168
+ { expiresAt: true },
169
+ );
170
+
171
+ /**
172
+ * Forward geocode a free-text query into a list of named places.
173
+ * Returns cities, regions, natural features, and addresses ranked by relevance.
174
+ * Every parameter the geocoder is asked with is checked or built by this API, so a failure of the geocoder, its refusal of a request included, is INTERNAL_ERROR, never the caller's to fix.
175
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
176
+ */
177
+ export const geocode = <S extends Selection<typeof geocodeFields> | undefined = undefined>(
178
+ transport: MountayaTransport,
179
+ input: GeocodeInput,
180
+ options?: DataOptions<S>,
181
+ ): Promise<DataResult<GeocodeResult, S>> =>
182
+ runOperation(
183
+ transport,
184
+ "geocode",
185
+ documentFor(
186
+ "geocode",
187
+ "GeocodeInput!",
188
+ geocodeFields,
189
+ "query Geocode($input: GeocodeInput!) {\n geocode(input: $input) {\n count\n places {\n osm {\n id\n type\n key\n value\n }\n name\n label\n layer\n category\n point\n bounds\n country\n countryName\n region\n county\n city\n postcode\n street\n houseNumber\n }\n }\n}\n",
190
+ options?.select,
191
+ ),
192
+ input,
193
+ options,
194
+ );
195
+
196
+ /**
197
+ * Compute isochrones (reachability polygons) from one or more locations for a given activity.
198
+ * Returns polygons representing areas reachable within the specified range.
199
+ * The input's own bounds (one or two locations, one to six ranges, each range at most 7,200 seconds or 25,000 meters, and a speed that stretches no time range past 7,200 seconds) are checked first, each refusal at the field it names, and then each location is placed on the activity's network, as `locations` states.
200
+ * Any failure of the routing engine after that is INTERNAL_ERROR, a ceiling of its own set below these bounds included.
201
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
202
+ */
203
+ export const isochrones = <S extends Selection<typeof isochronesFields> | undefined = undefined>(
204
+ transport: MountayaTransport,
205
+ input: IsochronesInput,
206
+ options?: DataOptions<S>,
207
+ ): Promise<DataResult<IsochronesResult, S>> =>
208
+ runOperation(
209
+ transport,
210
+ "isochrones",
211
+ documentFor(
212
+ "isochrones",
213
+ "IsochronesInput!",
214
+ isochronesFields,
215
+ "query Isochrones($input: IsochronesInput!) {\n isochrones(input: $input) {\n isochrones {\n value\n area\n reachFactor\n center\n geometry\n }\n }\n}\n",
216
+ options?.select,
217
+ ),
218
+ input,
219
+ options,
220
+ );
221
+
222
+ /**
223
+ * Read a single itinerary by identifier, with its ordered segments and waypoints.
224
+ * What is served depends on who owns it.
225
+ * An itinerary of your key's own organization, public or private, is served as its current draft under a session token naming a member.
226
+ * Under a session token minted without `user_id`, such as the one an Embedded Studio's read-only viewer runs on, it is served as it was last published, exactly as a bare publishable key is served it on the Map Studio API, and one never published, taken down, or whose organization's agreement does not include Map Publishing answers NOT_FOUND; the token Mountaya's MCP server holds for its own requests is the one exception, and is served the draft.
227
+ * Another organization's public itinerary ('anyone with the link') is served as it was last published, and one that organization has never published answers NOT_FOUND, as does one whose organization's agreement does not include Map Publishing; another organization's private itinerary is never served.
228
+ * A personal itinerary, made from an individual account and owned by no organization, is readable only when it is public, and then exactly like another organization's public itinerary.
229
+ * An id no itinerary carries and an itinerary you may not read both answer NOT_FOUND, so the answer never confirms that an id exists.
230
+ * An itinerary of more than 500,000 positions, every position of its segments' geometry, the vias of its routed lines included, plus one per waypoint, is more than one answer carries: it is refused with PAYLOAD_TOO_LARGE at ["input"], naming none of its fields, as `exportItinerary` refuses it.
231
+ * The positions are counted over the whole itinerary before anything is loaded, whatever the selection asks for, and the refusal comes after every other, NOT_FOUND included.
232
+ * Within that ceiling, the geometry and the points are decoded only when the selection asks for them, which changes nothing in what is answered.
233
+ * This is the companion to the itineraries target of `search`, which returns references only.
234
+ * Pair it with `terrainProfile` or `analyzeGeometry` to answer questions about the ground a saved route actually covers, sending a segment's LineString positions reduced to [longitude, latitude], as `ItinerarySegment.
235
+ * geometry` describes.
236
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
237
+ */
238
+ export const itinerary = <S extends Selection<typeof itineraryFields> | undefined = undefined>(
239
+ transport: MountayaTransport,
240
+ input: ItineraryInput,
241
+ options?: DataOptions<S>,
242
+ ): Promise<DataResult<ItineraryResult, S>> =>
243
+ runOperation(
244
+ transport,
245
+ "itinerary",
246
+ documentFor(
247
+ "itinerary",
248
+ "ItineraryInput!",
249
+ itineraryFields,
250
+ "query Itinerary($input: ItineraryInput!) {\n itinerary(input: $input) {\n id\n name\n description\n activitySlug\n distance\n ascent\n isPrivate\n organizationId\n segments {\n id\n name\n description\n position\n groupId\n distance\n duration\n ascent\n descent\n altitude {\n max\n min\n }\n gradient {\n max\n min\n }\n geometry\n }\n waypoints {\n id\n name\n description\n position\n point\n amenities\n timing {\n cutoffAt\n stopDuration\n }\n contact {\n website\n phone\n email\n address\n openingHours\n bookingUrl\n }\n media {\n photos {\n url\n caption\n }\n links {\n label\n url\n }\n }\n properties {\n key\n label\n value\n format\n }\n }\n groups {\n id\n name\n color\n speed\n }\n segmentCount\n waypointCount\n groupCount\n }\n}\n",
251
+ options?.select,
252
+ ),
253
+ input,
254
+ options,
255
+ { waypoints: [{ timing: { cutoffAt: true } }] },
256
+ );
257
+
258
+ /**
259
+ * Compute a time-distance matrix between locations for a given activity.
260
+ * Returns duration and/or distance grids between all source-destination pairs.
261
+ * The costs are the routing engine's over its whole network: unlike `directions`, they do not leave out the ways an activity avoids, so a cost may cross a ferry, a ford or steps the activity's own route would not take.
262
+ * Use `directions` for a route exact to the activity.
263
+ * A matrix whose search the routing engine cannot hold at once, many locations over a dense network, is computed one source at a time and answered exactly as the whole matrix, recorded as one request, in a few seconds more (see `locations`).
264
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
265
+ */
266
+ export const matrix = <S extends Selection<typeof matrixFields> | undefined = undefined>(
267
+ transport: MountayaTransport,
268
+ input: MatrixInput,
269
+ options?: DataOptions<S>,
270
+ ): Promise<DataResult<MatrixResult, S>> =>
271
+ runOperation(
272
+ transport,
273
+ "matrix",
274
+ documentFor(
275
+ "matrix",
276
+ "MatrixInput!",
277
+ matrixFields,
278
+ "query Matrix($input: MatrixInput!) {\n matrix(input: $input) {\n durations\n distances\n }\n}\n",
279
+ options?.select,
280
+ ),
281
+ input,
282
+ options,
283
+ );
284
+
285
+ /**
286
+ * List points-of-interest matching one or more categories inside a bounding box or a buffered geometry.
287
+ * Returns POIs ranked by relevance and, when a buffered area is provided, annotated with their distance to the geometry.
288
+ * Neither area is required: with neither, the categories are looked up with no geographic filter.
289
+ * `limit` caps what the geocoder is asked for, and a POI outside the buffered area, or a feature that maps to no POI category, is dropped after that, so fewer than `limit` POIs can come back (see `buffered`).
290
+ * Every parameter the geocoder is asked with is checked or built by this API, so a failure of the geocoder, its refusal of a request included, is INTERNAL_ERROR, never the caller's to fix.
291
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
292
+ */
293
+ export const pois = <S extends Selection<typeof poisFields> | undefined = undefined>(
294
+ transport: MountayaTransport,
295
+ input: PoisInput,
296
+ options?: DataOptions<S>,
297
+ ): Promise<DataResult<PoisResult, S>> =>
298
+ runOperation(
299
+ transport,
300
+ "pois",
301
+ documentFor(
302
+ "pois",
303
+ "PoisInput!",
304
+ poisFields,
305
+ "query Pois($input: PoisInput!) {\n pois(input: $input) {\n count\n pois {\n osm {\n id\n type\n key\n value\n }\n name\n category\n point\n elevation\n tags {\n key\n value\n }\n distanceMeters\n country\n countryName\n region\n city\n }\n }\n}\n",
306
+ options?.select,
307
+ ),
308
+ input,
309
+ options,
310
+ );
311
+
312
+ /**
313
+ * Reverse geocode a [longitude, latitude] point into a list of named places.
314
+ * Returns the place closest to the point, optionally constrained by layer or radius.
315
+ * A failure of the geocoder, its refusal of a lookup included, is INTERNAL_ERROR, never the caller's to fix.
316
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
317
+ */
318
+ export const reverseGeocode = <
319
+ S extends Selection<typeof reverseGeocodeFields> | undefined = undefined,
320
+ >(
321
+ transport: MountayaTransport,
322
+ input: ReverseGeocodeInput,
323
+ options?: DataOptions<S>,
324
+ ): Promise<DataResult<ReverseGeocodeResult, S>> =>
325
+ runOperation(
326
+ transport,
327
+ "reverseGeocode",
328
+ documentFor(
329
+ "reverseGeocode",
330
+ "ReverseGeocodeInput!",
331
+ reverseGeocodeFields,
332
+ "query ReverseGeocode($input: ReverseGeocodeInput!) {\n reverseGeocode(input: $input) {\n point\n places {\n osm {\n id\n type\n key\n value\n }\n name\n label\n layer\n category\n point\n bounds\n country\n countryName\n region\n county\n city\n postcode\n street\n houseNumber\n }\n count\n }\n}\n",
333
+ options?.select,
334
+ ),
335
+ input,
336
+ options,
337
+ );
338
+
339
+ /**
340
+ * Unified full-text search across geocoded places, POIs, ways, and Mountaya entities (itineraries, collections, zones).
341
+ * Each enabled target runs on its own: a failed target leaves its section null and adds an entry to `errors`, and `SearchResult` says how a failure is answered and counted.
342
+ * A malformed `focus` or `bbox` fails the request.
343
+ * A feature found by more than one of places, pois and ways is returned once, in `ways` first, then `pois`.
344
+ * The entity targets list your key's own organization's entities only, never another organization's or a personal one.
345
+ * A session token naming a member lists them public and private, an itinerary or a zone as its draft.
346
+ * A session token minted without `user_id` lists what a bare publishable key lists: public itineraries and zones currently published, each as last published, and public collections.
347
+ * The token Mountaya's MCP server holds lists as a member's does.
348
+ * Requires a publishable key with the DATA scope, or with the MCP scope through Mountaya's MCP server, and a session token.
349
+ */
350
+ export const search = <S extends Selection<typeof searchFields> | undefined = undefined>(
351
+ transport: MountayaTransport,
352
+ input: SearchInput,
353
+ options?: DataOptions<S>,
354
+ ): Promise<DataResult<SearchResult, S>> =>
355
+ runOperation(
356
+ transport,
357
+ "search",
358
+ documentFor(
359
+ "search",
360
+ "SearchInput!",
361
+ searchFields,
362
+ "query Search($input: SearchInput!) {\n search(input: $input) {\n query\n language\n targets {\n places\n pois\n ways\n itineraries\n collections\n zones\n }\n places {\n count\n places {\n osm {\n id\n type\n key\n value\n }\n name\n label\n layer\n category\n point\n bounds\n country\n countryName\n region\n county\n city\n postcode\n street\n houseNumber\n }\n }\n pois {\n count\n pois {\n osm {\n id\n type\n key\n value\n }\n name\n category\n point\n elevation\n tags {\n key\n value\n }\n distanceMeters\n country\n countryName\n region\n city\n }\n }\n ways {\n count\n ways {\n osm {\n id\n type\n key\n value\n }\n name\n highway\n surface\n sacScale\n point\n bounds\n coordinates\n activityCompatible\n country\n countryName\n region\n city\n }\n activityApplied\n }\n itineraries {\n count\n itineraries {\n id\n name\n description\n distance\n ascent\n activitySlug\n start\n bounds\n isPrivate\n organizationId\n score\n matchedField\n }\n }\n collections {\n count\n collections {\n id\n name\n description\n count {\n itineraries\n zones\n }\n bounds\n isPrivate\n organizationId\n score\n matchedField\n }\n }\n zones {\n count\n zones {\n id\n name\n description\n level\n mode\n point\n bounds\n isPrivate\n organizationId\n score\n matchedField\n }\n }\n errors {\n target\n code\n message\n }\n }\n}\n",
363
+ options?.select,
364
+ ),
365
+ input,
366
+ options,
367
+ );
368
+
369
+ /**
370
+ * Generate route suggestions matching distance constraints for a given activity.
371
+ * Returns multiple route candidates with elevation data, allowing the client to select based on elevation gain, distance, or shape preference.
372
+ * Suggested routes NEVER cross a tollway or an access-restricted way.
373
+ * There is no opt-out: proposing somewhere to go is a different act from a user deliberately routing across such a way, which `directions` still allows.
374
+ * Every candidate's `analysis.
375
+ * advisories` therefore reports no hazard.
376
+ * A request no candidate survives fails as `start` states, and `routes` says when fewer come back than were asked for.
377
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
378
+ */
379
+ export const suggestions = <S extends Selection<typeof suggestionsFields> | undefined = undefined>(
380
+ transport: MountayaTransport,
381
+ input: SuggestionsInput,
382
+ options?: DataOptions<S>,
383
+ ): Promise<DataResult<SuggestionsResult, S>> =>
384
+ runOperation(
385
+ transport,
386
+ "suggestions",
387
+ documentFor(
388
+ "suggestions",
389
+ "SuggestionsInput!",
390
+ suggestionsFields,
391
+ "query Suggestions($input: SuggestionsInput!) {\n suggestions(input: $input) {\n routes {\n distance\n duration\n elevation {\n altitude {\n max\n min\n }\n ascent\n descent\n gradient {\n max\n min\n }\n }\n geometry\n analysis {\n elevation {\n altitude {\n max\n min\n }\n ascent\n descent\n gradient {\n max\n min\n }\n }\n elevations\n slopeInfo {\n fromIndex\n toIndex\n value\n }\n speedInfo {\n fromIndex\n toIndex\n value\n }\n surfaceInfo {\n fromIndex\n toIndex\n value\n }\n trailDifficultyInfo {\n fromIndex\n toIndex\n value\n }\n wayTypeInfo {\n fromIndex\n toIndex\n value\n }\n advisories {\n tollway\n restrictedAccess\n tollwayInfo {\n fromIndex\n toIndex\n value\n }\n roadAccessInfo {\n fromIndex\n toIndex\n values\n }\n }\n }\n summary\n steps {\n fromIndex\n toIndex\n type\n name\n distance\n duration\n exitNumber\n }\n seed\n }\n }\n}\n",
392
+ options?.select,
393
+ ),
394
+ input,
395
+ options,
396
+ );
397
+
398
+ /**
399
+ * Sample the surface over a rectangular grid inside a bounding box, for area reconnaissance: finding high ground, a steep band, or a slope facing a given direction before routing through it.
400
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
401
+ */
402
+ export const terrainGrid = <S extends Selection<typeof terrainGridFields> | undefined = undefined>(
403
+ transport: MountayaTransport,
404
+ input: TerrainGridInput,
405
+ options?: DataOptions<S>,
406
+ ): Promise<DataResult<TerrainGridResult, S>> =>
407
+ runOperation(
408
+ transport,
409
+ "terrainGrid",
410
+ documentFor(
411
+ "terrainGrid",
412
+ "TerrainGridInput!",
413
+ terrainGridFields,
414
+ "query TerrainGrid($input: TerrainGridInput!) {\n terrainGrid(input: $input) {\n count\n coveredCount\n zoom\n resolutionMeters\n cols\n rows\n cells {\n point\n elevation\n slope\n aspect\n aspectOctant\n steepnessBand\n distanceMeters\n }\n }\n}\n",
415
+ options?.select,
416
+ ),
417
+ input,
418
+ options,
419
+ );
420
+
421
+ /**
422
+ * Sample the surface along a geometry at a fixed interval, producing an elevation profile as data.
423
+ * Use it to answer how steep a route is and where the hard sections sit.
424
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
425
+ */
426
+ export const terrainProfile = <
427
+ S extends Selection<typeof terrainProfileFields> | undefined = undefined,
428
+ >(
429
+ transport: MountayaTransport,
430
+ input: TerrainProfileInput,
431
+ options?: DataOptions<S>,
432
+ ): Promise<DataResult<TerrainProfileResult, S>> =>
433
+ runOperation(
434
+ transport,
435
+ "terrainProfile",
436
+ documentFor(
437
+ "terrainProfile",
438
+ "TerrainProfileInput!",
439
+ terrainProfileFields,
440
+ "query TerrainProfile($input: TerrainProfileInput!) {\n terrainProfile(input: $input) {\n count\n coveredCount\n zoom\n resolutionMeters\n samples {\n point\n elevation\n slope\n aspect\n aspectOctant\n steepnessBand\n distanceMeters\n }\n }\n}\n",
441
+ options?.select,
442
+ ),
443
+ input,
444
+ options,
445
+ );
446
+
447
+ /**
448
+ * Sample elevation, slope, and aspect at standalone [longitude, latitude] points.
449
+ * Use it for readings at known coordinates; for an existing line use terrainProfile, and to search an area for features you have not located use terrainGrid.
450
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
451
+ */
452
+ export const terrainSamples = <
453
+ S extends Selection<typeof terrainSamplesFields> | undefined = undefined,
454
+ >(
455
+ transport: MountayaTransport,
456
+ input: TerrainSamplesInput,
457
+ options?: DataOptions<S>,
458
+ ): Promise<DataResult<TerrainSamplesResult, S>> =>
459
+ runOperation(
460
+ transport,
461
+ "terrainSamples",
462
+ documentFor(
463
+ "terrainSamples",
464
+ "TerrainSamplesInput!",
465
+ terrainSamplesFields,
466
+ "query TerrainSamples($input: TerrainSamplesInput!) {\n terrainSamples(input: $input) {\n count\n coveredCount\n zoom\n resolutionMeters\n samples {\n point\n elevation\n slope\n aspect\n aspectOctant\n steepnessBand\n distanceMeters\n }\n }\n}\n",
467
+ options?.select,
468
+ ),
469
+ input,
470
+ options,
471
+ );
472
+
473
+ /**
474
+ * bind returns every Data API operation with the transport applied.
475
+ */
476
+ export const bind = (transport: MountayaTransport) => ({
477
+ /**
478
+ * Analyze surface and way type of an existing geometry.
479
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
480
+ * @see {@link analyzeGeometry}
481
+ */
482
+ analyzeGeometry: <S extends Selection<typeof analyzeGeometryFields> | undefined = undefined>(
483
+ input: AnalyzeGeometryInput,
484
+ options?: DataOptions<S>,
485
+ ) => analyzeGeometry(transport, input, options),
486
+ /**
487
+ * Compute directions between waypoints for a given activity.
488
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
489
+ * @see {@link directions}
490
+ */
491
+ directions: <S extends Selection<typeof directionsFields> | undefined = undefined>(
492
+ input: DirectionsInput,
493
+ options?: DataOptions<S>,
494
+ ) => directions(transport, input, options),
495
+ /**
496
+ * Prepare a download of an itinerary in a route file format.
497
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
498
+ * @see {@link exportItinerary}
499
+ */
500
+ exportItinerary: <S extends Selection<typeof exportItineraryFields> | undefined = undefined>(
501
+ input: ExportItineraryInput,
502
+ options?: DataOptions<S>,
503
+ ) => exportItinerary(transport, input, options),
504
+ /**
505
+ * Forward geocode a free-text query into a list of named places.
506
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
507
+ * @see {@link geocode}
508
+ */
509
+ geocode: <S extends Selection<typeof geocodeFields> | undefined = undefined>(
510
+ input: GeocodeInput,
511
+ options?: DataOptions<S>,
512
+ ) => geocode(transport, input, options),
513
+ /**
514
+ * Compute isochrones (reachability polygons) from one or more locations for a given activity.
515
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
516
+ * @see {@link isochrones}
517
+ */
518
+ isochrones: <S extends Selection<typeof isochronesFields> | undefined = undefined>(
519
+ input: IsochronesInput,
520
+ options?: DataOptions<S>,
521
+ ) => isochrones(transport, input, options),
522
+ /**
523
+ * Read a single itinerary by identifier, with its ordered segments and waypoints.
524
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
525
+ * @see {@link itinerary}
526
+ */
527
+ itinerary: <S extends Selection<typeof itineraryFields> | undefined = undefined>(
528
+ input: ItineraryInput,
529
+ options?: DataOptions<S>,
530
+ ) => itinerary(transport, input, options),
531
+ /**
532
+ * Compute a time-distance matrix between locations for a given activity.
533
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
534
+ * @see {@link matrix}
535
+ */
536
+ matrix: <S extends Selection<typeof matrixFields> | undefined = undefined>(
537
+ input: MatrixInput,
538
+ options?: DataOptions<S>,
539
+ ) => matrix(transport, input, options),
540
+ /**
541
+ * List points-of-interest matching one or more categories inside a bounding box or a buffered geometry.
542
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
543
+ * @see {@link pois}
544
+ */
545
+ pois: <S extends Selection<typeof poisFields> | undefined = undefined>(
546
+ input: PoisInput,
547
+ options?: DataOptions<S>,
548
+ ) => pois(transport, input, options),
549
+ /**
550
+ * Reverse geocode a [longitude, latitude] point into a list of named places.
551
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
552
+ * @see {@link reverseGeocode}
553
+ */
554
+ reverseGeocode: <S extends Selection<typeof reverseGeocodeFields> | undefined = undefined>(
555
+ input: ReverseGeocodeInput,
556
+ options?: DataOptions<S>,
557
+ ) => reverseGeocode(transport, input, options),
558
+ /**
559
+ * Unified full-text search across geocoded places, POIs, ways, and Mountaya entities (itineraries, collections, zones).
560
+ * Requires a publishable key with the DATA scope, or with the MCP scope through Mountaya's MCP server, and a session token.
561
+ * @see {@link search}
562
+ */
563
+ search: <S extends Selection<typeof searchFields> | undefined = undefined>(
564
+ input: SearchInput,
565
+ options?: DataOptions<S>,
566
+ ) => search(transport, input, options),
567
+ /**
568
+ * Generate route suggestions matching distance constraints for a given activity.
569
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
570
+ * @see {@link suggestions}
571
+ */
572
+ suggestions: <S extends Selection<typeof suggestionsFields> | undefined = undefined>(
573
+ input: SuggestionsInput,
574
+ options?: DataOptions<S>,
575
+ ) => suggestions(transport, input, options),
576
+ /**
577
+ * Sample the surface over a rectangular grid inside a bounding box, for area reconnaissance: finding high ground, a steep band, or a slope facing a given direction before routing through it.
578
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
579
+ * @see {@link terrainGrid}
580
+ */
581
+ terrainGrid: <S extends Selection<typeof terrainGridFields> | undefined = undefined>(
582
+ input: TerrainGridInput,
583
+ options?: DataOptions<S>,
584
+ ) => terrainGrid(transport, input, options),
585
+ /**
586
+ * Sample the surface along a geometry at a fixed interval, producing an elevation profile as data.
587
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
588
+ * @see {@link terrainProfile}
589
+ */
590
+ terrainProfile: <S extends Selection<typeof terrainProfileFields> | undefined = undefined>(
591
+ input: TerrainProfileInput,
592
+ options?: DataOptions<S>,
593
+ ) => terrainProfile(transport, input, options),
594
+ /**
595
+ * Sample elevation, slope, and aspect at standalone [longitude, latitude] points.
596
+ * Requires a publishable key with the DATA scope, or with the MCP scope when the call arrives through Mountaya's MCP server, and a session token.
597
+ * @see {@link terrainSamples}
598
+ */
599
+ terrainSamples: <S extends Selection<typeof terrainSamplesFields> | undefined = undefined>(
600
+ input: TerrainSamplesInput,
601
+ options?: DataOptions<S>,
602
+ ) => terrainSamples(transport, input, options),
603
+ });