@iveri/contracts 0.125.0 → 0.127.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
@@ -184,6 +184,12 @@ one person, and only that person or a service on their behalf can send through i
184
184
  `ConversationStatus`, `MessageDirection`, `MessageAuthorType`, `MessageStatus`,
185
185
  `MessageContentType`.
186
186
 
187
+ - **`UniboxRefusal` is the refusals an agent can act on**, sent as `details.reason` (`channel-inactive`,
188
+ `status-not-allowed` with `currentStatus` and `requestedStatus`, `snooze-in-past`, `shortcut-taken`,
189
+ `team-name-taken`, `channel-key-taken`, `send-rate-limited` and `rate-limited` with `retryAfterSeconds`,
190
+ `dispatch-refused`, `dispatch-unavailable`). `unibox-web` says each in its reader's language and shows the API's
191
+ English for a reason it does not know.
192
+
187
193
  ### `api/unibox-ai/` → `@iveri/contracts/unibox-ai`
188
194
 
189
195
  The authenticated agent-runtime boundary: bounded conversation context, the handoff-aware agent
@@ -299,6 +305,7 @@ Conduit's outbox.
299
305
  `localization:render` permissions.
300
306
  - Version `0.100.0` adds `notification:send-any`, the password-reset bodies and Conduit's usage metrics.
301
307
  - Version `0.101.0` adds `UsageHistory`, a company's closed months of a product by metric.
308
+ - Version `0.127.0` adds `UniboxRefusal` and `SocialRefusal.STORAGE_UNAVAILABLE` (`storage-unavailable`).
302
309
  - Version `0.123.0` adds `HrRefusal`, the HR refusals a client says in the reader's language.
303
310
  - Version `0.122.0` adds `RestaurantRefusal`, the restaurant refusals a client says in the reader's language.
304
311
  - Version `0.121.0` adds Conduit's route test: `RouteTestResult`, `TestRouteBody`, `RouteCriterion` and
@@ -306,6 +313,9 @@ Conduit's outbox.
306
313
  exist on npm.)
307
314
  - Version `0.120.0` adds `chat:embed:manage-any` and an optional `tenantId` on the embed requests, so HR opens every
308
315
  company's conversations from its operator-workspace key.
316
+ - Version `0.126.0` adds `realtime:event:publish-any` and `realtime:subscription-grant:issue-any` and an optional
317
+ `tenantId` on the realtime publish and grant requests, so the clinic announces every company's calendar changes from
318
+ its operator-workspace key.
309
319
  - Widening a type is minor; narrowing it is major.
310
320
  - Under `api/`, the contract follows the service: add the field to the service's DTO and to the
311
321
  interface in the same release, and let `implements` prove they agree.
@@ -22,10 +22,15 @@ export declare const REALTIME_GRANT_ISSUER = "iveri-realtime";
22
22
  /**
23
23
  * Requested by an owning API only after it has authorized a person to read the resource.
24
24
  *
25
- * `tenantId` is absent: it comes from the API's service token. The grant is bound to
26
- * `subjectId`, so copying one to another authenticated socket does not authorize that socket.
25
+ * The tenant normally comes from the API's service token. The grant is bound to `subjectId`, so
26
+ * copying one to another authenticated socket does not authorize that socket.
27
27
  */
28
28
  export interface IssueRealtimeSubscriptionGrantBody {
29
+ /**
30
+ * The company the grant admits a person into, when it is not the token's own. Accepted only from a token holding
31
+ * `realtime:subscription-grant:issue-any` issued in Iveri's operator workspace; anything else naming one is a 403.
32
+ */
33
+ tenantId?: UUID;
29
34
  subjectId: UUID;
30
35
  resourceType: RealtimeResourceType;
31
36
  resourceId: UUID;
@@ -52,11 +57,15 @@ export interface RealtimeSubscriptionGrantClaims {
52
57
  /**
53
58
  * A product service's best-effort change notification.
54
59
  *
55
- * The tenant comes from the authenticated service principal and is intentionally absent here.
56
- * `idempotencyKey` makes an HTTP retry harmless; no domain data or location coordinates travel
57
- * over this channel.
60
+ * The tenant normally comes from the authenticated service principal. `idempotencyKey` makes an
61
+ * HTTP retry harmless; no domain data or location coordinates travel over this channel.
58
62
  */
59
63
  export interface PublishRealtimeEventBody {
64
+ /**
65
+ * The company whose rooms hear the change, when it is not the token's own. Accepted only from a token holding
66
+ * `realtime:event:publish-any` issued in Iveri's operator workspace; anything else naming one is a 403.
67
+ */
68
+ tenantId?: UUID;
60
69
  idempotencyKey: UUID;
61
70
  resourceType: RealtimeResourceType;
62
71
  resourceId: UUID;
@@ -20,6 +20,8 @@ export declare enum SocialRefusal {
20
20
  IMAGE_UNREADABLE = "image-unreadable",
21
21
  IMAGE_TOO_LARGE = "image-too-large",
22
22
  MEDIA_UNAVAILABLE = "media-unavailable",
23
+ /** Where photographs and videos are kept cannot be reached just now, so an upload did not go through. */
24
+ STORAGE_UNAVAILABLE = "storage-unavailable",
23
25
  VIDEO_UNREADABLE = "video-unreadable",
24
26
  VIDEO_TOO_LARGE = "video-too-large",
25
27
  VIDEO_TOO_LONG = "video-too-long",
@@ -21,6 +21,8 @@ export var SocialRefusal;
21
21
  SocialRefusal["IMAGE_UNREADABLE"] = "image-unreadable";
22
22
  SocialRefusal["IMAGE_TOO_LARGE"] = "image-too-large";
23
23
  SocialRefusal["MEDIA_UNAVAILABLE"] = "media-unavailable";
24
+ /** Where photographs and videos are kept cannot be reached just now, so an upload did not go through. */
25
+ SocialRefusal["STORAGE_UNAVAILABLE"] = "storage-unavailable";
24
26
  SocialRefusal["VIDEO_UNREADABLE"] = "video-unreadable";
25
27
  SocialRefusal["VIDEO_TOO_LARGE"] = "video-too-large";
26
28
  SocialRefusal["VIDEO_TOO_LONG"] = "video-too-long";
@@ -12,3 +12,4 @@ export * from './message.type.js';
12
12
  export * from './realtime-event.enum.js';
13
13
  export * from './realtime.type.js';
14
14
  export * from './team.type.js';
15
+ export * from './unibox-refusal.enum.js';
@@ -12,3 +12,4 @@ export * from './message.type.js';
12
12
  export * from './realtime-event.enum.js';
13
13
  export * from './realtime.type.js';
14
14
  export * from './team.type.js';
15
+ export * from './unibox-refusal.enum.js';
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Why `unibox-api` refused something an agent can do something about.
3
+ *
4
+ * Sent as `error.details.reason`. An inbox shown in Georgian cannot print the API's English sentence at the agent, so
5
+ * each of these is a key `unibox-web` translates. The English `message` remains for a log line and for anything that
6
+ * does not know this list.
7
+ */
8
+ export declare enum UniboxRefusal {
9
+ /** The conversation's channel has been switched off, so a reply has nowhere to go. */
10
+ CHANNEL_INACTIVE = "channel-inactive",
11
+ /** The conversation cannot move to that status from where it is now. Carries `currentStatus` and `requestedStatus`. */
12
+ STATUS_NOT_ALLOWED = "status-not-allowed",
13
+ /** A conversation is snoozed until a moment that has to be in the future. */
14
+ SNOOZE_IN_PAST = "snooze-in-past",
15
+ /** Another canned reply already uses that shortcut. */
16
+ SHORTCUT_TAKEN = "shortcut-taken",
17
+ /** Another team already has that name. */
18
+ TEAM_NAME_TAKEN = "team-name-taken",
19
+ /** Another channel already has that key. */
20
+ CHANNEL_KEY_TAKEN = "channel-key-taken",
21
+ /** Too many replies in one conversation at once. Carries `retryAfterSeconds`. */
22
+ SEND_RATE_LIMITED = "send-rate-limited",
23
+ /** Too many requests at once. Carries `retryAfterSeconds`. */
24
+ RATE_LIMITED = "rate-limited",
25
+ /** Conduit would not take the reply, which is the channel's connection or operation, not the reply itself. */
26
+ DISPATCH_REFUSED = "dispatch-refused",
27
+ /** Conduit could not be reached, so the reply was not handed over. Trying again may work. */
28
+ DISPATCH_UNAVAILABLE = "dispatch-unavailable"
29
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Why `unibox-api` refused something an agent can do something about.
3
+ *
4
+ * Sent as `error.details.reason`. An inbox shown in Georgian cannot print the API's English sentence at the agent, so
5
+ * each of these is a key `unibox-web` translates. The English `message` remains for a log line and for anything that
6
+ * does not know this list.
7
+ */
8
+ export var UniboxRefusal;
9
+ (function (UniboxRefusal) {
10
+ /** The conversation's channel has been switched off, so a reply has nowhere to go. */
11
+ UniboxRefusal["CHANNEL_INACTIVE"] = "channel-inactive";
12
+ /** The conversation cannot move to that status from where it is now. Carries `currentStatus` and `requestedStatus`. */
13
+ UniboxRefusal["STATUS_NOT_ALLOWED"] = "status-not-allowed";
14
+ /** A conversation is snoozed until a moment that has to be in the future. */
15
+ UniboxRefusal["SNOOZE_IN_PAST"] = "snooze-in-past";
16
+ /** Another canned reply already uses that shortcut. */
17
+ UniboxRefusal["SHORTCUT_TAKEN"] = "shortcut-taken";
18
+ /** Another team already has that name. */
19
+ UniboxRefusal["TEAM_NAME_TAKEN"] = "team-name-taken";
20
+ /** Another channel already has that key. */
21
+ UniboxRefusal["CHANNEL_KEY_TAKEN"] = "channel-key-taken";
22
+ /** Too many replies in one conversation at once. Carries `retryAfterSeconds`. */
23
+ UniboxRefusal["SEND_RATE_LIMITED"] = "send-rate-limited";
24
+ /** Too many requests at once. Carries `retryAfterSeconds`. */
25
+ UniboxRefusal["RATE_LIMITED"] = "rate-limited";
26
+ /** Conduit would not take the reply, which is the channel's connection or operation, not the reply itself. */
27
+ UniboxRefusal["DISPATCH_REFUSED"] = "dispatch-refused";
28
+ /** Conduit could not be reached, so the reply was not handed over. Trying again may work. */
29
+ UniboxRefusal["DISPATCH_UNAVAILABLE"] = "dispatch-unavailable";
30
+ })(UniboxRefusal || (UniboxRefusal = {}));
@@ -400,6 +400,20 @@ export declare enum UserPermission {
400
400
  * without the other.
401
401
  */
402
402
  REALTIME_EVENT_PUBLISH = "realtime:event:publish",
403
+ /**
404
+ * Issue a subscription grant for a company the request names in `tenantId`, rather than the token's own. A platform
405
+ * permission: held only by a service credential in Iveri's operator workspace, so a product sold to many companies
406
+ * (the clinic) admits each company's own people to that company's rooms from one key. Held beside
407
+ * {@link UserPermission.REALTIME_SUBSCRIPTION_GRANT_ISSUE}, which still opens the route; the grant is bound to the
408
+ * company it names, so it admits nobody to another company's rooms.
409
+ */
410
+ REALTIME_SUBSCRIPTION_GRANT_ISSUE_ANY = "realtime:subscription-grant:issue-any",
411
+ /**
412
+ * Publish an identifier-only resource change into a company the request names in `tenantId`, rather than the
413
+ * token's own. A platform permission, held beside {@link UserPermission.REALTIME_EVENT_PUBLISH} only by a service
414
+ * credential in Iveri's operator workspace, so one key announces every company's changes in that company's rooms.
415
+ */
416
+ REALTIME_EVENT_PUBLISH_ANY = "realtime:event:publish-any",
403
417
  /** Read worker profiles and operational availability inside the caller's tenant. */
404
418
  MOBILITY_WORKER_READ = "mobility:worker:read",
405
419
  /** Enrol workers, amend their capabilities, and suspend or reactivate them. */
@@ -463,6 +463,20 @@ export var UserPermission;
463
463
  * without the other.
464
464
  */
465
465
  UserPermission["REALTIME_EVENT_PUBLISH"] = "realtime:event:publish";
466
+ /**
467
+ * Issue a subscription grant for a company the request names in `tenantId`, rather than the token's own. A platform
468
+ * permission: held only by a service credential in Iveri's operator workspace, so a product sold to many companies
469
+ * (the clinic) admits each company's own people to that company's rooms from one key. Held beside
470
+ * {@link UserPermission.REALTIME_SUBSCRIPTION_GRANT_ISSUE}, which still opens the route; the grant is bound to the
471
+ * company it names, so it admits nobody to another company's rooms.
472
+ */
473
+ UserPermission["REALTIME_SUBSCRIPTION_GRANT_ISSUE_ANY"] = "realtime:subscription-grant:issue-any";
474
+ /**
475
+ * Publish an identifier-only resource change into a company the request names in `tenantId`, rather than the
476
+ * token's own. A platform permission, held beside {@link UserPermission.REALTIME_EVENT_PUBLISH} only by a service
477
+ * credential in Iveri's operator workspace, so one key announces every company's changes in that company's rooms.
478
+ */
479
+ UserPermission["REALTIME_EVENT_PUBLISH_ANY"] = "realtime:event:publish-any";
466
480
  // ══ iveri-mobility-api ══════════════════════════════════════════════════
467
481
  /** Read worker profiles and operational availability inside the caller's tenant. */
468
482
  UserPermission["MOBILITY_WORKER_READ"] = "mobility:worker:read";
@@ -753,6 +767,8 @@ export const PLATFORM_PERMISSIONS = Object.freeze([
753
767
  UserPermission.BILLING_USAGE_READ_ANY,
754
768
  UserPermission.NOTIFICATION_SEND_ANY,
755
769
  UserPermission.CHAT_EMBED_MANAGE_ANY,
770
+ UserPermission.REALTIME_SUBSCRIPTION_GRANT_ISSUE_ANY,
771
+ UserPermission.REALTIME_EVENT_PUBLISH_ANY,
756
772
  ]);
757
773
  /** Whether a permission acts across companies, and so may only be held in Iveri's operator workspace. */
758
774
  export function isPlatformPermission(permission) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iveri/contracts",
3
- "version": "0.125.0",
3
+ "version": "0.127.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {