@myrobotaxi/contracts 0.1.4 → 0.3.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/index.cjs +117 -4
- 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 +117 -4
- package/dist/index.js.map +1 -1
- package/dist/types.d.cts +99 -5
- package/dist/types.d.ts +99 -5
- package/package.json +2 -1
- package/schemas/vehicle-summary.schema.json +108 -0
- package/schemas/ws-messages.schema.json +6 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AuthOkPayload, AuthPayload, ConnectivityPayload, DriveEndedPayload, DriveStartedPayload, ErrorPayload, HeartbeatPayload, MessageType, PingPayload, PongPayload, SubscribePayload, UnsubscribePayload, VehicleState, VehicleUpdatePayload, WebSocketEnvelope, WebSocketMessages } from './types.cjs';
|
|
1
|
+
export { AuthOkPayload, AuthPayload, ConnectivityPayload, DriveEndedPayload, DriveStartedPayload, ErrorPayload, HeartbeatPayload, MessageType, PingPayload, PongPayload, SubscribePayload, UnsubscribePayload, VehicleListResponse, VehicleState, VehicleSummary, VehicleUpdatePayload, WebSocketEnvelope, WebSocketMessages } from './types.cjs';
|
|
2
2
|
|
|
3
3
|
declare const schemas: {
|
|
4
4
|
readonly vehicleState: {
|
|
@@ -284,6 +284,104 @@ declare const schemas: {
|
|
|
284
284
|
originLongitude: string[];
|
|
285
285
|
};
|
|
286
286
|
};
|
|
287
|
+
readonly vehicleSummary: {
|
|
288
|
+
$schema: string;
|
|
289
|
+
$id: string;
|
|
290
|
+
title: string;
|
|
291
|
+
description: string;
|
|
292
|
+
type: string;
|
|
293
|
+
additionalProperties: boolean;
|
|
294
|
+
required: string[];
|
|
295
|
+
properties: {
|
|
296
|
+
items: {
|
|
297
|
+
type: string;
|
|
298
|
+
description: string;
|
|
299
|
+
items: {
|
|
300
|
+
$ref: string;
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
$defs: {
|
|
305
|
+
VehicleSummary: {
|
|
306
|
+
title: string;
|
|
307
|
+
description: string;
|
|
308
|
+
type: string;
|
|
309
|
+
additionalProperties: boolean;
|
|
310
|
+
required: string[];
|
|
311
|
+
properties: {
|
|
312
|
+
vehicleId: {
|
|
313
|
+
type: string;
|
|
314
|
+
description: string;
|
|
315
|
+
"x-classification": string;
|
|
316
|
+
examples: string[];
|
|
317
|
+
};
|
|
318
|
+
name: {
|
|
319
|
+
type: string;
|
|
320
|
+
description: string;
|
|
321
|
+
"x-classification": string;
|
|
322
|
+
examples: string[];
|
|
323
|
+
};
|
|
324
|
+
model: {
|
|
325
|
+
type: string;
|
|
326
|
+
description: string;
|
|
327
|
+
"x-classification": string;
|
|
328
|
+
examples: string[];
|
|
329
|
+
};
|
|
330
|
+
year: {
|
|
331
|
+
type: string;
|
|
332
|
+
description: string;
|
|
333
|
+
"x-classification": string;
|
|
334
|
+
examples: number[];
|
|
335
|
+
};
|
|
336
|
+
color: {
|
|
337
|
+
type: string;
|
|
338
|
+
description: string;
|
|
339
|
+
"x-classification": string;
|
|
340
|
+
examples: string[];
|
|
341
|
+
};
|
|
342
|
+
vinLast4: {
|
|
343
|
+
type: string;
|
|
344
|
+
description: string;
|
|
345
|
+
"x-classification": string;
|
|
346
|
+
examples: string[];
|
|
347
|
+
};
|
|
348
|
+
status: {
|
|
349
|
+
type: string;
|
|
350
|
+
enum: string[];
|
|
351
|
+
description: string;
|
|
352
|
+
"x-classification": string;
|
|
353
|
+
};
|
|
354
|
+
chargeLevel: {
|
|
355
|
+
type: string;
|
|
356
|
+
description: string;
|
|
357
|
+
"x-classification": string;
|
|
358
|
+
"x-unit": string;
|
|
359
|
+
minimum: number;
|
|
360
|
+
maximum: number;
|
|
361
|
+
};
|
|
362
|
+
estimatedRange: {
|
|
363
|
+
type: string;
|
|
364
|
+
description: string;
|
|
365
|
+
"x-classification": string;
|
|
366
|
+
"x-unit": string;
|
|
367
|
+
minimum: number;
|
|
368
|
+
};
|
|
369
|
+
lastUpdated: {
|
|
370
|
+
type: string;
|
|
371
|
+
format: string;
|
|
372
|
+
description: string;
|
|
373
|
+
"x-classification": string;
|
|
374
|
+
};
|
|
375
|
+
role: {
|
|
376
|
+
type: string;
|
|
377
|
+
enum: string[];
|
|
378
|
+
description: string;
|
|
379
|
+
"x-classification": string;
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
};
|
|
287
385
|
readonly wsMessages: {
|
|
288
386
|
$schema: string;
|
|
289
387
|
$id: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AuthOkPayload, AuthPayload, ConnectivityPayload, DriveEndedPayload, DriveStartedPayload, ErrorPayload, HeartbeatPayload, MessageType, PingPayload, PongPayload, SubscribePayload, UnsubscribePayload, VehicleState, VehicleUpdatePayload, WebSocketEnvelope, WebSocketMessages } from './types.js';
|
|
1
|
+
export { AuthOkPayload, AuthPayload, ConnectivityPayload, DriveEndedPayload, DriveStartedPayload, ErrorPayload, HeartbeatPayload, MessageType, PingPayload, PongPayload, SubscribePayload, UnsubscribePayload, VehicleListResponse, VehicleState, VehicleSummary, VehicleUpdatePayload, WebSocketEnvelope, WebSocketMessages } from './types.js';
|
|
2
2
|
|
|
3
3
|
declare const schemas: {
|
|
4
4
|
readonly vehicleState: {
|
|
@@ -284,6 +284,104 @@ declare const schemas: {
|
|
|
284
284
|
originLongitude: string[];
|
|
285
285
|
};
|
|
286
286
|
};
|
|
287
|
+
readonly vehicleSummary: {
|
|
288
|
+
$schema: string;
|
|
289
|
+
$id: string;
|
|
290
|
+
title: string;
|
|
291
|
+
description: string;
|
|
292
|
+
type: string;
|
|
293
|
+
additionalProperties: boolean;
|
|
294
|
+
required: string[];
|
|
295
|
+
properties: {
|
|
296
|
+
items: {
|
|
297
|
+
type: string;
|
|
298
|
+
description: string;
|
|
299
|
+
items: {
|
|
300
|
+
$ref: string;
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
$defs: {
|
|
305
|
+
VehicleSummary: {
|
|
306
|
+
title: string;
|
|
307
|
+
description: string;
|
|
308
|
+
type: string;
|
|
309
|
+
additionalProperties: boolean;
|
|
310
|
+
required: string[];
|
|
311
|
+
properties: {
|
|
312
|
+
vehicleId: {
|
|
313
|
+
type: string;
|
|
314
|
+
description: string;
|
|
315
|
+
"x-classification": string;
|
|
316
|
+
examples: string[];
|
|
317
|
+
};
|
|
318
|
+
name: {
|
|
319
|
+
type: string;
|
|
320
|
+
description: string;
|
|
321
|
+
"x-classification": string;
|
|
322
|
+
examples: string[];
|
|
323
|
+
};
|
|
324
|
+
model: {
|
|
325
|
+
type: string;
|
|
326
|
+
description: string;
|
|
327
|
+
"x-classification": string;
|
|
328
|
+
examples: string[];
|
|
329
|
+
};
|
|
330
|
+
year: {
|
|
331
|
+
type: string;
|
|
332
|
+
description: string;
|
|
333
|
+
"x-classification": string;
|
|
334
|
+
examples: number[];
|
|
335
|
+
};
|
|
336
|
+
color: {
|
|
337
|
+
type: string;
|
|
338
|
+
description: string;
|
|
339
|
+
"x-classification": string;
|
|
340
|
+
examples: string[];
|
|
341
|
+
};
|
|
342
|
+
vinLast4: {
|
|
343
|
+
type: string;
|
|
344
|
+
description: string;
|
|
345
|
+
"x-classification": string;
|
|
346
|
+
examples: string[];
|
|
347
|
+
};
|
|
348
|
+
status: {
|
|
349
|
+
type: string;
|
|
350
|
+
enum: string[];
|
|
351
|
+
description: string;
|
|
352
|
+
"x-classification": string;
|
|
353
|
+
};
|
|
354
|
+
chargeLevel: {
|
|
355
|
+
type: string;
|
|
356
|
+
description: string;
|
|
357
|
+
"x-classification": string;
|
|
358
|
+
"x-unit": string;
|
|
359
|
+
minimum: number;
|
|
360
|
+
maximum: number;
|
|
361
|
+
};
|
|
362
|
+
estimatedRange: {
|
|
363
|
+
type: string;
|
|
364
|
+
description: string;
|
|
365
|
+
"x-classification": string;
|
|
366
|
+
"x-unit": string;
|
|
367
|
+
minimum: number;
|
|
368
|
+
};
|
|
369
|
+
lastUpdated: {
|
|
370
|
+
type: string;
|
|
371
|
+
format: string;
|
|
372
|
+
description: string;
|
|
373
|
+
"x-classification": string;
|
|
374
|
+
};
|
|
375
|
+
role: {
|
|
376
|
+
type: string;
|
|
377
|
+
enum: string[];
|
|
378
|
+
description: string;
|
|
379
|
+
"x-classification": string;
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
};
|
|
287
385
|
readonly wsMessages: {
|
|
288
386
|
$schema: string;
|
|
289
387
|
$id: string;
|
package/dist/index.js
CHANGED
|
@@ -343,6 +343,116 @@ var vehicle_state_schema_default = {
|
|
|
343
343
|
}
|
|
344
344
|
};
|
|
345
345
|
|
|
346
|
+
// schemas/vehicle-summary.schema.json
|
|
347
|
+
var vehicle_summary_schema_default = {
|
|
348
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
349
|
+
$id: "https://myrobotaxi.com/schemas/vehicle-summary.schema.json",
|
|
350
|
+
title: "VehicleListResponse",
|
|
351
|
+
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 \xA77.0 and intentionally absent in v1. The envelope itself is part of the wire contract: consumers MUST NOT strip it silently.",
|
|
352
|
+
type: "object",
|
|
353
|
+
additionalProperties: false,
|
|
354
|
+
required: ["items"],
|
|
355
|
+
properties: {
|
|
356
|
+
items: {
|
|
357
|
+
type: "array",
|
|
358
|
+
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 \u2014 see rest-api.md \xA77.0 RBAC v1 implementation note).",
|
|
359
|
+
items: { $ref: "#/$defs/VehicleSummary" }
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
$defs: {
|
|
363
|
+
VehicleSummary: {
|
|
364
|
+
title: "VehicleSummary",
|
|
365
|
+
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.",
|
|
366
|
+
type: "object",
|
|
367
|
+
additionalProperties: false,
|
|
368
|
+
required: [
|
|
369
|
+
"vehicleId",
|
|
370
|
+
"name",
|
|
371
|
+
"model",
|
|
372
|
+
"year",
|
|
373
|
+
"color",
|
|
374
|
+
"vinLast4",
|
|
375
|
+
"status",
|
|
376
|
+
"chargeLevel",
|
|
377
|
+
"estimatedRange",
|
|
378
|
+
"lastUpdated",
|
|
379
|
+
"role"
|
|
380
|
+
],
|
|
381
|
+
properties: {
|
|
382
|
+
vehicleId: {
|
|
383
|
+
type: "string",
|
|
384
|
+
description: "Opaque database identifier (cuid). NOT the VIN. All SDK API calls use this ID (FR-4.2). Matches VehicleState.vehicleId.",
|
|
385
|
+
"x-classification": "P0",
|
|
386
|
+
examples: ["clxyz1234567890abcdef"]
|
|
387
|
+
},
|
|
388
|
+
name: {
|
|
389
|
+
type: "string",
|
|
390
|
+
description: "User-assigned vehicle name from DB Vehicle.name. Matches VehicleState.name.",
|
|
391
|
+
"x-classification": "P0",
|
|
392
|
+
examples: ["Optimus"]
|
|
393
|
+
},
|
|
394
|
+
model: {
|
|
395
|
+
type: "string",
|
|
396
|
+
description: "Vehicle model (e.g., 'Model 3', 'Model Y'). Sourced from DB Vehicle.model. Matches VehicleState.model.",
|
|
397
|
+
"x-classification": "P0",
|
|
398
|
+
examples: ["Model 3"]
|
|
399
|
+
},
|
|
400
|
+
year: {
|
|
401
|
+
type: "integer",
|
|
402
|
+
description: "Model year. Sourced from DB Vehicle.year. Matches VehicleState.year.",
|
|
403
|
+
"x-classification": "P0",
|
|
404
|
+
examples: [2024]
|
|
405
|
+
},
|
|
406
|
+
color: {
|
|
407
|
+
type: "string",
|
|
408
|
+
description: "Vehicle exterior color. Sourced from DB Vehicle.color. Matches VehicleState.color.",
|
|
409
|
+
"x-classification": "P0",
|
|
410
|
+
examples: ["Midnight Silver Metallic"]
|
|
411
|
+
},
|
|
412
|
+
vinLast4: {
|
|
413
|
+
type: "string",
|
|
414
|
+
description: "Last 4 characters of the vehicle's 17-character VIN. The full VIN is never emitted on the list endpoint \u2014 vinLast4 is sufficient for human disambiguation in the catalog UI without exposing the full identifier. Empty string when the VIN is unknown.",
|
|
415
|
+
"x-classification": "P1",
|
|
416
|
+
examples: ["3F5A"]
|
|
417
|
+
},
|
|
418
|
+
status: {
|
|
419
|
+
type: "string",
|
|
420
|
+
enum: ["driving", "parked", "charging", "offline", "in_service"],
|
|
421
|
+
description: "Derived vehicle status snapshot at the time of the last telemetry update. Same enum as VehicleState.status.",
|
|
422
|
+
"x-classification": "P0"
|
|
423
|
+
},
|
|
424
|
+
chargeLevel: {
|
|
425
|
+
type: "integer",
|
|
426
|
+
description: "Battery state of charge snapshot at the time of the last telemetry update. Same semantics as VehicleState.chargeLevel.",
|
|
427
|
+
"x-classification": "P0",
|
|
428
|
+
"x-unit": "percent",
|
|
429
|
+
minimum: 0,
|
|
430
|
+
maximum: 100
|
|
431
|
+
},
|
|
432
|
+
estimatedRange: {
|
|
433
|
+
type: "integer",
|
|
434
|
+
description: "Estimated remaining driving range snapshot at the time of the last telemetry update. Same semantics as VehicleState.estimatedRange.",
|
|
435
|
+
"x-classification": "P0",
|
|
436
|
+
"x-unit": "miles",
|
|
437
|
+
minimum: 0
|
|
438
|
+
},
|
|
439
|
+
lastUpdated: {
|
|
440
|
+
type: "string",
|
|
441
|
+
format: "date-time",
|
|
442
|
+
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').",
|
|
443
|
+
"x-classification": "P0"
|
|
444
|
+
},
|
|
445
|
+
role: {
|
|
446
|
+
type: "string",
|
|
447
|
+
enum: ["owner", "viewer"],
|
|
448
|
+
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 \u2014 see rest-api.md \xA77.0 RBAC v1 implementation note.",
|
|
449
|
+
"x-classification": "P0"
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
|
|
346
456
|
// schemas/ws-messages.schema.json
|
|
347
457
|
var ws_messages_schema_default = {
|
|
348
458
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
@@ -559,7 +669,7 @@ var ws_messages_schema_default = {
|
|
|
559
669
|
properties: {
|
|
560
670
|
code: {
|
|
561
671
|
type: "string",
|
|
562
|
-
description: "Stable typed error code
|
|
672
|
+
description: "Stable typed error code. Shared enum across the WebSocket and REST transports so the SDK's CoreError is a single union (rest-api.md \xA74.1.1, \xA74.1.1.a; ws catalog websocket-protocol.md \xA76.1.1). Consumer SDKs map these to typed errors per FR-7.1 and MUST NOT string-match on the sibling `message` field. WS emits today: `auth_failed`, `auth_timeout`; the remaining WS values are PLANNED (divergences DV-02 / DV-07 / DV-08 in websocket-protocol.md \xA710). `not_found` and `invalid_request` are REST-only on the wire (the WS path enforces ownership via silent filtering and has no structured request bodies, rest-api.md \xA74.1.1.a) but are members of this shared enum by mandate so the SDK union is one enum across transports \u2014 they are NOT a WS drift (DV-20 enum slice). `service_unavailable` is intentionally NOT in this enum: it is REST-only and the WS 503 analogue is a close code, not a typed frame (rest-api.md:258); the SDK declares it as a REST-only variant on its side. `rate_limited` has two carriers: (a) HTTP 429 on the WS upgrade (per-IP, pre-auth) and (b) an `error` frame paired with WS close 4003 (per-user, post-auth) \u2014 the SDK treats both as the same typed error with the extended backoff in websocket-protocol.md \xA76.1.1 / \xA77.1.",
|
|
563
673
|
enum: [
|
|
564
674
|
"auth_failed",
|
|
565
675
|
"auth_timeout",
|
|
@@ -567,7 +677,9 @@ var ws_messages_schema_default = {
|
|
|
567
677
|
"vehicle_not_owned",
|
|
568
678
|
"rate_limited",
|
|
569
679
|
"internal_error",
|
|
570
|
-
"snapshot_required"
|
|
680
|
+
"snapshot_required",
|
|
681
|
+
"not_found",
|
|
682
|
+
"invalid_request"
|
|
571
683
|
],
|
|
572
684
|
"x-classification": "P0"
|
|
573
685
|
},
|
|
@@ -578,8 +690,8 @@ var ws_messages_schema_default = {
|
|
|
578
690
|
},
|
|
579
691
|
subCode: {
|
|
580
692
|
type: "string",
|
|
581
|
-
description: "Optional typed sub-code for branching consumer-visible UI when the primary code is ambiguous across carriers.
|
|
582
|
-
enum: ["device_cap"],
|
|
693
|
+
description: "Optional typed sub-code for branching consumer-visible UI when the primary code is ambiguous across carriers. v1 enum: `device_cap` (WS-only) and `reauth_required` (REST-only). `device_cap`: WS server rejected a connection because it breached the per-user cap (post-auth, close 4003); the error frame carries `subCode: \"device_cap\"` so SDKs surface an actionable 'Too many devices signed in' message instead of a generic rate-limit toast (per-IP HTTP 429 breaches carry no sub-code \u2014 see websocket-protocol.md \xA76.1.1). `reauth_required`: REST-only, emitted with `code: auth_failed` by rest-api.md \xA77.6 / \xA77.7 when the bearer token is valid but the most recent fresh OAuth sign-in is older than the recent-auth window \u2014 the SDK MUST surface this to the consumer's auth layer to trigger a fresh interactive sign-in and MUST NOT silently retry via getToken() (a silent refresh cannot advance the `auth_time` claim). Declared on this shared enum for single-union SDK typing; the WS transport never emits `reauth_required`.",
|
|
694
|
+
enum: ["device_cap", "reauth_required"],
|
|
583
695
|
"x-classification": "P0"
|
|
584
696
|
}
|
|
585
697
|
}
|
|
@@ -710,6 +822,7 @@ var ws_envelope_schema_default = {
|
|
|
710
822
|
// src/index.ts
|
|
711
823
|
var schemas = {
|
|
712
824
|
vehicleState: vehicle_state_schema_default,
|
|
825
|
+
vehicleSummary: vehicle_summary_schema_default,
|
|
713
826
|
wsMessages: ws_messages_schema_default,
|
|
714
827
|
wsEnvelope: ws_envelope_schema_default
|
|
715
828
|
};
|