jamespot-user-api 1.0.117 → 1.0.119
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/assets/search.js +1 -1
- package/documentation/classes/AdminLicenseApi.html +11 -11
- package/documentation/classes/AdminStoreApi.html +1 -1
- package/documentation/classes/AdminUtilsApi.html +1 -1
- package/documentation/classes/JApplicationApi.html +8 -8
- package/documentation/classes/JArticleApi.html +1 -1
- package/documentation/classes/JAssetReservation.html +1 -1
- package/documentation/classes/JAudienceApi.html +1 -1
- package/documentation/classes/JBaseApi.html +1 -1
- package/documentation/classes/JBookmarkApi.html +1 -1
- package/documentation/classes/JCommunityApi.html +1 -1
- package/documentation/classes/JDiapazoneApi.html +1 -1
- package/documentation/classes/JFaqApi.html +1 -1
- package/documentation/classes/JFileApi.html +6 -6
- package/documentation/classes/JFilebankApi.html +1 -1
- package/documentation/classes/JGroupApi.html +9 -9
- package/documentation/classes/JLandApi.html +1 -1
- package/documentation/classes/JMessengerApi.html +1 -1
- package/documentation/classes/JSearchApi.html +6 -6
- package/documentation/classes/JShareApi.html +1 -1
- package/documentation/classes/JTaxonomyApi.html +2 -2
- package/documentation/classes/JUserApi.html +4 -4
- package/documentation/classes/JWedocApi.html +1 -1
- package/documentation/classes/JamespotUserApi.html +1 -1
- package/documentation/classes/Network.html +1 -1
- package/documentation/classes/TVDisplayApi.html +1 -1
- package/documentation/classes/WindowBrowser.html +1 -1
- package/documentation/enums/StudioApplicationStatus.html +1 -1
- package/documentation/index.html +1 -1
- package/documentation/interfaces/AccessRightObject.html +1 -1
- package/documentation/interfaces/AdminLicenseUser.html +1 -1
- package/documentation/interfaces/ApiDefaultWrapper.html +1 -1
- package/documentation/interfaces/ApiWrapper.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/FileBankProps.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/ObjectListProps.html +1 -1
- package/documentation/interfaces/PagingResults.html +1 -1
- package/documentation/interfaces/RootFolderProps.html +1 -1
- package/documentation/interfaces/SearchCategoryModel.html +1 -1
- package/documentation/interfaces/SearchCategoryValue.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/SearchResultPropsApp.html +1 -1
- package/documentation/interfaces/SearchResultPropsObject.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/WindowInterface.html +1 -1
- package/documentation/modules.html +14 -9
- package/lib/jamespot-user-api.js +1 -1
- package/lib/jamespot-user-api.js.map +1 -1
- package/lib/src/apis/article/article.d.ts +3 -11
- package/lib/src/apis/article/article.mock.d.ts +3 -3
- package/lib/src/apis/faq/faq.d.ts +1 -3
- package/lib/src/apis/file/file.d.ts +68 -0
- package/lib/src/apis/file/file.mock.d.ts +8 -0
- package/lib/src/apis/file/file.test.d.ts +1 -0
- package/lib/src/apis/index.d.ts +1 -1
- package/lib/src/apis/jamespotUserApi.d.ts +1 -1
- package/lib/src/apis/wedoc/wedoc.d.ts +1 -0
- package/lib/src/apis/wedoc/wedoc.mock.d.ts +1 -0
- package/lib/src/types/file.d.ts +9 -20
- package/lib/src/types/mediaLibrary.d.ts +3 -7
- package/lib/src/types/widgets.d.ts +9 -10
- package/lib/src/util/Test.d.ts +23 -0
- package/lib/src/util/file.d.ts +23 -7
- package/lib/src/util/file.mock.d.ts +312 -0
- package/lib/src/util/network.d.ts +16 -2
- package/package.json +1 -1
- package/phpunitMock/articleGet-faq-category.json +1 -2
- package/phpunitMock/articleGet-mpArticle-list.json +1 -2
- package/phpunitMock/articleGet-with-widgets.json +161 -0
- package/phpunitMock/articleGetAttachment-success.json +19 -18
- package/phpunitMock/fileCreate-rawLittle.json +17 -0
- package/phpunitMock/fileDelete-default.json +1 -0
- package/phpunitMock/fileDeleteImage-default.json +1 -0
- package/phpunitMock/fileGet-default.json +17 -0
- package/phpunitMock/fileUpdate-rawLittle.json +18 -0
- package/phpunitMock/onlyOfficeCreateVersion-create-version.json +12 -0
- package/phpunitMock/tvDisplayGetChannel-dynamic.json +16 -16
- package/phpunitMock/tvDisplayGetChannel-slideshow.json +16 -14
- package/phpunitMock/tvDisplayGetConfigureChannel-dynamic.json +16 -16
- package/phpunitMock/tvDisplayGetConfigureChannel-slideshow.json +16 -14
- package/lib/src/apis/file.d.ts +0 -62
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JBaseApi } from '../base';
|
|
2
|
-
import { ApiWrapper, BaseMessages, Filters, jArticleList, jArticleLittle,
|
|
2
|
+
import { ApiWrapper, BaseMessages, Filters, jArticleList, jArticleLittle, jFileLittle, MaybeWithToken, Orders, PagingResults } from '../../types';
|
|
3
3
|
export type ArticleListConfig = {
|
|
4
4
|
type: string;
|
|
5
5
|
format?: string;
|
|
@@ -29,22 +29,14 @@ export type BaseArticle = {
|
|
|
29
29
|
title: string;
|
|
30
30
|
uri: string;
|
|
31
31
|
};
|
|
32
|
-
export type FileArticle = jObjectBase & {
|
|
33
|
-
title: string;
|
|
34
|
-
type: 'fileArticle';
|
|
35
|
-
mainType: 'fileArticle';
|
|
36
|
-
_url: string;
|
|
37
|
-
};
|
|
38
32
|
export declare class JArticleApi extends JBaseApi {
|
|
39
33
|
list<T extends jArticleLittle = jArticleLittle>(config: ArticleListConfig): Promise<ApiWrapper<PagingResults<T>>>;
|
|
40
|
-
get<T extends jArticleLittle = jArticleLittle>(config: ArticleGetConfig): Promise<ApiWrapper<T
|
|
41
|
-
_nbAttachedFiles: number;
|
|
42
|
-
}, BaseMessages>>;
|
|
34
|
+
get<T extends jArticleLittle = jArticleLittle>(config: ArticleGetConfig): Promise<ApiWrapper<T, BaseMessages>>;
|
|
43
35
|
create<R extends jArticleLittle = jArticleLittle, P extends ArticleCreation = ArticleCreation>(article: MaybeWithToken<P>, format?: string): Promise<ApiWrapper<Array<R>, BaseMessages>>;
|
|
44
36
|
update<T extends {
|
|
45
37
|
uri: string;
|
|
46
38
|
}, U extends jArticleLittle = jArticleList>(article: T): Promise<ApiWrapper<U, BaseMessages>>;
|
|
47
39
|
delete(id: number): Promise<ApiWrapper<boolean, BaseMessages>>;
|
|
48
40
|
count(type: string): Promise<ApiWrapper<number>>;
|
|
49
|
-
getAttachments(id: number, type: string, format?: string): Promise<ApiWrapper<
|
|
41
|
+
getAttachments(id: number, type: string, format?: string): Promise<ApiWrapper<jFileLittle[]>>;
|
|
50
42
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ApiWrapper, BaseMessages, PagingResults, jArticleList, jArticleLittle, jArticleView } from '../../types';
|
|
2
|
-
import { FileArticle } from './article';
|
|
1
|
+
import { ApiWrapper, BaseMessages, PagingResults, jArticleList, jArticleLittle, jArticleView, jArticleWidgetLittle, jFileLittle } from '../../types';
|
|
3
2
|
export declare const articleGetMpArticleList: ApiWrapper<jArticleList, BaseMessages>;
|
|
4
3
|
export declare const articleCreateMpArticleLittle: ApiWrapper<Array<jArticleLittle>, BaseMessages>;
|
|
5
4
|
export declare const articleUpdateMpArticleView: ApiWrapper<jArticleView, BaseMessages>;
|
|
6
5
|
export declare const articleCountMpArticle: ApiWrapper<number>;
|
|
6
|
+
export declare const articleWithWidget: ApiWrapper<jArticleWidgetLittle>;
|
|
7
7
|
export declare const objectListJamespotArticleQueryList: ApiWrapper<PagingResults<jArticleLittle>>;
|
|
8
8
|
export declare const articleDeleteMpArticle: ApiWrapper<boolean, BaseMessages>;
|
|
9
|
-
export declare const articleGetAttachment: ApiWrapper<
|
|
9
|
+
export declare const articleGetAttachment: ApiWrapper<jFileLittle[]>;
|
|
@@ -3,9 +3,7 @@ import { ApiWrapper, CreateFaqCategory, EditFaqCategory, FaqCategoryView, FaqHoo
|
|
|
3
3
|
export declare class JFaqApi extends JBaseApi {
|
|
4
4
|
createCategory<T extends jArticleLittle = FaqCategoryView>(params: Omit<CreateFaqCategory, 'type'>, format?: string): Promise<ApiWrapper<Array<T>>>;
|
|
5
5
|
updateCategory<T extends jArticleLittle = FaqCategoryView>(params: Omit<EditFaqCategory, 'type'>, format?: string): Promise<ApiWrapper<T>>;
|
|
6
|
-
getCategory<T extends jArticleLittle = FaqCategoryView>(id: number, format?: string): Promise<ApiWrapper<T
|
|
7
|
-
_nbAttachedFiles: number;
|
|
8
|
-
}>>;
|
|
6
|
+
getCategory<T extends jArticleLittle = FaqCategoryView>(id: number, format?: string): Promise<ApiWrapper<T>>;
|
|
9
7
|
deleteCategory(id: number): Promise<ApiWrapper<boolean>>;
|
|
10
8
|
getTaxonomy(): Promise<ApiWrapper<FaqTaxonomy>>;
|
|
11
9
|
getHookProperties(properties?: Array<keyof FaqHookProperties>): Promise<ApiWrapper<FaqHookProperties>>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ApiWrapper, FileCropConfig, UploadConfig, jFileLittle, jFileLittleCrop } from '../../types';
|
|
2
|
+
import { JBaseApi } from '../base';
|
|
3
|
+
export declare class JFileApi extends JBaseApi {
|
|
4
|
+
/**
|
|
5
|
+
* Upload a file to the server. use the same token to link the file to an article
|
|
6
|
+
* @param config configuration object. One of "file" and "url" is mandatory
|
|
7
|
+
*/
|
|
8
|
+
upload(config: UploadConfig): Promise<{
|
|
9
|
+
response: ApiWrapper<{
|
|
10
|
+
uri: string;
|
|
11
|
+
id: number;
|
|
12
|
+
mainType: string;
|
|
13
|
+
type: string;
|
|
14
|
+
dateCreation: string;
|
|
15
|
+
title: string;
|
|
16
|
+
_url: string;
|
|
17
|
+
dateModified: string | null;
|
|
18
|
+
mimetype: string;
|
|
19
|
+
path?: string;
|
|
20
|
+
}, import("../../types").BaseMessages>;
|
|
21
|
+
token: string;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Upload a list of files to the server. use the same token to link the file to an article
|
|
25
|
+
* @param attrName file name (attachment, image, bannerImage, etc.)
|
|
26
|
+
* @param files files
|
|
27
|
+
* @param token token
|
|
28
|
+
*/
|
|
29
|
+
uploadMany(configArray: Array<UploadConfig>): Promise<{
|
|
30
|
+
response: ApiWrapper<{
|
|
31
|
+
uri: string;
|
|
32
|
+
id: number;
|
|
33
|
+
mainType: string;
|
|
34
|
+
type: string;
|
|
35
|
+
dateCreation: string;
|
|
36
|
+
title: string;
|
|
37
|
+
_url: string;
|
|
38
|
+
dateModified: string | null;
|
|
39
|
+
mimetype: string;
|
|
40
|
+
path?: string;
|
|
41
|
+
}, import("../../types").BaseMessages>;
|
|
42
|
+
token: string;
|
|
43
|
+
}[]>;
|
|
44
|
+
get<T extends jFileLittle>(idFile: number, format?: string): Promise<ApiWrapper<T>>;
|
|
45
|
+
/**
|
|
46
|
+
* Crop an image
|
|
47
|
+
* @param config crop configuration
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
update(idFile: number | string, type: string, config: FileCropConfig): Promise<ApiWrapper<jFileLittleCrop, import("../../types").BaseMessages>>;
|
|
51
|
+
/**
|
|
52
|
+
* delete file. This action is not automatic. You need to update the content associated with the deleted image with the same token
|
|
53
|
+
* @param idFile file id
|
|
54
|
+
* @param attrName attribute name
|
|
55
|
+
* @param token token
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
deleteFile(idFile: number | string, attrName: string, token: string, signal?: AbortSignal): Promise<ApiWrapper<boolean, import("../../types").BaseMessages>>;
|
|
59
|
+
/**
|
|
60
|
+
* delete the image associated with a content. This action is permanent. There is no two step process with a token
|
|
61
|
+
* @param id content id
|
|
62
|
+
* @param type content type
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
deleteImage(id: number | string, type: string): Promise<ApiWrapper<{
|
|
66
|
+
id: number;
|
|
67
|
+
}, import("../../types").BaseMessages>>;
|
|
68
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ApiWrapper, jFileLittle, jFileLittleCrop } from '../../types';
|
|
2
|
+
export declare const fileCreateRawLittle: ApiWrapper<jFileLittle>;
|
|
3
|
+
export declare const fileUpdateRawLittle: ApiWrapper<jFileLittleCrop>;
|
|
4
|
+
export declare const fileDeleteDefault: ApiWrapper<boolean>;
|
|
5
|
+
export declare const fileDeleteImageDefault: ApiWrapper<{
|
|
6
|
+
id: number;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const fileGetDefault: ApiWrapper<jFileLittle>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/src/apis/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export * from './base';
|
|
|
7
7
|
export * from './bookmark/bookmark';
|
|
8
8
|
export * from './community';
|
|
9
9
|
export * from './diapazone/diapazone';
|
|
10
|
+
export * from './file/file';
|
|
10
11
|
export * from './faq/faq';
|
|
11
|
-
export * from './file';
|
|
12
12
|
export * from './filebank';
|
|
13
13
|
export * from './group';
|
|
14
14
|
export * from './jamespotUserApi';
|
|
@@ -7,7 +7,7 @@ import { JAudienceApi } from './audience/audience';
|
|
|
7
7
|
import { JCommunityApi } from './community';
|
|
8
8
|
import { JDiapazoneApi } from './diapazone/diapazone';
|
|
9
9
|
import { JDriveApi } from './drive/drive';
|
|
10
|
-
import { JFileApi } from './file';
|
|
10
|
+
import { JFileApi } from './file/file';
|
|
11
11
|
import { JFilebankApi } from './filebank';
|
|
12
12
|
import { JGroupApi } from './group/group';
|
|
13
13
|
import { JMediaLibraryApi } from './mediaLibrary/mediaLibrary';
|
|
@@ -13,3 +13,4 @@ export declare const wedocDeleteFile: ApiWrapper<boolean>;
|
|
|
13
13
|
export declare const wedocGetFile: ApiWrapper<WedocFileType>;
|
|
14
14
|
export declare const wedocGetObjectAccessHash: ApiWrapper<string>;
|
|
15
15
|
export declare const wedocGetFiles: ApiWrapper<PagingResults<WedocFileType>>;
|
|
16
|
+
export declare const wedocCreateVersion: ApiWrapper<boolean>;
|
package/lib/src/types/file.d.ts
CHANGED
|
@@ -9,39 +9,28 @@ export type ImageSize = {
|
|
|
9
9
|
width: number;
|
|
10
10
|
height: number;
|
|
11
11
|
};
|
|
12
|
-
export type FileResponse = {
|
|
13
|
-
id: string;
|
|
14
|
-
name: string;
|
|
15
|
-
type: string;
|
|
16
|
-
token?: string;
|
|
17
|
-
crop?: FileCropConfig;
|
|
18
|
-
size: string;
|
|
19
|
-
mediaKey: string;
|
|
20
|
-
imagesize: ImageSize;
|
|
21
|
-
};
|
|
22
12
|
export type FileCropConfig = {
|
|
23
13
|
x: number;
|
|
24
14
|
y: number;
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
w: number;
|
|
16
|
+
h: number;
|
|
27
17
|
rotation: number;
|
|
28
18
|
killSize?: boolean;
|
|
29
19
|
};
|
|
30
|
-
export type FileCropReturnType = Omit<FileResponse, 'token'> & {
|
|
31
|
-
crop: FileCropConfig;
|
|
32
|
-
};
|
|
33
20
|
export type jFileLittle = Readable<Omit<jObjectLittle, 'dateModified'> & {
|
|
34
21
|
dateCreation: string;
|
|
35
22
|
dateModified: string | null;
|
|
23
|
+
mimetype: string;
|
|
24
|
+
path?: string;
|
|
36
25
|
}>;
|
|
26
|
+
export type jFileLittleCrop = jFileLittle & {
|
|
27
|
+
_extend: {
|
|
28
|
+
crop: FileCropConfig;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
37
31
|
export type jFileRendition = {
|
|
38
32
|
name: string;
|
|
39
33
|
filename: string;
|
|
40
34
|
dateModified: string;
|
|
41
35
|
mimetype: string;
|
|
42
36
|
};
|
|
43
|
-
export type JFileExtended = jFileLittle & {
|
|
44
|
-
meta?: string;
|
|
45
|
-
_renditions: string[];
|
|
46
|
-
_renditionsData: Record<string, jFileRendition>;
|
|
47
|
-
};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { AudienceAutocomplete, jArticleList, jArticleLittle,
|
|
2
|
-
export type MediaLibraryAttachment = jObjectBase & {
|
|
3
|
-
title: string;
|
|
4
|
-
size: string;
|
|
5
|
-
};
|
|
1
|
+
import { AudienceAutocomplete, jArticleList, jArticleLittle, jFileLittle } from '../types';
|
|
6
2
|
export type MediaLibraryLittle = jArticleLittle & {
|
|
7
|
-
attachment:
|
|
3
|
+
attachment: jFileLittle;
|
|
8
4
|
description: string;
|
|
9
5
|
};
|
|
10
6
|
export type MediaLibraryList = jArticleList & {
|
|
11
7
|
description: string;
|
|
12
|
-
attachment:
|
|
8
|
+
attachment: jFileLittle;
|
|
13
9
|
_audience: Array<AudienceAutocomplete>;
|
|
14
10
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { AudienceAutocomplete } from './autocomplete';
|
|
2
|
+
import { jFileLittle } from './file';
|
|
2
3
|
import { jArticleLittle } from './utils';
|
|
4
|
+
export type jArticleWidgetLittle = jArticleLittle & {
|
|
5
|
+
articleWidgets: WidgetWrapperProps[];
|
|
6
|
+
};
|
|
3
7
|
export type WidgetLayer = {
|
|
4
8
|
uniqid: string;
|
|
5
9
|
title: string;
|
|
@@ -80,14 +84,10 @@ export type VariantType = 'contained' | 'outlined';
|
|
|
80
84
|
export type OpeningType = 'link' | 'anchor' | 'popup';
|
|
81
85
|
export type WidgetArticleGalleryContent = {
|
|
82
86
|
gap?: string;
|
|
83
|
-
|
|
84
|
-
files?:
|
|
85
|
-
galleryDisplay?: 'portrait' | 'landscape';
|
|
86
|
-
heightMode?: 'auto' | 'custom';
|
|
87
|
-
heightModeValue?: string;
|
|
87
|
+
column?: string;
|
|
88
|
+
files?: jFileLittle[];
|
|
88
89
|
};
|
|
89
90
|
export type WidgetArticleTitleContent = {
|
|
90
|
-
widgets?: WidgetWrapperProps[];
|
|
91
91
|
text?: string;
|
|
92
92
|
textAlign?: CSSTextAlignType;
|
|
93
93
|
heading?: string;
|
|
@@ -126,16 +126,15 @@ export type WidgetArticleButtonContent = {
|
|
|
126
126
|
openingTypePopup?: OpeningTypePopup;
|
|
127
127
|
};
|
|
128
128
|
export type WidgetArticleImageContent = {
|
|
129
|
-
file?:
|
|
129
|
+
file?: jFileLittle;
|
|
130
130
|
useFilter?: boolean;
|
|
131
131
|
displayAs?: 'image' | 'background';
|
|
132
132
|
backgroundPosition?: CSSBackgroundPosition;
|
|
133
133
|
backgroundSize?: CSSBackgroundSize;
|
|
134
134
|
borderRadius?: string;
|
|
135
|
-
widgets?: WidgetWrapperProps[];
|
|
136
135
|
};
|
|
137
136
|
export type WidgetArticleAttachmentContent = {
|
|
138
|
-
files?:
|
|
137
|
+
files?: jFileLittle[];
|
|
139
138
|
fileDisplay?: 'list' | 'gallery';
|
|
140
139
|
};
|
|
141
140
|
export type CombinedWidgetContent = {
|
|
@@ -174,7 +173,7 @@ export type WidgetFileType = {
|
|
|
174
173
|
height: number;
|
|
175
174
|
};
|
|
176
175
|
};
|
|
177
|
-
export type WidgetDisplayMode = 'edit' | 'view';
|
|
176
|
+
export type WidgetDisplayMode = 'edit' | 'view' | 'preview';
|
|
178
177
|
export type WidgetModalProps = {
|
|
179
178
|
title?: string;
|
|
180
179
|
view?: any;
|
package/lib/src/util/Test.d.ts
CHANGED
|
@@ -16,6 +16,29 @@ export declare const validateArticleIsFormatView: <T extends jArticleView = jArt
|
|
|
16
16
|
export declare const validateUserIsFormatList: <T extends jUserList = jUserList>(object: T) => void;
|
|
17
17
|
export declare const validateCommentIsFormatList: <T extends jCommentList = jCommentList>(object: T) => void;
|
|
18
18
|
export declare const validateObjectIsFormatAutocomplete: <T extends jObjectAutocomplete = jObjectAutocomplete>(object: T) => void;
|
|
19
|
+
export declare const validateFileIsFormatLittle: <T extends {
|
|
20
|
+
uri: string;
|
|
21
|
+
id: number;
|
|
22
|
+
mainType: string;
|
|
23
|
+
type: string;
|
|
24
|
+
dateCreation: string;
|
|
25
|
+
title: string;
|
|
26
|
+
_url: string;
|
|
27
|
+
dateModified: string | null;
|
|
28
|
+
mimetype: string;
|
|
29
|
+
path?: string;
|
|
30
|
+
} = {
|
|
31
|
+
uri: string;
|
|
32
|
+
id: number;
|
|
33
|
+
mainType: string;
|
|
34
|
+
type: string;
|
|
35
|
+
dateCreation: string;
|
|
36
|
+
title: string;
|
|
37
|
+
_url: string;
|
|
38
|
+
dateModified: string | null;
|
|
39
|
+
mimetype: string;
|
|
40
|
+
path?: string;
|
|
41
|
+
}>(object: T) => void;
|
|
19
42
|
export declare const expectToHaveProperties: <T>(props: string[], payload: T[]) => void;
|
|
20
43
|
export declare const expectToBeArray: <T>(arr: T[]) => void;
|
|
21
44
|
export declare const validateRights: (object: Rights) => void;
|
package/lib/src/util/file.d.ts
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export declare
|
|
6
|
-
export
|
|
7
|
-
export declare
|
|
1
|
+
import { jFileLittle } from '../types';
|
|
2
|
+
export declare const mimetypes: readonly ["application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.presentationml.presentation", "application/pdf", "application/zip", "application/illustrator", "application/postscript", "application/vnd.ms-opentype", "application/x-font-ttf", "application/octet-stream", "audio/mp3", "audio/mpeg", "font/ttf", "font/otf", "image/jpeg", "image/jpg", "image/png", "image/gif", "image/vnd.adobe.photoshop", "image/svg+xml", "text/plain", "text/csv", "video/mp4", "video/webm"];
|
|
3
|
+
export type MimetypesType = (typeof mimetypes)[number];
|
|
4
|
+
export type fileExtensionTypes = 'docx' | 'xlsx' | 'csv' | 'pptx' | 'pdf' | 'zip' | 'ai' | 'mp3' | 'mpeg' | 'ttf' | 'otf' | 'jpg' | 'jpeg' | 'png' | 'gif' | 'psd' | 'svg' | 'txt' | 'mp4' | 'odt' | 'webm';
|
|
5
|
+
export declare const extensions: fileExtensionTypes[];
|
|
6
|
+
export type fileFamilyTypes = 'application' | 'gif' | 'image' | 'video' | 'audio' | 'font' | 'text';
|
|
7
|
+
export declare const mimetypeToExt: Record<string, fileExtensionTypes>;
|
|
8
|
+
export declare const getMimetypeFromExtension: (fileExt: fileExtensionTypes) => string | undefined;
|
|
9
|
+
export declare const getFileExtensionFromMimetype: (mimetype: string) => fileExtensionTypes;
|
|
10
|
+
export declare function getExtensionFromName(name: string): fileExtensionTypes;
|
|
11
|
+
/**
|
|
12
|
+
* This resolve bad/missing (mostly application/octet-stream) mimetype with the file name.
|
|
13
|
+
* If this doesn't match any extension. Return application/octet-stream to get neutral file display
|
|
14
|
+
*/
|
|
15
|
+
export declare const getMimetypeFromName: (name: string) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Resolve file path. If undefined show file avatar
|
|
18
|
+
*/
|
|
19
|
+
export declare const resolveFilePath: (file: jFileLittle, size?: string) => string | undefined;
|
|
20
|
+
export declare const getFileFamilyFromName: (name: string) => fileFamilyTypes;
|
|
21
|
+
export declare function getFileFamily(mimetype: string | undefined): fileFamilyTypes;
|
|
22
|
+
export declare const resolveFileMimetype: (file: jFileLittle) => string;
|
|
23
|
+
export declare const resolveFileFamily: (file: jFileLittle) => fileFamilyTypes;
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
export declare const FileDocx: {
|
|
2
|
+
title: string;
|
|
3
|
+
mimetype: string;
|
|
4
|
+
uri: string;
|
|
5
|
+
id: number;
|
|
6
|
+
mainType: string;
|
|
7
|
+
type: string;
|
|
8
|
+
dateCreation: string;
|
|
9
|
+
_url: string;
|
|
10
|
+
dateModified: string | null;
|
|
11
|
+
path?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const FileXlsx: {
|
|
14
|
+
title: string;
|
|
15
|
+
mimetype: string;
|
|
16
|
+
uri: string;
|
|
17
|
+
id: number;
|
|
18
|
+
mainType: string;
|
|
19
|
+
type: string;
|
|
20
|
+
dateCreation: string;
|
|
21
|
+
_url: string;
|
|
22
|
+
dateModified: string | null;
|
|
23
|
+
path?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const FilePptx: {
|
|
26
|
+
title: string;
|
|
27
|
+
mimetype: string;
|
|
28
|
+
uri: string;
|
|
29
|
+
id: number;
|
|
30
|
+
mainType: string;
|
|
31
|
+
type: string;
|
|
32
|
+
dateCreation: string;
|
|
33
|
+
_url: string;
|
|
34
|
+
dateModified: string | null;
|
|
35
|
+
path?: string;
|
|
36
|
+
};
|
|
37
|
+
export declare const FileOdt: {
|
|
38
|
+
title: string;
|
|
39
|
+
mimetype: string;
|
|
40
|
+
uri: string;
|
|
41
|
+
id: number;
|
|
42
|
+
mainType: string;
|
|
43
|
+
type: string;
|
|
44
|
+
dateCreation: string;
|
|
45
|
+
_url: string;
|
|
46
|
+
dateModified: string | null;
|
|
47
|
+
path?: string;
|
|
48
|
+
};
|
|
49
|
+
export declare const FilePdf: {
|
|
50
|
+
title: string;
|
|
51
|
+
mimetype: string;
|
|
52
|
+
uri: string;
|
|
53
|
+
id: number;
|
|
54
|
+
mainType: string;
|
|
55
|
+
type: string;
|
|
56
|
+
dateCreation: string;
|
|
57
|
+
_url: string;
|
|
58
|
+
dateModified: string | null;
|
|
59
|
+
path?: string;
|
|
60
|
+
};
|
|
61
|
+
export declare const FileZip: {
|
|
62
|
+
title: string;
|
|
63
|
+
mimetype: string;
|
|
64
|
+
uri: string;
|
|
65
|
+
id: number;
|
|
66
|
+
mainType: string;
|
|
67
|
+
type: string;
|
|
68
|
+
dateCreation: string;
|
|
69
|
+
_url: string;
|
|
70
|
+
dateModified: string | null;
|
|
71
|
+
path?: string;
|
|
72
|
+
};
|
|
73
|
+
export declare const FileZip2: {
|
|
74
|
+
title: string;
|
|
75
|
+
mimetype: string;
|
|
76
|
+
uri: string;
|
|
77
|
+
id: number;
|
|
78
|
+
mainType: string;
|
|
79
|
+
type: string;
|
|
80
|
+
dateCreation: string;
|
|
81
|
+
_url: string;
|
|
82
|
+
dateModified: string | null;
|
|
83
|
+
path?: string;
|
|
84
|
+
};
|
|
85
|
+
export declare const FileAi: {
|
|
86
|
+
title: string;
|
|
87
|
+
mimetype: string;
|
|
88
|
+
uri: string;
|
|
89
|
+
id: number;
|
|
90
|
+
mainType: string;
|
|
91
|
+
type: string;
|
|
92
|
+
dateCreation: string;
|
|
93
|
+
_url: string;
|
|
94
|
+
dateModified: string | null;
|
|
95
|
+
path?: string;
|
|
96
|
+
};
|
|
97
|
+
export declare const FileAi2: {
|
|
98
|
+
title: string;
|
|
99
|
+
mimetype: string;
|
|
100
|
+
uri: string;
|
|
101
|
+
id: number;
|
|
102
|
+
mainType: string;
|
|
103
|
+
type: string;
|
|
104
|
+
dateCreation: string;
|
|
105
|
+
_url: string;
|
|
106
|
+
dateModified: string | null;
|
|
107
|
+
path?: string;
|
|
108
|
+
};
|
|
109
|
+
export declare const FileMp3: {
|
|
110
|
+
title: string;
|
|
111
|
+
mimetype: string;
|
|
112
|
+
uri: string;
|
|
113
|
+
id: number;
|
|
114
|
+
mainType: string;
|
|
115
|
+
type: string;
|
|
116
|
+
dateCreation: string;
|
|
117
|
+
_url: string;
|
|
118
|
+
dateModified: string | null;
|
|
119
|
+
path?: string;
|
|
120
|
+
};
|
|
121
|
+
export declare const FileMp4: {
|
|
122
|
+
title: string;
|
|
123
|
+
mimetype: string;
|
|
124
|
+
uri: string;
|
|
125
|
+
id: number;
|
|
126
|
+
mainType: string;
|
|
127
|
+
type: string;
|
|
128
|
+
dateCreation: string;
|
|
129
|
+
_url: string;
|
|
130
|
+
dateModified: string | null;
|
|
131
|
+
path?: string;
|
|
132
|
+
};
|
|
133
|
+
export declare const FileMpeg: {
|
|
134
|
+
title: string;
|
|
135
|
+
mimetype: string;
|
|
136
|
+
uri: string;
|
|
137
|
+
id: number;
|
|
138
|
+
mainType: string;
|
|
139
|
+
type: string;
|
|
140
|
+
dateCreation: string;
|
|
141
|
+
_url: string;
|
|
142
|
+
dateModified: string | null;
|
|
143
|
+
path?: string;
|
|
144
|
+
};
|
|
145
|
+
export declare const FileTtf: {
|
|
146
|
+
title: string;
|
|
147
|
+
mimetype: string;
|
|
148
|
+
uri: string;
|
|
149
|
+
id: number;
|
|
150
|
+
mainType: string;
|
|
151
|
+
type: string;
|
|
152
|
+
dateCreation: string;
|
|
153
|
+
_url: string;
|
|
154
|
+
dateModified: string | null;
|
|
155
|
+
path?: string;
|
|
156
|
+
};
|
|
157
|
+
export declare const FileTtf2: {
|
|
158
|
+
title: string;
|
|
159
|
+
mimetype: string;
|
|
160
|
+
uri: string;
|
|
161
|
+
id: number;
|
|
162
|
+
mainType: string;
|
|
163
|
+
type: string;
|
|
164
|
+
dateCreation: string;
|
|
165
|
+
_url: string;
|
|
166
|
+
dateModified: string | null;
|
|
167
|
+
path?: string;
|
|
168
|
+
};
|
|
169
|
+
export declare const FileOtf: {
|
|
170
|
+
title: string;
|
|
171
|
+
mimetype: string;
|
|
172
|
+
uri: string;
|
|
173
|
+
id: number;
|
|
174
|
+
mainType: string;
|
|
175
|
+
type: string;
|
|
176
|
+
dateCreation: string;
|
|
177
|
+
_url: string;
|
|
178
|
+
dateModified: string | null;
|
|
179
|
+
path?: string;
|
|
180
|
+
};
|
|
181
|
+
export declare const FileOtf2: {
|
|
182
|
+
title: string;
|
|
183
|
+
mimetype: string;
|
|
184
|
+
uri: string;
|
|
185
|
+
id: number;
|
|
186
|
+
mainType: string;
|
|
187
|
+
type: string;
|
|
188
|
+
dateCreation: string;
|
|
189
|
+
_url: string;
|
|
190
|
+
dateModified: string | null;
|
|
191
|
+
path?: string;
|
|
192
|
+
};
|
|
193
|
+
export declare const FileJpeg: {
|
|
194
|
+
title: string;
|
|
195
|
+
mimetype: string;
|
|
196
|
+
uri: string;
|
|
197
|
+
id: number;
|
|
198
|
+
mainType: string;
|
|
199
|
+
type: string;
|
|
200
|
+
dateCreation: string;
|
|
201
|
+
_url: string;
|
|
202
|
+
dateModified: string | null;
|
|
203
|
+
path?: string;
|
|
204
|
+
};
|
|
205
|
+
export declare const FileJpg: {
|
|
206
|
+
title: string;
|
|
207
|
+
mimetype: string;
|
|
208
|
+
uri: string;
|
|
209
|
+
id: number;
|
|
210
|
+
mainType: string;
|
|
211
|
+
type: string;
|
|
212
|
+
dateCreation: string;
|
|
213
|
+
_url: string;
|
|
214
|
+
dateModified: string | null;
|
|
215
|
+
path?: string;
|
|
216
|
+
};
|
|
217
|
+
export declare const FilePng: {
|
|
218
|
+
title: string;
|
|
219
|
+
mimetype: string;
|
|
220
|
+
uri: string;
|
|
221
|
+
id: number;
|
|
222
|
+
mainType: string;
|
|
223
|
+
type: string;
|
|
224
|
+
dateCreation: string;
|
|
225
|
+
_url: string;
|
|
226
|
+
dateModified: string | null;
|
|
227
|
+
path?: string;
|
|
228
|
+
};
|
|
229
|
+
export declare const FileGif: {
|
|
230
|
+
title: string;
|
|
231
|
+
mimetype: string;
|
|
232
|
+
uri: string;
|
|
233
|
+
id: number;
|
|
234
|
+
mainType: string;
|
|
235
|
+
type: string;
|
|
236
|
+
dateCreation: string;
|
|
237
|
+
_url: string;
|
|
238
|
+
dateModified: string | null;
|
|
239
|
+
path?: string;
|
|
240
|
+
};
|
|
241
|
+
export declare const FilePsd: {
|
|
242
|
+
title: string;
|
|
243
|
+
mimetype: string;
|
|
244
|
+
uri: string;
|
|
245
|
+
id: number;
|
|
246
|
+
mainType: string;
|
|
247
|
+
type: string;
|
|
248
|
+
dateCreation: string;
|
|
249
|
+
_url: string;
|
|
250
|
+
dateModified: string | null;
|
|
251
|
+
path?: string;
|
|
252
|
+
};
|
|
253
|
+
export declare const FileSvg: {
|
|
254
|
+
title: string;
|
|
255
|
+
mimetype: string;
|
|
256
|
+
uri: string;
|
|
257
|
+
id: number;
|
|
258
|
+
mainType: string;
|
|
259
|
+
type: string;
|
|
260
|
+
dateCreation: string;
|
|
261
|
+
_url: string;
|
|
262
|
+
dateModified: string | null;
|
|
263
|
+
path?: string;
|
|
264
|
+
};
|
|
265
|
+
export declare const FileTxt: {
|
|
266
|
+
title: string;
|
|
267
|
+
mimetype: string;
|
|
268
|
+
uri: string;
|
|
269
|
+
id: number;
|
|
270
|
+
mainType: string;
|
|
271
|
+
type: string;
|
|
272
|
+
dateCreation: string;
|
|
273
|
+
_url: string;
|
|
274
|
+
dateModified: string | null;
|
|
275
|
+
path?: string;
|
|
276
|
+
};
|
|
277
|
+
export declare const FileCsv: {
|
|
278
|
+
title: string;
|
|
279
|
+
mimetype: string;
|
|
280
|
+
uri: string;
|
|
281
|
+
id: number;
|
|
282
|
+
mainType: string;
|
|
283
|
+
type: string;
|
|
284
|
+
dateCreation: string;
|
|
285
|
+
_url: string;
|
|
286
|
+
dateModified: string | null;
|
|
287
|
+
path?: string;
|
|
288
|
+
};
|
|
289
|
+
export declare const FileWebm: {
|
|
290
|
+
title: string;
|
|
291
|
+
mimetype: string;
|
|
292
|
+
uri: string;
|
|
293
|
+
id: number;
|
|
294
|
+
mainType: string;
|
|
295
|
+
type: string;
|
|
296
|
+
dateCreation: string;
|
|
297
|
+
_url: string;
|
|
298
|
+
dateModified: string | null;
|
|
299
|
+
path?: string;
|
|
300
|
+
};
|
|
301
|
+
export declare const FileUnknownPsd: {
|
|
302
|
+
title: string;
|
|
303
|
+
mimetype: string;
|
|
304
|
+
uri: string;
|
|
305
|
+
id: number;
|
|
306
|
+
mainType: string;
|
|
307
|
+
type: string;
|
|
308
|
+
dateCreation: string;
|
|
309
|
+
_url: string;
|
|
310
|
+
dateModified: string | null;
|
|
311
|
+
path?: string;
|
|
312
|
+
};
|