@jsm-mit/tigi-sharded-package 0.18.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.
@@ -44,6 +44,9 @@ type CarInfo = record {
44
44
  name : text; // make and model, ≤ 120 characters
45
45
  plate : text; // ≤ 16 characters
46
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>`
47
50
  };
48
51
 
49
52
  // What the network shows of a driver in an offer (public). Photos are served by the
@@ -158,6 +161,19 @@ type Quote = record {
158
161
  freeAtNs : opt nat64; // P-23: the driver ends a ride by then; `etaToPickupSec` counts
159
162
  // from now and holds the rest of that ride; no pin, no
160
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
161
177
  };
162
178
 
163
179
  type QuoteDecline = record { requestId : RequestId; driverKey : DriverKey };
@@ -273,6 +289,7 @@ service : {
273
289
  // bookingDropped : (BookingRef) -> (); // P-22
274
290
  // unregisterDriver : (DriverKey) -> ();
275
291
  // submitQuote : (Quote) -> (variant { ok; err : ProtocolError });
292
+ // handOver : (HandOver) -> (variant { ok; err : ProtocolError }); // P-24
276
293
  // declineQuote : (QuoteDecline) -> ();
277
294
  // answerOrder : (OrderAnswer) -> (variant { ok; err : ProtocolError });
278
295
  // rideStatusChanged : (RideStatusChange) -> (variant { ok; err : ProtocolError });
@@ -29,6 +29,7 @@ export type CarColour = { 'red' : null } |
29
29
  * D-42: the car apart — the offer shows each field (WO-N13).
30
30
  */
31
31
  export interface CarInfo {
32
+ 'photoPath' : [] | [string],
32
33
  'name' : string,
33
34
  'plate' : string,
34
35
  'colour' : [] | [CarColour],
@@ -76,6 +77,18 @@ export interface DriverCard {
76
77
  export type DriverKey = string;
77
78
  export interface Geo { 'lat' : number, 'lng' : number }
78
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
+ }
79
92
  export interface Licence {
80
93
  'mimeType' : string,
81
94
  'image' : Uint8Array | number[],
@@ -99,6 +112,11 @@ export interface Quote {
99
112
  'freeAtNs' : [] | [bigint],
100
113
  'requestId' : RequestId,
101
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],
102
120
  'rideSec' : number,
103
121
  'routeLine' : [] | [RouteLine],
104
122
  'driverKey' : DriverKey,
@@ -61,6 +61,7 @@ export const idlFactory = ({ IDL }) => {
61
61
  'yellow' : IDL.Null,
62
62
  });
63
63
  const CarInfo = IDL.Record({
64
+ 'photoPath' : IDL.Opt(IDL.Text),
64
65
  'name' : IDL.Text,
65
66
  'plate' : IDL.Text,
66
67
  'colour' : IDL.Opt(CarColour),
@@ -21,7 +21,14 @@ type CarColour = variant {
21
21
  yellow;
22
22
  };
23
23
  // D-42: the car apart — make and model, plate, colour (the offer shows each, WO-N13).
24
- type CarInfo = record { name : text; plate : text; colour : opt CarColour };
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
+ };
25
32
  // `variant { ok : CardPaymentView; err : ProtocolError }`.
26
33
  type CardPaymentAnswer = variant { ok : CardPaymentView; err : ProtocolError };
27
34
  // P-20: `startCardPayment` — the rider's front gives the page Stripe sends the rider back to.
@@ -28,6 +28,11 @@ export type CarColour = { 'red' : null } |
28
28
  * D-42: the car apart — make and model, plate, colour (the offer shows each, WO-N13).
29
29
  */
30
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],
31
36
  'name' : string,
32
37
  'plate' : string,
33
38
  'colour' : [] | [CarColour],
@@ -93,6 +93,7 @@ export const idlFactory = ({ IDL }) => {
93
93
  'yellow' : IDL.Null,
94
94
  });
95
95
  const CarInfo = IDL.Record({
96
+ 'photoPath' : IDL.Opt(IDL.Text),
96
97
  'name' : IDL.Text,
97
98
  'plate' : IDL.Text,
98
99
  'colour' : IDL.Opt(CarColour),
@@ -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
@@ -319,6 +322,7 @@ type QuoteDecline =
319
322
  };
320
323
  type Quote =
321
324
  record {
325
+ card: opt DriverCardIn;
322
326
  driverKey: DriverKey;
323
327
  driverPosition: opt Geo;
324
328
  etaToPickupSec: nat32;
@@ -427,6 +431,13 @@ type InitArgs =
427
431
  mode: Mode;
428
432
  };
429
433
  type HasSimulatedDriversArgs = record {center: Geo;};
434
+ type HandOver =
435
+ record {
436
+ card: DriverCardIn;
437
+ fromKey: DriverKey;
438
+ requestId: RequestId;
439
+ toKey: DriverKey;
440
+ };
430
441
  type Geohash = text;
431
442
  type Geo =
432
443
  record {
@@ -569,6 +580,7 @@ type CarInfo =
569
580
  record {
570
581
  colour: opt CarColour;
571
582
  name: text;
583
+ photoPath: opt text;
572
584
  plate: text;
573
585
  };
574
586
  type CarColour =
@@ -21,6 +21,7 @@ export type CarColour = { 'red' : null } |
21
21
  { 'white' : null } |
22
22
  { 'yellow' : null };
23
23
  export interface CarInfo {
24
+ 'photoPath' : [] | [string],
24
25
  'name' : string,
25
26
  'plate' : string,
26
27
  'colour' : [] | [CarColour],
@@ -128,6 +129,12 @@ export interface FlowStatus {
128
129
  }
129
130
  export interface Geo { 'lat' : number, 'lng' : number }
130
131
  export type Geohash = string;
132
+ export interface HandOver {
133
+ 'toKey' : DriverKey,
134
+ 'requestId' : RequestId,
135
+ 'card' : DriverCardIn,
136
+ 'fromKey' : DriverKey,
137
+ }
131
138
  export interface HasSimulatedDriversArgs { 'center' : Geo }
132
139
  export interface InitArgs {
133
140
  'home' : Principal,
@@ -200,6 +207,7 @@ export interface Quote {
200
207
  'freeAtNs' : [] | [bigint],
201
208
  'requestId' : RequestId,
202
209
  'rideMeters' : number,
210
+ 'card' : [] | [DriverCardIn],
203
211
  'rideSec' : number,
204
212
  'routeLine' : [] | [RouteLine],
205
213
  'driverKey' : DriverKey,
@@ -444,6 +452,11 @@ export interface TigiWorker {
444
452
  * / ZO-18: the rider gives up.
445
453
  */
446
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>,
447
460
  /**
448
461
  * / WO-20 (stage and the test modes): simulated drivers within 3 km of the point?
449
462
  */
@@ -179,6 +179,7 @@ export const idlFactory = ({ IDL }) => {
179
179
  'yellow' : IDL.Null,
180
180
  });
181
181
  const CarInfo = IDL.Record({
182
+ 'photoPath' : IDL.Opt(IDL.Text),
182
183
  'name' : IDL.Text,
183
184
  'plate' : IDL.Text,
184
185
  'colour' : IDL.Opt(CarColour),
@@ -317,6 +318,21 @@ export const idlFactory = ({ IDL }) => {
317
318
  });
318
319
  const Result_5 = IDL.Variant({ 'ok' : WorkerStatus, 'err' : Error });
319
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
+ });
320
336
  const HasSimulatedDriversArgs = IDL.Record({ 'center' : Geo });
321
337
  const TestLoadArgs = IDL.Record({
322
338
  'reportLevel' : IDL.Opt(IDL.Nat),
@@ -331,15 +347,6 @@ export const idlFactory = ({ IDL }) => {
331
347
  'stars' : IDL.Nat8,
332
348
  'driverKey' : DriverKey,
333
349
  });
334
- const DriverCardIn = IDL.Record({
335
- 'car' : IDL.Opt(CarInfo),
336
- 'carDescription' : IDL.Text,
337
- 'name' : IDL.Text,
338
- 'carrierKind' : CarrierKind,
339
- 'driverKey' : DriverKey,
340
- 'carPhotoCount' : IDL.Nat8,
341
- 'hasLicencePhoto' : IDL.Bool,
342
- });
343
350
  const Geohash = IDL.Text;
344
351
  const RegisterBase = IDL.Record({
345
352
  'card' : DriverCardIn,
@@ -390,6 +397,7 @@ export const idlFactory = ({ IDL }) => {
390
397
  'freeAtNs' : IDL.Opt(IDL.Nat64),
391
398
  'requestId' : RequestId,
392
399
  'rideMeters' : IDL.Nat32,
400
+ 'card' : IDL.Opt(DriverCardIn),
393
401
  'rideSec' : IDL.Nat32,
394
402
  'routeLine' : IDL.Opt(RouteLine),
395
403
  'driverKey' : DriverKey,
@@ -422,6 +430,7 @@ export const idlFactory = ({ IDL }) => {
422
430
  'getStatus' : IDL.Func([], [Result_5], ['query']),
423
431
  'giveBackCycles' : IDL.Func([], [Result_4], []),
424
432
  'giveUp' : IDL.Func([RequestRef], [Result_3], []),
433
+ 'handOver' : IDL.Func([HandOver], [ProtocolResult], []),
425
434
  'hasSimulatedDrivers' : IDL.Func(
426
435
  [HasSimulatedDriversArgs],
427
436
  [Result_3],
package/dist/mappers.d.ts CHANGED
@@ -13,7 +13,7 @@ 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;
16
+ export declare function photoUrl(driverCanister: string, driverKey: string, index: number, host?: string, photoPath?: string): string;
17
17
  /** WO-N13 (D-42): the car apart; the colour as its code (the front translates it). */
18
18
  export declare function carOf(car: CandidCarInfo): CarView;
19
19
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../src/mappers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,IAAI,aAAa,EAAE,WAAW,IAAI,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E,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,11 +22,13 @@ 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
33
  /** WO-N13 (D-42): the car apart; the colour as its code (the front translates it). */
32
34
  export function carOf(car) {
@@ -48,7 +50,7 @@ export function cardOf(card, driverCanister, host, car) {
48
50
  name: card.name,
49
51
  ...carrierOf(card.carrierKind),
50
52
  carDescription: card.carDescription,
51
- 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])),
52
54
  hasLicencePhoto: card.hasLicencePhoto,
53
55
  ...(info === undefined ? {} : { car: carOf(info) }),
54
56
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsm-mit/tigi-sharded-package",
3
- "version": "0.18.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": "97624ea87ce0f31368ec29dadd91686177adb99e"
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": "ad07a52fd72aa3a3bc815621b2f095dcaa760663"
69
+ "commit": "b51dac1e17bb1e09d4160ba584be3bc7bf86a7a0"
70
70
  }
71
71
  }