@ampsec/platform-client 64.3.0 → 65.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.
@@ -102,6 +102,49 @@ export declare const _PlatformFlowSpecUpsertDto: z.ZodObject<{
102
102
  value?: number | undefined;
103
103
  units?: string | undefined;
104
104
  }>>;
105
+ triage: z.ZodOptional<z.ZodObject<{
106
+ message: z.ZodString;
107
+ yesAction: z.ZodObject<{
108
+ actionId: z.ZodString;
109
+ findingStatus: z.ZodOptional<z.ZodNativeEnum<typeof import("..").FindingStatus>>;
110
+ }, "strip", z.ZodTypeAny, {
111
+ actionId: string;
112
+ findingStatus?: import("..").FindingStatus | undefined;
113
+ }, {
114
+ actionId: string;
115
+ findingStatus?: import("..").FindingStatus | undefined;
116
+ }>;
117
+ noAction: z.ZodObject<{
118
+ actionId: z.ZodString;
119
+ findingStatus: z.ZodOptional<z.ZodNativeEnum<typeof import("..").FindingStatus>>;
120
+ }, "strip", z.ZodTypeAny, {
121
+ actionId: string;
122
+ findingStatus?: import("..").FindingStatus | undefined;
123
+ }, {
124
+ actionId: string;
125
+ findingStatus?: import("..").FindingStatus | undefined;
126
+ }>;
127
+ }, "strip", z.ZodTypeAny, {
128
+ message: string;
129
+ yesAction: {
130
+ actionId: string;
131
+ findingStatus?: import("..").FindingStatus | undefined;
132
+ };
133
+ noAction: {
134
+ actionId: string;
135
+ findingStatus?: import("..").FindingStatus | undefined;
136
+ };
137
+ }, {
138
+ message: string;
139
+ yesAction: {
140
+ actionId: string;
141
+ findingStatus?: import("..").FindingStatus | undefined;
142
+ };
143
+ noAction: {
144
+ actionId: string;
145
+ findingStatus?: import("..").FindingStatus | undefined;
146
+ };
147
+ }>>;
105
148
  reminderInterval: z.ZodOptional<z.ZodObject<{
106
149
  minutes: z.ZodNumber;
107
150
  value: z.ZodOptional<z.ZodNumber>;
@@ -129,27 +172,7 @@ export declare const _PlatformFlowSpecUpsertDto: z.ZodObject<{
129
172
  findingStatus?: import("..").FindingStatus | undefined;
130
173
  }>>;
131
174
  simpleTriageYesActId: z.ZodOptional<z.ZodString>;
132
- simpleTriageYesAction: z.ZodOptional<z.ZodObject<{
133
- actionId: z.ZodString;
134
- findingStatus: z.ZodOptional<z.ZodNativeEnum<typeof import("..").FindingStatus>>;
135
- }, "strip", z.ZodTypeAny, {
136
- actionId: string;
137
- findingStatus?: import("..").FindingStatus | undefined;
138
- }, {
139
- actionId: string;
140
- findingStatus?: import("..").FindingStatus | undefined;
141
- }>>;
142
175
  simpleTriageNoActId: z.ZodOptional<z.ZodString>;
143
- simpleTriageNoAction: z.ZodOptional<z.ZodObject<{
144
- actionId: z.ZodString;
145
- findingStatus: z.ZodOptional<z.ZodNativeEnum<typeof import("..").FindingStatus>>;
146
- }, "strip", z.ZodTypeAny, {
147
- actionId: string;
148
- findingStatus?: import("..").FindingStatus | undefined;
149
- }, {
150
- actionId: string;
151
- findingStatus?: import("..").FindingStatus | undefined;
152
- }>>;
153
176
  resolveNowActionId: z.ZodOptional<z.ZodString>;
154
177
  resolveNowAction: z.ZodOptional<z.ZodObject<{
155
178
  actionId: z.ZodString;
@@ -169,15 +192,7 @@ export declare const _PlatformFlowSpecUpsertDto: z.ZodObject<{
169
192
  findingStatus?: import("..").FindingStatus | undefined;
170
193
  } | undefined;
171
194
  simpleTriageYesActId?: string | undefined;
172
- simpleTriageYesAction?: {
173
- actionId: string;
174
- findingStatus?: import("..").FindingStatus | undefined;
175
- } | undefined;
176
195
  simpleTriageNoActId?: string | undefined;
177
- simpleTriageNoAction?: {
178
- actionId: string;
179
- findingStatus?: import("..").FindingStatus | undefined;
180
- } | undefined;
181
196
  resolveNowActionId?: string | undefined;
182
197
  resolveNowAction?: {
183
198
  actionId: string;
@@ -191,15 +206,7 @@ export declare const _PlatformFlowSpecUpsertDto: z.ZodObject<{
191
206
  findingStatus?: import("..").FindingStatus | undefined;
192
207
  } | undefined;
193
208
  simpleTriageYesActId?: string | undefined;
194
- simpleTriageYesAction?: {
195
- actionId: string;
196
- findingStatus?: import("..").FindingStatus | undefined;
197
- } | undefined;
198
209
  simpleTriageNoActId?: string | undefined;
199
- simpleTriageNoAction?: {
200
- actionId: string;
201
- findingStatus?: import("..").FindingStatus | undefined;
202
- } | undefined;
203
210
  resolveNowActionId?: string | undefined;
204
211
  resolveNowAction?: {
205
212
  actionId: string;
@@ -287,6 +294,17 @@ export declare const _PlatformFlowSpecUpsertDto: z.ZodObject<{
287
294
  value?: number | undefined;
288
295
  units?: string | undefined;
289
296
  } | undefined;
297
+ triage?: {
298
+ message: string;
299
+ yesAction: {
300
+ actionId: string;
301
+ findingStatus?: import("..").FindingStatus | undefined;
302
+ };
303
+ noAction: {
304
+ actionId: string;
305
+ findingStatus?: import("..").FindingStatus | undefined;
306
+ };
307
+ } | undefined;
290
308
  reminderInterval?: {
291
309
  minutes: number;
292
310
  value?: number | undefined;
@@ -300,15 +318,7 @@ export declare const _PlatformFlowSpecUpsertDto: z.ZodObject<{
300
318
  findingStatus?: import("..").FindingStatus | undefined;
301
319
  } | undefined;
302
320
  simpleTriageYesActId?: string | undefined;
303
- simpleTriageYesAction?: {
304
- actionId: string;
305
- findingStatus?: import("..").FindingStatus | undefined;
306
- } | undefined;
307
321
  simpleTriageNoActId?: string | undefined;
308
- simpleTriageNoAction?: {
309
- actionId: string;
310
- findingStatus?: import("..").FindingStatus | undefined;
311
- } | undefined;
312
322
  resolveNowActionId?: string | undefined;
313
323
  resolveNowAction?: {
314
324
  actionId: string;
@@ -370,6 +380,17 @@ export declare const _PlatformFlowSpecUpsertDto: z.ZodObject<{
370
380
  value?: number | undefined;
371
381
  units?: string | undefined;
372
382
  } | undefined;
383
+ triage?: {
384
+ message: string;
385
+ yesAction: {
386
+ actionId: string;
387
+ findingStatus?: import("..").FindingStatus | undefined;
388
+ };
389
+ noAction: {
390
+ actionId: string;
391
+ findingStatus?: import("..").FindingStatus | undefined;
392
+ };
393
+ } | undefined;
373
394
  reminderInterval?: {
374
395
  minutes: number;
375
396
  value?: number | undefined;
@@ -383,15 +404,7 @@ export declare const _PlatformFlowSpecUpsertDto: z.ZodObject<{
383
404
  findingStatus?: import("..").FindingStatus | undefined;
384
405
  } | undefined;
385
406
  simpleTriageYesActId?: string | undefined;
386
- simpleTriageYesAction?: {
387
- actionId: string;
388
- findingStatus?: import("..").FindingStatus | undefined;
389
- } | undefined;
390
407
  simpleTriageNoActId?: string | undefined;
391
- simpleTriageNoAction?: {
392
- actionId: string;
393
- findingStatus?: import("..").FindingStatus | undefined;
394
- } | undefined;
395
408
  resolveNowActionId?: string | undefined;
396
409
  resolveNowAction?: {
397
410
  actionId: string;
@@ -527,6 +540,49 @@ export declare const _PlatformFlowSpecDto: z.ZodObject<{
527
540
  value?: number | undefined;
528
541
  units?: string | undefined;
529
542
  }>>;
543
+ triage: z.ZodOptional<z.ZodObject<{
544
+ message: z.ZodString;
545
+ yesAction: z.ZodObject<{
546
+ actionId: z.ZodString;
547
+ findingStatus: z.ZodOptional<z.ZodNativeEnum<typeof import("..").FindingStatus>>;
548
+ }, "strip", z.ZodTypeAny, {
549
+ actionId: string;
550
+ findingStatus?: import("..").FindingStatus | undefined;
551
+ }, {
552
+ actionId: string;
553
+ findingStatus?: import("..").FindingStatus | undefined;
554
+ }>;
555
+ noAction: z.ZodObject<{
556
+ actionId: z.ZodString;
557
+ findingStatus: z.ZodOptional<z.ZodNativeEnum<typeof import("..").FindingStatus>>;
558
+ }, "strip", z.ZodTypeAny, {
559
+ actionId: string;
560
+ findingStatus?: import("..").FindingStatus | undefined;
561
+ }, {
562
+ actionId: string;
563
+ findingStatus?: import("..").FindingStatus | undefined;
564
+ }>;
565
+ }, "strip", z.ZodTypeAny, {
566
+ message: string;
567
+ yesAction: {
568
+ actionId: string;
569
+ findingStatus?: import("..").FindingStatus | undefined;
570
+ };
571
+ noAction: {
572
+ actionId: string;
573
+ findingStatus?: import("..").FindingStatus | undefined;
574
+ };
575
+ }, {
576
+ message: string;
577
+ yesAction: {
578
+ actionId: string;
579
+ findingStatus?: import("..").FindingStatus | undefined;
580
+ };
581
+ noAction: {
582
+ actionId: string;
583
+ findingStatus?: import("..").FindingStatus | undefined;
584
+ };
585
+ }>>;
530
586
  reminderInterval: z.ZodOptional<z.ZodObject<{
531
587
  minutes: z.ZodNumber;
532
588
  value: z.ZodOptional<z.ZodNumber>;
@@ -554,27 +610,7 @@ export declare const _PlatformFlowSpecDto: z.ZodObject<{
554
610
  findingStatus?: import("..").FindingStatus | undefined;
555
611
  }>>;
556
612
  simpleTriageYesActId: z.ZodOptional<z.ZodString>;
557
- simpleTriageYesAction: z.ZodOptional<z.ZodObject<{
558
- actionId: z.ZodString;
559
- findingStatus: z.ZodOptional<z.ZodNativeEnum<typeof import("..").FindingStatus>>;
560
- }, "strip", z.ZodTypeAny, {
561
- actionId: string;
562
- findingStatus?: import("..").FindingStatus | undefined;
563
- }, {
564
- actionId: string;
565
- findingStatus?: import("..").FindingStatus | undefined;
566
- }>>;
567
613
  simpleTriageNoActId: z.ZodOptional<z.ZodString>;
568
- simpleTriageNoAction: z.ZodOptional<z.ZodObject<{
569
- actionId: z.ZodString;
570
- findingStatus: z.ZodOptional<z.ZodNativeEnum<typeof import("..").FindingStatus>>;
571
- }, "strip", z.ZodTypeAny, {
572
- actionId: string;
573
- findingStatus?: import("..").FindingStatus | undefined;
574
- }, {
575
- actionId: string;
576
- findingStatus?: import("..").FindingStatus | undefined;
577
- }>>;
578
614
  resolveNowActionId: z.ZodOptional<z.ZodString>;
579
615
  resolveNowAction: z.ZodOptional<z.ZodObject<{
580
616
  actionId: z.ZodString;
@@ -594,15 +630,7 @@ export declare const _PlatformFlowSpecDto: z.ZodObject<{
594
630
  findingStatus?: import("..").FindingStatus | undefined;
595
631
  } | undefined;
596
632
  simpleTriageYesActId?: string | undefined;
597
- simpleTriageYesAction?: {
598
- actionId: string;
599
- findingStatus?: import("..").FindingStatus | undefined;
600
- } | undefined;
601
633
  simpleTriageNoActId?: string | undefined;
602
- simpleTriageNoAction?: {
603
- actionId: string;
604
- findingStatus?: import("..").FindingStatus | undefined;
605
- } | undefined;
606
634
  resolveNowActionId?: string | undefined;
607
635
  resolveNowAction?: {
608
636
  actionId: string;
@@ -616,15 +644,7 @@ export declare const _PlatformFlowSpecDto: z.ZodObject<{
616
644
  findingStatus?: import("..").FindingStatus | undefined;
617
645
  } | undefined;
618
646
  simpleTriageYesActId?: string | undefined;
619
- simpleTriageYesAction?: {
620
- actionId: string;
621
- findingStatus?: import("..").FindingStatus | undefined;
622
- } | undefined;
623
647
  simpleTriageNoActId?: string | undefined;
624
- simpleTriageNoAction?: {
625
- actionId: string;
626
- findingStatus?: import("..").FindingStatus | undefined;
627
- } | undefined;
628
648
  resolveNowActionId?: string | undefined;
629
649
  resolveNowAction?: {
630
650
  actionId: string;
@@ -725,6 +745,17 @@ export declare const _PlatformFlowSpecDto: z.ZodObject<{
725
745
  value?: number | undefined;
726
746
  units?: string | undefined;
727
747
  } | undefined;
748
+ triage?: {
749
+ message: string;
750
+ yesAction: {
751
+ actionId: string;
752
+ findingStatus?: import("..").FindingStatus | undefined;
753
+ };
754
+ noAction: {
755
+ actionId: string;
756
+ findingStatus?: import("..").FindingStatus | undefined;
757
+ };
758
+ } | undefined;
728
759
  reminderInterval?: {
729
760
  minutes: number;
730
761
  value?: number | undefined;
@@ -738,15 +769,7 @@ export declare const _PlatformFlowSpecDto: z.ZodObject<{
738
769
  findingStatus?: import("..").FindingStatus | undefined;
739
770
  } | undefined;
740
771
  simpleTriageYesActId?: string | undefined;
741
- simpleTriageYesAction?: {
742
- actionId: string;
743
- findingStatus?: import("..").FindingStatus | undefined;
744
- } | undefined;
745
772
  simpleTriageNoActId?: string | undefined;
746
- simpleTriageNoAction?: {
747
- actionId: string;
748
- findingStatus?: import("..").FindingStatus | undefined;
749
- } | undefined;
750
773
  resolveNowActionId?: string | undefined;
751
774
  resolveNowAction?: {
752
775
  actionId: string;
@@ -813,6 +836,17 @@ export declare const _PlatformFlowSpecDto: z.ZodObject<{
813
836
  value?: number | undefined;
814
837
  units?: string | undefined;
815
838
  } | undefined;
839
+ triage?: {
840
+ message: string;
841
+ yesAction: {
842
+ actionId: string;
843
+ findingStatus?: import("..").FindingStatus | undefined;
844
+ };
845
+ noAction: {
846
+ actionId: string;
847
+ findingStatus?: import("..").FindingStatus | undefined;
848
+ };
849
+ } | undefined;
816
850
  reminderInterval?: {
817
851
  minutes: number;
818
852
  value?: number | undefined;
@@ -826,15 +860,7 @@ export declare const _PlatformFlowSpecDto: z.ZodObject<{
826
860
  findingStatus?: import("..").FindingStatus | undefined;
827
861
  } | undefined;
828
862
  simpleTriageYesActId?: string | undefined;
829
- simpleTriageYesAction?: {
830
- actionId: string;
831
- findingStatus?: import("..").FindingStatus | undefined;
832
- } | undefined;
833
863
  simpleTriageNoActId?: string | undefined;
834
- simpleTriageNoAction?: {
835
- actionId: string;
836
- findingStatus?: import("..").FindingStatus | undefined;
837
- } | undefined;
838
864
  resolveNowActionId?: string | undefined;
839
865
  resolveNowAction?: {
840
866
  actionId: string;
@@ -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,UAAU,GAAG,IAAI,oBAAiB,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,aAAa,GAAG,IAAI,uBAAoB,CAAC,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,kBAAkB,GAAG,IAAI,uBAAoB,CAAmD,IAAI,EAAE,gBAAI,CAAC,oBAAoB,CAAC,CAAC;QACtI,IAAI,CAAC,iBAAiB,GAAG,IAAI,uBAAoB,CAAiD,IAAI,EAAE,gBAAI,CAAC,mBAAmB,CAAC,CAAC;QAClI,IAAI,CAAC,KAAK,GAAG,IAAI,yBAAkB,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,QAAQ,GAAG,IAAI,kBAAe,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,gBAAgB,GAAG,IAAI,0BAAuB,CAAC,IAAI,EAAE,gBAAI,CAAC,iBAAiB,CAAC,CAAC;QAClF,IAAI,CAAC,YAA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AU,CAAC,CAAC;QAC5E,IAAI,CAAC,QAAQ,GAAG,IAAI,qBAAkB,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO,GAAG,IAAI,uBAAoB,CAA6B,IAAI,EAAE,gBAAI,CAAC,OAAO,CAAC,CAAC;QACxF,IAAI,CAAC,MAAM,GAAG,IAAI,qBAAkB,CAAW,IAAI,EAAE,gBAAI,CAAC,MAAM,CAAC,CAAC;QAClE,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAkB,CAAU,IAAI,EAAE,gBAAI,CAAC,KAAK,CAAC,CAAC;QAC/D,IAAI,CAAC,aAAa,GAAG,IAAI,4CAAoB,CAAC,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,IAAI,oBAAiB,CAAC,IAAI,EAAE,gBAAI,CAAC,QAAQ,CAAC,CAAC;IAC/D,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,OAAsB;QACpC,MAAM,IAAI,GAAG,IAAA,uBAAgB,EAAC,OAAO,CAAC,CAAC;QACvC,OAAO,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.3.0",
3
+ "version": "65.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>;
@@ -144,15 +144,14 @@ export const _FlowActions = z.object({
144
144
  expirationActionId: z.string().optional(),
145
145
  expirationAction: _FlowActionDetails.optional(),
146
146
  /**
147
- * @deprecated Use simpleTriageYesAction instead
147
+ * @deprecated Use triage instead
148
148
  */
149
149
  simpleTriageYesActId: z.string().optional(),
150
- simpleTriageYesAction: _FlowActionDetails.optional(),
151
150
  /**
152
- * @deprecated Use simpleTriageNoAction instead
151
+ * @deprecated Use triage instead
153
152
  */
154
153
  simpleTriageNoActId: z.string().optional(),
155
- simpleTriageNoAction: _FlowActionDetails.optional(),
154
+
156
155
  /**
157
156
  * @deprecated Use resolveNowAction instead
158
157
  */
@@ -183,6 +182,7 @@ export const _FlowSpecDto = _BaseDto.merge(
183
182
  engagementChannelCids: z.array(z.string()),
184
183
  tone: _FlowTone.optional(),
185
184
  targetResolution: _FlowInterval.optional(),
185
+ triage: z.object({message: z.string(), yesAction: _FlowActionDetails, noAction: _FlowActionDetails}).optional(),
186
186
  reminderInterval: _FlowInterval.optional(),
187
187
  actions: _FlowActions.optional(),
188
188
  rewards: z.array(_FlowRewardsConfig).optional(),
@@ -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);