@ampsec/platform-client 62.8.0 → 62.10.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 (67) hide show
  1. package/build/src/dto/base.dto.d.ts +6 -0
  2. package/build/src/dto/base.dto.js +8 -2
  3. package/build/src/dto/base.dto.js.map +1 -1
  4. package/build/src/dto/customActions.dto.d.ts +365 -0
  5. package/build/src/dto/customActions.dto.js +40 -0
  6. package/build/src/dto/customActions.dto.js.map +1 -0
  7. package/build/src/dto/customScores.dto.d.ts +153 -0
  8. package/build/src/dto/customScores.dto.js +17 -0
  9. package/build/src/dto/customScores.dto.js.map +1 -0
  10. package/build/src/dto/findings.dto.d.ts +88 -0
  11. package/build/src/dto/findings.dto.js +25 -0
  12. package/build/src/dto/findings.dto.js.map +1 -1
  13. package/build/src/dto/flows.dto.d.ts +19 -0
  14. package/build/src/dto/flows.dto.js +9 -10
  15. package/build/src/dto/flows.dto.js.map +1 -1
  16. package/build/src/dto/index.d.ts +2 -0
  17. package/build/src/dto/index.js +2 -0
  18. package/build/src/dto/index.js.map +1 -1
  19. package/build/src/dto/platform/index.d.ts +2 -0
  20. package/build/src/dto/platform/index.js +2 -0
  21. package/build/src/dto/platform/index.js.map +1 -1
  22. package/build/src/dto/platform/platform.customActions.dto.d.ts +303 -0
  23. package/build/src/dto/platform/platform.customActions.dto.js +12 -0
  24. package/build/src/dto/platform/platform.customActions.dto.js.map +1 -0
  25. package/build/src/dto/platform/platform.customScores.dto.d.ts +165 -0
  26. package/build/src/dto/platform/platform.customScores.dto.js +18 -0
  27. package/build/src/dto/platform/platform.customScores.dto.js.map +1 -0
  28. package/build/src/dto/platform/platform.findings.dto.d.ts +77 -0
  29. package/build/src/dto/platform/platform.findings.dto.js +9 -0
  30. package/build/src/dto/platform/platform.findings.dto.js.map +1 -1
  31. package/build/src/dto/platform/platform.saasAssets.dto.d.ts +3 -0
  32. package/build/src/dto/platform/platform.saasAssets.dto.js +1 -0
  33. package/build/src/dto/platform/platform.saasAssets.dto.js.map +1 -1
  34. package/build/src/dto/platform/platform.saasComponents.dto.d.ts +1 -0
  35. package/build/src/dto/platform/platform.saasUsers.dto.d.ts +3 -0
  36. package/build/src/dto/platform/platform.saasUsers.dto.js +1 -0
  37. package/build/src/dto/platform/platform.saasUsers.dto.js.map +1 -1
  38. package/build/src/services/AmpApi.d.ts +5 -1
  39. package/build/src/services/AmpApi.js +4 -0
  40. package/build/src/services/AmpApi.js.map +1 -1
  41. package/build/src/services/AmpSdk.d.ts +5 -4
  42. package/build/src/services/AmpSdk.js +4 -0
  43. package/build/src/services/AmpSdk.js.map +1 -1
  44. package/build/src/services/constants.d.ts +4 -0
  45. package/build/src/services/constants.js +4 -0
  46. package/build/src/services/constants.js.map +1 -1
  47. package/build/src/services/entity.service.d.ts +2 -2
  48. package/build/src/services/entity.service.js +4 -7
  49. package/build/src/services/entity.service.js.map +1 -1
  50. package/package.json +1 -1
  51. package/src/dto/base.dto.ts +7 -2
  52. package/src/dto/customActions.dto.ts +44 -0
  53. package/src/dto/customScores.dto.ts +21 -0
  54. package/src/dto/findings.dto.ts +29 -1
  55. package/src/dto/flows.dto.ts +8 -11
  56. package/src/dto/index.ts +2 -0
  57. package/src/dto/platform/index.ts +2 -0
  58. package/src/dto/platform/platform.customActions.dto.ts +12 -0
  59. package/src/dto/platform/platform.customScores.dto.ts +22 -0
  60. package/src/dto/platform/platform.findings.dto.ts +12 -1
  61. package/src/dto/platform/platform.saasAssets.dto.ts +1 -0
  62. package/src/dto/platform/platform.saasComponents.dto.ts +1 -0
  63. package/src/dto/platform/platform.saasUsers.dto.ts +1 -0
  64. package/src/services/AmpApi.ts +29 -1
  65. package/src/services/AmpSdk.ts +29 -10
  66. package/src/services/constants.ts +4 -0
  67. package/src/services/entity.service.ts +5 -8
@@ -0,0 +1,44 @@
1
+ import {z} from 'zod';
2
+ import {UPSERT_DTO_MASK, _BaseDto} from './base.dto';
3
+
4
+ const _BaseCustomAction = _BaseDto.extend({
5
+ displayValue: z.string(),
6
+ description: z.string(),
7
+ isTemplate: z.boolean(),
8
+ retryStrategy: z
9
+ .object({
10
+ kind: z.literal('CONSTANT_BACKOFF'),
11
+ maxRetries: z.number(),
12
+ delay: z.number(),
13
+ })
14
+ .optional(),
15
+ });
16
+
17
+ export const _CustomRestActionMetaDto = z.object({
18
+ request: z.object({
19
+ url: z.string(),
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()),
28
+ }),
29
+ timeout: z.number().optional(),
30
+ });
31
+ const _CustomRestActionDto = _BaseCustomAction.extend({
32
+ kind: z.literal('REST_ACTION'),
33
+ meta: _CustomRestActionMetaDto,
34
+ });
35
+
36
+ const _CustomRestActionUpsertDto = _CustomRestActionDto.partial(UPSERT_DTO_MASK);
37
+
38
+ export const _CustomActionDto = _CustomRestActionDto;
39
+ export type CustomActionDto = z.infer<typeof _CustomActionDto>;
40
+
41
+ export const _CustomActionUpsertDto = _CustomRestActionUpsertDto;
42
+ export type CustomActionUpsertDto = z.infer<typeof _CustomActionUpsertDto>;
43
+
44
+ // TODO action execution history + errors
@@ -0,0 +1,21 @@
1
+ import {z} from 'zod';
2
+ import {UPSERT_DTO_MASK, _BaseDto} from './base.dto';
3
+ import {_AmplifierCohortDto} from './flows.dto';
4
+
5
+ export const _CustomScoreValueDto = _BaseDto.extend({
6
+ findingSpecId: z.string(),
7
+ value: z.number(),
8
+ });
9
+ export type CustomScoreValueDto = z.infer<typeof _CustomScoreValueDto>;
10
+
11
+ export const _CustomScoreValueUpsertDto = _CustomScoreValueDto.partial(UPSERT_DTO_MASK);
12
+ export type CustomScoreValueUpsertDto = z.infer<typeof _CustomScoreValueUpsertDto>;
13
+
14
+ export const _CustomScoreCohortDto = _BaseDto.extend({
15
+ cohort: _AmplifierCohortDto,
16
+ multiplier: z.number(),
17
+ });
18
+ export type CustomScoreCohortDto = z.infer<typeof _CustomScoreCohortDto>;
19
+
20
+ export const _CustomScoreCohortUpsertDto = _CustomScoreCohortDto.partial(UPSERT_DTO_MASK);
21
+ export type CustomScoreCohortUpsertDto = z.infer<typeof _CustomScoreCohortUpsertDto>;
@@ -1,5 +1,6 @@
1
+ import {z} from 'zod';
1
2
  import {SimpleAssetDto} from './assets.dto';
2
- import {BaseDto, BaseUpsertDto} from './base.dto';
3
+ import {BaseDto, BaseUpsertDto, _BaseDto} from './base.dto';
3
4
  import {Category, FindingKind} from './enums';
4
5
  import {FindingOutcome, FindingSeverity, FindingStatus} from './enums';
5
6
  import {SimpleProviderDto} from './providers.dto';
@@ -57,3 +58,30 @@ export type FindingDto = BaseDto &
57
58
  /** Optionally populated when requested through query param `include=meta`. Comes from `saasComp.meta` */
58
59
  meta?: SaasComponentMeta;
59
60
  };
61
+
62
+ const _FindingSpecDescription = z.unknown();
63
+ export const _FindingSpecDto = _BaseDto.extend({
64
+ cid: z.string().optional(),
65
+ name: z.string(),
66
+ displayValue: z.string(),
67
+ eventType: z.string(),
68
+ description: z.union([z.string(), _FindingSpecDescription]),
69
+ severity: z.nativeEnum(FindingSeverity),
70
+ });
71
+ export type FindingSpecDto = z.infer<typeof _FindingSpecDto>;
72
+
73
+ export const _FindingSpecUpsertDto = _FindingSpecDto.partial({
74
+ id: true,
75
+ createdAt: true,
76
+ updatedAt: true,
77
+ deletedAt: true,
78
+ });
79
+ export type FindingSpecUpsertDto = z.infer<typeof _FindingSpecUpsertDto>;
80
+
81
+ export const _FindingSummaryDto = z.object({
82
+ id: z.string(),
83
+ cid: z.string().optional(),
84
+ displayValue: z.string(),
85
+ eventType: z.string(),
86
+ });
87
+ export type FindingSummaryDto = z.infer<typeof _FindingSummaryDto>;
@@ -108,18 +108,15 @@ const _FlowTriggerFilter = z.object({
108
108
  custom: z.record(z.unknown()).optional(),
109
109
  });
110
110
  export type FlowTriggerFilter = z.infer<typeof _FlowTriggerFilter>;
111
+ export const _AmplifierCohortDto = z.object({
112
+ id: z.string(),
113
+ kind: z.enum(['ORGANIZATION', 'DEPARTMENT', 'USER', 'RISK_CONTRIBUTOR']),
114
+ displayValue: z.string(),
115
+ value: z.string(),
116
+ inclusive: z.boolean(),
117
+ });
111
118
  const _FlowFilter = z.object({
112
- cohorts: z.array(
113
- z
114
- .object({
115
- id: z.string(),
116
- kind: z.enum(['ORGANIZATION', 'DEPARTMENT', 'USER', 'RISK_CONTRIBUTOR']),
117
- displayValue: z.string(),
118
- value: z.string(),
119
- inclusive: z.boolean(),
120
- })
121
- .optional()
122
- ),
119
+ cohorts: z.array(_AmplifierCohortDto.optional()),
123
120
  custom: z.record(z.unknown()).optional(),
124
121
  });
125
122
  const _FlowTone = z.object({
package/src/dto/index.ts CHANGED
@@ -5,6 +5,8 @@ export * from './base.dto';
5
5
  export * from './connectors.dto';
6
6
  export * from './constants';
7
7
  export * from './coverage.dto';
8
+ export * from './customActions.dto';
9
+ export * from './customScores.dto';
8
10
  export * from './defaultConnector.dto';
9
11
  export * from './entityIdSummaries.dto';
10
12
  export * from './enum.dto';
@@ -1,6 +1,8 @@
1
1
  export * from './platform.agents.dto';
2
2
  export * from './platform.assets.dto';
3
3
  export * from './platform.connectors.dto';
4
+ export * from './platform.customActions.dto';
5
+ export * from './platform.customScores.dto';
4
6
  export * from './platform.findingsInsights.dto';
5
7
  export * from './platform.findings.dto';
6
8
  export * from './platform.flows.dto';
@@ -0,0 +1,12 @@
1
+ import {z} from 'zod';
2
+ import {_CustomActionDto, _CustomActionUpsertDto} from '../customActions.dto';
3
+
4
+ export const _PlatformCustomActionDto = _CustomActionDto.extend({
5
+ tid: z.string(),
6
+ });
7
+ export type PlatformCustomActionDto = z.infer<typeof _PlatformCustomActionDto>;
8
+
9
+ export const _PlatformCustomActionUpsertDto = _CustomActionUpsertDto.extend({
10
+ tid: z.string(),
11
+ });
12
+ export type PlatformCustomActionUpsertDto = z.infer<typeof _PlatformCustomActionUpsertDto>;
@@ -0,0 +1,22 @@
1
+ import {z} from 'zod';
2
+ import {_CustomScoreCohortDto, _CustomScoreCohortUpsertDto, _CustomScoreValueDto, _CustomScoreValueUpsertDto} from '../customScores.dto';
3
+
4
+ export const _PlatformCustomScoreValueDto = _CustomScoreValueDto.extend({
5
+ tid: z.string(),
6
+ });
7
+ export type PlatformCustomScoreValueDto = z.infer<typeof _PlatformCustomScoreValueDto>;
8
+
9
+ export const _PlatformCustomScoreValueUpsertDto = _CustomScoreValueUpsertDto.extend({
10
+ tid: z.string(),
11
+ });
12
+ export type PlatformCustomScoreValueUpsertDto = z.infer<typeof _PlatformCustomScoreValueUpsertDto>;
13
+
14
+ export const _PlatformCustomScoreCohortDto = _CustomScoreCohortDto.extend({
15
+ tid: z.string(),
16
+ });
17
+ export type PlatformCustomScoreCohortDto = z.infer<typeof _PlatformCustomScoreCohortDto>;
18
+
19
+ export const _PlatformCustomScoreCohortUpsertDto = _CustomScoreCohortDto.extend({
20
+ tid: z.string(),
21
+ });
22
+ export type PlatformCustomScoreCohortUpsertDto = z.infer<typeof _PlatformCustomScoreCohortUpsertDto>;
@@ -1,6 +1,17 @@
1
- import {FindingDto, FindingUpsertDto} from '../findings.dto';
1
+ import {z} from 'zod';
2
+ import {FindingDto, FindingUpsertDto, _FindingSpecDto, _FindingSpecUpsertDto} from '../findings.dto';
2
3
  import {TenantBased, UpsertTenantBased} from './tenant.based.dto';
3
4
 
4
5
  export type PlatformFindingUpsertDto = FindingUpsertDto & UpsertTenantBased;
5
6
 
6
7
  export type PlatformFindingDto = FindingDto & TenantBased;
8
+
9
+ export const _PlatformFindingSpecDto = _FindingSpecDto.extend({
10
+ tid: z.string(),
11
+ });
12
+ export type PlatformFindingSpecDto = z.infer<typeof _PlatformFindingSpecDto>;
13
+
14
+ export const _PlatformFindingSpecUpsertDto = _FindingSpecUpsertDto.extend({
15
+ tid: z.string(),
16
+ });
17
+ export type PlatformFindingSpecUpsertDto = z.infer<typeof _PlatformFindingSpecUpsertDto>;
@@ -7,6 +7,7 @@ export type PlatformSaasAssetDto = SaasAssetDto & TenantBased;
7
7
 
8
8
  export const _StagedSaasAssetUpsertDto = _SaasAssetUpsertDto.extend({
9
9
  aid: z.string().optional(),
10
+ sessionId: z.string(),
10
11
  });
11
12
 
12
13
  export type StagedSaasAssetUpsertDto = z.infer<typeof _StagedSaasAssetUpsertDto>;
@@ -7,6 +7,7 @@ export type PlatformSaasComponentDto = SaasComponentDto & TenantBased;
7
7
 
8
8
  export type StagedSaasComponentUpsertDto = SaasComponentUpsertDto & {
9
9
  displayValue?: string | null;
10
+ sessionId: string;
10
11
  };
11
12
 
12
13
  export type PlatformStagedSaasComponentUpsertDto = StagedSaasComponentUpsertDto & UpsertTenantBased;
@@ -7,6 +7,7 @@ export type PlatformSaasUserDto = SaasUserUpsertDto & TenantBased;
7
7
 
8
8
  export const _StagedSaasUserUpsertDto = _SaasUserUpsertDto.extend({
9
9
  uid: z.string().optional(),
10
+ sessionId: z.string(),
10
11
  });
11
12
 
12
13
  export type StagedSaasUserUpsertDto = z.infer<typeof _StagedSaasUserUpsertDto>;
@@ -1,4 +1,24 @@
1
- import {AgentDto, AgentUpsertDto, AssetDto, ProviderDto, ReportResultDto, SaasAssetDto, SaasComponentDto, SaasUserDto, TenantDto, TenantUpsertDto, UserDto} from '../dto';
1
+ import {
2
+ AgentDto,
3
+ AgentUpsertDto,
4
+ AssetDto,
5
+ CustomActionDto,
6
+ CustomActionUpsertDto,
7
+ CustomScoreCohortDto,
8
+ CustomScoreCohortUpsertDto,
9
+ CustomScoreValueDto,
10
+ CustomScoreValueUpsertDto,
11
+ FindingSpecDto,
12
+ FindingSpecUpsertDto,
13
+ ProviderDto,
14
+ ReportResultDto,
15
+ SaasAssetDto,
16
+ SaasComponentDto,
17
+ SaasUserDto,
18
+ TenantDto,
19
+ TenantUpsertDto,
20
+ UserDto,
21
+ } from '../dto';
2
22
  import {
3
23
  AmpEntityService,
4
24
  AmpEntityServiceImpl,
@@ -38,9 +58,13 @@ export class AmpApi {
38
58
  readonly asset: AmpDataService<AssetDto>;
39
59
  readonly cohorts: CohortService;
40
60
  readonly connectors: ConnectorsService;
61
+ readonly customActions: AmpEntityService<CustomActionUpsertDto, CustomActionDto>;
62
+ readonly customScoreValues: AmpEntityService<CustomScoreValueUpsertDto, CustomScoreValueDto>;
63
+ readonly customScoreCohorts: AmpEntityService<CustomScoreCohortUpsertDto, CustomScoreCohortDto>;
41
64
  readonly enums: EnumService;
42
65
  readonly findings: FindingsService;
43
66
  readonly findingsInsights: FindingsInsightsService;
67
+ readonly findingSpecs: AmpEntityService<FindingSpecUpsertDto, FindingSpecDto>;
44
68
  readonly flowSpecs: FlowSpecsService;
45
69
  readonly identity: AgentIdentityService;
46
70
  readonly install: ConnectorInstallService;
@@ -62,9 +86,13 @@ export class AmpApi {
62
86
  this.asset = new AmpDataServiceImpl<AssetDto>(rest, KIND.ASSETS);
63
87
  this.cohorts = new CohortService(rest);
64
88
  this.connectors = new ConnectorsService(rest);
89
+ this.customActions = new AmpEntityServiceImpl<CustomActionUpsertDto, CustomActionDto>(rest, KIND.CUSTOM_ACTIONS);
90
+ this.customScoreCohorts = new AmpEntityServiceImpl<CustomScoreCohortUpsertDto, CustomScoreCohortDto>(rest, KIND.CUSTOM_SCORE_COHORTS);
91
+ this.customScoreValues = new AmpEntityServiceImpl<CustomScoreValueUpsertDto, CustomScoreValueDto>(rest, KIND.CUSTOM_SCORE_VALUES);
65
92
  this.enums = new DefaultEnumService(rest);
66
93
  this.findings = new FindingsService(rest);
67
94
  this.findingsInsights = new FindingsInsightsService(rest, KIND.FINDINGS_INSIGHTS);
95
+ this.findingSpecs = new AmpEntityServiceImpl<FindingSpecUpsertDto, FindingSpecDto>(rest, KIND.FINDING_SPECS);
68
96
  this.flowSpecs = new FlowSpecsService(rest);
69
97
  this.identity = new AgentIdentityService(rest);
70
98
  this.install = new ConnectorInstallService(rest, TARGET_API_AGENT);
@@ -3,8 +3,24 @@ import {
3
3
  PlatformAgentUpsertDto,
4
4
  PlatformConnectorDto,
5
5
  PlatformConnectorUpsertDto,
6
+ PlatformCustomActionDto,
7
+ PlatformCustomActionUpsertDto,
8
+ PlatformCustomScoreCohortDto,
9
+ PlatformCustomScoreCohortUpsertDto,
10
+ PlatformCustomScoreValueDto,
11
+ PlatformCustomScoreValueUpsertDto,
6
12
  PlatformFindingDto,
13
+ PlatformFindingSpecDto,
14
+ PlatformFindingSpecUpsertDto,
7
15
  PlatformFindingUpsertDto,
16
+ PlatformFlowSpecDto,
17
+ PlatformFlowSpecUpsertDto,
18
+ PlatformFlowStateDto,
19
+ PlatformFlowStateUpsertDto,
20
+ PlatformJobExecutionStateDto,
21
+ PlatformJobExecutionStateUpsertDto,
22
+ PlatformJobSpecDto,
23
+ PlatformJobSpecUpsertDto,
8
24
  PlatformNotificationDto,
9
25
  PlatformNotificationUpsertDto,
10
26
  PlatformProviderUpsertDto,
@@ -12,14 +28,12 @@ import {
12
28
  PlatformReportResultUpsertDto,
13
29
  PlatformRiskContributorDto,
14
30
  PlatformRiskContributorUpsertDto,
15
- PlatformSaasAssetDto,
16
- PlatformSaasAssetUpsertDto,
17
31
  PlatformSaasComponentDto,
18
32
  PlatformSaasComponentUpsertDto,
19
- PlatformSaasUserDto,
20
- PlatformSaasUserUpsertDto,
21
33
  PlatformStagedSaasAssetDto,
22
34
  PlatformStagedSaasAssetUpsertDto,
35
+ PlatformStagedSaasComponentDto,
36
+ PlatformStagedSaasComponentUpsertDto,
23
37
  PlatformStagedSaasUserDto,
24
38
  PlatformStagedSaasUserUpsertDto,
25
39
  ProviderDto,
@@ -37,14 +51,11 @@ import {
37
51
  } from './entity.service';
38
52
  import {AmpRestClientOptions, RestClient, getAmpRestClient} from './rest';
39
53
  import {KIND, TARGET_API_PLATFORM} from './constants';
40
- import {PlatformJobSpecDto, PlatformJobSpecUpsertDto} from '../dto/platform/platform.jobSpec.dto';
41
- import {PlatformJobExecutionStateDto, PlatformJobExecutionStateUpsertDto} from '../dto/platform/platform.jobExecutionState.dto';
42
54
  import {DefaultEnumService, EnumService} from './rest/EnumService';
43
55
  import {AmpSdkSettingsService} from './settings.service';
44
56
  import {AmpSaaSEntityService, AmpSaaSEntityServiceImpl, AmpSdkSaasAssetService, AmpSdkSaasComponentService, AmpSdkSaasUserService} from './saasEntity.service';
45
57
  import {ContentfulService} from './contentful.service';
46
58
  import {FindingsInsightsService} from './findingsInsights.service';
47
- import {PlatformFlowSpecDto, PlatformFlowSpecUpsertDto, PlatformFlowStateDto, PlatformFlowStateUpsertDto} from '../dto/platform/platform.flows.dto';
48
59
 
49
60
  export type AmpSdkOptions = AmpRestClientOptions;
50
61
 
@@ -62,8 +73,12 @@ export class AmpSdkServices {
62
73
  readonly asset: AmpSdkAssetService;
63
74
  readonly connectors: AmpEntityService<PlatformConnectorUpsertDto, PlatformConnectorDto>;
64
75
  readonly contentful: ContentfulService;
76
+ readonly customActions: AmpEntityService<PlatformCustomActionUpsertDto, PlatformCustomActionDto>;
77
+ readonly customScoreCohorts: AmpEntityService<PlatformCustomScoreCohortUpsertDto, PlatformCustomScoreCohortDto>;
78
+ readonly customScoreValues: AmpEntityService<PlatformCustomScoreValueUpsertDto, PlatformCustomScoreValueDto>;
65
79
  readonly enums: EnumService;
66
80
  readonly findings: AmpSaaSEntityService<PlatformFindingUpsertDto, PlatformFindingDto>;
81
+ readonly findingSpecs: AmpSaaSEntityService<PlatformFindingSpecUpsertDto, PlatformFindingSpecDto>;
67
82
  readonly findingsInsights: FindingsInsightsService;
68
83
  readonly flowSpecs: AmpSaaSEntityService<PlatformFlowSpecUpsertDto, PlatformFlowSpecDto>;
69
84
  readonly flowStates: AmpSaaSEntityService<PlatformFlowStateUpsertDto, PlatformFlowStateDto>;
@@ -88,8 +103,12 @@ export class AmpSdkServices {
88
103
  this.asset = new AmpSdkAssetService(rest, TARGET_API_PLATFORM);
89
104
  this.connectors = new AmpEntityServiceImpl<PlatformConnectorUpsertDto, PlatformConnectorDto>(rest, KIND.CONNECTORS, TARGET_API_PLATFORM);
90
105
  this.contentful = new ContentfulService();
106
+ this.customActions = new AmpEntityServiceImpl<PlatformCustomActionUpsertDto, PlatformCustomActionDto>(rest, KIND.CUSTOM_ACTIONS, TARGET_API_PLATFORM);
107
+ this.customScoreCohorts = new AmpEntityServiceImpl<PlatformCustomScoreCohortUpsertDto, PlatformCustomScoreCohortDto>(rest, KIND.CUSTOM_SCORE_COHORTS, TARGET_API_PLATFORM);
108
+ this.customScoreValues = new AmpEntityServiceImpl<PlatformCustomScoreValueUpsertDto, PlatformCustomScoreValueDto>(rest, KIND.CUSTOM_SCORE_VALUES, TARGET_API_PLATFORM);
91
109
  this.enums = new DefaultEnumService(rest, TARGET_API_PLATFORM);
92
110
  this.findings = new AmpSaaSEntityServiceImpl<PlatformFindingUpsertDto, PlatformFindingDto>(rest, KIND.FINDINGS, TARGET_API_PLATFORM);
111
+ this.findingSpecs = new AmpSaaSEntityServiceImpl<PlatformFindingSpecUpsertDto, PlatformFindingSpecDto>(rest, KIND.FINDING_SPECS, TARGET_API_PLATFORM);
93
112
  this.findingsInsights = new FindingsInsightsService(rest, KIND.FINDINGS_INSIGHTS, TARGET_API_PLATFORM);
94
113
  this.flowSpecs = new AmpSaaSEntityServiceImpl<PlatformFlowSpecUpsertDto, PlatformFlowSpecDto>(rest, KIND.FLOW_SPECS, TARGET_API_PLATFORM);
95
114
  this.flowStates = new AmpSaaSEntityServiceImpl<PlatformFlowStateUpsertDto, PlatformFlowStateDto>(rest, KIND.FLOW_STATES, TARGET_API_PLATFORM);
@@ -102,13 +121,13 @@ export class AmpSdkServices {
102
121
  this.saasAssets = new AmpSdkSaasAssetService(rest, TARGET_API_PLATFORM);
103
122
  this.saasComponents = new AmpSdkSaasComponentService(rest, TARGET_API_PLATFORM);
104
123
  this.saasUsers = new AmpSdkSaasUserService(rest, TARGET_API_PLATFORM);
105
- this.stagedSaasAssets = new TruncatableAmpEntityServiceImpl<PlatformSaasAssetUpsertDto, PlatformSaasAssetDto>(rest, KIND.STAGED_SAAS_ASSETS, TARGET_API_PLATFORM);
106
- this.stagedSaaSComponents = new TruncatableAmpEntityServiceImpl<PlatformSaasComponentUpsertDto, PlatformSaasComponentDto>(
124
+ this.stagedSaasAssets = new TruncatableAmpEntityServiceImpl<PlatformStagedSaasAssetUpsertDto, PlatformStagedSaasAssetDto>(rest, KIND.STAGED_SAAS_ASSETS, TARGET_API_PLATFORM);
125
+ this.stagedSaaSComponents = new TruncatableAmpEntityServiceImpl<PlatformStagedSaasComponentUpsertDto, PlatformStagedSaasComponentDto>(
107
126
  rest,
108
127
  KIND.STAGED_SAAS_COMPONENTS,
109
128
  TARGET_API_PLATFORM
110
129
  );
111
- this.stagedSaaSUsers = new TruncatableAmpEntityServiceImpl<PlatformSaasUserUpsertDto, PlatformSaasUserDto>(rest, KIND.STAGED_SAAS_USERS, TARGET_API_PLATFORM);
130
+ this.stagedSaaSUsers = new TruncatableAmpEntityServiceImpl<PlatformStagedSaasUserUpsertDto, PlatformStagedSaasUserDto>(rest, KIND.STAGED_SAAS_USERS, TARGET_API_PLATFORM);
112
131
 
113
132
  this.settings = new AmpSdkSettingsService(rest);
114
133
  this.tenants = new AmpEntityServiceImpl<TenantUpsertDto, TenantDto>(rest, KIND.TENANTS, TARGET_API_PLATFORM);
@@ -13,11 +13,15 @@ export const KIND = {
13
13
  AGENTS: 'agents',
14
14
  ASSETS: 'assets',
15
15
  CONNECTORS: 'connectors',
16
+ CUSTOM_ACTIONS: 'custom_actions',
17
+ CUSTOM_SCORE_COHORTS: 'custom_score_cohorts',
18
+ CUSTOM_SCORE_VALUES: 'custom_score_values',
16
19
  ENUM_DEPARTMENTS: 'departments',
17
20
  ENUM_ORGANIZATIONS: 'organizations',
18
21
  ENUM_TITLES: 'titles',
19
22
  FINDINGS: 'findings',
20
23
  FINDINGS_INSIGHTS: 'findings_insights',
24
+ FINDING_SPECS: 'findings_specs',
21
25
  FLOW_SPECS: 'flow_specs',
22
26
  FLOW_STATES: 'flow_states',
23
27
  JOB_EXECUTIONS: 'job_executions',
@@ -19,7 +19,7 @@ export interface AmpEntityService<WriteT extends BaseUpsertDto, ReadT extends Ba
19
19
  }
20
20
 
21
21
  export interface TruncatableAmpEntityService<WriteT extends BaseUpsertDto, ReadT extends BaseDto> extends AmpEntityService<WriteT, ReadT> {
22
- truncate(tid: string): Promise<Message>;
22
+ truncate(tid: string, sessionId?: string): Promise<Message>;
23
23
  }
24
24
 
25
25
  export interface AmpSdkTenantService<WriteT extends BaseUpsertDto, ReadT extends BaseDto> extends AmpDataService<ReadT> {
@@ -89,14 +89,11 @@ export class TruncatableAmpEntityServiceImpl<WriteT extends BaseUpsertDto, ReadT
89
89
  extends AmpEntityServiceImpl<WriteT, ReadT>
90
90
  implements TruncatableAmpEntityService<WriteT, ReadT>
91
91
  {
92
- truncate = async (tid: string): Promise<Message> => {
93
- if (!tid) {
94
- throw new Error('Tenant id is required');
95
- }
92
+ truncate = async (tid: string, sessionId?: string): Promise<Message> => {
96
93
  const req: RestRequest = {
97
94
  url: `/${this.targetApi}/v1/${this.kind}/truncate`,
98
95
  method: 'POST',
99
- data: {tid},
96
+ data: {tid, sessionId},
100
97
  };
101
98
  const {error} = await this.call(req, (error: unknown) => {
102
99
  if (error instanceof Error) {
@@ -105,10 +102,10 @@ export class TruncatableAmpEntityServiceImpl<WriteT extends BaseUpsertDto, ReadT
105
102
  return {success: false, error};
106
103
  });
107
104
  if (error) {
108
- throw new Error(`Failed to truncate ${this.kind} for tenant id="${tid}"`);
105
+ throw new Error(`Failed to truncate ${this.kind} for tenant id=[${tid}]${sessionId ? ` and sessionId=[${sessionId}]` : ''}`);
109
106
  }
110
107
  return {
111
- message: `Truncated ${this.kind} for tenant id="${tid}"`,
108
+ message: `Truncated ${this.kind} for tenant id=[${tid}]${sessionId ? ` and sessionId=[${sessionId}]` : ''}`,
112
109
  };
113
110
  };
114
111
  }