@iveri/contracts 0.152.0 → 0.153.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.153.0` adds `UserPermission.CONDUIT_DISPATCH_READ_ANY` (`conduit:dispatch:read-any`, a platform
328
+ permission) and `MarkConversationReadBody` under `@iveri/contracts/unibox`.
327
329
  - Version `0.152.0` adds the glossary shapes under `@iveri/contracts/localization` (`GlossaryTerm`,
328
330
  `GlossaryTermTranslation`, `GlossaryTermList`, `CreateGlossaryTermBody`, `UpdateGlossaryTermBody`,
329
331
  `TranslationConsistencyGlossary`; `TranslationConsistencyGroup.glossary` and
@@ -38,6 +38,9 @@ export interface Conversation {
38
38
  * Per conversation, not per agent. A shared inbox is shared: two agents looking at the same
39
39
  * queue should see the same numbers, and per-agent unread counts turn "has anyone dealt with
40
40
  * this" into a question the UI cannot answer.
41
+ *
42
+ * An inbound message adds one; {@link MarkConversationReadBody} brings it down to the messages
43
+ * newer than the one an agent was shown. Snoozing, closing and replying leave it alone.
41
44
  */
42
45
  unreadCount: number;
43
46
  /** First ~200 characters of the last message, for the list. Null on an empty conversation. */
@@ -137,3 +140,15 @@ export interface HandoverConversationBody {
137
140
  /** Defaults to the caller. Naming someone else is a handover *to* them. */
138
141
  userId?: Nullable<UUID>;
139
142
  }
143
+ /**
144
+ * `POST /api/v1/conversations/:id/read` — an agent has been shown the thread up to a message.
145
+ *
146
+ * Names the newest message the agent was shown rather than meaning "everything", so a customer
147
+ * message that lands between the thread loading and this call stays unread: the count becomes the
148
+ * inbound messages after that one (in the thread's own order), and never goes up. Answers the
149
+ * conversation.
150
+ */
151
+ export interface MarkConversationReadBody {
152
+ /** The newest message of this conversation the agent was shown. */
153
+ throughMessageId: UUID;
154
+ }
@@ -5,9 +5,13 @@
5
5
  * {@link MessageStatus.NONE} respectively — the states below describe our side of a send, and a
6
6
  * message that arrived has no send to describe.
7
7
  *
8
- * The three post-send states mirror what the messaging platforms report back through their status
8
+ * `delivered` and `read` mirror what the messaging platforms report back through their status
9
9
  * webhooks, and they arrive **through the inbound pipeline** (§11): a provider telling us a
10
10
  * message was read is just another webhook. Nothing polls for them.
11
+ *
12
+ * Conduit's own outcome is different: `unibox-api` asks Conduit how each dispatch it submitted
13
+ * ended. Conduit `delivered` (the provider's API accepted it) becomes {@link MessageStatus.SENT},
14
+ * never `delivered`; Conduit `dead-lettered` or `cancelled` becomes {@link MessageStatus.FAILED}.
11
15
  */
12
16
  export declare enum MessageStatus {
13
17
  /** Not applicable — an internal note. */
@@ -22,7 +26,7 @@ export declare enum MessageStatus {
22
26
  * exactly the moment a provider outage matters.
23
27
  */
24
28
  QUEUED = "queued",
25
- /** The provider accepted it. */
29
+ /** The provider accepted it: Conduit delivered the dispatch, or the provider said so. */
26
30
  SENT = "sent",
27
31
  /** The provider says it reached the contact's device. */
28
32
  DELIVERED = "delivered",
@@ -31,8 +35,9 @@ export declare enum MessageStatus {
31
35
  /**
32
36
  * It will not be sent. Terminal.
33
37
  *
34
- * Set when Conduit dead-letters the dispatch, or when the send is refused outright — an
35
- * inactive channel, a closed messaging window. `failureReason` carries the why, because
38
+ * Set when Conduit dead-letters or cancels the dispatch, or when the send is refused outright — an
39
+ * inactive channel, a closed messaging window. A dead-lettered reply an operator redrives in
40
+ * Conduit and that is then delivered moves on to `sent`. `failureReason` carries the why, because
36
41
  * "failed" alone sends an agent to ask an engineer.
37
42
  */
38
43
  FAILED = "failed"
@@ -5,9 +5,13 @@
5
5
  * {@link MessageStatus.NONE} respectively — the states below describe our side of a send, and a
6
6
  * message that arrived has no send to describe.
7
7
  *
8
- * The three post-send states mirror what the messaging platforms report back through their status
8
+ * `delivered` and `read` mirror what the messaging platforms report back through their status
9
9
  * webhooks, and they arrive **through the inbound pipeline** (§11): a provider telling us a
10
10
  * message was read is just another webhook. Nothing polls for them.
11
+ *
12
+ * Conduit's own outcome is different: `unibox-api` asks Conduit how each dispatch it submitted
13
+ * ended. Conduit `delivered` (the provider's API accepted it) becomes {@link MessageStatus.SENT},
14
+ * never `delivered`; Conduit `dead-lettered` or `cancelled` becomes {@link MessageStatus.FAILED}.
11
15
  */
12
16
  export var MessageStatus;
13
17
  (function (MessageStatus) {
@@ -23,7 +27,7 @@ export var MessageStatus;
23
27
  * exactly the moment a provider outage matters.
24
28
  */
25
29
  MessageStatus["QUEUED"] = "queued";
26
- /** The provider accepted it. */
30
+ /** The provider accepted it: Conduit delivered the dispatch, or the provider said so. */
27
31
  MessageStatus["SENT"] = "sent";
28
32
  /** The provider says it reached the contact's device. */
29
33
  MessageStatus["DELIVERED"] = "delivered";
@@ -32,8 +36,9 @@ export var MessageStatus;
32
36
  /**
33
37
  * It will not be sent. Terminal.
34
38
  *
35
- * Set when Conduit dead-letters the dispatch, or when the send is refused outright — an
36
- * inactive channel, a closed messaging window. `failureReason` carries the why, because
39
+ * Set when Conduit dead-letters or cancels the dispatch, or when the send is refused outright — an
40
+ * inactive channel, a closed messaging window. A dead-lettered reply an operator redrives in
41
+ * Conduit and that is then delivered moves on to `sent`. `failureReason` carries the why, because
37
42
  * "failed" alone sends an agent to ask an engineer.
38
43
  */
39
44
  MessageStatus["FAILED"] = "failed";
@@ -170,6 +170,13 @@ export declare enum UserPermission {
170
170
  * connections. The connection is looked up in the named company, so it can never reach another company's.
171
171
  */
172
172
  CONDUIT_DISPATCH_SEND_ANY = "conduit:dispatch:send-any",
173
+ /**
174
+ * Read one dispatch of a company the request names in `tenantId`, rather than the token's own. A platform
175
+ * permission, held beside {@link UserPermission.CONDUIT_DISPATCH_READ} only by a service credential in Iveri's
176
+ * operator workspace, so the product that sent a company's message (`unibox-api`) can learn whether Conduit
177
+ * delivered it, dead-lettered it or had it cancelled. Only `GET /dispatches/:id` honours it.
178
+ */
179
+ CONDUIT_DISPATCH_READ_ANY = "conduit:dispatch:read-any",
173
180
  /** Read the tenant's product catalog, including prices and availability. */
174
181
  COMMERCE_CATALOG_READ = "commerce:catalog:read",
175
182
  /** Create, edit, archive or restore products in the tenant's catalog. */
@@ -189,6 +189,13 @@ export var UserPermission;
189
189
  * connections. The connection is looked up in the named company, so it can never reach another company's.
190
190
  */
191
191
  UserPermission["CONDUIT_DISPATCH_SEND_ANY"] = "conduit:dispatch:send-any";
192
+ /**
193
+ * Read one dispatch of a company the request names in `tenantId`, rather than the token's own. A platform
194
+ * permission, held beside {@link UserPermission.CONDUIT_DISPATCH_READ} only by a service credential in Iveri's
195
+ * operator workspace, so the product that sent a company's message (`unibox-api`) can learn whether Conduit
196
+ * delivered it, dead-lettered it or had it cancelled. Only `GET /dispatches/:id` honours it.
197
+ */
198
+ UserPermission["CONDUIT_DISPATCH_READ_ANY"] = "conduit:dispatch:read-any";
192
199
  // ══ commerce-api ═════════════════════════════════════════════════════════
193
200
  // ── Catalog ─────────────────────────────────────────────────────────────
194
201
  /** Read the tenant's product catalog, including prices and availability. */
@@ -874,6 +881,7 @@ export const PLATFORM_PERMISSIONS = Object.freeze([
874
881
  UserPermission.MOBILITY_DISPATCH_CREATE_ANY,
875
882
  UserPermission.MOBILITY_DISPATCH_OPERATE_ANY,
876
883
  UserPermission.CONDUIT_DISPATCH_SEND_ANY,
884
+ UserPermission.CONDUIT_DISPATCH_READ_ANY,
877
885
  UserPermission.UNIBOX_REALTIME_PUBLISH_ANY,
878
886
  UserPermission.UNIBOX_AI_RUN_ANY,
879
887
  UserPermission.DELIVERY_JOB_READ_ANY,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iveri/contracts",
3
- "version": "0.152.0",
3
+ "version": "0.153.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {