@ampsec/platform-client 84.26.0 → 84.28.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.
- package/build/src/dto/findingsTags.dto.d.ts +90 -0
- package/build/src/dto/findingsTags.dto.js +33 -0
- package/build/src/dto/findingsTags.dto.js.map +1 -0
- package/build/src/dto/index.d.ts +2 -0
- package/build/src/dto/index.js +2 -0
- package/build/src/dto/index.js.map +1 -1
- package/build/src/dto/tagSpecs.dto.d.ts +174 -0
- package/build/src/dto/tagSpecs.dto.js +48 -0
- package/build/src/dto/tagSpecs.dto.js.map +1 -0
- package/build/src/dto/trainings.dto.d.ts +29 -0
- package/build/src/dto/trainings.dto.js +11 -0
- package/build/src/dto/trainings.dto.js.map +1 -0
- package/build/src/services/AmpApi.d.ts +2 -0
- package/build/src/services/AmpApi.js +2 -0
- package/build/src/services/AmpApi.js.map +1 -1
- package/build/src/services/AmpSdk.d.ts +4 -0
- package/build/src/services/AmpSdk.js +4 -0
- package/build/src/services/AmpSdk.js.map +1 -1
- package/build/src/services/constants.d.ts +3 -0
- package/build/src/services/constants.js +3 -0
- package/build/src/services/constants.js.map +1 -1
- package/build/src/services/findingsTags.service.d.ts +11 -0
- package/build/src/services/findingsTags.service.js +67 -0
- package/build/src/services/findingsTags.service.js.map +1 -0
- package/build/src/services/tagSpecs.service.d.ts +7 -0
- package/build/src/services/tagSpecs.service.js +35 -0
- package/build/src/services/tagSpecs.service.js.map +1 -0
- package/build/src/services/trainings.service.d.ts +23 -0
- package/build/src/services/trainings.service.js +41 -0
- package/build/src/services/trainings.service.js.map +1 -0
- package/build/src/settings.d.ts +1 -0
- package/build/src/settings.js +1 -0
- package/build/src/settings.js.map +1 -1
- package/package.json +1 -1
- package/src/dto/findingsTags.dto.ts +35 -0
- package/src/dto/index.ts +2 -0
- package/src/dto/tagSpecs.dto.ts +63 -0
- package/src/dto/trainings.dto.ts +12 -0
- package/src/services/AmpApi.ts +3 -0
- package/src/services/AmpSdk.ts +6 -0
- package/src/services/constants.ts +3 -0
- package/src/services/findingsTags.service.ts +83 -0
- package/src/services/tagSpecs.service.ts +44 -0
- package/src/services/trainings.service.ts +47 -0
- package/src/settings.ts +2 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {TrainingDto} from '../dto/trainings.dto';
|
|
2
|
+
import {TargetApi} from './constants';
|
|
3
|
+
import {RestClient, RestResponse} from './rest';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Service to manage compliance trainings.
|
|
7
|
+
*/
|
|
8
|
+
export class TrainingsService {
|
|
9
|
+
protected readonly rest: RestClient;
|
|
10
|
+
protected readonly targetApi: string;
|
|
11
|
+
protected readonly kind: string;
|
|
12
|
+
constructor(rest: RestClient, kind: string, targetApi: TargetApi = 'api') {
|
|
13
|
+
this.rest = rest;
|
|
14
|
+
this.kind = kind;
|
|
15
|
+
this.targetApi = targetApi;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Creates a new training with the provided details
|
|
19
|
+
createTraining = async (trainingDto: TrainingDto): Promise<RestResponse> => {
|
|
20
|
+
const res = await this.rest.call({
|
|
21
|
+
url: `/${this.targetApi}/v1/${this.kind}/create`,
|
|
22
|
+
method: 'POST',
|
|
23
|
+
data: trainingDto,
|
|
24
|
+
});
|
|
25
|
+
return res;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Fetches the video URL for a given training identified by HMAC
|
|
29
|
+
getVideoUrl = async (hmac: string): Promise<{success: boolean; videoUrl: string}> => {
|
|
30
|
+
const res = await this.rest.call({
|
|
31
|
+
url: `/${this.targetApi}/v1/${this.kind}/${hmac}`,
|
|
32
|
+
method: 'GET',
|
|
33
|
+
});
|
|
34
|
+
return res as unknown as {success: boolean; videoUrl: string};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Marks the training identified by HMAC as complete
|
|
38
|
+
completeTraining = async (hmac: string): Promise<{success: boolean; message: string; findingsClosed: number}> => {
|
|
39
|
+
const res = await this.rest.call({
|
|
40
|
+
url: `/${this.targetApi}/v1/${this.kind}/${hmac}/complete`,
|
|
41
|
+
method: 'POST',
|
|
42
|
+
});
|
|
43
|
+
return res as unknown as {success: boolean; message: string; findingsClosed: number};
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default TrainingsService;
|
package/src/settings.ts
CHANGED
|
@@ -111,6 +111,8 @@ const TENANT_SETTINGS = {
|
|
|
111
111
|
SECURITY_TIPS_USERS_TEST_COHORTS: AmpSettingsMap.asKey<string[]>('securitytips.users.test.cohorts', []),
|
|
112
112
|
|
|
113
113
|
SECURITY_TIPS_NOTIFICATION_CONNECTOR_ID: AmpSettingsMap.asKey<string>('securitytips.notification.connectorId'),
|
|
114
|
+
|
|
115
|
+
FINDINGS_TAGS_ENABLED: AmpSettingsMap.asKey<boolean>('findingstags.enabled', false),
|
|
114
116
|
};
|
|
115
117
|
|
|
116
118
|
/**
|