@hahnpro/hpc-api 2025.3.10 → 2025.4.0

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 (187) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/package.json +3 -1
  3. package/src/index.d.ts +2 -16
  4. package/src/index.js +2 -15
  5. package/src/lib/api-base.d.ts +3 -3
  6. package/src/lib/api.d.ts +6 -20
  7. package/src/lib/api.js +18 -32
  8. package/src/lib/interfaces/ai.interface.d.ts +1 -1
  9. package/src/lib/{alert.interface.d.ts → interfaces/alert.interface.d.ts} +1 -1
  10. package/src/lib/interfaces/asset.interface.d.ts +1 -2
  11. package/src/lib/{content.interface.d.ts → interfaces/content.interface.d.ts} +1 -2
  12. package/src/lib/{data.interface.d.ts → interfaces/data.interface.d.ts} +4 -4
  13. package/src/lib/interfaces/event.interface.d.ts +1 -1
  14. package/src/lib/{flow-deployment.interface.d.ts → interfaces/flow-deployment.interface.d.ts} +1 -3
  15. package/src/lib/{flow-module.interface.d.ts → interfaces/flow-module.interface.d.ts} +1 -1
  16. package/src/lib/{flow.interface.d.ts → interfaces/flow.interface.d.ts} +1 -3
  17. package/src/lib/interfaces/http.interface.d.ts +13 -0
  18. package/src/lib/interfaces/index.d.ts +29 -7
  19. package/src/lib/interfaces/index.js +11 -0
  20. package/src/lib/interfaces/invitation-representation.interface.d.ts +48 -0
  21. package/src/lib/interfaces/keycloak-profile.interface.d.ts +12 -0
  22. package/src/lib/interfaces/label.interface.d.ts +1 -1
  23. package/src/lib/{notification-rule.interface.d.ts → interfaces/notification-rule.interface.d.ts} +1 -1
  24. package/src/lib/interfaces/organization-role-representation.interface.d.ts +37 -0
  25. package/src/lib/interfaces/organization.interface.d.ts +74 -0
  26. package/src/lib/interfaces/organizations-resources.interface.d.ts +9 -0
  27. package/src/lib/interfaces/secret.interface.js +2 -0
  28. package/src/lib/interfaces/storage.interface.js +2 -0
  29. package/src/lib/{task.interface.d.ts → interfaces/task.interface.d.ts} +11 -8
  30. package/src/lib/interfaces/task.interface.js +2 -0
  31. package/src/lib/interfaces/user-settings.interface.js +2 -0
  32. package/src/lib/interfaces/vault.interface.js +2 -0
  33. package/src/lib/mock/ai.mock.service.d.ts +5 -8
  34. package/src/lib/mock/ai.mock.service.js +5 -2
  35. package/src/lib/mock/alert.mock.service.d.ts +6 -0
  36. package/src/lib/mock/alert.mock.service.js +11 -0
  37. package/src/lib/mock/api-base.mock.d.ts +5 -3
  38. package/src/lib/mock/api-base.mock.js +8 -2
  39. package/src/lib/mock/api.mock.d.ts +16 -47
  40. package/src/lib/mock/api.mock.js +28 -38
  41. package/src/lib/mock/asset.mock.service.d.ts +6 -12
  42. package/src/lib/mock/asset.mock.service.js +3 -5
  43. package/src/lib/mock/assetTypes.mock.service.d.ts +4 -7
  44. package/src/lib/mock/assetTypes.mock.service.js +3 -5
  45. package/src/lib/mock/content.mock.service.d.ts +4 -7
  46. package/src/lib/mock/content.mock.service.js +10 -12
  47. package/src/lib/mock/data.mock.service.d.ts +10 -13
  48. package/src/lib/mock/data.mock.service.js +21 -36
  49. package/src/lib/mock/endpoint.mock.service.d.ts +3 -3
  50. package/src/lib/mock/endpoint.mock.service.js +2 -2
  51. package/src/lib/mock/event.mock.service.d.ts +1 -1
  52. package/src/lib/mock/event.mock.service.js +2 -2
  53. package/src/lib/mock/flow-deployment.mock.service.d.ts +3 -7
  54. package/src/lib/mock/flow-deployment.mock.service.js +14 -6
  55. package/src/lib/mock/flow-functions.mock.service.d.ts +4 -5
  56. package/src/lib/mock/flow-functions.mock.service.js +2 -2
  57. package/src/lib/mock/flow-modules.mock.service.d.ts +3 -5
  58. package/src/lib/mock/flow-modules.mock.service.js +2 -2
  59. package/src/lib/mock/flow.mock.service.d.ts +5 -9
  60. package/src/lib/mock/flow.mock.service.js +3 -5
  61. package/src/lib/mock/{http.mock.service.d.ts → http-client.mock.service.d.ts} +3 -2
  62. package/src/lib/mock/{http.mock.service.js → http-client.mock.service.js} +4 -4
  63. package/src/lib/mock/index.d.ts +28 -12
  64. package/src/lib/mock/index.js +57 -12
  65. package/src/lib/mock/label.mock.service.d.ts +2 -2
  66. package/src/lib/mock/label.mock.service.js +2 -2
  67. package/src/lib/mock/notification-rules.mock.service.d.ts +5 -0
  68. package/src/lib/mock/notification-rules.mock.service.js +11 -0
  69. package/src/lib/mock/notification.mock.service.d.ts +3 -3
  70. package/src/lib/mock/notification.mock.service.js +2 -2
  71. package/src/lib/mock/organizations-administration.mock.service.d.ts +17 -0
  72. package/src/lib/mock/organizations-administration.mock.service.js +93 -0
  73. package/src/lib/mock/organizations-resources.mock.service.d.ts +12 -0
  74. package/src/lib/mock/organizations-resources.mock.service.js +24 -0
  75. package/src/lib/mock/organizations.mock.service.d.ts +29 -0
  76. package/src/lib/mock/organizations.mock.service.js +90 -0
  77. package/src/lib/mock/search.mock.service.d.ts +3 -4
  78. package/src/lib/mock/search.mock.service.js +2 -2
  79. package/src/lib/mock/secret.mock.service.d.ts +4 -7
  80. package/src/lib/mock/secret.mock.service.js +3 -5
  81. package/src/lib/mock/task.mock.service.d.ts +8 -12
  82. package/src/lib/mock/task.mock.service.js +4 -6
  83. package/src/lib/mock/timeseries.mock.service.d.ts +5 -8
  84. package/src/lib/mock/timeseries.mock.service.js +3 -5
  85. package/src/lib/mock/trash.mock.service.d.ts +6 -8
  86. package/src/lib/mock/trash.mock.service.js +3 -4
  87. package/src/lib/mock/user.mock.service.d.ts +1 -1
  88. package/src/lib/mock/user.mock.service.js +2 -2
  89. package/src/lib/mock/utils/index.d.ts +1 -0
  90. package/src/lib/mock/utils/index.js +5 -0
  91. package/src/lib/mock/utils/sort-data.function.d.ts +1 -0
  92. package/src/lib/mock/utils/sort-data.function.js +17 -0
  93. package/src/lib/mock/vault.mock.service.d.ts +3 -3
  94. package/src/lib/mock/vault.mock.service.js +2 -2
  95. package/src/lib/services/ai.service.d.ts +4 -5
  96. package/src/lib/services/alert.service.d.ts +5 -0
  97. package/src/lib/{alert.service.js → services/alert.service.js} +2 -2
  98. package/src/lib/services/asset.service.d.ts +6 -10
  99. package/src/lib/services/asset.service.js +3 -4
  100. package/src/lib/services/assettypes.service.d.ts +4 -7
  101. package/src/lib/services/assettypes.service.js +2 -3
  102. package/src/lib/{content.service.d.ts → services/content.service.d.ts} +5 -7
  103. package/src/lib/{content.service.js → services/content.service.js} +11 -12
  104. package/src/lib/{data.service.d.ts → services/data.service.d.ts} +4 -6
  105. package/src/lib/{data.service.js → services/data.service.js} +3 -21
  106. package/src/lib/{endpoint.service.d.ts → services/endpoint.service.d.ts} +3 -4
  107. package/src/lib/{endpoint.service.js → services/endpoint.service.js} +2 -2
  108. package/src/lib/services/event.service.d.ts +3 -4
  109. package/src/lib/services/event.service.js +2 -2
  110. package/src/lib/{flow-deployment.service.d.ts → services/flow-deployment.service.d.ts} +4 -7
  111. package/src/lib/{flow-deployment.service.js → services/flow-deployment.service.js} +3 -4
  112. package/src/lib/{flow-function.service.d.ts → services/flow-function.service.d.ts} +4 -6
  113. package/src/lib/{flow-function.service.js → services/flow-function.service.js} +2 -2
  114. package/src/lib/{flow-module.service.d.ts → services/flow-module.service.d.ts} +4 -5
  115. package/src/lib/{flow-module.service.js → services/flow-module.service.js} +3 -3
  116. package/src/lib/{flow.service.d.ts → services/flow.service.d.ts} +6 -10
  117. package/src/lib/{flow.service.js → services/flow.service.js} +3 -4
  118. package/src/lib/{http.service.d.ts → services/http-client.service.d.ts} +8 -16
  119. package/src/lib/{http.service.js → services/http-client.service.js} +42 -6
  120. package/src/lib/services/index.d.ts +20 -0
  121. package/src/lib/services/index.js +41 -1
  122. package/src/lib/services/label.service.d.ts +3 -4
  123. package/src/lib/services/label.service.js +2 -2
  124. package/src/lib/services/notification-rule.service.d.ts +5 -0
  125. package/src/lib/{notification-rule.service.js → services/notification-rule.service.js} +2 -2
  126. package/src/lib/services/notification.service.d.ts +5 -0
  127. package/src/lib/{notification.service.js → services/notification.service.js} +2 -2
  128. package/src/lib/services/organizations-administration.service.d.ts +56 -0
  129. package/src/lib/services/organizations-administration.service.js +84 -0
  130. package/src/lib/services/organizations-resources.service.d.ts +35 -0
  131. package/src/lib/services/organizations-resources.service.js +61 -0
  132. package/src/lib/services/organizations.service.d.ts +167 -0
  133. package/src/lib/services/organizations.service.js +216 -0
  134. package/src/lib/{proxy.service.d.ts → services/proxy.service.d.ts} +3 -2
  135. package/src/lib/services/search.service.d.ts +3 -3
  136. package/src/lib/services/secret.service.d.ts +11 -0
  137. package/src/lib/{secret.service.js → services/secret.service.js} +3 -4
  138. package/src/lib/{task.service.d.ts → services/task.service.d.ts} +8 -11
  139. package/src/lib/{task.service.js → services/task.service.js} +3 -4
  140. package/src/lib/services/timeseries.service.d.ts +4 -7
  141. package/src/lib/services/timeseries.service.js +2 -3
  142. package/src/lib/{trash.service.d.ts → services/trash.service.d.ts} +3 -3
  143. package/src/lib/{trash.service.js → services/trash.service.js} +1 -1
  144. package/src/lib/{user.service.d.ts → services/user.service.d.ts} +3 -3
  145. package/src/lib/services/vault.service.d.ts +6 -0
  146. package/src/lib/{vault.service.js → services/vault.service.js} +2 -2
  147. package/src/lib/utils.d.ts +2 -0
  148. package/src/lib/utils.js +21 -0
  149. package/src/lib/alert.service.d.ts +0 -6
  150. package/src/lib/mock/organization.mock.service.d.ts +0 -10
  151. package/src/lib/mock/organization.mock.service.js +0 -44
  152. package/src/lib/notification-rule.service.d.ts +0 -6
  153. package/src/lib/notification.service.d.ts +0 -6
  154. package/src/lib/organization.interface.d.ts +0 -36
  155. package/src/lib/organization.service.d.ts +0 -10
  156. package/src/lib/organization.service.js +0 -22
  157. package/src/lib/secret.service.d.ts +0 -13
  158. package/src/lib/vault.service.d.ts +0 -7
  159. /package/src/lib/{alert.interface.js → interfaces/alert.interface.js} +0 -0
  160. /package/src/lib/{content.interface.js → interfaces/content.interface.js} +0 -0
  161. /package/src/lib/{data.interface.js → interfaces/data.interface.js} +0 -0
  162. /package/src/lib/{endpoint.interface.d.ts → interfaces/endpoint.interface.d.ts} +0 -0
  163. /package/src/lib/{endpoint.interface.js → interfaces/endpoint.interface.js} +0 -0
  164. /package/src/lib/{flow-deployment.interface.js → interfaces/flow-deployment.interface.js} +0 -0
  165. /package/src/lib/{flow-function.interface.d.ts → interfaces/flow-function.interface.d.ts} +0 -0
  166. /package/src/lib/{flow-function.interface.js → interfaces/flow-function.interface.js} +0 -0
  167. /package/src/lib/{flow-module.interface.js → interfaces/flow-module.interface.js} +0 -0
  168. /package/src/lib/{flow.interface.js → interfaces/flow.interface.js} +0 -0
  169. /package/src/lib/{notification-rule.interface.js → interfaces/http.interface.js} +0 -0
  170. /package/src/lib/{notification.interface.js → interfaces/invitation-representation.interface.js} +0 -0
  171. /package/src/lib/{organization.interface.js → interfaces/keycloak-profile.interface.js} +0 -0
  172. /package/src/lib/{schema.interface.js → interfaces/notification-rule.interface.js} +0 -0
  173. /package/src/lib/{notification.interface.d.ts → interfaces/notification.interface.d.ts} +0 -0
  174. /package/src/lib/{secret.interface.js → interfaces/notification.interface.js} +0 -0
  175. /package/src/lib/{storage.interface.js → interfaces/organization-role-representation.interface.js} +0 -0
  176. /package/src/lib/{task.interface.js → interfaces/organization.interface.js} +0 -0
  177. /package/src/lib/{user-settings.interface.js → interfaces/organizations-resources.interface.js} +0 -0
  178. /package/src/lib/{schema.interface.d.ts → interfaces/schema.interface.d.ts} +0 -0
  179. /package/src/lib/{vault.interface.js → interfaces/schema.interface.js} +0 -0
  180. /package/src/lib/{secret.interface.d.ts → interfaces/secret.interface.d.ts} +0 -0
  181. /package/src/lib/{storage.interface.d.ts → interfaces/storage.interface.d.ts} +0 -0
  182. /package/src/lib/{user-settings.interface.d.ts → interfaces/user-settings.interface.d.ts} +0 -0
  183. /package/src/lib/{vault.interface.d.ts → interfaces/vault.interface.d.ts} +0 -0
  184. /package/src/lib/{Queue.d.ts → queue.d.ts} +0 -0
  185. /package/src/lib/{Queue.js → queue.js} +0 -0
  186. /package/src/lib/{proxy.service.js → services/proxy.service.js} +0 -0
  187. /package/src/lib/{user.service.js → services/user.service.js} +0 -0
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrganizationsAdministrationService = void 0;
4
+ const api_base_1 = require("../api-base");
5
+ const utils_1 = require("../utils");
6
+ /**
7
+ * Service for managing organizations with administrative privileges (superuser role required).
8
+ */
9
+ class OrganizationsAdministrationService extends api_base_1.APIBase {
10
+ constructor(httpClient) {
11
+ super(httpClient, '/organizations-administration');
12
+ }
13
+ /**
14
+ * Gets one organization by id, combining data from Keycloak and MongoDB.
15
+ *
16
+ * @param {string} id - The ID of the organization to retrieve.
17
+ * @returns {Promise<Organization>} - An promise containing the combined organization data from Keycloak and MongoDB.
18
+ */
19
+ getOneCombined(id) {
20
+ return this.httpClient.get(`${this.basePath}/${id}`);
21
+ }
22
+ /**
23
+ * Get many organizations with pagination, filtering, and sorting options.
24
+ *
25
+ * @param {RequestParameter} params - The request parameters for pagination, filtering, and sorting.
26
+ * @returns {Promise<Paginated<Organization>>} - An observable containing the paginated list of organizations.
27
+ */
28
+ async getMany(params = {}) {
29
+ params.limit = params.limit || 0;
30
+ params.page = params.page || 1;
31
+ return this.httpClient.get(`${this.basePath}`, { params });
32
+ }
33
+ /**
34
+ * Get many organizations filtered by specific properties with pagination, filtering, and sorting options.
35
+ *
36
+ * @param {Filter} filter - The filter object containing properties to filter by.
37
+ * @param {RequestParameter} params - The request parameters for pagination, filtering, and sorting.
38
+ * @returns {Promise<Paginated<Organization>>} - An observable containing the paginated list of organizations.
39
+ */
40
+ async getManyFiltered(filter, params = {}) {
41
+ params.filter = (0, utils_1.getFilterString)(filter);
42
+ return this.getMany(params);
43
+ }
44
+ /**
45
+ * Searches for all organizations using the organization client.
46
+ *
47
+ * @param {OrganizationSearchQuery} query - The search query object containing optional filters.
48
+ * @param {string} query.name - The name of the organization to filter by (optional).
49
+ * @returns {Promise<Organization[]>} - An observable containing an array of organizations matching the query.
50
+ */
51
+ searchAllOrganizationWithOrganizationClient(query) {
52
+ const params = query.name ? { name: query.name } : {};
53
+ return this.httpClient.get(`${this.basePath}/search`, { params });
54
+ }
55
+ /**
56
+ * Creates an organization with a free subscription and invites a user to that organization
57
+ *
58
+ * @param {OrganizationCreateDto} organizationCreateDto - The data transfer object containing the organization details for creation
59
+ * @param {string} userEmail - The email address of the user to be invited to the organization
60
+ * @returns {Promise<Organization>} - An observable containing the created organization
61
+ */
62
+ createFreeOrgAndInviteUser(organizationCreateDto, userEmail) {
63
+ return this.httpClient.post(`${this.basePath}/create-free-org-invite-users`, {
64
+ organizationDto: organizationCreateDto,
65
+ userEmail,
66
+ });
67
+ }
68
+ async addOrganizationMembers(id, usersWithOrgRoles) {
69
+ return this.httpClient.post(`${this.basePath}/${id}/members`, { usersWithOrgRoles });
70
+ }
71
+ async addSubscriptionToOrganization(id, type) {
72
+ return this.httpClient.post(`${this.basePath}/${id}/subscription`, { type });
73
+ }
74
+ /**
75
+ * Deletes an organization.
76
+ *
77
+ * @param {string} id - organization id
78
+ * @returns {Promise<void>} - Promise resolving to void
79
+ */
80
+ deleteOne(id) {
81
+ return this.httpClient.delete(`${this.basePath}/${id}`);
82
+ }
83
+ }
84
+ exports.OrganizationsAdministrationService = OrganizationsAdministrationService;
@@ -0,0 +1,35 @@
1
+ import { Observable } from 'rxjs';
2
+ import { APIBase } from '../api-base';
3
+ import { OrganizationResourcesProgressDto } from '../interfaces';
4
+ import { HttpClientService } from './';
5
+ export declare class OrganizationsResourcesService extends APIBase {
6
+ constructor(httpClient: HttpClientService);
7
+ /**
8
+ * Fetches the names of all available resource sets.
9
+ * @returns {Promise<string[]>} A promise that resolves to an array of resource set names.
10
+ */
11
+ getResourceSetNames(): Promise<string[]>;
12
+ /**
13
+ * Starts the creation of resources for a specific organization based on the provided resource set name.
14
+ *
15
+ * The progress status update messages can be received by subscribing to the `getResourceCreationProgress` method with the same organization ID.
16
+ *
17
+ * @param {string} organizationId - The ID of the organization for which resources are to be created.
18
+ * @param {string} resourceSetName - The name of the resource set to be used for resource creation from the S3 bucket.
19
+ * @returns {Promise<string[]>} A promise that resolves to an array of resource set names.
20
+ */
21
+ createResourcesForOrganization(organizationId: string, resourceSetName: string): Promise<string>;
22
+ /**
23
+ * Subscribes to server-sent events to receive real-time progress updates on the resource tasks for a specific organization.
24
+ * @param {string} organizationId - The ID of the organization to monitor the resources progress updates for.
25
+ * @param {string} path - The API path segment for the SSE endpoint
26
+ * @returns {Observable<OrganizationResourcesProgress>} An observable that emits progress updates.
27
+ */
28
+ getSseObservable(organizationId: string, path: 'creationTask'): Observable<OrganizationResourcesProgressDto>;
29
+ /**
30
+ * Subscribes to server-sent events to receive real-time progress updates on the resource creation task for a specific organization.
31
+ * @param {string} organizationId - The ID of the organization to monitor the resource creation progress for.
32
+ * @returns {Observable<OrganizationResourcesProgress>} An observable that emits progress updates.
33
+ */
34
+ getResourceCreationProgress(organizationId: string): Observable<OrganizationResourcesProgressDto>;
35
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrganizationsResourcesService = void 0;
4
+ const api_base_1 = require("../api-base");
5
+ class OrganizationsResourcesService extends api_base_1.APIBase {
6
+ constructor(httpClient) {
7
+ super(httpClient, '/organizations-resources');
8
+ }
9
+ /**
10
+ * Fetches the names of all available resource sets.
11
+ * @returns {Promise<string[]>} A promise that resolves to an array of resource set names.
12
+ */
13
+ getResourceSetNames() {
14
+ return this.httpClient.get(`${this.basePath}/set-names`);
15
+ }
16
+ /**
17
+ * Starts the creation of resources for a specific organization based on the provided resource set name.
18
+ *
19
+ * The progress status update messages can be received by subscribing to the `getResourceCreationProgress` method with the same organization ID.
20
+ *
21
+ * @param {string} organizationId - The ID of the organization for which resources are to be created.
22
+ * @param {string} resourceSetName - The name of the resource set to be used for resource creation from the S3 bucket.
23
+ * @returns {Promise<string[]>} A promise that resolves to an array of resource set names.
24
+ */
25
+ createResourcesForOrganization(organizationId, resourceSetName) {
26
+ return this.httpClient.post(`${this.basePath}/${organizationId}`, { resourceSetName });
27
+ }
28
+ /**
29
+ * Subscribes to server-sent events to receive real-time progress updates on the resource tasks for a specific organization.
30
+ * @param {string} organizationId - The ID of the organization to monitor the resources progress updates for.
31
+ * @param {string} path - The API path segment for the SSE endpoint
32
+ * @returns {Observable<OrganizationResourcesProgress>} An observable that emits progress updates.
33
+ */
34
+ getSseObservable(organizationId, path) {
35
+ return this.httpClient.getSseObservable(`${this.basePath}/${path}/${organizationId}`, (subject, event) => {
36
+ if (event.data) {
37
+ try {
38
+ const data = JSON.parse(event.data);
39
+ if ('message' in data) {
40
+ subject.error(data);
41
+ }
42
+ else {
43
+ subject.next(data);
44
+ }
45
+ }
46
+ catch (err) {
47
+ subject.next(event.data);
48
+ }
49
+ }
50
+ });
51
+ }
52
+ /**
53
+ * Subscribes to server-sent events to receive real-time progress updates on the resource creation task for a specific organization.
54
+ * @param {string} organizationId - The ID of the organization to monitor the resource creation progress for.
55
+ * @returns {Observable<OrganizationResourcesProgress>} An observable that emits progress updates.
56
+ */
57
+ getResourceCreationProgress(organizationId) {
58
+ return this.getSseObservable(organizationId, 'creationTask');
59
+ }
60
+ }
61
+ exports.OrganizationsResourcesService = OrganizationsResourcesService;
@@ -0,0 +1,167 @@
1
+ import { OrganizationRoleRepresentation } from '@p2-inc/js-sdk';
2
+ import { APIBase } from '../api-base';
3
+ import { KeycloakProfile, Organization, OrganizationCreateDto, OrganizationData, OrganizationDataKind, OrganizationName, OrganizationRolesAdjustment } from '../interfaces';
4
+ import { HttpClientService } from './';
5
+ export declare class OrganizationsService extends APIBase {
6
+ constructor(httpClientClient: HttpClientService);
7
+ /**
8
+ * Create an organization.
9
+ *
10
+ * @param dto organization information
11
+ * @returns newly created organization
12
+ */
13
+ addOne(dto: OrganizationCreateDto): Promise<Organization>;
14
+ /**
15
+ * Invite a user to an organization.
16
+ *
17
+ * @param id organization id
18
+ * @param email email address of user
19
+ * @param roles roles (names) which the user should get in the organization
20
+ * @returns newly created invitation
21
+ */
22
+ addOrganizationInvitation(id: string, email: string, roles: string[]): Promise<void>;
23
+ /**
24
+ * Add organization role to an organization.
25
+ *
26
+ * @param id organization id
27
+ * @param roleDto organization role information
28
+ * @returns all organization roles
29
+ */
30
+ addOrganizationRole(id: string, roleDto: OrganizationRoleRepresentation): Promise<OrganizationRoleRepresentation[]>;
31
+ /**
32
+ * Grants or revoke roles which the selected user should have in the provided organization.
33
+ *
34
+ * @param id organization id
35
+ * @param roles information about which roles should be revoked or added
36
+ * @param userId id of a user whose organization roles are adjusted
37
+ */
38
+ grantOrRevokeRolesOfUser(id: string, roles: OrganizationRolesAdjustment, userId: string): Promise<void>;
39
+ /**
40
+ * Resend an invitation to an organization.
41
+ *
42
+ * @param id organization id
43
+ * @param invitationId
44
+ */
45
+ resendOrganizationInvitation(id: string, invitationId: string): Promise<Response>;
46
+ /**
47
+ * Requests the deletion of an organization.
48
+ *
49
+ * @param id organization id
50
+ */
51
+ requestDeletion(id: string): Promise<void>;
52
+ /**
53
+ * Set a (new) active organization for the current user.
54
+ *
55
+ * @param id organization id
56
+ */
57
+ setActiveOrganizationOfUser(id: string): Promise<void>;
58
+ /**
59
+ * Updates an organization.
60
+ *
61
+ * @param id organization id
62
+ * @param dto organization information
63
+ * @returns updated organization
64
+ */
65
+ updateOne(id: string, dto: any): Promise<Organization>;
66
+ /**
67
+ * Updates an organization role.
68
+ *
69
+ * @param id organization id
70
+ * @param roleName name of the role which shall be updated
71
+ * @param dto organization role information
72
+ * @returns organization roles (array of all roles belonging to the organization)
73
+ */
74
+ updateOrganizationRole(id: string, roleName: string, dto: OrganizationRoleRepresentation): Promise<OrganizationRoleRepresentation[]>;
75
+ /**
76
+ * Checks whether the organization name is already used (throws Exception).
77
+ *
78
+ * @param {string} name - Organization name
79
+ */
80
+ checkForOrganizationUniqueness(name: string): Promise<void>;
81
+ /**
82
+ * Get active organization for the current user
83
+ */
84
+ getActiveOrganizationOfUser(): Promise<Organization>;
85
+ /**
86
+ * Retrieves a single organization of the user by its ID.
87
+ *
88
+ * @param {string} id - The unique identifier of the organization to retrieve.
89
+ * @returns {Promise<Organization>} - The organization
90
+ */
91
+ getOneCombined(id: string): Promise<Organization>;
92
+ /**
93
+ * Returns data belonging to the organization identified by the provided id.
94
+ * A subset of all data is selected defined by the 'kinds' parameter.
95
+ *
96
+ * @param {string} id - organization id
97
+ * @param {string} kinds - array of requested data types ( selection of: ['members', 'invitations', 'roles', 'domains', 'userRoles'])
98
+ * @returns{Promise<OrganizationData>} organizationData (only selected kinds are returned)
99
+ */
100
+ getOrganizationData(id: string, kinds?: OrganizationDataKind[]): Promise<OrganizationData>;
101
+ /**
102
+ * Returns the member with the provided id
103
+ *
104
+ * @param {string} id - organization id
105
+ * @param {string} userId - user id of requested member
106
+ * @returns {Promise<KeycloakProfile>} member
107
+ */
108
+ getOrganizationMemberById(id: string, userId: string): Promise<KeycloakProfile>;
109
+ /**
110
+ * Returns the names of organizations with the provided ids.
111
+ *
112
+ * @param {string[]} ids - Ids of the organizations
113
+ * @returns array of organization name objects
114
+ */
115
+ getOrganizationNamesByIds(ids: string[]): Promise<OrganizationName[]>;
116
+ /**
117
+ * Returns the id of an organization with the provided name.
118
+ *
119
+ * @param {string} name - name of the organization
120
+ * @returns id of the organization, if it exists
121
+ */
122
+ getOrganizationIdByName(name: string): Promise<OrganizationName>;
123
+ /**
124
+ * Returns an array of organizations where the current user is a member.
125
+ *
126
+ * @returns {Promise<Organization[]>} - Organizations (array of organizations)
127
+ */
128
+ getMyOrganizations(): Promise<Organization[]>;
129
+ /**
130
+ * Returns an array of organizations where the user is a member.
131
+ *
132
+ * @returns organizations (array of organizations)
133
+ */
134
+ getUserOrganizations(userId: string): Promise<Organization[]>;
135
+ /**
136
+ * Returns an array of roles which the selected user has in the provided organizations.
137
+ *
138
+ * @param ids organization ids
139
+ * @param userId id of a user whose organization roles are requested
140
+ * @returns records with organization id and array user roles of that organization
141
+ */
142
+ getUserOrganizationRoles(ids: string[], userId: string): Promise<Record<string, OrganizationRoleRepresentation[]>>;
143
+ /**
144
+ * Returns whether the subscription is actively used by an organization.
145
+ *
146
+ * @param {string} subscriptionId - Subscription ID from an azure marketplace subscription
147
+ * @returns boolean (whether subscription is active)
148
+ */
149
+ hasActiveSubscription(subscriptionId: string): Promise<boolean>;
150
+ /**
151
+ * Deletes organization data.
152
+ *
153
+ * @comment Domains are deleted using the updateOne method
154
+ * @param {string} id - Organization id
155
+ * @param {string} elementId - ID belonging to an element of the provided kind
156
+ * @param {OrganizationDataKind} kind - Requested data type (one of: ['members', 'invitations', 'roles', 'userRoles'])
157
+ * @returns {Promise<OrganizationData>}
158
+ */
159
+ deleteOrganizationData(id: string, elementId: string, kind: OrganizationDataKind): Promise<OrganizationData>;
160
+ /**
161
+ * Removes the current user from the members of the provided organization.
162
+ *
163
+ * @param {string} id - organization id
164
+ * @returns {Promise<void>}
165
+ */
166
+ leaveOrganization(id: string): Promise<void>;
167
+ }
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrganizationsService = void 0;
4
+ const api_base_1 = require("../api-base");
5
+ class OrganizationsService extends api_base_1.APIBase {
6
+ constructor(httpClientClient) {
7
+ super(httpClientClient, '/organizations');
8
+ }
9
+ /**
10
+ * Create an organization.
11
+ *
12
+ * @param dto organization information
13
+ * @returns newly created organization
14
+ */
15
+ addOne(dto) {
16
+ return this.httpClient.post(this.basePath, dto);
17
+ }
18
+ /**
19
+ * Invite a user to an organization.
20
+ *
21
+ * @param id organization id
22
+ * @param email email address of user
23
+ * @param roles roles (names) which the user should get in the organization
24
+ * @returns newly created invitation
25
+ */
26
+ addOrganizationInvitation(id, email, roles) {
27
+ return this.httpClient.post(`${this.basePath}/${id}/data/invitations`, { roles, email });
28
+ }
29
+ /**
30
+ * Add organization role to an organization.
31
+ *
32
+ * @param id organization id
33
+ * @param roleDto organization role information
34
+ * @returns all organization roles
35
+ */
36
+ addOrganizationRole(id, roleDto) {
37
+ return this.httpClient.post(`${this.basePath}/${id}/data/roles`, roleDto);
38
+ }
39
+ /**
40
+ * Grants or revoke roles which the selected user should have in the provided organization.
41
+ *
42
+ * @param id organization id
43
+ * @param roles information about which roles should be revoked or added
44
+ * @param userId id of a user whose organization roles are adjusted
45
+ */
46
+ grantOrRevokeRolesOfUser(id, roles, userId) {
47
+ return this.httpClient.put(`${this.basePath}/${id}/data/roles/users/${userId}`, roles);
48
+ }
49
+ /**
50
+ * Resend an invitation to an organization.
51
+ *
52
+ * @param id organization id
53
+ * @param invitationId
54
+ */
55
+ resendOrganizationInvitation(id, invitationId) {
56
+ return this.httpClient.put(`${this.basePath}/${id}/data/invitations/${invitationId}/resend`, {});
57
+ }
58
+ /**
59
+ * Requests the deletion of an organization.
60
+ *
61
+ * @param id organization id
62
+ */
63
+ requestDeletion(id) {
64
+ return this.httpClient.put(`${this.basePath}/${id}/request-deletion`, {});
65
+ }
66
+ /**
67
+ * Set a (new) active organization for the current user.
68
+ *
69
+ * @param id organization id
70
+ */
71
+ setActiveOrganizationOfUser(id) {
72
+ return this.httpClient.put(`${this.basePath}/${id}/active`, {});
73
+ }
74
+ /**
75
+ * Updates an organization.
76
+ *
77
+ * @param id organization id
78
+ * @param dto organization information
79
+ * @returns updated organization
80
+ */
81
+ updateOne(id, dto) {
82
+ return this.httpClient.put(`${this.basePath}/${id}`, dto);
83
+ }
84
+ /**
85
+ * Updates an organization role.
86
+ *
87
+ * @param id organization id
88
+ * @param roleName name of the role which shall be updated
89
+ * @param dto organization role information
90
+ * @returns organization roles (array of all roles belonging to the organization)
91
+ */
92
+ updateOrganizationRole(id, roleName, dto) {
93
+ return this.httpClient.put(`${this.basePath}/${id}/data/roles/${roleName}`, dto);
94
+ }
95
+ /**
96
+ * Checks whether the organization name is already used (throws Exception).
97
+ *
98
+ * @param {string} name - Organization name
99
+ */
100
+ checkForOrganizationUniqueness(name) {
101
+ return this.httpClient.get(`${this.basePath}/unique/${name}`);
102
+ }
103
+ /**
104
+ * Get active organization for the current user
105
+ */
106
+ getActiveOrganizationOfUser() {
107
+ return this.httpClient.get(`${this.basePath}/active`);
108
+ }
109
+ /**
110
+ * Retrieves a single organization of the user by its ID.
111
+ *
112
+ * @param {string} id - The unique identifier of the organization to retrieve.
113
+ * @returns {Promise<Organization>} - The organization
114
+ */
115
+ getOneCombined(id) {
116
+ return this.httpClient.get(`${this.basePath}/${id}/`);
117
+ }
118
+ /**
119
+ * Returns data belonging to the organization identified by the provided id.
120
+ * A subset of all data is selected defined by the 'kinds' parameter.
121
+ *
122
+ * @param {string} id - organization id
123
+ * @param {string} kinds - array of requested data types ( selection of: ['members', 'invitations', 'roles', 'domains', 'userRoles'])
124
+ * @returns{Promise<OrganizationData>} organizationData (only selected kinds are returned)
125
+ */
126
+ getOrganizationData(id, kinds = []) {
127
+ const params = kinds.length > 0 ? { kinds: kinds.join(',') } : {};
128
+ return this.httpClient.get(`${this.basePath}/${id}/data`, { params });
129
+ }
130
+ /**
131
+ * Returns the member with the provided id
132
+ *
133
+ * @param {string} id - organization id
134
+ * @param {string} userId - user id of requested member
135
+ * @returns {Promise<KeycloakProfile>} member
136
+ */
137
+ getOrganizationMemberById(id, userId) {
138
+ return this.httpClient.get(`${this.basePath}/${id}/data/employees/${userId}`);
139
+ }
140
+ /**
141
+ * Returns the names of organizations with the provided ids.
142
+ *
143
+ * @param {string[]} ids - Ids of the organizations
144
+ * @returns array of organization name objects
145
+ */
146
+ getOrganizationNamesByIds(ids) {
147
+ return this.httpClient.post(`${this.basePath}/names`, { ids });
148
+ }
149
+ /**
150
+ * Returns the id of an organization with the provided name.
151
+ *
152
+ * @param {string} name - name of the organization
153
+ * @returns id of the organization, if it exists
154
+ */
155
+ getOrganizationIdByName(name) {
156
+ return this.httpClient.get(`${this.basePath}/names/${name}`);
157
+ }
158
+ /**
159
+ * Returns an array of organizations where the current user is a member.
160
+ *
161
+ * @returns {Promise<Organization[]>} - Organizations (array of organizations)
162
+ */
163
+ getMyOrganizations() {
164
+ return this.httpClient.get(`${this.basePath}/mine`);
165
+ }
166
+ /**
167
+ * Returns an array of organizations where the user is a member.
168
+ *
169
+ * @returns organizations (array of organizations)
170
+ */
171
+ getUserOrganizations(userId) {
172
+ return this.httpClient.get(`${this.basePath}/users/${userId}`);
173
+ }
174
+ /**
175
+ * Returns an array of roles which the selected user has in the provided organizations.
176
+ *
177
+ * @param ids organization ids
178
+ * @param userId id of a user whose organization roles are requested
179
+ * @returns records with organization id and array user roles of that organization
180
+ */
181
+ getUserOrganizationRoles(ids, userId) {
182
+ return this.httpClient.post(`${this.basePath}/users/${userId}/roles`, { ids });
183
+ }
184
+ /**
185
+ * Returns whether the subscription is actively used by an organization.
186
+ *
187
+ * @param {string} subscriptionId - Subscription ID from an azure marketplace subscription
188
+ * @returns boolean (whether subscription is active)
189
+ */
190
+ hasActiveSubscription(subscriptionId) {
191
+ return this.httpClient.get(`${this.basePath}/activeSubscription/${subscriptionId}`);
192
+ }
193
+ /**
194
+ * Deletes organization data.
195
+ *
196
+ * @comment Domains are deleted using the updateOne method
197
+ * @param {string} id - Organization id
198
+ * @param {string} elementId - ID belonging to an element of the provided kind
199
+ * @param {OrganizationDataKind} kind - Requested data type (one of: ['members', 'invitations', 'roles', 'userRoles'])
200
+ * @returns {Promise<OrganizationData>}
201
+ */
202
+ deleteOrganizationData(id, elementId, kind) {
203
+ const params = kind ? { kind } : {};
204
+ return this.httpClient.delete(`${this.basePath}/${id}/data/${elementId}`, { params });
205
+ }
206
+ /**
207
+ * Removes the current user from the members of the provided organization.
208
+ *
209
+ * @param {string} id - organization id
210
+ * @returns {Promise<void>}
211
+ */
212
+ leaveOrganization(id) {
213
+ return this.httpClient.delete(`${this.basePath}/${id}/leave`);
214
+ }
215
+ }
216
+ exports.OrganizationsService = OrganizationsService;
@@ -1,8 +1,9 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
- import { HttpClient, TokenOption } from './http.service';
2
+ import { HttpClientService } from '.';
3
+ import { TokenOption } from '../interfaces';
3
4
  export declare class ProxyService {
4
5
  private readonly httpClient;
5
- constructor(httpClient: HttpClient);
6
+ constructor(httpClient: HttpClientService);
6
7
  delete: <T>(proxyId: string, path: string, config?: TokenOption & AxiosRequestConfig) => Promise<T>;
7
8
  get: <T>(proxyId: string, path: string, config?: TokenOption & AxiosRequestConfig) => Promise<T>;
8
9
  post: <T>(proxyId: string, path: string, data: any, config?: TokenOption & AxiosRequestConfig) => Promise<T>;
@@ -1,8 +1,8 @@
1
+ import { HttpClientService } from '.';
1
2
  import { APIBase } from '../api-base';
2
- import { HttpClient, TokenOption } from '../http.service';
3
- import type { SearchOptions, SearchResult } from '../interfaces';
3
+ import type { SearchOptions, SearchResult, TokenOption } from '../interfaces';
4
4
  export declare class SearchService extends APIBase {
5
- constructor(httpClient: HttpClient);
5
+ constructor(httpClient: HttpClientService);
6
6
  search<T extends {
7
7
  id?: string;
8
8
  }, K extends keyof T & string = keyof T & string>(query: SearchOptions<T, K>, tokenOption?: TokenOption): Promise<SearchResult<T, K>>;
@@ -0,0 +1,11 @@
1
+ import { DataService, HttpClientService, TrashService } from '.';
2
+ import { APIBase } from '../api-base';
3
+ import { Secret } from '../interfaces';
4
+ interface BaseService extends DataService<Secret>, TrashService<Secret> {
5
+ }
6
+ declare class BaseService extends APIBase {
7
+ }
8
+ export declare class SecretService extends BaseService {
9
+ constructor(httpClient: HttpClientService);
10
+ }
11
+ export {};
@@ -3,13 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SecretService = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ts_mixer_1 = require("ts-mixer");
6
- const api_base_1 = require("./api-base");
7
- const data_service_1 = require("./data.service");
8
- const trash_service_1 = require("./trash.service");
6
+ const _1 = require(".");
7
+ const api_base_1 = require("../api-base");
9
8
  let BaseService = class BaseService extends api_base_1.APIBase {
10
9
  };
11
10
  BaseService = tslib_1.__decorate([
12
- (0, ts_mixer_1.mix)(data_service_1.DataService, trash_service_1.TrashService)
11
+ (0, ts_mixer_1.mix)(_1.DataService, _1.TrashService)
13
12
  ], BaseService);
14
13
  class SecretService extends BaseService {
15
14
  constructor(httpClient) {
@@ -1,24 +1,21 @@
1
- import { APIBase } from './api-base';
2
- import { Paginated } from './data.interface';
3
- import { DataService } from './data.service';
4
- import { HttpClient, TokenOption } from './http.service';
5
- import { LogbookEntry, LogbookEntryDto, Task } from './task.interface';
6
- import { TrashService } from './trash.service';
1
+ import { DataService, HttpClientService, TrashService } from '.';
2
+ import { APIBase } from '../api-base';
3
+ import { LogbookEntry, LogbookEntryDto, Paginated, Task, TokenOption } from '../interfaces';
7
4
  interface BaseService extends DataService<Task>, TrashService<Task> {
8
5
  }
9
6
  declare class BaseService extends APIBase {
10
7
  }
11
8
  export declare class TaskService extends BaseService {
12
- constructor(httpClient: HttpClient);
9
+ constructor(httpClient: HttpClientService);
13
10
  createTaskAttachedToAsset(dto: any, options?: TokenOption): Promise<Task>;
14
- findByName(name: string, options?: TokenOption): Promise<Paginated<Task[]>>;
15
- findByAsset(assetId: string, options?: TokenOption): Promise<Paginated<Task[]>>;
16
- getLogbookEntries(taskId: string, limit?: number, offset?: number, options?: TokenOption): Promise<Paginated<LogbookEntry[]>>;
11
+ findByName(name: string, options?: TokenOption): Promise<Paginated<Task>>;
12
+ findByAsset(assetId: string, options?: TokenOption): Promise<Paginated<Task>>;
13
+ getLogbookEntries(taskId: string, limit?: number, offset?: number, options?: TokenOption): Promise<Paginated<LogbookEntry>>;
17
14
  addLogbookEntry(taskId: string, entry: LogbookEntryDto, options?: TokenOption): Promise<LogbookEntry>;
18
15
  updateLogbookEntry(taskId: string, entryId: string, entry: Partial<LogbookEntryDto>, options?: TokenOption): Promise<LogbookEntry>;
19
16
  deleteLogbookEntry(taskId: string, entryId: string, options?: TokenOption): Promise<{
20
17
  deleted: boolean;
21
18
  }>;
22
- getUserLogbookEntries(limit?: number, offset?: number, options?: TokenOption): Promise<Paginated<LogbookEntry[]>>;
19
+ getUserLogbookEntries(limit?: number, offset?: number, options?: TokenOption): Promise<Paginated<LogbookEntry>>;
23
20
  }
24
21
  export {};
@@ -3,13 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TaskService = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ts_mixer_1 = require("ts-mixer");
6
- const api_base_1 = require("./api-base");
7
- const data_service_1 = require("./data.service");
8
- const trash_service_1 = require("./trash.service");
6
+ const _1 = require(".");
7
+ const api_base_1 = require("../api-base");
9
8
  let BaseService = class BaseService extends api_base_1.APIBase {
10
9
  };
11
10
  BaseService = tslib_1.__decorate([
12
- (0, ts_mixer_1.mix)(data_service_1.DataService, trash_service_1.TrashService)
11
+ (0, ts_mixer_1.mix)(_1.DataService, _1.TrashService)
13
12
  ], BaseService);
14
13
  class TaskService extends BaseService {
15
14
  constructor(httpClient) {