@jsm-mit/tigi-sharded-package 0.17.0 → 0.19.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.
@@ -33,15 +33,32 @@ type CarrierKind = variant {
33
33
  other : text;
34
34
  };
35
35
 
36
+ // D-42 (DRIVER-FLEET): the colour of a car as a code; the fronts translate it.
37
+ type CarColour = variant {
38
+ white; black; silver; grey; blue; navy; red; maroon; green; yellow; orange; brown;
39
+ beige; gold; purple; other;
40
+ };
41
+
42
+ // D-42: the car apart — the offer shows each field (WO-N13).
43
+ type CarInfo = record {
44
+ name : text; // make and model, ≤ 120 characters
45
+ plate : text; // ≤ 16 characters
46
+ colour : opt CarColour;
47
+ photoPath : opt text; // P-25 (D-48): the car's photos at `/photos/<photoPath>/<n>` of the
48
+ // driver canister (e.g. "car/a2") — a booking's car; none = the
49
+ // photos of `/photos/<driverKey>/<n>`
50
+ };
51
+
36
52
  // What the network shows of a driver in an offer (public). Photos are served by the
37
53
  // driver canister itself over HTTP: `/photos/<driverKey>/<index>` (U-11).
38
54
  type DriverCard = record {
39
55
  driverKey : DriverKey;
40
56
  name : text;
41
57
  carrierKind : CarrierKind;
42
- carDescription : text; // e.g. "Toyota Corolla, srebrna"
58
+ carDescription : text; // e.g. "Toyota Corolla · WX 12345" (also for fronts without `car`)
43
59
  carPhotoCount : nat8; // ≤ 6
44
60
  hasLicencePhoto : bool;
61
+ car : opt CarInfo; // D-42; none from a driver canister before the fleet
45
62
  };
46
63
 
47
64
  type ProtocolError = variant {
@@ -144,6 +161,19 @@ type Quote = record {
144
161
  freeAtNs : opt nat64; // P-23: the driver ends a ride by then; `etaToPickupSec` counts
145
162
  // from now and holds the rest of that ride; no pin, no
146
163
  // `routeLine.toPickup` ("") — they would show the other rider's B
164
+ card : opt DriverCard; // P-24 (D-44): the card and car of this offer — a fleet chooses the
165
+ // driver and the car per booking; none = the base's / registration's
166
+ };
167
+
168
+ // P-24 (D-46, DRIVER-FLEET): the canister hands a request over from one of its drivers to
169
+ // another — an offer or a booking of a ride at a chosen time (until "Jadę"), or a ride under
170
+ // way. The rider sees the new card; the ride and the booking follow `toKey`. `busy` while a
171
+ // booking order waits for the canister's answer, or when `toKey` is on a ride with one queued.
172
+ type HandOver = record {
173
+ requestId : RequestId;
174
+ fromKey : DriverKey;
175
+ toKey : DriverKey;
176
+ card : DriverCard; // of `toKey`, with the car of this request
147
177
  };
148
178
 
149
179
  type QuoteDecline = record { requestId : RequestId; driverKey : DriverKey };
@@ -259,6 +289,7 @@ service : {
259
289
  // bookingDropped : (BookingRef) -> (); // P-22
260
290
  // unregisterDriver : (DriverKey) -> ();
261
291
  // submitQuote : (Quote) -> (variant { ok; err : ProtocolError });
292
+ // handOver : (HandOver) -> (variant { ok; err : ProtocolError }); // P-24
262
293
  // declineQuote : (QuoteDecline) -> ();
263
294
  // answerOrder : (OrderAnswer) -> (variant { ok; err : ProtocolError });
264
295
  // rideStatusChanged : (RideStatusChange) -> (variant { ok; err : ProtocolError });
@@ -6,6 +6,34 @@ import type { IDL } from '@icp-sdk/core/candid';
6
6
  * P-22: a booking of a ride at a chosen time (the driver's "Jadę" / giving it up).
7
7
  */
8
8
  export interface BookingRef { 'requestId' : RequestId, 'driverKey' : DriverKey }
9
+ /**
10
+ * D-42 (DRIVER-FLEET): the colour of a car as a code; the fronts translate it.
11
+ */
12
+ export type CarColour = { 'red' : null } |
13
+ { 'other' : null } |
14
+ { 'blue' : null } |
15
+ { 'gold' : null } |
16
+ { 'grey' : null } |
17
+ { 'orange' : null } |
18
+ { 'navy' : null } |
19
+ { 'purple' : null } |
20
+ { 'green' : null } |
21
+ { 'beige' : null } |
22
+ { 'black' : null } |
23
+ { 'silver' : null } |
24
+ { 'brown' : null } |
25
+ { 'maroon' : null } |
26
+ { 'white' : null } |
27
+ { 'yellow' : null };
28
+ /**
29
+ * D-42: the car apart — the offer shows each field (WO-N13).
30
+ */
31
+ export interface CarInfo {
32
+ 'photoPath' : [] | [string],
33
+ 'name' : string,
34
+ 'plate' : string,
35
+ 'colour' : [] | [CarColour],
36
+ }
9
37
  export interface CardPaymentArgs {
10
38
  'returnUrl' : string,
11
39
  'requestId' : RequestId,
@@ -38,6 +66,7 @@ export type CloseReason = { 'offerRejected' : null } |
38
66
  * driver canister itself over HTTP: `/photos/<driverKey>/<index>` (U-11).
39
67
  */
40
68
  export interface DriverCard {
69
+ 'car' : [] | [CarInfo],
41
70
  'carDescription' : string,
42
71
  'name' : string,
43
72
  'carrierKind' : CarrierKind,
@@ -48,6 +77,18 @@ export interface DriverCard {
48
77
  export type DriverKey = string;
49
78
  export interface Geo { 'lat' : number, 'lng' : number }
50
79
  export type Geohash = string;
80
+ /**
81
+ * P-24 (D-46, DRIVER-FLEET): the canister hands a request over from one of its drivers to
82
+ * another — an offer or a booking of a ride at a chosen time (until "Jadę"), or a ride under
83
+ * way. The rider sees the new card; the ride and the booking follow `toKey`. `busy` while a
84
+ * booking order waits for the canister's answer, or when `toKey` is on a ride with one queued.
85
+ */
86
+ export interface HandOver {
87
+ 'toKey' : DriverKey,
88
+ 'requestId' : RequestId,
89
+ 'card' : DriverCard,
90
+ 'fromKey' : DriverKey,
91
+ }
51
92
  export interface Licence {
52
93
  'mimeType' : string,
53
94
  'image' : Uint8Array | number[],
@@ -71,6 +112,11 @@ export interface Quote {
71
112
  'freeAtNs' : [] | [bigint],
72
113
  'requestId' : RequestId,
73
114
  'rideMeters' : number,
115
+ /**
116
+ * from now and holds the rest of that ride; no pin, no
117
+ * `routeLine.toPickup` ("") — they would show the other rider's B
118
+ */
119
+ 'card' : [] | [DriverCard],
74
120
  'rideSec' : number,
75
121
  'routeLine' : [] | [RouteLine],
76
122
  'driverKey' : DriverKey,
@@ -42,6 +42,30 @@ export const idlFactory = ({ IDL }) => {
42
42
  'cancelledByDriver' : IDL.Record({ 'reason' : IDL.Text }),
43
43
  'inProgress' : IDL.Null,
44
44
  });
45
+ const CarColour = IDL.Variant({
46
+ 'red' : IDL.Null,
47
+ 'other' : IDL.Null,
48
+ 'blue' : IDL.Null,
49
+ 'gold' : IDL.Null,
50
+ 'grey' : IDL.Null,
51
+ 'orange' : IDL.Null,
52
+ 'navy' : IDL.Null,
53
+ 'purple' : IDL.Null,
54
+ 'green' : IDL.Null,
55
+ 'beige' : IDL.Null,
56
+ 'black' : IDL.Null,
57
+ 'silver' : IDL.Null,
58
+ 'brown' : IDL.Null,
59
+ 'maroon' : IDL.Null,
60
+ 'white' : IDL.Null,
61
+ 'yellow' : IDL.Null,
62
+ });
63
+ const CarInfo = IDL.Record({
64
+ 'photoPath' : IDL.Opt(IDL.Text),
65
+ 'name' : IDL.Text,
66
+ 'plate' : IDL.Text,
67
+ 'colour' : IDL.Opt(CarColour),
68
+ });
45
69
  const CarrierKind = IDL.Variant({
46
70
  'other' : IDL.Text,
47
71
  'taxi' : IDL.Null,
@@ -49,6 +73,7 @@ export const idlFactory = ({ IDL }) => {
49
73
  'privateDriver' : IDL.Null,
50
74
  });
51
75
  const DriverCard = IDL.Record({
76
+ 'car' : IDL.Opt(CarInfo),
52
77
  'carDescription' : IDL.Text,
53
78
  'name' : IDL.Text,
54
79
  'carrierKind' : CarrierKind,
@@ -1,4 +1,34 @@
1
1
  type CancelledByDriverStatus = record { reason : text };
2
+ // What the network shows of a driver in an offer (public). Photos are served by the driver
3
+ // canister itself over HTTP: `/photos/<driverKey>/<index>` (U-11).
4
+ // D-42 (DRIVER-FLEET): the colour of a car as a code; the fronts translate it.
5
+ type CarColour = variant {
6
+ red;
7
+ other;
8
+ blue;
9
+ gold;
10
+ grey;
11
+ orange;
12
+ navy;
13
+ purple;
14
+ green;
15
+ beige;
16
+ black;
17
+ silver;
18
+ brown;
19
+ maroon;
20
+ white;
21
+ yellow;
22
+ };
23
+ // D-42: the car apart — make and model, plate, colour (the offer shows each, WO-N13).
24
+ type CarInfo = record {
25
+ // P-25 (D-48): the car's photos at `/photos/<photoPath>/<n>` of this canister
26
+ // (`car/<id>`) — a booking's car, not the one the driver drives now.
27
+ photoPath : opt text;
28
+ name : text;
29
+ plate : text;
30
+ colour : opt CarColour;
31
+ };
2
32
  // `variant { ok : CardPaymentView; err : ProtocolError }`.
3
33
  type CardPaymentAnswer = variant { ok : CardPaymentView; err : ProtocolError };
4
34
  // P-20: `startCardPayment` — the rider's front gives the page Stripe sends the rider back to.
@@ -43,9 +73,9 @@ type CloseReason = variant {
43
73
  orderExpired;
44
74
  };
45
75
  type CompletedStatus = record { price : Money };
46
- // What the network shows of a driver in an offer (public). Photos are served by the driver
47
- // canister itself over HTTP: `/photos/<driverKey>/<index>` (U-11).
48
76
  type DriverCard = record {
77
+ // D-42: the car apart; none before the fleet.
78
+ car : opt CarInfo;
49
79
  carDescription : text;
50
80
  name : text;
51
81
  carrierKind : CarrierKind;
@@ -3,6 +3,40 @@ import type { ActorMethod } from '@icp-sdk/core/agent';
3
3
  import type { IDL } from '@icp-sdk/core/candid';
4
4
 
5
5
  export interface CancelledByDriverStatus { 'reason' : string }
6
+ /**
7
+ * What the network shows of a driver in an offer (public). Photos are served by the driver
8
+ * canister itself over HTTP: `/photos/<driverKey>/<index>` (U-11).
9
+ * D-42 (DRIVER-FLEET): the colour of a car as a code; the fronts translate it.
10
+ */
11
+ export type CarColour = { 'red' : null } |
12
+ { 'other' : null } |
13
+ { 'blue' : null } |
14
+ { 'gold' : null } |
15
+ { 'grey' : null } |
16
+ { 'orange' : null } |
17
+ { 'navy' : null } |
18
+ { 'purple' : null } |
19
+ { 'green' : null } |
20
+ { 'beige' : null } |
21
+ { 'black' : null } |
22
+ { 'silver' : null } |
23
+ { 'brown' : null } |
24
+ { 'maroon' : null } |
25
+ { 'white' : null } |
26
+ { 'yellow' : null };
27
+ /**
28
+ * D-42: the car apart — make and model, plate, colour (the offer shows each, WO-N13).
29
+ */
30
+ export interface CarInfo {
31
+ /**
32
+ * P-25 (D-48): the car's photos at `/photos/<photoPath>/<n>` of this canister
33
+ * (`car/<id>`) — a booking's car, not the one the driver drives now.
34
+ */
35
+ 'photoPath' : [] | [string],
36
+ 'name' : string,
37
+ 'plate' : string,
38
+ 'colour' : [] | [CarColour],
39
+ }
6
40
  /**
7
41
  * `variant { ok : CardPaymentView; err : ProtocolError }`.
8
42
  */
@@ -82,11 +116,11 @@ export type CloseReason = {
82
116
  'orderExpired' : null
83
117
  };
84
118
  export interface CompletedStatus { 'price' : Money }
85
- /**
86
- * What the network shows of a driver in an offer (public). Photos are served by the driver
87
- * canister itself over HTTP: `/photos/<driverKey>/<index>` (U-11).
88
- */
89
119
  export interface DriverCard {
120
+ /**
121
+ * D-42: the car apart; none before the fleet.
122
+ */
123
+ 'car' : [] | [CarInfo],
90
124
  'carDescription' : string,
91
125
  'name' : string,
92
126
  'carrierKind' : CarrierKind,
@@ -74,6 +74,30 @@ export const idlFactory = ({ IDL }) => {
74
74
  'cancelledByDriver' : CancelledByDriverStatus,
75
75
  'inProgress' : IDL.Null,
76
76
  });
77
+ const CarColour = IDL.Variant({
78
+ 'red' : IDL.Null,
79
+ 'other' : IDL.Null,
80
+ 'blue' : IDL.Null,
81
+ 'gold' : IDL.Null,
82
+ 'grey' : IDL.Null,
83
+ 'orange' : IDL.Null,
84
+ 'navy' : IDL.Null,
85
+ 'purple' : IDL.Null,
86
+ 'green' : IDL.Null,
87
+ 'beige' : IDL.Null,
88
+ 'black' : IDL.Null,
89
+ 'silver' : IDL.Null,
90
+ 'brown' : IDL.Null,
91
+ 'maroon' : IDL.Null,
92
+ 'white' : IDL.Null,
93
+ 'yellow' : IDL.Null,
94
+ });
95
+ const CarInfo = IDL.Record({
96
+ 'photoPath' : IDL.Opt(IDL.Text),
97
+ 'name' : IDL.Text,
98
+ 'plate' : IDL.Text,
99
+ 'colour' : IDL.Opt(CarColour),
100
+ });
77
101
  const CarrierKind = IDL.Variant({
78
102
  'other' : IDL.Text,
79
103
  'taxi' : IDL.Null,
@@ -81,6 +105,7 @@ export const idlFactory = ({ IDL }) => {
81
105
  'privateDriver' : IDL.Null,
82
106
  });
83
107
  const DriverCard = IDL.Record({
108
+ 'car' : IDL.Opt(CarInfo),
84
109
  'carDescription' : IDL.Text,
85
110
  'name' : IDL.Text,
86
111
  'carrierKind' : CarrierKind,
@@ -68,6 +68,9 @@ type TigiWorker =
68
68
  giveBackCycles: () -> (Result_4);
69
69
  /// ZO-18: the rider gives up.
70
70
  giveUp: (ref: RequestRef) -> (Result_3);
71
+ /// P-24 (D-46): the canister hands a request over between its drivers — an offer or a
72
+ /// booking of a ride at a chosen time, or a ride under way (variant B).
73
+ handOver: (args: HandOver) -> (ProtocolResult);
71
74
  /// WO-20 (stage and the test modes): simulated drivers within 3 km of the point?
72
75
  hasSimulatedDrivers: (args: HasSimulatedDriversArgs) -> (Result_3) query;
73
76
  /// The coordinator only, in a test mode only (prod and stage refuse, and so does the
@@ -132,6 +135,7 @@ type ScheduledStateView =
132
135
  variant {
133
136
  booked:
134
137
  record {
138
+ car: opt CarInfo;
135
139
  card: DriverCard;
136
140
  driverCanister: principal;
137
141
  driverKey: DriverKey;
@@ -292,7 +296,7 @@ type RequestId = text;
292
296
  type RegisterDriver =
293
297
  record {
294
298
  available: bool;
295
- card: DriverCard;
299
+ card: DriverCardIn;
296
300
  cardVersion: nat32;
297
301
  driverKey: DriverKey;
298
302
  freeAtNs: opt nat64;
@@ -301,7 +305,7 @@ type RegisterDriver =
301
305
  };
302
306
  type RegisterBase =
303
307
  record {
304
- card: DriverCard;
308
+ card: DriverCardIn;
305
309
  cardVersion: nat32;
306
310
  driverKey: DriverKey;
307
311
  geohash: Geohash;
@@ -318,6 +322,7 @@ type QuoteDecline =
318
322
  };
319
323
  type Quote =
320
324
  record {
325
+ card: opt DriverCardIn;
321
326
  driverKey: DriverKey;
322
327
  driverPosition: opt Geo;
323
328
  etaToPickupSec: nat32;
@@ -364,6 +369,7 @@ type OrderAnswer =
364
369
  };
365
370
  type OfferView =
366
371
  record {
372
+ car: opt CarInfo;
367
373
  card: DriverCard;
368
374
  driverCanister: principal;
369
375
  driverKey: DriverKey;
@@ -425,6 +431,13 @@ type InitArgs =
425
431
  mode: Mode;
426
432
  };
427
433
  type HasSimulatedDriversArgs = record {center: Geo;};
434
+ type HandOver =
435
+ record {
436
+ card: DriverCardIn;
437
+ fromKey: DriverKey;
438
+ requestId: RequestId;
439
+ toKey: DriverKey;
440
+ };
428
441
  type Geohash = text;
429
442
  type Geo =
430
443
  record {
@@ -460,6 +473,16 @@ type Error =
460
473
  logsJson: text;
461
474
  };
462
475
  type DriverKey = text;
476
+ type DriverCardIn =
477
+ record {
478
+ car: opt CarInfo;
479
+ carDescription: text;
480
+ carPhotoCount: nat8;
481
+ carrierKind: CarrierKind;
482
+ driverKey: DriverKey;
483
+ hasLicencePhoto: bool;
484
+ name: text;
485
+ };
463
486
  type DriverCard =
464
487
  record {
465
488
  carDescription: text;
@@ -553,6 +576,32 @@ type CarrierKind =
553
576
  rideHailing;
554
577
  taxi;
555
578
  };
579
+ type CarInfo =
580
+ record {
581
+ colour: opt CarColour;
582
+ name: text;
583
+ photoPath: opt text;
584
+ plate: text;
585
+ };
586
+ type CarColour =
587
+ variant {
588
+ beige;
589
+ black;
590
+ blue;
591
+ brown;
592
+ gold;
593
+ green;
594
+ grey;
595
+ maroon;
596
+ navy;
597
+ orange;
598
+ other;
599
+ purple;
600
+ red;
601
+ silver;
602
+ white;
603
+ yellow;
604
+ };
556
605
  type BookingRef =
557
606
  record {
558
607
  driverKey: DriverKey;
@@ -4,6 +4,28 @@ import type { IDL } from '@icp-sdk/core/candid';
4
4
 
5
5
  export interface AreaMap { 'entries' : Array<PrefixEntry>, 'version' : bigint }
6
6
  export interface BookingRef { 'requestId' : RequestId, 'driverKey' : DriverKey }
7
+ export type CarColour = { 'red' : null } |
8
+ { 'other' : null } |
9
+ { 'blue' : null } |
10
+ { 'gold' : null } |
11
+ { 'grey' : null } |
12
+ { 'orange' : null } |
13
+ { 'navy' : null } |
14
+ { 'purple' : null } |
15
+ { 'green' : null } |
16
+ { 'beige' : null } |
17
+ { 'black' : null } |
18
+ { 'silver' : null } |
19
+ { 'brown' : null } |
20
+ { 'maroon' : null } |
21
+ { 'white' : null } |
22
+ { 'yellow' : null };
23
+ export interface CarInfo {
24
+ 'photoPath' : [] | [string],
25
+ 'name' : string,
26
+ 'plate' : string,
27
+ 'colour' : [] | [CarColour],
28
+ }
7
29
  export type CarrierKind = { 'other' : string } |
8
30
  { 'taxi' : null } |
9
31
  { 'rideHailing' : null } |
@@ -75,6 +97,15 @@ export interface DriverCard {
75
97
  'carPhotoCount' : number,
76
98
  'hasLicencePhoto' : boolean,
77
99
  }
100
+ export interface DriverCardIn {
101
+ 'car' : [] | [CarInfo],
102
+ 'carDescription' : string,
103
+ 'name' : string,
104
+ 'carrierKind' : CarrierKind,
105
+ 'driverKey' : DriverKey,
106
+ 'carPhotoCount' : number,
107
+ 'hasLicencePhoto' : boolean,
108
+ }
78
109
  export type DriverKey = string;
79
110
  export interface Error { 'details' : ErrorDetails, 'logsJson' : string }
80
111
  export type ErrorDetails = { 'InterCanisterConnectionError' : null } |
@@ -98,6 +129,12 @@ export interface FlowStatus {
98
129
  }
99
130
  export interface Geo { 'lat' : number, 'lng' : number }
100
131
  export type Geohash = string;
132
+ export interface HandOver {
133
+ 'toKey' : DriverKey,
134
+ 'requestId' : RequestId,
135
+ 'card' : DriverCardIn,
136
+ 'fromKey' : DriverKey,
137
+ }
101
138
  export interface HasSimulatedDriversArgs { 'center' : Geo }
102
139
  export interface InitArgs {
103
140
  'home' : Principal,
@@ -132,6 +169,7 @@ export interface OfferRef {
132
169
  'driverCanister' : Principal,
133
170
  }
134
171
  export interface OfferView {
172
+ 'car' : [] | [CarInfo],
135
173
  'freeAtNs' : [] | [bigint],
136
174
  'rideMeters' : number,
137
175
  'driverRating' : [] | [number],
@@ -169,6 +207,7 @@ export interface Quote {
169
207
  'freeAtNs' : [] | [bigint],
170
208
  'requestId' : RequestId,
171
209
  'rideMeters' : number,
210
+ 'card' : [] | [DriverCardIn],
172
211
  'rideSec' : number,
173
212
  'routeLine' : [] | [RouteLine],
174
213
  'driverKey' : DriverKey,
@@ -184,14 +223,14 @@ export interface QuoteDecline {
184
223
  }
185
224
  export interface RateDriverArgs { 'requestId' : RequestId, 'stars' : number }
186
225
  export interface RegisterBase {
187
- 'card' : DriverCard,
226
+ 'card' : DriverCardIn,
188
227
  'cardVersion' : number,
189
228
  'geohash' : Geohash,
190
229
  'driverKey' : DriverKey,
191
230
  }
192
231
  export interface RegisterDriver {
193
232
  'freeAtNs' : [] | [bigint],
194
- 'card' : DriverCard,
233
+ 'card' : DriverCardIn,
195
234
  'cardVersion' : number,
196
235
  'geohash' : Geohash,
197
236
  'available' : boolean,
@@ -292,6 +331,7 @@ export type ScheduledStateView = { 'rescue' : { 'reason' : RescueReason } } |
292
331
  { 'started' : { 'driverKey' : DriverKey, 'driverCanister' : Principal } } |
293
332
  {
294
333
  'booked' : {
334
+ 'car' : [] | [CarInfo],
295
335
  'driverRating' : [] | [number],
296
336
  'card' : DriverCard,
297
337
  'driverKey' : DriverKey,
@@ -412,6 +452,11 @@ export interface TigiWorker {
412
452
  * / ZO-18: the rider gives up.
413
453
  */
414
454
  'giveUp' : ActorMethod<[RequestRef], Result_3>,
455
+ /**
456
+ * / P-24 (D-46): the canister hands a request over between its drivers — an offer or a
457
+ * / booking of a ride at a chosen time, or a ride under way (variant B).
458
+ */
459
+ 'handOver' : ActorMethod<[HandOver], ProtocolResult>,
415
460
  /**
416
461
  * / WO-20 (stage and the test modes): simulated drivers within 3 km of the point?
417
462
  */
@@ -160,6 +160,30 @@ export const idlFactory = ({ IDL }) => {
160
160
  const Result_7 = IDL.Variant({ 'ok' : RouteLine, 'err' : Error });
161
161
  const PrefixCount = IDL.Record({ 'load' : IDL.Nat, 'prefix' : IDL.Text });
162
162
  const Result_6 = IDL.Variant({ 'ok' : IDL.Vec(PrefixCount), 'err' : Error });
163
+ const CarColour = IDL.Variant({
164
+ 'red' : IDL.Null,
165
+ 'other' : IDL.Null,
166
+ 'blue' : IDL.Null,
167
+ 'gold' : IDL.Null,
168
+ 'grey' : IDL.Null,
169
+ 'orange' : IDL.Null,
170
+ 'navy' : IDL.Null,
171
+ 'purple' : IDL.Null,
172
+ 'green' : IDL.Null,
173
+ 'beige' : IDL.Null,
174
+ 'black' : IDL.Null,
175
+ 'silver' : IDL.Null,
176
+ 'brown' : IDL.Null,
177
+ 'maroon' : IDL.Null,
178
+ 'white' : IDL.Null,
179
+ 'yellow' : IDL.Null,
180
+ });
181
+ const CarInfo = IDL.Record({
182
+ 'photoPath' : IDL.Opt(IDL.Text),
183
+ 'name' : IDL.Text,
184
+ 'plate' : IDL.Text,
185
+ 'colour' : IDL.Opt(CarColour),
186
+ });
163
187
  const CarrierKind = IDL.Variant({
164
188
  'other' : IDL.Text,
165
189
  'taxi' : IDL.Null,
@@ -177,6 +201,7 @@ export const idlFactory = ({ IDL }) => {
177
201
  const Money = IDL.Record({ 'currency' : IDL.Text, 'amount' : IDL.Nat64 });
178
202
  const Geo = IDL.Record({ 'lat' : IDL.Float64, 'lng' : IDL.Float64 });
179
203
  const OfferView = IDL.Record({
204
+ 'car' : IDL.Opt(CarInfo),
180
205
  'freeAtNs' : IDL.Opt(IDL.Nat64),
181
206
  'rideMeters' : IDL.Nat32,
182
207
  'driverRating' : IDL.Opt(IDL.Nat16),
@@ -241,6 +266,7 @@ export const idlFactory = ({ IDL }) => {
241
266
  'driverCanister' : IDL.Principal,
242
267
  }),
243
268
  'booked' : IDL.Record({
269
+ 'car' : IDL.Opt(CarInfo),
244
270
  'driverRating' : IDL.Opt(IDL.Nat16),
245
271
  'card' : DriverCard,
246
272
  'driverKey' : DriverKey,
@@ -292,6 +318,21 @@ export const idlFactory = ({ IDL }) => {
292
318
  });
293
319
  const Result_5 = IDL.Variant({ 'ok' : WorkerStatus, 'err' : Error });
294
320
  const Result_4 = IDL.Variant({ 'ok' : IDL.Nat, 'err' : Error });
321
+ const DriverCardIn = IDL.Record({
322
+ 'car' : IDL.Opt(CarInfo),
323
+ 'carDescription' : IDL.Text,
324
+ 'name' : IDL.Text,
325
+ 'carrierKind' : CarrierKind,
326
+ 'driverKey' : DriverKey,
327
+ 'carPhotoCount' : IDL.Nat8,
328
+ 'hasLicencePhoto' : IDL.Bool,
329
+ });
330
+ const HandOver = IDL.Record({
331
+ 'toKey' : DriverKey,
332
+ 'requestId' : RequestId,
333
+ 'card' : DriverCardIn,
334
+ 'fromKey' : DriverKey,
335
+ });
295
336
  const HasSimulatedDriversArgs = IDL.Record({ 'center' : Geo });
296
337
  const TestLoadArgs = IDL.Record({
297
338
  'reportLevel' : IDL.Opt(IDL.Nat),
@@ -308,14 +349,14 @@ export const idlFactory = ({ IDL }) => {
308
349
  });
309
350
  const Geohash = IDL.Text;
310
351
  const RegisterBase = IDL.Record({
311
- 'card' : DriverCard,
352
+ 'card' : DriverCardIn,
312
353
  'cardVersion' : IDL.Nat32,
313
354
  'geohash' : Geohash,
314
355
  'driverKey' : DriverKey,
315
356
  });
316
357
  const RegisterDriver = IDL.Record({
317
358
  'freeAtNs' : IDL.Opt(IDL.Nat64),
318
- 'card' : DriverCard,
359
+ 'card' : DriverCardIn,
319
360
  'cardVersion' : IDL.Nat32,
320
361
  'geohash' : Geohash,
321
362
  'available' : IDL.Bool,
@@ -356,6 +397,7 @@ export const idlFactory = ({ IDL }) => {
356
397
  'freeAtNs' : IDL.Opt(IDL.Nat64),
357
398
  'requestId' : RequestId,
358
399
  'rideMeters' : IDL.Nat32,
400
+ 'card' : IDL.Opt(DriverCardIn),
359
401
  'rideSec' : IDL.Nat32,
360
402
  'routeLine' : IDL.Opt(RouteLine),
361
403
  'driverKey' : DriverKey,
@@ -388,6 +430,7 @@ export const idlFactory = ({ IDL }) => {
388
430
  'getStatus' : IDL.Func([], [Result_5], ['query']),
389
431
  'giveBackCycles' : IDL.Func([], [Result_4], []),
390
432
  'giveUp' : IDL.Func([RequestRef], [Result_3], []),
433
+ 'handOver' : IDL.Func([HandOver], [ProtocolResult], []),
391
434
  'hasSimulatedDrivers' : IDL.Func(
392
435
  [HasSimulatedDriversArgs],
393
436
  [Result_3],
@@ -97,7 +97,7 @@ export class ScheduledRide {
97
97
  const rating = offer.driverRating[0];
98
98
  offers.push({
99
99
  offerId,
100
- card: cardOf(offer.card, canister, this.options.host),
100
+ card: cardOf(offer.card, canister, this.options.host, offer.car),
101
101
  ...(rating === undefined ? {} : { driverRating: rating / 100 }),
102
102
  rideMeters: offer.rideMeters,
103
103
  rideSec: offer.rideSec,
@@ -131,7 +131,7 @@ export class ScheduledRide {
131
131
  snapshot.nextStageMs = msOf(next);
132
132
  if ("booked" in state) {
133
133
  const rating = state.booked.driverRating[0];
134
- snapshot.booked = { card: cardOf(state.booked.card, state.booked.driverCanister.toText(), this.options.host), ...(rating === undefined ? {} : { driverRating: rating / 100 }), price: moneyOf(state.booked.price) };
134
+ snapshot.booked = { card: cardOf(state.booked.card, state.booked.driverCanister.toText(), this.options.host, state.booked.car), ...(rating === undefined ? {} : { driverRating: rating / 100 }), price: moneyOf(state.booked.price) };
135
135
  }
136
136
  if ("rescue" in state)
137
137
  snapshot.rescue = Object.keys(state.rescue.reason)[0];
@@ -8,14 +8,25 @@ export interface Money {
8
8
  }
9
9
  export type CarrierKind = "privateDriver" | "taxi" | "rideHailing" | "other";
10
10
  /** The public card of a driver (P-12), with the URLs of its car photos (P-7). */
11
+ /** D-42 (DRIVER-FLEET): the colour of a car as a code; the front translates it. */
12
+ export type CarColour = "white" | "black" | "silver" | "grey" | "blue" | "navy" | "red" | "maroon" | "green" | "yellow" | "orange" | "brown" | "beige" | "gold" | "purple" | "other";
13
+ /** D-42: a car apart — make and model, plate, colour. */
14
+ export interface CarView {
15
+ name: string;
16
+ plate: string;
17
+ colour?: CarColour;
18
+ }
11
19
  export interface DriverCardView {
12
20
  name: string;
13
21
  carrierKind: CarrierKind;
14
22
  /** The driver's own words when `carrierKind` is "other". */
15
23
  carrierOther?: string;
24
+ /** One text for fronts that do not show `car` (with a fleet car: "make and model · plate"). */
16
25
  carDescription: string;
17
26
  carPhotoUrls: string[];
18
27
  hasLicencePhoto: boolean;
28
+ /** WO-N13 (D-42): the car apart; none from a driver canister before the fleet. */
29
+ car?: CarView;
19
30
  }
20
31
  /**
21
32
  * Why an offer left the rider's list (U-42, ZO-11a). The entry keeps its place, so the front
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,YAAY,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,wEAAwE;AACxE,MAAM,WAAW,KAAK;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,MAAM,GAAG,aAAa,GAAG,OAAO,CAAC;AAE7E,iFAAiF;AACjF,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,WAAW,CAAC;IACzB,4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,eAAe,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEhF;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACtB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,cAAc,CAAC;IACrB,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC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O,EAAE,MAAM,CAAA;CAAE,CAAC;AAExI,sEAAsE;AACtE,MAAM,WAAW,WAAW;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,wIAAwI;AACxI,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,UAAU,GAAG,MAAM,EAAE,CAAC;IAC9B,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;CACrB"}
package/dist/mappers.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { CarrierKind as CandidCarrierKind, DriverCard, Money as CandidMoney, RideStatus, RouteLine } from "../declarations/tigi-driver/tigi-driver.did.js";
1
+ import type { CarInfo as CandidCarInfo, CarrierKind as CandidCarrierKind, DriverCard, Money as CandidMoney, RideStatus, RouteLine } from "../declarations/tigi-driver/tigi-driver.did.js";
2
2
  import type { OfferView as CandidOfferView, RequestView as CandidRequestView } from "../declarations/worker/worker.did.js";
3
3
  import type { RateRideOutcome as CandidRateRideOutcome, RideView as CandidHistoryRide } from "../declarations/core/core.did.js";
4
- import type { CarrierKind, CloseReason, DriverCardView, Money, OfferView, RateRideOutcome, RequestPhase, RideHistoryEntry, RideStatusView, RideView, RouteLineView } from "./interfaces.js";
4
+ import type { CarView, CarrierKind, CloseReason, DriverCardView, Money, OfferView, RateRideOutcome, RequestPhase, RideHistoryEntry, RideStatusView, RideView, RouteLineView } from "./interfaces.js";
5
5
  export declare const NS_PER_MS = 1000000n;
6
6
  export declare function msOf(ns: bigint): number;
7
7
  export declare function moneyOf(money: CandidMoney): Money;
@@ -13,8 +13,16 @@ export declare function carrierOf(kind: CandidCarrierKind): {
13
13
  * The URL of a car photo (P-7, `/photos/<driverKey>/<index>`), served certified by the
14
14
  * driver canister. An empty driverKey is `_` (a path cannot hold `//` everywhere).
15
15
  */
16
- export declare function photoUrl(driverCanister: string, driverKey: string, index: number, host?: string): string;
17
- export declare function cardOf(card: DriverCard, driverCanister: string, host?: string): DriverCardView;
16
+ export declare function photoUrl(driverCanister: string, driverKey: string, index: number, host?: string, photoPath?: string): string;
17
+ /** WO-N13 (D-42): the car apart; the colour as its code (the front translates it). */
18
+ export declare function carOf(car: CandidCarInfo): CarView;
19
+ /**
20
+ * The card a rider sees. `car`: the car the worker keeps apart (an offer); without it, the
21
+ * card's own (a ride, from the driver canister). Old canisters send none.
22
+ */
23
+ export declare function cardOf(card: Omit<DriverCard, "car"> & {
24
+ car?: [] | [CandidCarInfo];
25
+ }, driverCanister: string, host?: string, car?: [] | [CandidCarInfo]): DriverCardView;
18
26
  export declare function rideStatusOf(status: RideStatus): RideStatusView;
19
27
  export declare function closeReasonOf(reason: {
20
28
  offerRejected: null;
@@ -1 +1 @@
1
- {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../src/mappers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,IAAI,iBAAiB,EAAE,UAAU,EAAE,KAAK,IAAI,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAC;AAChK,OAAO,KAAK,EAAE,SAAS,IAAI,eAAe,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC3H,OAAO,KAAK,EAAE,eAAe,IAAI,qBAAqB,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAEhI,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAW,gBAAgB,EAAkB,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,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EAAE,iBAAiB,GAAG,YAAY,CAE7D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,CAMhE;AAKD,sFAAsF;AACtF,eAAO,MAAM,WAAW,QAAS,CAAC;AAElC,wEAAwE;AACxE,MAAM,WAAW,QAAQ,CAAC,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS;IAAE,MAAM,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,EAAE,CActM;AAID;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,EAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAalF"}
package/dist/mappers.js CHANGED
@@ -22,20 +22,37 @@ export function carrierOf(kind) {
22
22
  * The URL of a car photo (P-7, `/photos/<driverKey>/<index>`), served certified by the
23
23
  * driver canister. An empty driverKey is `_` (a path cannot hold `//` everywhere).
24
24
  */
25
- export function photoUrl(driverCanister, driverKey, index, host = MAINNET_HOST) {
25
+ export function photoUrl(driverCanister, driverKey, index, host = MAINNET_HOST, photoPath) {
26
26
  const key = driverKey === "" ? "_" : encodeURIComponent(driverKey);
27
27
  const url = new URL(host);
28
28
  const origin = isLocalHost(host) ? `${url.protocol}//${driverCanister}.localhost${url.port ? `:${url.port}` : ""}` : `${url.protocol}//${driverCanister}.${url.host}`;
29
- return `${origin}/photos/${key}/${index}`;
29
+ // P-25 (D-48): a booking's car has its own photos (e.g. "car/a2"), not the driver's car of now.
30
+ const path = photoPath === undefined ? key : photoPath.split("/").map(encodeURIComponent).join("/");
31
+ return `${origin}/photos/${path}/${index}`;
30
32
  }
31
- export function cardOf(card, driverCanister, host) {
33
+ /** WO-N13 (D-42): the car apart; the colour as its code (the front translates it). */
34
+ export function carOf(car) {
35
+ const colour = car.colour[0];
36
+ return {
37
+ name: car.name,
38
+ plate: car.plate,
39
+ ...(colour === undefined ? {} : { colour: Object.keys(colour)[0] }),
40
+ };
41
+ }
42
+ /**
43
+ * The card a rider sees. `car`: the car the worker keeps apart (an offer); without it, the
44
+ * card's own (a ride, from the driver canister). Old canisters send none.
45
+ */
46
+ export function cardOf(card, driverCanister, host, car) {
32
47
  const photos = Math.min(6, card.carPhotoCount);
48
+ const info = (car ?? card.car)?.[0];
33
49
  return {
34
50
  name: card.name,
35
51
  ...carrierOf(card.carrierKind),
36
52
  carDescription: card.carDescription,
37
- carPhotoUrls: Array.from({ length: photos }, (_, index) => photoUrl(driverCanister, card.driverKey, index, host)),
53
+ carPhotoUrls: Array.from({ length: photos }, (_, index) => photoUrl(driverCanister, card.driverKey, index, host, info?.photoPath[0])),
38
54
  hasLicencePhoto: card.hasLicencePhoto,
55
+ ...(info === undefined ? {} : { car: carOf(info) }),
39
56
  };
40
57
  }
41
58
  export function rideStatusOf(status) {
@@ -146,7 +163,7 @@ export function offerOf(offer, simulator, host) {
146
163
  const pin = pinExact ? { lat: exact.lat, lng: exact.lng } : freeAtMs !== undefined ? undefined : (decodeGeohashCenter(offer.pinGeohash) ?? { lat: 0, lng: 0 });
147
164
  return {
148
165
  offerId: offerIdOf(canister, offer.driverKey),
149
- card: cardOf(offer.card, canister, host),
166
+ card: cardOf(offer.card, canister, host, offer.car),
150
167
  driverRating: offer.driverRating[0] === undefined ? undefined : offer.driverRating[0] / 100,
151
168
  ...(pin === undefined ? {} : { pin }),
152
169
  pinExact,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsm-mit/tigi-sharded-package",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "The one package of the Tigi network group: takes the coordinator's id and hides the coordinator, the core and the workers — for a consumer the group is one canister; plus the rider's few driver-canister endpoints (U-14).",
5
5
  "homepage": "https://github.com/JSM-Tigi/tigi-sharded/tree/master/package#readme",
6
6
  "repository": {
@@ -61,11 +61,11 @@
61
61
  "tigiSharded": {
62
62
  "repo": "tigi-sharded",
63
63
  "repoUrl": "https://github.com/JSM-Tigi/tigi-sharded",
64
- "commit": "ab8222c13b3e1ce46678c4e68597c3d52ba57170"
64
+ "commit": "46178c2bfa4cb99d29408d09014f41f31ee64636"
65
65
  },
66
66
  "tigiDriverRust": {
67
67
  "repo": "tigi-driver-rust",
68
68
  "repoUrl": "https://github.com/JSM-Tigi/tigi-driver-rust",
69
- "commit": "6359c22dbf23d217ca47a0660fa6b1a43dab73de"
69
+ "commit": "b51dac1e17bb1e09d4160ba584be3bc7bf86a7a0"
70
70
  }
71
71
  }