jamespot-user-api 1.0.43 → 1.0.44
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/documentation/classes/JApplication.html +1 -1
- package/documentation/classes/JApplicationApi.html +8 -8
- package/documentation/classes/JArticleApi.html +1 -1
- package/documentation/classes/JAudienceApi.html +1 -1
- package/documentation/classes/JBaseApi.html +1 -1
- package/documentation/classes/JBaseObject.html +1 -1
- package/documentation/classes/JBookmark.html +1 -1
- package/documentation/classes/JBookmarkApi.html +1 -1
- package/documentation/classes/JCommunityApi.html +1 -1
- package/documentation/classes/JConcept.html +1 -1
- package/documentation/classes/JConceptApi.html +1 -1
- package/documentation/classes/JDiapazoneApi.html +1 -1
- package/documentation/classes/JFileApi.html +1 -1
- package/documentation/classes/JFilebankApi.html +1 -1
- package/documentation/classes/JGroupApi.html +1 -1
- package/documentation/classes/JLandApi.html +1 -1
- package/documentation/classes/JMessengerApi.html +1 -1
- package/documentation/classes/JSearchApi.html +6 -6
- package/documentation/classes/JUser.html +1 -1
- package/documentation/classes/JUserApi.html +3 -3
- package/documentation/classes/JWedocApi.html +1 -1
- package/documentation/classes/JamespotUserApi.html +1 -1
- package/documentation/classes/Network.html +1 -1
- package/documentation/enums/JApplicationStatus.html +1 -1
- package/documentation/interfaces/ApiError.html +1 -1
- package/documentation/interfaces/ApiWrapper.html +1 -1
- package/documentation/interfaces/AseiGroups.html +1 -1
- package/documentation/interfaces/AseiInstitution.html +1 -1
- package/documentation/interfaces/AseiRights.html +1 -1
- package/documentation/interfaces/AseiTicket.html +1 -1
- package/documentation/interfaces/BaseAutocomplete.html +1 -1
- package/documentation/interfaces/BaseMessage.html +1 -1
- package/documentation/interfaces/Category.html +1 -1
- package/documentation/interfaces/CreateGroup.html +1 -1
- package/documentation/interfaces/FileBankProps.html +1 -1
- package/documentation/interfaces/FileOption.html +1 -1
- package/documentation/interfaces/FolderProps.html +1 -1
- package/documentation/interfaces/ListFilterSpec.html +1 -1
- package/documentation/interfaces/OF.html +1 -1
- package/documentation/interfaces/PagingResults.html +1 -1
- package/documentation/interfaces/Result.html +1 -1
- package/documentation/interfaces/RootFolderProps.html +1 -1
- package/documentation/interfaces/SearchCategoryModel.html +1 -1
- package/documentation/interfaces/SearchConfig.html +1 -1
- package/documentation/interfaces/SearchFacetModel.html +1 -1
- package/documentation/interfaces/SearchFacetValueModel.html +1 -1
- package/documentation/interfaces/SearchQuery.html +1 -1
- package/documentation/interfaces/SearchQueryFilterModel.html +1 -1
- package/documentation/interfaces/SearchQueryOption.html +1 -1
- package/documentation/interfaces/SearchQueryResult.html +1 -1
- package/documentation/interfaces/SearchQuerySortModel.html +1 -1
- package/documentation/interfaces/SearchResultCatProps.html +1 -1
- package/documentation/interfaces/SearchResultProps.html +1 -1
- package/documentation/interfaces/SpotProps.html +1 -1
- package/documentation/interfaces/Taxonomy.html +1 -1
- package/documentation/interfaces/TaxonomyCreate.html +1 -1
- package/documentation/interfaces/TmpApplication.html +1 -1
- package/documentation/interfaces/TmpUser.html +1 -1
- package/documentation/interfaces/UserModel.html +1 -1
- package/documentation/modules.html +1 -1
- package/package.json +1 -1
- package/src/apis/application.ts +0 -132
- package/src/apis/article.ts +0 -74
- package/src/apis/asei.ts +0 -73
- package/src/apis/audience.ts +0 -18
- package/src/apis/base.ts +0 -9
- package/src/apis/bookmark.ts +0 -110
- package/src/apis/community.ts +0 -20
- package/src/apis/concept.ts +0 -31
- package/src/apis/diapazone.ts +0 -65
- package/src/apis/file.ts +0 -14
- package/src/apis/filebank.ts +0 -50
- package/src/apis/group.ts +0 -48
- package/src/apis/index.ts +0 -17
- package/src/apis/jamespotUserApi.ts +0 -69
- package/src/apis/jland.ts +0 -51
- package/src/apis/messenger.ts +0 -25
- package/src/apis/search.ts +0 -85
- package/src/apis/taxonomy.ts +0 -30
- package/src/apis/user.ts +0 -53
- package/src/apis/wedoc.ts +0 -77
- package/src/classes/JApplication.ts +0 -55
- package/src/classes/JBaseObject.ts +0 -64
- package/src/classes/JBookmark.ts +0 -44
- package/src/classes/JConcept.ts +0 -3
- package/src/classes/JDiapazone.ts +0 -42
- package/src/classes/JFile.ts +0 -37
- package/src/classes/JUser.ts +0 -7
- package/src/classes/index.ts +0 -5
- package/src/index.ts +0 -21
- package/src/indexMock.ts +0 -17
- package/src/mock/data/autocomplete/audience/data.json +0 -191
- package/src/mock/data/autocomplete/community/data.json +0 -47
- package/src/mock/data/autocomplete/taxonomy/data.json +0 -35
- package/src/mock/data/autocomplete/user/data.json +0 -107
- package/src/mock/data/bookmarks/addBookmark/data.json +0 -54
- package/src/mock/data/bookmarks/addLink/data.json +0 -63
- package/src/mock/data/bookmarks/bookmarkList/data.json +0 -271
- package/src/mock/data/bookmarks/delete/data.json +0 -12
- package/src/mock/data/community/sendRequest/data.json +0 -12
- package/src/mock/data/file/create/data.json +0 -18
- package/src/mock/data/messenger/newMessage/data.json +0 -47
- package/src/mock/data/misc/tokenCSRF/data.json +0 -7
- package/src/mock/data/search/getConfig/data.json +0 -318
- package/src/mock/data/search/lastQueries/data.json +0 -7
- package/src/mock/data/search/proposition/data.json +0 -125
- package/src/mock/data/spot/create/data.json +0 -7
- package/src/mock/data/spot/get-available-widget/data.json +0 -56
- package/src/mock/data/spot/get-categories/data.json +0 -28
- package/src/mock/data/user/signIn/data.json +0 -197
- package/src/mock/windowMock.ts +0 -113
- package/src/types/asei.ts +0 -33
- package/src/types/autocomplete.ts +0 -17
- package/src/types/group.ts +0 -27
- package/src/types/index.ts +0 -7
- package/src/types/listWrapper.ts +0 -6
- package/src/types/search.ts +0 -105
- package/src/types/taxonomy.ts +0 -47
- package/src/types/user.ts +0 -14
- package/src/types/utils.ts +0 -66
- package/src/util/network.ts +0 -96
package/src/apis/search.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { ApiWrapper, SearchConfig, SearchQuery, SearchQueryResult, SearchResultCatProps } from '../types';
|
|
2
|
-
import { JBaseApi } from './base';
|
|
3
|
-
import { OF } from '../util/network';
|
|
4
|
-
|
|
5
|
-
export class JSearchApi extends JBaseApi {
|
|
6
|
-
/**
|
|
7
|
-
* return a completed version of the current config, taking in account platform installed modules
|
|
8
|
-
*/
|
|
9
|
-
public getConfig(): Promise<ApiWrapper<SearchConfig>> {
|
|
10
|
-
return this.network.post({ o: 'search', f: 'getConfig' });
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Return a maximum of 8 results for a given text query, classed upon config categories
|
|
15
|
-
* @param query string, words can be preceded by + and - for inclusive/exclusive search
|
|
16
|
-
* @param signal: @AbortSignal to cancel the fetch
|
|
17
|
-
*/
|
|
18
|
-
public proposition(
|
|
19
|
-
{ query, format }: { query: string; format?: 'list' | 'little' },
|
|
20
|
-
signal?: AbortSignal,
|
|
21
|
-
): Promise<ApiWrapper<SearchResultCatProps[]>> {
|
|
22
|
-
return this.network.post({ o: 'search', f: 'proposition', query, format: format || 'little' } as OF, signal);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Return a page of results based on a text query and various filters.
|
|
27
|
-
* All parameters are optional
|
|
28
|
-
* @param query
|
|
29
|
-
* @param query.keywords string, words can be preceded by + and - for inclusive/exclusive search (default *:*)
|
|
30
|
-
* @param query.category text id of a category from config,if specified: restrict results to these category
|
|
31
|
-
* @param query.facetCategories boolean, if true: count by categories are returned
|
|
32
|
-
* @param query.filters array of @SearchQueryFilterModel @SearchQueryFilterModel.
|
|
33
|
-
* @param query.page integer. default 1. index of returned page (start by 1)
|
|
34
|
-
* @param query.limit integer. default 20. number of result by page
|
|
35
|
-
* @param query.sort @SearchQuerySortModel default score then date
|
|
36
|
-
* @param query.options @SearchQueryOption. extra possible options for the search
|
|
37
|
-
* @param signal: @AbortSignal to cancel the fetch
|
|
38
|
-
|
|
39
|
-
* // Todo add query.facets (to be specified first)
|
|
40
|
-
*/
|
|
41
|
-
public searchQuery(query: SearchQuery, signal?: AbortSignal): Promise<ApiWrapper<SearchQueryResult>> {
|
|
42
|
-
const { keywords, category, facetCategories, filters, page, limit, sort, options } = query;
|
|
43
|
-
return this.network.post(
|
|
44
|
-
{
|
|
45
|
-
o: 'search',
|
|
46
|
-
f: 'query',
|
|
47
|
-
keywords,
|
|
48
|
-
category,
|
|
49
|
-
facetCategories,
|
|
50
|
-
filters,
|
|
51
|
-
page,
|
|
52
|
-
limit,
|
|
53
|
-
sort,
|
|
54
|
-
options,
|
|
55
|
-
} as OF,
|
|
56
|
-
signal,
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* return the five last keywords typed in the searchbar by the user
|
|
62
|
-
*/
|
|
63
|
-
public getLastQueries(): Promise<ApiWrapper<string[]>> {
|
|
64
|
-
return this.network.post({ o: 'search', f: 'getLastQueries' });
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* return the current platform json search-config object
|
|
69
|
-
*/
|
|
70
|
-
// FIXME when doing the search admin
|
|
71
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
72
|
-
public getAdminConfig(): Promise<any> {
|
|
73
|
-
return this.network.post({ o: 'search', f: 'getAdminConfig' });
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* set the platform search-config to the given json object
|
|
78
|
-
* @param config object. json search config
|
|
79
|
-
*/
|
|
80
|
-
// FIXME when doing the search admin
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
82
|
-
public setAdminConfig(config: any): Promise<any> {
|
|
83
|
-
return this.network.post({ o: 'search', f: 'setAdminConfig', config } as OF);
|
|
84
|
-
}
|
|
85
|
-
}
|
package/src/apis/taxonomy.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { JBaseApi } from './base';
|
|
2
|
-
import { OF } from '../util/network';
|
|
3
|
-
import { ApiWrapper, BaseMessagesOne, Taxonomy, TaxonomyCreate } from '../types';
|
|
4
|
-
|
|
5
|
-
export class JTaxonomyApi extends JBaseApi {
|
|
6
|
-
/**
|
|
7
|
-
* list all taxonomies (no pagination)
|
|
8
|
-
*/
|
|
9
|
-
public list(): Promise<Taxonomy[]> {
|
|
10
|
-
return this.network
|
|
11
|
-
.post<Taxonomy[]>({
|
|
12
|
-
o: 'taxonomy',
|
|
13
|
-
f: 'list',
|
|
14
|
-
} as OF)
|
|
15
|
-
.then((res) => {
|
|
16
|
-
if (Array.isArray(res.result)) {
|
|
17
|
-
return res.result;
|
|
18
|
-
}
|
|
19
|
-
throw 'Bad response from backend';
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public create(taxonomy: TaxonomyCreate): Promise<ApiWrapper<Taxonomy, BaseMessagesOne>> {
|
|
24
|
-
return this.network.post<Taxonomy, BaseMessagesOne>({
|
|
25
|
-
o: 'taxonomy',
|
|
26
|
-
f: 'create',
|
|
27
|
-
...taxonomy,
|
|
28
|
-
} as OF);
|
|
29
|
-
}
|
|
30
|
-
}
|
package/src/apis/user.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { JBaseApi } from './base';
|
|
2
|
-
import { JUser } from '../classes';
|
|
3
|
-
import { OF } from '../util/network';
|
|
4
|
-
import { ApiWrapper, Little } from '../types';
|
|
5
|
-
|
|
6
|
-
export interface TmpUser {
|
|
7
|
-
idUser: string;
|
|
8
|
-
type: string;
|
|
9
|
-
id: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class JUserApi extends JBaseApi {
|
|
13
|
-
/**
|
|
14
|
-
* autocomplete return a list or JUser
|
|
15
|
-
* @param query <string>
|
|
16
|
-
*/
|
|
17
|
-
public autocomplete(query: string): Promise<Array<JUser>> {
|
|
18
|
-
return this.network
|
|
19
|
-
.post<Array<TmpUser>>({ o: 'autocomplete', f: 'user', q: query, idToUri: false } as OF)
|
|
20
|
-
.then((res) => {
|
|
21
|
-
if (Array.isArray(res.result)) {
|
|
22
|
-
return res.result.map((user) => {
|
|
23
|
-
const jUser = new JUser(user.idUser, user.type);
|
|
24
|
-
jUser.hydrate(user);
|
|
25
|
-
return jUser;
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
throw 'Bad response from backend';
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Get a user
|
|
34
|
-
* @param uri uri
|
|
35
|
-
* @param format little by default. If another format is provided, the generic types should be defined
|
|
36
|
-
*/
|
|
37
|
-
public get<T extends Little = Little>(uri: string, format = 'little'): Promise<ApiWrapper<T>> {
|
|
38
|
-
return this.network.post<T>({ o: 'user', f: 'get', uri, format } as OF);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* signIn function returns a Promise of JUser.
|
|
43
|
-
* @param mail Mail or username
|
|
44
|
-
* @param pwd Password to be validated
|
|
45
|
-
*/
|
|
46
|
-
public signIn(mail: string, pwd: string): Promise<JUser> {
|
|
47
|
-
return this.network.post<TmpUser>({ o: 'user', f: 'signIn', mail, password: pwd } as OF).then((res) => {
|
|
48
|
-
const jUser = new JUser(res.result.id, res.result.type);
|
|
49
|
-
jUser.hydrate(res.result);
|
|
50
|
-
return jUser;
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
package/src/apis/wedoc.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { ApiWrapper } from '../types';
|
|
2
|
-
import { JBaseApi } from './base';
|
|
3
|
-
import { OF } from '../util/network';
|
|
4
|
-
import { ListWrapper } from '../types/listWrapper';
|
|
5
|
-
import { jFile } from '../classes/JFile';
|
|
6
|
-
|
|
7
|
-
type File = Record<string, object>;
|
|
8
|
-
|
|
9
|
-
type FiletList = {
|
|
10
|
-
page: number;
|
|
11
|
-
cnt: number;
|
|
12
|
-
limit: number;
|
|
13
|
-
data: File[];
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
import { Orders, Filters } from '../types';
|
|
17
|
-
|
|
18
|
-
export class JWedocApi extends JBaseApi {
|
|
19
|
-
public getFiles(
|
|
20
|
-
page: number,
|
|
21
|
-
query: string,
|
|
22
|
-
filters: Filters,
|
|
23
|
-
orders: Orders,
|
|
24
|
-
limit: number,
|
|
25
|
-
): Promise<ListWrapper<jFile>> {
|
|
26
|
-
return this.network
|
|
27
|
-
.post<FiletList>({ o: 'onlyOffice', f: 'getFiles', page, query, filters, orders, limit } as OF)
|
|
28
|
-
.then((res) => {
|
|
29
|
-
const result = res.result;
|
|
30
|
-
if (Array.isArray(result.data)) {
|
|
31
|
-
const data: jFile[] = result.data.map((entry) => jFile.createFromObject(entry));
|
|
32
|
-
return { page: result.page, cnt: result.cnt, limit: result.limit, data };
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
throw {
|
|
36
|
-
error: res.error,
|
|
37
|
-
messages: res.messages,
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public getTemplates(): Promise<ApiWrapper<boolean, { code: number; msg: string }>> {
|
|
43
|
-
return this.network.post({ o: 'onlyOffice', f: 'getTemplates' } as OF);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public duplicateFile(
|
|
47
|
-
idFile: number,
|
|
48
|
-
title: string,
|
|
49
|
-
publishTo: Array<any>,
|
|
50
|
-
): Promise<ApiWrapper<boolean, { code: number; msg: string }>> {
|
|
51
|
-
return this.network.post({ o: 'onlyOffice', f: 'duplicateFile', idFile, title, publishTo } as OF);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public deleteFile(idFile: number): Promise<ApiWrapper<boolean, { code: number; msg: string }>> {
|
|
55
|
-
return this.network.post({ o: 'onlyOffice', f: 'deleteFile', idFile } as OF);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public createFile(
|
|
59
|
-
title: string,
|
|
60
|
-
type: string,
|
|
61
|
-
publishTo: Array<any>,
|
|
62
|
-
): Promise<ApiWrapper<boolean, { code: number; msg: string }>> {
|
|
63
|
-
return this.network.post({ o: 'onlyOffice', f: 'createFile', title, type, publishTo } as OF);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
public updateFile(
|
|
67
|
-
idFile: number,
|
|
68
|
-
title: string,
|
|
69
|
-
publishTo: Array<string>,
|
|
70
|
-
): Promise<ApiWrapper<boolean, { code: number; msg: string }>> {
|
|
71
|
-
return this.network.post({ o: 'onlyOffice', f: 'updateFile', idFile, title, publishTo } as OF);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public getFileInfo(idFile: number, mode: string): Promise<ApiWrapper<boolean, { code: number; msg: string }>> {
|
|
75
|
-
return this.network.post({ o: 'onlyOffice', f: 'GetFileInfo', idFile, mode } as OF);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/* FIXME when working on studio typing */
|
|
3
|
-
|
|
4
|
-
import { JBaseObject } from './JBaseObject';
|
|
5
|
-
|
|
6
|
-
export enum JApplicationStatus {
|
|
7
|
-
local = 'local',
|
|
8
|
-
installed = 'installed',
|
|
9
|
-
autosaved = 'autosaved',
|
|
10
|
-
saved = 'saved',
|
|
11
|
-
}
|
|
12
|
-
export class JApplication extends JBaseObject {
|
|
13
|
-
private status?: JApplicationStatus;
|
|
14
|
-
|
|
15
|
-
public constructor(id?: string, type?: string, status?: JApplicationStatus) {
|
|
16
|
-
super(id, type);
|
|
17
|
-
if (status) {
|
|
18
|
-
this.setStatus(status);
|
|
19
|
-
} else {
|
|
20
|
-
this.setStatus(JApplicationStatus.local);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public get(prop: string): any {
|
|
25
|
-
if (prop === 'status') {
|
|
26
|
-
return this.getStatus();
|
|
27
|
-
}
|
|
28
|
-
return super.get(prop);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public set(prop: string, val: any): void {
|
|
32
|
-
if (prop === 'status') {
|
|
33
|
-
return this.setStatus(val);
|
|
34
|
-
}
|
|
35
|
-
return super.set(prop, val);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public setStatus(status: JApplicationStatus): void {
|
|
39
|
-
this.status = status;
|
|
40
|
-
}
|
|
41
|
-
public getStatus(): JApplicationStatus | undefined {
|
|
42
|
-
return this.status;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public updateUsing(newerJApplication: JApplication): JApplication {
|
|
46
|
-
if (this.getId() === newerJApplication.getId() && this.getType() === newerJApplication.getType()) {
|
|
47
|
-
Object.keys(newerJApplication.record).forEach((key: string) => {
|
|
48
|
-
this.set(key, newerJApplication.get(key));
|
|
49
|
-
});
|
|
50
|
-
} else {
|
|
51
|
-
throw new Error('Incompatible update');
|
|
52
|
-
}
|
|
53
|
-
return this;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/* FIXME when working on studio typing */
|
|
3
|
-
|
|
4
|
-
/** Base class to represent objects retreived from or sent to the backend.
|
|
5
|
-
* This JBaseObject is then derived to provide a more understandable result for each API.
|
|
6
|
-
*/
|
|
7
|
-
export class JBaseObject {
|
|
8
|
-
protected type?: string;
|
|
9
|
-
protected id?: string;
|
|
10
|
-
protected record: Record<string, any> = {};
|
|
11
|
-
|
|
12
|
-
public constructor(id?: string, type?: string) {
|
|
13
|
-
if (id) {
|
|
14
|
-
this.set('id', id);
|
|
15
|
-
}
|
|
16
|
-
if (type) {
|
|
17
|
-
this.set('type', type);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public hydrate(data: any = {}): void {
|
|
22
|
-
Object.keys(data).forEach((key) => {
|
|
23
|
-
this.set(key, data[key]);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public getType(): string | undefined {
|
|
28
|
-
return this.type;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public getId(): string | undefined {
|
|
32
|
-
return this.id;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public getUri(): string {
|
|
36
|
-
return `${this.getType()}/${this.getId()}`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
public get(prop: string): any {
|
|
40
|
-
switch (prop) {
|
|
41
|
-
case 'type':
|
|
42
|
-
return this.getType();
|
|
43
|
-
case 'id':
|
|
44
|
-
return this.getId();
|
|
45
|
-
case 'uri':
|
|
46
|
-
return this.getUri();
|
|
47
|
-
default:
|
|
48
|
-
return this.record[prop];
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
public set(prop: string, val: any): void {
|
|
53
|
-
switch (prop) {
|
|
54
|
-
case 'type':
|
|
55
|
-
this.type = val;
|
|
56
|
-
break;
|
|
57
|
-
case 'id':
|
|
58
|
-
this.id = val;
|
|
59
|
-
break;
|
|
60
|
-
default:
|
|
61
|
-
this.record[prop] = val;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
package/src/classes/JBookmark.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export class JBookmark {
|
|
2
|
-
public id?: number;
|
|
3
|
-
public type?: string;
|
|
4
|
-
public targetId?: number;
|
|
5
|
-
public targetType?: string;
|
|
6
|
-
public bookmarkUrl?: string;
|
|
7
|
-
public bookmarkOrder?: number;
|
|
8
|
-
public bookmarkLabel?: string;
|
|
9
|
-
public bookmarkMeta?: string;
|
|
10
|
-
public _cssClass?: string;
|
|
11
|
-
public _cssColor?: string;
|
|
12
|
-
public _values?: Record<string, string>;
|
|
13
|
-
public url?: string;
|
|
14
|
-
|
|
15
|
-
private static fields: string[] = [
|
|
16
|
-
'id',
|
|
17
|
-
'type',
|
|
18
|
-
'targetId',
|
|
19
|
-
'targetType',
|
|
20
|
-
'bookmarkUrl',
|
|
21
|
-
'bookmarkOrder',
|
|
22
|
-
'bookmarkLabel',
|
|
23
|
-
'bookmarkMeta',
|
|
24
|
-
'_cssClass',
|
|
25
|
-
'_cssColor',
|
|
26
|
-
'_values',
|
|
27
|
-
'url',
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
public static createFromObject(o: Record<string, object>): JBookmark {
|
|
31
|
-
const toRet = new JBookmark();
|
|
32
|
-
const copy: Record<string, object> = {};
|
|
33
|
-
// Clean unknown elements
|
|
34
|
-
JBookmark.fields.forEach((p) => {
|
|
35
|
-
if (o[p] !== undefined) {
|
|
36
|
-
copy[p] = o[p];
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
Object.assign(toRet, copy);
|
|
41
|
-
|
|
42
|
-
return toRet;
|
|
43
|
-
}
|
|
44
|
-
}
|
package/src/classes/JConcept.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export class JDiapazone {
|
|
2
|
-
public id!: number;
|
|
3
|
-
public title!: string;
|
|
4
|
-
public type!: string;
|
|
5
|
-
public _user?: Record<string, string>;
|
|
6
|
-
public _audience?: Record<string, string>;
|
|
7
|
-
public _audienceLeft?: number;
|
|
8
|
-
public _right?: Record<string, string>;
|
|
9
|
-
public _cssClass?: string;
|
|
10
|
-
public _cssColor?: string;
|
|
11
|
-
public _values?: Record<string, string>;
|
|
12
|
-
public _extend?: Record<string, string>;
|
|
13
|
-
public _url?: string;
|
|
14
|
-
|
|
15
|
-
private static fields: string[] = [
|
|
16
|
-
'id',
|
|
17
|
-
'title',
|
|
18
|
-
'type',
|
|
19
|
-
'_user',
|
|
20
|
-
'_audience',
|
|
21
|
-
'_audienceLeft',
|
|
22
|
-
'_right',
|
|
23
|
-
'_cssClass',
|
|
24
|
-
'_cssColor',
|
|
25
|
-
'_values',
|
|
26
|
-
'_extend',
|
|
27
|
-
'_url',
|
|
28
|
-
];
|
|
29
|
-
public static createFromObject(o: Record<string, object>): JDiapazone {
|
|
30
|
-
const toRet = new JDiapazone();
|
|
31
|
-
const copy: Record<string, object> = {};
|
|
32
|
-
// Clean unknown elements
|
|
33
|
-
JDiapazone.fields.forEach((p) => {
|
|
34
|
-
if (o[p] !== undefined) {
|
|
35
|
-
copy[p] = o[p];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
Object.assign(toRet, copy);
|
|
39
|
-
|
|
40
|
-
return toRet;
|
|
41
|
-
}
|
|
42
|
-
}
|
package/src/classes/JFile.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export class jFile {
|
|
2
|
-
public id!: number;
|
|
3
|
-
public title!: string;
|
|
4
|
-
public type!: string;
|
|
5
|
-
public dateCreation!: string;
|
|
6
|
-
public mimetype!: string;
|
|
7
|
-
public _extend: any;
|
|
8
|
-
public _user: any;
|
|
9
|
-
public _right: any;
|
|
10
|
-
public _audience: any;
|
|
11
|
-
|
|
12
|
-
private static fields: string[] = [
|
|
13
|
-
'id',
|
|
14
|
-
'title',
|
|
15
|
-
'type',
|
|
16
|
-
'dateCreation',
|
|
17
|
-
'dateModified',
|
|
18
|
-
'mimetype',
|
|
19
|
-
'_extend',
|
|
20
|
-
'_user',
|
|
21
|
-
'_right',
|
|
22
|
-
'_audience',
|
|
23
|
-
];
|
|
24
|
-
public static createFromObject(o: Record<string, object>): jFile {
|
|
25
|
-
const toRet = new jFile();
|
|
26
|
-
const copy: Record<string, object> = {};
|
|
27
|
-
// Clean unknown elements
|
|
28
|
-
jFile.fields.forEach((p) => {
|
|
29
|
-
if (o[p] !== undefined) {
|
|
30
|
-
copy[p] = o[p];
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
Object.assign(toRet, copy);
|
|
34
|
-
|
|
35
|
-
return toRet;
|
|
36
|
-
}
|
|
37
|
-
}
|
package/src/classes/JUser.ts
DELETED
package/src/classes/index.ts
DELETED
package/src/index.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { JamespotUserApi } from './apis/jamespotUserApi';
|
|
2
|
-
import { Network } from './util/network';
|
|
3
|
-
|
|
4
|
-
const network = new Network(window);
|
|
5
|
-
const JamespotUserApiInstance = new JamespotUserApi(network);
|
|
6
|
-
|
|
7
|
-
declare global {
|
|
8
|
-
interface Window {
|
|
9
|
-
JamespotUserApi: JamespotUserApi;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
window.JamespotUserApi = JamespotUserApiInstance;
|
|
14
|
-
|
|
15
|
-
export { JamespotUserApiInstance };
|
|
16
|
-
export default JamespotUserApiInstance;
|
|
17
|
-
|
|
18
|
-
export * from './apis';
|
|
19
|
-
export * from './types';
|
|
20
|
-
export * from './classes';
|
|
21
|
-
export * from './util/network';
|
package/src/indexMock.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { JamespotUserApi } from './apis';
|
|
2
|
-
import { Network } from './util/network';
|
|
3
|
-
import { WindowMock } from './mock/windowMock';
|
|
4
|
-
|
|
5
|
-
const network = new Network(new WindowMock() as unknown as Window);
|
|
6
|
-
const JamespotUserApiInstance = new JamespotUserApi(network);
|
|
7
|
-
|
|
8
|
-
declare global {
|
|
9
|
-
interface Window {
|
|
10
|
-
JamespotUserApi: JamespotUserApi;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
window.JamespotUserApi = JamespotUserApiInstance;
|
|
15
|
-
|
|
16
|
-
export { JamespotUserApiInstance };
|
|
17
|
-
export default JamespotUserApiInstance;
|