@iveri/contracts 0.137.0 → 0.138.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
@@ -314,6 +314,9 @@ Conduit's outbox.
314
314
  - Version `0.137.0` adds a gym plan's free guest visits: `GymPlan.guestVisitsPerMonth`, the membership's guest
315
315
  counters, `GymGuestVisit`, `RecordGymGuestVisitRequest`, and the `GymRefusal` members `guest-passes-used` and
316
316
  `guest-pass-not-current`.
317
+ - Version `0.138.0` adds `profile:directory:read` and `profile:directory:read-any` with `ProfileDirectoryPage` under
318
+ `@iveri/contracts/identity` (the names of a company's members who hold a permission), and `UniboxAgent` /
319
+ `UniboxAgents` under `@iveri/contracts/unibox`, so the inbox picks agents by name.
317
320
  - Version `0.134.0` adds `delivery:job:create-any`, `delivery:job:read-any` and `delivery:job:operate-any`, so a shop's
318
321
  and a restaurant's operator-workspace keys ask for, confirm and follow a courier in the company a request names.
319
322
  - Version `0.131.0` adds `mobility:dispatch:create-any`, `mobility:dispatch:read-any`, `mobility:dispatch:operate-any`,
@@ -1,6 +1,7 @@
1
1
  import type { UserPermission } from '../../enum/user-permission.enum.js';
2
2
  import type { IsoDateTime } from '../../type/iso-date-time.type.js';
3
3
  import type { Nullable } from '../../type/nil.type.js';
4
+ import type { Paginated } from '../../type/paginated.type.js';
4
5
  import type { UUID } from '../../type/uuid.type.js';
5
6
  import type { MembershipStatus } from './membership-status.enum.js';
6
7
  import type { TenantStatus } from './tenant-status.enum.js';
@@ -229,3 +230,12 @@ export interface PublicProfile {
229
230
  displayName: string;
230
231
  avatarUrl: Nullable<string>;
231
232
  }
233
+ /**
234
+ * `GET /users/profiles?permission=`: the public profiles of a company's **active** members whose roles grant
235
+ * `permission`, ordered by name. Behind {@link UserPermission.PROFILE_DIRECTORY_READ}; `tenantId` names another company
236
+ * only beside `profile:directory:read-any` from Iveri's operator workspace.
237
+ *
238
+ * An invited, suspended or removed person is absent, so a caller holding an id this list does not name knows the person
239
+ * cannot do the thing asked about here any more — the list is the answer, not a cache to patch.
240
+ */
241
+ export type ProfileDirectoryPage = Paginated<PublicProfile>;
@@ -0,0 +1,30 @@
1
+ import type { Nullable } from '../../type/nil.type.js';
2
+ import type { UUID } from '../../type/uuid.type.js';
3
+ /**
4
+ * Somebody in the company who can work the inbox, named for a picker: assign a conversation, add a team member.
5
+ *
6
+ * **Unibox stores no names.** `unibox-api` asks identity, under its operator-workspace key naming the company, for the
7
+ * active members whose roles grant `unibox:conversation:read`, and passes on the public half only: a name and a photo,
8
+ * never an email or a role. An agent assigning a conversation therefore needs no `user:read`, which is the company's
9
+ * staff directory with everybody's email in it.
10
+ */
11
+ export interface UniboxAgent {
12
+ /** The identity user id a team's `memberUserIds` and a conversation's `assigneeUserId` hold. */
13
+ userId: UUID;
14
+ /** Composed by identity: `firstName lastName`, or the email's local part when no name is set. */
15
+ displayName: string;
16
+ avatarUrl: Nullable<string>;
17
+ }
18
+ /**
19
+ * `GET /api/v1/agents`, ordered by name, behind `unibox:conversation:read`.
20
+ *
21
+ * An id a team or a conversation holds that is not in `items` belongs to somebody who has left the company or can no
22
+ * longer work the inbox, and a client says so ("former agent") rather than printing the id — **but only when
23
+ * `isComplete`**. A company with more agents than one answer carries is cut short, and then an unknown id is simply
24
+ * not named.
25
+ */
26
+ export interface UniboxAgents {
27
+ items: UniboxAgent[];
28
+ /** False when the company has more agents than `unibox-api` reads in one answer. */
29
+ isComplete: boolean;
30
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ export * from './agent.type.js';
1
2
  export * from './canned-reply.type.js';
2
3
  export * from './channel-platform.enum.js';
3
4
  export * from './channel.type.js';
@@ -1,3 +1,4 @@
1
+ export * from './agent.type.js';
1
2
  export * from './canned-reply.type.js';
2
3
  export * from './channel-platform.enum.js';
3
4
  export * from './channel.type.js';
@@ -44,6 +44,21 @@ export declare enum UserPermission {
44
44
  * product sold to many companies names each company's people in the conversations it opens for them.
45
45
  */
46
46
  PROFILE_READ_ANY = "profile:read-any",
47
+ /**
48
+ * List the public profiles of a company's active members who hold one named permission — the same name and photo
49
+ * {@link UserPermission.PROFILE_READ} answers for one person, never an email, phone or role.
50
+ *
51
+ * Deliberately neither `USER_READ` nor `PROFILE_READ`. The first is the staff directory with emails; the second is
52
+ * held by shoppers and passengers so they can see who is driving, and a list on it would let any of them enumerate
53
+ * a company's people. This is what a product shows in a picker ("assign to…") without handing anybody either.
54
+ */
55
+ PROFILE_DIRECTORY_READ = "profile:directory:read",
56
+ /**
57
+ * List those profiles in a company the request names in `tenantId`. A platform permission, held beside
58
+ * {@link UserPermission.PROFILE_DIRECTORY_READ} only by a service credential in Iveri's operator workspace, so a
59
+ * product sold to many companies (Unibox's agent picker) names each company's people from one key.
60
+ */
61
+ PROFILE_DIRECTORY_READ_ANY = "profile:directory:read-any",
47
62
  MEMBERSHIP_READ = "membership:read",
48
63
  /** Suspend or reactivate someone's access without deleting their account. */
49
64
  MEMBERSHIP_UPDATE = "membership:update",
@@ -49,6 +49,21 @@ export var UserPermission;
49
49
  * product sold to many companies names each company's people in the conversations it opens for them.
50
50
  */
51
51
  UserPermission["PROFILE_READ_ANY"] = "profile:read-any";
52
+ /**
53
+ * List the public profiles of a company's active members who hold one named permission — the same name and photo
54
+ * {@link UserPermission.PROFILE_READ} answers for one person, never an email, phone or role.
55
+ *
56
+ * Deliberately neither `USER_READ` nor `PROFILE_READ`. The first is the staff directory with emails; the second is
57
+ * held by shoppers and passengers so they can see who is driving, and a list on it would let any of them enumerate
58
+ * a company's people. This is what a product shows in a picker ("assign to…") without handing anybody either.
59
+ */
60
+ UserPermission["PROFILE_DIRECTORY_READ"] = "profile:directory:read";
61
+ /**
62
+ * List those profiles in a company the request names in `tenantId`. A platform permission, held beside
63
+ * {@link UserPermission.PROFILE_DIRECTORY_READ} only by a service credential in Iveri's operator workspace, so a
64
+ * product sold to many companies (Unibox's agent picker) names each company's people from one key.
65
+ */
66
+ UserPermission["PROFILE_DIRECTORY_READ_ANY"] = "profile:directory:read-any";
52
67
  // ── Membership ──────────────────────────────────────────────────────────
53
68
  UserPermission["MEMBERSHIP_READ"] = "membership:read";
54
69
  /** Suspend or reactivate someone's access without deleting their account. */
@@ -832,6 +847,7 @@ export const PLATFORM_PERMISSIONS = Object.freeze([
832
847
  UserPermission.NOTIFICATION_SEND_ANY,
833
848
  UserPermission.CHAT_EMBED_MANAGE_ANY,
834
849
  UserPermission.PROFILE_READ_ANY,
850
+ UserPermission.PROFILE_DIRECTORY_READ_ANY,
835
851
  UserPermission.REALTIME_SUBSCRIPTION_GRANT_ISSUE_ANY,
836
852
  UserPermission.REALTIME_EVENT_PUBLISH_ANY,
837
853
  UserPermission.MOBILITY_WORKER_READ_ANY,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iveri/contracts",
3
- "version": "0.137.0",
3
+ "version": "0.138.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {