@myrobotaxi/contracts 0.5.0 → 0.7.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/README.md +6 -1
- package/dist/index.cjs +445 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +409 -1
- package/dist/index.d.ts +409 -1
- package/dist/index.js +445 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.cts +370 -1
- package/dist/types.d.ts +370 -1
- package/package.json +4 -1
- package/schemas/drive-detail.schema.json +174 -0
- package/schemas/drive-route.schema.json +78 -0
- package/schemas/drives-list.schema.json +184 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://myrobotaxi.com/schemas/drives-list.schema.json",
|
|
4
|
+
"title": "DrivesListResponse",
|
|
5
|
+
"description": "Cursor-paginated envelope returned by GET /api/vehicles/{vehicleId}/drives (rest-api.md §7.2). Wraps an array of DriveSummary rows under `items`, newest first (ORDER BY startTime DESC, id DESC). Mirrors the Go `drivesPageResponse` struct in telemetry/internal/telemetry/vehicle_drives_types.go and the `PaginatedDrives` component in telemetry/docs/contracts/specs/rest.openapi.yaml. Pairs with the WebSocket `drive_ended` subscription for FR-9.1/FR-9.2: the SDK hydrates the first page here and prepends live `drive_ended` frames without re-fetching. The envelope is part of the wire contract: consumers MUST NOT strip it silently.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["items", "nextCursor", "hasMore"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"items": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"description": "Drive summary rows for this page. Always present; an empty array (never null) means no more drives — e.g. the final page or a vehicle with no completed drives. Ordered startTime DESC, id DESC (rest-api.md §7.2 Ordering).",
|
|
13
|
+
"x-classification": "P0",
|
|
14
|
+
"items": { "$ref": "#/$defs/DriveSummary" }
|
|
15
|
+
},
|
|
16
|
+
"nextCursor": {
|
|
17
|
+
"type": ["string", "null"],
|
|
18
|
+
"description": "Opaque base64 cursor for the next page, or null on the final page. Pass it back as the `cursor` query param to fetch the next page. Encodes (startTime, id) so pagination is stable across concurrent writes. Nullable on the wire — the Go server emits JSON `null` (not an omitted key) when there is no further page (drivesPageResponse.NextCursor is a `*string` with no omitempty, telemetry/internal/telemetry/vehicle_drives_types.go). Redundant with `hasMore == false`.",
|
|
19
|
+
"x-classification": "P0"
|
|
20
|
+
},
|
|
21
|
+
"hasMore": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"description": "True iff more pages exist after this one. Redundant with `nextCursor != null`, provided for caller convenience.",
|
|
24
|
+
"x-classification": "P0"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"$defs": {
|
|
28
|
+
"DriveSummary": {
|
|
29
|
+
"title": "DriveSummary",
|
|
30
|
+
"description": "Lightweight per-drive row returned by GET /api/vehicles/{vehicleId}/drives. A list-view projection of a completed drive containing the FR-3.4 headline stats plus origin/destination labels, so the history list renders without a per-row DriveDetail fetch. Includes the four P1 location/address labels (MYR-145) and the P0 fsdMiles/fsdPercentage stats (MYR-152). Deliberately omits energyUsedKwh, interventions, and routePoints — those live on Drive (drive detail, §7.3) and DriveRoute (§7.4). Mirrors the Go `driveSummary` struct + `toMaskMap` in telemetry/internal/telemetry/vehicle_drives_types.go and the `DriveSummary` component in telemetry/docs/contracts/specs/rest.openapi.yaml.",
|
|
31
|
+
"type": "object",
|
|
32
|
+
"additionalProperties": false,
|
|
33
|
+
"required": [
|
|
34
|
+
"id",
|
|
35
|
+
"vehicleId",
|
|
36
|
+
"startTime",
|
|
37
|
+
"endTime",
|
|
38
|
+
"date",
|
|
39
|
+
"distanceMiles",
|
|
40
|
+
"durationSeconds",
|
|
41
|
+
"avgSpeedMph",
|
|
42
|
+
"maxSpeedMph",
|
|
43
|
+
"startChargeLevel",
|
|
44
|
+
"endChargeLevel",
|
|
45
|
+
"fsdMiles",
|
|
46
|
+
"fsdPercentage",
|
|
47
|
+
"createdAt"
|
|
48
|
+
],
|
|
49
|
+
"properties": {
|
|
50
|
+
"id": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "Opaque database identifier (cuid) for this drive. Matches the `driveId` carried by `drive_started` / `drive_ended` WebSocket frames and the path param of GET /api/drives/{driveId}.",
|
|
53
|
+
"x-classification": "P0",
|
|
54
|
+
"examples": ["clmno9876543210zyxw0001"]
|
|
55
|
+
},
|
|
56
|
+
"vehicleId": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"description": "Opaque database identifier (cuid) for the drive's parent vehicle. Matches VehicleState.vehicleId / VehicleSummary.vehicleId.",
|
|
59
|
+
"x-classification": "P0",
|
|
60
|
+
"examples": ["clxyz1234567890abcdef"]
|
|
61
|
+
},
|
|
62
|
+
"startTime": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"format": "date-time",
|
|
65
|
+
"description": "ISO 8601 / RFC 3339 UTC timestamp when the drive began (e.g., '2026-04-13T18:22:00Z').",
|
|
66
|
+
"x-classification": "P0",
|
|
67
|
+
"examples": ["2026-04-13T18:22:00Z"]
|
|
68
|
+
},
|
|
69
|
+
"endTime": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"format": "date-time",
|
|
72
|
+
"description": "ISO 8601 / RFC 3339 UTC timestamp when the drive ended (e.g., '2026-04-13T18:46:18Z').",
|
|
73
|
+
"x-classification": "P0",
|
|
74
|
+
"examples": ["2026-04-13T18:46:18Z"]
|
|
75
|
+
},
|
|
76
|
+
"date": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"format": "date",
|
|
79
|
+
"description": "Local calendar date of the drive as a 'YYYY-MM-DD' string (e.g., '2026-04-13'), for day-grouping the history list. Not a full timestamp — use startTime/endTime for instants.",
|
|
80
|
+
"x-classification": "P0",
|
|
81
|
+
"examples": ["2026-04-13"]
|
|
82
|
+
},
|
|
83
|
+
"startLocation": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"description": "Reverse-geocoded place name at the drive's start (e.g., 'Home', 'Whole Foods Market'). OPTIONAL on the wire: the Go handler OMITS this key entirely (never emits '' or null) when the underlying Drive.startLocation column is empty — zero-GPS at drive start or reverse-geocode failed (toMaskMap, telemetry/internal/telemetry/vehicle_drives_types.go). Consumers branch on key presence.",
|
|
86
|
+
"x-classification": "P1",
|
|
87
|
+
"examples": ["Home"]
|
|
88
|
+
},
|
|
89
|
+
"startAddress": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"description": "Reverse-geocoded street address at the drive's start. OPTIONAL on the wire: the key is omitted entirely when the underlying Drive.startAddress column is empty (same omit-when-empty convention as startLocation).",
|
|
92
|
+
"x-classification": "P1",
|
|
93
|
+
"examples": ["742 Evergreen Terrace, San Francisco, CA 94107"]
|
|
94
|
+
},
|
|
95
|
+
"endLocation": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"description": "Reverse-geocoded place name at the drive's end. OPTIONAL on the wire: the key is omitted entirely when the underlying Drive.endLocation column is empty — drive in progress, zero-GPS at drive end, or reverse-geocode failed.",
|
|
98
|
+
"x-classification": "P1",
|
|
99
|
+
"examples": ["Whole Foods Market"]
|
|
100
|
+
},
|
|
101
|
+
"endAddress": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"description": "Reverse-geocoded street address at the drive's end. OPTIONAL on the wire: the key is omitted entirely when the underlying Drive.endAddress column is empty.",
|
|
104
|
+
"x-classification": "P1",
|
|
105
|
+
"examples": ["399 4th Street, San Francisco, CA 94107"]
|
|
106
|
+
},
|
|
107
|
+
"distanceMiles": {
|
|
108
|
+
"type": "number",
|
|
109
|
+
"description": "Total distance driven, in miles (FR-3.4).",
|
|
110
|
+
"x-classification": "P0",
|
|
111
|
+
"x-unit": "miles",
|
|
112
|
+
"minimum": 0,
|
|
113
|
+
"examples": [12.4]
|
|
114
|
+
},
|
|
115
|
+
"durationSeconds": {
|
|
116
|
+
"type": "integer",
|
|
117
|
+
"description": "Total drive duration, in seconds (FR-3.4). The Go server converts the stored DurationMinutes to seconds (DurationMinutes * 60) before emitting. Matches the WebSocket drive_ended.payload.durationSeconds shape (DV-12).",
|
|
118
|
+
"x-classification": "P0",
|
|
119
|
+
"x-unit": "seconds",
|
|
120
|
+
"minimum": 0,
|
|
121
|
+
"examples": [1458]
|
|
122
|
+
},
|
|
123
|
+
"avgSpeedMph": {
|
|
124
|
+
"type": "number",
|
|
125
|
+
"description": "Average speed over the drive, in miles per hour (FR-3.4).",
|
|
126
|
+
"x-classification": "P0",
|
|
127
|
+
"x-unit": "mph",
|
|
128
|
+
"minimum": 0,
|
|
129
|
+
"examples": [30.5]
|
|
130
|
+
},
|
|
131
|
+
"maxSpeedMph": {
|
|
132
|
+
"type": "number",
|
|
133
|
+
"description": "Maximum speed reached during the drive, in miles per hour (FR-3.4).",
|
|
134
|
+
"x-classification": "P0",
|
|
135
|
+
"x-unit": "mph",
|
|
136
|
+
"minimum": 0,
|
|
137
|
+
"examples": [65.2]
|
|
138
|
+
},
|
|
139
|
+
"startChargeLevel": {
|
|
140
|
+
"type": "integer",
|
|
141
|
+
"description": "Battery state of charge at drive start (FR-3.4).",
|
|
142
|
+
"x-classification": "P0",
|
|
143
|
+
"x-unit": "percent",
|
|
144
|
+
"minimum": 0,
|
|
145
|
+
"maximum": 100,
|
|
146
|
+
"examples": [82]
|
|
147
|
+
},
|
|
148
|
+
"endChargeLevel": {
|
|
149
|
+
"type": "integer",
|
|
150
|
+
"description": "Battery state of charge at drive end (FR-3.4).",
|
|
151
|
+
"x-classification": "P0",
|
|
152
|
+
"x-unit": "percent",
|
|
153
|
+
"minimum": 0,
|
|
154
|
+
"maximum": 100,
|
|
155
|
+
"examples": [76]
|
|
156
|
+
},
|
|
157
|
+
"fsdMiles": {
|
|
158
|
+
"type": "number",
|
|
159
|
+
"description": "Miles driven under Full Self-Driving during this drive (FR-3.4, MYR-152). Always present; defaults to 0 for a drive with no FSD usage.",
|
|
160
|
+
"x-classification": "P0",
|
|
161
|
+
"x-unit": "miles",
|
|
162
|
+
"minimum": 0,
|
|
163
|
+
"examples": [8.1]
|
|
164
|
+
},
|
|
165
|
+
"fsdPercentage": {
|
|
166
|
+
"type": "number",
|
|
167
|
+
"description": "Percent of the drive covered by FSD (FR-3.4, MYR-152). Always present; defaults to 0 for a drive with no FSD usage.",
|
|
168
|
+
"x-classification": "P0",
|
|
169
|
+
"x-unit": "percent",
|
|
170
|
+
"minimum": 0,
|
|
171
|
+
"maximum": 100,
|
|
172
|
+
"examples": [65.3]
|
|
173
|
+
},
|
|
174
|
+
"createdAt": {
|
|
175
|
+
"type": "string",
|
|
176
|
+
"format": "date-time",
|
|
177
|
+
"description": "ISO 8601 / RFC 3339 UTC row-creation timestamp. The Go server renders it as `CreatedAt.UTC().Format(time.RFC3339)` (telemetry/internal/telemetry/vehicle_drives_types.go).",
|
|
178
|
+
"x-classification": "P0",
|
|
179
|
+
"examples": ["2026-04-13T18:46:19Z"]
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|