@ampsec/platform-client 64.4.0 → 66.0.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 (36) hide show
  1. package/build/src/dto/agents.dto.d.ts +80 -2
  2. package/build/src/dto/agents.dto.js +17 -0
  3. package/build/src/dto/agents.dto.js.map +1 -1
  4. package/build/src/dto/customActions.dto.d.ts +113 -113
  5. package/build/src/dto/customActions.dto.js +7 -5
  6. package/build/src/dto/customActions.dto.js.map +1 -1
  7. package/build/src/dto/customScores.dto.d.ts +12 -120
  8. package/build/src/dto/customScores.dto.js +1 -1
  9. package/build/src/dto/customScores.dto.js.map +1 -1
  10. package/build/src/dto/enums/findingSpecKind.d.ts +4 -0
  11. package/build/src/dto/enums/findingSpecKind.js +9 -0
  12. package/build/src/dto/enums/findingSpecKind.js.map +1 -0
  13. package/build/src/dto/enums/index.d.ts +1 -0
  14. package/build/src/dto/enums/index.js +1 -0
  15. package/build/src/dto/enums/index.js.map +1 -1
  16. package/build/src/dto/findings.dto.d.ts +7 -1
  17. package/build/src/dto/findings.dto.js +1 -0
  18. package/build/src/dto/findings.dto.js.map +1 -1
  19. package/build/src/dto/platform/platform.customActions.dto.d.ts +62 -62
  20. package/build/src/dto/platform/platform.customScores.dto.d.ts +12 -120
  21. package/build/src/dto/platform/platform.findings.dto.d.ts +6 -0
  22. package/build/src/services/AgentsService.d.ts +47 -0
  23. package/build/src/services/AgentsService.js +23 -0
  24. package/build/src/services/AgentsService.js.map +1 -0
  25. package/build/src/services/AmpApi.d.ts +3 -2
  26. package/build/src/services/AmpApi.js +2 -1
  27. package/build/src/services/AmpApi.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/dto/agents.dto.ts +22 -3
  30. package/src/dto/customActions.dto.ts +10 -8
  31. package/src/dto/customScores.dto.ts +1 -1
  32. package/src/dto/enums/findingSpecKind.ts +4 -0
  33. package/src/dto/enums/index.ts +1 -0
  34. package/src/dto/findings.dto.ts +2 -1
  35. package/src/services/AgentsService.ts +25 -0
  36. package/src/services/AmpApi.ts +3 -4
@@ -56,7 +56,7 @@ export declare const _PlatformCustomScoreCohortDto: z.ZodObject<{
56
56
  createdAt: z.ZodString;
57
57
  updatedAt: z.ZodString;
58
58
  deletedAt: z.ZodNullable<z.ZodString>;
59
- cohort: z.ZodUnion<[z.ZodObject<{
59
+ cohort: z.ZodArray<z.ZodObject<{
60
60
  id: z.ZodString;
61
61
  kind: z.ZodEnum<["ORGANIZATION", "DEPARTMENT", "USER", "RISK_CONTRIBUTOR"]>;
62
62
  displayValue: z.ZodString;
@@ -74,25 +74,7 @@ export declare const _PlatformCustomScoreCohortDto: z.ZodObject<{
74
74
  id: string;
75
75
  displayValue: string;
76
76
  kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
77
- }>, z.ZodArray<z.ZodObject<{
78
- id: z.ZodString;
79
- kind: z.ZodEnum<["ORGANIZATION", "DEPARTMENT", "USER", "RISK_CONTRIBUTOR"]>;
80
- displayValue: z.ZodString;
81
- value: z.ZodString;
82
- inclusive: z.ZodBoolean;
83
- }, "strip", z.ZodTypeAny, {
84
- inclusive: boolean;
85
- value: string;
86
- id: string;
87
- displayValue: string;
88
- kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
89
- }, {
90
- inclusive: boolean;
91
- value: string;
92
- id: string;
93
- displayValue: string;
94
- kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
95
- }>, "many">]>;
77
+ }>, "many">;
96
78
  multiplier: z.ZodNumber;
97
79
  tid: z.ZodString;
98
80
  }, "strip", z.ZodTypeAny, {
@@ -101,31 +83,13 @@ export declare const _PlatformCustomScoreCohortDto: z.ZodObject<{
101
83
  createdAt: string;
102
84
  updatedAt: string;
103
85
  deletedAt: string | null;
104
- cohort: ({
105
- inclusive: boolean;
106
- value: string;
107
- id: string;
108
- displayValue: string;
109
- kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
110
- } | {
86
+ cohort: {
111
87
  inclusive: boolean;
112
88
  value: string;
113
89
  id: string;
114
90
  displayValue: string;
115
91
  kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
116
- }[]) & ({
117
- inclusive: boolean;
118
- value: string;
119
- id: string;
120
- displayValue: string;
121
- kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
122
- } | {
123
- inclusive: boolean;
124
- value: string;
125
- id: string;
126
- displayValue: string;
127
- kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
128
- }[] | undefined);
92
+ }[];
129
93
  multiplier: number;
130
94
  }, {
131
95
  id: string;
@@ -133,31 +97,13 @@ export declare const _PlatformCustomScoreCohortDto: z.ZodObject<{
133
97
  createdAt: string;
134
98
  updatedAt: string;
135
99
  deletedAt: string | null;
136
- cohort: ({
137
- inclusive: boolean;
138
- value: string;
139
- id: string;
140
- displayValue: string;
141
- kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
142
- } | {
143
- inclusive: boolean;
144
- value: string;
145
- id: string;
146
- displayValue: string;
147
- kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
148
- }[]) & ({
149
- inclusive: boolean;
150
- value: string;
151
- id: string;
152
- displayValue: string;
153
- kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
154
- } | {
100
+ cohort: {
155
101
  inclusive: boolean;
156
102
  value: string;
157
103
  id: string;
158
104
  displayValue: string;
159
105
  kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
160
- }[] | undefined);
106
+ }[];
161
107
  multiplier: number;
162
108
  }>;
163
109
  export type PlatformCustomScoreCohortDto = z.infer<typeof _PlatformCustomScoreCohortDto>;
@@ -166,7 +112,7 @@ export declare const _PlatformCustomScoreCohortUpsertDto: z.ZodObject<{
166
112
  createdAt: z.ZodString;
167
113
  updatedAt: z.ZodString;
168
114
  deletedAt: z.ZodNullable<z.ZodString>;
169
- cohort: z.ZodUnion<[z.ZodObject<{
115
+ cohort: z.ZodArray<z.ZodObject<{
170
116
  id: z.ZodString;
171
117
  kind: z.ZodEnum<["ORGANIZATION", "DEPARTMENT", "USER", "RISK_CONTRIBUTOR"]>;
172
118
  displayValue: z.ZodString;
@@ -184,25 +130,7 @@ export declare const _PlatformCustomScoreCohortUpsertDto: z.ZodObject<{
184
130
  id: string;
185
131
  displayValue: string;
186
132
  kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
187
- }>, z.ZodArray<z.ZodObject<{
188
- id: z.ZodString;
189
- kind: z.ZodEnum<["ORGANIZATION", "DEPARTMENT", "USER", "RISK_CONTRIBUTOR"]>;
190
- displayValue: z.ZodString;
191
- value: z.ZodString;
192
- inclusive: z.ZodBoolean;
193
- }, "strip", z.ZodTypeAny, {
194
- inclusive: boolean;
195
- value: string;
196
- id: string;
197
- displayValue: string;
198
- kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
199
- }, {
200
- inclusive: boolean;
201
- value: string;
202
- id: string;
203
- displayValue: string;
204
- kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
205
- }>, "many">]>;
133
+ }>, "many">;
206
134
  multiplier: z.ZodNumber;
207
135
  tid: z.ZodString;
208
136
  }, "strip", z.ZodTypeAny, {
@@ -211,31 +139,13 @@ export declare const _PlatformCustomScoreCohortUpsertDto: z.ZodObject<{
211
139
  createdAt: string;
212
140
  updatedAt: string;
213
141
  deletedAt: string | null;
214
- cohort: ({
215
- inclusive: boolean;
216
- value: string;
217
- id: string;
218
- displayValue: string;
219
- kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
220
- } | {
142
+ cohort: {
221
143
  inclusive: boolean;
222
144
  value: string;
223
145
  id: string;
224
146
  displayValue: string;
225
147
  kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
226
- }[]) & ({
227
- inclusive: boolean;
228
- value: string;
229
- id: string;
230
- displayValue: string;
231
- kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
232
- } | {
233
- inclusive: boolean;
234
- value: string;
235
- id: string;
236
- displayValue: string;
237
- kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
238
- }[] | undefined);
148
+ }[];
239
149
  multiplier: number;
240
150
  }, {
241
151
  id: string;
@@ -243,31 +153,13 @@ export declare const _PlatformCustomScoreCohortUpsertDto: z.ZodObject<{
243
153
  createdAt: string;
244
154
  updatedAt: string;
245
155
  deletedAt: string | null;
246
- cohort: ({
247
- inclusive: boolean;
248
- value: string;
249
- id: string;
250
- displayValue: string;
251
- kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
252
- } | {
253
- inclusive: boolean;
254
- value: string;
255
- id: string;
256
- displayValue: string;
257
- kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
258
- }[]) & ({
259
- inclusive: boolean;
260
- value: string;
261
- id: string;
262
- displayValue: string;
263
- kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
264
- } | {
156
+ cohort: {
265
157
  inclusive: boolean;
266
158
  value: string;
267
159
  id: string;
268
160
  displayValue: string;
269
161
  kind: "USER" | "ORGANIZATION" | "DEPARTMENT" | "RISK_CONTRIBUTOR";
270
- }[] | undefined);
162
+ }[];
271
163
  multiplier: number;
272
164
  }>;
273
165
  export type PlatformCustomScoreCohortUpsertDto = z.infer<typeof _PlatformCustomScoreCohortUpsertDto>;
@@ -13,6 +13,7 @@ export declare const _PlatformFindingSpecDto: z.ZodObject<{
13
13
  deletedAt: z.ZodNullable<z.ZodString>;
14
14
  displayValue: z.ZodString;
15
15
  score: z.ZodOptional<z.ZodNumber>;
16
+ kind: z.ZodNativeEnum<typeof import("..").FindingSpecKind>;
16
17
  eventType: z.ZodString;
17
18
  severity: z.ZodNativeEnum<typeof import("..").FindingSeverity>;
18
19
  insights: z.ZodOptional<z.ZodObject<{
@@ -119,6 +120,7 @@ export declare const _PlatformFindingSpecDto: z.ZodObject<{
119
120
  updatedAt: string;
120
121
  deletedAt: string | null;
121
122
  displayValue: string;
123
+ kind: import("..").FindingSpecKind;
122
124
  eventType: string;
123
125
  severity: import("..").FindingSeverity;
124
126
  description?: unknown;
@@ -153,6 +155,7 @@ export declare const _PlatformFindingSpecDto: z.ZodObject<{
153
155
  updatedAt: string;
154
156
  deletedAt: string | null;
155
157
  displayValue: string;
158
+ kind: import("..").FindingSpecKind;
156
159
  eventType: string;
157
160
  severity: import("..").FindingSeverity;
158
161
  description?: unknown;
@@ -191,6 +194,7 @@ export declare const _PlatformFindingSpecUpsertDto: z.ZodObject<{
191
194
  deletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
192
195
  displayValue: z.ZodString;
193
196
  score: z.ZodOptional<z.ZodNumber>;
197
+ kind: z.ZodNativeEnum<typeof import("..").FindingSpecKind>;
194
198
  eventType: z.ZodString;
195
199
  severity: z.ZodNativeEnum<typeof import("..").FindingSeverity>;
196
200
  insights: z.ZodOptional<z.ZodObject<{
@@ -293,6 +297,7 @@ export declare const _PlatformFindingSpecUpsertDto: z.ZodObject<{
293
297
  name: string;
294
298
  tid: string;
295
299
  displayValue: string;
300
+ kind: import("..").FindingSpecKind;
296
301
  eventType: string;
297
302
  severity: import("..").FindingSeverity;
298
303
  description?: unknown;
@@ -327,6 +332,7 @@ export declare const _PlatformFindingSpecUpsertDto: z.ZodObject<{
327
332
  name: string;
328
333
  tid: string;
329
334
  displayValue: string;
335
+ kind: import("..").FindingSpecKind;
330
336
  eventType: string;
331
337
  severity: import("..").FindingSeverity;
332
338
  description?: unknown;
@@ -0,0 +1,47 @@
1
+ import { z } from 'zod';
2
+ import { AgentDto, AgentUpsertDto, Page } from '../dto';
3
+ import { AmpEntityServiceImpl } from './entity.service';
4
+ import { RestClient } from './rest';
5
+ declare const _AgentSummaryPayload: z.ZodObject<{
6
+ email: z.ZodString;
7
+ status: z.ZodOptional<z.ZodNativeEnum<typeof import("../dto").AgentStatus>>;
8
+ id: z.ZodOptional<z.ZodString>;
9
+ createdAt: z.ZodOptional<z.ZodString>;
10
+ updatedAt: z.ZodOptional<z.ZodString>;
11
+ deletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
+ firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
+ lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
+ pictureUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
15
+ role: z.ZodNativeEnum<typeof import("../dto").AuthRole>;
16
+ lastLoggedIn: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ email: string;
19
+ role: import("../dto").AuthRole;
20
+ status?: import("../dto").AgentStatus | undefined;
21
+ id?: string | undefined;
22
+ createdAt?: string | undefined;
23
+ updatedAt?: string | undefined;
24
+ deletedAt?: string | null | undefined;
25
+ firstName?: string | null | undefined;
26
+ lastName?: string | null | undefined;
27
+ pictureUrl?: string | null | undefined;
28
+ lastLoggedIn?: Date | null | undefined;
29
+ }, {
30
+ email: string;
31
+ role: import("../dto").AuthRole;
32
+ status?: import("../dto").AgentStatus | undefined;
33
+ id?: string | undefined;
34
+ createdAt?: string | undefined;
35
+ updatedAt?: string | undefined;
36
+ deletedAt?: string | null | undefined;
37
+ firstName?: string | null | undefined;
38
+ lastName?: string | null | undefined;
39
+ pictureUrl?: string | null | undefined;
40
+ lastLoggedIn?: Date | null | undefined;
41
+ }>;
42
+ export type AgentSummaryPayload = z.infer<typeof _AgentSummaryPayload>;
43
+ export declare class AgentsService extends AmpEntityServiceImpl<AgentUpsertDto, AgentDto> {
44
+ constructor(rest: RestClient);
45
+ invite: (agentSavePayload: AgentSummaryPayload) => Promise<Page<AgentDto>>;
46
+ }
47
+ export {};
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AgentsService = void 0;
4
+ const dto_1 = require("../dto");
5
+ const constants_1 = require("./constants");
6
+ const entity_service_1 = require("./entity.service");
7
+ const _AgentSummaryPayload = dto_1._AgentSummaryUpsertDto.required({ email: true, role: true });
8
+ class AgentsService extends entity_service_1.AmpEntityServiceImpl {
9
+ constructor(rest) {
10
+ super(rest, constants_1.KIND.AGENTS);
11
+ this.invite = async (agentSavePayload) => {
12
+ const payload = _AgentSummaryPayload.parse(agentSavePayload);
13
+ const res = await this.rest.call({
14
+ url: `/${this.targetApi}/v1/${this.kind}/invite`,
15
+ method: 'POST',
16
+ data: payload,
17
+ });
18
+ return res.data;
19
+ };
20
+ }
21
+ }
22
+ exports.AgentsService = AgentsService;
23
+ //# sourceMappingURL=AgentsService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentsService.js","sourceRoot":"","sources":["../../../src/services/AgentsService.ts"],"names":[],"mappings":";;;AACA,gCAA8E;AAC9E,2CAAiC;AACjC,qDAAsD;AAGtD,MAAM,oBAAoB,GAAG,4BAAsB,CAAC,QAAQ,CAAC,EAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;AAGxF,MAAa,aAAc,SAAQ,qCAA8C;IAC/E,YAAY,IAAgB;QAC1B,KAAK,CAAC,IAAI,EAAE,gBAAI,CAAC,MAAM,CAAC,CAAC;QAE3B,WAAM,GAAG,KAAK,EAAE,gBAAqC,EAA2B,EAAE;YAChF,MAAM,OAAO,GAAG,oBAAoB,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YAE7D,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC/B,GAAG,EAAE,IAAI,IAAI,CAAC,SAAS,OAAO,IAAI,CAAC,IAAI,SAAS;gBAChD,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,OAAO;aACd,CAAC,CAAC;YAEH,OAAO,GAAG,CAAC,IAAsB,CAAC;QACpC,CAAC,CAAC;IAXF,CAAC;CAYF;AAfD,sCAeC"}
@@ -1,9 +1,10 @@
1
- import { ActionExecutionDto, AgentDto, AgentUpsertDto, AssetDto, CustomScoreCohortDto, CustomScoreCohortUpsertDto, CustomScoreValueDto, CustomScoreValueUpsertDto, FindingSpecDto, FindingSpecUpsertDto, ProviderDto, ReportResultDto, SaasAssetDto, SaasComponentDto, SaasUserDto, TenantDto, TenantUpsertDto, TokenDto, UserDto } from '../dto';
1
+ import { ActionExecutionDto, AssetDto, CustomScoreCohortDto, CustomScoreCohortUpsertDto, CustomScoreValueDto, CustomScoreValueUpsertDto, FindingSpecDto, FindingSpecUpsertDto, ProviderDto, ReportResultDto, SaasAssetDto, SaasComponentDto, SaasUserDto, TenantDto, TenantUpsertDto, TokenDto, UserDto } from '../dto';
2
2
  import { AmpEntityService, AmpDataService, AmpReportService, AmpSettingsService, ConnectorsService, FindingsInsightsService, FindingsService, NotificationService, PredictionService, CustomActionsService } from '.';
3
3
  import { AmpRestClientOptions, AgentIdentityService, ConnectorInstallService, EnumService, RestClient } from './rest';
4
4
  import { UsersInsightsService } from './usersInsights.service';
5
5
  import { FlowSpecsService } from './flowSpecs.service';
6
6
  import { CohortService } from './rest/CohortService';
7
+ import { AgentsService } from './AgentsService';
7
8
  export type AmpApiOptions = AmpRestClientOptions;
8
9
  /**
9
10
  * AMP API
@@ -19,7 +20,7 @@ export type AmpApiOptions = AmpRestClientOptions;
19
20
  */
20
21
  export declare class AmpApi {
21
22
  readonly actionExecutions: AmpDataService<ActionExecutionDto>;
22
- readonly agents: AmpEntityService<AgentUpsertDto, AgentDto>;
23
+ readonly agents: AgentsService;
23
24
  readonly asset: AmpDataService<AssetDto>;
24
25
  readonly cohorts: CohortService;
25
26
  readonly connectors: ConnectorsService;
@@ -7,6 +7,7 @@ const rest_1 = require("./rest");
7
7
  const usersInsights_service_1 = require("./usersInsights.service");
8
8
  const flowSpecs_service_1 = require("./flowSpecs.service");
9
9
  const CohortService_1 = require("./rest/CohortService");
10
+ const AgentsService_1 = require("./AgentsService");
10
11
  /**
11
12
  * AMP API
12
13
  * This client is a wrapper around the AMP REST API meant to be used by
@@ -22,7 +23,7 @@ const CohortService_1 = require("./rest/CohortService");
22
23
  class AmpApi {
23
24
  constructor(rest) {
24
25
  this.actionExecutions = new _1.AmpDataServiceImpl(rest, constants_1.KIND.ACTION_EXECUTION);
25
- this.agents = new _1.AmpEntityServiceImpl(rest, constants_1.KIND.AGENTS);
26
+ this.agents = new AgentsService_1.AgentsService(rest);
26
27
  this.asset = new _1.AmpDataServiceImpl(rest, constants_1.KIND.ASSETS);
27
28
  this.cohorts = new CohortService_1.CohortService(rest);
28
29
  this.connectors = new _1.ConnectorsService(rest);
@@ -1 +1 @@
1
- {"version":3,"file":"AmpApi.js","sourceRoot":"","sources":["../../../src/services/AmpApi.ts"],"names":[],"mappings":";;;AAqBA,wBAcW;AACX,2CAAmD;AACnD,iCAA0J;AAC1J,mEAA6D;AAC7D,2DAAqD;AACrD,wDAAmD;AAInD;;;;;;;;;;;GAWG;AACH,MAAa,MAAM;IA8BjB,YAAY,IAAgB;QAC1B,IAAI,CAAC,gBAAgB,GAAG,IAAI,qBAAkB,CAAqB,IAAI,EAAE,gBAAI,CAAC,gBAAgB,CAAC,CAAC;QAChG,IAAI,CAAC,MAAM,GAAG,IAAI,uBAAoB,CAA2B,IAAI,EAAE,gBAAI,CAAC,MAAM,CAAC,CAAC;QACpF,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAkB,CAAW,IAAI,EAAE,gBAAI,CAAC,MAAM,CAAC,CAAC;QACjE,IAAI,CAAC,OAAO,GAAG,IAAI,6BAAa,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,UAA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AAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF;AAjED,wBAiEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampsec/platform-client",
3
- "version": "64.4.0",
3
+ "version": "66.0.0",
4
4
  "description": "",
5
5
  "main": "build/src/index.js",
6
6
  "runkitExampleFilename": "example/main.js",
@@ -1,12 +1,14 @@
1
1
  import {AgentStatus} from './enums/agent.status';
2
- import {BaseDto, BaseUpsertDto} from './base.dto';
2
+ import {BaseDto, BaseUpsertDto, _BaseDto, _BaseUpsertDto} from './base.dto';
3
+ import {AuthRole} from './enums';
4
+ import {z} from 'zod';
3
5
  // import {AgentRole} from './enums';
4
6
 
5
7
  export type AgentUpsertDto = BaseUpsertDto & {
6
8
  /** Agent first name */
7
- firstName: string;
9
+ firstName: string | null;
8
10
  /** Agent last name */
9
- lastName: string;
11
+ lastName: string | null;
10
12
  /** Status of the Agent, e.g. ACTIVE */
11
13
  status: AgentStatus;
12
14
  /** External Id */
@@ -18,3 +20,20 @@ export type AgentUpsertDto = BaseUpsertDto & {
18
20
  };
19
21
 
20
22
  export type AgentDto = BaseDto & AgentUpsertDto;
23
+
24
+ export const _AgentSummaryDto = z
25
+ .object({
26
+ firstName: z.string().nullable(),
27
+ lastName: z.string().nullable(),
28
+ email: z.string(),
29
+ pictureUrl: z.string().nullable().optional(),
30
+ status: z.nativeEnum(AgentStatus),
31
+ role: z.nativeEnum(AuthRole),
32
+ lastLoggedIn: z.date().nullable(),
33
+ })
34
+ .merge(_BaseDto);
35
+
36
+ export type AgentSummaryDto = z.infer<typeof _AgentSummaryDto>;
37
+
38
+ export const _AgentSummaryUpsertDto = _AgentSummaryDto.partial();
39
+ export type AgentSummaryUpsertDto = z.infer<typeof _AgentSummaryUpsertDto>;
@@ -3,7 +3,7 @@ import {UPSERT_DTO_MASK, _BaseDto} from './base.dto';
3
3
 
4
4
  const _BaseCustomAction = _BaseDto.extend({
5
5
  displayValue: z.string(),
6
- description: z.string(),
6
+ description: z.string().optional(),
7
7
  isTemplate: z.boolean(),
8
8
  retryStrategy: z
9
9
  .object({
@@ -18,13 +18,15 @@ export const _CustomRestActionMetaDto = z.object({
18
18
  request: z.object({
19
19
  url: z.string(),
20
20
  method: z.string(),
21
- payload: z.object({
22
- kind: z.literal('TEMPLATE'),
23
- format: z.literal('JSON'),
24
- value: z.string(),
25
- }),
26
- headers: z.record(z.string()),
27
- params: z.record(z.string()),
21
+ payload: z
22
+ .object({
23
+ kind: z.literal('TEMPLATE'),
24
+ format: z.literal('JSON'),
25
+ value: z.string(),
26
+ })
27
+ .optional(),
28
+ headers: z.record(z.string()).optional(),
29
+ params: z.record(z.string()).optional(),
28
30
  }),
29
31
  timeout: z.number().optional(),
30
32
  });
@@ -16,7 +16,7 @@ export const _CustomScoreValueUpsertDto = _CustomScoreValueDto.partial(UPSERT_DT
16
16
  export type CustomScoreValueUpsertDto = z.infer<typeof _CustomScoreValueUpsertDto>;
17
17
 
18
18
  export const _CustomScoreCohortDto = _BaseDto.extend({
19
- cohort: z.union([_AmplifierCohortDto, z.array(_AmplifierCohortDto)]),
19
+ cohort: z.array(_AmplifierCohortDto),
20
20
  multiplier: z.number(),
21
21
  });
22
22
  export type CustomScoreCohortDto = z.infer<typeof _CustomScoreCohortDto>;
@@ -0,0 +1,4 @@
1
+ export enum FindingSpecKind {
2
+ CUSTOM = 'CUSTOM',
3
+ SYSTEM = 'SYSTEM',
4
+ }
@@ -7,6 +7,7 @@ export * from './computer.os.enum';
7
7
  export * from './connector.status';
8
8
  export * from './contact.type';
9
9
  export * from './findingKind';
10
+ export * from './findingSpecKind';
10
11
  export * from './finding.severity';
11
12
  export * from './finding.status';
12
13
  export * from './finding.outcome';
@@ -1,7 +1,7 @@
1
1
  import {z} from 'zod';
2
2
  import {SimpleAssetDto} from './assets.dto';
3
3
  import {BaseDto, BaseUpsertDto, _BaseDto} from './base.dto';
4
- import {Category, FindingKind, SaasComponentKind} from './enums';
4
+ import {Category, FindingKind, FindingSpecKind, SaasComponentKind} from './enums';
5
5
  import {FindingOutcome, FindingSeverity, FindingStatus} from './enums';
6
6
  import {SimpleProviderDto} from './providers.dto';
7
7
  import {SaasComponentMeta} from './saasComponents.dto';
@@ -100,6 +100,7 @@ export const _FindingSpecDto = _BaseDto.extend({
100
100
  .optional(),
101
101
  expireAfterDays: z.nullable(z.number()).optional(),
102
102
  outcome: z.nativeEnum(FindingOutcome).optional(), // TODO add column and form field??? Or just default to REMEDIATION?
103
+ kind: z.nativeEnum(FindingSpecKind),
103
104
  score: z.number().optional(),
104
105
  });
105
106
  export type FindingSpecDto = z.infer<typeof _FindingSpecDto>;
@@ -0,0 +1,25 @@
1
+ import {z} from 'zod';
2
+ import {AgentDto, AgentUpsertDto, Page, _AgentSummaryUpsertDto} from '../dto';
3
+ import {KIND} from './constants';
4
+ import {AmpEntityServiceImpl} from './entity.service';
5
+ import {RestClient} from './rest';
6
+
7
+ const _AgentSummaryPayload = _AgentSummaryUpsertDto.required({email: true, role: true});
8
+ export type AgentSummaryPayload = z.infer<typeof _AgentSummaryPayload>;
9
+
10
+ export class AgentsService extends AmpEntityServiceImpl<AgentUpsertDto, AgentDto> {
11
+ constructor(rest: RestClient) {
12
+ super(rest, KIND.AGENTS);
13
+ }
14
+ invite = async (agentSavePayload: AgentSummaryPayload): Promise<Page<AgentDto>> => {
15
+ const payload = _AgentSummaryPayload.parse(agentSavePayload);
16
+
17
+ const res = await this.rest.call({
18
+ url: `/${this.targetApi}/v1/${this.kind}/invite`,
19
+ method: 'POST',
20
+ data: payload,
21
+ });
22
+
23
+ return res.data as Page<AgentDto>;
24
+ };
25
+ }
@@ -1,7 +1,5 @@
1
1
  import {
2
2
  ActionExecutionDto,
3
- AgentDto,
4
- AgentUpsertDto,
5
3
  AssetDto,
6
4
  CustomScoreCohortDto,
7
5
  CustomScoreCohortUpsertDto,
@@ -39,6 +37,7 @@ import {getAmpRestClient, AmpRestClientOptions, AgentIdentityService, ConnectorI
39
37
  import {UsersInsightsService} from './usersInsights.service';
40
38
  import {FlowSpecsService} from './flowSpecs.service';
41
39
  import {CohortService} from './rest/CohortService';
40
+ import {AgentsService} from './AgentsService';
42
41
 
43
42
  export type AmpApiOptions = AmpRestClientOptions;
44
43
 
@@ -56,7 +55,7 @@ export type AmpApiOptions = AmpRestClientOptions;
56
55
  */
57
56
  export class AmpApi {
58
57
  readonly actionExecutions: AmpDataService<ActionExecutionDto>;
59
- readonly agents: AmpEntityService<AgentUpsertDto, AgentDto>;
58
+ readonly agents: AgentsService;
60
59
  readonly asset: AmpDataService<AssetDto>;
61
60
  readonly cohorts: CohortService;
62
61
  readonly connectors: ConnectorsService;
@@ -86,7 +85,7 @@ export class AmpApi {
86
85
 
87
86
  constructor(rest: RestClient) {
88
87
  this.actionExecutions = new AmpDataServiceImpl<ActionExecutionDto>(rest, KIND.ACTION_EXECUTION);
89
- this.agents = new AmpEntityServiceImpl<AgentUpsertDto, AgentDto>(rest, KIND.AGENTS);
88
+ this.agents = new AgentsService(rest);
90
89
  this.asset = new AmpDataServiceImpl<AssetDto>(rest, KIND.ASSETS);
91
90
  this.cohorts = new CohortService(rest);
92
91
  this.connectors = new ConnectorsService(rest);