ode-ts-client 1.1.3 → 1.1.4-dev.202306051713
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/dist/agents/blog.agent.d.ts +2 -0
- package/dist/agents/folder.agent.d.ts +2 -0
- package/dist/agents/index.d.ts +4 -0
- package/dist/{ts/apps → apps}/timeline/Framework.d.ts +0 -1
- package/dist/{ts/apps → apps}/timeline/Notification.model.d.ts +0 -1
- package/dist/{ts/apps → apps}/timeline/interfaces.d.ts +0 -1
- package/dist/cache/Service.d.ts +14 -0
- package/dist/{ts/configure → configure}/Analytics.d.ts +0 -1
- package/dist/{ts/configure → configure}/AppConf.d.ts +3 -1
- package/dist/{ts/configure → configure}/Framework.d.ts +1 -2
- package/dist/configure/Service.d.ts +17 -0
- package/dist/{ts/configure → configure}/Theme.d.ts +0 -1
- package/dist/{ts/configure → configure}/User.d.ts +0 -1
- package/dist/{ts/configure → configure}/interfaces.d.ts +24 -5
- package/dist/directory/Service.d.ts +17 -0
- package/dist/directory/interface.d.ts +53 -0
- package/dist/{ts/explore → explore}/Agent.d.ts +0 -1
- package/dist/{ts/explore → explore}/AgentLoader.d.ts +0 -2
- package/dist/{ts/explore → explore}/Bus.d.ts +0 -1
- package/dist/{ts/explore → explore}/Context.d.ts +3 -2
- package/dist/{ts/explore → explore}/Framework.d.ts +2 -2
- package/dist/{ts/explore → explore}/interfaces.d.ts +105 -28
- package/dist/{ts/globals.d.ts → globals.d.ts} +3 -3
- package/dist/{ts/configure → idiom}/Idiom.d.ts +6 -3
- package/dist/idiom/Service.d.ts +24 -0
- package/dist/idiom/interfaces.d.ts +22 -0
- package/dist/index.cjs.d.ts +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/legacy/Behaviours.d.ts +35 -0
- package/dist/legacy/entcore.d.ts +7 -0
- package/dist/legacy/http.d.ts +24 -0
- package/dist/legacy/me.d.ts +12 -0
- package/dist/legacy/rights.d.ts +55 -0
- package/dist/{ts/notify → notify}/Framework.d.ts +0 -1
- package/dist/{ts/notify → notify}/interfaces.d.ts +2 -3
- package/dist/ode-ts-client.js +16 -15
- package/dist/ode-ts-client.js.map +1 -1
- package/dist/ode-ts-client.mjs +7701 -0
- package/dist/ode-ts-client.mjs.map +1 -0
- package/dist/resources/BlogResourceService.d.ts +11 -0
- package/dist/resources/ResourceService.d.ts +55 -0
- package/dist/resources/interface.d.ts +26 -0
- package/dist/rights/Service.d.ts +78 -0
- package/dist/rights/interface.d.ts +16 -0
- package/dist/services/OdeServices.d.ts +44 -0
- package/dist/services/index.d.ts +7 -0
- package/dist/{ts/session → session}/Framework.d.ts +2 -1
- package/dist/session/Service.d.ts +32 -0
- package/dist/{ts/session → session}/Session.d.ts +10 -3
- package/dist/{ts/session → session}/interfaces.d.ts +81 -4
- package/dist/share/Service.d.ts +18 -0
- package/dist/share/interface.d.ts +99 -0
- package/dist/{ts/transport → transport}/Framework.d.ts +0 -1
- package/dist/{ts/transport → transport}/Http.d.ts +0 -1
- package/dist/transport/Service.d.ts +25 -0
- package/dist/{ts/transport → transport}/interfaces.d.ts +3 -1
- package/dist/utils/FileTypeUtils.d.ts +6 -0
- package/dist/utils/MimeTypeUtils.d.ts +20 -0
- package/dist/utils/StringUtils.d.ts +3 -0
- package/dist/version.txt +1 -1
- package/dist/{ts/widget → widget}/Framework.d.ts +0 -1
- package/dist/{ts/widget → widget}/LastInfos.widget.d.ts +0 -1
- package/dist/{ts/widget → widget}/interfaces.d.ts +1 -2
- package/dist/workspace/Service.d.ts +12 -0
- package/dist/workspace/interface.d.ts +48 -0
- package/package.json +40 -30
- package/dist/test/Foundation.spec.d.ts +0 -2
- package/dist/test/Foundation.spec.d.ts.map +0 -1
- package/dist/test/mocks/agents/MockedAgentLoader.d.ts +0 -9
- package/dist/test/mocks/agents/MockedAgentLoader.d.ts.map +0 -1
- package/dist/test/mocks/agents/MockedFolderAgent.d.ts +0 -15
- package/dist/test/mocks/agents/MockedFolderAgent.d.ts.map +0 -1
- package/dist/ts/apps/timeline/Framework.d.ts.map +0 -1
- package/dist/ts/apps/timeline/Notification.model.d.ts.map +0 -1
- package/dist/ts/apps/timeline/interfaces.d.ts.map +0 -1
- package/dist/ts/configure/Analytics.d.ts.map +0 -1
- package/dist/ts/configure/AppConf.d.ts.map +0 -1
- package/dist/ts/configure/Framework.d.ts.map +0 -1
- package/dist/ts/configure/Idiom.d.ts.map +0 -1
- package/dist/ts/configure/Theme.d.ts.map +0 -1
- package/dist/ts/configure/User.d.ts.map +0 -1
- package/dist/ts/configure/interfaces.d.ts.map +0 -1
- package/dist/ts/explore/Agent.d.ts.map +0 -1
- package/dist/ts/explore/AgentLoader.d.ts.map +0 -1
- package/dist/ts/explore/Bus.d.ts.map +0 -1
- package/dist/ts/explore/Context.d.ts.map +0 -1
- package/dist/ts/explore/Framework.d.ts.map +0 -1
- package/dist/ts/explore/interfaces.d.ts.map +0 -1
- package/dist/ts/globals.d.ts.map +0 -1
- package/dist/ts/index.d.ts +0 -12
- package/dist/ts/index.d.ts.map +0 -1
- package/dist/ts/notify/Framework.d.ts.map +0 -1
- package/dist/ts/notify/interfaces.d.ts.map +0 -1
- package/dist/ts/session/Framework.d.ts.map +0 -1
- package/dist/ts/session/Session.d.ts.map +0 -1
- package/dist/ts/session/interfaces.d.ts.map +0 -1
- package/dist/ts/transport/Framework.d.ts.map +0 -1
- package/dist/ts/transport/Http.d.ts.map +0 -1
- package/dist/ts/transport/interfaces.d.ts.map +0 -1
- package/dist/ts/widget/Framework.d.ts.map +0 -1
- package/dist/ts/widget/LastInfos.widget.d.ts.map +0 -1
- package/dist/ts/widget/interfaces.d.ts.map +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ResourceType } from "..";
|
|
2
|
+
import { BlogUpdate, UpdateResult } from "./interface";
|
|
3
|
+
import { ResourceService } from "./ResourceService";
|
|
4
|
+
export declare class BlogResourceService extends ResourceService {
|
|
5
|
+
update(parameters: BlogUpdate): Promise<UpdateResult>;
|
|
6
|
+
getResourceType(): ResourceType;
|
|
7
|
+
getApplication(): string;
|
|
8
|
+
getFormUrl(folderId?: string): string;
|
|
9
|
+
getViewUrl(resourceId: string): string;
|
|
10
|
+
getPrintUrl(resourceId: string, withComment?: boolean): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { PublishParameters, PublishResult, GetContextParameters, GetContextResult, ISearchResults, CreateFolderParameters, MoveParameters, IActionResult, TrashParameters, CreateFolderResult, UpdateFolderParameters, ID, GetSubFoldersResult, DeleteParameters, ResourceType } from "..";
|
|
2
|
+
import { OdeServices } from "../services/OdeServices";
|
|
3
|
+
import { UpdateParameters, UpdateResult } from "./interface";
|
|
4
|
+
export declare abstract class ResourceService {
|
|
5
|
+
protected context: OdeServices;
|
|
6
|
+
private static registry;
|
|
7
|
+
static register({ application, resourceType, }: {
|
|
8
|
+
application: string;
|
|
9
|
+
resourceType: string;
|
|
10
|
+
}, service: (context: OdeServices) => ResourceService): void;
|
|
11
|
+
static findService({ application, resourceType, }: {
|
|
12
|
+
application: string;
|
|
13
|
+
resourceType: string;
|
|
14
|
+
}, context: OdeServices): ResourceService;
|
|
15
|
+
static findMainService({ application }: {
|
|
16
|
+
application: string;
|
|
17
|
+
}, context: OdeServices): ResourceService;
|
|
18
|
+
constructor(context: OdeServices);
|
|
19
|
+
protected get http(): import("../transport/Service").HttpService;
|
|
20
|
+
abstract getApplication(): string;
|
|
21
|
+
abstract getPrintUrl(resourceId: string, withComment?: boolean): string;
|
|
22
|
+
abstract getViewUrl(resourceId: string): string;
|
|
23
|
+
abstract getFormUrl(folderId?: string): string;
|
|
24
|
+
abstract update<T extends UpdateParameters>(parameters: T): Promise<UpdateResult>;
|
|
25
|
+
abstract getResourceType(): ResourceType;
|
|
26
|
+
getShareReadUrl(id: string): string;
|
|
27
|
+
getSaveShareUrl(id: string): string;
|
|
28
|
+
gotoPrint(resourceId: string, withComment?: boolean): void;
|
|
29
|
+
gotoView(resourceId: string): void;
|
|
30
|
+
gotoForm(folderId?: string): void;
|
|
31
|
+
publish(parameters: PublishParameters): Promise<PublishResult>;
|
|
32
|
+
/** Create a search context. */
|
|
33
|
+
createContext(parameters: GetContextParameters): Promise<GetContextResult>;
|
|
34
|
+
/** Search / paginate within a search context. */
|
|
35
|
+
searchContext(parameters: GetContextParameters): Promise<ISearchResults>;
|
|
36
|
+
/** Create a new folder. */
|
|
37
|
+
createFolder(parameters: CreateFolderParameters): Promise<CreateFolderResult>;
|
|
38
|
+
/** Update folder. */
|
|
39
|
+
updateFolder(parameters: UpdateFolderParameters): Promise<CreateFolderResult>;
|
|
40
|
+
/** Move resources/folders to a folder. */
|
|
41
|
+
moveToFolder(parameters: MoveParameters): Promise<IActionResult>;
|
|
42
|
+
/** List subfolders of a parent folder. */
|
|
43
|
+
listSubfolders(folderId: ID): Promise<GetSubFoldersResult>;
|
|
44
|
+
/** Delete folders and/or resources. */
|
|
45
|
+
deleteAll(parameters: DeleteParameters): Promise<IActionResult>;
|
|
46
|
+
/** Trash folders and/or resources. */
|
|
47
|
+
trashAll({ resourceType, ...parameters }: Omit<TrashParameters, "trash">): Promise<IActionResult>;
|
|
48
|
+
/** Trash folders and/or resources. */
|
|
49
|
+
restoreAll({ resourceType, ...parameters }: Omit<TrashParameters, "trash">): Promise<IActionResult>;
|
|
50
|
+
protected checkHttpResponse: <R>(result: R) => R;
|
|
51
|
+
protected getThumbnailPath(thumb: string | Blob | File | undefined): Promise<string | undefined>;
|
|
52
|
+
private toQueryParams;
|
|
53
|
+
private createFolderToBodyParams;
|
|
54
|
+
private moveToBodyParams;
|
|
55
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IResource } from "..";
|
|
2
|
+
/**
|
|
3
|
+
* Parameters expected to update resource
|
|
4
|
+
*/
|
|
5
|
+
export interface UpdateParameters {
|
|
6
|
+
entId: string;
|
|
7
|
+
trashed: boolean;
|
|
8
|
+
name: string;
|
|
9
|
+
thumbnail: string | Blob | File;
|
|
10
|
+
description: string;
|
|
11
|
+
public: boolean;
|
|
12
|
+
slug: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Response when updating resource
|
|
16
|
+
*/
|
|
17
|
+
export interface UpdateResult {
|
|
18
|
+
entId: string;
|
|
19
|
+
thumbnail?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface BlogUpdate extends UpdateParameters {
|
|
22
|
+
"publish-type"?: "RESTRAINT" | "IMMEDIATE";
|
|
23
|
+
}
|
|
24
|
+
export interface BlogResource extends IResource {
|
|
25
|
+
"publish-type": "RESTRAINT" | "IMMEDIATE";
|
|
26
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { RightStringified } from "../explore/interfaces";
|
|
2
|
+
import { OdeServices } from "../services/OdeServices";
|
|
3
|
+
import { ResourceRight, RightRole } from "./interface";
|
|
4
|
+
export declare class RightService {
|
|
5
|
+
private context;
|
|
6
|
+
constructor(context: OdeServices);
|
|
7
|
+
get session(): import("../session/Service").SessionService;
|
|
8
|
+
/**
|
|
9
|
+
* Parse right concat as "$TYPE:$ID:$RIGHT"
|
|
10
|
+
* $TYPE = user | group | creator
|
|
11
|
+
* $ID: id of the resource
|
|
12
|
+
* $RIGHT: read | contrib | manage
|
|
13
|
+
*
|
|
14
|
+
* @param right a concat right
|
|
15
|
+
* @returns Right parsed
|
|
16
|
+
*/
|
|
17
|
+
parseResourceRight(right: RightStringified): ResourceRight | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Parse an array of rights concat as "$TYPE:$ID:$RIGHT"
|
|
20
|
+
* $TYPE = user | group | creator
|
|
21
|
+
* $ID: id of the resource
|
|
22
|
+
* $RIGHT: read | contrib | manage
|
|
23
|
+
*
|
|
24
|
+
* @param rights a list of concat rights
|
|
25
|
+
* @returns Array of Right parsed
|
|
26
|
+
*/
|
|
27
|
+
parseResourceRights(rights: RightStringified[]): ResourceRight[];
|
|
28
|
+
/**
|
|
29
|
+
* Check wether a user has the expected right for a ressource
|
|
30
|
+
* @param user the userId and groupId concerned by the check
|
|
31
|
+
* @param expect the expected right to check
|
|
32
|
+
* @param rights array of Right for the resource
|
|
33
|
+
* @returns true if has rights
|
|
34
|
+
*/
|
|
35
|
+
hasResourceRight({ id, groupIds }: {
|
|
36
|
+
id: string;
|
|
37
|
+
groupIds: string[];
|
|
38
|
+
}, expect: RightRole, rights: ResourceRight[] | RightStringified[]): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Check wether the current user have resource right
|
|
41
|
+
* @param expect the expected right to check
|
|
42
|
+
* @param rights array of Right for the resource
|
|
43
|
+
* @returns true if has rights
|
|
44
|
+
*/
|
|
45
|
+
sessionHasResourceRight(expect: RightRole, rights: ResourceRight[] | RightStringified[]): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Check wether the current user have at least one of resource right expected
|
|
48
|
+
* @param expects array of expected right to check
|
|
49
|
+
* @param rights array of Right for the resource
|
|
50
|
+
* @returns true if has rights
|
|
51
|
+
*/
|
|
52
|
+
sessionHasAtLeastOneResourceRight(expects: RightRole[], rights: ResourceRight[] | RightStringified[]): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Check wether the current user has resource right for each right list
|
|
55
|
+
* @param expect expected right to check
|
|
56
|
+
* @param rightsArray array of array of Right for multiple resources
|
|
57
|
+
* @returns true if has rights
|
|
58
|
+
*/
|
|
59
|
+
sessionHasResourceRightForEachList(expect: RightRole, rightsArray: ResourceRight[][] | RightStringified[][]): Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Check wether the current user have at least one of resource right for each right list
|
|
62
|
+
* @param expects array of expected right to check
|
|
63
|
+
* @param rightsArray array of array of Right for multiple resources
|
|
64
|
+
* @returns true if has rights
|
|
65
|
+
*/
|
|
66
|
+
sessionHasAtLeastOneResourceRightForEachList(expects: RightRole[], rightsArray: ResourceRight[][] | RightStringified[][]): Promise<boolean>;
|
|
67
|
+
hasWorkflowRight(expect: string, right: string[]): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* @param expect a workflow right
|
|
70
|
+
* @returns true if current session has right on it
|
|
71
|
+
*/
|
|
72
|
+
sessionHasWorkflowRight(expect: string): Promise<boolean>;
|
|
73
|
+
/**
|
|
74
|
+
* @param expect a workflow right
|
|
75
|
+
* @returns a record with right as key and boolean as value if current session has right on it
|
|
76
|
+
*/
|
|
77
|
+
sessionHasWorkflowRights(expects: string[]): Promise<Record<string, boolean>>;
|
|
78
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identify the type of "user"
|
|
3
|
+
*/
|
|
4
|
+
export declare type RightSubject = "user" | "group" | "creator";
|
|
5
|
+
/**
|
|
6
|
+
* Identify the role of the right
|
|
7
|
+
*/
|
|
8
|
+
export declare type RightRole = "read" | "contrib" | "manager" | "creator";
|
|
9
|
+
/**
|
|
10
|
+
* Right of a resource
|
|
11
|
+
*/
|
|
12
|
+
export interface ResourceRight {
|
|
13
|
+
type: RightSubject;
|
|
14
|
+
id: string;
|
|
15
|
+
right: RightRole;
|
|
16
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { ResourceService } from "../resources/ResourceService";
|
|
6
|
+
import { RightService } from "../rights/Service";
|
|
7
|
+
import { SessionService } from "../session/Service";
|
|
8
|
+
import { ShareService } from "../share/Service";
|
|
9
|
+
import { WorkspaceService } from "../workspace/Service";
|
|
10
|
+
import { IdiomService } from "../idiom/Service";
|
|
11
|
+
export interface IOdeServices {
|
|
12
|
+
cache(): CacheService;
|
|
13
|
+
conf(): ConfService;
|
|
14
|
+
directory(): DirectoryService;
|
|
15
|
+
http(): HttpService;
|
|
16
|
+
idiom(): IdiomService;
|
|
17
|
+
resource(application: string, resourceType?: string): ResourceService;
|
|
18
|
+
rights(): RightService;
|
|
19
|
+
session(): SessionService;
|
|
20
|
+
share(): ShareService;
|
|
21
|
+
workspace(): WorkspaceService;
|
|
22
|
+
}
|
|
23
|
+
export declare class OdeServices implements IOdeServices {
|
|
24
|
+
private _cache;
|
|
25
|
+
private _conf;
|
|
26
|
+
private _directory;
|
|
27
|
+
private _http;
|
|
28
|
+
private _idiom;
|
|
29
|
+
private _rights;
|
|
30
|
+
private _session;
|
|
31
|
+
private _share;
|
|
32
|
+
private _workspace;
|
|
33
|
+
constructor();
|
|
34
|
+
cache(): CacheService;
|
|
35
|
+
conf(): ConfService;
|
|
36
|
+
directory(): DirectoryService;
|
|
37
|
+
http(): HttpService;
|
|
38
|
+
idiom(): IdiomService;
|
|
39
|
+
resource(application: string, resourceType?: string): ResourceService;
|
|
40
|
+
rights(): RightService;
|
|
41
|
+
session(): SessionService;
|
|
42
|
+
share(): ShareService;
|
|
43
|
+
workspace(): WorkspaceService;
|
|
44
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IOdeServices } from "./OdeServices";
|
|
2
|
+
export declare const odeServices: IOdeServices;
|
|
3
|
+
export * from "../directory/interface";
|
|
4
|
+
export * from "../resources/interface";
|
|
5
|
+
export * from "../rights/interface";
|
|
6
|
+
export * from "../share/interface";
|
|
7
|
+
export * from "../workspace/interface";
|
|
@@ -3,7 +3,8 @@ import { Session } from "./Session";
|
|
|
3
3
|
export declare class SessionFramework implements ISessionFramework {
|
|
4
4
|
session: Session;
|
|
5
5
|
initialize(): Promise<void>;
|
|
6
|
+
login(email: string, password: string, rememberMe?: boolean, secureLocation?: boolean): Promise<void>;
|
|
7
|
+
logout(): Promise<void>;
|
|
6
8
|
}
|
|
7
9
|
/** The whole framework is a singleton. */
|
|
8
10
|
export declare const session: SessionFramework;
|
|
9
|
-
//# sourceMappingURL=Framework.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { IGetSession, IQuotaAndUsage, IUserInfo, UserProfile } from "./interfaces";
|
|
2
|
+
import { IOdeServices } from "../services/OdeServices";
|
|
3
|
+
export declare class SessionService {
|
|
4
|
+
private context;
|
|
5
|
+
constructor(context: IOdeServices);
|
|
6
|
+
get http(): import("../transport/Service").HttpService;
|
|
7
|
+
get cache(): import("../cache/Service").CacheService;
|
|
8
|
+
/**
|
|
9
|
+
* Callback to call when user logout
|
|
10
|
+
*/
|
|
11
|
+
onLogout(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Callback to call when session change
|
|
14
|
+
*/
|
|
15
|
+
onRefreshSession(): void;
|
|
16
|
+
getSession(): Promise<IGetSession>;
|
|
17
|
+
login(email: string, password: string, rememberMe?: boolean, secureLocation?: boolean): Promise<void>;
|
|
18
|
+
logout(): Promise<void>;
|
|
19
|
+
latestQuotaAndUsage(user: IUserInfo | undefined): Promise<IQuotaAndUsage>;
|
|
20
|
+
getCurrentLanguage(user: IUserInfo | undefined): Promise<string | undefined>;
|
|
21
|
+
private loadUserLanguage;
|
|
22
|
+
private loadDefaultLanguage;
|
|
23
|
+
getUser(): Promise<IUserInfo | undefined>;
|
|
24
|
+
hasWorkflow({ workflowName, user, }: {
|
|
25
|
+
workflowName: string;
|
|
26
|
+
user: IUserInfo;
|
|
27
|
+
}): boolean;
|
|
28
|
+
private loadDescription;
|
|
29
|
+
private getBookmarks;
|
|
30
|
+
getUserProfile(options?: any): Promise<UserProfile>;
|
|
31
|
+
isAdml(): Promise<boolean>;
|
|
32
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { IEmailValidationInfos, IEmailValidationState, IQuotaAndUsage, ISession, IUserDescription, IUserInfo } from "./interfaces";
|
|
1
|
+
import { IEmailValidationInfos, IEmailValidationState, IMfaCodeState, IMfaInfos, IMobileValidationInfos, IMobileValidationState, IQuotaAndUsage, ISession, IUserDescription, IUserInfo, UserProfile } from "./interfaces";
|
|
2
2
|
import { App } from "../globals";
|
|
3
3
|
export declare class Session implements ISession {
|
|
4
4
|
private _me;
|
|
5
5
|
private _currentLanguage;
|
|
6
6
|
private _notLoggedIn;
|
|
7
7
|
private _description?;
|
|
8
|
+
private _profile?;
|
|
8
9
|
get currentLanguage(): string;
|
|
9
10
|
get notLoggedIn(): boolean;
|
|
10
11
|
get description(): IUserDescription;
|
|
@@ -18,10 +19,16 @@ export declare class Session implements ISession {
|
|
|
18
19
|
get latestQuotaAndUsage(): Promise<IQuotaAndUsage>;
|
|
19
20
|
private setCurrentLanguage;
|
|
20
21
|
private loadDefaultLanguage;
|
|
21
|
-
private loadUserLanguage;
|
|
22
22
|
private loadDescription;
|
|
23
|
+
get profile(): UserProfile;
|
|
24
|
+
getUserProfile(): Promise<UserProfile>;
|
|
25
|
+
private loadUserLanguage;
|
|
23
26
|
getEmailValidationInfos(): Promise<IEmailValidationInfos>;
|
|
24
27
|
checkEmail(email: String): Promise<void>;
|
|
25
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>;
|
|
26
34
|
}
|
|
27
|
-
//# sourceMappingURL=Session.d.ts.map
|
|
@@ -4,8 +4,20 @@ export declare abstract class SessionFrameworkFactory {
|
|
|
4
4
|
static instance(): ISessionFramework;
|
|
5
5
|
}
|
|
6
6
|
export interface ISessionFramework {
|
|
7
|
+
/** Initialize once before use. */
|
|
7
8
|
initialize(): Promise<void>;
|
|
9
|
+
/** The current user session. */
|
|
8
10
|
session: ISession;
|
|
11
|
+
/** Log the current user in. */
|
|
12
|
+
login(email: string, password: string, rememberMe?: boolean, secureLocation?: boolean): Promise<void>;
|
|
13
|
+
/** Close the current user session. */
|
|
14
|
+
logout(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export interface ILoginModel {
|
|
17
|
+
email: string;
|
|
18
|
+
password: string;
|
|
19
|
+
rememberMe?: boolean;
|
|
20
|
+
secureLocation?: boolean;
|
|
9
21
|
}
|
|
10
22
|
export interface ISession {
|
|
11
23
|
/** Language code (2-letters) actually applied. */
|
|
@@ -14,6 +26,8 @@ export interface ISession {
|
|
|
14
26
|
readonly notLoggedIn: boolean;
|
|
15
27
|
/** Additional information about the connected user. */
|
|
16
28
|
readonly description: IUserDescription;
|
|
29
|
+
/** Additional profile user information. */
|
|
30
|
+
readonly profile: UserProfile;
|
|
17
31
|
/**
|
|
18
32
|
* Get the connected user's avatar URL, or a default one.
|
|
19
33
|
* Append a query parameter to this URL for it to get resized, for example "?thumbnail=48x48"
|
|
@@ -27,6 +41,8 @@ export interface ISession {
|
|
|
27
41
|
readonly latestQuotaAndUsage: Promise<IQuotaAndUsage>;
|
|
28
42
|
hasWorkflow(workflowName: string): boolean;
|
|
29
43
|
hasRight(resource: any, right: any): boolean;
|
|
44
|
+
/** Get User Profile */
|
|
45
|
+
getUserProfile(): Promise<UserProfile>;
|
|
30
46
|
/** Verify if the logged-in user has a valid email address. */
|
|
31
47
|
getEmailValidationInfos(): Promise<IEmailValidationInfos>;
|
|
32
48
|
/**
|
|
@@ -36,6 +52,19 @@ export interface ISession {
|
|
|
36
52
|
checkEmail(email: String): Promise<void>;
|
|
37
53
|
/** Send a 6-digits code to the server to try validating the pending email address. */
|
|
38
54
|
tryEmailValidation(code: String): Promise<IEmailValidationState>;
|
|
55
|
+
/** Verify if the logged-in user has a valid phone number. */
|
|
56
|
+
getMobileValidationInfos(): Promise<IMobileValidationInfos>;
|
|
57
|
+
/**
|
|
58
|
+
* Send a 6-digits code to a phone number to validate it.
|
|
59
|
+
* => when resolved successfully, the phone number infos will switch to the "pending" state.
|
|
60
|
+
*/
|
|
61
|
+
checkMobile(mobile: String): Promise<void>;
|
|
62
|
+
/** Send a 6-digits code to the server to try validating the pending phone number. */
|
|
63
|
+
tryMobileValidation(code: String): Promise<IMobileValidationState>;
|
|
64
|
+
/** Start an MFA for the logged-in user, unless already pending or done. */
|
|
65
|
+
getMfaInfos(): Promise<IMfaInfos>;
|
|
66
|
+
/** Send a 6-digits code to the server to validate a pending MFA. */
|
|
67
|
+
tryMfaCode(code: String): Promise<IMfaCodeState>;
|
|
39
68
|
}
|
|
40
69
|
export declare type Hobby = {
|
|
41
70
|
visibility: "PRIVE" | "PUBLIC";
|
|
@@ -49,11 +78,12 @@ export declare type School = {
|
|
|
49
78
|
UAI: string;
|
|
50
79
|
exports: string[];
|
|
51
80
|
};
|
|
81
|
+
export declare type UserProfile = Array<"Student" | "Teacher" | "Relative" | "Personnel" | "Guest">;
|
|
52
82
|
export interface IUserDescription {
|
|
53
83
|
alertSize: boolean;
|
|
54
84
|
health: string;
|
|
55
85
|
hobbies: Array<Hobby>;
|
|
56
|
-
mood:
|
|
86
|
+
mood: "default" | "happy" | "proud" | "dreamy" | "love" | "tired" | "angry" | "worried" | "sick" | "joker" | "sad";
|
|
57
87
|
motto: string;
|
|
58
88
|
oldPicture?: string;
|
|
59
89
|
picture: string;
|
|
@@ -75,7 +105,7 @@ export interface IUserDescription {
|
|
|
75
105
|
relatedType?: any;
|
|
76
106
|
schools: Array<School>;
|
|
77
107
|
tel: string;
|
|
78
|
-
profiles:
|
|
108
|
+
profiles: UserProfile;
|
|
79
109
|
userId: string;
|
|
80
110
|
visibleInfos: Array<string>;
|
|
81
111
|
}
|
|
@@ -136,7 +166,7 @@ export declare const WIDGET_POSITION: {
|
|
|
136
166
|
readonly LEFT: "left";
|
|
137
167
|
readonly RIGHT: "right";
|
|
138
168
|
};
|
|
139
|
-
export declare type WidgetPosition = typeof WIDGET_POSITION[keyof typeof WIDGET_POSITION];
|
|
169
|
+
export declare type WidgetPosition = (typeof WIDGET_POSITION)[keyof typeof WIDGET_POSITION];
|
|
140
170
|
export interface IWidgetModel {
|
|
141
171
|
application?: string;
|
|
142
172
|
position?: WidgetPosition;
|
|
@@ -184,4 +214,51 @@ export interface IEmailValidationState {
|
|
|
184
214
|
/** (optional) Remaining number of times a validation code can be typed in. */
|
|
185
215
|
tries?: number;
|
|
186
216
|
}
|
|
187
|
-
|
|
217
|
+
export interface IMobileValidationInfos {
|
|
218
|
+
/** The current phone number of the user (maybe not verified) */
|
|
219
|
+
mobile: string;
|
|
220
|
+
/** State of the current phone number. */
|
|
221
|
+
mobileState: IMobileValidationState | null;
|
|
222
|
+
/** Suggested time to wait for the validation phone number to be sent (platform configuration) */
|
|
223
|
+
waitInSeconds: number;
|
|
224
|
+
}
|
|
225
|
+
export interface IMobileValidationState {
|
|
226
|
+
/** Validation state */
|
|
227
|
+
state: "unchecked" | "outdated" | "pending" | "valid";
|
|
228
|
+
/** Last known valid phone number, or empty string. */
|
|
229
|
+
valid: string;
|
|
230
|
+
/** (optional) Current pending (or outdated) phone number being checked. */
|
|
231
|
+
pending?: string;
|
|
232
|
+
/** (optional) Seconds remaining for the user to type in the correct validation code. */
|
|
233
|
+
ttl?: number;
|
|
234
|
+
/** (optional) Remaining number of times a validation code can be typed in. */
|
|
235
|
+
tries?: number;
|
|
236
|
+
}
|
|
237
|
+
export interface IMfaInfos {
|
|
238
|
+
/** The type of MFA used. */
|
|
239
|
+
type: "sms" | "email";
|
|
240
|
+
/** State of the generated MFA code. */
|
|
241
|
+
state: IMfaCodeState | null;
|
|
242
|
+
/** Suggested time to wait for the MFA code to be sent (platform configuration) */
|
|
243
|
+
waitInSeconds: number;
|
|
244
|
+
}
|
|
245
|
+
export interface IMfaCodeState {
|
|
246
|
+
/** Validation state */
|
|
247
|
+
state: "outdated" | "pending" | "valid";
|
|
248
|
+
/** (optional) Seconds remaining for the user to type in the correct code. */
|
|
249
|
+
ttl?: number;
|
|
250
|
+
/** (optional) Remaining number of times a code can be typed in. */
|
|
251
|
+
tries?: number;
|
|
252
|
+
}
|
|
253
|
+
export interface IGetSession {
|
|
254
|
+
user: IUserInfo | undefined;
|
|
255
|
+
currentLanguage: string | undefined;
|
|
256
|
+
quotaAndUsage: IQuotaAndUsage;
|
|
257
|
+
userDescription: IUserDescription;
|
|
258
|
+
userProfile?: UserProfile;
|
|
259
|
+
bookmarkedApps: IWebApp[];
|
|
260
|
+
}
|
|
261
|
+
export declare type PersonApiResult = {
|
|
262
|
+
status: "ok" | string;
|
|
263
|
+
result: Array<IUserDescription>;
|
|
264
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OdeServices } from "../services/OdeServices";
|
|
2
|
+
import { GetResourceRightPayload, ShareMapping, ShareRightWithVisibles, PutShareResponse, ShareSubject, ShareRight, ShareRightAction, ShareRightActionDisplayName } from "./interface";
|
|
3
|
+
export declare class ShareService {
|
|
4
|
+
protected context: OdeServices;
|
|
5
|
+
constructor(context: OdeServices);
|
|
6
|
+
get directory(): import("../directory/Service").DirectoryService;
|
|
7
|
+
get http(): import("../transport/Service").HttpService;
|
|
8
|
+
get cache(): import("../cache/Service").CacheService;
|
|
9
|
+
searchShareSubjects(app: string, resourceId: string, searchText: string): Promise<ShareSubject[]>;
|
|
10
|
+
getShareMapping(app: string): Promise<ShareMapping>;
|
|
11
|
+
getActionsAvailableFor({ id, type }: {
|
|
12
|
+
id: string;
|
|
13
|
+
type: "user" | "group";
|
|
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[]>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Group, Bookmark, User } from "../directory/interface";
|
|
2
|
+
export interface ShareRight {
|
|
3
|
+
id: string;
|
|
4
|
+
type: ShareRightType;
|
|
5
|
+
displayName: string;
|
|
6
|
+
profile?: string;
|
|
7
|
+
avatarUrl: string;
|
|
8
|
+
directoryUrl: string;
|
|
9
|
+
actions: ShareRightAction[];
|
|
10
|
+
isBookmarkMember?: boolean;
|
|
11
|
+
users?: User[];
|
|
12
|
+
groups?: Group[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Type of share right
|
|
16
|
+
* */
|
|
17
|
+
export declare type ShareRightType = "user" | "group" | "sharebookmark";
|
|
18
|
+
/**
|
|
19
|
+
* Type of action when sharing
|
|
20
|
+
* */
|
|
21
|
+
export interface ShareRightAction {
|
|
22
|
+
id: ShareRightActionDisplayName;
|
|
23
|
+
displayName: ShareRightActionDisplayName;
|
|
24
|
+
priority?: number;
|
|
25
|
+
requires?: ShareRightActionDisplayName[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Name of current action when sharing
|
|
29
|
+
* */
|
|
30
|
+
export declare type ShareRightActionDisplayName = "read" | "contrib" | "manage" | "publish" | "manager" | "comment";
|
|
31
|
+
export declare type ShareRightActionDisplayNameExt = ShareRightActionDisplayName | "creator";
|
|
32
|
+
export declare type SharingRight = Record<ShareRightActionDisplayName, {
|
|
33
|
+
priority: number;
|
|
34
|
+
default: boolean;
|
|
35
|
+
requires: ShareRightActionDisplayName[];
|
|
36
|
+
}>;
|
|
37
|
+
export declare type ShareMapping = Record<ShareRightActionDisplayName, string[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Payload of shared resource
|
|
40
|
+
* */
|
|
41
|
+
export interface GetResourceRightPayload {
|
|
42
|
+
actions: Array<{
|
|
43
|
+
name: string[];
|
|
44
|
+
displayName: string;
|
|
45
|
+
type: "RESOURCE";
|
|
46
|
+
}>;
|
|
47
|
+
groups: {
|
|
48
|
+
visibles: Array<{
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
groupDisplayName: string;
|
|
52
|
+
structureName: string;
|
|
53
|
+
}>;
|
|
54
|
+
checked: Record<string, string[]>;
|
|
55
|
+
};
|
|
56
|
+
users: {
|
|
57
|
+
visibles: Array<{
|
|
58
|
+
id: string;
|
|
59
|
+
login: string;
|
|
60
|
+
username: string;
|
|
61
|
+
lastName: string;
|
|
62
|
+
firstName: string;
|
|
63
|
+
profile: string;
|
|
64
|
+
}>;
|
|
65
|
+
checked: Record<string, string[]>;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Update payload of shared resource
|
|
70
|
+
* */
|
|
71
|
+
export interface PutSharePayload {
|
|
72
|
+
users: Record<string, string[]>;
|
|
73
|
+
groups: Record<string, string[]>;
|
|
74
|
+
bookmarks: Record<string, string[]>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Response of shared resource
|
|
78
|
+
* */
|
|
79
|
+
export interface PutShareResponse {
|
|
80
|
+
"notify-timeline-array": Array<{
|
|
81
|
+
groupId: string;
|
|
82
|
+
} | {
|
|
83
|
+
userId: string;
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
export interface ShareSubject {
|
|
87
|
+
id: string;
|
|
88
|
+
displayName: string;
|
|
89
|
+
profile?: string;
|
|
90
|
+
avatarUrl: string;
|
|
91
|
+
directoryUrl: string;
|
|
92
|
+
type: "user" | "group" | "sharebookmark";
|
|
93
|
+
}
|
|
94
|
+
export interface ShareRightWithVisibles {
|
|
95
|
+
rights: ShareRight[];
|
|
96
|
+
visibleUsers: User[];
|
|
97
|
+
visibleGroups: Group[];
|
|
98
|
+
visibleBookmarks: Bookmark[];
|
|
99
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IHttpResponse, IHttpParams } from "./interfaces";
|
|
2
|
+
import { OdeServices } from "../services/OdeServices";
|
|
3
|
+
export declare class HttpService {
|
|
4
|
+
private context;
|
|
5
|
+
private axios;
|
|
6
|
+
private _latestResponse;
|
|
7
|
+
constructor(context: OdeServices, params?: any);
|
|
8
|
+
setCdn(cdnUrl: string): void;
|
|
9
|
+
private toAxiosConfig;
|
|
10
|
+
private toCdnUrl;
|
|
11
|
+
private mapAxiosError;
|
|
12
|
+
private mapAxiosResponse;
|
|
13
|
+
get latestResponse(): IHttpResponse;
|
|
14
|
+
get<R = any>(url: string, params?: IHttpParams): Promise<R>;
|
|
15
|
+
post<R = any>(url: string, data?: any, params?: IHttpParams): Promise<R>;
|
|
16
|
+
postFile<R = any>(url: string, data: any, params?: IHttpParams): Promise<R>;
|
|
17
|
+
postJson<R = any>(url: string, json: any, params?: IHttpParams): Promise<R>;
|
|
18
|
+
put<R = any>(url: string, data?: any, params?: IHttpParams): Promise<R>;
|
|
19
|
+
putFile<R = any>(url: string, data: FormData, params?: IHttpParams): Promise<any>;
|
|
20
|
+
putJson<R = any>(url: string, json: any, params?: IHttpParams): Promise<R>;
|
|
21
|
+
delete<R = any>(url: string, params?: IHttpParams): Promise<R>;
|
|
22
|
+
deleteJson<R = any>(url: string, json: any): Promise<R>;
|
|
23
|
+
getScript<R = any>(url: string, params?: IHttpParams, variableName?: string): Promise<R>;
|
|
24
|
+
loadScript(url: string, params?: IHttpParams): Promise<void>;
|
|
25
|
+
}
|
|
@@ -44,6 +44,7 @@ export interface IHttp {
|
|
|
44
44
|
loadScript(url: string, params?: IHttpParams): Promise<void>;
|
|
45
45
|
setCdn(url: string): void;
|
|
46
46
|
}
|
|
47
|
+
export declare type IHttpParamsResponseType = "arraybuffer" | "blob" | "document" | "json" | "text" | "stream";
|
|
47
48
|
export declare type IHttpParams = {
|
|
48
49
|
/** Request the API to send a notification when done. */
|
|
49
50
|
readonly requestName?: string;
|
|
@@ -57,10 +58,11 @@ export declare type IHttpParams = {
|
|
|
57
58
|
readonly queryParams?: {
|
|
58
59
|
[key: string]: any;
|
|
59
60
|
};
|
|
61
|
+
/** Response Type */
|
|
62
|
+
readonly responseType?: IHttpParamsResponseType;
|
|
60
63
|
};
|
|
61
64
|
export declare type IHttpResponse = {
|
|
62
65
|
status: number;
|
|
63
66
|
statusText: string;
|
|
64
67
|
headers?: any;
|
|
65
68
|
};
|
|
66
|
-
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare class FileTypeUtils {
|
|
2
|
+
private static fileTypes;
|
|
3
|
+
static registerContentTypeToFileType(mapper: ContentTypeToFileType): void;
|
|
4
|
+
static getFileType(fileType: string, previewRole?: boolean, extension?: string): string;
|
|
5
|
+
}
|
|
6
|
+
export declare type ContentTypeToFileType = (contentType: string, previewRole: boolean) => string | undefined;
|