tesla-fleet-api 0.2.2 → 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.
Files changed (192) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +22 -0
  2. package/dist/_virtual/_rolldown/runtime.mjs +12 -0
  3. package/dist/charging.cjs +53 -0
  4. package/dist/charging.d.cts +31 -0
  5. package/dist/charging.d.mts +30 -0
  6. package/dist/charging.mjs +53 -0
  7. package/dist/commands.cjs +802 -0
  8. package/dist/commands.d.cts +350 -0
  9. package/dist/commands.d.mts +349 -0
  10. package/dist/commands.mjs +800 -0
  11. package/dist/const.cjs +300 -0
  12. package/dist/const.d.cts +287 -0
  13. package/dist/const.d.mts +287 -0
  14. package/dist/const.mjs +263 -0
  15. package/dist/energy.cjs +137 -0
  16. package/dist/energy.d.cts +95 -0
  17. package/{src/energy.ts → dist/energy.d.mts} +17 -140
  18. package/dist/energy.mjs +137 -0
  19. package/dist/energyspecific.cjs +99 -0
  20. package/dist/energyspecific.d.cts +78 -0
  21. package/dist/energyspecific.d.mts +77 -0
  22. package/dist/energyspecific.mjs +99 -0
  23. package/dist/exceptions.cjs +1487 -0
  24. package/dist/exceptions.d.cts +1142 -0
  25. package/dist/exceptions.d.mts +1142 -0
  26. package/dist/exceptions.mjs +1324 -0
  27. package/dist/index.cjs +226 -0
  28. package/dist/index.d.cts +14 -0
  29. package/dist/index.d.mts +14 -0
  30. package/dist/index.mjs +14 -0
  31. package/dist/partner.cjs +32 -0
  32. package/dist/partner.d.cts +24 -0
  33. package/dist/partner.d.mts +23 -0
  34. package/dist/partner.mjs +32 -0
  35. package/dist/router.cjs +0 -0
  36. package/dist/router.d.cts +1 -0
  37. package/dist/router.d.mts +1 -0
  38. package/dist/router.mjs +1 -0
  39. package/dist/signing/crypto.cjs +31 -0
  40. package/dist/signing/crypto.mjs +27 -0
  41. package/dist/signing/session.cjs +112 -0
  42. package/dist/signing/session.d.cts +69 -0
  43. package/dist/signing/session.d.mts +69 -0
  44. package/dist/signing/session.mjs +110 -0
  45. package/dist/tariff.cjs +292 -0
  46. package/dist/{tariff.d.ts → tariff.d.cts} +17 -17
  47. package/dist/tariff.d.mts +29 -0
  48. package/dist/tariff.mjs +291 -0
  49. package/dist/teslafleetapi.cjs +125 -0
  50. package/dist/teslafleetapi.d.cts +64 -0
  51. package/dist/teslafleetapi.d.mts +64 -0
  52. package/dist/teslafleetapi.mjs +125 -0
  53. package/dist/teslemetry.cjs +36 -0
  54. package/dist/teslemetry.d.cts +23 -0
  55. package/dist/teslemetry.d.mts +23 -0
  56. package/dist/teslemetry.mjs +36 -0
  57. package/dist/tessie.cjs +34 -0
  58. package/dist/tessie.d.cts +23 -0
  59. package/dist/tessie.d.mts +23 -0
  60. package/dist/tessie.mjs +34 -0
  61. package/dist/types/commands.d.cts +28 -0
  62. package/dist/types/commands.d.mts +28 -0
  63. package/dist/types/live_status.d.cts +30 -0
  64. package/dist/types/live_status.d.mts +30 -0
  65. package/dist/types/products.d.cts +58 -0
  66. package/dist/types/products.d.mts +58 -0
  67. package/dist/types/responses.d.cts +9 -0
  68. package/dist/types/responses.d.mts +9 -0
  69. package/dist/types/site_info.d.cts +154 -0
  70. package/dist/types/site_info.d.mts +154 -0
  71. package/dist/types/vehicle.d.cts +27 -0
  72. package/dist/types/vehicle.d.mts +27 -0
  73. package/dist/types/vehicle_data.d.cts +278 -0
  74. package/dist/types/vehicle_data.d.mts +278 -0
  75. package/dist/types.cjs +0 -0
  76. package/dist/types.d.cts +9 -0
  77. package/dist/types.d.mts +9 -0
  78. package/dist/types.mjs +1 -0
  79. package/dist/user.cjs +28 -0
  80. package/dist/user.d.cts +17 -0
  81. package/dist/user.d.mts +16 -0
  82. package/dist/user.mjs +28 -0
  83. package/dist/vehicle.cjs +804 -0
  84. package/dist/vehicle.d.cts +550 -0
  85. package/dist/vehicle.d.mts +549 -0
  86. package/dist/vehicle.mjs +804 -0
  87. package/dist/vehiclesigned.cjs +20 -0
  88. package/dist/vehiclesigned.d.cts +14 -0
  89. package/dist/{vehiclesigned.d.ts → vehiclesigned.d.mts} +3 -3
  90. package/dist/vehiclesigned.mjs +20 -0
  91. package/dist/vehiclespecific.cjs +604 -0
  92. package/dist/vehiclespecific.d.cts +433 -0
  93. package/dist/vehiclespecific.d.mts +432 -0
  94. package/dist/vehiclespecific.mjs +604 -0
  95. package/package.json +108 -35
  96. package/dist/charging.d.ts +0 -30
  97. package/dist/charging.js +0 -51
  98. package/dist/charging.js.map +0 -1
  99. package/dist/commands.d.ts +0 -352
  100. package/dist/commands.js +0 -875
  101. package/dist/commands.js.map +0 -1
  102. package/dist/energy.d.ts +0 -94
  103. package/dist/energy.js +0 -125
  104. package/dist/energy.js.map +0 -1
  105. package/dist/energyspecific.d.ts +0 -77
  106. package/dist/energyspecific.js +0 -97
  107. package/dist/energyspecific.js.map +0 -1
  108. package/dist/helpers.d.ts +0 -2
  109. package/dist/helpers.js +0 -10
  110. package/dist/helpers.js.map +0 -1
  111. package/dist/index.d.ts +0 -14
  112. package/dist/index.js +0 -14
  113. package/dist/index.js.map +0 -1
  114. package/dist/partner.d.ts +0 -23
  115. package/dist/partner.js +0 -31
  116. package/dist/partner.js.map +0 -1
  117. package/dist/signing/crypto.d.ts +0 -10
  118. package/dist/signing/crypto.js +0 -26
  119. package/dist/signing/crypto.js.map +0 -1
  120. package/dist/signing/errors.d.ts +0 -29
  121. package/dist/signing/errors.js +0 -40
  122. package/dist/signing/errors.js.map +0 -1
  123. package/dist/signing/session.d.ts +0 -69
  124. package/dist/signing/session.js +0 -102
  125. package/dist/signing/session.js.map +0 -1
  126. package/dist/tariff.js +0 -302
  127. package/dist/tariff.js.map +0 -1
  128. package/dist/teslafleetapi.d.ts +0 -58
  129. package/dist/teslafleetapi.js +0 -120
  130. package/dist/teslafleetapi.js.map +0 -1
  131. package/dist/teslemetry.d.ts +0 -29
  132. package/dist/teslemetry.js +0 -39
  133. package/dist/teslemetry.js.map +0 -1
  134. package/dist/tessie.d.ts +0 -23
  135. package/dist/tessie.js +0 -28
  136. package/dist/tessie.js.map +0 -1
  137. package/dist/types/commands.d.ts +0 -44
  138. package/dist/types/commands.js +0 -11
  139. package/dist/types/commands.js.map +0 -1
  140. package/dist/types/live_status.d.ts +0 -26
  141. package/dist/types/live_status.js +0 -2
  142. package/dist/types/live_status.js.map +0 -1
  143. package/dist/types/products.d.ts +0 -54
  144. package/dist/types/products.js +0 -2
  145. package/dist/types/products.js.map +0 -1
  146. package/dist/types/responses.d.ts +0 -5
  147. package/dist/types/responses.js +0 -2
  148. package/dist/types/responses.js.map +0 -1
  149. package/dist/types/site_info.d.ts +0 -150
  150. package/dist/types/site_info.js +0 -2
  151. package/dist/types/site_info.js.map +0 -1
  152. package/dist/types/vehicle.d.ts +0 -22
  153. package/dist/types/vehicle.js +0 -2
  154. package/dist/types/vehicle.js.map +0 -1
  155. package/dist/types/vehicle_data.d.ts +0 -274
  156. package/dist/types/vehicle_data.js +0 -2
  157. package/dist/types/vehicle_data.js.map +0 -1
  158. package/dist/user.d.ts +0 -16
  159. package/dist/user.js +0 -26
  160. package/dist/user.js.map +0 -1
  161. package/dist/vehicle.d.ts +0 -548
  162. package/dist/vehicle.js +0 -781
  163. package/dist/vehicle.js.map +0 -1
  164. package/dist/vehiclesigned.js +0 -19
  165. package/dist/vehiclesigned.js.map +0 -1
  166. package/dist/vehiclespecific.d.ts +0 -432
  167. package/dist/vehiclespecific.js +0 -601
  168. package/dist/vehiclespecific.js.map +0 -1
  169. package/src/charging.ts +0 -66
  170. package/src/commands.ts +0 -1134
  171. package/src/energyspecific.ts +0 -116
  172. package/src/helpers.ts +0 -11
  173. package/src/index.ts +0 -20
  174. package/src/partner.ts +0 -37
  175. package/src/signing/crypto.ts +0 -29
  176. package/src/signing/errors.ts +0 -50
  177. package/src/signing/session.ts +0 -132
  178. package/src/tariff.ts +0 -375
  179. package/src/teslafleetapi.ts +0 -182
  180. package/src/teslemetry.ts +0 -54
  181. package/src/tessie.ts +0 -42
  182. package/src/types/commands.ts +0 -62
  183. package/src/types/live_status.ts +0 -27
  184. package/src/types/products.ts +0 -61
  185. package/src/types/responses.ts +0 -1
  186. package/src/types/site_info.ts +0 -159
  187. package/src/types/vehicle.ts +0 -23
  188. package/src/types/vehicle_data.ts +0 -286
  189. package/src/user.ts +0 -35
  190. package/src/vehicle.ts +0 -895
  191. package/src/vehiclesigned.ts +0 -20
  192. package/src/vehiclespecific.ts +0 -818
@@ -0,0 +1,1324 @@
1
+ // src/exceptions.ts
2
+ /**
3
+ * Base class for all Tesla exceptions.
4
+ */
5
+ var TeslaFleetError = class extends Error {
6
+ static message = "An unknown error has occurred.";
7
+ static status = null;
8
+ static key = null;
9
+ static code = null;
10
+ data;
11
+ status;
12
+ key;
13
+ code;
14
+ constructor(data = null, status = null, options) {
15
+ const cls = new.target;
16
+ super(cls.message, options);
17
+ this.name = cls.name;
18
+ this.data = data;
19
+ this.status = status || cls.status;
20
+ this.key = cls.key;
21
+ this.code = cls.code;
22
+ }
23
+ };
24
+ /**
25
+ * A request to the API could not be completed: `fetch` rejected (DNS,
26
+ * refused connection, TLS, reset) or the request timed out. The underlying
27
+ * error is kept as `cause`.
28
+ */
29
+ var TeslaFleetConnectionError = class extends TeslaFleetError {
30
+ static message = "Could not connect to the API.";
31
+ };
32
+ /**
33
+ * A cloud REST call was made on a vehicle that is only reachable over Bluetooth.
34
+ */
35
+ var BluetoothCloudUnavailableError = class extends TeslaFleetError {
36
+ static message = "This vehicle is only reachable over Bluetooth; the cloud API is unavailable.";
37
+ };
38
+ /**
39
+ * Bluetooth command timed out waiting for vehicle response.
40
+ */
41
+ var BluetoothTimeout = class extends TeslaFleetError {
42
+ static message = "Bluetooth command timed out waiting for vehicle response.";
43
+ };
44
+ /**
45
+ * A mutating Bluetooth command has an unresolved outcome.
46
+ *
47
+ * The write either completed and its ack was lost, or it entered backend I/O
48
+ * and then failed/timed out in a way that cannot prove whether the vehicle
49
+ * received it. It can also have acknowledged the request without a required
50
+ * physical state check confirming completion. The vehicle may have executed
51
+ * the command - lock/unlock have both been observed to execute despite this
52
+ * error. Treat the outcome as unknown, not failed: verify by reading state
53
+ * back when possible, and never blind-retry or re-issue the same command on
54
+ * another transport, since it may already have run.
55
+ *
56
+ * Extends `BluetoothTimeout` so existing `instanceof BluetoothTimeout`
57
+ * handling still catches it, while remaining distinguishable from it (and
58
+ * from `BluetoothTransportError`, the provable pre-submission transport
59
+ * failure) via `unconfirmed` - e.g. a BLE-primary/cloud-fallback router should
60
+ * not fail over on this error, since failing over risks double-executing the
61
+ * command.
62
+ */
63
+ var BluetoothUnconfirmedCommand = class extends BluetoothTimeout {
64
+ static message = "Bluetooth command outcome could not be confirmed after submission; it may have executed anyway.";
65
+ unconfirmed = true;
66
+ };
67
+ /**
68
+ * A mutating Bluetooth command was proven NOT to have taken effect.
69
+ *
70
+ * Unlike `BluetoothUnconfirmedCommand` (ack lost, outcome unknown), this
71
+ * means a state check - a `confirmation="verify"` post-timeout read, or
72
+ * the vehicle's own status broadcast still showing a different value once
73
+ * the whole confirmation window elapsed - actively contradicted the
74
+ * requested end state. That makes it safe to fail over: a router replaying the
75
+ * command on a fallback transport is not at risk of double-executing an
76
+ * already-applied command, because this one demonstrably did not apply.
77
+ * Deliberately does NOT subclass `BluetoothTimeout`/
78
+ * `BluetoothUnconfirmedCommand` so a fallback router's per-command
79
+ * failover (which only special-cases the ambiguous case) treats it like any
80
+ * other ordinary failure and tries the next backend.
81
+ */
82
+ var BluetoothCommandFailed = class extends TeslaFleetError {
83
+ static message = "Bluetooth command was proven not to have taken effect.";
84
+ };
85
+ /**
86
+ * The Bluetooth transport failed provably before the write reached the vehicle.
87
+ *
88
+ * Covers connect, notify-subscribe, and GATT characteristic-resolution
89
+ * failures - all raised by the local BLE stack before any bytes go out over
90
+ * the air, so a fallback router can safely retry the same command
91
+ * elsewhere. A GATT write that entered backend I/O and then failed or timed
92
+ * out is delivery-ambiguous instead (the write may have reached the
93
+ * vehicle) and raises `BluetoothTimeout`/`BluetoothUnconfirmedCommand`,
94
+ * not this class - see those exceptions.
95
+ */
96
+ var BluetoothTransportError = class extends TeslaFleetError {
97
+ static message = "The Bluetooth transport failed before a vehicle response could be awaited.";
98
+ };
99
+ /**
100
+ * The response from the server was not JSON.
101
+ */
102
+ var ResponseError = class extends TeslaFleetError {
103
+ static message = "The response from the server was not JSON.";
104
+ };
105
+ /**
106
+ * The data request or command is unknown.
107
+ */
108
+ var InvalidCommand = class extends TeslaFleetError {
109
+ static message = "The data request or command is unknown.";
110
+ static status = 400;
111
+ static key = "invalid_command";
112
+ };
113
+ /**
114
+ * A field in the input is not valid.
115
+ */
116
+ var InvalidField = class extends TeslaFleetError {
117
+ static message = "A field in the input is not valid.";
118
+ static status = 400;
119
+ static key = "invalid_field";
120
+ };
121
+ /**
122
+ * The request body is not valid, a description giving a more specific error message may be returned.
123
+ */
124
+ var InvalidRequest = class extends TeslaFleetError {
125
+ static message = "The request body is not valid";
126
+ static status = 400;
127
+ static key = "invalid_request";
128
+ };
129
+ /**
130
+ * The "code" in request body is invalid, generate a new one and try again.
131
+ */
132
+ var InvalidAuthCode = class extends TeslaFleetError {
133
+ static message = "The 'code' in request body is invalid, generate a new one and try again.";
134
+ static status = 400;
135
+ static key = "invalid_auth_code";
136
+ };
137
+ /**
138
+ * Invalid redirect URI/URL. The authorize redirect URI and token redirect URI must match.
139
+ */
140
+ var InvalidRedirectUrl = class extends TeslaFleetError {
141
+ static message = "Invalid redirect URI/URL. The authorize redirect URI and token redirect URI must match.";
142
+ static status = 400;
143
+ static key = "invalid_redirect_url";
144
+ };
145
+ /**
146
+ * We don't recognize this client_id and client_secret combination. Use the client_id and client_secret that has been granted for the application.
147
+ */
148
+ var UnauthorizedClient = class extends TeslaFleetError {
149
+ static message = "We don't recognize this client_id and client_secret combination. Use the client_id and client_secret that has been granted for the application.";
150
+ static status = 400;
151
+ static key = "unauthorized_client";
152
+ };
153
+ /**
154
+ * The vehicle has turned off remote access.
155
+ */
156
+ var MobileAccessDisabled = class extends TeslaFleetError {
157
+ static message = "The vehicle has turned off remote access.";
158
+ static status = 401;
159
+ static key = "mobile_access_disabled";
160
+ };
161
+ /**
162
+ * Third party specific error when no access token is provided.
163
+ */
164
+ var MissingToken = class extends TeslaFleetError {
165
+ static message = "Missing access token.";
166
+ static status = 401;
167
+ };
168
+ /**
169
+ * Teslemetry specific error when no access token is provided.
170
+ */
171
+ var MissingTeslemetryToken = class extends MissingToken {
172
+ static key = "missing_token";
173
+ };
174
+ /**
175
+ * Tessie specific error when no access token is provided.
176
+ */
177
+ var MissingTessieToken = class extends MissingToken {
178
+ static key = "Access token is required";
179
+ };
180
+ /**
181
+ * Third party specific error for invalid access token.
182
+ */
183
+ var InvalidToken = class extends TeslaFleetError {
184
+ static message = "Invalid access token.";
185
+ static status = 401;
186
+ };
187
+ /**
188
+ * Teslemetry specific error for invalid access token.
189
+ */
190
+ var InvalidTeslemetryToken = class extends InvalidToken {
191
+ static key = "invalid_token";
192
+ };
193
+ /**
194
+ * Tessie specific error for invalid access token.
195
+ */
196
+ var InvalidTessieToken = class extends InvalidToken {
197
+ static key = "Invalid access token";
198
+ };
199
+ /**
200
+ * The OAuth token is invalid.
201
+ */
202
+ var OAuthInvalid = class extends TeslaFleetError {
203
+ static message = "The OAuth token is invalid.";
204
+ static status = 401;
205
+ static key = "invalid bearer token";
206
+ };
207
+ /**
208
+ * The OAuth token has expired.
209
+ */
210
+ var OAuthExpired = class extends TeslaFleetError {
211
+ static message = "The OAuth token has expired.";
212
+ static status = 401;
213
+ static key = "token expired (401)";
214
+ };
215
+ /**
216
+ * Teslemetry OAuth dynamic client registration (RFC 7591) failed.
217
+ *
218
+ * Covers a transport/timeout failure reaching the registration endpoint, a
219
+ * non-2xx response, a response body that isn't valid JSON, and a
220
+ * well-formed response missing a usable `client_id`. The specific reason
221
+ * is carried in `data`.
222
+ */
223
+ var TeslemetryRegistrationError = class extends TeslaFleetError {
224
+ static message = "Teslemetry dynamic client registration failed.";
225
+ };
226
+ /**
227
+ * The user has reset their password and a new auth code is required, or the refresh_token has already been used.
228
+ */
229
+ var LoginRequired = class extends TeslaFleetError {
230
+ static message = "The user has reset their password and a new auth code is required, or the refresh_token has already been used.";
231
+ static status = 401;
232
+ static key = "login_required";
233
+ };
234
+ /**
235
+ * Payment is required in order to use the API (non-free account only).
236
+ */
237
+ var PaymentRequired = class extends TeslaFleetError {
238
+ static message = "Payment is required in order to use the API (non-free account only).";
239
+ static status = 402;
240
+ };
241
+ /**
242
+ * Subscription is required in order to use Teslemetry.
243
+ */
244
+ var SubscriptionRequired = class extends TeslaFleetError {
245
+ static message = "Subscription is required in order to use Teslemetry.";
246
+ static status = 402;
247
+ static key = "subscription_required";
248
+ };
249
+ /**
250
+ * Subscription is required in order to use Teslemetry.
251
+ */
252
+ var VehicleSubscriptionRequired = class extends TeslaFleetError {
253
+ static message = "Vehicle data subscription is required to make this request.";
254
+ static status = 402;
255
+ static key = "vehicle_subscription_required";
256
+ };
257
+ /**
258
+ * Account has insufficient credits to make this request.
259
+ */
260
+ var InsufficientCredits = class extends TeslaFleetError {
261
+ static message = "Account has insufficient command credits to make this request.";
262
+ static status = 402;
263
+ static key = "insufficient_credits";
264
+ };
265
+ /**
266
+ * Access to this resource is not authorized, developers should check required Scope.
267
+ */
268
+ var Forbidden = class extends TeslaFleetError {
269
+ static message = "Access to this resource is not authorized, developers should check required Scope.";
270
+ static status = 403;
271
+ static key = "Unauthorized missing scopes";
272
+ };
273
+ /**
274
+ * The requested scopes are not granted.
275
+ */
276
+ var InvalidScope = class extends TeslaFleetError {
277
+ static message = "The requested scopes are not granted.";
278
+ static status = 403;
279
+ static key = "invalid_scope";
280
+ };
281
+ /**
282
+ * The vehicle is unsupported.
283
+ */
284
+ var UnsupportedVehicle = class extends TeslaFleetError {
285
+ static message = "The vehicle is unsupported.";
286
+ static status = 403;
287
+ static key = "unsupported vehicle";
288
+ };
289
+ /**
290
+ * The requested resource does not exist.
291
+ */
292
+ var NotFound = class extends TeslaFleetError {
293
+ static message = "The requested resource does not exist.";
294
+ static status = 404;
295
+ };
296
+ /**
297
+ * The HTTP method is not allowed.
298
+ */
299
+ var InvalidMethod = class extends TeslaFleetError {
300
+ static message = "The HTTP method is not allowed.";
301
+ static status = 405;
302
+ static key = "invalid_method";
303
+ };
304
+ /**
305
+ * The operation is not allowed.
306
+ */
307
+ var NotAllowed = class extends TeslaFleetError {
308
+ static message = "The operation is not allowed.";
309
+ static status = 405;
310
+ };
311
+ /**
312
+ * The HTTP request does not have a Content-Type header set to application/json.
313
+ */
314
+ var NotAcceptable = class extends TeslaFleetError {
315
+ static message = "The HTTP request does not have a Content-Type header set to application/json.";
316
+ static status = 406;
317
+ };
318
+ /**
319
+ * The vehicle is not "online.
320
+ */
321
+ var VehicleOffline = class extends TeslaFleetError {
322
+ static message = "The vehicle is not 'online'.";
323
+ static status = 408;
324
+ };
325
+ /**
326
+ * A condition has not been met to process the request.
327
+ */
328
+ var PreconditionFailed = class extends TeslaFleetError {
329
+ static message = "A condition has not been met to process the request.";
330
+ static status = 412;
331
+ };
332
+ /**
333
+ * This user is not present in the current region.
334
+ */
335
+ var InvalidRegion = class extends TeslaFleetError {
336
+ static message = "This user is not present in the current region.";
337
+ static status = 421;
338
+ };
339
+ /**
340
+ * There is a semantic problem with the data, e.g. missing or invalid data.
341
+ */
342
+ var InvalidResource = class extends TeslaFleetError {
343
+ static message = "There is a semantic problem with the data, e.g. missing or invalid data.";
344
+ static status = 422;
345
+ };
346
+ /**
347
+ * Account is locked, and must be unlocked by Tesla.
348
+ */
349
+ var Locked = class extends TeslaFleetError {
350
+ static message = "Account is locked, and must be unlocked by Tesla.";
351
+ static status = 423;
352
+ };
353
+ /**
354
+ * The response from Tesla was invalid.
355
+ */
356
+ var InvalidResponse = class extends TeslaFleetError {
357
+ static message = "The response from Tesla was invalid.";
358
+ static status = 424;
359
+ };
360
+ /**
361
+ * Account or server is rate limited.
362
+ */
363
+ var RateLimited = class extends TeslaFleetError {
364
+ static message = "Account or server is rate limited.";
365
+ static status = 429;
366
+ };
367
+ /**
368
+ * Querying for a user/vehicle without proper privacy settings.
369
+ */
370
+ var ResourceUnavailableForLegalReasons = class extends TeslaFleetError {
371
+ static message = "Querying for a user/vehicle without proper privacy settings.";
372
+ static status = 451;
373
+ };
374
+ /**
375
+ * Client has closed the request before the server could send a response.
376
+ */
377
+ var ClientClosedRequest = class extends TeslaFleetError {
378
+ static message = "Client has closed the request before the server could send a response.";
379
+ static status = 499;
380
+ };
381
+ /**
382
+ * An error occurred while processing the request.
383
+ */
384
+ var InternalServerError = class extends TeslaFleetError {
385
+ static message = "An error occurred while processing the request.";
386
+ static status = 500;
387
+ };
388
+ /**
389
+ * The server, acting as a gateway, received an invalid response from an upstream server.
390
+ */
391
+ var BadGateway = class extends TeslaFleetError {
392
+ static message = "The server, acting as a gateway, received an invalid response from an upstream server.";
393
+ static status = 502;
394
+ };
395
+ /**
396
+ * The energy gateway is unreachable.
397
+ */
398
+ var EnergyGatewayUnreachable = class extends BadGateway {
399
+ static message = "The energy gateway is unreachable.";
400
+ static key = "energy_gateway_unreachable";
401
+ };
402
+ /**
403
+ * Either an internal service or a vehicle did not respond (timeout).
404
+ */
405
+ var ServiceUnavailable = class extends TeslaFleetError {
406
+ static message = "Either an internal service or a vehicle did not respond (timeout).";
407
+ static status = 503;
408
+ };
409
+ /**
410
+ * Server did not receive a response.
411
+ */
412
+ var GatewayTimeout = class extends TeslaFleetError {
413
+ static message = "Server did not receive a response.";
414
+ static status = 504;
415
+ };
416
+ /**
417
+ * Vehicle responded with an error - might need a reboot, OTA update, or service.
418
+ */
419
+ var DeviceUnexpectedResponse = class extends TeslaFleetError {
420
+ static message = "Vehicle responded with an error - might need a reboot, OTA update, or service.";
421
+ static status = 540;
422
+ };
423
+ /**
424
+ * Errors related to this library.
425
+ */
426
+ var LibraryError = class extends Error {
427
+ constructor(message, options) {
428
+ super(message, options);
429
+ this.name = new.target.name;
430
+ }
431
+ };
432
+ /**
433
+ * A signed operation was attempted on a vehicle constructed with signing
434
+ * explicitly disabled.
435
+ */
436
+ var SigningDisabled = class extends LibraryError {
437
+ constructor() {
438
+ super("This vehicle was constructed with command signing explicitly disabled. Any signed command or read needs a real private key.");
439
+ }
440
+ };
441
+ /**
442
+ * An existing private key file could not be loaded as a usable key.
443
+ *
444
+ * `reason` is one of `"unreadable"` (I/O failure), `"malformed"` (not valid
445
+ * PEM), `"encrypted"` (PEM requires a passphrase), or `"wrong_type"` (loaded
446
+ * key is not the expected type). A local key-file failure, not an upstream
447
+ * Fleet API error, so this extends `LibraryError` rather than
448
+ * `TeslaFleetError`.
449
+ */
450
+ var PrivateKeyError = class extends LibraryError {
451
+ reason;
452
+ constructor(reason, message, options) {
453
+ super(message, options);
454
+ this.reason = reason;
455
+ }
456
+ };
457
+ /**
458
+ * The requested action requires a signed command; the unsigned cloud API cannot actuate it.
459
+ *
460
+ * Energy gateways have been observed acknowledging this class of unsigned
461
+ * `grpc_command` without physically operating the grid contactor - see
462
+ * `EnergySite.set_island_mode`. Pair an RSA key with
463
+ * `EnergySite.add_authorized_client`, then either build the energy site
464
+ * with that `private_key` and its `din` to sign it through the cloud, or
465
+ * issue it through a signed local LAN backend (composed via
466
+ * `EnergySiteRouter`).
467
+ */
468
+ var SignedCommandRequired = class extends TeslaFleetError {
469
+ static message = "This command cannot actuate via the unsigned cloud API - gateways acknowledge it without operating the contactor. Pair a key with add_authorized_client, then create the energy site with that private_key and its din, or use a signed local control path (EnergySiteRouter).";
470
+ };
471
+ /**
472
+ * An energy gateway's presence-proof window expired before verification.
473
+ *
474
+ * The gateway itself reported the terminal `PENDING_VERIFICATION_TIMEOUT`
475
+ * state (`AuthorizedClientState`) - the ~9-minute window to confirm the
476
+ * key (typically via a physical breaker/switch toggle) closed with no
477
+ * confirmation. The registration is dead; re-register the *same* public
478
+ * key with `add_authorized_client` to reset the window and retry, rather
479
+ * than generating a new key.
480
+ */
481
+ var AuthorizedClientPairingTimedOut = class extends TeslaFleetError {
482
+ static message = "Authorized-client pairing timed out: the presence-proof window expired (PENDING_VERIFICATION_TIMEOUT). Re-register the same public key to reset the window and retry.";
483
+ };
484
+ /**
485
+ * `wait_until_paired()`'s own bounded overall wait elapsed.
486
+ *
487
+ * Distinct from `AuthorizedClientPairingTimedOut`: the gateway had not
488
+ * reported a terminal state (the registration may still be alive, e.g.
489
+ * still `PENDING_VERIFICATION`, or the local `verify_by_use` check
490
+ * kept failing) when the caller's `timeout` ran out. Retry by calling
491
+ * `wait_until_paired()` again.
492
+ */
493
+ var AuthorizedClientWaitExpired = class extends TeslaFleetError {
494
+ static message = "Timed out waiting for authorized-client pairing to complete.";
495
+ };
496
+ /**
497
+ * A `session_info` reply failed local authentication and was discarded.
498
+ *
499
+ * Raised when the reply's `session_info_tag` HMAC does not verify, is
500
+ * absent, the echoed `request_uuid` does not match the outstanding
501
+ * request it claims to answer, or its clock time regresses within the same
502
+ * epoch. Also raised when the reply carries an empty `publicKey` (so no
503
+ * shared key can be derived to verify a tag) with a status other than
504
+ * `SESSION_INFO_STATUS_KEY_NOT_ON_WHITELIST`, which raises
505
+ * `NotOnWhitelistFault` instead. The session's prior state is left
506
+ * unmodified.
507
+ */
508
+ var SessionInfoAuthenticationFault = class extends TeslaFleetError {
509
+ static message = "Session info reply failed authentication and was discarded.";
510
+ };
511
+ /**
512
+ * A signed command response reused a counter value already seen on this session.
513
+ *
514
+ * protocol.md requires rejecting a response whose counter has previously
515
+ * been used, to prevent an attacker from replaying a captured encrypted
516
+ * response back at the client.
517
+ */
518
+ var SignedCommandResponseReplayed = class extends TeslaFleetError {
519
+ static message = "Signed command response reused an already-seen counter; discarded as a replay.";
520
+ };
521
+ /**
522
+ * Vehicle has responded with an error when sending a signed command
523
+ */
524
+ var TeslaFleetInformationFault = class extends TeslaFleetError {
525
+ static message = "Vehicle has responded with an error when sending a signed command";
526
+ };
527
+ /**
528
+ * Unknown fault on signed command.
529
+ */
530
+ var UnknownFault = class extends TeslaFleetInformationFault {
531
+ static message = "Unknown fault on signed command.";
532
+ static code = 1;
533
+ };
534
+ /**
535
+ * Not on whitelist fault on signed command.
536
+ */
537
+ var NotOnWhitelistFault = class extends TeslaFleetInformationFault {
538
+ static message = "Not on whitelist fault on signed command.";
539
+ static code = 2;
540
+ };
541
+ /**
542
+ * IV smaller than expected fault on signed command.
543
+ */
544
+ var IVSmallerThanExpectedFault = class extends TeslaFleetInformationFault {
545
+ static message = "IV smaller than expected fault on signed command.";
546
+ static code = 3;
547
+ };
548
+ /**
549
+ * Invalid token fault on signed command.
550
+ */
551
+ var InvalidTokenFault = class extends TeslaFleetInformationFault {
552
+ static message = "Invalid token fault on signed command.";
553
+ static code = 4;
554
+ };
555
+ /**
556
+ * Token and counter invalid fault on signed command.
557
+ */
558
+ var TokenAndCounterInvalidFault = class extends TeslaFleetInformationFault {
559
+ static message = "Token and counter invalid fault on signed command.";
560
+ static code = 5;
561
+ };
562
+ /**
563
+ * AES decrypt auth fault on signed command.
564
+ */
565
+ var AESDecryptAuthFault = class extends TeslaFleetInformationFault {
566
+ static message = "AES decrypt auth fault on signed command.";
567
+ static code = 6;
568
+ };
569
+ /**
570
+ * ECDSA input fault on signed command.
571
+ */
572
+ var ECDSAInputFault = class extends TeslaFleetInformationFault {
573
+ static message = "ECDSA input fault on signed command.";
574
+ static code = 7;
575
+ };
576
+ /**
577
+ * ECDSA signature fault on signed command.
578
+ */
579
+ var ECDSASignatureFault = class extends TeslaFleetInformationFault {
580
+ static message = "ECDSA signature fault on signed command.";
581
+ static code = 8;
582
+ };
583
+ /**
584
+ * Local entity start fault on signed command.
585
+ */
586
+ var LocalEntityStartFault = class extends TeslaFleetInformationFault {
587
+ static message = "Local entity start fault on signed command.";
588
+ static code = 9;
589
+ };
590
+ /**
591
+ * Local entity result fault on signed command.
592
+ */
593
+ var LocalEntityResultFault = class extends TeslaFleetInformationFault {
594
+ static message = "Local entity result fault on signed command.";
595
+ static code = 10;
596
+ };
597
+ /**
598
+ * Could not retrieve key fault on signed command.
599
+ */
600
+ var CouldNotRetrieveKeyFault = class extends TeslaFleetInformationFault {
601
+ static message = "Could not retrieve key fault on signed command.";
602
+ static code = 11;
603
+ };
604
+ /**
605
+ * Could not retrieve token fault on signed command.
606
+ */
607
+ var CouldNotRetrieveTokenFault = class extends TeslaFleetInformationFault {
608
+ static message = "Could not retrieve token fault on signed command.";
609
+ static code = 12;
610
+ };
611
+ /**
612
+ * Signature too short fault on signed command.
613
+ */
614
+ var SignatureTooShortFault = class extends TeslaFleetInformationFault {
615
+ static message = "Signature too short fault on signed command.";
616
+ static code = 13;
617
+ };
618
+ /**
619
+ * Token is incorrect length fault on signed command.
620
+ */
621
+ var TokenIsIncorrectLengthFault = class extends TeslaFleetInformationFault {
622
+ static message = "Token is incorrect length fault on signed command.";
623
+ static code = 14;
624
+ };
625
+ /**
626
+ * Incorrect epoch fault on signed command.
627
+ */
628
+ var IncorrectEpochFault = class extends TeslaFleetInformationFault {
629
+ static message = "Incorrect epoch fault on signed command.";
630
+ static code = 15;
631
+ };
632
+ /**
633
+ * IV incorrect length fault on signed command.
634
+ */
635
+ var IVIncorrectLengthFault = class extends TeslaFleetInformationFault {
636
+ static message = "IV incorrect length fault on signed command.";
637
+ static code = 16;
638
+ };
639
+ /**
640
+ * Time expired fault on signed command.
641
+ */
642
+ var TimeExpiredFault = class extends TeslaFleetInformationFault {
643
+ static message = "Time expired fault on signed command.";
644
+ static code = 17;
645
+ };
646
+ /**
647
+ * Not provisioned with identity fault on signed command.
648
+ */
649
+ var NotProvisionedWithIdentityFault = class extends TeslaFleetInformationFault {
650
+ static message = "Not provisioned with identity fault on signed command.";
651
+ static code = 18;
652
+ };
653
+ /**
654
+ * Could not hash metadata fault on signed command.
655
+ */
656
+ var CouldNotHashMetadataFault = class extends TeslaFleetInformationFault {
657
+ static message = "Could not hash metadata fault on signed command.";
658
+ static code = 19;
659
+ };
660
+ /**
661
+ * Vehicle has responded with an error when sending a signed command
662
+ */
663
+ var TeslaFleetMessageFault = class extends TeslaFleetError {
664
+ static message = "Vehicle has responded with an error when sending a signed command";
665
+ };
666
+ /**
667
+ * Required vehicle subsystem is busy. Try again
668
+ */
669
+ var TeslaFleetMessageFaultBusy = class extends TeslaFleetMessageFault {
670
+ static message = "Required vehicle subsystem is busy. Try again";
671
+ static code = 1;
672
+ };
673
+ /**
674
+ * Vehicle subsystem did not respond. Try again
675
+ */
676
+ var TeslaFleetMessageFaultTimeout = class extends TeslaFleetMessageFault {
677
+ static message = "Vehicle subsystem did not respond. Try again";
678
+ static code = 2;
679
+ };
680
+ /**
681
+ * Vehicle did not recognize the key used to authorize command. Make sure your key is paired with the vehicle
682
+ */
683
+ var TeslaFleetMessageFaultUnknownKeyId = class extends TeslaFleetMessageFault {
684
+ static message = "Vehicle did not recognize the key used to authorize command. Make sure your key is paired with the vehicle";
685
+ static code = 3;
686
+ };
687
+ /**
688
+ * Key used to authorize command has been disabled
689
+ */
690
+ var TeslaFleetMessageFaultInactiveKey = class extends TeslaFleetMessageFault {
691
+ static message = "Key used to authorize command has been disabled";
692
+ static code = 4;
693
+ };
694
+ /**
695
+ * Command signature/MAC is incorrect. Use included session info to update session and try again
696
+ */
697
+ var TeslaFleetMessageFaultInvalidSignature = class extends TeslaFleetMessageFault {
698
+ static message = "Command signature/MAC is incorrect. Use included session info to update session and try again";
699
+ static code = 5;
700
+ };
701
+ /**
702
+ * Command anti-replay counter has been used before. Use included session info to update session and try again
703
+ */
704
+ var TeslaFleetMessageFaultInvalidTokenOrCounter = class extends TeslaFleetMessageFault {
705
+ static message = "Command anti-replay counter has been used before. Use included session info to update session and try again";
706
+ static code = 6;
707
+ };
708
+ /**
709
+ * User is not authorized to execute command. This can be because of the role or because of vehicle state
710
+ */
711
+ var TeslaFleetMessageFaultInsufficientPrivileges = class extends TeslaFleetMessageFault {
712
+ static message = "User is not authorized to execute command. This can be because of the role or because of vehicle state";
713
+ static code = 7;
714
+ };
715
+ /**
716
+ * Command was malformed or addressed to an unrecognized vehicle system. May indicate client error or older vehicle firmware
717
+ */
718
+ var TeslaFleetMessageFaultInvalidDomains = class extends TeslaFleetMessageFault {
719
+ static message = "Command was malformed or addressed to an unrecognized vehicle system. May indicate client error or older vehicle firmware";
720
+ static code = 8;
721
+ };
722
+ /**
723
+ * Unrecognized command. May indicate client error or unsupported vehicle firmware
724
+ */
725
+ var TeslaFleetMessageFaultInvalidCommand = class extends TeslaFleetMessageFault {
726
+ static message = "Unrecognized command. May indicate client error or unsupported vehicle firmware";
727
+ static code = 9;
728
+ };
729
+ /**
730
+ * Could not parse command. Indicates client error
731
+ */
732
+ var TeslaFleetMessageFaultDecoding = class extends TeslaFleetMessageFault {
733
+ static message = "Could not parse command. Indicates client error";
734
+ static code = 10;
735
+ };
736
+ /**
737
+ * Internal vehicle error. Try again. Most commonly encountered when the vehicle has not finished booting
738
+ */
739
+ var TeslaFleetMessageFaultInternal = class extends TeslaFleetMessageFault {
740
+ static message = "Internal vehicle error. Try again. Most commonly encountered when the vehicle has not finished booting";
741
+ static code = 11;
742
+ };
743
+ /**
744
+ * Command sent to wrong VIN
745
+ */
746
+ var TeslaFleetMessageFaultWrongPersonalization = class extends TeslaFleetMessageFault {
747
+ static message = "Command sent to wrong VIN";
748
+ static code = 12;
749
+ };
750
+ /**
751
+ * Command was malformed or used a deprecated parameter
752
+ */
753
+ var TeslaFleetMessageFaultBadParameter = class extends TeslaFleetMessageFault {
754
+ static message = "Command was malformed or used a deprecated parameter";
755
+ static code = 13;
756
+ };
757
+ /**
758
+ * Vehicle's keychain is full. You must delete a key before you can add another
759
+ */
760
+ var TeslaFleetMessageFaultKeychainIsFull = class extends TeslaFleetMessageFault {
761
+ static message = "Vehicle's keychain is full. You must delete a key before you can add another";
762
+ static code = 14;
763
+ };
764
+ /**
765
+ * Session ID mismatch. Use included session info to update session and try again
766
+ */
767
+ var TeslaFleetMessageFaultIncorrectEpoch = class extends TeslaFleetMessageFault {
768
+ static message = "Session ID mismatch. Use included session info to update session and try again";
769
+ static code = 15;
770
+ };
771
+ /**
772
+ * Initialization Value length is incorrect (AES-GCM must use 12-byte IVs). Indicates a client programming error
773
+ */
774
+ var TeslaFleetMessageFaultIVIncorrectLength = class extends TeslaFleetMessageFault {
775
+ static message = "Initialization Value length is incorrect (AES-GCM must use 12-byte IVs). Indicates a client programming error";
776
+ static code = 16;
777
+ };
778
+ /**
779
+ * Command expired. Use included session info to determine if clocks have desynchronized and try again
780
+ */
781
+ var TeslaFleetMessageFaultTimeExpired = class extends TeslaFleetMessageFault {
782
+ static message = "Command expired. Use included session info to determine if clocks have desynchronized and try again";
783
+ static code = 17;
784
+ };
785
+ /**
786
+ * Vehicle has not been provisioned with a VIN and may require service
787
+ */
788
+ var TeslaFleetMessageFaultNotProvisionedWithIdentity = class extends TeslaFleetMessageFault {
789
+ static message = "Vehicle has not been provisioned with a VIN and may require service";
790
+ static code = 18;
791
+ };
792
+ /**
793
+ * Internal vehicle error
794
+ */
795
+ var TeslaFleetMessageFaultCouldNotHashMetadata = class extends TeslaFleetMessageFault {
796
+ static message = "Internal vehicle error";
797
+ static code = 19;
798
+ };
799
+ /**
800
+ * Vehicle rejected command because its expiration time was too far in the future. This is a security precaution
801
+ */
802
+ var TeslaFleetMessageFaultTimeToLiveTooLong = class extends TeslaFleetMessageFault {
803
+ static message = "Vehicle rejected command because its expiration time was too far in the future. This is a security precaution";
804
+ static code = 20;
805
+ };
806
+ /**
807
+ * The vehicle owner has disabled Mobile access
808
+ */
809
+ var TeslaFleetMessageFaultRemoteAccessDisabled = class extends TeslaFleetMessageFault {
810
+ static message = "The vehicle owner has disabled Mobile access";
811
+ static code = 21;
812
+ };
813
+ /**
814
+ * The command was authorized with a Service key, but the vehicle has not been configured to permit remote service commands
815
+ */
816
+ var TeslaFleetMessageFaultRemoteServiceAccessDisabled = class extends TeslaFleetMessageFault {
817
+ static message = "The command was authorized with a Service key, but the vehicle has not been configured to permit remote service commands";
818
+ static code = 22;
819
+ };
820
+ /**
821
+ * The command requires proof of Tesla account credentials but was not sent over a channel that provides this proof. Resend the command using Fleet API
822
+ */
823
+ var TeslaFleetMessageFaultCommandRequiresAccountCredentials = class extends TeslaFleetMessageFault {
824
+ static message = "The command requires proof of Tesla account credentials but was not sent over a channel that provides this proof. Resend the command using Fleet API";
825
+ static code = 23;
826
+ };
827
+ /**
828
+ * Client sent a request with a field that exceeds MTU
829
+ */
830
+ var TeslaFleetMessageFaultFieldExceedsMTU = class extends TeslaFleetMessageFault {
831
+ static message = "Client sent a request with a field that exceeds MTU";
832
+ static code = 24;
833
+ };
834
+ /**
835
+ * Client's request was received, but response size exceeded MTU
836
+ */
837
+ var TeslaFleetMessageFaultResponseSizeExceedsMTU = class extends TeslaFleetMessageFault {
838
+ static message = "Client's request was received, but response size exceeded MTU";
839
+ static code = 25;
840
+ };
841
+ /**
842
+ * The vehicle has seen this counter value before. Reset the counter and try again
843
+ */
844
+ var TeslaFleetMessageFaultRepeatedCounter = class extends TeslaFleetMessageFault {
845
+ static message = "The vehicle has seen this counter value before. Reset the counter and try again";
846
+ static code = 26;
847
+ };
848
+ /**
849
+ * The key handle is not valid. The key may have been revoked or expired
850
+ */
851
+ var TeslaFleetMessageFaultInvalidKeyHandle = class extends TeslaFleetMessageFault {
852
+ static message = "The key handle is not valid. The key may have been revoked or expired";
853
+ static code = 27;
854
+ };
855
+ /**
856
+ * The response requires encryption but encryption was not requested
857
+ */
858
+ var TeslaFleetMessageFaultRequiresResponseEncryption = class extends TeslaFleetMessageFault {
859
+ static message = "The response requires encryption but encryption was not requested";
860
+ static code = 28;
861
+ };
862
+ /**
863
+ * Vehicle has responded with an error when sending a signed command
864
+ */
865
+ var SignedMessageInformationFault = class extends TeslaFleetError {
866
+ static message = "Vehicle has responded with an error when sending a signed command";
867
+ };
868
+ /**
869
+ * Unknown fault on signed command.
870
+ */
871
+ var SignedMessageInformationFaultUnknown = class extends SignedMessageInformationFault {
872
+ static message = "Unknown fault on signed command.";
873
+ static code = 1;
874
+ };
875
+ /**
876
+ * Not on whitelist fault on signed command.
877
+ */
878
+ var SignedMessageInformationFaultNotOnWhitelist = class extends SignedMessageInformationFault {
879
+ static message = "Not on whitelist fault on signed command.";
880
+ static code = 2;
881
+ };
882
+ /**
883
+ * IV smaller than expected fault on signed command.
884
+ */
885
+ var SignedMessageInformationFaultIVSmallerThanExpected = class extends SignedMessageInformationFault {
886
+ static message = "IV smaller than expected fault on signed command.";
887
+ static code = 3;
888
+ };
889
+ /**
890
+ * Invalid token fault on signed command.
891
+ */
892
+ var SignedMessageInformationFaultInvalidToken = class extends SignedMessageInformationFault {
893
+ static message = "Invalid token fault on signed command.";
894
+ static code = 4;
895
+ };
896
+ /**
897
+ * Token and counter invalid fault on signed command.
898
+ */
899
+ var SignedMessageInformationFaultTokenAndCounterInvalid = class extends SignedMessageInformationFault {
900
+ static message = "Token and counter invalid fault on signed command.";
901
+ static code = 5;
902
+ };
903
+ /**
904
+ * AES decrypt auth fault on signed command.
905
+ */
906
+ var SignedMessageInformationFaultAESDecryptAuth = class extends SignedMessageInformationFault {
907
+ static message = "AES decrypt auth fault on signed command.";
908
+ static code = 6;
909
+ };
910
+ /**
911
+ * ECDSA input fault on signed command.
912
+ */
913
+ var SignedMessageInformationFaultECDSAInput = class extends SignedMessageInformationFault {
914
+ static message = "ECDSA input fault on signed command.";
915
+ static code = 7;
916
+ };
917
+ /**
918
+ * ECDSA signature fault on signed command.
919
+ */
920
+ var SignedMessageInformationFaultECDSASignature = class extends SignedMessageInformationFault {
921
+ static message = "ECDSA signature fault on signed command.";
922
+ static code = 8;
923
+ };
924
+ /**
925
+ * Local entity start fault on signed command.
926
+ */
927
+ var SignedMessageInformationFaultLocalEntityStart = class extends SignedMessageInformationFault {
928
+ static message = "Local entity start fault on signed command.";
929
+ static code = 9;
930
+ };
931
+ /**
932
+ * Local entity result fault on signed command.
933
+ */
934
+ var SignedMessageInformationFaultLocalEntityResult = class extends SignedMessageInformationFault {
935
+ static message = "Local entity result fault on signed command.";
936
+ static code = 10;
937
+ };
938
+ /**
939
+ * Could not retrieve key fault on signed command.
940
+ */
941
+ var SignedMessageInformationFaultCouldNotRetrieveKey = class extends SignedMessageInformationFault {
942
+ static message = "Could not retrieve key fault on signed command.";
943
+ static code = 11;
944
+ };
945
+ /**
946
+ * Could not retrieve token fault on signed command.
947
+ */
948
+ var SignedMessageInformationFaultCouldNotRetrieveToken = class extends SignedMessageInformationFault {
949
+ static message = "Could not retrieve token fault on signed command.";
950
+ static code = 12;
951
+ };
952
+ /**
953
+ * Signature too short fault on signed command.
954
+ */
955
+ var SignedMessageInformationFaultSignatureTooShort = class extends SignedMessageInformationFault {
956
+ static message = "Signature too short fault on signed command.";
957
+ static code = 13;
958
+ };
959
+ /**
960
+ * Token is incorrect length fault on signed command.
961
+ */
962
+ var SignedMessageInformationFaultTokenIsIncorrectLength = class extends SignedMessageInformationFault {
963
+ static message = "Token is incorrect length fault on signed command.";
964
+ static code = 14;
965
+ };
966
+ /**
967
+ * Incorrect epoch fault on signed command.
968
+ */
969
+ var SignedMessageInformationFaultIncorrectEpoch = class extends SignedMessageInformationFault {
970
+ static message = "Incorrect epoch fault on signed command.";
971
+ static code = 15;
972
+ };
973
+ /**
974
+ * IV incorrect length fault on signed command.
975
+ */
976
+ var SignedMessageInformationFaultIVIncorrectLength = class extends SignedMessageInformationFault {
977
+ static message = "IV incorrect length fault on signed command.";
978
+ static code = 16;
979
+ };
980
+ /**
981
+ * Time expired fault on signed command.
982
+ */
983
+ var SignedMessageInformationFaultTimeExpired = class extends SignedMessageInformationFault {
984
+ static message = "Time expired fault on signed command.";
985
+ static code = 17;
986
+ };
987
+ /**
988
+ * Not provisioned with identity fault on signed command.
989
+ */
990
+ var SignedMessageInformationFaultNotProvisionedWithIdentity = class extends SignedMessageInformationFault {
991
+ static message = "Not provisioned with identity fault on signed command.";
992
+ static code = 18;
993
+ };
994
+ /**
995
+ * Could not hash metadata fault on signed command.
996
+ */
997
+ var SignedMessageInformationFaultCouldNotHashMetadata = class extends SignedMessageInformationFault {
998
+ static message = "Could not hash metadata fault on signed command.";
999
+ static code = 19;
1000
+ };
1001
+ var WhitelistOperationStatus = class extends TeslaFleetError {
1002
+ static message = "Whitelist operation failed";
1003
+ };
1004
+ var WhitelistOperationUndocumentedError = class extends WhitelistOperationStatus {
1005
+ static message = "Undocumented whitelist operation error";
1006
+ static code = 1;
1007
+ };
1008
+ var WhitelistOperationNoPermissionToRemoveOneself = class extends WhitelistOperationStatus {
1009
+ static message = "No permission to remove oneself from whitelist";
1010
+ static code = 2;
1011
+ };
1012
+ var WhitelistOperationKeyfobSlotsFull = class extends WhitelistOperationStatus {
1013
+ static message = "Keyfob slots are full";
1014
+ static code = 3;
1015
+ };
1016
+ var WhitelistOperationWhitelistFull = class extends WhitelistOperationStatus {
1017
+ static message = "Whitelist is full";
1018
+ static code = 4;
1019
+ };
1020
+ var WhitelistOperationNoPermissionToAdd = class extends WhitelistOperationStatus {
1021
+ static message = "No permission to add to whitelist";
1022
+ static code = 5;
1023
+ };
1024
+ var WhitelistOperationInvalidPublicKey = class extends WhitelistOperationStatus {
1025
+ static message = "Invalid public key";
1026
+ static code = 6;
1027
+ };
1028
+ var WhitelistOperationNoPermissionToRemove = class extends WhitelistOperationStatus {
1029
+ static message = "No permission to remove from whitelist";
1030
+ static code = 7;
1031
+ };
1032
+ var WhitelistOperationNoPermissionToChangePermissions = class extends WhitelistOperationStatus {
1033
+ static message = "No permission to change permissions";
1034
+ static code = 8;
1035
+ };
1036
+ var WhitelistOperationAttemptingToElevateOthersAboveOneself = class extends WhitelistOperationStatus {
1037
+ static message = "Attempting to elevate others above oneself";
1038
+ static code = 9;
1039
+ };
1040
+ var WhitelistOperationAttemptingToDemoteSuperiorToOneself = class extends WhitelistOperationStatus {
1041
+ static message = "Attempting to demote superior to oneself";
1042
+ static code = 10;
1043
+ };
1044
+ var WhitelistOperationAttemptingToRemoveOwnPermissions = class extends WhitelistOperationStatus {
1045
+ static message = "Attempting to remove own permissions";
1046
+ static code = 11;
1047
+ };
1048
+ var WhitelistOperationPublicKeyNotOnWhitelist = class extends WhitelistOperationStatus {
1049
+ static message = "Public key not on whitelist";
1050
+ static code = 12;
1051
+ };
1052
+ var WhitelistOperationAttemptingToAddExistingKey = class extends WhitelistOperationStatus {
1053
+ static message = "Attempting to add key that is already on the whitelist";
1054
+ static code = 13;
1055
+ };
1056
+ var WhitelistOperationNotAllowedToAddUnlessOnReader = class extends WhitelistOperationStatus {
1057
+ static message = "Not allowed to add unless on reader";
1058
+ static code = 14;
1059
+ };
1060
+ var WhitelistOperationFMModifyingOutsideOfFMode = class extends WhitelistOperationStatus {
1061
+ static message = "FM modifying outside of F mode";
1062
+ static code = 15;
1063
+ };
1064
+ var WhitelistOperationFMAttemptingToAddPermanentKey = class extends WhitelistOperationStatus {
1065
+ static message = "FM attempting to add permanent key";
1066
+ static code = 16;
1067
+ };
1068
+ var WhitelistOperationFMAttemptingToRemovePermanentKey = class extends WhitelistOperationStatus {
1069
+ static message = "FM attempting to remove permanent key";
1070
+ static code = 17;
1071
+ };
1072
+ var WhitelistOperationKeychainWhileFSFull = class extends WhitelistOperationStatus {
1073
+ static message = "Keychain while FS full";
1074
+ static code = 18;
1075
+ };
1076
+ var WhitelistOperationAttemptingToAddKeyWithoutRole = class extends WhitelistOperationStatus {
1077
+ static message = "Attempting to add key without role";
1078
+ static code = 19;
1079
+ };
1080
+ var WhitelistOperationAttemptingToAddKeyWithServiceRole = class extends WhitelistOperationStatus {
1081
+ static message = "Attempting to add key with service role";
1082
+ static code = 20;
1083
+ };
1084
+ var WhitelistOperationNonServiceKeyAttemptingToAddServiceTech = class extends WhitelistOperationStatus {
1085
+ static message = "Non-service key attempting to add service tech";
1086
+ static code = 21;
1087
+ };
1088
+ var WhitelistOperationServiceKeyAttemptingToAddServiceTechOutsideServiceMode = class extends WhitelistOperationStatus {
1089
+ static message = "Service key attempting to add service tech outside service mode";
1090
+ static code = 22;
1091
+ };
1092
+ var WhitelistOperationCouldNotStartLocalEntityAuth = class extends WhitelistOperationStatus {
1093
+ static message = "Could not start local entity authentication";
1094
+ static code = 23;
1095
+ };
1096
+ var WhitelistOperationLocalEntityAuthFailedUIDenied = class extends WhitelistOperationStatus {
1097
+ static message = "Local entity authentication failed - UI denied";
1098
+ static code = 24;
1099
+ };
1100
+ var WhitelistOperationLocalEntityAuthFailedTimedOutWaitingForTap = class extends WhitelistOperationStatus {
1101
+ static message = "Authorization request timed out";
1102
+ static code = 25;
1103
+ };
1104
+ var WhitelistOperationLocalEntityAuthFailedTimedOutWaitingForUIAck = class extends WhitelistOperationStatus {
1105
+ static message = "Local entity authentication failed - timed out waiting for UI acknowledgement";
1106
+ static code = 26;
1107
+ };
1108
+ var WhitelistOperationLocalEntityAuthFailedValetMode = class extends WhitelistOperationStatus {
1109
+ static message = "Local entity authentication failed - valet mode";
1110
+ static code = 27;
1111
+ };
1112
+ var WhitelistOperationLocalEntityAuthFailedCancelled = class extends WhitelistOperationStatus {
1113
+ static message = "Local entity authentication failed - cancelled";
1114
+ static code = 28;
1115
+ };
1116
+ /** `TeslaFleetInformationFault` subclasses indexed by their protobuf enum value; index 0 (no fault) is `null`. */
1117
+ const INFORMATION_FAULTS = [
1118
+ null,
1119
+ UnknownFault,
1120
+ NotOnWhitelistFault,
1121
+ IVSmallerThanExpectedFault,
1122
+ InvalidTokenFault,
1123
+ TokenAndCounterInvalidFault,
1124
+ AESDecryptAuthFault,
1125
+ ECDSAInputFault,
1126
+ ECDSASignatureFault,
1127
+ LocalEntityStartFault,
1128
+ LocalEntityResultFault,
1129
+ CouldNotRetrieveKeyFault,
1130
+ CouldNotRetrieveTokenFault,
1131
+ SignatureTooShortFault,
1132
+ TokenIsIncorrectLengthFault,
1133
+ IncorrectEpochFault,
1134
+ IVIncorrectLengthFault,
1135
+ TimeExpiredFault,
1136
+ NotProvisionedWithIdentityFault,
1137
+ CouldNotHashMetadataFault
1138
+ ];
1139
+ /** `TeslaFleetMessageFault` subclasses indexed by their protobuf enum value; index 0 (no fault) is `null`. */
1140
+ const MESSAGE_FAULTS = [
1141
+ null,
1142
+ TeslaFleetMessageFaultBusy,
1143
+ TeslaFleetMessageFaultTimeout,
1144
+ TeslaFleetMessageFaultUnknownKeyId,
1145
+ TeslaFleetMessageFaultInactiveKey,
1146
+ TeslaFleetMessageFaultInvalidSignature,
1147
+ TeslaFleetMessageFaultInvalidTokenOrCounter,
1148
+ TeslaFleetMessageFaultInsufficientPrivileges,
1149
+ TeslaFleetMessageFaultInvalidDomains,
1150
+ TeslaFleetMessageFaultInvalidCommand,
1151
+ TeslaFleetMessageFaultDecoding,
1152
+ TeslaFleetMessageFaultInternal,
1153
+ TeslaFleetMessageFaultWrongPersonalization,
1154
+ TeslaFleetMessageFaultBadParameter,
1155
+ TeslaFleetMessageFaultKeychainIsFull,
1156
+ TeslaFleetMessageFaultIncorrectEpoch,
1157
+ TeslaFleetMessageFaultIVIncorrectLength,
1158
+ TeslaFleetMessageFaultTimeExpired,
1159
+ TeslaFleetMessageFaultNotProvisionedWithIdentity,
1160
+ TeslaFleetMessageFaultCouldNotHashMetadata,
1161
+ TeslaFleetMessageFaultTimeToLiveTooLong,
1162
+ TeslaFleetMessageFaultRemoteAccessDisabled,
1163
+ TeslaFleetMessageFaultRemoteServiceAccessDisabled,
1164
+ TeslaFleetMessageFaultCommandRequiresAccountCredentials,
1165
+ TeslaFleetMessageFaultFieldExceedsMTU,
1166
+ TeslaFleetMessageFaultResponseSizeExceedsMTU,
1167
+ TeslaFleetMessageFaultRepeatedCounter,
1168
+ TeslaFleetMessageFaultInvalidKeyHandle,
1169
+ TeslaFleetMessageFaultRequiresResponseEncryption
1170
+ ];
1171
+ /** `SignedMessageInformationFault` subclasses indexed by their protobuf enum value; index 0 (no fault) is `null`. */
1172
+ const SIGNED_MESSAGE_INFORMATION_FAULTS = [
1173
+ null,
1174
+ SignedMessageInformationFaultUnknown,
1175
+ SignedMessageInformationFaultNotOnWhitelist,
1176
+ SignedMessageInformationFaultIVSmallerThanExpected,
1177
+ SignedMessageInformationFaultInvalidToken,
1178
+ SignedMessageInformationFaultTokenAndCounterInvalid,
1179
+ SignedMessageInformationFaultAESDecryptAuth,
1180
+ SignedMessageInformationFaultECDSAInput,
1181
+ SignedMessageInformationFaultECDSASignature,
1182
+ SignedMessageInformationFaultLocalEntityStart,
1183
+ SignedMessageInformationFaultLocalEntityResult,
1184
+ SignedMessageInformationFaultCouldNotRetrieveKey,
1185
+ SignedMessageInformationFaultCouldNotRetrieveToken,
1186
+ SignedMessageInformationFaultSignatureTooShort,
1187
+ SignedMessageInformationFaultTokenIsIncorrectLength,
1188
+ SignedMessageInformationFaultIncorrectEpoch,
1189
+ SignedMessageInformationFaultIVIncorrectLength,
1190
+ SignedMessageInformationFaultTimeExpired,
1191
+ SignedMessageInformationFaultNotProvisionedWithIdentity,
1192
+ SignedMessageInformationFaultCouldNotHashMetadata
1193
+ ];
1194
+ /** `WhitelistOperationStatus` subclasses indexed by their protobuf enum value; index 0 (no fault) is `null`. */
1195
+ const WHITELIST_OPERATION_STATUS = [
1196
+ null,
1197
+ WhitelistOperationUndocumentedError,
1198
+ WhitelistOperationNoPermissionToRemoveOneself,
1199
+ WhitelistOperationKeyfobSlotsFull,
1200
+ WhitelistOperationWhitelistFull,
1201
+ WhitelistOperationNoPermissionToAdd,
1202
+ WhitelistOperationInvalidPublicKey,
1203
+ WhitelistOperationNoPermissionToRemove,
1204
+ WhitelistOperationNoPermissionToChangePermissions,
1205
+ WhitelistOperationAttemptingToElevateOthersAboveOneself,
1206
+ WhitelistOperationAttemptingToDemoteSuperiorToOneself,
1207
+ WhitelistOperationAttemptingToRemoveOwnPermissions,
1208
+ WhitelistOperationPublicKeyNotOnWhitelist,
1209
+ WhitelistOperationAttemptingToAddExistingKey,
1210
+ WhitelistOperationNotAllowedToAddUnlessOnReader,
1211
+ WhitelistOperationFMModifyingOutsideOfFMode,
1212
+ WhitelistOperationFMAttemptingToAddPermanentKey,
1213
+ WhitelistOperationFMAttemptingToRemovePermanentKey,
1214
+ WhitelistOperationKeychainWhileFSFull,
1215
+ WhitelistOperationAttemptingToAddKeyWithoutRole,
1216
+ WhitelistOperationAttemptingToAddKeyWithServiceRole,
1217
+ WhitelistOperationNonServiceKeyAttemptingToAddServiceTech,
1218
+ WhitelistOperationServiceKeyAttemptingToAddServiceTechOutsideServiceMode,
1219
+ WhitelistOperationCouldNotStartLocalEntityAuth,
1220
+ WhitelistOperationLocalEntityAuthFailedUIDenied,
1221
+ WhitelistOperationLocalEntityAuthFailedTimedOutWaitingForTap,
1222
+ WhitelistOperationLocalEntityAuthFailedTimedOutWaitingForUIAck,
1223
+ WhitelistOperationLocalEntityAuthFailedValetMode,
1224
+ WhitelistOperationLocalEntityAuthFailedCancelled
1225
+ ];
1226
+ /**
1227
+ * Every fault a vehicle can return that means it did not recognize/accept our
1228
+ * signing key as authorized to issue commands, verified against each fault's
1229
+ * proto enum meaning rather than its name alone.
1230
+ * `TeslaFleetMessageFaultKeychainIsFull` is deliberately excluded: its proto
1231
+ * meaning is "no room to add another key", not "this key was rejected".
1232
+ */
1233
+ const KEY_REJECTED_FAULTS = [
1234
+ NotOnWhitelistFault,
1235
+ CouldNotRetrieveKeyFault,
1236
+ SignedMessageInformationFaultNotOnWhitelist,
1237
+ SignedMessageInformationFaultCouldNotRetrieveKey,
1238
+ TeslaFleetMessageFaultUnknownKeyId,
1239
+ TeslaFleetMessageFaultInactiveKey,
1240
+ TeslaFleetMessageFaultInvalidKeyHandle
1241
+ ];
1242
+ /**
1243
+ * Whether `error` means the vehicle rejected our signing key.
1244
+ *
1245
+ * True for a fault meaning the vehicle does not recognize our key as
1246
+ * whitelisted/paired (or could not retrieve/validate it), false for every
1247
+ * other fault, including transport errors and faults about an unrelated
1248
+ * signed-command condition (e.g. a full keychain).
1249
+ */
1250
+ function is_key_rejected(error) {
1251
+ return KEY_REJECTED_FAULTS.some((cls) => error instanceof cls);
1252
+ }
1253
+ function keyed(error, candidates) {
1254
+ return error ? candidates.find((cls) => cls.key === error) : void 0;
1255
+ }
1256
+ /**
1257
+ * Throw the `TeslaFleetError` subclass matching `resp` if its status is >= 400.
1258
+ * https://developer.tesla.com/docs/fleet-api#response-codes
1259
+ *
1260
+ * Consumes the response body when it throws; resolves without touching the
1261
+ * body otherwise.
1262
+ */
1263
+ async function raise_for_status(resp) {
1264
+ if (resp.status < 400) return;
1265
+ const text = await resp.text();
1266
+ let data = null;
1267
+ if (resp.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase() === "application/json") try {
1268
+ const parsed = JSON.parse(text);
1269
+ if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) data = parsed;
1270
+ } catch {}
1271
+ const error = data?.error;
1272
+ switch (resp.status) {
1273
+ case 400: throw new ((keyed(error, [
1274
+ InvalidCommand,
1275
+ InvalidField,
1276
+ InvalidRequest,
1277
+ InvalidAuthCode,
1278
+ InvalidRedirectUrl,
1279
+ UnauthorizedClient
1280
+ ])) ?? InvalidRequest)(data);
1281
+ case 401: {
1282
+ const cls = keyed(error, [
1283
+ OAuthExpired,
1284
+ MobileAccessDisabled,
1285
+ LoginRequired,
1286
+ MissingTeslemetryToken,
1287
+ MissingTessieToken,
1288
+ InvalidTeslemetryToken,
1289
+ InvalidTessieToken
1290
+ ]);
1291
+ if (cls) throw new cls(data);
1292
+ throw new OAuthExpired();
1293
+ }
1294
+ case 402: throw new ((keyed(error, [
1295
+ SubscriptionRequired,
1296
+ VehicleSubscriptionRequired,
1297
+ InsufficientCredits
1298
+ ])) ?? PaymentRequired)(data);
1299
+ case 403: throw new ((keyed(error, [InvalidScope, UnsupportedVehicle])) ?? Forbidden)(data);
1300
+ case 404: throw new NotFound(data);
1301
+ case 405: throw new (error === InvalidMethod.key ? InvalidMethod : NotAllowed)(data);
1302
+ case 406: throw new NotAcceptable(data);
1303
+ case 408: throw new VehicleOffline(data);
1304
+ case 412: throw new PreconditionFailed(data);
1305
+ case 421: throw new InvalidRegion(data);
1306
+ case 422: throw new InvalidResource(data);
1307
+ case 423: throw new Locked(data);
1308
+ case 424: throw new InvalidResponse(data);
1309
+ case 429: throw new RateLimited({
1310
+ reset: resp.headers.get("RateLimit-Reset"),
1311
+ after: resp.headers.get("Retry-After")
1312
+ });
1313
+ case 451: throw new ResourceUnavailableForLegalReasons(data);
1314
+ case 499: throw new ClientClosedRequest(data);
1315
+ case 500: throw new InternalServerError(data);
1316
+ case 502: throw new (error === EnergyGatewayUnreachable.key ? EnergyGatewayUnreachable : BadGateway)(data);
1317
+ case 503: throw new ServiceUnavailable(data);
1318
+ case 504: throw new GatewayTimeout(data);
1319
+ case 540: throw new DeviceUnexpectedResponse(data);
1320
+ }
1321
+ if (data === null) throw new ResponseError(text, resp.status);
1322
+ throw new TeslaFleetError(data, resp.status);
1323
+ }
1324
+ export { AESDecryptAuthFault, AuthorizedClientPairingTimedOut, AuthorizedClientWaitExpired, BadGateway, BluetoothCloudUnavailableError, BluetoothCommandFailed, BluetoothTimeout, BluetoothTransportError, BluetoothUnconfirmedCommand, ClientClosedRequest, CouldNotHashMetadataFault, CouldNotRetrieveKeyFault, CouldNotRetrieveTokenFault, DeviceUnexpectedResponse, ECDSAInputFault, ECDSASignatureFault, EnergyGatewayUnreachable, Forbidden, GatewayTimeout, INFORMATION_FAULTS, IVIncorrectLengthFault, IVSmallerThanExpectedFault, IncorrectEpochFault, InsufficientCredits, InternalServerError, InvalidAuthCode, InvalidCommand, InvalidField, InvalidMethod, InvalidRedirectUrl, InvalidRegion, InvalidRequest, InvalidResource, InvalidResponse, InvalidScope, InvalidTeslemetryToken, InvalidTessieToken, InvalidToken, InvalidTokenFault, KEY_REJECTED_FAULTS, LibraryError, LocalEntityResultFault, LocalEntityStartFault, Locked, LoginRequired, MESSAGE_FAULTS, MissingTeslemetryToken, MissingTessieToken, MissingToken, MobileAccessDisabled, NotAcceptable, NotAllowed, NotFound, NotOnWhitelistFault, NotProvisionedWithIdentityFault, OAuthExpired, OAuthInvalid, PaymentRequired, PreconditionFailed, PrivateKeyError, RateLimited, ResourceUnavailableForLegalReasons, ResponseError, SIGNED_MESSAGE_INFORMATION_FAULTS, ServiceUnavailable, SessionInfoAuthenticationFault, SignatureTooShortFault, SignedCommandRequired, SignedCommandResponseReplayed, SignedMessageInformationFault, SignedMessageInformationFaultAESDecryptAuth, SignedMessageInformationFaultCouldNotHashMetadata, SignedMessageInformationFaultCouldNotRetrieveKey, SignedMessageInformationFaultCouldNotRetrieveToken, SignedMessageInformationFaultECDSAInput, SignedMessageInformationFaultECDSASignature, SignedMessageInformationFaultIVIncorrectLength, SignedMessageInformationFaultIVSmallerThanExpected, SignedMessageInformationFaultIncorrectEpoch, SignedMessageInformationFaultInvalidToken, SignedMessageInformationFaultLocalEntityResult, SignedMessageInformationFaultLocalEntityStart, SignedMessageInformationFaultNotOnWhitelist, SignedMessageInformationFaultNotProvisionedWithIdentity, SignedMessageInformationFaultSignatureTooShort, SignedMessageInformationFaultTimeExpired, SignedMessageInformationFaultTokenAndCounterInvalid, SignedMessageInformationFaultTokenIsIncorrectLength, SignedMessageInformationFaultUnknown, SigningDisabled, SubscriptionRequired, TeslaFleetConnectionError, TeslaFleetError, TeslaFleetInformationFault, TeslaFleetMessageFault, TeslaFleetMessageFaultBadParameter, TeslaFleetMessageFaultBusy, TeslaFleetMessageFaultCommandRequiresAccountCredentials, TeslaFleetMessageFaultCouldNotHashMetadata, TeslaFleetMessageFaultDecoding, TeslaFleetMessageFaultFieldExceedsMTU, TeslaFleetMessageFaultIVIncorrectLength, TeslaFleetMessageFaultInactiveKey, TeslaFleetMessageFaultIncorrectEpoch, TeslaFleetMessageFaultInsufficientPrivileges, TeslaFleetMessageFaultInternal, TeslaFleetMessageFaultInvalidCommand, TeslaFleetMessageFaultInvalidDomains, TeslaFleetMessageFaultInvalidKeyHandle, TeslaFleetMessageFaultInvalidSignature, TeslaFleetMessageFaultInvalidTokenOrCounter, TeslaFleetMessageFaultKeychainIsFull, TeslaFleetMessageFaultNotProvisionedWithIdentity, TeslaFleetMessageFaultRemoteAccessDisabled, TeslaFleetMessageFaultRemoteServiceAccessDisabled, TeslaFleetMessageFaultRepeatedCounter, TeslaFleetMessageFaultRequiresResponseEncryption, TeslaFleetMessageFaultResponseSizeExceedsMTU, TeslaFleetMessageFaultTimeExpired, TeslaFleetMessageFaultTimeToLiveTooLong, TeslaFleetMessageFaultTimeout, TeslaFleetMessageFaultUnknownKeyId, TeslaFleetMessageFaultWrongPersonalization, TeslemetryRegistrationError, TimeExpiredFault, TokenAndCounterInvalidFault, TokenIsIncorrectLengthFault, UnauthorizedClient, UnknownFault, UnsupportedVehicle, VehicleOffline, VehicleSubscriptionRequired, WHITELIST_OPERATION_STATUS, WhitelistOperationAttemptingToAddExistingKey, WhitelistOperationAttemptingToAddKeyWithServiceRole, WhitelistOperationAttemptingToAddKeyWithoutRole, WhitelistOperationAttemptingToDemoteSuperiorToOneself, WhitelistOperationAttemptingToElevateOthersAboveOneself, WhitelistOperationAttemptingToRemoveOwnPermissions, WhitelistOperationCouldNotStartLocalEntityAuth, WhitelistOperationFMAttemptingToAddPermanentKey, WhitelistOperationFMAttemptingToRemovePermanentKey, WhitelistOperationFMModifyingOutsideOfFMode, WhitelistOperationInvalidPublicKey, WhitelistOperationKeychainWhileFSFull, WhitelistOperationKeyfobSlotsFull, WhitelistOperationLocalEntityAuthFailedCancelled, WhitelistOperationLocalEntityAuthFailedTimedOutWaitingForTap, WhitelistOperationLocalEntityAuthFailedTimedOutWaitingForUIAck, WhitelistOperationLocalEntityAuthFailedUIDenied, WhitelistOperationLocalEntityAuthFailedValetMode, WhitelistOperationNoPermissionToAdd, WhitelistOperationNoPermissionToChangePermissions, WhitelistOperationNoPermissionToRemove, WhitelistOperationNoPermissionToRemoveOneself, WhitelistOperationNonServiceKeyAttemptingToAddServiceTech, WhitelistOperationNotAllowedToAddUnlessOnReader, WhitelistOperationPublicKeyNotOnWhitelist, WhitelistOperationServiceKeyAttemptingToAddServiceTechOutsideServiceMode, WhitelistOperationStatus, WhitelistOperationUndocumentedError, WhitelistOperationWhitelistFull, is_key_rejected, raise_for_status };