@myrobotaxi/contracts 0.2.0 → 0.4.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/CONTRIBUTING.md +15 -4
- package/README.md +40 -2
- package/dist/index.cjs +111 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -1
- package/dist/index.d.ts +99 -1
- package/dist/index.js +111 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.cts +95 -1
- package/dist/types.d.ts +95 -1
- package/package.json +3 -1
- package/schemas/vehicle-summary.schema.json +108 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://myrobotaxi.com/schemas/vehicle-summary.schema.json",
|
|
4
|
+
"title": "VehicleListResponse",
|
|
5
|
+
"description": "Envelope returned by GET /api/vehicles. Wraps an array of VehicleSummary rows under the `items` key. Pagination fields are reserved per rest-api.md §7.0 and intentionally absent in v1. The envelope itself is part of the wire contract: consumers MUST NOT strip it silently.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["items"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"items": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"description": "Per-vehicle summary rows for vehicles the caller has access to. Order is server-defined (currently ORDER BY Vehicle.createdAt ASC in the telemetry list query). An empty array means the caller has no vehicles (or is a v1 viewer-tier caller — see rest-api.md §7.0 RBAC v1 implementation note).",
|
|
13
|
+
"items": { "$ref": "#/$defs/VehicleSummary" }
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"$defs": {
|
|
17
|
+
"VehicleSummary": {
|
|
18
|
+
"title": "VehicleSummary",
|
|
19
|
+
"description": "Lean per-vehicle row returned by GET /api/vehicles. A list-view projection of VehicleState containing only the fields the catalog UI needs (identity, model/year/color, status, charge headline, last-updated). No GPS, no navigation, no climate, no encrypted-at-rest fields. Mirrors the Go `vehicleSummary` struct in telemetry/internal/telemetry/vehicles_list_handler.go and the `VehicleSummary` shape in telemetry/specs/rest.openapi.yaml. Use VehicleState for the full snapshot/WebSocket payload; use VehicleSummary for list endpoints.",
|
|
20
|
+
"type": "object",
|
|
21
|
+
"additionalProperties": false,
|
|
22
|
+
"required": [
|
|
23
|
+
"vehicleId",
|
|
24
|
+
"name",
|
|
25
|
+
"model",
|
|
26
|
+
"year",
|
|
27
|
+
"color",
|
|
28
|
+
"vinLast4",
|
|
29
|
+
"status",
|
|
30
|
+
"chargeLevel",
|
|
31
|
+
"estimatedRange",
|
|
32
|
+
"lastUpdated",
|
|
33
|
+
"role"
|
|
34
|
+
],
|
|
35
|
+
"properties": {
|
|
36
|
+
"vehicleId": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "Opaque database identifier (cuid). NOT the VIN. All SDK API calls use this ID (FR-4.2). Matches VehicleState.vehicleId.",
|
|
39
|
+
"x-classification": "P0",
|
|
40
|
+
"examples": ["clxyz1234567890abcdef"]
|
|
41
|
+
},
|
|
42
|
+
"name": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "User-assigned vehicle name from DB Vehicle.name. Matches VehicleState.name.",
|
|
45
|
+
"x-classification": "P0",
|
|
46
|
+
"examples": ["Optimus"]
|
|
47
|
+
},
|
|
48
|
+
"model": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"description": "Vehicle model (e.g., 'Model 3', 'Model Y'). Sourced from DB Vehicle.model. Matches VehicleState.model.",
|
|
51
|
+
"x-classification": "P0",
|
|
52
|
+
"examples": ["Model 3"]
|
|
53
|
+
},
|
|
54
|
+
"year": {
|
|
55
|
+
"type": "integer",
|
|
56
|
+
"description": "Model year. Sourced from DB Vehicle.year. Matches VehicleState.year.",
|
|
57
|
+
"x-classification": "P0",
|
|
58
|
+
"examples": [2024]
|
|
59
|
+
},
|
|
60
|
+
"color": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"description": "Vehicle exterior color. Sourced from DB Vehicle.color. Matches VehicleState.color.",
|
|
63
|
+
"x-classification": "P0",
|
|
64
|
+
"examples": ["Midnight Silver Metallic"]
|
|
65
|
+
},
|
|
66
|
+
"vinLast4": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"description": "Last 4 characters of the vehicle's 17-character VIN. The full VIN is never emitted on the list endpoint — vinLast4 is sufficient for human disambiguation in the catalog UI without exposing the full identifier. Empty string when the VIN is unknown.",
|
|
69
|
+
"x-classification": "P1",
|
|
70
|
+
"examples": ["3F5A"]
|
|
71
|
+
},
|
|
72
|
+
"status": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"enum": ["driving", "parked", "charging", "offline", "in_service"],
|
|
75
|
+
"description": "Derived vehicle status snapshot at the time of the last telemetry update. Same enum as VehicleState.status.",
|
|
76
|
+
"x-classification": "P0"
|
|
77
|
+
},
|
|
78
|
+
"chargeLevel": {
|
|
79
|
+
"type": "integer",
|
|
80
|
+
"description": "Battery state of charge snapshot at the time of the last telemetry update. Same semantics as VehicleState.chargeLevel.",
|
|
81
|
+
"x-classification": "P0",
|
|
82
|
+
"x-unit": "percent",
|
|
83
|
+
"minimum": 0,
|
|
84
|
+
"maximum": 100
|
|
85
|
+
},
|
|
86
|
+
"estimatedRange": {
|
|
87
|
+
"type": "integer",
|
|
88
|
+
"description": "Estimated remaining driving range snapshot at the time of the last telemetry update. Same semantics as VehicleState.estimatedRange.",
|
|
89
|
+
"x-classification": "P0",
|
|
90
|
+
"x-unit": "miles",
|
|
91
|
+
"minimum": 0
|
|
92
|
+
},
|
|
93
|
+
"lastUpdated": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"format": "date-time",
|
|
96
|
+
"description": "ISO 8601 timestamp of the most recent telemetry update applied to this vehicle. Same semantics as VehicleState.lastUpdated. Telemetry emits RFC 3339 UTC strings (e.g., '2026-05-25T17:30:00Z').",
|
|
97
|
+
"x-classification": "P0"
|
|
98
|
+
},
|
|
99
|
+
"role": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"enum": ["owner", "viewer"],
|
|
102
|
+
"description": "RBAC role the caller holds against this vehicle. v1 only emits 'owner' rows (every vehicle returned is one the caller owns via Vehicle.userId). The 'viewer' value is reserved for the viewer-merged invite-read pathway tracked as a follow-up — see rest-api.md §7.0 RBAC v1 implementation note.",
|
|
103
|
+
"x-classification": "P0"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|