@iveri/contracts 0.118.0 → 0.120.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
@@ -284,6 +284,8 @@ Conduit's outbox.
284
284
  `localization:render` permissions.
285
285
  - Version `0.100.0` adds `notification:send-any`, the password-reset bodies and Conduit's usage metrics.
286
286
  - Version `0.101.0` adds `UsageHistory`, a company's closed months of a product by metric.
287
+ - Version `0.120.0` adds `chat:embed:manage-any` and an optional `tenantId` on the embed requests, so HR opens every
288
+ company's conversations from its operator-workspace key.
287
289
  - Widening a type is minor; narrowing it is major.
288
290
  - Under `api/`, the contract follows the service: add the field to the service's DTO and to the
289
291
  interface in the same release, and let `implements` prove they agree.
@@ -81,8 +81,11 @@ export type ServerChatParticipant = Omit<EmbeddedChatParticipant, 'userId'> & {
81
81
  * `PUT /server/conversations`: the embed request, with each participant named by the app's own id for them rather
82
82
  * than a Baasi id.
83
83
  */
84
- /** Calls are not offered to other companies' apps yet, so an app's server cannot ask for them. */
85
- export type OpenServerChatRequest = Omit<OpenEmbeddedChatRequest, 'participants' | 'callable'> & {
84
+ /**
85
+ * Calls are not offered to other companies' apps yet, so an app's server cannot ask for them; and an app is one
86
+ * company, so its server names no other.
87
+ */
88
+ export type OpenServerChatRequest = Omit<OpenEmbeddedChatRequest, 'participants' | 'callable' | 'tenantId'> & {
86
89
  participants: ServerChatParticipant[];
87
90
  };
88
91
  /** `GET /server/users/:userId/export`: everything Baasi holds about one user of an app. */
@@ -26,6 +26,11 @@ export interface EmbeddedChatParticipant {
26
26
  * two replicas and a reassignment land on one conversation, and participants are reconciled.
27
27
  */
28
28
  export interface OpenEmbeddedChatRequest {
29
+ /**
30
+ * The company the conversation is for, when it is not the token's own. A 403 unless the token holds
31
+ * `chat:embed:manage-any` and comes from Iveri's operator workspace; naming your own company counts as naming one.
32
+ */
33
+ tenantId?: UUID;
29
34
  context: {
30
35
  product: string;
31
36
  type: string;
@@ -58,11 +63,25 @@ export interface OpenEmbeddedChatResponse {
58
63
  }
59
64
  /** A notice from the product: a translation key in the `chat-kit` namespace and its variables. */
60
65
  export interface PostEmbeddedSystemMessageRequest {
66
+ /** As on `OpenEmbeddedChatRequest`: the company the conversation was opened for, behind `chat:embed:manage-any`. */
67
+ tenantId?: UUID;
61
68
  key: string;
62
69
  variables?: Record<string, string>;
63
70
  /** So a retried notice is posted once. */
64
71
  idempotencyKey: UUID;
65
72
  }
73
+ /** `POST /embed/conversations/:id/close`. An empty body closes one in the token's own company. */
74
+ export interface CloseEmbeddedChatRequest {
75
+ /** As on `OpenEmbeddedChatRequest`: the company the conversation was opened for, behind `chat:embed:manage-any`. */
76
+ tenantId?: UUID;
77
+ }
78
+ /** `GET /embed/conversations`: the context to look up, and the company it is in as on `OpenEmbeddedChatRequest`. */
79
+ export interface EmbeddedChatReferenceQuery {
80
+ tenantId?: UUID;
81
+ product: string;
82
+ type: string;
83
+ id: string;
84
+ }
66
85
  export interface EmbeddedChatReference {
67
86
  conversationId: UUID;
68
87
  context: {
@@ -621,6 +621,13 @@ export declare enum UserPermission {
621
621
  GYM_REPORT_READ = "gym:report:read",
622
622
  /** Open, reconcile and close conversations about something in a product. Held by that product's service key. */
623
623
  CHAT_EMBED_MANAGE = "chat:embed:manage",
624
+ /**
625
+ * Open, reconcile and close embedded conversations for a company the request names in `tenantId`, rather than the
626
+ * token's own. A platform permission: held only by a service credential in Iveri's operator workspace, so a product
627
+ * sold to many companies (HR) keeps every company's conversations from one key. The conversation is filed in, and
628
+ * its participants are people of, the company it names.
629
+ */
630
+ CHAT_EMBED_MANAGE_ANY = "chat:embed:manage-any",
624
631
  /** See the moderation queue and what a report copied. Every read of a conversation is logged. */
625
632
  CHAT_MODERATION_READ = "chat:moderation:read",
626
633
  /** Decide a case: dismiss it, remove the message, warn, suspend or ban. */
@@ -691,6 +691,13 @@ export var UserPermission;
691
691
  // Chat
692
692
  /** Open, reconcile and close conversations about something in a product. Held by that product's service key. */
693
693
  UserPermission["CHAT_EMBED_MANAGE"] = "chat:embed:manage";
694
+ /**
695
+ * Open, reconcile and close embedded conversations for a company the request names in `tenantId`, rather than the
696
+ * token's own. A platform permission: held only by a service credential in Iveri's operator workspace, so a product
697
+ * sold to many companies (HR) keeps every company's conversations from one key. The conversation is filed in, and
698
+ * its participants are people of, the company it names.
699
+ */
700
+ UserPermission["CHAT_EMBED_MANAGE_ANY"] = "chat:embed:manage-any";
694
701
  /** See the moderation queue and what a report copied. Every read of a conversation is logged. */
695
702
  UserPermission["CHAT_MODERATION_READ"] = "chat:moderation:read";
696
703
  /** Decide a case: dismiss it, remove the message, warn, suspend or ban. */
@@ -745,6 +752,7 @@ export const PLATFORM_PERMISSIONS = Object.freeze([
745
752
  UserPermission.BILLING_USAGE_RECORD_ANY,
746
753
  UserPermission.BILLING_USAGE_READ_ANY,
747
754
  UserPermission.NOTIFICATION_SEND_ANY,
755
+ UserPermission.CHAT_EMBED_MANAGE_ANY,
748
756
  ]);
749
757
  /** Whether a permission acts across companies, and so may only be held in Iveri's operator workspace. */
750
758
  export function isPlatformPermission(permission) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iveri/contracts",
3
- "version": "0.118.0",
3
+ "version": "0.120.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {