@sierragridteam/sdk 0.0.0-stage → 0.1.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.
Files changed (42) hide show
  1. package/README.md +49 -2
  2. package/dist/fixtures-data.d.ts +609 -0
  3. package/dist/fixtures-data.js +2676 -0
  4. package/dist/fixtures.d.ts +12 -0
  5. package/dist/fixtures.js +139 -0
  6. package/dist/generated/client/client.gen.d.ts +2 -0
  7. package/dist/generated/client/client.gen.js +216 -0
  8. package/dist/generated/client/index.d.ts +10 -0
  9. package/dist/generated/client/index.js +6 -0
  10. package/dist/generated/client/types.gen.d.ts +120 -0
  11. package/dist/generated/client/types.gen.js +2 -0
  12. package/dist/generated/client/utils.gen.d.ts +37 -0
  13. package/dist/generated/client/utils.gen.js +228 -0
  14. package/dist/generated/client.gen.d.ts +12 -0
  15. package/dist/generated/client.gen.js +3 -0
  16. package/dist/generated/core/auth.gen.d.ts +25 -0
  17. package/dist/generated/core/auth.gen.js +14 -0
  18. package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
  19. package/dist/generated/core/bodySerializer.gen.js +57 -0
  20. package/dist/generated/core/params.gen.d.ts +43 -0
  21. package/dist/generated/core/params.gen.js +109 -0
  22. package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
  23. package/dist/generated/core/pathSerializer.gen.js +106 -0
  24. package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
  25. package/dist/generated/core/queryKeySerializer.gen.js +92 -0
  26. package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
  27. package/dist/generated/core/serverSentEvents.gen.js +132 -0
  28. package/dist/generated/core/types.gen.d.ts +83 -0
  29. package/dist/generated/core/types.gen.js +2 -0
  30. package/dist/generated/core/utils.gen.d.ts +19 -0
  31. package/dist/generated/core/utils.gen.js +87 -0
  32. package/dist/generated/index.d.ts +2 -0
  33. package/dist/generated/index.js +2 -0
  34. package/dist/generated/sdk.gen.d.ts +210 -0
  35. package/dist/generated/sdk.gen.js +336 -0
  36. package/dist/generated/types.gen.d.ts +3474 -0
  37. package/dist/generated/types.gen.js +2 -0
  38. package/dist/generated/zod.gen.d.ts +6537 -0
  39. package/dist/generated/zod.gen.js +1849 -0
  40. package/dist/index.d.ts +1287 -0
  41. package/dist/index.js +99 -0
  42. package/package.json +42 -4
@@ -0,0 +1,210 @@
1
+ import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client/index.js';
2
+ import type { GetMapLayerData, GetMapLayerErrors, GetMapLayerResponses, GridServiceGetConditionsData, GridServiceGetConditionsErrors, GridServiceGetConditionsResponses, GridServiceGetEventData, GridServiceGetEventErrors, GridServiceGetEventHistoryData, GridServiceGetEventHistoryErrors, GridServiceGetEventHistoryResponses, GridServiceGetEventResponses, GridServiceGetMeshTelemetryData, GridServiceGetMeshTelemetryErrors, GridServiceGetMeshTelemetryResponses, GridServiceGetPlaceData, GridServiceGetPlaceErrors, GridServiceGetPlaceResponses, GridServiceGetPlaceSummaryData, GridServiceGetPlaceSummaryErrors, GridServiceGetPlaceSummaryResponses, GridServiceListCamerasData, GridServiceListCamerasErrors, GridServiceListCamerasResponses, GridServiceListEventsData, GridServiceListEventsErrors, GridServiceListEventsResponses, GridServiceListHistoryData, GridServiceListHistoryErrors, GridServiceListHistoryResponses, GridServiceListPlacesData, GridServiceListPlacesErrors, GridServiceListPlacesResponses, GridServiceListScannersData, GridServiceListScannersErrors, GridServiceListScannersResponses, GridServiceListSourcesData, GridServiceListSourcesErrors, GridServiceListSourcesResponses, GridServiceResolvePlaceData, GridServiceResolvePlaceErrors, GridServiceResolvePlaceResponses, ListMeshLinksData, ListMeshLinksErrors, ListMeshLinksResponses } from './types.gen.js';
3
+ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
4
+ /**
5
+ * You can provide a client instance returned by `createClient()` instead of
6
+ * individual options. This might be also useful if you want to implement a
7
+ * custom client.
8
+ */
9
+ client?: Client;
10
+ /**
11
+ * You can pass arbitrary values through the `meta` object. This can be
12
+ * used to access values that aren't defined as part of the SDK function.
13
+ */
14
+ meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
15
+ };
16
+ /**
17
+ * List Caltrans traffic cameras.
18
+ *
19
+ * In-service Caltrans CCTV cameras within 25 km of a coverage area, each with
20
+ * a snapshot image URL and, where Caltrans publishes one, an HLS stream URL.
21
+ * Links only: images and streams are served by Caltrans, never proxied. With
22
+ * `place`, only cameras within 25 km of that place, nearest first. Cameras are
23
+ * reference views, not events: nothing here is a hazard, and an empty list
24
+ * means no camera nearby. Refreshed every 6 hours; check `sourceStatus`.
25
+ * Supports ETag / If-None-Match.
26
+ */
27
+ export declare const gridServiceListCameras: <ThrowOnError extends boolean = false>(options?: Options<GridServiceListCamerasData, ThrowOnError>) => RequestResult<GridServiceListCamerasResponses, GridServiceListCamerasErrors, ThrowOnError>;
28
+ /**
29
+ * Get current weather, forecasts and fire weather.
30
+ *
31
+ * Current conditions per weather location (OpenWeatherMap, refreshed every 15
32
+ * minutes), a 48-hour NWS forecast per location, and the region's fire-weather
33
+ * state. With `place`, only the weather locations inside the place's bounding
34
+ * box (and their forecasts); `fireWeather` is region-wide either way. Weather
35
+ * ALERTS are events (`/api/v1/events?layer=WEATHER_ALERT`); road conditions
36
+ * are the `road_segment` and `chain_control` map layers.
37
+ */
38
+ export declare const gridServiceGetConditions: <ThrowOnError extends boolean = false>(options?: Options<GridServiceGetConditionsData, ThrowOnError>) => RequestResult<GridServiceGetConditionsResponses, GridServiceGetConditionsErrors, ThrowOnError>;
39
+ /**
40
+ * Query events across layers.
41
+ *
42
+ * The main event feed, from the grid event store. Defaults: status ACTIVE and
43
+ * SCHEDULED, every layer, every place, every severity, up to 50 per page.
44
+ *
45
+ * An unscoped query is dominated by MESH nodes (hundreds of INFO community
46
+ * radio nodes, many outside every place) and SCHEDULED Caltrans roadwork. For
47
+ * a hazard feed pass `place` and `status=ACTIVE`, and either
48
+ * `severityMin=MINOR` or an explicit `layer` list. Use
49
+ * `layer=ROAD_INCIDENT&place={corridor}` for a highway's incidents and
50
+ * `layer=WEATHER_ALERT` for NWS alerts. Sorted by severity, then most recently
51
+ * observed. A page holds at most `pageSize` events and stops early at about
52
+ * 3 MiB encoded, so follow `nextPageToken` until it is empty. Supports
53
+ * ETag / If-None-Match.
54
+ */
55
+ export declare const gridServiceListEvents: <ThrowOnError extends boolean = false>(options?: Options<GridServiceListEventsData, ThrowOnError>) => RequestResult<GridServiceListEventsResponses, GridServiceListEventsErrors, ThrowOnError>;
56
+ /**
57
+ * Get one event.
58
+ *
59
+ * The current revision of one event, any status. Ids contain colons
60
+ * (`chp:261106ST0341`); URL-encode them if your client requires it. Ids that
61
+ * appear in the summary's domain headlines with `kind: CONDITION`
62
+ * (`road:...`, `cc:...`, `fw:...`) are map features, not events, and return
63
+ * 404 here. Supports ETag / If-None-Match.
64
+ */
65
+ export declare const gridServiceGetEvent: <ThrowOnError extends boolean = false>(options: Options<GridServiceGetEventData, ThrowOnError>) => RequestResult<GridServiceGetEventResponses, GridServiceGetEventErrors, ThrowOnError>;
66
+ /**
67
+ * List one event's revisions.
68
+ *
69
+ * Every stored revision of one event, newest first, each a full snapshot. A
70
+ * status change (for example ACTIVE to RESOLVED) is a revision, so the last
71
+ * entries show when it ended. Up to 50 per page by default, up to 200; a
72
+ * page also stops early at about 3 MiB encoded (a perimeter that grew over
73
+ * many revisions), so follow `nextPageToken` until it is empty. Supports
74
+ * ETag / If-None-Match.
75
+ */
76
+ export declare const gridServiceGetEventHistory: <ThrowOnError extends boolean = false>(options: Options<GridServiceGetEventHistoryData, ThrowOnError>) => RequestResult<GridServiceGetEventHistoryResponses, GridServiceGetEventHistoryErrors, ThrowOnError>;
77
+ /**
78
+ * Query revisions across events (the archive).
79
+ *
80
+ * Revisions of all events, optionally filtered by place and layer, over a
81
+ * half-open `[from, to)` window on each revision's `observedAt`. With no
82
+ * window it covers all history. Ordered newest first. Place and layer
83
+ * filters use each event's CURRENT place attachments and layer. Use it for
84
+ * "what happened here last week". A page holds at most `pageSize` revisions
85
+ * and stops early at about 3 MiB encoded, so follow `nextPageToken` until it
86
+ * is empty. Supports ETag / If-None-Match.
87
+ */
88
+ export declare const gridServiceListHistory: <ThrowOnError extends boolean = false>(options?: Options<GridServiceListHistoryData, ThrowOnError>) => RequestResult<GridServiceListHistoryResponses, GridServiceListHistoryErrors, ThrowOnError>;
89
+ /**
90
+ * The MeshCore relay topology, as an edge list
91
+ *
92
+ * Every undirected relay link observed within `window`, mesh-wide (not
93
+ * place-scoped: a mesh spans places). Nodes are identified by public key;
94
+ * to draw a link, join `a` and `b` to `properties.mesh.publicKey` on the
95
+ * `mesh_node` map layer (or `mesh.publicKey` on `layer=MESH` events) for
96
+ * coordinates. For a place-scoped, ready-to-draw version use the
97
+ * `mesh_link` map layer. Weight edges by `daysActive`, fade by `lastSeen`.
98
+ *
99
+ * `Cache-Control: public, max-age=60` and a weak `ETag` (`W/"…"`) that
100
+ * excludes `generatedAt`: `If-None-Match` revalidates to `304` until the
101
+ * links change.
102
+ *
103
+ */
104
+ export declare const listMeshLinks: <ThrowOnError extends boolean = false>(options?: Options<ListMeshLinksData, ThrowOnError>) => RequestResult<ListMeshLinksResponses, ListMeshLinksErrors, ThrowOnError>;
105
+ /**
106
+ * Get one mesh node's telemetry series.
107
+ *
108
+ * Every archived operator-monitor reading for one MeshCore node over a
109
+ * window, oldest first: the data behind a battery, temperature or airtime
110
+ * chart. The event carries only the latest reading
111
+ * (`mesh.telemetry.admin`). Only nodes an operator monitors have samples.
112
+ * The default window is the 24 hours before `to` (default now); windows over
113
+ * 400 days are clamped. At most 20,000 samples are returned (`truncated`
114
+ * says so).
115
+ */
116
+ export declare const gridServiceGetMeshTelemetry: <ThrowOnError extends boolean = false>(options: Options<GridServiceGetMeshTelemetryData, ThrowOnError>) => RequestResult<GridServiceGetMeshTelemetryResponses, GridServiceGetMeshTelemetryErrors, ThrowOnError>;
117
+ /**
118
+ * List places.
119
+ *
120
+ * The place directory, with geometry: coverage areas, counties, towns and
121
+ * highway corridors (about 20 today). Filter by `kind` and a case-insensitive
122
+ * name substring `q`. Not paginated. Supports ETag / If-None-Match.
123
+ */
124
+ export declare const gridServiceListPlaces: <ThrowOnError extends boolean = false>(options?: Options<GridServiceListPlacesData, ThrowOnError>) => RequestResult<GridServiceListPlacesResponses, GridServiceListPlacesErrors, ThrowOnError>;
125
+ /**
126
+ * Get one place.
127
+ *
128
+ * One place by slug (`arnold`) or namespaced id (`town:arnold`), with its
129
+ * geometry. Supports ETag / If-None-Match.
130
+ */
131
+ export declare const gridServiceGetPlace: <ThrowOnError extends boolean = false>(options: Options<GridServiceGetPlaceData, ThrowOnError>) => RequestResult<GridServiceGetPlaceResponses, GridServiceGetPlaceErrors, ThrowOnError>;
132
+ /**
133
+ * One map layer for a place, as GeoJSON
134
+ *
135
+ * An RFC 7946 FeatureCollection of one layer's features within a place.
136
+ * Coordinates are `[longitude, latitude]`. Check `metadata.sourceStatus`
137
+ * before drawing: UNAVAILABLE means unknown (empty `features`), STALE
138
+ * means last-good data.
139
+ *
140
+ * | layer | features | backed by |
141
+ * |---|---|---|
142
+ * | `road_incident` | Points: CHP incidents (category `incident`) and Caltrans planned lane closures (`closure`, SCHEDULED until set up) | events |
143
+ * | `chain_control` | Points: active R1/R2/R3 checkpoints and seasonal pass closures | live Caltrans |
144
+ * | `road_segment` | LineStrings: configured routes with travel time; `status` OPEN/CLOSED/RESTRICTED/MAINTENANCE | live Google Routes + Caltrans |
145
+ * | `message_sign` | Points: Caltrans message signs and their text; always INFO | live Caltrans |
146
+ * | `weather_alert` | null geometry: NWS zone watches/warnings/advisories | events |
147
+ * | `fire_weather` | one null-geometry region banner (`fw:region`) plus forecast Points | live NWS |
148
+ * | `earthquake` | Points | events (USGS) |
149
+ * | `wildfire` | Points or (Multi)Polygon perimeters | events (CAL FIRE, FIRIS) |
150
+ * | `evacuation` | (Multi)Polygon zones; `status` is the level | events (Cal OES) |
151
+ * | `power` | Polygons/Points: PG&E outages (`unplanned`/`planned`) and PSPS (`psps`) | events |
152
+ * | `mesh_node` | Points: MeshCore nodes in the place; always INFO | events |
153
+ * | `mesh_link` | LineString relay links touching the place plus the MESH_NODE Points at both ends (neighbours outside the place have `mesh.inRegion: false`); honours `window` | derived |
154
+ * | `camera` | Points: Caltrans CCTV cameras near the place, nearest first; always INFO | live Caltrans |
155
+ *
156
+ * Event-backed layers carry only ACTIVE and SCHEDULED features, and each
157
+ * feature `id` is an event id usable with `/api/v1/events/{id}`. The
158
+ * `.geojson` suffix is optional (`/map/wildfire` is the same resource).
159
+ *
160
+ * **Caching.** `Cache-Control: public, max-age=60` and a weak `ETag`
161
+ * (`W/"…"`) over the layer's content, excluding `metadata.generatedAt`.
162
+ * Revalidate with `If-None-Match`: the answer is `304` until the
163
+ * features, `sourceStatus`, `lastSourceUpdate` or `attribution` change,
164
+ * so polling a quiet layer costs no body.
165
+ *
166
+ */
167
+ export declare const getMapLayer: <ThrowOnError extends boolean = false>(options: Options<GetMapLayerData, ThrowOnError>) => RequestResult<GetMapLayerResponses, GetMapLayerErrors, ThrowOnError>;
168
+ /**
169
+ * Summarize a place in one call.
170
+ *
171
+ * The dashboard headline: `mode` (QUIET, WATCH, ACTIVE), a cross-layer hazard
172
+ * rollup (`summary`), one block per domain (`domains`), and a source-health
173
+ * sidecar (`sources`). Built from the place's ACTIVE and SCHEDULED events
174
+ * plus the live condition layers (road segments, chain control, fire
175
+ * weather).
176
+ *
177
+ * Ambient state is kept out of the hazard rollup (`totalActive`,
178
+ * `severityCounts`, `topEvents`, `mode`): MESH nodes, BURN_STATUS, INFO-level
179
+ * POWER outages, and SCHEDULED road closures. MESH and BURN_STATUS appear only
180
+ * in their own `comms` and `burn` domains. The `evacuation` invariant: see
181
+ * `summary.activeEvacuations`. Computed fresh on each call; no ETag.
182
+ */
183
+ export declare const gridServiceGetPlaceSummary: <ThrowOnError extends boolean = false>(options: Options<GridServiceGetPlaceSummaryData, ThrowOnError>) => RequestResult<GridServiceGetPlaceSummaryResponses, GridServiceGetPlaceSummaryErrors, ThrowOnError>;
184
+ /**
185
+ * Resolve a point or an address to places.
186
+ *
187
+ * Returns every place containing the point, most specific first (SITE,
188
+ * EVAC_ZONE, TOWN, CORRIDOR, COUNTY, AREA). A town matches within 3 km of its
189
+ * point (nearest town first); a corridor within about 1.5 km of its line. Give
190
+ * `lat` and `lng`, or `address` (geocoded with the US Census geocoder), not
191
+ * both. An empty `places` list means the point is outside the covered region.
192
+ */
193
+ export declare const gridServiceResolvePlace: <ThrowOnError extends boolean = false>(options?: Options<GridServiceResolvePlaceData, ThrowOnError>) => RequestResult<GridServiceResolvePlaceResponses, GridServiceResolvePlaceErrors, ThrowOnError>;
194
+ /**
195
+ * List police, fire and CHP scanner feeds.
196
+ *
197
+ * Broadcastify audio feeds that cover the region. With `place` naming an AREA,
198
+ * that area's feeds; with any other place, or none, every configured feed,
199
+ * deduplicated. Links only; audio is served by Broadcastify.
200
+ */
201
+ export declare const gridServiceListScanners: <ThrowOnError extends boolean = false>(options?: Options<GridServiceListScannersData, ThrowOnError>) => RequestResult<GridServiceListScannersResponses, GridServiceListScannersErrors, ThrowOnError>;
202
+ /**
203
+ * List sources and their health.
204
+ *
205
+ * The upstream source registry with per-source health (OK, STALE,
206
+ * UNAVAILABLE), last success, last attempt and last error. This is how a
207
+ * client decides how far to trust each layer. It also lists one health-only
208
+ * row per operator push reporter.
209
+ */
210
+ export declare const gridServiceListSources: <ThrowOnError extends boolean = false>(options?: Options<GridServiceListSourcesData, ThrowOnError>) => RequestResult<GridServiceListSourcesResponses, GridServiceListSourcesErrors, ThrowOnError>;
@@ -0,0 +1,336 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ import * as z from 'zod';
3
+ import { client } from './client.gen.js';
4
+ import { zGetMapLayerHeaders, zGetMapLayerPath, zGetMapLayerQuery, zGetMapLayerResponse, zGridServiceGetConditionsQuery, zGridServiceGetConditionsResponse, zGridServiceGetEventHistoryPath, zGridServiceGetEventHistoryQuery, zGridServiceGetEventHistoryResponse, zGridServiceGetEventPath, zGridServiceGetEventQuery, zGridServiceGetEventResponse, zGridServiceGetMeshTelemetryQuery, zGridServiceGetMeshTelemetryResponse, zGridServiceGetPlacePath, zGridServiceGetPlaceQuery, zGridServiceGetPlaceResponse, zGridServiceGetPlaceSummaryPath, zGridServiceGetPlaceSummaryResponse, zGridServiceListCamerasQuery, zGridServiceListCamerasResponse, zGridServiceListEventsQuery, zGridServiceListEventsResponse, zGridServiceListHistoryQuery, zGridServiceListHistoryResponse, zGridServiceListPlacesQuery, zGridServiceListPlacesResponse, zGridServiceListScannersQuery, zGridServiceListScannersResponse, zGridServiceListSourcesResponse, zGridServiceResolvePlaceQuery, zGridServiceResolvePlaceResponse, zListMeshLinksHeaders, zListMeshLinksQuery, zListMeshLinksResponse } from './zod.gen.js';
5
+ /**
6
+ * List Caltrans traffic cameras.
7
+ *
8
+ * In-service Caltrans CCTV cameras within 25 km of a coverage area, each with
9
+ * a snapshot image URL and, where Caltrans publishes one, an HLS stream URL.
10
+ * Links only: images and streams are served by Caltrans, never proxied. With
11
+ * `place`, only cameras within 25 km of that place, nearest first. Cameras are
12
+ * reference views, not events: nothing here is a hazard, and an empty list
13
+ * means no camera nearby. Refreshed every 6 hours; check `sourceStatus`.
14
+ * Supports ETag / If-None-Match.
15
+ */
16
+ export const gridServiceListCameras = (options) => (options?.client ?? client).get({
17
+ requestValidator: async (data) => await z.object({
18
+ body: z.never().optional(),
19
+ path: z.never().optional(),
20
+ query: zGridServiceListCamerasQuery.optional()
21
+ }).parseAsync(data),
22
+ responseValidator: async (data) => await zGridServiceListCamerasResponse.parseAsync(data),
23
+ url: '/api/v1/cameras',
24
+ ...options
25
+ });
26
+ /**
27
+ * Get current weather, forecasts and fire weather.
28
+ *
29
+ * Current conditions per weather location (OpenWeatherMap, refreshed every 15
30
+ * minutes), a 48-hour NWS forecast per location, and the region's fire-weather
31
+ * state. With `place`, only the weather locations inside the place's bounding
32
+ * box (and their forecasts); `fireWeather` is region-wide either way. Weather
33
+ * ALERTS are events (`/api/v1/events?layer=WEATHER_ALERT`); road conditions
34
+ * are the `road_segment` and `chain_control` map layers.
35
+ */
36
+ export const gridServiceGetConditions = (options) => (options?.client ?? client).get({
37
+ requestValidator: async (data) => await z.object({
38
+ body: z.never().optional(),
39
+ path: z.never().optional(),
40
+ query: zGridServiceGetConditionsQuery.optional()
41
+ }).parseAsync(data),
42
+ responseValidator: async (data) => await zGridServiceGetConditionsResponse.parseAsync(data),
43
+ url: '/api/v1/conditions',
44
+ ...options
45
+ });
46
+ /**
47
+ * Query events across layers.
48
+ *
49
+ * The main event feed, from the grid event store. Defaults: status ACTIVE and
50
+ * SCHEDULED, every layer, every place, every severity, up to 50 per page.
51
+ *
52
+ * An unscoped query is dominated by MESH nodes (hundreds of INFO community
53
+ * radio nodes, many outside every place) and SCHEDULED Caltrans roadwork. For
54
+ * a hazard feed pass `place` and `status=ACTIVE`, and either
55
+ * `severityMin=MINOR` or an explicit `layer` list. Use
56
+ * `layer=ROAD_INCIDENT&place={corridor}` for a highway's incidents and
57
+ * `layer=WEATHER_ALERT` for NWS alerts. Sorted by severity, then most recently
58
+ * observed. A page holds at most `pageSize` events and stops early at about
59
+ * 3 MiB encoded, so follow `nextPageToken` until it is empty. Supports
60
+ * ETag / If-None-Match.
61
+ */
62
+ export const gridServiceListEvents = (options) => (options?.client ?? client).get({
63
+ requestValidator: async (data) => await z.object({
64
+ body: z.never().optional(),
65
+ path: z.never().optional(),
66
+ query: zGridServiceListEventsQuery.optional()
67
+ }).parseAsync(data),
68
+ responseValidator: async (data) => await zGridServiceListEventsResponse.parseAsync(data),
69
+ url: '/api/v1/events',
70
+ ...options
71
+ });
72
+ /**
73
+ * Get one event.
74
+ *
75
+ * The current revision of one event, any status. Ids contain colons
76
+ * (`chp:261106ST0341`); URL-encode them if your client requires it. Ids that
77
+ * appear in the summary's domain headlines with `kind: CONDITION`
78
+ * (`road:...`, `cc:...`, `fw:...`) are map features, not events, and return
79
+ * 404 here. Supports ETag / If-None-Match.
80
+ */
81
+ export const gridServiceGetEvent = (options) => (options.client ?? client).get({
82
+ requestValidator: async (data) => await z.object({
83
+ body: z.never().optional(),
84
+ path: zGridServiceGetEventPath,
85
+ query: zGridServiceGetEventQuery.optional()
86
+ }).parseAsync(data),
87
+ responseValidator: async (data) => await zGridServiceGetEventResponse.parseAsync(data),
88
+ url: '/api/v1/events/{id}',
89
+ ...options
90
+ });
91
+ /**
92
+ * List one event's revisions.
93
+ *
94
+ * Every stored revision of one event, newest first, each a full snapshot. A
95
+ * status change (for example ACTIVE to RESOLVED) is a revision, so the last
96
+ * entries show when it ended. Up to 50 per page by default, up to 200; a
97
+ * page also stops early at about 3 MiB encoded (a perimeter that grew over
98
+ * many revisions), so follow `nextPageToken` until it is empty. Supports
99
+ * ETag / If-None-Match.
100
+ */
101
+ export const gridServiceGetEventHistory = (options) => (options.client ?? client).get({
102
+ requestValidator: async (data) => await z.object({
103
+ body: z.never().optional(),
104
+ path: zGridServiceGetEventHistoryPath,
105
+ query: zGridServiceGetEventHistoryQuery.optional()
106
+ }).parseAsync(data),
107
+ responseValidator: async (data) => await zGridServiceGetEventHistoryResponse.parseAsync(data),
108
+ url: '/api/v1/events/{id}/history',
109
+ ...options
110
+ });
111
+ /**
112
+ * Query revisions across events (the archive).
113
+ *
114
+ * Revisions of all events, optionally filtered by place and layer, over a
115
+ * half-open `[from, to)` window on each revision's `observedAt`. With no
116
+ * window it covers all history. Ordered newest first. Place and layer
117
+ * filters use each event's CURRENT place attachments and layer. Use it for
118
+ * "what happened here last week". A page holds at most `pageSize` revisions
119
+ * and stops early at about 3 MiB encoded, so follow `nextPageToken` until it
120
+ * is empty. Supports ETag / If-None-Match.
121
+ */
122
+ export const gridServiceListHistory = (options) => (options?.client ?? client).get({
123
+ requestValidator: async (data) => await z.object({
124
+ body: z.never().optional(),
125
+ path: z.never().optional(),
126
+ query: zGridServiceListHistoryQuery.optional()
127
+ }).parseAsync(data),
128
+ responseValidator: async (data) => await zGridServiceListHistoryResponse.parseAsync(data),
129
+ url: '/api/v1/history',
130
+ ...options
131
+ });
132
+ /**
133
+ * The MeshCore relay topology, as an edge list
134
+ *
135
+ * Every undirected relay link observed within `window`, mesh-wide (not
136
+ * place-scoped: a mesh spans places). Nodes are identified by public key;
137
+ * to draw a link, join `a` and `b` to `properties.mesh.publicKey` on the
138
+ * `mesh_node` map layer (or `mesh.publicKey` on `layer=MESH` events) for
139
+ * coordinates. For a place-scoped, ready-to-draw version use the
140
+ * `mesh_link` map layer. Weight edges by `daysActive`, fade by `lastSeen`.
141
+ *
142
+ * `Cache-Control: public, max-age=60` and a weak `ETag` (`W/"…"`) that
143
+ * excludes `generatedAt`: `If-None-Match` revalidates to `304` until the
144
+ * links change.
145
+ *
146
+ */
147
+ export const listMeshLinks = (options) => (options?.client ?? client).get({
148
+ requestValidator: async (data) => await z.object({
149
+ body: z.never().optional(),
150
+ headers: zListMeshLinksHeaders.optional(),
151
+ path: z.never().optional(),
152
+ query: zListMeshLinksQuery.optional()
153
+ }).parseAsync(data),
154
+ responseValidator: async (data) => await zListMeshLinksResponse.parseAsync(data),
155
+ url: '/api/v1/mesh/links',
156
+ ...options
157
+ });
158
+ /**
159
+ * Get one mesh node's telemetry series.
160
+ *
161
+ * Every archived operator-monitor reading for one MeshCore node over a
162
+ * window, oldest first: the data behind a battery, temperature or airtime
163
+ * chart. The event carries only the latest reading
164
+ * (`mesh.telemetry.admin`). Only nodes an operator monitors have samples.
165
+ * The default window is the 24 hours before `to` (default now); windows over
166
+ * 400 days are clamped. At most 20,000 samples are returned (`truncated`
167
+ * says so).
168
+ */
169
+ export const gridServiceGetMeshTelemetry = (options) => (options.client ?? client).get({
170
+ requestValidator: async (data) => await z.object({
171
+ body: z.never().optional(),
172
+ path: z.never().optional(),
173
+ query: zGridServiceGetMeshTelemetryQuery
174
+ }).parseAsync(data),
175
+ responseValidator: async (data) => await zGridServiceGetMeshTelemetryResponse.parseAsync(data),
176
+ url: '/api/v1/mesh/telemetry',
177
+ ...options
178
+ });
179
+ /**
180
+ * List places.
181
+ *
182
+ * The place directory, with geometry: coverage areas, counties, towns and
183
+ * highway corridors (about 20 today). Filter by `kind` and a case-insensitive
184
+ * name substring `q`. Not paginated. Supports ETag / If-None-Match.
185
+ */
186
+ export const gridServiceListPlaces = (options) => (options?.client ?? client).get({
187
+ requestValidator: async (data) => await z.object({
188
+ body: z.never().optional(),
189
+ path: z.never().optional(),
190
+ query: zGridServiceListPlacesQuery.optional()
191
+ }).parseAsync(data),
192
+ responseValidator: async (data) => await zGridServiceListPlacesResponse.parseAsync(data),
193
+ url: '/api/v1/places',
194
+ ...options
195
+ });
196
+ /**
197
+ * Get one place.
198
+ *
199
+ * One place by slug (`arnold`) or namespaced id (`town:arnold`), with its
200
+ * geometry. Supports ETag / If-None-Match.
201
+ */
202
+ export const gridServiceGetPlace = (options) => (options.client ?? client).get({
203
+ requestValidator: async (data) => await z.object({
204
+ body: z.never().optional(),
205
+ path: zGridServiceGetPlacePath,
206
+ query: zGridServiceGetPlaceQuery.optional()
207
+ }).parseAsync(data),
208
+ responseValidator: async (data) => await zGridServiceGetPlaceResponse.parseAsync(data),
209
+ url: '/api/v1/places/{place}',
210
+ ...options
211
+ });
212
+ /**
213
+ * One map layer for a place, as GeoJSON
214
+ *
215
+ * An RFC 7946 FeatureCollection of one layer's features within a place.
216
+ * Coordinates are `[longitude, latitude]`. Check `metadata.sourceStatus`
217
+ * before drawing: UNAVAILABLE means unknown (empty `features`), STALE
218
+ * means last-good data.
219
+ *
220
+ * | layer | features | backed by |
221
+ * |---|---|---|
222
+ * | `road_incident` | Points: CHP incidents (category `incident`) and Caltrans planned lane closures (`closure`, SCHEDULED until set up) | events |
223
+ * | `chain_control` | Points: active R1/R2/R3 checkpoints and seasonal pass closures | live Caltrans |
224
+ * | `road_segment` | LineStrings: configured routes with travel time; `status` OPEN/CLOSED/RESTRICTED/MAINTENANCE | live Google Routes + Caltrans |
225
+ * | `message_sign` | Points: Caltrans message signs and their text; always INFO | live Caltrans |
226
+ * | `weather_alert` | null geometry: NWS zone watches/warnings/advisories | events |
227
+ * | `fire_weather` | one null-geometry region banner (`fw:region`) plus forecast Points | live NWS |
228
+ * | `earthquake` | Points | events (USGS) |
229
+ * | `wildfire` | Points or (Multi)Polygon perimeters | events (CAL FIRE, FIRIS) |
230
+ * | `evacuation` | (Multi)Polygon zones; `status` is the level | events (Cal OES) |
231
+ * | `power` | Polygons/Points: PG&E outages (`unplanned`/`planned`) and PSPS (`psps`) | events |
232
+ * | `mesh_node` | Points: MeshCore nodes in the place; always INFO | events |
233
+ * | `mesh_link` | LineString relay links touching the place plus the MESH_NODE Points at both ends (neighbours outside the place have `mesh.inRegion: false`); honours `window` | derived |
234
+ * | `camera` | Points: Caltrans CCTV cameras near the place, nearest first; always INFO | live Caltrans |
235
+ *
236
+ * Event-backed layers carry only ACTIVE and SCHEDULED features, and each
237
+ * feature `id` is an event id usable with `/api/v1/events/{id}`. The
238
+ * `.geojson` suffix is optional (`/map/wildfire` is the same resource).
239
+ *
240
+ * **Caching.** `Cache-Control: public, max-age=60` and a weak `ETag`
241
+ * (`W/"…"`) over the layer's content, excluding `metadata.generatedAt`.
242
+ * Revalidate with `If-None-Match`: the answer is `304` until the
243
+ * features, `sourceStatus`, `lastSourceUpdate` or `attribution` change,
244
+ * so polling a quiet layer costs no body.
245
+ *
246
+ */
247
+ export const getMapLayer = (options) => (options.client ?? client).get({
248
+ requestValidator: async (data) => await z.object({
249
+ body: z.never().optional(),
250
+ headers: zGetMapLayerHeaders.optional(),
251
+ path: zGetMapLayerPath,
252
+ query: zGetMapLayerQuery.optional()
253
+ }).parseAsync(data),
254
+ responseValidator: async (data) => await zGetMapLayerResponse.parseAsync(data),
255
+ url: '/api/v1/places/{place}/map/{layer}.geojson',
256
+ ...options
257
+ });
258
+ /**
259
+ * Summarize a place in one call.
260
+ *
261
+ * The dashboard headline: `mode` (QUIET, WATCH, ACTIVE), a cross-layer hazard
262
+ * rollup (`summary`), one block per domain (`domains`), and a source-health
263
+ * sidecar (`sources`). Built from the place's ACTIVE and SCHEDULED events
264
+ * plus the live condition layers (road segments, chain control, fire
265
+ * weather).
266
+ *
267
+ * Ambient state is kept out of the hazard rollup (`totalActive`,
268
+ * `severityCounts`, `topEvents`, `mode`): MESH nodes, BURN_STATUS, INFO-level
269
+ * POWER outages, and SCHEDULED road closures. MESH and BURN_STATUS appear only
270
+ * in their own `comms` and `burn` domains. The `evacuation` invariant: see
271
+ * `summary.activeEvacuations`. Computed fresh on each call; no ETag.
272
+ */
273
+ export const gridServiceGetPlaceSummary = (options) => (options.client ?? client).get({
274
+ requestValidator: async (data) => await z.object({
275
+ body: z.never().optional(),
276
+ path: zGridServiceGetPlaceSummaryPath,
277
+ query: z.never().optional()
278
+ }).parseAsync(data),
279
+ responseValidator: async (data) => await zGridServiceGetPlaceSummaryResponse.parseAsync(data),
280
+ url: '/api/v1/places/{place}/summary',
281
+ ...options
282
+ });
283
+ /**
284
+ * Resolve a point or an address to places.
285
+ *
286
+ * Returns every place containing the point, most specific first (SITE,
287
+ * EVAC_ZONE, TOWN, CORRIDOR, COUNTY, AREA). A town matches within 3 km of its
288
+ * point (nearest town first); a corridor within about 1.5 km of its line. Give
289
+ * `lat` and `lng`, or `address` (geocoded with the US Census geocoder), not
290
+ * both. An empty `places` list means the point is outside the covered region.
291
+ */
292
+ export const gridServiceResolvePlace = (options) => (options?.client ?? client).get({
293
+ requestValidator: async (data) => await z.object({
294
+ body: z.never().optional(),
295
+ path: z.never().optional(),
296
+ query: zGridServiceResolvePlaceQuery.optional()
297
+ }).parseAsync(data),
298
+ responseValidator: async (data) => await zGridServiceResolvePlaceResponse.parseAsync(data),
299
+ url: '/api/v1/places:resolve',
300
+ ...options
301
+ });
302
+ /**
303
+ * List police, fire and CHP scanner feeds.
304
+ *
305
+ * Broadcastify audio feeds that cover the region. With `place` naming an AREA,
306
+ * that area's feeds; with any other place, or none, every configured feed,
307
+ * deduplicated. Links only; audio is served by Broadcastify.
308
+ */
309
+ export const gridServiceListScanners = (options) => (options?.client ?? client).get({
310
+ requestValidator: async (data) => await z.object({
311
+ body: z.never().optional(),
312
+ path: z.never().optional(),
313
+ query: zGridServiceListScannersQuery.optional()
314
+ }).parseAsync(data),
315
+ responseValidator: async (data) => await zGridServiceListScannersResponse.parseAsync(data),
316
+ url: '/api/v1/scanners',
317
+ ...options
318
+ });
319
+ /**
320
+ * List sources and their health.
321
+ *
322
+ * The upstream source registry with per-source health (OK, STALE,
323
+ * UNAVAILABLE), last success, last attempt and last error. This is how a
324
+ * client decides how far to trust each layer. It also lists one health-only
325
+ * row per operator push reporter.
326
+ */
327
+ export const gridServiceListSources = (options) => (options?.client ?? client).get({
328
+ requestValidator: async (data) => await z.object({
329
+ body: z.never().optional(),
330
+ path: z.never().optional(),
331
+ query: z.never().optional()
332
+ }).parseAsync(data),
333
+ responseValidator: async (data) => await zGridServiceListSourcesResponse.parseAsync(data),
334
+ url: '/api/v1/sources',
335
+ ...options
336
+ });