@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/dist/types.d.cts CHANGED
@@ -637,6 +637,76 @@ interface Drive {
637
637
  createdAt: string;
638
638
  }
639
639
 
640
+ /**
641
+ * AUTO-GENERATED by scripts/codegen.mjs from the corresponding JSON Schema
642
+ * in ../schemas/. DO NOT EDIT BY HAND — re-run `npm run codegen` instead.
643
+ *
644
+ * The x-classification / x-atomic-group / x-unit / x-encrypted custom JSON
645
+ * Schema annotations from the source schemas are folded into the generated
646
+ * TSDoc comments so grep can find them without leaving the editor.
647
+ */
648
+ /**
649
+ * Full GPS polyline for a single completed drive, returned as a bare object by GET /api/drives/{driveId}/route (rest-api.md §7.4, FR-3.3). This is the heavy per-drive route payload deliberately excluded from both DriveSummary (§7.2) and Drive detail (§7.3): the SDK fetches it lazily on tap-through of a drive's map view, NOT eagerly per drive-list row (see §7.4 lazy-fetch guidance — 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 §1.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) — 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.
650
+ */
651
+ interface DriveRoute {
652
+ /**
653
+ * 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).
654
+ *
655
+ * @classification "P0"
656
+ */
657
+ driveId: string;
658
+ /**
659
+ * 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) — 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 — the entire polyline is returned in one response (there is no cursor/limit on this endpoint, unlike the §7.2 drives list).
660
+ *
661
+ * @classification "mixed"
662
+ */
663
+ routePoints: RoutePoint[];
664
+ }
665
+ /**
666
+ * A single GPS sample on a drive's polyline. Matches the `RoutePointRecord` shape from data-classification.md §1.5 — 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.
667
+ *
668
+ * This interface was referenced by `DriveRoute`'s JSON-Schema
669
+ * via the `definition` "RoutePoint".
670
+ */
671
+ interface RoutePoint {
672
+ /**
673
+ * 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.
674
+ *
675
+ * @classification "P1"
676
+ * @unit "degrees"
677
+ * @encrypted-at-rest true
678
+ */
679
+ lat: number;
680
+ /**
681
+ * Longitude in degrees at this point. Emitted as a JSON number (Go float64).
682
+ *
683
+ * @classification "P1"
684
+ * @unit "degrees"
685
+ * @encrypted-at-rest true
686
+ */
687
+ lng: number;
688
+ /**
689
+ * 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).
690
+ *
691
+ * @classification "P0"
692
+ * @unit "mph"
693
+ */
694
+ speed: number;
695
+ /**
696
+ * 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).
697
+ *
698
+ * @classification "P0"
699
+ * @unit "degrees"
700
+ */
701
+ heading: number;
702
+ /**
703
+ * 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.
704
+ *
705
+ * @classification "P0"
706
+ */
707
+ timestamp: string;
708
+ }
709
+
640
710
  /**
641
711
  * AUTO-GENERATED by scripts/codegen.mjs from the corresponding JSON Schema
642
712
  * in ../schemas/. DO NOT EDIT BY HAND — re-run `npm run codegen` instead.
@@ -980,4 +1050,4 @@ interface WebSocketEnvelope {
980
1050
  ts?: string;
981
1051
  }
982
1052
 
983
- export type { AuthOkPayload, AuthPayload, ConnectivityPayload, Drive, DriveEndedPayload, DriveStartedPayload, DriveSummary, DrivesListResponse, ErrorPayload, HeartbeatPayload, MessageType, PingPayload, PongPayload, SubscribePayload, UnsubscribePayload, VehicleListResponse, VehicleState, VehicleSummary, VehicleUpdatePayload, WebSocketEnvelope, WebSocketMessages };
1053
+ export type { AuthOkPayload, AuthPayload, ConnectivityPayload, Drive, DriveEndedPayload, DriveRoute, DriveStartedPayload, DriveSummary, DrivesListResponse, ErrorPayload, HeartbeatPayload, MessageType, PingPayload, PongPayload, RoutePoint, SubscribePayload, UnsubscribePayload, VehicleListResponse, VehicleState, VehicleSummary, VehicleUpdatePayload, WebSocketEnvelope, WebSocketMessages };
package/dist/types.d.ts CHANGED
@@ -637,6 +637,76 @@ interface Drive {
637
637
  createdAt: string;
638
638
  }
639
639
 
640
+ /**
641
+ * AUTO-GENERATED by scripts/codegen.mjs from the corresponding JSON Schema
642
+ * in ../schemas/. DO NOT EDIT BY HAND — re-run `npm run codegen` instead.
643
+ *
644
+ * The x-classification / x-atomic-group / x-unit / x-encrypted custom JSON
645
+ * Schema annotations from the source schemas are folded into the generated
646
+ * TSDoc comments so grep can find them without leaving the editor.
647
+ */
648
+ /**
649
+ * Full GPS polyline for a single completed drive, returned as a bare object by GET /api/drives/{driveId}/route (rest-api.md §7.4, FR-3.3). This is the heavy per-drive route payload deliberately excluded from both DriveSummary (§7.2) and Drive detail (§7.3): the SDK fetches it lazily on tap-through of a drive's map view, NOT eagerly per drive-list row (see §7.4 lazy-fetch guidance — 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 §1.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) — 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.
650
+ */
651
+ interface DriveRoute {
652
+ /**
653
+ * 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).
654
+ *
655
+ * @classification "P0"
656
+ */
657
+ driveId: string;
658
+ /**
659
+ * 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) — 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 — the entire polyline is returned in one response (there is no cursor/limit on this endpoint, unlike the §7.2 drives list).
660
+ *
661
+ * @classification "mixed"
662
+ */
663
+ routePoints: RoutePoint[];
664
+ }
665
+ /**
666
+ * A single GPS sample on a drive's polyline. Matches the `RoutePointRecord` shape from data-classification.md §1.5 — 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.
667
+ *
668
+ * This interface was referenced by `DriveRoute`'s JSON-Schema
669
+ * via the `definition` "RoutePoint".
670
+ */
671
+ interface RoutePoint {
672
+ /**
673
+ * 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.
674
+ *
675
+ * @classification "P1"
676
+ * @unit "degrees"
677
+ * @encrypted-at-rest true
678
+ */
679
+ lat: number;
680
+ /**
681
+ * Longitude in degrees at this point. Emitted as a JSON number (Go float64).
682
+ *
683
+ * @classification "P1"
684
+ * @unit "degrees"
685
+ * @encrypted-at-rest true
686
+ */
687
+ lng: number;
688
+ /**
689
+ * 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).
690
+ *
691
+ * @classification "P0"
692
+ * @unit "mph"
693
+ */
694
+ speed: number;
695
+ /**
696
+ * 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).
697
+ *
698
+ * @classification "P0"
699
+ * @unit "degrees"
700
+ */
701
+ heading: number;
702
+ /**
703
+ * 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.
704
+ *
705
+ * @classification "P0"
706
+ */
707
+ timestamp: string;
708
+ }
709
+
640
710
  /**
641
711
  * AUTO-GENERATED by scripts/codegen.mjs from the corresponding JSON Schema
642
712
  * in ../schemas/. DO NOT EDIT BY HAND — re-run `npm run codegen` instead.
@@ -980,4 +1050,4 @@ interface WebSocketEnvelope {
980
1050
  ts?: string;
981
1051
  }
982
1052
 
983
- export type { AuthOkPayload, AuthPayload, ConnectivityPayload, Drive, DriveEndedPayload, DriveStartedPayload, DriveSummary, DrivesListResponse, ErrorPayload, HeartbeatPayload, MessageType, PingPayload, PongPayload, SubscribePayload, UnsubscribePayload, VehicleListResponse, VehicleState, VehicleSummary, VehicleUpdatePayload, WebSocketEnvelope, WebSocketMessages };
1053
+ export type { AuthOkPayload, AuthPayload, ConnectivityPayload, Drive, DriveEndedPayload, DriveRoute, DriveStartedPayload, DriveSummary, DrivesListResponse, ErrorPayload, HeartbeatPayload, MessageType, PingPayload, PongPayload, RoutePoint, SubscribePayload, UnsubscribePayload, VehicleListResponse, VehicleState, VehicleSummary, VehicleUpdatePayload, WebSocketEnvelope, WebSocketMessages };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myrobotaxi/contracts",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Canonical wire-protocol schemas for the MyRoboTaxi platform. JSON Schema (draft-2020-12) + pre-generated TypeScript types. Consumed by SDKs (TS, Swift) and the Go telemetry server.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -41,6 +41,7 @@
41
41
  "./schemas/vehicle-summary.json": "./schemas/vehicle-summary.schema.json",
42
42
  "./schemas/drives-list.json": "./schemas/drives-list.schema.json",
43
43
  "./schemas/drive-detail.json": "./schemas/drive-detail.schema.json",
44
+ "./schemas/drive-route.json": "./schemas/drive-route.schema.json",
44
45
  "./schemas/ws-messages.json": "./schemas/ws-messages.schema.json",
45
46
  "./schemas/ws-envelope.json": "./schemas/ws-envelope.schema.json"
46
47
  },
@@ -0,0 +1,78 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://myrobotaxi.com/schemas/drive-route.schema.json",
4
+ "title": "DriveRoute",
5
+ "description": "Full GPS polyline for a single completed drive, returned as a bare object by GET /api/drives/{driveId}/route (rest-api.md §7.4, FR-3.3). This is the heavy per-drive route payload deliberately excluded from both DriveSummary (§7.2) and Drive detail (§7.3): the SDK fetches it lazily on tap-through of a drive's map view, NOT eagerly per drive-list row (see §7.4 lazy-fetch guidance — 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 §1.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) — 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.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["driveId", "routePoints"],
9
+ "properties": {
10
+ "driveId": {
11
+ "type": "string",
12
+ "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).",
13
+ "x-classification": "P0",
14
+ "examples": ["clmno9876543210zyxw0001"]
15
+ },
16
+ "routePoints": {
17
+ "type": "array",
18
+ "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) — 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 — the entire polyline is returned in one response (there is no cursor/limit on this endpoint, unlike the §7.2 drives list).",
19
+ "x-classification": "mixed",
20
+ "items": { "$ref": "#/$defs/RoutePoint" }
21
+ }
22
+ },
23
+ "$defs": {
24
+ "RoutePoint": {
25
+ "title": "RoutePoint",
26
+ "description": "A single GPS sample on a drive's polyline. Matches the `RoutePointRecord` shape from data-classification.md §1.5 — 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.",
27
+ "type": "object",
28
+ "additionalProperties": false,
29
+ "required": ["lat", "lng", "speed", "heading", "timestamp"],
30
+ "properties": {
31
+ "lat": {
32
+ "type": "number",
33
+ "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.",
34
+ "x-classification": "P1",
35
+ "x-encrypted-at-rest": true,
36
+ "x-unit": "degrees",
37
+ "minimum": -90,
38
+ "maximum": 90,
39
+ "examples": [37.7749]
40
+ },
41
+ "lng": {
42
+ "type": "number",
43
+ "description": "Longitude in degrees at this point. Emitted as a JSON number (Go float64).",
44
+ "x-classification": "P1",
45
+ "x-encrypted-at-rest": true,
46
+ "x-unit": "degrees",
47
+ "minimum": -180,
48
+ "maximum": 180,
49
+ "examples": [-122.4194]
50
+ },
51
+ "speed": {
52
+ "type": "number",
53
+ "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).",
54
+ "x-classification": "P0",
55
+ "x-unit": "mph",
56
+ "minimum": 0,
57
+ "examples": [15]
58
+ },
59
+ "heading": {
60
+ "type": "number",
61
+ "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).",
62
+ "x-classification": "P0",
63
+ "x-unit": "degrees",
64
+ "minimum": 0,
65
+ "maximum": 360,
66
+ "examples": [175]
67
+ },
68
+ "timestamp": {
69
+ "type": "string",
70
+ "format": "date-time",
71
+ "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.",
72
+ "x-classification": "P0",
73
+ "examples": ["2026-04-13T18:22:00Z"]
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }