jamespot-user-api 1.0.104 → 1.0.106

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/documentation/assets/search.js +1 -1
  2. package/documentation/classes/AdminLicenseApi.html +12 -12
  3. package/documentation/classes/AdminStoreApi.html +1 -1
  4. package/documentation/classes/AdminUtilsApi.html +2 -2
  5. package/documentation/classes/JApplicationApi.html +9 -9
  6. package/documentation/classes/JArticleApi.html +1 -1
  7. package/documentation/classes/JAssetReservation.html +1 -1
  8. package/documentation/classes/JAudienceApi.html +2 -2
  9. package/documentation/classes/JBaseApi.html +1 -1
  10. package/documentation/classes/JBookmarkApi.html +1 -1
  11. package/documentation/classes/JCommunityApi.html +1 -1
  12. package/documentation/classes/JDiapazoneApi.html +1 -1
  13. package/documentation/classes/JFileApi.html +6 -6
  14. package/documentation/classes/JFilebankApi.html +1 -1
  15. package/documentation/classes/JGroupApi.html +8 -8
  16. package/documentation/classes/JLandApi.html +1 -1
  17. package/documentation/classes/JMessengerApi.html +1 -1
  18. package/documentation/classes/JSearchApi.html +7 -7
  19. package/documentation/classes/JShareApi.html +1 -1
  20. package/documentation/classes/JTaxonomyApi.html +3 -3
  21. package/documentation/classes/JUserApi.html +4 -4
  22. package/documentation/classes/JWedocApi.html +1 -1
  23. package/documentation/classes/JamespotUserApi.html +1 -1
  24. package/documentation/classes/Network.html +1 -1
  25. package/documentation/classes/WindowBrowser.html +1 -1
  26. package/documentation/enums/StudioApplicationStatus.html +1 -1
  27. package/documentation/index.html +1 -1
  28. package/documentation/interfaces/AccessRightObject.html +1 -1
  29. package/documentation/interfaces/AdminLicenseUser.html +1 -1
  30. package/documentation/interfaces/ApiDefaultWrapper.html +1 -1
  31. package/documentation/interfaces/ApiWrapper.html +1 -1
  32. package/documentation/interfaces/BaseAutocomplete.html +1 -1
  33. package/documentation/interfaces/BaseMessage.html +1 -1
  34. package/documentation/interfaces/Category.html +1 -1
  35. package/documentation/interfaces/FileBankProps.html +1 -1
  36. package/documentation/interfaces/FolderProps.html +1 -1
  37. package/documentation/interfaces/ListFilterSpec.html +1 -1
  38. package/documentation/interfaces/OF.html +1 -1
  39. package/documentation/interfaces/ObjectListProps.html +1 -1
  40. package/documentation/interfaces/PagingResults.html +1 -1
  41. package/documentation/interfaces/RootFolderProps.html +1 -1
  42. package/documentation/interfaces/SearchCategoryModel.html +1 -1
  43. package/documentation/interfaces/SearchCategoryValue.html +1 -1
  44. package/documentation/interfaces/SearchConfig.html +1 -1
  45. package/documentation/interfaces/SearchFacetModel.html +1 -1
  46. package/documentation/interfaces/SearchFacetValueModel.html +1 -1
  47. package/documentation/interfaces/SearchQuery.html +1 -1
  48. package/documentation/interfaces/SearchQueryFilterModel.html +1 -1
  49. package/documentation/interfaces/SearchQueryOption.html +1 -1
  50. package/documentation/interfaces/SearchQueryResult.html +1 -1
  51. package/documentation/interfaces/SearchQuerySortModel.html +1 -1
  52. package/documentation/interfaces/SearchResultCatProps.html +1 -1
  53. package/documentation/interfaces/SearchResultPropsApp.html +1 -1
  54. package/documentation/interfaces/SearchResultPropsObject.html +1 -1
  55. package/documentation/interfaces/SpotProps.html +1 -1
  56. package/documentation/interfaces/Taxonomy.html +1 -1
  57. package/documentation/interfaces/TaxonomyCreate.html +1 -1
  58. package/documentation/interfaces/WindowInterface.html +1 -1
  59. package/documentation/modules.html +6 -6
  60. package/lib/jamespot-user-api.js +1 -1
  61. package/lib/jamespot-user-api.js.map +1 -1
  62. package/lib/src/apis/base.d.ts +3 -1
  63. package/lib/src/apis/{bookmark.d.ts → bookmark/bookmark.d.ts} +7 -7
  64. package/lib/src/apis/bookmark/bookmark.mock.d.ts +8 -0
  65. package/lib/src/apis/bookmark/bookmark.test.d.ts +1 -0
  66. package/lib/src/apis/drive/drive.d.ts +20 -0
  67. package/lib/src/apis/drive/drive.mock.d.ts +4 -0
  68. package/lib/src/apis/index.d.ts +4 -3
  69. package/lib/src/apis/jamespotUserApi.d.ts +5 -3
  70. package/lib/src/apis/share/share.d.ts +14 -0
  71. package/lib/src/apis/share/share.mock.d.ts +7 -0
  72. package/lib/src/apis/share/share.test.d.ts +1 -0
  73. package/lib/src/apis/wedoc/wedoc.d.ts +17 -0
  74. package/lib/src/apis/wedoc/wedoc.mock.d.ts +14 -0
  75. package/lib/src/apis/wedoc/wedoc.test.d.ts +1 -0
  76. package/lib/src/types/bookmark.d.ts +2 -1
  77. package/lib/src/types/drive.d.ts +27 -0
  78. package/lib/src/types/index.d.ts +1 -0
  79. package/lib/src/types/share.d.ts +7 -17
  80. package/lib/src/types/user.d.ts +1 -0
  81. package/lib/src/types/utils.d.ts +1 -9
  82. package/lib/src/types/wedoc.d.ts +6 -21
  83. package/lib/src/util/Test.d.ts +11 -5
  84. package/lib/src/util/ensure.d.ts +3 -0
  85. package/lib/src/util/network.d.ts +14 -5
  86. package/lib/src/util/network.mock.d.ts +2 -1
  87. package/lib/src/util/network.test.d.ts +1 -0
  88. package/lib/src/window/Window.d.ts +5 -4
  89. package/lib/src/window/WindowBrowser.d.ts +2 -2
  90. package/lib/src/window/WindowBrowser.test.d.ts +1 -0
  91. package/package.json +1 -1
  92. package/phpunitMock/articleCount-mpArticle.json +1 -1
  93. package/phpunitMock/articleCreate-mpArticle-little.json +9 -6
  94. package/phpunitMock/articleGet-mpArticle-list.json +4 -4
  95. package/phpunitMock/articleUpdate-mpArticleView.json +7 -7
  96. package/phpunitMock/autocompleteAudience-u.json +42 -0
  97. package/phpunitMock/autocompleteTaxonomy-default.json +2 -2
  98. package/phpunitMock/bookmarksAdd-url.json +35 -0
  99. package/phpunitMock/bookmarksDelete-spot1Article.json +7 -0
  100. package/phpunitMock/bookmarksMove-spot1Article.json +7 -0
  101. package/phpunitMock/bookmarksRename-spot1Article.json +7 -0
  102. package/phpunitMock/customActionAdd-bookmarkSpot1Article.json +45 -0
  103. package/phpunitMock/licenseManagerAssignLicense-default.json +1 -7
  104. package/phpunitMock/licenseManagerCountLicensesNotAssigned-count.json +7 -15
  105. package/phpunitMock/licenseManagerGetLicensesAssigned-default.json +48 -48
  106. package/phpunitMock/licenseManagerUnassignLicense-default.json +1 -7
  107. package/phpunitMock/objectList-bookmarksList.json +92 -0
  108. package/phpunitMock/objectListJamespotArticleList-mpArticle-little.json +1 -109
  109. package/phpunitMock/objectListJamespotUserMap-default.json +1 -11
  110. package/phpunitMock/objectListMediaLibraryGetUnclassifiedFiles-default.json +7 -13
  111. package/phpunitMock/objectListTaxonomyConcept-default.json +16 -16
  112. package/phpunitMock/objectListTaxonomyHierarchyConcept-default.json +2 -2
  113. package/phpunitMock/onlyOfficeAskObjectAccess-ask-read.json +1 -0
  114. package/phpunitMock/onlyOfficeCreateFile-create-file.json +19 -0
  115. package/phpunitMock/onlyOfficeDeleteFile-delete-file.json +1 -0
  116. package/phpunitMock/onlyOfficeDuplicateFile-duplicate-file.json +19 -0
  117. package/phpunitMock/onlyOfficeGetFile-get-file.json +50 -0
  118. package/phpunitMock/onlyOfficeGetFiles-get-files.json +58 -0
  119. package/phpunitMock/onlyOfficeGetObject-default.json +26 -0
  120. package/phpunitMock/onlyOfficeGetObjectAccess-default.json +34 -0
  121. package/phpunitMock/onlyOfficeGetObjectAccessRequest-all-request.json +19 -0
  122. package/phpunitMock/onlyOfficeGetTemplates-get-templates.json +29 -0
  123. package/phpunitMock/onlyOfficeSetObjectAccess-default.json +1 -0
  124. package/phpunitMock/onlyOfficeSetObjectAccessRequest-accept.json +1 -0
  125. package/phpunitMock/onlyOfficeUpdateFile-update-file.json +1 -0
  126. package/phpunitMock/searchGetConfig-default.json +4 -3
  127. package/phpunitMock/searchProposition-gro.json +34 -0
  128. package/phpunitMock/searchQuery-admin.json +4 -3
  129. package/phpunitMock/supportConfiguration-configuration.json +51 -0
  130. package/phpunitMock/taxonomyCreate-default.json +6 -6
  131. package/phpunitMock/taxonomyList-default.json +95 -17
  132. package/phpunitMock/userDirectoryConfiguration-default.json +3 -1
  133. package/phpunitMock/userGet-rawView.json +5 -3
  134. package/documentation/interfaces/ApiError.html +0 -1
  135. package/lib/src/apis/share.d.ts +0 -17
  136. package/lib/src/apis/wedoc.d.ts +0 -26
@@ -0,0 +1,4 @@
1
+ import { ApiWrapper, BaseMessages, DriveItemType, MSGraphGroup, MSGraphTenant } from '../../types';
2
+ export declare const driveGetTenants: ApiWrapper<MSGraphTenant[], BaseMessages>;
3
+ export declare const driveGetGroups: ApiWrapper<MSGraphGroup[], BaseMessages>;
4
+ export declare const driveGetDocuments: ApiWrapper<DriveItemType[], BaseMessages>;
@@ -4,7 +4,7 @@ export * from './article/article';
4
4
  export * from './assetReservation';
5
5
  export * from './audience/audience';
6
6
  export * from './base';
7
- export * from './bookmark';
7
+ export * from './bookmark/bookmark';
8
8
  export * from './community';
9
9
  export * from './diapazone';
10
10
  export * from './file';
@@ -13,8 +13,9 @@ export * from './group';
13
13
  export * from './jamespotUserApi';
14
14
  export * from './jland/jland';
15
15
  export * from './messenger';
16
+ export * from './share/share';
16
17
  export * from './search/search';
17
- export * from './share';
18
+ export * from './share/share';
18
19
  export * from './user/user';
19
20
  export * from './taxonomy';
20
- export * from './wedoc';
21
+ export * from './wedoc/wedoc';
@@ -5,6 +5,7 @@ import { JAseiApi } from './asei';
5
5
  import { JAssetReservation } from './assetReservation';
6
6
  import { JAudienceApi } from './audience/audience';
7
7
  import { JCommunityApi } from './community';
8
+ import { JDriveApi } from './drive/drive';
8
9
  import { JFileApi } from './file';
9
10
  import { JFilebankApi } from './filebank';
10
11
  import { JGroupApi } from './group';
@@ -12,13 +13,13 @@ import { JMediaLibraryApi } from './mediaLibrary/mediaLibrary';
12
13
  import { JLandApi } from './jland/jland';
13
14
  import { JMessengerApi } from './messenger';
14
15
  import { JSearchApi } from './search/search';
15
- import { JBookmarkApi } from './bookmark';
16
+ import { JBookmarkApi } from './bookmark/bookmark';
16
17
  import { JTaxonomyApi } from './taxonomy';
17
18
  import { JUserApi } from './user/user';
18
19
  import { JDiapazoneApi } from './diapazone';
19
- import { JWedocApi } from './wedoc';
20
+ import { JWedocApi } from './wedoc/wedoc';
20
21
  import { Network } from '../util/network';
21
- import { JShareApi } from './share';
22
+ import { JShareApi } from './share/share';
22
23
  /**
23
24
  * In browser usage, 'window' should be the window object.
24
25
  * In server side usage, 'window' object given must implement the fetch method, used by the Apis.
@@ -42,6 +43,7 @@ export declare class JamespotUserApi {
42
43
  bookmark: JBookmarkApi;
43
44
  community: JCommunityApi;
44
45
  diapazone: JDiapazoneApi;
46
+ drive: JDriveApi;
45
47
  file: JFileApi;
46
48
  filebank: JFilebankApi;
47
49
  group: JGroupApi;
@@ -0,0 +1,14 @@
1
+ import { ApiWrapper } from '../../types';
2
+ import { JBaseApi } from '../base';
3
+ import { ShareAccessObject, ShareAccessProps, ShareAudienceItem, ShareGeneralAccessRules } from '../../types/share';
4
+ export declare class JShareApi extends JBaseApi {
5
+ setObjectAccessRequest(uri: string, idUser: number, requestAccessValue: 'accept' | 'deny', requestResponseMessage?: string): Promise<ApiWrapper<[]>>;
6
+ getObjectAccessRequest(uri: string, idUser?: number): Promise<ApiWrapper<ShareAudienceItem[]>>;
7
+ getObject(uri: string): Promise<ApiWrapper<ShareAccessObject>>;
8
+ askObjectAccess(uri: string, askAccess: 'read' | 'write', askMessage?: string): Promise<ApiWrapper<boolean>>;
9
+ setObjectAccess(uri: string, access: {
10
+ read: string[];
11
+ write: string[];
12
+ }, message: string, generalAccessRule: ShareGeneralAccessRules): Promise<ApiWrapper<boolean>>;
13
+ getObjectAccess(uri: string): Promise<ApiWrapper<ShareAccessProps>>;
14
+ }
@@ -0,0 +1,7 @@
1
+ import { ApiWrapper, ShareAccessObject, ShareAccessProps, ShareAudienceItem } from '../../types';
2
+ export declare const shareAskObjectAccess: ApiWrapper<boolean>;
3
+ export declare const shareGetObject: ApiWrapper<ShareAccessObject>;
4
+ export declare const shareGetObjectAccess: ApiWrapper<ShareAccessProps>;
5
+ export declare const shareGetObjectAccessRequest: ApiWrapper<ShareAudienceItem[]>;
6
+ export declare const shareSetObjectAccess: ApiWrapper<boolean>;
7
+ export declare const shareSetObjectAccessRequest: ApiWrapper<[]>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { ApiWrapper, PagingResults, WedocFileType, WedocQueryType, WedocTemplate, jArticleLittle } from '../../types';
2
+ import { JBaseApi } from '../base';
3
+ export declare class JWedocApi extends JBaseApi {
4
+ getFiles(query: WedocQueryType): Promise<ApiWrapper<PagingResults<WedocFileType>>>;
5
+ getFile(idFile: number, hash?: string): Promise<ApiWrapper<WedocFileType>>;
6
+ getTemplates(): Promise<ApiWrapper<WedocTemplate[]>>;
7
+ duplicateFile(idFile: number, title: string, publishTo: string[]): Promise<ApiWrapper<{
8
+ idFile: number;
9
+ article: jArticleLittle;
10
+ }>>;
11
+ deleteFile(idFile: number): Promise<ApiWrapper<boolean>>;
12
+ createFile(title: string, type: string, publishTo: string[]): Promise<ApiWrapper<{
13
+ idFile: number;
14
+ article: jArticleLittle;
15
+ }>>;
16
+ updateFile(idFile: number, title: string): Promise<ApiWrapper<boolean>>;
17
+ }
@@ -0,0 +1,14 @@
1
+ import { ApiWrapper, PagingResults, WedocFileType, WedocTemplate, jArticleLittle } from '../../types';
2
+ export declare const wedocGetTemplates: ApiWrapper<WedocTemplate[]>;
3
+ export declare const wedocCreateFile: ApiWrapper<{
4
+ idFile: number;
5
+ article: jArticleLittle;
6
+ }>;
7
+ export declare const wedocDuplicateFile: ApiWrapper<{
8
+ idFile: number;
9
+ article: jArticleLittle;
10
+ }>;
11
+ export declare const wedocUpdateFile: ApiWrapper<boolean>;
12
+ export declare const wedocDeleteFile: ApiWrapper<boolean>;
13
+ export declare const wedocGetFile: ApiWrapper<WedocFileType>;
14
+ export declare const wedocGetFiles: ApiWrapper<PagingResults<WedocFileType>>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,6 @@
1
+ import { jUserLittle } from './user';
1
2
  import { jLinkList, jObjectBase, jObjectLittle } from './utils';
2
- export declare type BookmarkRawList<T extends jObjectBase = jObjectLittle> = jLinkList<T> & {
3
+ export declare type BookmarkRawList<T extends jObjectBase = jObjectLittle | jUserLittle> = jLinkList<T> & {
3
4
  bookmarkUrl?: string | null;
4
5
  bookmarkOrder?: number;
5
6
  bookmarkLabel?: string;
@@ -0,0 +1,27 @@
1
+ export declare type MSGraphTenant = {
2
+ title: string;
3
+ type: string;
4
+ };
5
+ export declare type MSGraphGroup = {
6
+ title: string;
7
+ id: string;
8
+ type: string;
9
+ };
10
+ export declare type MSGraphSite = {
11
+ title: string;
12
+ id: string;
13
+ type: string;
14
+ };
15
+ export declare type DriveItemType = {
16
+ title: string;
17
+ id: string;
18
+ type: string;
19
+ webUrl: string;
20
+ };
21
+ export declare type DriveDocumentParams = {
22
+ msTenant: 'groups' | 'sites' | undefined;
23
+ msId: string | undefined;
24
+ idFolder: string | undefined;
25
+ page: number;
26
+ limit: number;
27
+ };
@@ -5,6 +5,7 @@ export * from './asei';
5
5
  export * from './assetReservation';
6
6
  export * from './autocomplete';
7
7
  export * from './bookmark';
8
+ export * from './drive';
8
9
  export * from './file';
9
10
  export * from './group';
10
11
  export * from './mediaLibrary';
@@ -1,10 +1,6 @@
1
+ import { jUserLittle } from './user';
1
2
  import { Rights } from './utils';
2
- export declare type ShareAccessObjectAudience = {
3
- id: number;
4
- uri: string;
5
- title: string;
6
- type: string;
7
- };
3
+ export declare type ShareGeneralAccessRules = 'link' | 'invitation';
8
4
  export declare type ShareOptionObject = {
9
5
  id: number;
10
6
  title: string;
@@ -17,21 +13,15 @@ export declare type ShareAccessObject = {
17
13
  type: string;
18
14
  uri: string;
19
15
  title: string;
20
- generalAccessRule: 'link' | 'invitation';
21
- generalAccessHash: string;
16
+ generalAccessRule: ShareGeneralAccessRules;
17
+ generalAccessHash: string | null;
22
18
  idUser: number;
23
- _audience: ShareAccessObjectAudience[];
19
+ _audience: ShareAudienceItem[];
24
20
  _right: Rights;
25
- _user: ShareAccessObjectAudience;
26
21
  };
22
+ export declare type ShareAudienceItem = jUserLittle;
27
23
  export declare type ShareAccessProps = {
28
- audience: ShareAccessObjectAudience[];
24
+ audience: ShareAudienceItem[];
29
25
  read: string[];
30
26
  write: string[];
31
27
  };
32
- export declare type ShareAccessRequestProps = {
33
- id: number;
34
- uri: string;
35
- title: string;
36
- type: string;
37
- };
@@ -26,6 +26,7 @@ export declare type jUserLittle = jObjectLittle & {
26
26
  dateModified: string;
27
27
  };
28
28
  export declare type jUserList = jUserLittle & {
29
+ active: number;
29
30
  [key: string]: WidgetsValue;
30
31
  };
31
32
  export declare type jUserView = jUserList & {};
@@ -45,10 +45,6 @@ export interface PagingResults<T> {
45
45
  page: number;
46
46
  }
47
47
  export declare type ApiPagingResults<T, U = BaseMessages> = ApiWrapper<PagingResults<T>, U>;
48
- export interface ApiError<U = string> {
49
- error: number;
50
- messages: U[];
51
- }
52
48
  export declare type Rights = {
53
49
  create: boolean;
54
50
  read: boolean;
@@ -73,7 +69,6 @@ export declare type jObjectLittle = Readable<jObjectBase & {
73
69
  }>;
74
70
  export declare type jObjectList = jObjectLittle & {
75
71
  description?: string;
76
- active: number;
77
72
  _user: jUserLittle;
78
73
  _right: Rights;
79
74
  };
@@ -91,7 +86,7 @@ export declare type jLinkLittle = jObjectBase & {
91
86
  targetId: number;
92
87
  targetType: string | null;
93
88
  };
94
- export declare type jLinkList<T extends jObjectBase = jObjectLittle> = jLinkLittle & {
89
+ export declare type jLinkList<T extends jObjectBase = jObjectLittle | jUserLittle> = jLinkLittle & {
95
90
  value: string | null;
96
91
  _src?: T;
97
92
  _target?: T | undefined;
@@ -128,9 +123,6 @@ export declare type Filter = {
128
123
  method?: '<' | '>' | '<=' | '>=' | '!=' | '<>' | '+' | '-' | 'like' | 'between' | 'is' | 'is not' | 'in' | 'link' | 'match' | 'equal';
129
124
  };
130
125
  export declare type Filters = Array<Filter>;
131
- export declare type MaybeWithCsrf<T> = T & {
132
- tokenCSRF?: string | undefined;
133
- };
134
126
  export declare type MaybeWithToken<T> = T & {
135
127
  token?: string | undefined;
136
128
  };
@@ -1,4 +1,5 @@
1
- import { Filters, Orders, Rights } from './utils';
1
+ import { jUserLittle } from './user';
2
+ import { Filters, jObjectBase, jObjectLittle, Orders, Rights } from './utils';
2
3
  export declare type WedocFileInfo = {
3
4
  color: string;
4
5
  description: string;
@@ -6,14 +7,9 @@ export declare type WedocFileInfo = {
6
7
  icon: string;
7
8
  label: string;
8
9
  };
9
- export declare type WedocFileType = {
10
- dateCreation: string;
11
- dateModified: string;
12
- id: string;
13
- mimetype: string;
10
+ export declare type WedocFileType = jObjectBase & {
14
11
  title: string;
15
- type: string;
16
- uri: string;
12
+ mimetype: string;
17
13
  _extend: {
18
14
  generalAccessRule: string;
19
15
  dateModified: string;
@@ -22,20 +18,9 @@ export declare type WedocFileType = {
22
18
  };
23
19
  _audience: WedocFileAudienceType[];
24
20
  _right: Rights;
25
- _user: WedocFileUserType;
26
- };
27
- export declare type WedocFileAudienceType = {
28
- id: number;
29
- title: string;
30
- uri: string;
31
- type: string;
32
- };
33
- export declare type WedocFileUserType = {
34
- id: number;
35
- title: string;
36
- uri: string;
37
- type: string;
21
+ _user: jUserLittle;
38
22
  };
23
+ export declare type WedocFileAudienceType = jObjectLittle;
39
24
  export declare type WedocTemplate = {
40
25
  color: string;
41
26
  description: string;
@@ -1,9 +1,12 @@
1
1
  import { JamespotUserApi } from '../apis';
2
- import { ApiDefaultWrapper, PagingResults, jArticleLittle, jObjectAutocomplete, jObjectList } from '../types';
2
+ import { ApiDefaultWrapper, PagingResults, jArticleLittle, jObjectAutocomplete, jObjectList, jUserList } from '../types';
3
+ import { FetchResponseType, WindowBrowser } from '../window';
3
4
  import { Network } from './network';
5
+ export declare const windowBrowser: WindowBrowser;
4
6
  export declare const network: Network;
5
7
  export declare const jApi: JamespotUserApi;
6
- export declare const validateJArticle: <T extends jArticleLittle>(received: T, expected: T, _format: 'raw-little' | 'raw-list' | 'raw-view') => void;
8
+ export declare const fetchMock: <T>(data: T) => jest.Mock<Promise<FetchResponseType<T>>, []>;
9
+ export declare const validateJArticle: <T extends jArticleLittle>(received: T, expected: T) => void;
7
10
  export declare const validateApiWrapper: <T extends ApiDefaultWrapper<import("../types").BaseMessages>>(res: T, o: string, f: string, error?: null) => void;
8
11
  export declare const validatePagingResults: <T>(res: PagingResults<T>) => void;
9
12
  export declare const validateObjectIsFormatLittle: <T extends {
@@ -24,6 +27,9 @@ export declare const validateObjectIsFormatLittle: <T extends {
24
27
  dateModified?: string;
25
28
  title: string;
26
29
  _url: string;
27
- }>(object: T) => boolean;
28
- export declare const validateObjectIsFormatList: <T extends jObjectList = jObjectList>(object: T) => boolean;
29
- export declare const validateObjectIsFormatAutocomplete: <T extends jObjectAutocomplete = jObjectAutocomplete>(object: T) => boolean;
30
+ }>(object: T) => void;
31
+ export declare const validateObjectIsFormatList: <T extends jObjectList = jObjectList>(object: T) => void;
32
+ export declare const validateUserIsFormatList: <T extends jUserList = jUserList>(object: T) => void;
33
+ export declare const validateObjectIsFormatAutocomplete: <T extends jObjectAutocomplete = jObjectAutocomplete>(object: T) => void;
34
+ export declare const expectToHaveProperties: <T>(props: string[], payload: T[]) => void;
35
+ export declare const expectToBeArray: <T>(arr: T[]) => void;
@@ -1,4 +1,5 @@
1
1
  import { BookmarkCustom, BookmarkLink, BookmarkRawList, jObjectBase } from '../types';
2
+ import { AbortApiError, StandardApiError } from './network';
2
3
  declare function ensureIsBookmarkLink(bookmark: BookmarkCustom | BookmarkLink): bookmark is BookmarkLink;
3
4
  declare function ensureIsBookmarkCustom(bookmark: BookmarkCustom | BookmarkLink): bookmark is BookmarkCustom;
4
5
  declare function ensureIsBookmarkRawList(bookmark: jObjectBase | BookmarkRawList): bookmark is BookmarkRawList;
@@ -11,5 +12,7 @@ export declare const jEnsure: {
11
12
  isBookmarkCustom: typeof ensureIsBookmarkCustom;
12
13
  isBookmarkRawList: typeof ensureIsBookmarkRawList;
13
14
  objectIsType: typeof ensureObjectIsType;
15
+ isStandardApiError: (err: any) => err is StandardApiError<import("../types").BaseMessages>;
16
+ isAbortApiError: (err: any) => err is AbortApiError;
14
17
  };
15
18
  export {};
@@ -1,9 +1,20 @@
1
- import { ApiWrapper, BaseMessages, FileResponse, MaybeWithCsrf, MaybeWithToken } from '../types';
2
- import { FetchReturnType, WindowInterface } from '../window/Window';
1
+ import { ApiWrapper, BaseMessages, FileResponse, MaybeWithToken } from '../types';
2
+ import { WindowInterface } from '../window/Window';
3
3
  export interface OF {
4
4
  o: string;
5
5
  f: string;
6
6
  }
7
+ export declare type ApiError = {
8
+ error: number;
9
+ };
10
+ export declare type StandardApiError<T = BaseMessages> = ApiError & {
11
+ errorMsg: string | undefined;
12
+ messages: T;
13
+ };
14
+ export declare type AbortApiError = ApiError & {
15
+ error: -1;
16
+ aborted: true;
17
+ };
7
18
  /**
8
19
  * deprecated
9
20
  */
@@ -12,14 +23,12 @@ export declare class Network {
12
23
  private readonly window;
13
24
  constructor(window: WindowInterface, action?: string);
14
25
  static _formatPostOptions(body: object): RequestInit;
15
- static _formatQueryOptions(options: Record<string, string | boolean | number>): string;
16
26
  getUrl(o: string, f: string): Promise<string>;
17
27
  getHostname(): Promise<string>;
18
- fetch({ o, f, ...body }: OF, signal?: AbortSignal | null): FetchReturnType;
28
+ fetch<T>({ o, f, ...body }: OF, signal?: AbortSignal | null): Promise<import("../window/Window").FetchResponseType<T>>;
19
29
  post<T, U = BaseMessages>(body: OF, signal?: AbortSignal): Promise<ApiWrapper<T, U>>;
20
30
  postFile(body: FormData): Promise<ApiWrapper<FileResponse, BaseMessages>>;
21
31
  postCSRF<T, U = BaseMessages>(body: OF): Promise<ApiWrapper<T, U>>;
22
- maybePostCSRF<T, U = BaseMessages>(body: MaybeWithCsrf<OF>): Promise<ApiWrapper<T, U>>;
23
32
  postToken<T, U = BaseMessages>(body: OF): Promise<ApiWrapper<T, U>>;
24
33
  maybePostToken<T, U = BaseMessages>(body: MaybeWithToken<OF>): Promise<ApiWrapper<T, U>>;
25
34
  token(): Promise<ApiWrapper<string>>;
@@ -1,3 +1,4 @@
1
- import { ApiWrapper } from '../types';
1
+ import { ApiDefaultWrapper, ApiWrapper } from '../types';
2
+ export declare const miscTokenError: ApiDefaultWrapper;
2
3
  export declare const miscToken: ApiWrapper<string>;
3
4
  export declare const miscTokenCSRF: ApiWrapper<string>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,8 @@
1
- export declare type FetchReturnType = Promise<{
2
- json: () => unknown;
3
- }>;
1
+ export declare type FetchResponseType<T> = {
2
+ json: () => Promise<T>;
3
+ };
4
+ export declare type FetchReturnType<T> = Promise<FetchResponseType<T>>;
4
5
  export interface WindowInterface {
5
6
  getBackendUrl: () => Promise<string>;
6
- fetch: (url: string, init?: RequestInit) => FetchReturnType;
7
+ fetch: <T>(url: string, init?: RequestInit) => FetchReturnType<T>;
7
8
  }
@@ -1,5 +1,5 @@
1
- import { WindowInterface } from './Window';
1
+ import { FetchReturnType, WindowInterface } from './Window';
2
2
  export declare class WindowBrowser implements WindowInterface {
3
3
  getBackendUrl(): Promise<string>;
4
- fetch(url: string, init?: RequestInit): Promise<Response>;
4
+ fetch<T>(url: string, init?: RequestInit): FetchReturnType<T>;
5
5
  }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jamespot-user-api",
3
- "version": "1.0.104",
3
+ "version": "1.0.106",
4
4
  "scripts": {
5
5
  "build": "npx webpack --env NODE_ENV=production",
6
6
  "build-dev-vm": "npx webpack --env NODE_ENV=development --env NODE_BUILD=VM",
@@ -1 +1 @@
1
- { "o": "article", "f": "count", "error": 0, "messages": [], "result": 13 }
1
+ { "o": "article", "f": "count", "error": 0, "messages": [], "result": 4 }
@@ -2,17 +2,20 @@
2
2
  "o": "article",
3
3
  "f": "create",
4
4
  "error": 0,
5
- "messages": [{ "code": 200, "msg": "Enregistrement r\u00e9ussi" }],
5
+ "messages": [
6
+ { "code": 200, "msg": "Enregistrement r\u00e9ussi" },
7
+ { "code": 400, "msg": "Message non envoy\u00e9 (configuration Mail)." }
8
+ ],
6
9
  "result": [
7
10
  {
8
- "id": 35,
11
+ "id": 167,
9
12
  "mainType": "article",
10
13
  "type": "mpArticle",
11
- "uri": "mpArticle/35",
14
+ "uri": "mpArticle/167",
15
+ "dateCreation": "2023-05-29 17:37:14",
16
+ "dateModified": "2023-05-29 17:37:14",
12
17
  "title": "Article for testArticleCreate",
13
- "_url": "/article/35",
14
- "dateCreation": "2023-04-11 14:53:51",
15
- "dateModified": "2023-04-11 14:53:51"
18
+ "_url": "/article/167"
16
19
  }
17
20
  ]
18
21
  }
@@ -8,10 +8,10 @@
8
8
  "mainType": "article",
9
9
  "type": "mpArticle",
10
10
  "uri": "mpArticle/2",
11
- "title": "Article groupe public",
12
- "_url": "/article/2",
13
11
  "dateCreation": "2019-07-19 09:36:25",
14
12
  "dateModified": "2019-07-19 09:36:25",
13
+ "title": "Article groupe public",
14
+ "_url": "/article/2",
15
15
  "_right": {
16
16
  "create": true,
17
17
  "read": true,
@@ -28,10 +28,10 @@
28
28
  "mainType": "user",
29
29
  "type": "user",
30
30
  "uri": "user/1",
31
+ "dateCreation": "2019-03-26 16:29:33",
32
+ "dateModified": "2023-05-29 17:35:50",
31
33
  "title": "AdminJenkins",
32
34
  "_url": "/user/1",
33
- "dateCreation": "2019-03-26 16:29:33",
34
- "dateModified": "2019-07-19 09:39:23",
35
35
  "level": 9
36
36
  },
37
37
  "_nbAttachedFiles": 0
@@ -4,14 +4,14 @@
4
4
  "error": 0,
5
5
  "messages": [{ "code": 200, "msg": "Enregistrement r\u00e9ussi" }],
6
6
  "result": {
7
- "id": 64,
7
+ "id": 174,
8
8
  "mainType": "article",
9
9
  "type": "mpArticle",
10
- "uri": "mpArticle/64",
10
+ "uri": "mpArticle/174",
11
+ "dateCreation": "2023-05-29 17:37:17",
12
+ "dateModified": "2023-05-29 17:37:17",
11
13
  "title": "New Title for testArticleUpdate",
12
- "_url": "/article/64",
13
- "dateCreation": "2023-04-11 15:34:46",
14
- "dateModified": "2023-04-11 15:34:46",
14
+ "_url": "/article/174",
15
15
  "_right": {
16
16
  "create": true,
17
17
  "read": true,
@@ -28,10 +28,10 @@
28
28
  "mainType": "user",
29
29
  "type": "user",
30
30
  "uri": "user/4",
31
- "title": "Admin1",
32
- "_url": "/user/4",
33
31
  "dateCreation": "2019-07-09 15:48:26",
34
32
  "dateModified": "2019-07-09 15:51:24",
33
+ "title": "Admin1",
34
+ "_url": "/user/4",
35
35
  "level": 9
36
36
  },
37
37
  "processContext": null
@@ -59,6 +59,48 @@
59
59
  "cssClass": "group",
60
60
  "cssColor": "#e34d55",
61
61
  "class": "user-selector-spot"
62
+ },
63
+ {
64
+ "id": "spot/22",
65
+ "idspot": "22",
66
+ "uri": "spot/22",
67
+ "shortUri": "s22",
68
+ "title": "Groupe test A",
69
+ "name": "Groupe test A",
70
+ "mainType": "spot",
71
+ "type": "spot",
72
+ "label": "Groupe",
73
+ "cssClass": "group",
74
+ "cssColor": "#e34d55",
75
+ "class": "user-selector-spot"
76
+ },
77
+ {
78
+ "id": "spot/5",
79
+ "idspot": "5",
80
+ "uri": "spot/5",
81
+ "shortUri": "s5",
82
+ "title": "Spot 1 [updated]",
83
+ "name": "Spot 1 [updated]",
84
+ "mainType": "spot",
85
+ "type": "spot",
86
+ "label": "Groupe",
87
+ "cssClass": "group",
88
+ "cssColor": "#e34d55",
89
+ "class": "user-selector-spot"
90
+ },
91
+ {
92
+ "id": "spot/6",
93
+ "idspot": "6",
94
+ "uri": "spot/6",
95
+ "shortUri": "s6",
96
+ "title": "Spot 2 [updated]",
97
+ "name": "Spot 2 [updated]",
98
+ "mainType": "spot",
99
+ "type": "spot",
100
+ "label": "Groupe",
101
+ "cssClass": "group",
102
+ "cssColor": "#e34d55",
103
+ "class": "user-selector-spot"
62
104
  }
63
105
  ]
64
106
  }
@@ -5,8 +5,8 @@
5
5
  "messages": [],
6
6
  "result": [
7
7
  {
8
- "id": "tagConcept/101",
9
- "uri": "tagConcept/101",
8
+ "id": "tagConcept/9",
9
+ "uri": "tagConcept/9",
10
10
  "shortUri": "",
11
11
  "title": "autocomplete",
12
12
  "name": "autocomplete",
@@ -0,0 +1,35 @@
1
+ {
2
+ "o": "bookmarks",
3
+ "f": "add",
4
+ "error": 0,
5
+ "messages": [{ "code": 200, "msg": "Enregistrement r\u00e9ussi" }],
6
+ "result": {
7
+ "id": 46,
8
+ "mainType": "link",
9
+ "type": "bookmarkLink",
10
+ "uri": "bookmarkLink/46",
11
+ "dateCreation": "2023-06-09 16:26:25",
12
+ "dateModified": "2023-06-09 16:26:25",
13
+ "srcId": 1,
14
+ "srcType": "user",
15
+ "targetId": 0,
16
+ "targetType": null,
17
+ "value": null,
18
+ "_src": {
19
+ "id": 1,
20
+ "mainType": "user",
21
+ "type": "user",
22
+ "uri": "user/1",
23
+ "dateCreation": "2019-03-26 16:29:33",
24
+ "dateModified": "2019-07-19 09:39:23",
25
+ "title": "AdminJenkins",
26
+ "_url": "/user/1",
27
+ "level": 9
28
+ },
29
+ "bookmarkOrder": -13,
30
+ "bookmarkLabel": "www.example.com",
31
+ "bookmarkUrl": "https://www.example.com",
32
+ "bookmarkMeta": null,
33
+ "url": null
34
+ }
35
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "o": "bookmarks",
3
+ "f": "delete",
4
+ "error": 0,
5
+ "messages": [{ "code": 200, "msg": "Suppression r\u00e9ussie" }],
6
+ "result": null
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "o": "bookmarks",
3
+ "f": "move",
4
+ "error": 0,
5
+ "messages": [{ "code": 200, "msg": "Enregistrement r\u00e9ussi" }],
6
+ "result": null
7
+ }