@edifice.io/client 2.5.4 → 2.5.5-develop-b2school.20251218094734

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.
@@ -25,7 +25,7 @@ export declare class RightService {
25
25
  */
26
26
  parseResourceRights(rights: RightStringified[]): ResourceRight[];
27
27
  /**
28
- * Check wether a user has the expected right for a ressource
28
+ * Check wether a user has the expected right for a resource
29
29
  * @param user the userId and groupId concerned by the check
30
30
  * @param expect the expected right to check
31
31
  * @param rights array of Right for the resource
@@ -1,18 +1,19 @@
1
1
  import { IOdeServices } from '../services/OdeServices';
2
- import { GetResourceRightPayload, PutShareResponse, ShareMapping, ShareRight, ShareRightAction, ShareRightActionDisplayName, ShareRightWithVisibles, ShareSubject } from './interface';
2
+ import { GetResourceRightPayload, PutSharePayload, PutShareResponse, ShareMapping, ShareRight, ShareRightAction, ShareRightActionDisplayName, ShareRightWithVisibles, ShareSubject, ShareUrls } from './interface';
3
3
  export declare class ShareService {
4
4
  protected context: IOdeServices;
5
5
  constructor(context: IOdeServices);
6
6
  get directory(): import('../directory/Service').DirectoryService;
7
7
  get http(): import('../transport/Service').HttpService;
8
8
  get cache(): import('../cache/Service').CacheService;
9
- searchShareSubjects(app: string, resourceId: string, searchText: string): Promise<ShareSubject[]>;
10
- getShareMapping(app: string): Promise<ShareMapping>;
9
+ searchShareSubjects(app: string, resourceId: string, searchText: string, urlResourceRights?: string): Promise<ShareSubject[]>;
10
+ getShareMapping(app: string, urlShareMapping?: string): Promise<ShareMapping>;
11
11
  getActionsAvailableFor({ id, type }: {
12
12
  id: string;
13
13
  type: 'user' | 'group';
14
14
  }, payload: GetResourceRightPayload, mapping: ShareMapping): ShareRightActionDisplayName[];
15
- getRightsForResource(app: string, resourceId: string): Promise<ShareRightWithVisibles>;
16
- saveRights(app: string, resourceId: string, rights: ShareRight[]): Promise<PutShareResponse>;
17
- getActionsForApp(app: string): Promise<ShareRightAction[]>;
15
+ getRightsForResource(app: string, resourceId: string, shareUrls?: ShareUrls): Promise<ShareRightWithVisibles>;
16
+ getPutSharePayload(app: string, rights: ShareRight[], urlGetShareMapping?: string): Promise<PutSharePayload>;
17
+ saveRights(app: string, resourceId: string, rights: ShareRight[], urls?: ShareUrls): Promise<PutShareResponse>;
18
+ getActionsForApp(app: string, urlShareMapping?: string): Promise<ShareRightAction[]>;
18
19
  }
@@ -1,4 +1,19 @@
1
- import { Group, Bookmark, User } from '../directory/interface';
1
+ import { Bookmark, Group, User } from '../directory/interface';
2
+ /**
3
+ * Represents a share right for a user, group, or bookmark with associated permissions and metadata.
4
+ *
5
+ * @interface ShareRight
6
+ * @property {string} id - Unique identifier for the share right
7
+ * @property {ShareRightType} type - Type of entity being shared with (user, group, or sharebookmark)
8
+ * @property {string} displayName - Human-readable name for display purposes
9
+ * @property {string} [profile] - User profile information (only applicable when type is 'user')
10
+ * @property {string} avatarUrl - URL to the entity's avatar image
11
+ * @property {string} directoryUrl - URL to the entity's directory page
12
+ * @property {ShareRightAction[]} actions - Array of available actions/permissions for this share right
13
+ * @property {boolean} [isBookmarkMember] - Indicates if the entity is a member of a bookmark
14
+ * @property {User[]} [users] - Array of users associated with a bookmark (when type is 'sharebookmark')
15
+ * @property {Group[]} [groups] - Array of groups associated with a bookmark (when type is 'sharebookmark')
16
+ */
2
17
  export interface ShareRight {
3
18
  id: string;
4
19
  type: ShareRightType;
@@ -11,6 +26,13 @@ export interface ShareRight {
11
26
  users?: User[];
12
27
  groups?: Group[];
13
28
  }
29
+ /**
30
+ * Parameters for sharing operations containing resource ID and associated rights.
31
+ *
32
+ * @interface ShareParameters
33
+ * @property {string} id - Unique identifier of the resource being shared
34
+ * @property {ShareRight[]} rights - Array of share rights defining who has access and what permissions they have
35
+ */
14
36
  export interface ShareParameters {
15
37
  id: string;
16
38
  rights: ShareRight[];
@@ -20,8 +42,14 @@ export interface ShareParameters {
20
42
  * */
21
43
  export type ShareRightType = 'user' | 'group' | 'sharebookmark';
22
44
  /**
23
- * Type of action when sharing
24
- * */
45
+ * Represents an action that can be performed on a shared resource.
46
+ *
47
+ * @interface ShareRightAction
48
+ * @property {ShareRightActionDisplayName} id - Unique identifier for the action
49
+ * @property {ShareRightActionDisplayName} displayName - Display name for the action
50
+ * @property {number} [priority] - Priority level of the action (higher values indicate higher priority)
51
+ * @property {ShareRightActionDisplayName[]} [requires] - Array of action names that are required as prerequisites for this action
52
+ */
25
53
  export interface ShareRightAction {
26
54
  id: ShareRightActionDisplayName;
27
55
  displayName: ShareRightActionDisplayName;
@@ -33,15 +61,35 @@ export interface ShareRightAction {
33
61
  * */
34
62
  export type ShareRightActionDisplayName = 'read' | 'contrib' | 'manage' | 'publish' | 'manager' | 'comment';
35
63
  export type ShareRightActionDisplayNameExt = ShareRightActionDisplayName | 'creator';
64
+ /**
65
+ * Configuration object defining sharing rights with their properties including priority, default status, and dependencies.
66
+ *
67
+ * @type {SharingRight}
68
+ * @description Record mapping each ShareRightActionDisplayName to an object containing:
69
+ * - priority: Numeric priority level
70
+ * - default: Whether this right is selected by default
71
+ * - requires: Array of prerequisite action names
72
+ */
36
73
  export type SharingRight = Record<ShareRightActionDisplayName, {
37
74
  priority: number;
38
75
  default: boolean;
39
76
  requires: ShareRightActionDisplayName[];
40
77
  }>;
78
+ /**
79
+ * Mapping of share right actions to their corresponding backend permission strings.
80
+ *
81
+ * @type {ShareMapping}
82
+ * @description Record mapping each ShareRightActionDisplayName to an array of backend permission strings
83
+ */
41
84
  export type ShareMapping = Record<ShareRightActionDisplayName, string[]>;
42
85
  /**
43
- * Payload of shared resource
44
- * */
86
+ * Payload structure returned when fetching resource rights information.
87
+ *
88
+ * @interface GetResourceRightPayload
89
+ * @property {Array} actions - Available actions with their metadata including name arrays, display names, and type
90
+ * @property {Object} groups - Group information including visible groups and their checked permissions
91
+ * @property {Object} users - User information including visible users and their checked permissions
92
+ */
45
93
  export interface GetResourceRightPayload {
46
94
  actions: Array<{
47
95
  name: string[];
@@ -71,16 +119,24 @@ export interface GetResourceRightPayload {
71
119
  };
72
120
  }
73
121
  /**
74
- * Update payload of shared resource
75
- * */
122
+ * Payload structure for updating shared resource permissions.
123
+ *
124
+ * @interface PutSharePayload
125
+ * @property {Record<string, string[]>} users - Mapping of user IDs to their assigned permission arrays
126
+ * @property {Record<string, string[]>} groups - Mapping of group IDs to their assigned permission arrays
127
+ * @property {Record<string, string[]>} bookmarks - Mapping of bookmark IDs to their assigned permission arrays
128
+ */
76
129
  export interface PutSharePayload {
77
130
  users: Record<string, string[]>;
78
131
  groups: Record<string, string[]>;
79
132
  bookmarks: Record<string, string[]>;
80
133
  }
81
134
  /**
82
- * Response of shared resource
83
- * */
135
+ * Response structure returned after updating shared resource permissions.
136
+ *
137
+ * @interface PutShareResponse
138
+ * @property {Array} notify-timeline-array - Array of notification objects containing either groupId or userId for timeline notifications
139
+ */
84
140
  export interface PutShareResponse {
85
141
  'notify-timeline-array': Array<{
86
142
  groupId: string;
@@ -88,6 +144,18 @@ export interface PutShareResponse {
88
144
  userId: string;
89
145
  }>;
90
146
  }
147
+ /**
148
+ * Represents a subject (user, group, or bookmark) that can be involved in sharing operations.
149
+ *
150
+ * @interface ShareSubject
151
+ * @property {string} id - Unique identifier
152
+ * @property {string} displayName - Human-readable display name
153
+ * @property {string} [profile] - Profile information (applicable for users)
154
+ * @property {string} avatarUrl - URL to avatar image
155
+ * @property {string} directoryUrl - URL to directory page
156
+ * @property {'user' | 'group' | 'sharebookmark'} type - Type of subject
157
+ * @property {string} [structureName] - Name of the organizational structure (applicable for groups)
158
+ */
91
159
  export interface ShareSubject {
92
160
  id: string;
93
161
  displayName: string;
@@ -97,9 +165,51 @@ export interface ShareSubject {
97
165
  type: 'user' | 'group' | 'sharebookmark';
98
166
  structureName?: string;
99
167
  }
168
+ /**
169
+ * Extended structure containing share rights along with all visible entities that can be shared with.
170
+ *
171
+ * @interface ShareRightWithVisibles
172
+ * @property {ShareRight[]} rights - Current share rights configuration
173
+ * @property {User[]} visibleUsers - Array of users available for sharing
174
+ * @property {Group[]} visibleGroups - Array of groups available for sharing
175
+ * @property {Bookmark[]} visibleBookmarks - Array of bookmarks available for sharing
176
+ */
100
177
  export interface ShareRightWithVisibles {
101
178
  rights: ShareRight[];
102
179
  visibleUsers: User[];
103
180
  visibleGroups: Group[];
104
181
  visibleBookmarks: Bookmark[];
105
182
  }
183
+ /**
184
+ * Configuration object containing URLs for various sharing-related API endpoints.
185
+ *
186
+ * @type {ShareUrls}
187
+ * @property {string} [getResourceRights] - Optional URL endpoint for fetching resource rights
188
+ * @property {string} [saveResourceRights] - Optional URL endpoint for saving/updating resource rights
189
+ * @property {string} [getShareMapping] - Optional URL endpoint for retrieving share action mappings
190
+ *
191
+ * @example Example related to sharing thread resources:
192
+ * ```ts
193
+ * const shareUrls: ShareUrls = {
194
+ * getResourceRights: '/api/V1/thread/shares', (get endpoint)
195
+ * saveResourceRights: '/api/V1/thread/shares', (put endpoint)
196
+ * getShareMapping: '/api/V1/rights/sharing'
197
+ * }
198
+ * };
199
+ * ```
200
+ *
201
+ * @example Example related to sharing info resources:
202
+ * ```ts
203
+ * const shareUrls: ShareUrls = {
204
+ * getResourceRights: '/api/V1/info/shares', (get endpoint)
205
+ * saveResourceRights: '/api/V1/info/shares', (put endpoint)
206
+ * getShareMapping: '/api/V1/rights/sharing'
207
+ * }
208
+ * };
209
+ * ```
210
+ */
211
+ export type ShareUrls = {
212
+ getResourceRights?: string;
213
+ saveResourceRights?: string;
214
+ getShareMapping?: string;
215
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/client",
3
- "version": "2.5.4",
3
+ "version": "2.5.5-develop-b2school.20251218094734",
4
4
  "description": "Edifice TypeScript Client",
5
5
  "keywords": [
6
6
  "typescript",
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "axios": "^1.7.7",
38
38
  "core-js": "^3.35.1",
39
- "@edifice.io/utilities": "2.5.4"
39
+ "@edifice.io/utilities": "2.5.5-develop-b2school.20251218094734"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/jasmine": "5.1.4",
@@ -48,7 +48,7 @@
48
48
  "typedoc-plugin-markdown": "3.17.1",
49
49
  "vite": "^5.4.11",
50
50
  "vite-plugin-dts": "^4.1.0",
51
- "@edifice.io/config": "2.5.4"
51
+ "@edifice.io/config": "2.5.5-develop-b2school.20251218094734"
52
52
  },
53
53
  "scripts": {
54
54
  "build": "vite build",