@equinor/fusion-framework-module-services 5.1.1-msal-0b0dadf270ee512f019a325c2f1586f91f9150a4 → 5.1.2

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 (254) hide show
  1. package/CHANGELOG.md +114 -98
  2. package/dist/esm/bookmarks/api-version.js.map +1 -1
  3. package/dist/esm/bookmarks/client.js.map +1 -1
  4. package/dist/esm/bookmarks/endpoints/bookmark-apply.get.js.map +1 -1
  5. package/dist/esm/bookmarks/endpoints/bookmark.delete.js.map +1 -1
  6. package/dist/esm/bookmarks/endpoints/bookmark.get.js.map +1 -1
  7. package/dist/esm/bookmarks/endpoints/bookmark.patch.js.map +1 -1
  8. package/dist/esm/bookmarks/endpoints/bookmark.post.js.map +1 -1
  9. package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.delete.js.map +1 -1
  10. package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.head.js.map +1 -1
  11. package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.post.js.map +1 -1
  12. package/dist/esm/bookmarks/endpoints/user-bookmarks.get.js.map +1 -1
  13. package/dist/esm/bookmarks/schemas.js +1 -3
  14. package/dist/esm/bookmarks/schemas.js.map +1 -1
  15. package/dist/esm/bookmarks/selectors.js.map +1 -1
  16. package/dist/esm/context/client.js +2 -2
  17. package/dist/esm/context/client.js.map +1 -1
  18. package/dist/esm/context/get/client.js.map +1 -1
  19. package/dist/esm/context/get/generate-endpoint.js +0 -1
  20. package/dist/esm/context/get/generate-endpoint.js.map +1 -1
  21. package/dist/esm/context/get/generate-parameters.js.map +1 -1
  22. package/dist/esm/context/get/types.js.map +1 -1
  23. package/dist/esm/context/index.js.map +1 -1
  24. package/dist/esm/context/query/client.js.map +1 -1
  25. package/dist/esm/context/query/generate-endpoint.js +58 -13
  26. package/dist/esm/context/query/generate-endpoint.js.map +1 -1
  27. package/dist/esm/context/query/generate-parameters.js.map +1 -1
  28. package/dist/esm/context/query/types.js.map +1 -1
  29. package/dist/esm/context/related/client.js.map +1 -1
  30. package/dist/esm/context/related/generate-endpoint.js +56 -13
  31. package/dist/esm/context/related/generate-endpoint.js.map +1 -1
  32. package/dist/esm/context/related/generate-parameters.js.map +1 -1
  33. package/dist/esm/context/related/types.js.map +1 -1
  34. package/dist/esm/context/static.js.map +1 -1
  35. package/dist/esm/errors.js.map +1 -1
  36. package/dist/esm/module.js.map +1 -1
  37. package/dist/esm/notification/client.js.map +1 -1
  38. package/dist/esm/notification/notification/delete/client.js.map +1 -1
  39. package/dist/esm/notification/notification/delete/generate-endpoint.js +0 -1
  40. package/dist/esm/notification/notification/delete/generate-endpoint.js.map +1 -1
  41. package/dist/esm/notification/notification/delete/generate-parameters.js.map +1 -1
  42. package/dist/esm/notification/notification/get/client.js.map +1 -1
  43. package/dist/esm/notification/notification/get/generate-endpoint.js +0 -1
  44. package/dist/esm/notification/notification/get/generate-endpoint.js.map +1 -1
  45. package/dist/esm/notification/notification/get/generate-parameters.js.map +1 -1
  46. package/dist/esm/notification/notification/getAll/client.js.map +1 -1
  47. package/dist/esm/notification/notification/getAll/generate-endpoint.js +0 -1
  48. package/dist/esm/notification/notification/getAll/generate-endpoint.js.map +1 -1
  49. package/dist/esm/notification/notification/getAll/generate-parameters.js.map +1 -1
  50. package/dist/esm/notification/notification/patch/client.js.map +1 -1
  51. package/dist/esm/notification/notification/patch/generate-endpoint.js +0 -1
  52. package/dist/esm/notification/notification/patch/generate-endpoint.js.map +1 -1
  53. package/dist/esm/notification/notification/patch/generate-parameters.js.map +1 -1
  54. package/dist/esm/notification/notification/post/client.js.map +1 -1
  55. package/dist/esm/notification/notification/post/generate-endpoint.js +0 -1
  56. package/dist/esm/notification/notification/post/generate-endpoint.js.map +1 -1
  57. package/dist/esm/notification/notification/post/generate-parameters.js.map +1 -1
  58. package/dist/esm/notification/settings/get/client.js.map +1 -1
  59. package/dist/esm/notification/settings/get/generate-endpoint.js +0 -1
  60. package/dist/esm/notification/settings/get/generate-endpoint.js.map +1 -1
  61. package/dist/esm/notification/settings/get/generate-parameters.js.map +1 -1
  62. package/dist/esm/notification/settings/put/client.js.map +1 -1
  63. package/dist/esm/notification/settings/put/generate-endpoint.js +0 -1
  64. package/dist/esm/notification/settings/put/generate-endpoint.js.map +1 -1
  65. package/dist/esm/notification/settings/put/generate-parameters.js.map +1 -1
  66. package/dist/esm/notification/static.js.map +1 -1
  67. package/dist/esm/people/client.js.map +1 -1
  68. package/dist/esm/people/person-details/client.js.map +1 -1
  69. package/dist/esm/people/person-details/generate-endpoint.js.map +1 -1
  70. package/dist/esm/people/person-details/generate-parameters.js.map +1 -1
  71. package/dist/esm/people/person-photo/client.js.map +1 -1
  72. package/dist/esm/people/person-photo/generate-endpoint.js.map +1 -1
  73. package/dist/esm/people/person-photo/generate-parameters.js.map +1 -1
  74. package/dist/esm/people/query/client.js.map +1 -1
  75. package/dist/esm/people/query/generate-endpoint.js.map +1 -1
  76. package/dist/esm/people/query/generate-parameters.js.map +1 -1
  77. package/dist/esm/people/static.js.map +1 -1
  78. package/dist/esm/people/utils.js.map +1 -1
  79. package/dist/esm/provider.js.map +1 -1
  80. package/dist/esm/utils.js.map +1 -1
  81. package/dist/esm/version.js +1 -1
  82. package/dist/tsconfig.tsbuildinfo +1 -1
  83. package/dist/types/bookmarks/api-version.d.ts +2 -2
  84. package/dist/types/bookmarks/client.d.ts +8 -8
  85. package/dist/types/bookmarks/endpoints/bookmark-apply.get.d.ts +1 -1
  86. package/dist/types/bookmarks/endpoints/bookmark.delete.d.ts +1 -1
  87. package/dist/types/bookmarks/endpoints/bookmark.get.d.ts +1 -1
  88. package/dist/types/bookmarks/endpoints/bookmark.patch.d.ts +1 -1
  89. package/dist/types/bookmarks/endpoints/bookmark.post.d.ts +1 -1
  90. package/dist/types/bookmarks/endpoints/user-bookmark-favourite.delete.d.ts +1 -1
  91. package/dist/types/bookmarks/endpoints/user-bookmark-favourite.head.d.ts +1 -1
  92. package/dist/types/bookmarks/endpoints/user-bookmark-favourite.post.d.ts +1 -1
  93. package/dist/types/bookmarks/endpoints/user-bookmarks.get.d.ts +1 -1
  94. package/dist/types/bookmarks/selectors.d.ts +1 -1
  95. package/dist/types/bookmarks/types.d.ts +1 -1
  96. package/dist/types/configurator.d.ts +1 -1
  97. package/dist/types/context/client.d.ts +4 -4
  98. package/dist/types/context/get/client.d.ts +3 -2
  99. package/dist/types/context/get/generate-endpoint.d.ts +2 -1
  100. package/dist/types/context/get/generate-parameters.d.ts +2 -1
  101. package/dist/types/context/get/types.d.ts +2 -2
  102. package/dist/types/context/index.d.ts +1 -0
  103. package/dist/types/context/query/client.d.ts +3 -2
  104. package/dist/types/context/query/generate-endpoint.d.ts +11 -1
  105. package/dist/types/context/query/generate-parameters.d.ts +3 -2
  106. package/dist/types/context/query/types.d.ts +2 -2
  107. package/dist/types/context/related/client.d.ts +3 -2
  108. package/dist/types/context/related/generate-endpoint.d.ts +11 -1
  109. package/dist/types/context/related/generate-parameters.d.ts +3 -2
  110. package/dist/types/context/related/types.d.ts +2 -2
  111. package/dist/types/context/static.d.ts +2 -2
  112. package/dist/types/module.d.ts +2 -2
  113. package/dist/types/notification/client.d.ts +9 -9
  114. package/dist/types/notification/notification/delete/client.d.ts +4 -3
  115. package/dist/types/notification/notification/delete/generate-endpoint.d.ts +2 -1
  116. package/dist/types/notification/notification/delete/generate-parameters.d.ts +4 -3
  117. package/dist/types/notification/notification/delete/types.d.ts +3 -3
  118. package/dist/types/notification/notification/get/client.d.ts +4 -3
  119. package/dist/types/notification/notification/get/generate-endpoint.d.ts +2 -1
  120. package/dist/types/notification/notification/get/generate-parameters.d.ts +4 -3
  121. package/dist/types/notification/notification/get/types.d.ts +3 -3
  122. package/dist/types/notification/notification/getAll/client.d.ts +4 -3
  123. package/dist/types/notification/notification/getAll/generate-endpoint.d.ts +2 -1
  124. package/dist/types/notification/notification/getAll/generate-parameters.d.ts +4 -3
  125. package/dist/types/notification/notification/getAll/types.d.ts +3 -3
  126. package/dist/types/notification/notification/patch/client.d.ts +4 -3
  127. package/dist/types/notification/notification/patch/generate-endpoint.d.ts +2 -1
  128. package/dist/types/notification/notification/patch/generate-parameters.d.ts +4 -3
  129. package/dist/types/notification/notification/patch/types.d.ts +3 -3
  130. package/dist/types/notification/notification/post/client.d.ts +4 -3
  131. package/dist/types/notification/notification/post/generate-endpoint.d.ts +2 -1
  132. package/dist/types/notification/notification/post/generate-parameters.d.ts +4 -3
  133. package/dist/types/notification/notification/post/types.d.ts +3 -3
  134. package/dist/types/notification/settings/get/client.d.ts +4 -3
  135. package/dist/types/notification/settings/get/generate-endpoint.d.ts +2 -1
  136. package/dist/types/notification/settings/get/generate-parameters.d.ts +4 -3
  137. package/dist/types/notification/settings/get/types.d.ts +3 -3
  138. package/dist/types/notification/settings/put/client.d.ts +4 -3
  139. package/dist/types/notification/settings/put/generate-endpoint.d.ts +2 -1
  140. package/dist/types/notification/settings/put/generate-parameters.d.ts +4 -3
  141. package/dist/types/notification/settings/put/types.d.ts +3 -3
  142. package/dist/types/notification/static.d.ts +2 -2
  143. package/dist/types/people/api-models.d.ts +2 -2
  144. package/dist/types/people/api-models.v2.d.ts +1 -1
  145. package/dist/types/people/api-models.v4.d.ts +1 -1
  146. package/dist/types/people/client.d.ts +4 -4
  147. package/dist/types/people/person-details/client.d.ts +2 -2
  148. package/dist/types/people/person-details/generate-parameters.d.ts +1 -1
  149. package/dist/types/people/person-details/types.d.ts +1 -1
  150. package/dist/types/people/person-photo/client.d.ts +2 -2
  151. package/dist/types/people/person-photo/generate-parameters.d.ts +1 -1
  152. package/dist/types/people/person-photo/types.d.ts +2 -2
  153. package/dist/types/people/query/client.d.ts +2 -2
  154. package/dist/types/people/query/generate-parameters.d.ts +1 -1
  155. package/dist/types/people/query/types.d.ts +2 -2
  156. package/dist/types/people/static.d.ts +2 -2
  157. package/dist/types/people/utils.d.ts +1 -1
  158. package/dist/types/provider.d.ts +3 -3
  159. package/dist/types/types.d.ts +1 -1
  160. package/dist/types/utils.d.ts +1 -1
  161. package/dist/types/version.d.ts +1 -1
  162. package/package.json +11 -7
  163. package/src/bookmarks/api-version.ts +2 -2
  164. package/src/bookmarks/client.ts +228 -231
  165. package/src/bookmarks/endpoints/bookmark-apply.get.ts +58 -58
  166. package/src/bookmarks/endpoints/bookmark.delete.ts +57 -57
  167. package/src/bookmarks/endpoints/bookmark.get.ts +62 -62
  168. package/src/bookmarks/endpoints/bookmark.patch.ts +78 -78
  169. package/src/bookmarks/endpoints/bookmark.post.ts +68 -68
  170. package/src/bookmarks/endpoints/user-bookmark-favourite.delete.ts +57 -57
  171. package/src/bookmarks/endpoints/user-bookmark-favourite.head.ts +57 -57
  172. package/src/bookmarks/endpoints/user-bookmark-favourite.post.ts +58 -58
  173. package/src/bookmarks/endpoints/user-bookmarks.get.ts +98 -98
  174. package/src/bookmarks/schemas.ts +54 -56
  175. package/src/bookmarks/selectors.ts +24 -24
  176. package/src/bookmarks/types.ts +6 -6
  177. package/src/configurator.ts +3 -3
  178. package/src/context/api-models.ts +19 -19
  179. package/src/context/client.ts +68 -58
  180. package/src/context/get/client.ts +18 -18
  181. package/src/context/get/generate-endpoint.ts +13 -14
  182. package/src/context/get/generate-parameters.ts +9 -9
  183. package/src/context/get/types.ts +20 -20
  184. package/src/context/index.ts +2 -0
  185. package/src/context/query/client.ts +22 -22
  186. package/src/context/query/generate-endpoint.ts +97 -49
  187. package/src/context/query/generate-parameters.ts +10 -10
  188. package/src/context/query/types.ts +25 -25
  189. package/src/context/related/client.ts +22 -22
  190. package/src/context/related/generate-endpoint.ts +92 -45
  191. package/src/context/related/generate-parameters.ts +10 -10
  192. package/src/context/related/types.ts +27 -27
  193. package/src/context/static.ts +3 -3
  194. package/src/errors.ts +6 -6
  195. package/src/module.ts +50 -52
  196. package/src/notification/api-models.ts +36 -36
  197. package/src/notification/client.ts +131 -151
  198. package/src/notification/notification/delete/client.ts +22 -22
  199. package/src/notification/notification/delete/generate-endpoint.ts +13 -14
  200. package/src/notification/notification/delete/generate-parameters.ts +18 -18
  201. package/src/notification/notification/delete/types.ts +21 -21
  202. package/src/notification/notification/get/client.ts +19 -19
  203. package/src/notification/notification/get/generate-endpoint.ts +13 -14
  204. package/src/notification/notification/get/generate-parameters.ts +11 -11
  205. package/src/notification/notification/get/types.ts +21 -21
  206. package/src/notification/notification/getAll/client.ts +22 -22
  207. package/src/notification/notification/getAll/generate-endpoint.ts +13 -14
  208. package/src/notification/notification/getAll/generate-parameters.ts +11 -11
  209. package/src/notification/notification/getAll/types.ts +21 -21
  210. package/src/notification/notification/patch/client.ts +22 -22
  211. package/src/notification/notification/patch/generate-endpoint.ts +13 -14
  212. package/src/notification/notification/patch/generate-parameters.ts +18 -18
  213. package/src/notification/notification/patch/types.ts +22 -22
  214. package/src/notification/notification/post/client.ts +22 -22
  215. package/src/notification/notification/post/generate-endpoint.ts +13 -14
  216. package/src/notification/notification/post/generate-parameters.ts +18 -18
  217. package/src/notification/notification/post/types.ts +31 -31
  218. package/src/notification/settings/get/client.ts +22 -22
  219. package/src/notification/settings/get/generate-endpoint.ts +13 -14
  220. package/src/notification/settings/get/generate-parameters.ts +11 -11
  221. package/src/notification/settings/get/types.ts +21 -21
  222. package/src/notification/settings/put/client.ts +22 -22
  223. package/src/notification/settings/put/generate-endpoint.ts +13 -14
  224. package/src/notification/settings/put/generate-parameters.ts +20 -20
  225. package/src/notification/settings/put/types.ts +20 -20
  226. package/src/notification/static.ts +3 -3
  227. package/src/people/api-models.ts +30 -30
  228. package/src/people/api-models.v2.ts +27 -27
  229. package/src/people/api-models.v4.ts +79 -79
  230. package/src/people/client.ts +73 -77
  231. package/src/people/person-details/client.ts +21 -18
  232. package/src/people/person-details/generate-endpoint.ts +16 -16
  233. package/src/people/person-details/generate-parameters.ts +8 -8
  234. package/src/people/person-details/types.ts +13 -13
  235. package/src/people/person-photo/client.ts +19 -22
  236. package/src/people/person-photo/generate-endpoint.ts +13 -13
  237. package/src/people/person-photo/generate-parameters.ts +8 -8
  238. package/src/people/person-photo/types.ts +8 -8
  239. package/src/people/query/client.ts +20 -18
  240. package/src/people/query/generate-endpoint.ts +14 -14
  241. package/src/people/query/generate-parameters.ts +8 -8
  242. package/src/people/query/types.ts +10 -10
  243. package/src/people/static.ts +2 -2
  244. package/src/people/utils.ts +20 -20
  245. package/src/provider.ts +85 -85
  246. package/src/types.ts +34 -34
  247. package/src/utils.ts +22 -26
  248. package/src/version.ts +1 -1
  249. package/tests/context.test.ts +109 -0
  250. package/tests/mocks/get-context-item.ts +60 -0
  251. package/tests/mocks/index.ts +1 -0
  252. package/tests/setup.ts +73 -0
  253. package/tsconfig.json +4 -3
  254. package/vitest.config.ts +11 -0
@@ -1,61 +1,61 @@
1
- import { IHttpClient, ClientRequestInit } from '@equinor/fusion-framework-module-http/client';
1
+ import type { IHttpClient, ClientRequestInit } from '@equinor/fusion-framework-module-http/client';
2
2
 
3
- import { ApiVersion, ApiContextEntity, ClientMethod } from '..';
3
+ import { ApiVersion, type ApiContextEntity, type ClientMethod } from '..';
4
4
 
5
5
  export { ApiClientArguments, ClientMethod } from '..';
6
6
 
7
7
  export type ApiRelatedContextEntity<T extends ApiVersion> = ApiContextEntity<T> & {
8
- relationSource: string; // "ProjectMaster|OrgChart",
9
- relationType: unknown;
8
+ relationSource: string; // "ProjectMaster|OrgChart",
9
+ relationType: unknown;
10
10
  };
11
11
 
12
12
  export type RelatedContextOdataFilter = {
13
- type?: string[];
13
+ type?: string[];
14
14
  };
15
15
 
16
16
  export type RelatedContextOdataParameters = {
17
- search?: string;
18
- filter?: RelatedContextOdataFilter;
17
+ search?: string;
18
+ filter?: RelatedContextOdataFilter;
19
19
  };
20
20
 
21
21
  type RelatedContextArgs_v1 = {
22
- /** context id */
23
- id: string;
24
- query?: string | RelatedContextOdataParameters;
22
+ /** context id */
23
+ id: string;
24
+ query?: string | RelatedContextOdataParameters;
25
25
  };
26
26
 
27
27
  type RelatedContextArgs_v2 = RelatedContextArgs_v1;
28
28
 
29
29
  type RelatedContextArgTypes = {
30
- [ApiVersion.v1]: RelatedContextArgs_v1;
31
- [ApiVersion.v2]: RelatedContextArgs_v2;
30
+ [ApiVersion.v1]: RelatedContextArgs_v1;
31
+ [ApiVersion.v2]: RelatedContextArgs_v2;
32
32
  };
33
33
 
34
34
  export type RelatedContextArgs<T> = T extends keyof typeof ApiVersion
35
- ? RelatedContextArgTypes[(typeof ApiVersion)[T]]
36
- : { id: string };
35
+ ? RelatedContextArgTypes[(typeof ApiVersion)[T]]
36
+ : { id: string };
37
37
 
38
38
  type RelatedContextResponseTypes = {
39
- [ApiVersion.v1]: Array<ApiRelatedContextEntity<ApiVersion.v1>>;
40
- [ApiVersion.v2]: Array<ApiRelatedContextEntity<ApiVersion.v2>>;
39
+ [ApiVersion.v1]: Array<ApiRelatedContextEntity<ApiVersion.v1>>;
40
+ [ApiVersion.v2]: Array<ApiRelatedContextEntity<ApiVersion.v2>>;
41
41
  };
42
42
 
43
43
  export type RelatedContextResponse<T> = T extends keyof typeof ApiVersion
44
- ? RelatedContextResponseTypes[(typeof ApiVersion)[T]]
45
- : unknown;
44
+ ? RelatedContextResponseTypes[(typeof ApiVersion)[T]]
45
+ : unknown;
46
46
 
47
47
  export type RelatedContextFn<
48
- TVersion extends string = keyof typeof ApiVersion,
49
- TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
50
- TClient extends IHttpClient = IHttpClient,
51
- TResult = RelatedContextResponse<TVersion>,
48
+ TVersion extends string = keyof typeof ApiVersion,
49
+ TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
50
+ TClient extends IHttpClient = IHttpClient,
51
+ TResult = RelatedContextResponse<TVersion>,
52
52
  > = (
53
- args: RelatedContextArgs<TVersion>,
54
- init?: ClientRequestInit<TClient, TResult>,
53
+ args: RelatedContextArgs<TVersion>,
54
+ init?: ClientRequestInit<TClient, TResult>,
55
55
  ) => RelatedContextResult<TVersion, TMethod, TResult>;
56
56
 
57
57
  export type RelatedContextResult<
58
- TVersion extends string = keyof typeof ApiVersion,
59
- TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
60
- TResult = RelatedContextResponse<TVersion>,
58
+ TVersion extends string = keyof typeof ApiVersion,
59
+ TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
60
+ TResult = RelatedContextResponse<TVersion>,
61
61
  > = ClientMethod<TResult>[TMethod];
@@ -1,6 +1,6 @@
1
1
  /** index of api versions of context service */
2
2
  export enum ApiVersion {
3
- 'v1' = '1.0',
4
- /** not in use atm */
5
- 'v2' = '2.0',
3
+ v1 = '1.0',
4
+ /** not in use atm */
5
+ v2 = '2.0',
6
6
  }
package/src/errors.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export class UnsupportedApiVersion extends Error {
2
- constructor(
3
- public readonly version: string | number,
4
- cause?: unknown,
5
- ) {
6
- super(`unsupported version ${version}`, { cause });
7
- }
2
+ constructor(
3
+ public readonly version: string | number,
4
+ cause?: unknown,
5
+ ) {
6
+ super(`unsupported version ${version}`, { cause });
7
+ }
8
8
  }
package/src/module.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  import type {
2
- IModuleConfigurator,
3
- IModulesConfigurator,
4
- Module,
2
+ IModuleConfigurator,
3
+ IModulesConfigurator,
4
+ Module,
5
5
  } from '@equinor/fusion-framework-module';
6
6
  import type { HttpModule, IHttpClientProvider } from '@equinor/fusion-framework-module-http';
7
7
  import type {
8
- ServiceDiscoveryModule,
9
- ServiceDiscoveryProvider,
8
+ ServiceDiscoveryModule,
9
+ ServiceDiscoveryProvider,
10
10
  } from '@equinor/fusion-framework-module-service-discovery';
11
11
 
12
- import { IApiConfigurator, ApiConfigurator } from './configurator';
13
- import { IApiProvider, ApiProvider } from './provider';
12
+ import { type IApiConfigurator, ApiConfigurator } from './configurator';
13
+ import { type IApiProvider, ApiProvider } from './provider';
14
14
 
15
15
  import type { ApiClientFactory } from './types';
16
16
 
@@ -19,52 +19,50 @@ export type ServicesModuleKey = 'services';
19
19
  export const moduleKey: ServicesModuleKey = 'services';
20
20
 
21
21
  export type ServicesModule = Module<
22
- ServicesModuleKey,
23
- IApiProvider,
24
- IApiConfigurator,
25
- [HttpModule, ServiceDiscoveryModule]
22
+ ServicesModuleKey,
23
+ IApiProvider,
24
+ IApiConfigurator,
25
+ [HttpModule, ServiceDiscoveryModule]
26
26
  >;
27
27
 
28
28
  /**
29
29
  * Method to trying to resolve method for creating an IHttpClient
30
30
  */
31
31
  const createDefaultClient =
32
- (http: IHttpClientProvider, serviceDiscovery?: ServiceDiscoveryProvider): ApiClientFactory =>
33
- async (name: string) => {
34
- if (http.hasClient(name)) {
35
- return http.createClient(name);
36
- }
37
- if (serviceDiscovery) {
38
- return serviceDiscovery.createClient(name);
39
- }
40
- throw Error(`failed to create http client for service ${name}`);
41
- };
32
+ (http: IHttpClientProvider, serviceDiscovery?: ServiceDiscoveryProvider): ApiClientFactory =>
33
+ async (name: string) => {
34
+ if (http.hasClient(name)) {
35
+ return http.createClient(name);
36
+ }
37
+ if (serviceDiscovery) {
38
+ return serviceDiscovery.createClient(name);
39
+ }
40
+ throw Error(`failed to create http client for service ${name}`);
41
+ };
42
42
 
43
43
  /**
44
44
  * Configure http-client
45
45
  */
46
46
  export const module: ServicesModule = {
47
- name: moduleKey,
48
- configure: () => new ApiConfigurator(),
49
- initialize: async ({ ref, config, requireInstance, hasModule }) => {
50
- /** we can not create this callback within the configuration, since it might require other modules. */
51
- if (!config.createClient) {
52
- const http = await requireInstance('http');
53
- const serviceDiscovery: ServiceDiscoveryProvider | undefined = hasModule(
54
- 'serviceDiscovery',
55
- )
56
- ? /** if the module is within module, await creation */
57
- await requireInstance('serviceDiscovery')
58
- : /** try to load parent service discovery provider */
59
- ref?.serviceDiscovery;
47
+ name: moduleKey,
48
+ configure: () => new ApiConfigurator(),
49
+ initialize: async ({ ref, config, requireInstance, hasModule }) => {
50
+ /** we can not create this callback within the configuration, since it might require other modules. */
51
+ if (!config.createClient) {
52
+ const http = await requireInstance('http');
53
+ const serviceDiscovery: ServiceDiscoveryProvider | undefined = hasModule('serviceDiscovery')
54
+ ? /** if the module is within module, await creation */
55
+ await requireInstance('serviceDiscovery')
56
+ : /** try to load parent service discovery provider */
57
+ ref?.serviceDiscovery;
60
58
 
61
- config.createClient = createDefaultClient(http, serviceDiscovery);
62
- }
63
- if (!config.createClient) {
64
- throw Error('missing configuration for creating API client');
65
- }
66
- return new ApiProvider(config as Required<IApiConfigurator>);
67
- },
59
+ config.createClient = createDefaultClient(http, serviceDiscovery);
60
+ }
61
+ if (!config.createClient) {
62
+ throw Error('missing configuration for creating API client');
63
+ }
64
+ return new ApiProvider(config as Required<IApiConfigurator>);
65
+ },
68
66
  };
69
67
 
70
68
  /**
@@ -72,10 +70,10 @@ export const module: ServicesModule = {
72
70
  * @param config - configuration object
73
71
  */
74
72
  export const enableServices = (
75
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
- config: IModulesConfigurator<any, any>,
73
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
74
+ config: IModulesConfigurator<any, any>,
77
75
  ): void => {
78
- config.addConfig({ module });
76
+ config.addConfig({ module });
79
77
  };
80
78
 
81
79
  /**
@@ -87,18 +85,18 @@ export const enableServices = (
87
85
  * @returns Configuration object
88
86
  */
89
87
  export const configureServices = (
90
- configure: (configurator: IApiConfigurator) => void,
88
+ configure: (configurator: IApiConfigurator) => void,
91
89
  ): IModuleConfigurator<ServicesModule> => {
92
- return {
93
- module,
94
- configure,
95
- };
90
+ return {
91
+ module,
92
+ configure,
93
+ };
96
94
  };
97
95
 
98
96
  declare module '@equinor/fusion-framework-module' {
99
- interface Modules {
100
- services: ServicesModule;
101
- }
97
+ interface Modules {
98
+ services: ServicesModule;
99
+ }
102
100
  }
103
101
 
104
102
  export default module;
@@ -1,70 +1,70 @@
1
1
  import { ApiVersion } from './static';
2
2
 
3
3
  type ApiNotificationEntity_v1 = {
4
- id: string;
5
- appKey: string;
6
- emailPriority: number;
7
- fallbackHtml: string;
8
- targetAzureUniqueId: string;
9
- title: string;
10
- card: string;
11
- created: string;
12
- createdBy: CreatedBy_v1;
13
- createdByApplication: CreatedByApplication_v1;
14
- seenByUser: boolean;
15
- seen: string;
16
- sourceSystem: SourceSystem_v1;
4
+ id: string;
5
+ appKey: string;
6
+ emailPriority: number;
7
+ fallbackHtml: string;
8
+ targetAzureUniqueId: string;
9
+ title: string;
10
+ card: string;
11
+ created: string;
12
+ createdBy: CreatedBy_v1;
13
+ createdByApplication: CreatedByApplication_v1;
14
+ seenByUser: boolean;
15
+ seen: string;
16
+ sourceSystem: SourceSystem_v1;
17
17
  };
18
18
 
19
19
  type SourceSystem_v1 = {
20
- name: string;
21
- subSystem: string;
22
- identifier: string;
20
+ name: string;
21
+ subSystem: string;
22
+ identifier: string;
23
23
  };
24
24
 
25
25
  type CreatedByApplication_v1 = {
26
- id: string;
27
- title: string;
26
+ id: string;
27
+ title: string;
28
28
  };
29
29
 
30
30
  type CreatedBy_v1 = {
31
- id: string;
32
- name: string;
33
- jobTitle: string;
34
- mail: string;
35
- accountType: string;
31
+ id: string;
32
+ name: string;
33
+ jobTitle: string;
34
+ mail: string;
35
+ accountType: string;
36
36
  };
37
37
 
38
38
  type ApiNotificationEntity_v2 = unknown;
39
39
 
40
40
  type ApiNotificationEntityTypes = {
41
- [ApiVersion.v1]: ApiNotificationEntity_v1;
42
- [ApiVersion.v2]: ApiNotificationEntity_v2;
41
+ [ApiVersion.v1]: ApiNotificationEntity_v1;
42
+ [ApiVersion.v2]: ApiNotificationEntity_v2;
43
43
  };
44
44
 
45
45
  export type ApiNotificationEntity<T extends string = ApiVersion> = T extends ApiVersion
46
- ? ApiNotificationEntityTypes[T]
47
- : unknown;
46
+ ? ApiNotificationEntityTypes[T]
47
+ : unknown;
48
48
 
49
49
  /**User notification Settings */
50
50
  type ApiNotificationSettingsEntity_v1 = {
51
- email: boolean;
52
- delayInMinutes: number;
53
- appConfig: AppConfig_v1[];
51
+ email: boolean;
52
+ delayInMinutes: number;
53
+ appConfig: AppConfig_v1[];
54
54
  };
55
55
 
56
56
  type AppConfig_v1 = {
57
- appKey: string;
58
- enabled: boolean;
57
+ appKey: string;
58
+ enabled: boolean;
59
59
  };
60
60
 
61
61
  type ApiNotificationSettingsEntity_v2 = unknown;
62
62
 
63
63
  type ApiNotificationSettingEntityTypes = {
64
- [ApiVersion.v1]: ApiNotificationSettingsEntity_v1;
65
- [ApiVersion.v2]: ApiNotificationSettingsEntity_v2;
64
+ [ApiVersion.v1]: ApiNotificationSettingsEntity_v1;
65
+ [ApiVersion.v2]: ApiNotificationSettingsEntity_v2;
66
66
  };
67
67
 
68
68
  export type ApiNotificationSettingsEntity<T extends string = ApiVersion> = T extends ApiVersion
69
- ? ApiNotificationSettingEntityTypes[T]
70
- : unknown;
69
+ ? ApiNotificationSettingEntityTypes[T]
70
+ : unknown;