@shieldiot/pulse-lib 1.0.5 → 1.0.6

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 (246) hide show
  1. package/dist/index.d.ts +4 -2
  2. package/dist/index.js +4 -2
  3. package/dist/index.js.map +1 -1
  4. package/dist/lib/common/TimeSeries.d.ts +1 -1
  5. package/dist/lib/common/TimeSeriesOf2D.d.ts +1 -1
  6. package/dist/lib/entities/Account.d.ts +2 -2
  7. package/dist/lib/entities/Account.js.map +1 -1
  8. package/dist/lib/entities/AccountDTO.d.ts +2 -2
  9. package/dist/lib/entities/AccountDTO.js.map +1 -1
  10. package/dist/lib/entities/AccountSettings.d.ts +1 -1
  11. package/dist/lib/entities/Alert.d.ts +4 -4
  12. package/dist/lib/entities/Alert.js.map +1 -1
  13. package/dist/lib/entities/AlertWithDevice.d.ts +4 -4
  14. package/dist/lib/entities/AlertWithDevice.js.map +1 -1
  15. package/dist/lib/entities/Device.d.ts +3 -3
  16. package/dist/lib/entities/Device.js.map +1 -1
  17. package/dist/lib/entities/DeviceWithEvents.d.ts +1 -1
  18. package/dist/lib/entities/DeviceWithEvents.js.map +1 -1
  19. package/dist/lib/entities/Event.d.ts +6 -6
  20. package/dist/lib/entities/Event.js.map +1 -1
  21. package/dist/lib/entities/EventWithDevice.d.ts +5 -5
  22. package/dist/lib/entities/EventWithDevice.js.map +1 -1
  23. package/dist/lib/entities/Feature.d.ts +1 -1
  24. package/dist/lib/entities/Feature.js.map +1 -1
  25. package/dist/lib/entities/Integration.d.ts +3 -3
  26. package/dist/lib/entities/Integration.js.map +1 -1
  27. package/dist/lib/entities/Report.d.ts +1 -1
  28. package/dist/lib/entities/Report.js.map +1 -1
  29. package/dist/lib/entities/Rule.d.ts +3 -3
  30. package/dist/lib/entities/Rule.js.map +1 -1
  31. package/dist/lib/entities/RuleTemplate.d.ts +2 -2
  32. package/dist/lib/entities/RuleTemplate.js.map +1 -1
  33. package/dist/lib/entities/StreamAnalyticsConfig.d.ts +2 -2
  34. package/dist/lib/entities/StreamAnalyticsConfig.js.map +1 -1
  35. package/dist/lib/entities/StreamConfig.d.ts +4 -4
  36. package/dist/lib/entities/User.d.ts +2 -2
  37. package/dist/lib/entities/User.js.map +1 -1
  38. package/dist/lib/entities/UserMembership.d.ts +2 -2
  39. package/dist/lib/entities/UserMembership.js.map +1 -1
  40. package/dist/lib/pulse-client.d.ts +12 -12
  41. package/dist/lib/pulse-client.js +30 -30
  42. package/dist/lib/pulse-client.js.map +1 -1
  43. package/dist/lib/services/sysAccountsService.d.ts +1 -1
  44. package/dist/lib/services/sysFeaturesService.d.ts +1 -1
  45. package/dist/lib/services/usrAlertsService.d.ts +9 -9
  46. package/dist/lib/services/usrDevicesService.d.ts +5 -5
  47. package/dist/lib/services/usrEventsService.d.ts +7 -7
  48. package/package.json +1 -1
  49. package/src/index.ts +4 -3
  50. package/dist/public-api.d.ts +0 -3
  51. package/dist/public-api.js +0 -7
  52. package/dist/public-api.js.map +0 -1
  53. package/src/config.d.ts +0 -6
  54. package/src/config.d.ts.map +0 -1
  55. package/src/config.js +0 -6
  56. package/src/config.js.map +0 -1
  57. package/src/index.d.ts +0 -3
  58. package/src/index.d.ts.map +0 -1
  59. package/src/index.js +0 -3
  60. package/src/index.js.map +0 -1
  61. package/src/lib/common/AccountRole.ts +0 -25
  62. package/src/lib/common/ConsumptionData.ts +0 -24
  63. package/src/lib/common/ConsumptionTimeDataPoint.ts +0 -21
  64. package/src/lib/common/DeviceConfig.ts +0 -22
  65. package/src/lib/common/DeviceScoreConfig.ts +0 -24
  66. package/src/lib/common/DevicesAtRiskConfig.ts +0 -16
  67. package/src/lib/common/EventSeverityConfig.ts +0 -17
  68. package/src/lib/common/FloatKeyValue.ts +0 -20
  69. package/src/lib/common/GeoData.ts +0 -38
  70. package/src/lib/common/GraphSeries.ts +0 -21
  71. package/src/lib/common/Indicator.ts +0 -32
  72. package/src/lib/common/IntKeySeriesDataValue.ts +0 -21
  73. package/src/lib/common/IntKeyValue.ts +0 -20
  74. package/src/lib/common/Interval.ts +0 -20
  75. package/src/lib/common/Link.ts +0 -41
  76. package/src/lib/common/Location.ts +0 -20
  77. package/src/lib/common/LoginParams.ts +0 -24
  78. package/src/lib/common/MaliciousIPCard.ts +0 -45
  79. package/src/lib/common/MaliciousIPData.ts +0 -28
  80. package/src/lib/common/NetworkMap.ts +0 -22
  81. package/src/lib/common/Node.ts +0 -54
  82. package/src/lib/common/SeriesData.ts +0 -22
  83. package/src/lib/common/SessionTransform.ts +0 -29
  84. package/src/lib/common/SeverityIntervalTuple.ts +0 -22
  85. package/src/lib/common/ShieldexConfig.ts +0 -36
  86. package/src/lib/common/StringIntValue.ts +0 -20
  87. package/src/lib/common/StringKeyIntValue.ts +0 -20
  88. package/src/lib/common/StringKeyValue.ts +0 -20
  89. package/src/lib/common/Thresholds.ts +0 -16
  90. package/src/lib/common/TimeDataPoint.ts +0 -20
  91. package/src/lib/common/TimeDataPoint2D.ts +0 -21
  92. package/src/lib/common/TimeDataPointFloat.ts +0 -20
  93. package/src/lib/common/TimeFrame.ts +0 -20
  94. package/src/lib/common/TimeSeries.ts +0 -26
  95. package/src/lib/common/TimeSeriesOf2D.ts +0 -26
  96. package/src/lib/common/TimeSeriesOfDataConsumption.ts +0 -26
  97. package/src/lib/common/TimeSeriesOfFloat.ts +0 -26
  98. package/src/lib/common/TokenData.ts +0 -39
  99. package/src/lib/common/Tuple.ts +0 -20
  100. package/src/lib/common/UsageTransform.ts +0 -37
  101. package/src/lib/common/ZScore.ts +0 -20
  102. package/src/lib/common/index.ts +0 -41
  103. package/src/lib/entities/Account.ts +0 -45
  104. package/src/lib/entities/AccountDTO.ts +0 -49
  105. package/src/lib/entities/AccountSettings.ts +0 -31
  106. package/src/lib/entities/Action.ts +0 -30
  107. package/src/lib/entities/Alert.ts +0 -91
  108. package/src/lib/entities/AlertWithDevice.ts +0 -92
  109. package/src/lib/entities/ApiKey.ts +0 -33
  110. package/src/lib/entities/AuditLog.ts +0 -39
  111. package/src/lib/entities/BaseEntity.ts +0 -24
  112. package/src/lib/entities/BulkDevices.ts +0 -17
  113. package/src/lib/entities/Checkpoint.ts +0 -71
  114. package/src/lib/entities/ComplianceReportSettings.ts +0 -28
  115. package/src/lib/entities/Condition.ts +0 -28
  116. package/src/lib/entities/ConfigParam.ts +0 -15
  117. package/src/lib/entities/DNSRecord.ts +0 -40
  118. package/src/lib/entities/DataIngestion.ts +0 -63
  119. package/src/lib/entities/DataPointOfDeviceReport.ts +0 -21
  120. package/src/lib/entities/Device.ts +0 -82
  121. package/src/lib/entities/DeviceReport.ts +0 -29
  122. package/src/lib/entities/DeviceWithEvents.ts +0 -86
  123. package/src/lib/entities/Distribution.ts +0 -25
  124. package/src/lib/entities/Event.ts +0 -98
  125. package/src/lib/entities/EventOccurrence.ts +0 -34
  126. package/src/lib/entities/EventWithDevice.ts +0 -97
  127. package/src/lib/entities/Feature.ts +0 -18
  128. package/src/lib/entities/FeaturesGroup.ts +0 -18
  129. package/src/lib/entities/Group.ts +0 -24
  130. package/src/lib/entities/Image.ts +0 -18
  131. package/src/lib/entities/Insight.ts +0 -49
  132. package/src/lib/entities/InsightQuery.ts +0 -29
  133. package/src/lib/entities/InsightSpec.ts +0 -28
  134. package/src/lib/entities/IntDistribution.ts +0 -25
  135. package/src/lib/entities/Integration.ts +0 -81
  136. package/src/lib/entities/Member.ts +0 -22
  137. package/src/lib/entities/Radius.ts +0 -45
  138. package/src/lib/entities/Report.ts +0 -37
  139. package/src/lib/entities/Rule.ts +0 -65
  140. package/src/lib/entities/RuleTemplate.ts +0 -38
  141. package/src/lib/entities/SIM.ts +0 -32
  142. package/src/lib/entities/ServiceStatus.ts +0 -26
  143. package/src/lib/entities/SessionRecord.ts +0 -71
  144. package/src/lib/entities/Shieldex.ts +0 -23
  145. package/src/lib/entities/Stream.ts +0 -31
  146. package/src/lib/entities/StreamAnalyticsConfig.ts +0 -30
  147. package/src/lib/entities/StreamConfig.ts +0 -52
  148. package/src/lib/entities/TeaserPopUpSettings.ts +0 -24
  149. package/src/lib/entities/TimeSeriesOfDeviceReport.ts +0 -26
  150. package/src/lib/entities/UsageRecord.ts +0 -101
  151. package/src/lib/entities/User.ts +0 -45
  152. package/src/lib/entities/UserMembership.ts +0 -38
  153. package/src/lib/entities/UserMemberships.ts +0 -38
  154. package/src/lib/entities/index.ts +0 -51
  155. package/src/lib/enums/AccountStatusCode.ts +0 -35
  156. package/src/lib/enums/AccountTypeCode.ts +0 -40
  157. package/src/lib/enums/DataSourceCode.ts +0 -35
  158. package/src/lib/enums/DeviceActionCode.ts +0 -40
  159. package/src/lib/enums/DeviceCreationCode.ts +0 -40
  160. package/src/lib/enums/DeviceIdentityCode.ts +0 -55
  161. package/src/lib/enums/DeviceStatusCode.ts +0 -40
  162. package/src/lib/enums/DeviceTypeCode.ts +0 -90
  163. package/src/lib/enums/DirectionContextCode.ts +0 -40
  164. package/src/lib/enums/EventCategoryCode.ts +0 -30
  165. package/src/lib/enums/EventStatusCode.ts +0 -40
  166. package/src/lib/enums/EventTypeCode.ts +0 -115
  167. package/src/lib/enums/FeatureCode.ts +0 -70
  168. package/src/lib/enums/HomePageViewCode.ts +0 -35
  169. package/src/lib/enums/HttpMethodCode.ts +0 -45
  170. package/src/lib/enums/InsightStatusCode.ts +0 -35
  171. package/src/lib/enums/InsightTypeCode.ts +0 -30
  172. package/src/lib/enums/IntegrationTriggerCode.ts +0 -30
  173. package/src/lib/enums/IntegrationTypeCode.ts +0 -40
  174. package/src/lib/enums/MemberRoleCode.ts +0 -40
  175. package/src/lib/enums/NetworkMapTypeCode.ts +0 -35
  176. package/src/lib/enums/OperatorCode.ts +0 -75
  177. package/src/lib/enums/PermissionCode.ts +0 -45
  178. package/src/lib/enums/ReportTypeCode.ts +0 -35
  179. package/src/lib/enums/RuleTypeCode.ts +0 -35
  180. package/src/lib/enums/SeverityTypeCode.ts +0 -40
  181. package/src/lib/enums/TrafficDirectionCode.ts +0 -35
  182. package/src/lib/enums/UserStatusCode.ts +0 -40
  183. package/src/lib/enums/UserTypeCode.ts +0 -40
  184. package/src/lib/enums/index.ts +0 -29
  185. package/src/lib/index.ts +0 -4
  186. package/src/lib/pulse-client.ts +0 -190
  187. package/src/lib/services/index.ts +0 -26
  188. package/src/lib/services/services.export.ts +0 -54
  189. package/src/lib/services/supportStreamAnalyticsConfig.ts +0 -63
  190. package/src/lib/services/sysAccountsService.ts +0 -90
  191. package/src/lib/services/sysAuditLogService.ts +0 -72
  192. package/src/lib/services/sysCheckpointsService.ts +0 -62
  193. package/src/lib/services/sysConfigService.ts +0 -63
  194. package/src/lib/services/sysFeaturesService.ts +0 -77
  195. package/src/lib/services/sysGroupsService.ts +0 -85
  196. package/src/lib/services/sysInsightsService.ts +0 -122
  197. package/src/lib/services/sysKeysService.ts +0 -71
  198. package/src/lib/services/sysMembersService.ts +0 -66
  199. package/src/lib/services/sysRuleTemplatesService.ts +0 -63
  200. package/src/lib/services/sysRulesService.ts +0 -79
  201. package/src/lib/services/sysStatisticsService.ts +0 -50
  202. package/src/lib/services/sysStreamsService.ts +0 -64
  203. package/src/lib/services/sysUsersService.ts +0 -89
  204. package/src/lib/services/usrAlertsService.ts +0 -382
  205. package/src/lib/services/usrDevicesService.ts +0 -303
  206. package/src/lib/services/usrEventsService.ts +0 -355
  207. package/src/lib/services/usrInsightsService.ts +0 -29
  208. package/src/lib/services/usrIntegrationsService.ts +0 -79
  209. package/src/lib/services/usrMembersService.ts +0 -77
  210. package/src/lib/services/usrNetworkService.ts +0 -59
  211. package/src/lib/services/usrReportsService.ts +0 -114
  212. package/src/lib/services/usrRulesService.ts +0 -78
  213. package/src/lib/services/usrUserService.ts +0 -114
  214. package/src/public-api.d.ts +0 -4
  215. package/src/public-api.d.ts.map +0 -1
  216. package/src/public-api.js +0 -7
  217. package/src/public-api.js.map +0 -1
  218. package/src/public-api.ts +0 -9
  219. package/src/utils/ActionResponse.d.ts +0 -6
  220. package/src/utils/ActionResponse.d.ts.map +0 -1
  221. package/src/utils/ActionResponse.js +0 -9
  222. package/src/utils/ActionResponse.js.map +0 -1
  223. package/src/utils/BaseRestResponse.d.ts +0 -5
  224. package/src/utils/BaseRestResponse.d.ts.map +0 -1
  225. package/src/utils/BaseRestResponse.js +0 -8
  226. package/src/utils/BaseRestResponse.js.map +0 -1
  227. package/src/utils/EntitiesResponse.d.ts +0 -9
  228. package/src/utils/EntitiesResponse.d.ts.map +0 -1
  229. package/src/utils/EntitiesResponse.js +0 -15
  230. package/src/utils/EntitiesResponse.js.map +0 -1
  231. package/src/utils/EntityResponse.d.ts +0 -9
  232. package/src/utils/EntityResponse.d.ts.map +0 -1
  233. package/src/utils/EntityResponse.js +0 -15
  234. package/src/utils/EntityResponse.js.map +0 -1
  235. package/src/utils/index.d.ts +0 -6
  236. package/src/utils/index.d.ts.map +0 -1
  237. package/src/utils/index.js +0 -6
  238. package/src/utils/index.js.map +0 -1
  239. package/src/utils/rest-axios-setup.d.ts +0 -4
  240. package/src/utils/rest-axios-setup.d.ts.map +0 -1
  241. package/src/utils/rest-axios-setup.js +0 -8
  242. package/src/utils/rest-axios-setup.js.map +0 -1
  243. package/src/utils/rest-util.d.ts +0 -16
  244. package/src/utils/rest-util.d.ts.map +0 -1
  245. package/src/utils/rest-util.js +0 -101
  246. package/src/utils/rest-util.js.map +0 -1
@@ -1,79 +0,0 @@
1
- import { RestUtil, EntityResponse, EntitiesResponse, ActionResponse } from '../../utils';
2
- import { PulseConfig } from '../../config';
3
-
4
- import { TimeSeriesOfFloat } from '../common';
5
- import { Rule } from '../entities';
6
-
7
-
8
-
9
- // List of rules related actions for system administrator only
10
- // @RequestHeader X-API-KEY The key to identify the application (console)
11
- // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
12
- export class SysRulesService {
13
-
14
- // URL to web api
15
- private baseUrl = '/sys/rules';
16
-
17
- // Class constructor
18
- constructor(private config: PulseConfig, private rest: RestUtil) {
19
- this.baseUrl = this.config.api + this.baseUrl;
20
- }
21
-
22
-
23
- /**
24
- * Create new rule
25
- */
26
- create(body?: Rule) {
27
- return this.rest.put<EntityResponse<Rule>>(`${this.baseUrl}`, typeof body === 'object' ? JSON.stringify(body) : body);
28
- }
29
-
30
- /**
31
- * Update existing rule in the system
32
- */
33
- update(body?: Rule) {
34
- return this.rest.patch<EntityResponse<Rule>>(`${this.baseUrl}`, typeof body === 'object' ? JSON.stringify(body) : body);
35
- }
36
-
37
- /**
38
- * Delete a rule from the system
39
- */
40
- delete(id?: string) {
41
- return this.rest.delete<ActionResponse>(`${this.baseUrl}/${id}`);
42
- }
43
-
44
- /**
45
- * Get single rule by id
46
- */
47
- get(id?: string) {
48
- return this.rest.get<EntityResponse<Rule>>(`${this.baseUrl}/${id}`);
49
- }
50
-
51
- /**
52
- * Find list of rules by query
53
- */
54
- find(accountId?: string, streamId?: string, search?: string, sort?: string, page?: number, size?: number) {
55
- const params = [];
56
- if (accountId != null) { params.push(`accountId=${accountId}`); }
57
- if (streamId != null) { params.push(`streamId=${streamId}`); }
58
- if (search != null) { params.push(`search=${search}`); }
59
- if (sort != null) { params.push(`sort=${sort}`); }
60
- if (page != null) { params.push(`page=${page}`); }
61
- if (size != null) { params.push(`size=${size}`); }
62
-
63
- return this.rest.get<EntitiesResponse<Rule>>(`${this.baseUrl}`, ...params);
64
- }
65
-
66
- /**
67
- * Analyze rule configuration against historic data
68
- */
69
- analyze(from?: number, to?: number, interval?: number, size?: number, body?: Rule) {
70
- const params = [];
71
- if (from != null) { params.push(`from=${from}`); }
72
- if (to != null) { params.push(`to=${to}`); }
73
- if (interval != null) { params.push(`interval=${interval}`); }
74
- if (size != null) { params.push(`size=${size}`); }
75
-
76
- return this.rest.post<EntityResponse<TimeSeriesOfFloat>>(`${this.baseUrl}/analyze`, typeof body === 'object' ? JSON.stringify(body) : body, ...params);
77
- }
78
-
79
- }
@@ -1,50 +0,0 @@
1
- import { RestUtil, EntityResponse, EntitiesResponse, ActionResponse } from '../../utils';
2
- import { PulseConfig } from '../../config';
3
-
4
- import { Distribution } from '../entities';
5
-
6
-
7
-
8
- // List of system statistics information for system administrator only
9
- // @RequestHeader X-API-KEY The key to identify the application (console)
10
- // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
11
- export class SysStatisticsService {
12
-
13
- // URL to web api
14
- private baseUrl = '/sys/statistics';
15
-
16
- // Class constructor
17
- constructor(private config: PulseConfig, private rest: RestUtil) {
18
- this.baseUrl = this.config.api + this.baseUrl;
19
- }
20
-
21
-
22
- /**
23
- * Get accounts distribution by field
24
- */
25
- getAccountsCount(field?: string) {
26
- return this.rest.get<EntityResponse<Distribution>>(`${this.baseUrl}/accounts/${field}`);
27
- }
28
-
29
- /**
30
- * Get streams distribution by field
31
- */
32
- getStreamsCount(field?: string) {
33
- return this.rest.get<EntityResponse<Distribution>>(`${this.baseUrl}/streams/${field}`);
34
- }
35
-
36
- /**
37
- * Get devices distribution by field
38
- */
39
- getDevicesCount(field?: string) {
40
- return this.rest.get<EntityResponse<Distribution>>(`${this.baseUrl}/devices/${field}`);
41
- }
42
-
43
- /**
44
- * Get users distribution by field
45
- */
46
- getUsersCount(field?: string) {
47
- return this.rest.get<EntityResponse<Distribution>>(`${this.baseUrl}/users/${field}`);
48
- }
49
-
50
- }
@@ -1,64 +0,0 @@
1
- import { RestUtil, EntityResponse, EntitiesResponse, ActionResponse } from '../../utils';
2
- import { PulseConfig } from '../../config';
3
-
4
- import { Stream } from '../entities';
5
-
6
-
7
-
8
- // List of stream related actions for system administrator only
9
- // @RequestHeader X-API-KEY The key to identify the application (console)
10
- // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
11
- export class SysStreamsService {
12
-
13
- // URL to web api
14
- private baseUrl = '/sys/streams';
15
-
16
- // Class constructor
17
- constructor(private config: PulseConfig, private rest: RestUtil) {
18
- this.baseUrl = this.config.api + this.baseUrl;
19
- }
20
-
21
-
22
- /**
23
- * Create new stream
24
- */
25
- create(body?: Stream) {
26
- return this.rest.put<EntityResponse<Stream>>(`${this.baseUrl}`, typeof body === 'object' ? JSON.stringify(body) : body);
27
- }
28
-
29
- /**
30
- * Update existing stream in the system
31
- */
32
- update(body?: Stream) {
33
- return this.rest.patch<EntityResponse<Stream>>(`${this.baseUrl}`, typeof body === 'object' ? JSON.stringify(body) : body);
34
- }
35
-
36
- /**
37
- * Delete a stream from the system
38
- */
39
- delete(id?: string) {
40
- return this.rest.delete<ActionResponse>(`${this.baseUrl}/${id}`);
41
- }
42
-
43
- /**
44
- * Get single stream by id
45
- */
46
- get(id?: string) {
47
- return this.rest.get<EntityResponse<Stream>>(`${this.baseUrl}/${id}`);
48
- }
49
-
50
- /**
51
- * Find list of streams by query
52
- */
53
- find(accountId?: string, search?: string, sort?: string, page?: number, size?: number) {
54
- const params = [];
55
- if (accountId != null) { params.push(`accountId=${accountId}`); }
56
- if (search != null) { params.push(`search=${search}`); }
57
- if (sort != null) { params.push(`sort=${sort}`); }
58
- if (page != null) { params.push(`page=${page}`); }
59
- if (size != null) { params.push(`size=${size}`); }
60
-
61
- return this.rest.get<EntitiesResponse<Stream>>(`${this.baseUrl}`, ...params);
62
- }
63
-
64
- }
@@ -1,89 +0,0 @@
1
- import { RestUtil, EntityResponse, EntitiesResponse, ActionResponse } from '../../utils';
2
- import { PulseConfig } from '../../config';
3
-
4
- import { User } from '../entities';
5
- import { UserTypeCode } from '../enums';
6
- import { UserStatusCode } from '../enums';
7
- import { UserMemberships } from '../entities';
8
-
9
-
10
-
11
- // List of users related actions for system administrator only
12
- // @RequestHeader X-API-KEY The key to identify the application (console)
13
- // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
14
- export class SysUsersService {
15
-
16
- // URL to web api
17
- private baseUrl = '/sys/users';
18
-
19
- // Class constructor
20
- constructor(private config: PulseConfig, private rest: RestUtil) {
21
- this.baseUrl = this.config.api + this.baseUrl;
22
- }
23
-
24
-
25
- /**
26
- * Create new user
27
- */
28
- create(body?: User) {
29
- return this.rest.put<EntityResponse<User>>(`${this.baseUrl}`, typeof body === 'object' ? JSON.stringify(body) : body);
30
- }
31
-
32
- /**
33
- * Update existing user in the system
34
- */
35
- update(body?: User) {
36
- return this.rest.patch<EntityResponse<User>>(`${this.baseUrl}`, typeof body === 'object' ? JSON.stringify(body) : body);
37
- }
38
-
39
- /**
40
- * Delete a user from the system
41
- */
42
- delete(id?: string) {
43
- return this.rest.delete<ActionResponse>(`${this.baseUrl}/${id}`);
44
- }
45
-
46
- /**
47
- * Get single user by id
48
- */
49
- get(id?: string) {
50
- return this.rest.get<EntityResponse<User>>(`${this.baseUrl}/${id}`);
51
- }
52
-
53
- /**
54
- * Find list of users by query
55
- */
56
- find(search?: string, type?: UserTypeCode[], status?: UserStatusCode[], sort?: string, page?: number, size?: number) {
57
- const params = [];
58
- if (search != null) { params.push(`search=${search}`); }
59
- if (type != null) { params.push(`type=${type}`); }
60
- if (status != null) { params.push(`status=${status}`); }
61
- if (sort != null) { params.push(`sort=${sort}`); }
62
- if (page != null) { params.push(`page=${page}`); }
63
- if (size != null) { params.push(`size=${size}`); }
64
-
65
- return this.rest.get<EntitiesResponse<User>>(`${this.baseUrl}`, ...params);
66
- }
67
-
68
- /**
69
- * Create new user with all its accounts memberships
70
- */
71
- createMembership(body?: UserMemberships) {
72
- return this.rest.post<EntityResponse<UserMemberships>>(`${this.baseUrl}/memberships`, typeof body === 'object' ? JSON.stringify(body) : body);
73
- }
74
-
75
- /**
76
- * Update user's default account
77
- */
78
- setDefaultAccount(id?: string, accountId?: string) {
79
- return this.rest.patch<ActionResponse>(`${this.baseUrl}/${id}/${accountId}`, '');
80
- }
81
-
82
- /**
83
- * Update access token
84
- */
85
- getAccessToken(id?: string) {
86
- return this.rest.get<ActionResponse>(`${this.baseUrl}/${id}/access-token`);
87
- }
88
-
89
- }
@@ -1,382 +0,0 @@
1
- import { RestUtil, EntityResponse, EntitiesResponse, ActionResponse } from '../../utils';
2
- import { PulseConfig } from '../../config';
3
-
4
- import { Alert } from '../entities';
5
- import { EventTypeCode } from '../enums';
6
- import { SeverityTypeCode } from '../enums';
7
- import { AlertWithDevice } from '../entities';
8
- import { EventStatusCode } from '../enums';
9
- import { IntDistribution } from '../entities';
10
- import { TimeSeriesOf2D } from '../common';
11
- import { TimeSeriesOfFloat } from '../common';
12
- import { MaliciousIPData } from '../common';
13
- import { EventCategoryCode } from '../enums';
14
- import { RuleTypeCode } from '../enums';
15
- import { DeviceActionCode } from '../enums';
16
- import { MaliciousIPCard } from '../common';
17
- import { StringKeyValue } from '../common';
18
-
19
-
20
-
21
- // List of alerts related actions for the operator
22
- // @RequestHeader X-API-KEY The key to identify the application (console)
23
- // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
24
- export class UsrAlertsService {
25
-
26
- // URL to web api
27
- private baseUrl = '/alerts';
28
-
29
- // Class constructor
30
- constructor(private config: PulseConfig, private rest: RestUtil) {
31
- this.baseUrl = this.config.api + this.baseUrl;
32
- }
33
-
34
-
35
- /**
36
- * Get single alert by id
37
- */
38
- get(id?: string) {
39
- return this.rest.get<EntityResponse<Alert>>(`${this.baseUrl}/${id}`);
40
- }
41
-
42
- /**
43
- * Find list of alerts by query
44
- */
45
- find(streamId?: string, deviceId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number, withoutOccurrences?: boolean) {
46
- const params = [];
47
- if (streamId != null) { params.push(`streamId=${streamId}`); }
48
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
49
- if (search != null) { params.push(`search=${search}`); }
50
- if (from != null) { params.push(`from=${from}`); }
51
- if (to != null) { params.push(`to=${to}`); }
52
- if (type != null) { params.push(`type=${type}`); }
53
- if (severity != null) { params.push(`severity=${severity}`); }
54
- if (category != null) { params.push(`category=${category}`); }
55
- if (status != null) { params.push(`status=${status}`); }
56
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
57
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
58
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
59
- if (sort != null) { params.push(`sort=${sort}`); }
60
- if (page != null) { params.push(`page=${page}`); }
61
- if (size != null) { params.push(`size=${size}`); }
62
- if (withoutOccurrences != null) { params.push(`withoutOccurrences=${withoutOccurrences}`); }
63
-
64
- return this.rest.get<EntitiesResponse<Alert>>(`${this.baseUrl}`, ...params);
65
- }
66
-
67
- /**
68
- * Export list of alerts by query to a file with the specified format
69
- */
70
- exportFormat(format?: string, streamId?: string, deviceId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number) {
71
- const params = [];
72
- if (streamId != null) { params.push(`streamId=${streamId}`); }
73
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
74
- if (search != null) { params.push(`search=${search}`); }
75
- if (from != null) { params.push(`from=${from}`); }
76
- if (to != null) { params.push(`to=${to}`); }
77
- if (type != null) { params.push(`type=${type}`); }
78
- if (severity != null) { params.push(`severity=${severity}`); }
79
- if (category != null) { params.push(`category=${category}`); }
80
- if (status != null) { params.push(`status=${status}`); }
81
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
82
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
83
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
84
- if (sort != null) { params.push(`sort=${sort}`); }
85
- if (page != null) { params.push(`page=${page}`); }
86
- if (size != null) { params.push(`size=${size}`); }
87
-
88
- return this.rest.download(`usr-alerts`,`${this.baseUrl}/export/${format}`, ...params);
89
- }
90
-
91
- /**
92
- * Find top 10 alerts by their severity filter by query
93
- */
94
- getTop(streamId?: string, deviceId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number, withoutOccurrences?: boolean) {
95
- const params = [];
96
- if (streamId != null) { params.push(`streamId=${streamId}`); }
97
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
98
- if (search != null) { params.push(`search=${search}`); }
99
- if (from != null) { params.push(`from=${from}`); }
100
- if (to != null) { params.push(`to=${to}`); }
101
- if (type != null) { params.push(`type=${type}`); }
102
- if (severity != null) { params.push(`severity=${severity}`); }
103
- if (category != null) { params.push(`category=${category}`); }
104
- if (status != null) { params.push(`status=${status}`); }
105
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
106
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
107
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
108
- if (sort != null) { params.push(`sort=${sort}`); }
109
- if (page != null) { params.push(`page=${page}`); }
110
- if (size != null) { params.push(`size=${size}`); }
111
- if (withoutOccurrences != null) { params.push(`withoutOccurrences=${withoutOccurrences}`); }
112
-
113
- return this.rest.get<EntitiesResponse<AlertWithDevice>>(`${this.baseUrl}/top`, ...params);
114
- }
115
-
116
- /**
117
- * Get top malicious IPs
118
- */
119
- getTopMaliciousIPs(streamId?: string, top?: number, from?: number, to?: number) {
120
- const params = [];
121
- if (streamId != null) { params.push(`streamId=${streamId}`); }
122
- if (top != null) { params.push(`top=${top}`); }
123
- if (from != null) { params.push(`from=${from}`); }
124
- if (to != null) { params.push(`to=${to}`); }
125
-
126
- return this.rest.get<EntitiesResponse<MaliciousIPData>>(`${this.baseUrl}/top-malicious-ips`, ...params);
127
- }
128
-
129
- /**
130
- * Find alerts distribution by type filtered by query
131
- */
132
- countByType(streamId?: string, deviceId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number, withoutOccurrences?: boolean) {
133
- const params = [];
134
- if (streamId != null) { params.push(`streamId=${streamId}`); }
135
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
136
- if (search != null) { params.push(`search=${search}`); }
137
- if (from != null) { params.push(`from=${from}`); }
138
- if (to != null) { params.push(`to=${to}`); }
139
- if (type != null) { params.push(`type=${type}`); }
140
- if (severity != null) { params.push(`severity=${severity}`); }
141
- if (category != null) { params.push(`category=${category}`); }
142
- if (status != null) { params.push(`status=${status}`); }
143
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
144
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
145
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
146
- if (sort != null) { params.push(`sort=${sort}`); }
147
- if (page != null) { params.push(`page=${page}`); }
148
- if (size != null) { params.push(`size=${size}`); }
149
- if (withoutOccurrences != null) { params.push(`withoutOccurrences=${withoutOccurrences}`); }
150
-
151
- return this.rest.get<EntityResponse<IntDistribution>>(`${this.baseUrl}/count/by-type`, ...params);
152
- }
153
-
154
- /**
155
- * Find alerts distribution by status filtered by query
156
- */
157
- countByStatus(streamId?: string, deviceId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number, withoutOccurrences?: boolean) {
158
- const params = [];
159
- if (streamId != null) { params.push(`streamId=${streamId}`); }
160
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
161
- if (search != null) { params.push(`search=${search}`); }
162
- if (from != null) { params.push(`from=${from}`); }
163
- if (to != null) { params.push(`to=${to}`); }
164
- if (type != null) { params.push(`type=${type}`); }
165
- if (severity != null) { params.push(`severity=${severity}`); }
166
- if (category != null) { params.push(`category=${category}`); }
167
- if (status != null) { params.push(`status=${status}`); }
168
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
169
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
170
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
171
- if (sort != null) { params.push(`sort=${sort}`); }
172
- if (page != null) { params.push(`page=${page}`); }
173
- if (size != null) { params.push(`size=${size}`); }
174
- if (withoutOccurrences != null) { params.push(`withoutOccurrences=${withoutOccurrences}`); }
175
-
176
- return this.rest.get<EntityResponse<IntDistribution>>(`${this.baseUrl}/count/by-status`, ...params);
177
- }
178
-
179
- /**
180
- * Find alerts distribution by severity filtered by query
181
- */
182
- countBySeverity(streamId?: string, deviceId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number, withoutOccurrences?: boolean) {
183
- const params = [];
184
- if (streamId != null) { params.push(`streamId=${streamId}`); }
185
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
186
- if (search != null) { params.push(`search=${search}`); }
187
- if (from != null) { params.push(`from=${from}`); }
188
- if (to != null) { params.push(`to=${to}`); }
189
- if (type != null) { params.push(`type=${type}`); }
190
- if (severity != null) { params.push(`severity=${severity}`); }
191
- if (category != null) { params.push(`category=${category}`); }
192
- if (status != null) { params.push(`status=${status}`); }
193
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
194
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
195
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
196
- if (sort != null) { params.push(`sort=${sort}`); }
197
- if (page != null) { params.push(`page=${page}`); }
198
- if (size != null) { params.push(`size=${size}`); }
199
- if (withoutOccurrences != null) { params.push(`withoutOccurrences=${withoutOccurrences}`); }
200
-
201
- return this.rest.get<EntityResponse<IntDistribution>>(`${this.baseUrl}/count/by-severity`, ...params);
202
- }
203
-
204
- /**
205
- * Find alerts distribution by rule filtered by query
206
- */
207
- countByRule(streamId?: string, deviceId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number, withoutOccurrences?: boolean) {
208
- const params = [];
209
- if (streamId != null) { params.push(`streamId=${streamId}`); }
210
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
211
- if (search != null) { params.push(`search=${search}`); }
212
- if (from != null) { params.push(`from=${from}`); }
213
- if (to != null) { params.push(`to=${to}`); }
214
- if (type != null) { params.push(`type=${type}`); }
215
- if (severity != null) { params.push(`severity=${severity}`); }
216
- if (category != null) { params.push(`category=${category}`); }
217
- if (status != null) { params.push(`status=${status}`); }
218
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
219
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
220
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
221
- if (sort != null) { params.push(`sort=${sort}`); }
222
- if (page != null) { params.push(`page=${page}`); }
223
- if (size != null) { params.push(`size=${size}`); }
224
- if (withoutOccurrences != null) { params.push(`withoutOccurrences=${withoutOccurrences}`); }
225
-
226
- return this.rest.get<EntityResponse<IntDistribution>>(`${this.baseUrl}/count/by-rule`, ...params);
227
- }
228
-
229
- /**
230
- * Find alerts distribution by category filtered by query
231
- */
232
- countByCategory(streamId?: string, deviceId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number, withoutOccurrences?: boolean) {
233
- const params = [];
234
- if (streamId != null) { params.push(`streamId=${streamId}`); }
235
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
236
- if (search != null) { params.push(`search=${search}`); }
237
- if (from != null) { params.push(`from=${from}`); }
238
- if (to != null) { params.push(`to=${to}`); }
239
- if (type != null) { params.push(`type=${type}`); }
240
- if (severity != null) { params.push(`severity=${severity}`); }
241
- if (category != null) { params.push(`category=${category}`); }
242
- if (status != null) { params.push(`status=${status}`); }
243
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
244
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
245
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
246
- if (sort != null) { params.push(`sort=${sort}`); }
247
- if (page != null) { params.push(`page=${page}`); }
248
- if (size != null) { params.push(`size=${size}`); }
249
- if (withoutOccurrences != null) { params.push(`withoutOccurrences=${withoutOccurrences}`); }
250
-
251
- return this.rest.get<EntityResponse<IntDistribution>>(`${this.baseUrl}/count/by-category`, ...params);
252
- }
253
-
254
- /**
255
- * Add tag to an alert
256
- */
257
- addTag(id?: string, tag?: string) {
258
- return this.rest.post<EntityResponse<Alert>>(`${this.baseUrl}/${id}/tags/${tag}`, '');
259
- }
260
-
261
- /**
262
- * Delete a tag from the alert
263
- */
264
- deleteTag(id?: string, tag?: string) {
265
- return this.rest.delete<EntityResponse<Alert>>(`${this.baseUrl}/${id}/tags/${tag}`);
266
- }
267
-
268
- /**
269
- * Apply action on an alert
270
- */
271
- applyAction(id?: string, action?: DeviceActionCode) {
272
- return this.rest.post<ActionResponse>(`${this.baseUrl}/${id}/actions/${action}`, '');
273
- }
274
-
275
- /**
276
- * Set alert status
277
- */
278
- setStatus(id?: string, status?: EventStatusCode) {
279
- return this.rest.post<ActionResponse>(`${this.baseUrl}/${id}/status/${status}`, '');
280
- }
281
-
282
- /**
283
- * Get current shieldex value as ActionResponse, the Key contains the shield index and the data includes the trend
284
- */
285
- getShieldex() {
286
- return this.rest.get<ActionResponse>(`${this.baseUrl}/shieldex`);
287
- }
288
-
289
- /**
290
- * Get histogram of alerts over time by dimension (type | severity | status | ruleType | category)
291
- */
292
- alertsTimeline(streamId?: string, deviceId?: string, dimension?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number) {
293
- const params = [];
294
- if (streamId != null) { params.push(`streamId=${streamId}`); }
295
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
296
- if (dimension != null) { params.push(`dimension=${dimension}`); }
297
- if (from != null) { params.push(`from=${from}`); }
298
- if (to != null) { params.push(`to=${to}`); }
299
- if (type != null) { params.push(`type=${type}`); }
300
- if (severity != null) { params.push(`severity=${severity}`); }
301
- if (category != null) { params.push(`category=${category}`); }
302
- if (status != null) { params.push(`status=${status}`); }
303
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
304
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
305
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
306
- if (sort != null) { params.push(`sort=${sort}`); }
307
- if (page != null) { params.push(`page=${page}`); }
308
- if (size != null) { params.push(`size=${size}`); }
309
-
310
- return this.rest.get<EntityResponse<TimeSeriesOf2D>>(`${this.baseUrl}/timeline`, ...params);
311
- }
312
-
313
- /**
314
- * Get histogram of shieldex values over time
315
- */
316
- shieldexTimeline(streamId?: string, from?: number, to?: number) {
317
- const params = [];
318
- if (streamId != null) { params.push(`streamId=${streamId}`); }
319
- if (from != null) { params.push(`from=${from}`); }
320
- if (to != null) { params.push(`to=${to}`); }
321
-
322
- return this.rest.get<EntityResponse<TimeSeriesOfFloat>>(`${this.baseUrl}/shieldex/timeline`, ...params);
323
- }
324
-
325
- /**
326
- * Export alert source file
327
- */
328
- exportSource(id?: string) {
329
- return this.rest.download(`usr-alerts`,`${this.baseUrl}/${id}/export_source`);
330
- }
331
-
332
- /**
333
- * Get total number devices at risk (affected by the alerts matching the query)
334
- */
335
- getTotalDevicesAtRisk(streamId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[]) {
336
- const params = [];
337
- if (streamId != null) { params.push(`streamId=${streamId}`); }
338
- if (search != null) { params.push(`search=${search}`); }
339
- if (from != null) { params.push(`from=${from}`); }
340
- if (to != null) { params.push(`to=${to}`); }
341
- if (type != null) { params.push(`type=${type}`); }
342
- if (severity != null) { params.push(`severity=${severity}`); }
343
- if (category != null) { params.push(`category=${category}`); }
344
- if (status != null) { params.push(`status=${status}`); }
345
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
346
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
347
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
348
-
349
- return this.rest.get<ActionResponse>(`${this.baseUrl}/devices-at-risk`, ...params);
350
- }
351
-
352
- /**
353
- * Get malicious IP data card for specific malicious IP
354
- */
355
- getMaliciousIpCard(streamId?: string, targetIp?: string, from?: number, to?: number) {
356
- const params = [];
357
- if (streamId != null) { params.push(`streamId=${streamId}`); }
358
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
359
- if (from != null) { params.push(`from=${from}`); }
360
- if (to != null) { params.push(`to=${to}`); }
361
-
362
- return this.rest.get<EntityResponse<MaliciousIPCard>>(`${this.baseUrl}/malicious-ip-card`, ...params);
363
- }
364
-
365
- /**
366
- * Apply DNS lookup for each IP in the list
367
- */
368
- getIpLookup(ip?: string[]) {
369
- const params = [];
370
- if (ip != null) { params.push(`ip=${ip}`); }
371
-
372
- return this.rest.get<EntitiesResponse<StringKeyValue>>(`${this.baseUrl}/ip-lookup`, ...params);
373
- }
374
-
375
- /**
376
- * Find list of alerts by insight id query
377
- */
378
- findByInsightContext() {
379
- return this.rest.get<EntitiesResponse<Alert>>(`${this.baseUrl}/find-by-insight-context`);
380
- }
381
-
382
- }