@edifice.io/client 2.0.0-develop-rc.26

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.
Files changed (83) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +90 -0
  3. package/dist/analytics/Service.d.ts +17 -0
  4. package/dist/apps/timeline/Framework.d.ts +25 -0
  5. package/dist/apps/timeline/Notification.model.d.ts +10 -0
  6. package/dist/apps/timeline/interfaces.d.ts +69 -0
  7. package/dist/audience/ReactionsService.d.ts +22 -0
  8. package/dist/audience/Service.d.ts +13 -0
  9. package/dist/audience/ViewsService.d.ts +12 -0
  10. package/dist/audience/interface.d.ts +108 -0
  11. package/dist/cache/Service.d.ts +14 -0
  12. package/dist/configure/Analytics.d.ts +40 -0
  13. package/dist/configure/AppConf.d.ts +17 -0
  14. package/dist/configure/Framework.d.ts +22 -0
  15. package/dist/configure/Service.d.ts +21 -0
  16. package/dist/configure/Theme.d.ts +34 -0
  17. package/dist/configure/User.d.ts +21 -0
  18. package/dist/configure/interfaces.d.ts +218 -0
  19. package/dist/data/Service.d.ts +25 -0
  20. package/dist/data/WebBroker.d.ts +12 -0
  21. package/dist/data/interface.d.ts +50 -0
  22. package/dist/directory/Service.d.ts +17 -0
  23. package/dist/directory/interface.d.ts +53 -0
  24. package/dist/embedder/Service.d.ts +39 -0
  25. package/dist/embedder/interface.d.ts +14 -0
  26. package/dist/globals.d.ts +52 -0
  27. package/dist/idiom/Idiom.d.ts +18 -0
  28. package/dist/idiom/Service.d.ts +24 -0
  29. package/dist/idiom/interfaces.d.ts +22 -0
  30. package/dist/index.cjs +6 -0
  31. package/dist/index.d.ts +13 -0
  32. package/dist/index.js +6192 -0
  33. package/dist/notify/Framework.d.ts +29 -0
  34. package/dist/notify/Subject.d.ts +9 -0
  35. package/dist/notify/interfaces.d.ts +113 -0
  36. package/dist/resources/ResourceService.d.ts +52 -0
  37. package/dist/resources/ServiceRegistry.d.ts +25 -0
  38. package/dist/resources/SnipletsService.d.ts +18 -0
  39. package/dist/resources/behaviours/AbstractBehaviourService.d.ts +34 -0
  40. package/dist/resources/behaviours/ActualitesBehaviour.d.ts +6 -0
  41. package/dist/resources/behaviours/BlogBehaviour.d.ts +6 -0
  42. package/dist/resources/behaviours/CollaborativewallBehaviour.d.ts +6 -0
  43. package/dist/resources/behaviours/CommunityBehaviour.d.ts +6 -0
  44. package/dist/resources/behaviours/ExercizerBehaviour.d.ts +6 -0
  45. package/dist/resources/behaviours/FormulaireBehaviour.d.ts +6 -0
  46. package/dist/resources/behaviours/ForumBehaviour.d.ts +6 -0
  47. package/dist/resources/behaviours/HomeworksBehaviour.d.ts +6 -0
  48. package/dist/resources/behaviours/MagnetoBehaviour.d.ts +6 -0
  49. package/dist/resources/behaviours/MindmapBehaviour.d.ts +6 -0
  50. package/dist/resources/behaviours/PagesBehaviour.d.ts +6 -0
  51. package/dist/resources/behaviours/PollBehaviour.d.ts +6 -0
  52. package/dist/resources/behaviours/ScrapbookBehaviour.d.ts +6 -0
  53. package/dist/resources/behaviours/TimelinegeneratorBehaviour.d.ts +6 -0
  54. package/dist/resources/behaviours/WikiBehaviour.d.ts +6 -0
  55. package/dist/resources/behaviours/WorkspaceBehaviour.d.ts +7 -0
  56. package/dist/resources/interface.d.ts +390 -0
  57. package/dist/resources/services/ScrapbookResourceService.d.ts +14 -0
  58. package/dist/rights/Service.d.ts +77 -0
  59. package/dist/rights/interface.d.ts +18 -0
  60. package/dist/services/OdeServices.d.ts +72 -0
  61. package/dist/services/index.d.ts +10 -0
  62. package/dist/session/Framework.d.ts +10 -0
  63. package/dist/session/Service.d.ts +39 -0
  64. package/dist/session/Session.d.ts +34 -0
  65. package/dist/session/interfaces.d.ts +268 -0
  66. package/dist/share/Service.d.ts +18 -0
  67. package/dist/share/interface.d.ts +104 -0
  68. package/dist/transport/Framework.d.ts +9 -0
  69. package/dist/transport/Http.d.ts +26 -0
  70. package/dist/transport/Service.d.ts +31 -0
  71. package/dist/transport/interfaces.d.ts +70 -0
  72. package/dist/utilities/DocumentHelper.d.ts +27 -0
  73. package/dist/utilities/StringUtils.d.ts +3 -0
  74. package/dist/utilities/index.d.ts +3 -0
  75. package/dist/utilities/isActionAvailable.d.ts +2 -0
  76. package/dist/video/Service.d.ts +21 -0
  77. package/dist/video/interface.d.ts +42 -0
  78. package/dist/widget/Framework.d.ts +31 -0
  79. package/dist/widget/LastInfos.widget.d.ts +15 -0
  80. package/dist/widget/interfaces.d.ts +53 -0
  81. package/dist/workspace/Service.d.ts +75 -0
  82. package/dist/workspace/interface.d.ts +67 -0
  83. package/package.json +53 -0
@@ -0,0 +1,390 @@
1
+ import { App, ID, ILinkedResource, ResourceType, RightRole, RightStringified } from '..';
2
+ /**
3
+ * @deprecated Used by the internal linker ONLY
4
+ * Old-fashioned way of listing resources => `behaviours.loadResources()`
5
+ */
6
+ export interface IBehaviourService {
7
+ /** App providing this service. */
8
+ getApplication(): App | string;
9
+ /** Type of resource this service can manage. */
10
+ getResourceType(): ResourceType;
11
+ /** Load resources. */
12
+ loadResources(parameters: GetContextParameters): Promise<ILinkedResource[]>;
13
+ }
14
+ /**
15
+ * Resources management service.
16
+ * Resources are assets created or imported in the whole solution (core and non-core apps)
17
+ */
18
+ export interface IResourceService {
19
+ /** App providing this service. */
20
+ getApplication(): App | string;
21
+ /** Type of resource this service can manage. */
22
+ getResourceType(): ResourceType;
23
+ /** Create a new resource from common parameters. */
24
+ create<T extends CreateParameters>(parameters: T): Promise<CreateResult>;
25
+ /** Update an existing resource from common parameters. */
26
+ update<T extends UpdateParameters>(parameters: T): Promise<UpdateResult>;
27
+ /** Copy a resource from common parameters. */
28
+ copy<T extends CopyParameters>(parameters: T): Promise<CopyResult>;
29
+ /** Publish an resource */
30
+ publish(parameters: PublishParameters): Promise<PublishResult>;
31
+ /** Delete folders and/or resources. */
32
+ deleteAll(parameters: DeleteParameters, useAssetId?: boolean): Promise<IActionResult>;
33
+ /** Trash folders and/or resources. */
34
+ trashAll(parameters: DeleteParameters, useAssetId?: boolean): Promise<IActionResult>;
35
+ /** Restore folders and/or resources from trash. */
36
+ restoreAll(parameters: DeleteParameters, useAssetId?: boolean): Promise<IActionResult>;
37
+ /** Create a search context and get the first results page. */
38
+ createContext(parameters: GetContextParameters): Promise<GetContextResult>;
39
+ /** Search / paginate within a search context. */
40
+ searchContext(parameters: GetContextParameters): Promise<ISearchResults>;
41
+ /** Search 1 resource by `id` */
42
+ searchResource(parameters: GetResourceParameters): Promise<IResource>;
43
+ /** Create a new folder. */
44
+ createFolder(parameters: CreateFolderParameters): Promise<CreateFolderResult>;
45
+ /** Update folder. */
46
+ updateFolder(parameters: UpdateFolderParameters): Promise<CreateFolderResult>;
47
+ /** Move resources/folders to a folder. */
48
+ moveToFolder(parameters: MoveParameters, useAssetId?: boolean): Promise<IActionResult>;
49
+ /** List subfolders of a parent folder. */
50
+ listSubfolders(folderId: ID): Promise<GetSubFoldersResult>;
51
+ }
52
+ /** FIXME */
53
+ export interface IWebResourceService {
54
+ /** URL where to print a resource. */
55
+ getPrintUrl(resourceId: string): string;
56
+ /** URL where to view a resource. */
57
+ getViewUrl(resourceId: string): string;
58
+ /** URL where to edit a resource. */
59
+ getEditUrl(resourceId: string): string;
60
+ /** URL where to create a new resource. */
61
+ getFormUrl(folderId?: string): string;
62
+ }
63
+ /** Model of a searchable (indexed) resource. */
64
+ export interface IResource {
65
+ application: App | string;
66
+ assetId: ID;
67
+ creatorId: ID;
68
+ creatorName: string;
69
+ comments?: number;
70
+ createdAt: string;
71
+ favorite?: boolean;
72
+ folderIds?: ID[];
73
+ id: ID;
74
+ modifiedAt: string;
75
+ modifierId: ID;
76
+ modifierName: string;
77
+ name: string;
78
+ slug?: string;
79
+ public?: boolean;
80
+ shared?: boolean;
81
+ thumbnail: string;
82
+ updatedAt: string;
83
+ views?: number;
84
+ trashed: boolean;
85
+ trashedBy?: ID[];
86
+ rights: RightStringified[];
87
+ description: string;
88
+ }
89
+ /**
90
+ * Core actions applicable on resources.
91
+ * Specific actions, which would depend on the running application,
92
+ * MUST BE typed and implemented in this application's agent.
93
+ */
94
+ export declare const ACTION: {
95
+ readonly SEARCH: "search";
96
+ readonly CREATE: "create";
97
+ readonly CREATE_PUBLIC: "createPublic";
98
+ readonly OPEN: "open";
99
+ readonly EDIT: "edit";
100
+ readonly MANAGE: "manage";
101
+ readonly UPD_PROPS: "properties";
102
+ readonly COMMENT: "comment";
103
+ readonly DELETE: "delete";
104
+ readonly TRASH: "trash";
105
+ readonly RESTORE: "restore";
106
+ readonly MOVE: "move";
107
+ readonly COPY: "copy";
108
+ readonly EXPORT: "export";
109
+ readonly SHARE: "share";
110
+ readonly PRINT: "print";
111
+ readonly PAGES_LIST: "pages_list";
112
+ readonly DISTRIBUTE: "distribute";
113
+ readonly REGISTER: "register";
114
+ readonly PUBLISH: "publish";
115
+ readonly PUBLISH_MOODLE: "publish_moodle";
116
+ };
117
+ export type ActionType = (typeof ACTION)[keyof typeof ACTION];
118
+ /** Constant folders IDs */
119
+ export declare const FOLDER: {
120
+ /** Special ID of the bin, or trash folder. */
121
+ readonly BIN: "bin";
122
+ /** Special ID of the root folder. */
123
+ readonly DEFAULT: "default";
124
+ };
125
+ export type FolderType = (typeof FOLDER)[keyof typeof FOLDER];
126
+ /** Constant search filters IDs, having a boolean type. */
127
+ export declare const BOOLEAN_FILTER: {
128
+ readonly OWNER: "owner";
129
+ readonly SHARED: "shared";
130
+ readonly PUBLIC: "public";
131
+ readonly FAVORITE: "favorite";
132
+ };
133
+ export type BooleanFilterType = (typeof BOOLEAN_FILTER)[keyof typeof BOOLEAN_FILTER];
134
+ /** Sort orders. */
135
+ export declare const SORT_ORDER: {
136
+ readonly ASC: "asc";
137
+ readonly DESC: "desc";
138
+ };
139
+ export type SortOrderType = (typeof SORT_ORDER)[keyof typeof SORT_ORDER];
140
+ /** Sortable fields. */
141
+ export declare const SORT_BY: {
142
+ readonly NAME: "name";
143
+ readonly MODIFY_DATE: "updatedAt";
144
+ readonly CREATED_AT: "createdAt";
145
+ readonly APPLICATION: "application";
146
+ readonly RESOURCE_TYPE: "resourceType";
147
+ };
148
+ export type SortByType = (typeof SORT_BY)[keyof typeof SORT_BY];
149
+ export type FilterValues = {
150
+ [B in BooleanFilterType]?: boolean;
151
+ } & {
152
+ folder?: ID;
153
+ };
154
+ export type OrderValues = {
155
+ [O in SortByType]?: SortOrderType;
156
+ };
157
+ /**
158
+ * Model of actions the user can -or cannot- accomplish.
159
+ */
160
+ export interface IAction {
161
+ id: ActionType;
162
+ /** Needed workflow right to accomplish this action. */
163
+ workflow: string;
164
+ /** Thruthy if the user owns the corresponding right. */
165
+ available?: boolean;
166
+ target?: 'actionbar' | 'tree';
167
+ right?: RightRole;
168
+ }
169
+ export interface IFolder {
170
+ id: ID;
171
+ parentId: ID;
172
+ name: string;
173
+ type: FolderType | ID;
174
+ childNumber: number;
175
+ trashed: boolean;
176
+ rights: string[];
177
+ ancestors: string[];
178
+ }
179
+ export interface IFilter {
180
+ id: BooleanFilterType;
181
+ defaultValue?: string | string[] | boolean | boolean[];
182
+ }
183
+ export interface IOrder {
184
+ id: SortByType;
185
+ defaultValue?: SortOrderType;
186
+ i18n: string;
187
+ }
188
+ export interface IPagination {
189
+ /** Index of the first available result. */
190
+ startIdx: number;
191
+ /** Number of actual results. */
192
+ pageSize: number;
193
+ /** Index of the last result (number of hits less 1). */
194
+ maxIdx?: number;
195
+ }
196
+ /** Base */
197
+ export interface IActionParameters {
198
+ application: App | string;
199
+ }
200
+ /** */
201
+ export interface IActionResult {
202
+ }
203
+ /** Parameters expected to create a resource */
204
+ export interface CreateParameters extends IActionParameters {
205
+ name: string;
206
+ description: string;
207
+ thumbnail: string | Blob | File;
208
+ folder: number | undefined;
209
+ public?: boolean;
210
+ slug?: string;
211
+ commentType?: string;
212
+ publishType?: string;
213
+ }
214
+ /** Response when creating resource */
215
+ export interface CreateResult {
216
+ 'entId': string;
217
+ 'thumbnail': string | undefined;
218
+ '_id'?: string;
219
+ 'title'?: string;
220
+ 'description'?: string;
221
+ 'visibility'?: string;
222
+ 'trashed'?: boolean;
223
+ 'publish-type'?: string;
224
+ 'comment-type'?: string;
225
+ 'created'?: {
226
+ $date: string;
227
+ };
228
+ 'modified'?: {
229
+ $date: string;
230
+ };
231
+ 'author'?: {
232
+ userId: string;
233
+ username: string;
234
+ login: string;
235
+ };
236
+ 'shared'?: Array<string>;
237
+ }
238
+ /** Parameters expected to copy a resource. */
239
+ export interface CopyParameters extends IActionParameters {
240
+ resourceId: ID;
241
+ }
242
+ /** Response when copying a resource. */
243
+ export interface CopyResult extends IActionResult {
244
+ duplicateId: ID;
245
+ message: string;
246
+ }
247
+ /** Parameters expected to publish a resource */
248
+ export interface PublishParameters extends IActionParameters {
249
+ userId: string | undefined;
250
+ title: string;
251
+ cover: Blob;
252
+ language: string;
253
+ activityType: string[];
254
+ subjectArea: string[];
255
+ age: [string, string];
256
+ description: string;
257
+ keyWords: string;
258
+ licence: string;
259
+ teacherAvatar: Blob;
260
+ resourceId: string;
261
+ resourceEntId: string;
262
+ userStructureName: string;
263
+ }
264
+ /** Response when publishing a resource */
265
+ export interface PublishResult extends IActionResult {
266
+ details: {
267
+ application: string;
268
+ created_at: string;
269
+ description: string;
270
+ front_url: string;
271
+ id: string;
272
+ title: string;
273
+ };
274
+ message: string;
275
+ reason: string;
276
+ success: boolean;
277
+ }
278
+ export interface IPreferences {
279
+ view: 'card' | 'list';
280
+ }
281
+ export interface ISearchParameters {
282
+ types: ResourceType[];
283
+ filters: FilterValues;
284
+ orders?: OrderValues;
285
+ pagination: IPagination;
286
+ search?: string;
287
+ trashed?: boolean;
288
+ id?: number;
289
+ asset_id?: string[];
290
+ }
291
+ export interface IResourceParameters {
292
+ id: string;
293
+ }
294
+ export interface ISearchResults {
295
+ folders: IFolder[];
296
+ pagination: IPagination;
297
+ resources: IResource[];
298
+ searchConfig?: {
299
+ minLength: number;
300
+ };
301
+ }
302
+ export interface IContext extends ISearchResults {
303
+ preferences: IPreferences;
304
+ }
305
+ /** Parameters expected to search for a resource */
306
+ export type GetContextParameters = IActionParameters & ISearchParameters;
307
+ /** Response when searching for a resource */
308
+ export type GetContextResult = IActionResult & IContext;
309
+ /** Parameters expected to create a folder */
310
+ export interface CreateFolderParameters extends IActionParameters {
311
+ type?: ResourceType;
312
+ parentId: ID | 'default';
313
+ name: string;
314
+ }
315
+ /** Response when creating a folder */
316
+ export interface CreateFolderResult extends IActionResult, IFolder {
317
+ createdAt: string;
318
+ creator_id?: string;
319
+ }
320
+ /** Parameters expected to update a folder */
321
+ export interface UpdateFolderParameters extends IActionParameters {
322
+ folderId: ID;
323
+ type: ResourceType;
324
+ parentId: ID | 'default';
325
+ name: string;
326
+ }
327
+ /** Response when updating a folder */
328
+ export interface UpdateFolderResult extends CreateFolderResult {
329
+ updatedAt: string;
330
+ parentId: ID | 'default';
331
+ }
332
+ /** Parameters expected to move folders and/or resources */
333
+ export interface MoveParameters extends IActionParameters {
334
+ folderId: ID;
335
+ resourceIds: ID[];
336
+ folderIds: ID[];
337
+ }
338
+ /** Response when listing subfolders of a folder */
339
+ export interface GetSubFoldersResult extends IActionResult {
340
+ folders: IFolder[];
341
+ }
342
+ /** Parameters expected to delete folders and/or resources */
343
+ export interface DeleteParameters extends IActionParameters {
344
+ resourceType: string;
345
+ resourceIds: ID[];
346
+ folderIds: ID[];
347
+ }
348
+ export interface TrashParameters extends DeleteParameters {
349
+ trash: boolean;
350
+ }
351
+ export type GetResourceParameters = IActionParameters & IResourceParameters;
352
+ export type GetResourcesParameters = IActionParameters & ISearchParameters;
353
+ export type GetResourcesResult = IActionResult & ISearchResults;
354
+ /** Parameters expected to update resource. */
355
+ export interface UpdateParameters {
356
+ entId: string;
357
+ trashed: boolean;
358
+ name: string;
359
+ thumbnail: string | Blob | File;
360
+ description: string;
361
+ public: boolean;
362
+ slug: string;
363
+ }
364
+ /** Response when updating resource. */
365
+ export interface UpdateResult {
366
+ entId: string;
367
+ thumbnail?: string;
368
+ }
369
+ export interface BlogUpdate extends UpdateParameters {
370
+ 'publish-type'?: 'RESTRAINT' | 'IMMEDIATE';
371
+ }
372
+ export interface BlogResource extends IResource {
373
+ 'publish-type': 'RESTRAINT' | 'IMMEDIATE';
374
+ }
375
+ export interface MindmapUpdate extends UpdateParameters {
376
+ 'publish-type'?: 'RESTRAINT' | 'IMMEDIATE';
377
+ }
378
+ export interface MindmapResource extends IResource {
379
+ 'publish-type': 'RESTRAINT' | 'IMMEDIATE';
380
+ }
381
+ export interface CollaborativewallUpdate extends UpdateParameters {
382
+ 'publish-type'?: 'RESTRAINT' | 'IMMEDIATE';
383
+ }
384
+ export interface CollaborativewallResource extends IResource {
385
+ 'publish-type': 'RESTRAINT' | 'IMMEDIATE';
386
+ }
387
+ export interface ScrapbookUpdate extends UpdateParameters {
388
+ }
389
+ export interface ScrapbookResource extends IResource {
390
+ }
@@ -0,0 +1,14 @@
1
+ import { ResourceType } from '../..';
2
+ import { CreateParameters, CreateResult, ScrapbookUpdate, UpdateResult } from '../interface';
3
+ import { ResourceService } from '../ResourceService';
4
+ export declare class ScrapbookResourceService extends ResourceService {
5
+ create<T extends CreateParameters>(parameters: T): Promise<CreateResult>;
6
+ update(parameters: ScrapbookUpdate): Promise<UpdateResult>;
7
+ getResourceType(): ResourceType;
8
+ getApplication(): string;
9
+ getFormUrl(folderId?: string): string;
10
+ getViewUrl(resourceId: string): string;
11
+ getPrintUrl(resourceId: string): string;
12
+ getEditUrl(resourceId: string): string;
13
+ getExportUrl(resourceId: string): string;
14
+ }
@@ -0,0 +1,77 @@
1
+ import { IOdeServices } from '../services/OdeServices';
2
+ import { ResourceRight, RightRole, RightStringified } from './interface';
3
+ export declare class RightService {
4
+ private context;
5
+ constructor(context: IOdeServices);
6
+ get session(): import('../session/Service').SessionService;
7
+ /**
8
+ * Parse right concat as "$TYPE:$ID:$RIGHT"
9
+ * $TYPE = user | group | creator
10
+ * $ID: id of the resource
11
+ * $RIGHT: read | contrib | manage
12
+ *
13
+ * @param right a concat right
14
+ * @returns Right parsed
15
+ */
16
+ parseResourceRight(right: RightStringified): ResourceRight | undefined;
17
+ /**
18
+ * Parse an array of rights concat as "$TYPE:$ID:$RIGHT"
19
+ * $TYPE = user | group | creator
20
+ * $ID: id of the resource
21
+ * $RIGHT: read | contrib | manage
22
+ *
23
+ * @param rights a list of concat rights
24
+ * @returns Array of Right parsed
25
+ */
26
+ parseResourceRights(rights: RightStringified[]): ResourceRight[];
27
+ /**
28
+ * Check wether a user has the expected right for a ressource
29
+ * @param user the userId and groupId concerned by the check
30
+ * @param expect the expected right to check
31
+ * @param rights array of Right for the resource
32
+ * @returns true if has rights
33
+ */
34
+ hasResourceRight({ id, groupIds }: {
35
+ id: string;
36
+ groupIds: string[];
37
+ }, expect: RightRole, rights: ResourceRight[] | RightStringified[]): boolean;
38
+ /**
39
+ * Check wether the current user have resource right
40
+ * @param expect the expected right to check
41
+ * @param rights array of Right for the resource
42
+ * @returns true if has rights
43
+ */
44
+ sessionHasResourceRight(expect: RightRole, rights: ResourceRight[] | RightStringified[]): Promise<boolean>;
45
+ /**
46
+ * Check wether the current user have at least one of resource right expected
47
+ * @param expects array of expected right to check
48
+ * @param rights array of Right for the resource
49
+ * @returns true if has rights
50
+ */
51
+ sessionHasAtLeastOneResourceRight(expects: RightRole[], rights: ResourceRight[] | RightStringified[]): Promise<boolean>;
52
+ /**
53
+ * Check wether the current user has resource right for each right list
54
+ * @param expect expected right to check
55
+ * @param rightsArray array of array of Right for multiple resources
56
+ * @returns true if has rights
57
+ */
58
+ sessionHasResourceRightForEachList(expect: RightRole, rightsArray: ResourceRight[][] | RightStringified[][]): Promise<boolean>;
59
+ /**
60
+ * Check wether the current user have at least one of resource right for each right list
61
+ * @param expects array of expected right to check
62
+ * @param rightsArray array of array of Right for multiple resources
63
+ * @returns true if has rights
64
+ */
65
+ sessionHasAtLeastOneResourceRightForEachList(expects: RightRole[], rightsArray: ResourceRight[][] | RightStringified[][]): Promise<boolean>;
66
+ hasWorkflowRight(expect: string, right: string[]): boolean;
67
+ /**
68
+ * @param expect a workflow right
69
+ * @returns true if current session has right on it
70
+ */
71
+ sessionHasWorkflowRight(expect: string): Promise<boolean>;
72
+ /**
73
+ * @param expect a workflow right
74
+ * @returns a record with right as key and boolean as value if current session has right on it
75
+ */
76
+ sessionHasWorkflowRights(expects: string[]): Promise<Record<string, boolean>>;
77
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Identify the type of "user"
3
+ */
4
+ export type RightSubject = 'user' | 'group' | 'creator';
5
+ /**
6
+ * Identify the role of the right
7
+ */
8
+ export type RightRole = 'read' | 'contrib' | 'manager' | 'creator' | (string & {});
9
+ /**
10
+ * Right of a resource
11
+ */
12
+ export interface ResourceRight {
13
+ type: RightSubject;
14
+ id: string;
15
+ right: RightRole;
16
+ }
17
+ /** FIXME */
18
+ export type RightStringified = string;
@@ -0,0 +1,72 @@
1
+ import { CacheService } from '../cache/Service';
2
+ import { ConfService } from '../configure/Service';
3
+ import { DirectoryService } from '../directory/Service';
4
+ import { HttpService } from '../transport/Service';
5
+ import { RightService } from '../rights/Service';
6
+ import { SessionService } from '../session/Service';
7
+ import { ShareService } from '../share/Service';
8
+ import { WorkspaceService } from '../workspace/Service';
9
+ import { IdiomService } from '../idiom/Service';
10
+ import { AnalyticsService } from '../analytics/Service';
11
+ import { IAudienceService } from '../audience/interface';
12
+ import { VideoService } from '../video/Service';
13
+ import { App, ResourceType } from '../globals';
14
+ import { IBehaviourService, IResourceService, IWebResourceService } from '../resources/interface';
15
+ import { EmbedderService } from '../embedder/Service';
16
+ import { INotifyFramework } from '../notify/interfaces';
17
+ import { DataService } from '../data/Service';
18
+ import { IDataService } from '../data/interface';
19
+ export interface IOdeServices {
20
+ analytics(): AnalyticsService;
21
+ audience(application: App, resourceType: ResourceType): IAudienceService;
22
+ cache(): CacheService;
23
+ conf(): ConfService;
24
+ data(): IDataService;
25
+ directory(): DirectoryService;
26
+ http(): HttpService;
27
+ idiom(): IdiomService;
28
+ notify(): INotifyFramework;
29
+ resource(application: App, resourceType?: ResourceType): IResourceService & IWebResourceService;
30
+ behaviour(application: App, resourceType: ResourceType): IBehaviourService;
31
+ rights(): RightService;
32
+ session(): SessionService;
33
+ share(): ShareService;
34
+ video(): VideoService;
35
+ workspace(): WorkspaceService;
36
+ embedder(): EmbedderService;
37
+ }
38
+ export declare class OdeServices implements IOdeServices {
39
+ private _analytics;
40
+ private _cache;
41
+ private _conf;
42
+ private _data;
43
+ private _directory;
44
+ private _http;
45
+ private _idiom;
46
+ private _notify;
47
+ private _rights;
48
+ private _session;
49
+ private _share;
50
+ private _video;
51
+ private _workspace;
52
+ private _embedder;
53
+ constructor();
54
+ initialize(): OdeServices;
55
+ analytics(): AnalyticsService;
56
+ audience(application: App, resourceType: ResourceType): IAudienceService;
57
+ cache(): CacheService;
58
+ conf(): ConfService;
59
+ data(): DataService;
60
+ directory(): DirectoryService;
61
+ http(): HttpService;
62
+ idiom(): IdiomService;
63
+ notify(): INotifyFramework;
64
+ resource(application: App, resourceType?: ResourceType): IResourceService & IWebResourceService;
65
+ behaviour(application: App, resourceType: ResourceType): IBehaviourService;
66
+ rights(): RightService;
67
+ session(): SessionService;
68
+ share(): ShareService;
69
+ video(): VideoService;
70
+ workspace(): WorkspaceService;
71
+ embedder(): EmbedderService;
72
+ }
@@ -0,0 +1,10 @@
1
+ import { IOdeServices } from './OdeServices';
2
+ export declare const odeServices: IOdeServices;
3
+ export * from '../directory/interface';
4
+ export type { ILinkedResource } from '../resources/behaviours/AbstractBehaviourService';
5
+ export * from '../resources/interface';
6
+ export * from '../resources/ResourceService';
7
+ export * from '../resources/SnipletsService';
8
+ export * from '../rights/interface';
9
+ export * from '../share/interface';
10
+ export * from '../workspace/interface';
@@ -0,0 +1,10 @@
1
+ import { ISessionFramework } from './interfaces';
2
+ import { Session } from './Session';
3
+ export declare class SessionFramework implements ISessionFramework {
4
+ session: Session;
5
+ initialize(): Promise<void>;
6
+ login(email: string, password: string, rememberMe?: boolean, secureLocation?: boolean): Promise<void>;
7
+ logout(): Promise<void>;
8
+ }
9
+ /** The whole framework is a singleton. */
10
+ export declare const session: SessionFramework;
@@ -0,0 +1,39 @@
1
+ import { App } from '../globals';
2
+ import { GetUserProfileOptions, IGetSession, IQuotaAndUsage, IUserInfo, IWebApp, UserProfile } from './interfaces';
3
+ import { IOdeServices } from '../services/OdeServices';
4
+ export declare class SessionService {
5
+ private context;
6
+ constructor(context: IOdeServices);
7
+ get http(): import('../transport/Service').HttpService;
8
+ get cache(): import('../cache/Service').CacheService;
9
+ private get conf();
10
+ /**
11
+ * Callback to call when user logout
12
+ */
13
+ onLogout(): void;
14
+ /**
15
+ * Callback to call when session change
16
+ */
17
+ onRefreshSession(): void;
18
+ getSession(): Promise<IGetSession>;
19
+ login(email: string, password: string, rememberMe?: boolean, secureLocation?: boolean): Promise<void>;
20
+ logout(): Promise<void>;
21
+ latestQuotaAndUsage(user: IUserInfo | undefined): Promise<IQuotaAndUsage>;
22
+ getCurrentLanguage(user: IUserInfo | undefined): Promise<string | undefined>;
23
+ private loadUserLanguage;
24
+ private loadDefaultLanguage;
25
+ getUser(): Promise<IUserInfo | undefined>;
26
+ hasWorkflow({ workflowName, user, }: {
27
+ workflowName: string;
28
+ user: IUserInfo;
29
+ }): boolean;
30
+ private loadDescription;
31
+ private getBookmarks;
32
+ getUserProfile(options?: Partial<GetUserProfileOptions>): Promise<UserProfile>;
33
+ isAdml(): Promise<boolean>;
34
+ /**
35
+ * Get details of an application if the user can access it.
36
+ * @return undefined if no access, or app not found
37
+ */
38
+ getWebApp(application: App): Promise<IWebApp | undefined>;
39
+ }
@@ -0,0 +1,34 @@
1
+ import { IEmailValidationInfos, IEmailValidationState, IMfaCodeState, IMfaInfos, IMobileValidationInfos, IMobileValidationState, IQuotaAndUsage, ISession, IUserDescription, IUserInfo, UserProfile } from './interfaces';
2
+ import { App } from '../globals';
3
+ export declare class Session implements ISession {
4
+ private _me;
5
+ private _currentLanguage;
6
+ private _notLoggedIn;
7
+ private _description?;
8
+ private _profile?;
9
+ get currentLanguage(): string;
10
+ get notLoggedIn(): boolean;
11
+ get description(): IUserDescription;
12
+ get avatarUrl(): string;
13
+ get user(): IUserInfo;
14
+ get currentApp(): App | null;
15
+ initialize(): Promise<void>;
16
+ private setCurrentModel;
17
+ hasWorkflow(workflowName: string): boolean;
18
+ hasRight(resource: any, right: any): boolean;
19
+ get latestQuotaAndUsage(): Promise<IQuotaAndUsage>;
20
+ private setCurrentLanguage;
21
+ private loadDefaultLanguage;
22
+ private loadDescription;
23
+ get profile(): UserProfile;
24
+ getUserProfile(): Promise<UserProfile>;
25
+ private loadUserLanguage;
26
+ getEmailValidationInfos(): Promise<IEmailValidationInfos>;
27
+ checkEmail(email: String): Promise<void>;
28
+ tryEmailValidation(code: String): Promise<IEmailValidationState>;
29
+ getMobileValidationInfos(): Promise<IMobileValidationInfos>;
30
+ checkMobile(mobile: String): Promise<void>;
31
+ tryMobileValidation(code: String): Promise<IMobileValidationState>;
32
+ getMfaInfos(): Promise<IMfaInfos>;
33
+ tryMfaCode(code: String): Promise<IMfaCodeState>;
34
+ }