@iveri/contracts 0.153.0 → 0.154.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -324,6 +324,8 @@ Conduit's outbox.
324
324
  `UniboxAgents` under `@iveri/contracts/unibox`, so the inbox picks agents by name.
325
325
  - Version `0.139.0` adds a trainer's notes on a member: `GymTrainerNote`, `GymTrainerNotes`, `SaveGymTrainerNoteRequest`,
326
326
  `GymMyTrainerNote` and the `GymRefusal` member `not-their-trainer` under `@iveri/contracts/gym`.
327
+ - Version `0.154.0` lets an agent send a failed Unibox reply again: `Message.resendOfMessageId`,
328
+ `ResendMessageResponse`, and the `UniboxRefusal` members `reply-not-failed` and `handed-over`.
327
329
  - Version `0.153.0` adds `UserPermission.CONDUIT_DISPATCH_READ_ANY` (`conduit:dispatch:read-any`, a platform
328
330
  permission) and `MarkConversationReadBody` under `@iveri/contracts/unibox`.
329
331
  - Version `0.152.0` adds the glossary shapes under `@iveri/contracts/localization` (`GlossaryTerm`,
@@ -1,3 +1,5 @@
1
1
  export * from './taxi-admin.type.js';
2
+ export * from './taxi-cancellation-reason.enum.js';
3
+ export * from './taxi-expiry-kind.enum.js';
2
4
  export * from './taxi-refusal.enum.js';
3
5
  export * from './taxi-ride-status.enum.js';
@@ -1,3 +1,5 @@
1
1
  export * from './taxi-admin.type.js';
2
+ export * from './taxi-cancellation-reason.enum.js';
3
+ export * from './taxi-expiry-kind.enum.js';
2
4
  export * from './taxi-refusal.enum.js';
3
5
  export * from './taxi-ride-status.enum.js';
@@ -2,6 +2,8 @@ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
2
  import type { Nullable } from '../../type/nil.type.js';
3
3
  import type { Paginated } from '../../type/paginated.type.js';
4
4
  import type { UUID } from '../../type/uuid.type.js';
5
+ import type { TaxiCancellationReason } from './taxi-cancellation-reason.enum.js';
6
+ import type { TaxiExpiryKind } from './taxi-expiry-kind.enum.js';
5
7
  import type { TaxiRideStatus } from './taxi-ride-status.enum.js';
6
8
  /** A place as the passenger gave it. There is no address search, so it is coordinates only. */
7
9
  export interface TaxiPoint {
@@ -36,7 +38,19 @@ export interface TaxiBoardRide {
36
38
  startedAt: Nullable<IsoDateTime>;
37
39
  completedAt: Nullable<IsoDateTime>;
38
40
  cancelledAt: Nullable<IsoDateTime>;
41
+ /** Where exactly the passenger said they would wait; null when they said nothing or past the retention window. */
42
+ pickupNote: Nullable<string>;
43
+ /** Why the passenger cancelled, when they said; null on any other ride. */
44
+ cancellationReason: Nullable<TaxiCancellationReason>;
45
+ /** Why an expired ride ended without a trip; null on any other ride. */
46
+ expiryKind: Nullable<TaxiExpiryKind>;
39
47
  }
48
+ /**
49
+ * `GET /company/rides?status=&passengerUserId=&driverUserId=&from=&to=&limit=&offset=`: every ride the company was
50
+ * asked for, newest first, for finding the one a passenger or driver is calling about. `from` and `to` are instants
51
+ * bounding when the ride was asked for. Waiting quotes are listed too, since a passenger may call about one.
52
+ */
53
+ export type TaxiCompanyRidesPage = Paginated<TaxiBoardRide>;
40
54
  /**
41
55
  * `GET /company/board?since=`: what is happening now, and what finished since `since` (the start of the company's
42
56
  * day, which only the panel knows). Each list is capped and newest first.
@@ -109,10 +123,32 @@ export interface TaxiDailyTotals {
109
123
  /** Sum of the quoted fares of that day's completed rides, per currency. */
110
124
  completedQuotedFares: TaxiQuotedFareTotal[];
111
125
  }
112
- /** `GET /company/reports/daily?days=&timeZone=`: oldest day first, every day present, zeroes included. */
126
+ /** How many of the period's cancelled rides gave one reason; `reason` null counts those that gave none. */
127
+ export interface TaxiCancellationCount {
128
+ reason: Nullable<TaxiCancellationReason>;
129
+ rides: number;
130
+ }
131
+ /** How many of the period's expired rides ended one way. */
132
+ export interface TaxiExpiryCount {
133
+ kind: TaxiExpiryKind;
134
+ rides: number;
135
+ }
136
+ /**
137
+ * Why the period's rides ended without a trip. Every reason and kind is present, zeroes included, so the counts add up
138
+ * to the days' `cancelled` and `expired`.
139
+ */
140
+ export interface TaxiLostRides {
141
+ cancellations: TaxiCancellationCount[];
142
+ expiries: TaxiExpiryCount[];
143
+ }
144
+ /**
145
+ * `GET /company/reports/daily?days=&timeZone=`: oldest day first, every day present, zeroes included. A ride no driver
146
+ * was ever sent to keeps counting after its row is deleted (24 hours after it ended): only its count is kept.
147
+ */
113
148
  export interface TaxiDailyReport {
114
149
  timeZone: string;
115
150
  from: string;
116
151
  to: string;
117
152
  days: TaxiDailyTotals[];
153
+ lostRides: TaxiLostRides;
118
154
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Why a passenger called a ride off, when they said. A closed set, because a company reads these as counts and free
3
+ * text would be another unbounded place a passenger's words are kept. `driver-asked` exists because a driver cannot
4
+ * cancel; one who needs to asks the passenger.
5
+ */
6
+ export declare enum TaxiCancellationReason {
7
+ CHANGED_PLANS = "changed-plans",
8
+ WAITED_TOO_LONG = "waited-too-long",
9
+ WRONG_PICKUP = "wrong-pickup",
10
+ FOUND_ANOTHER_RIDE = "found-another-ride",
11
+ DRIVER_ASKED = "driver-asked",
12
+ OTHER = "other"
13
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Why a passenger called a ride off, when they said. A closed set, because a company reads these as counts and free
3
+ * text would be another unbounded place a passenger's words are kept. `driver-asked` exists because a driver cannot
4
+ * cancel; one who needs to asks the passenger.
5
+ */
6
+ export var TaxiCancellationReason;
7
+ (function (TaxiCancellationReason) {
8
+ TaxiCancellationReason["CHANGED_PLANS"] = "changed-plans";
9
+ TaxiCancellationReason["WAITED_TOO_LONG"] = "waited-too-long";
10
+ TaxiCancellationReason["WRONG_PICKUP"] = "wrong-pickup";
11
+ TaxiCancellationReason["FOUND_ANOTHER_RIDE"] = "found-another-ride";
12
+ TaxiCancellationReason["DRIVER_ASKED"] = "driver-asked";
13
+ TaxiCancellationReason["OTHER"] = "other";
14
+ })(TaxiCancellationReason || (TaxiCancellationReason = {}));
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Why an `expired` ride ended without a trip. The status alone cannot say, and the three have nothing in common:
3
+ * the passenger's choice, the company's drivers, or the service's own dispatch.
4
+ */
5
+ export declare enum TaxiExpiryKind {
6
+ /** The passenger never accepted the fare before it ran out. */
7
+ QUOTE_NOT_ACCEPTED = "quote-not-accepted",
8
+ /** The search ran and no driver took the ride: too few drivers on shift near the pickup. */
9
+ NO_DRIVER_FOUND = "no-driver-found",
10
+ /** The search could not be started at all, so no driver was ever asked. */
11
+ DISPATCH_FAILED = "dispatch-failed"
12
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Why an `expired` ride ended without a trip. The status alone cannot say, and the three have nothing in common:
3
+ * the passenger's choice, the company's drivers, or the service's own dispatch.
4
+ */
5
+ export var TaxiExpiryKind;
6
+ (function (TaxiExpiryKind) {
7
+ /** The passenger never accepted the fare before it ran out. */
8
+ TaxiExpiryKind["QUOTE_NOT_ACCEPTED"] = "quote-not-accepted";
9
+ /** The search ran and no driver took the ride: too few drivers on shift near the pickup. */
10
+ TaxiExpiryKind["NO_DRIVER_FOUND"] = "no-driver-found";
11
+ /** The search could not be started at all, so no driver was ever asked. */
12
+ TaxiExpiryKind["DISPATCH_FAILED"] = "dispatch-failed";
13
+ })(TaxiExpiryKind || (TaxiExpiryKind = {}));
@@ -69,6 +69,15 @@ export interface Message {
69
69
  * the other end.
70
70
  */
71
71
  dispatchId: Nullable<UUID>;
72
+ /**
73
+ * The failed reply this one sends again, set only by `POST /conversations/:id/messages/:messageId/resend`.
74
+ *
75
+ * Sending again writes a **new** message rather than re-dispatching the failed one: the failed row stays in the thread
76
+ * as the record of what did not go out and why, and the contact receives the words now, after anything said since.
77
+ * At most one message sends a given reply again, so a client shows "Sent again" on a failed reply that one points at
78
+ * and offers Send again only on a failed reply none does.
79
+ */
80
+ resendOfMessageId: Nullable<UUID>;
72
81
  /**
73
82
  * When the message was said, according to the provider — not when we stored it.
74
83
  *
@@ -115,6 +124,16 @@ export interface SendMessageBody {
115
124
  */
116
125
  idempotencyKey?: Nullable<string>;
117
126
  }
127
+ /**
128
+ * `POST /api/v1/conversations/:id/messages/:messageId/resend` takes no body and answers the new {@link Message}.
129
+ *
130
+ * Only a failed reply can be sent again (`reply-not-failed` otherwise). The new message carries the same words,
131
+ * attachments and author, goes through the channel exactly as a reply does, and is dispatched to Conduit under its own
132
+ * id: the failed reply's key would only give back the dispatch that already failed. Asking twice answers the message
133
+ * the first call wrote. The AI agent's reply is not sent again once a person has taken the conversation over
134
+ * (`handed-over`).
135
+ */
136
+ export type ResendMessageResponse = Message;
118
137
  /**
119
138
  * `POST /api/v1/conversations/:id/notes` — a private note in the thread.
120
139
  *
@@ -25,5 +25,15 @@ export declare enum UniboxRefusal {
25
25
  /** Conduit would not take the reply, which is the channel's connection or operation, not the reply itself. */
26
26
  DISPATCH_REFUSED = "dispatch-refused",
27
27
  /** Conduit could not be reached, so the reply was not handed over. Trying again may work. */
28
- DISPATCH_UNAVAILABLE = "dispatch-unavailable"
28
+ DISPATCH_UNAVAILABLE = "dispatch-unavailable",
29
+ /**
30
+ * Send again was asked of a message that is not a failed reply: it was sent after all, is still on its way, or is
31
+ * not a reply. Carries `currentStatus`.
32
+ */
33
+ REPLY_NOT_FAILED = "reply-not-failed",
34
+ /**
35
+ * Send again was asked of the AI agent's reply in a conversation a person has taken over since, where the AI agent
36
+ * no longer speaks.
37
+ */
38
+ HANDED_OVER = "handed-over"
29
39
  }
@@ -27,4 +27,14 @@ export var UniboxRefusal;
27
27
  UniboxRefusal["DISPATCH_REFUSED"] = "dispatch-refused";
28
28
  /** Conduit could not be reached, so the reply was not handed over. Trying again may work. */
29
29
  UniboxRefusal["DISPATCH_UNAVAILABLE"] = "dispatch-unavailable";
30
+ /**
31
+ * Send again was asked of a message that is not a failed reply: it was sent after all, is still on its way, or is
32
+ * not a reply. Carries `currentStatus`.
33
+ */
34
+ UniboxRefusal["REPLY_NOT_FAILED"] = "reply-not-failed";
35
+ /**
36
+ * Send again was asked of the AI agent's reply in a conversation a person has taken over since, where the AI agent
37
+ * no longer speaks.
38
+ */
39
+ UniboxRefusal["HANDED_OVER"] = "handed-over";
30
40
  })(UniboxRefusal || (UniboxRefusal = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iveri/contracts",
3
- "version": "0.153.0",
3
+ "version": "0.154.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {