@myrobotaxi/contracts 0.6.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 CHANGED
@@ -36,6 +36,7 @@ Raw JSON for non-JS consumers (Go):
36
36
  ./node_modules/@myrobotaxi/contracts/schemas/vehicle-summary.schema.json
37
37
  ./node_modules/@myrobotaxi/contracts/schemas/drives-list.schema.json
38
38
  ./node_modules/@myrobotaxi/contracts/schemas/drive-detail.schema.json
39
+ ./node_modules/@myrobotaxi/contracts/schemas/drive-route.schema.json
39
40
  ./node_modules/@myrobotaxi/contracts/schemas/ws-messages.schema.json
40
41
  ./node_modules/@myrobotaxi/contracts/schemas/ws-envelope.schema.json
41
42
  ```
package/dist/index.cjs CHANGED
@@ -817,6 +817,86 @@ var drive_detail_schema_default = {
817
817
  }
818
818
  };
819
819
 
820
+ // schemas/drive-route.schema.json
821
+ var drive_route_schema_default = {
822
+ $schema: "https://json-schema.org/draft/2020-12/schema",
823
+ $id: "https://myrobotaxi.com/schemas/drive-route.schema.json",
824
+ title: "DriveRoute",
825
+ description: "Full GPS polyline for a single completed drive, returned as a bare object by GET /api/drives/{driveId}/route (rest-api.md \xA77.4, FR-3.3). This is the heavy per-drive route payload deliberately excluded from both DriveSummary (\xA77.2) and Drive detail (\xA77.3): the SDK fetches it lazily on tap-through of a drive's map view, NOT eagerly per drive-list row (see \xA77.4 lazy-fetch guidance \u2014 cellular bandwidth / perceived latency, not heap pressure). The polyline is AES-256-GCM encrypted at rest on Drive.routePoints (NFR-3.23, data-classification.md \xA71.5) and decrypted in the store layer (NFR-3.25) before the handler serializes it; the SDK never sees ciphertext. Mirrors the Go `driveRouteResponse` struct in telemetry/internal/telemetry/drive_route_handler.go and the `DriveRoute` component in telemetry/docs/contracts/specs/rest.openapi.yaml. NOTE: the handler passes `routePoints` through as `json.RawMessage` (raw decrypted JSONB) \u2014 the per-point shape is owned by the writer that persisted it (store.RoutePointRecord, telemetry/internal/store/types.go), so RoutePoint below documents that persisted format field-for-field.",
826
+ type: "object",
827
+ additionalProperties: false,
828
+ required: ["driveId", "routePoints"],
829
+ properties: {
830
+ driveId: {
831
+ type: "string",
832
+ description: "Opaque database identifier (cuid) for this drive. Echoes the `driveId` path param and matches Drive.id / DriveSummary.id and the `driveId` carried by `drive_started` / `drive_ended` WebSocket frames. Always present (Go `driveRouteResponse.DriveID`, no omitempty).",
833
+ "x-classification": "P0",
834
+ examples: ["clmno9876543210zyxw0001"]
835
+ },
836
+ routePoints: {
837
+ type: "array",
838
+ description: "Ordered GPS breadcrumb trail for the drive, oldest point first, suitable for rendering the drive's polyline on a map. ALWAYS PRESENT and ALWAYS AN ARRAY, never null: the Go handler substitutes an empty `[]` when the underlying Drive.routePoints column is empty/absent (writeMaskedRoute, telemetry/internal/telemetry/drive_route_handler.go) \u2014 so a very short drive with no captured points, or a route that failed to decrypt, yields `[]` rather than a missing key or null. A 60-minute drive captured at ~1 Hz is roughly 3,600 points (~200-300 KB JSON); no server-side downsampling or paging \u2014 the entire polyline is returned in one response (there is no cursor/limit on this endpoint, unlike the \xA77.2 drives list).",
839
+ "x-classification": "mixed",
840
+ items: { $ref: "#/$defs/RoutePoint" }
841
+ }
842
+ },
843
+ $defs: {
844
+ RoutePoint: {
845
+ title: "RoutePoint",
846
+ description: "A single GPS sample on a drive's polyline. Matches the `RoutePointRecord` shape from data-classification.md \xA71.5 \u2014 the JSONB element format persisted by the Go writer (store.RoutePointRecord, telemetry/internal/store/types.go) and the legacy Next.js app. lat/lng are P1 (identifying GPS); speed, heading, and timestamp are P0 in isolation but are encrypted at rest as a unit inside the P1 routePoints column (NFR-3.23) and MUST NOT be logged separately. All five fields are always present on the wire (the Go struct carries no omitempty). Mirrors the `RoutePoint` component in telemetry/docs/contracts/specs/rest.openapi.yaml.",
847
+ type: "object",
848
+ additionalProperties: false,
849
+ required: ["lat", "lng", "speed", "heading", "timestamp"],
850
+ properties: {
851
+ lat: {
852
+ type: "number",
853
+ description: "Latitude in degrees at this point. Emitted as a JSON number (Go float64); whole-degree values serialize without a decimal point (Go shortest-float marshaling), so `10` and `10.0000` are the same value on the wire.",
854
+ "x-classification": "P1",
855
+ "x-encrypted-at-rest": true,
856
+ "x-unit": "degrees",
857
+ minimum: -90,
858
+ maximum: 90,
859
+ examples: [37.7749]
860
+ },
861
+ lng: {
862
+ type: "number",
863
+ description: "Longitude in degrees at this point. Emitted as a JSON number (Go float64).",
864
+ "x-classification": "P1",
865
+ "x-encrypted-at-rest": true,
866
+ "x-unit": "degrees",
867
+ minimum: -180,
868
+ maximum: 180,
869
+ examples: [-122.4194]
870
+ },
871
+ speed: {
872
+ type: "number",
873
+ description: "Instantaneous speed at this point, in miles per hour. P0 in isolation but encrypted at rest alongside the parent P1 routePoints column. Emitted as a JSON number (Go float64).",
874
+ "x-classification": "P0",
875
+ "x-unit": "mph",
876
+ minimum: 0,
877
+ examples: [15]
878
+ },
879
+ heading: {
880
+ type: "number",
881
+ description: "Compass heading at this point, in degrees (0-360, 0 = North). P0 in isolation but encrypted at rest alongside the parent P1 routePoints column. Emitted as a JSON number (Go float64).",
882
+ "x-classification": "P0",
883
+ "x-unit": "degrees",
884
+ minimum: 0,
885
+ maximum: 360,
886
+ examples: [175]
887
+ },
888
+ timestamp: {
889
+ type: "string",
890
+ format: "date-time",
891
+ description: "ISO 8601 / RFC 3339 UTC timestamp at which this point was captured. The Go writer renders it as `Timestamp.Format(time.RFC3339)` (telemetry/internal/store/drive_mapper.go). P0 in isolation but encrypted at rest alongside the parent P1 routePoints column.",
892
+ "x-classification": "P0",
893
+ examples: ["2026-04-13T18:22:00Z"]
894
+ }
895
+ }
896
+ }
897
+ }
898
+ };
899
+
820
900
  // schemas/ws-messages.schema.json
821
901
  var ws_messages_schema_default = {
822
902
  $schema: "https://json-schema.org/draft/2020-12/schema",
@@ -1189,6 +1269,7 @@ var schemas = {
1189
1269
  vehicleSummary: vehicle_summary_schema_default,
1190
1270
  drivesList: drives_list_schema_default,
1191
1271
  driveDetail: drive_detail_schema_default,
1272
+ driveRoute: drive_route_schema_default,
1192
1273
  wsMessages: ws_messages_schema_default,
1193
1274
  wsEnvelope: ws_envelope_schema_default
1194
1275
  };