@ampsec/platform-client 32.3.1 → 33.0.1
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/README.md +36 -56
- package/build/src/dto/saasComponents.dto.d.ts +49 -33
- package/package.json +1 -1
- package/src/dto/saasComponents.dto.ts +54 -33
package/README.md
CHANGED
|
@@ -2,72 +2,52 @@
|
|
|
2
2
|
|
|
3
3
|
Collection of data models, utilities, and clients used by and with our Platform API.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Entry Points
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm install @ampsec/platform-client
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
You can use the types by simply importing them.
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import {UpsertUserDto} from '@ampsec/platform-client'
|
|
17
|
-
|
|
18
|
-
const user: UpsertUserDto = {
|
|
19
|
-
id?: number;
|
|
20
|
-
etag: string;
|
|
21
|
-
department?: string;
|
|
22
|
-
emails: string[];
|
|
23
|
-
firstName: string;
|
|
24
|
-
lastName: string;
|
|
25
|
-
oid: number;
|
|
26
|
-
startDate?: string;
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
TODO: deploy docs for refrence
|
|
31
|
-
|
|
32
|
-
## Development
|
|
33
|
-
|
|
34
|
-
```sh
|
|
35
|
-
npm install
|
|
36
|
-
npm run dev
|
|
37
|
-
npm run test
|
|
7
|
+
### API Clients
|
|
38
8
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
9
|
+
- Agents
|
|
10
|
+
- [src/services/AmpApi.ts](https://amplifier-security.gitlab.io/ampsec-platform/amp-platform-client/classes/AmpApi.html)
|
|
11
|
+
- Service Accounts
|
|
12
|
+
- [src/services/AmpSdk.ts](https://amplifier-security.gitlab.io/ampsec-platform/amp-platform-client/classes/AmpSdk.html)
|
|
13
|
+
- End Users
|
|
14
|
+
- [src/services/EngageApi.ts](https://amplifier-security.gitlab.io/ampsec-platform/amp-platform-client/classes/AmpSdk.html)
|
|
44
15
|
|
|
45
|
-
|
|
16
|
+
### Services
|
|
46
17
|
|
|
47
|
-
|
|
18
|
+
- Settings
|
|
19
|
+
- [AmpSettingsService - src/services/settings.service.ts](https://amplifier-security.gitlab.io/ampsec-platform/amp-platform-client/classes/AmpSettingsService.html)
|
|
20
|
+
- [AmpSettingsMap - src/services/settings.service.ts](https://amplifier-security.gitlab.io/ampsec-platform/amp-platform-client/classes/AmpSettingsMap.html)
|
|
48
21
|
|
|
49
|
-
|
|
50
|
-
npm run test
|
|
51
|
-
```
|
|
22
|
+
### Data
|
|
52
23
|
|
|
53
|
-
|
|
24
|
+
- [Modules](https://amplifier-security.gitlab.io/ampsec-platform/amp-platform-client/modules.html)
|
|
25
|
+
- Enumerations
|
|
54
26
|
|
|
55
|
-
|
|
56
|
-
npm run test:integration
|
|
57
|
-
```
|
|
27
|
+
## Getting Started
|
|
58
28
|
|
|
59
|
-
|
|
29
|
+
```ts
|
|
30
|
+
import {UpsertUserDto} from '@ampsec/platform-client'
|
|
60
31
|
|
|
61
|
-
|
|
32
|
+
async function testAgentApi() {
|
|
33
|
+
const agentApi = AmpApi.instance({
|
|
34
|
+
baseUrl: process.env.PLATFORM_API_URL,
|
|
35
|
+
token: process.env.PLATFORM_TOKEN,
|
|
36
|
+
})
|
|
37
|
+
const me = await agentApi.identity.me();
|
|
38
|
+
console.log(me);
|
|
39
|
+
}
|
|
62
40
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
41
|
+
async function testAgentApi() {
|
|
42
|
+
const sdk = AmpSdkServices.instance({
|
|
43
|
+
baseUrl: process.env.PLATFORM_API_URL,
|
|
44
|
+
token: process.env.PLATFORM_TOKEN,
|
|
45
|
+
})
|
|
46
|
+
const me = await agentApi.identity.me();
|
|
47
|
+
console.log(me);
|
|
48
|
+
}
|
|
67
49
|
```
|
|
68
50
|
|
|
69
|
-
|
|
51
|
+
## Development
|
|
70
52
|
|
|
71
|
-
|
|
72
|
-
npm upgrade
|
|
73
|
-
```
|
|
53
|
+
See [DEVELOPMENT.md](DEVELOPMENT.md)
|
|
@@ -1,39 +1,55 @@
|
|
|
1
|
+
import { AssetKeys } from './assetKeys';
|
|
1
2
|
import { ChangeAwareDto, ChangeAwareUpsertDto } from './base.dto';
|
|
2
3
|
import { Category, FindingSeverity, SaasComponentKind } from './enums';
|
|
4
|
+
export type RawUserIds = {
|
|
5
|
+
uid?: string;
|
|
6
|
+
/** Provider id used against the API */
|
|
7
|
+
extId?: string;
|
|
8
|
+
primaryEmail?: string;
|
|
9
|
+
emails?: string[];
|
|
10
|
+
};
|
|
11
|
+
export type RawAssetIds = AssetKeys & {
|
|
12
|
+
aid?: string;
|
|
13
|
+
/** Provider id used against the API */
|
|
14
|
+
extId?: string;
|
|
15
|
+
/** Hostnames */
|
|
16
|
+
hostnames?: string[];
|
|
17
|
+
};
|
|
18
|
+
export type RawTrainingContext = {
|
|
19
|
+
title?: string;
|
|
20
|
+
url?: string;
|
|
21
|
+
enrollDate?: string | null;
|
|
22
|
+
};
|
|
23
|
+
export type RawVulnerabilityContext = {
|
|
24
|
+
cve?: string;
|
|
25
|
+
cvss?: number;
|
|
26
|
+
description?: string;
|
|
27
|
+
solution?: string;
|
|
28
|
+
};
|
|
29
|
+
export type RawFindingsContext = {
|
|
30
|
+
/**
|
|
31
|
+
* Uses styling to display the finding in the UI
|
|
32
|
+
* - `+` is used to denote success, e.g. `+ACTIVE`
|
|
33
|
+
* - `-` is used to denote failure, e.g. `-FAILED`
|
|
34
|
+
* - `?` is used to denote unknown, e.g. `?ASSIGNED` for a pending not-out-of-sla training
|
|
35
|
+
*/
|
|
36
|
+
displayValue?: string;
|
|
37
|
+
active?: boolean;
|
|
38
|
+
enabled?: boolean;
|
|
39
|
+
failedPhishing?: boolean;
|
|
40
|
+
loggedIn?: boolean;
|
|
41
|
+
overdue?: boolean;
|
|
42
|
+
severity?: FindingSeverity;
|
|
43
|
+
isExecutive?: boolean;
|
|
44
|
+
hasProdAccess?: boolean;
|
|
45
|
+
hasPrivilegedAccess?: boolean;
|
|
46
|
+
};
|
|
3
47
|
export type SaasComponentMeta = {
|
|
4
|
-
_findings:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* - `?` is used to denote unknown, e.g. `?ASSIGNED` for a pending not-out-of-sla training
|
|
10
|
-
*/
|
|
11
|
-
displayValue?: string;
|
|
12
|
-
active?: boolean;
|
|
13
|
-
enabled?: boolean;
|
|
14
|
-
failedPhishing?: boolean;
|
|
15
|
-
loggedIn?: boolean;
|
|
16
|
-
overdue?: boolean;
|
|
17
|
-
severity?: FindingSeverity;
|
|
18
|
-
isExecutive?: boolean;
|
|
19
|
-
hasProdAccess?: boolean;
|
|
20
|
-
hasPrivilegedAccess?: boolean;
|
|
21
|
-
};
|
|
22
|
-
_asset?: {
|
|
23
|
-
extId?: string;
|
|
24
|
-
sn?: string;
|
|
25
|
-
hostnames?: string[];
|
|
26
|
-
macs?: string[];
|
|
27
|
-
};
|
|
28
|
-
_user?: {
|
|
29
|
-
extId?: string;
|
|
30
|
-
email?: string;
|
|
31
|
-
};
|
|
32
|
-
_training?: {
|
|
33
|
-
title?: string;
|
|
34
|
-
enrollDate?: string | null;
|
|
35
|
-
startDate?: string | null;
|
|
36
|
-
};
|
|
48
|
+
_findings: RawFindingsContext;
|
|
49
|
+
_asset?: RawAssetIds;
|
|
50
|
+
_user?: RawUserIds;
|
|
51
|
+
_training?: RawTrainingContext;
|
|
52
|
+
_vulnerability?: RawVulnerabilityContext;
|
|
37
53
|
[propName: string]: unknown;
|
|
38
54
|
};
|
|
39
55
|
export type SaasComponentUpsertDto = ChangeAwareUpsertDto & {
|
package/package.json
CHANGED
|
@@ -1,40 +1,61 @@
|
|
|
1
|
+
import {AssetKeys} from './assetKeys';
|
|
1
2
|
import {ChangeAwareDto, ChangeAwareUpsertDto} from './base.dto';
|
|
2
3
|
import {Category, FindingSeverity, SaasComponentKind} from './enums';
|
|
3
4
|
|
|
5
|
+
export type RawUserIds = {
|
|
6
|
+
uid?: string;
|
|
7
|
+
/** Provider id used against the API */
|
|
8
|
+
extId?: string;
|
|
9
|
+
primaryEmail?: string;
|
|
10
|
+
emails?: string[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type RawAssetIds = AssetKeys & {
|
|
14
|
+
aid?: string;
|
|
15
|
+
/** Provider id used against the API */
|
|
16
|
+
extId?: string;
|
|
17
|
+
/** Hostnames */
|
|
18
|
+
hostnames?: string[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type RawTrainingContext = {
|
|
22
|
+
title?: string;
|
|
23
|
+
url?: string;
|
|
24
|
+
enrollDate?: string | null;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type RawVulnerabilityContext = {
|
|
28
|
+
cve?: string;
|
|
29
|
+
cvss?: number;
|
|
30
|
+
description?: string;
|
|
31
|
+
solution?: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type RawFindingsContext = {
|
|
35
|
+
/**
|
|
36
|
+
* Uses styling to display the finding in the UI
|
|
37
|
+
* - `+` is used to denote success, e.g. `+ACTIVE`
|
|
38
|
+
* - `-` is used to denote failure, e.g. `-FAILED`
|
|
39
|
+
* - `?` is used to denote unknown, e.g. `?ASSIGNED` for a pending not-out-of-sla training
|
|
40
|
+
*/
|
|
41
|
+
displayValue?: string;
|
|
42
|
+
active?: boolean;
|
|
43
|
+
enabled?: boolean;
|
|
44
|
+
failedPhishing?: boolean;
|
|
45
|
+
loggedIn?: boolean;
|
|
46
|
+
overdue?: boolean;
|
|
47
|
+
severity?: FindingSeverity;
|
|
48
|
+
isExecutive?: boolean;
|
|
49
|
+
hasProdAccess?: boolean;
|
|
50
|
+
hasPrivilegedAccess?: boolean;
|
|
51
|
+
};
|
|
52
|
+
|
|
4
53
|
export type SaasComponentMeta = {
|
|
5
|
-
_findings:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* - `?` is used to denote unknown, e.g. `?ASSIGNED` for a pending not-out-of-sla training
|
|
11
|
-
*/
|
|
12
|
-
displayValue?: string;
|
|
13
|
-
active?: boolean;
|
|
14
|
-
enabled?: boolean;
|
|
15
|
-
failedPhishing?: boolean;
|
|
16
|
-
loggedIn?: boolean;
|
|
17
|
-
overdue?: boolean;
|
|
18
|
-
severity?: FindingSeverity;
|
|
19
|
-
isExecutive?: boolean;
|
|
20
|
-
hasProdAccess?: boolean;
|
|
21
|
-
hasPrivilegedAccess?: boolean;
|
|
22
|
-
};
|
|
23
|
-
_asset?: {
|
|
24
|
-
extId?: string;
|
|
25
|
-
sn?: string;
|
|
26
|
-
hostnames?: string[];
|
|
27
|
-
macs?: string[];
|
|
28
|
-
};
|
|
29
|
-
_user?: {
|
|
30
|
-
extId?: string;
|
|
31
|
-
email?: string;
|
|
32
|
-
};
|
|
33
|
-
_training?: {
|
|
34
|
-
title?: string;
|
|
35
|
-
enrollDate?: string | null;
|
|
36
|
-
startDate?: string | null;
|
|
37
|
-
};
|
|
54
|
+
_findings: RawFindingsContext;
|
|
55
|
+
_asset?: RawAssetIds;
|
|
56
|
+
_user?: RawUserIds;
|
|
57
|
+
_training?: RawTrainingContext;
|
|
58
|
+
_vulnerability?: RawVulnerabilityContext;
|
|
38
59
|
[propName: string]: unknown;
|
|
39
60
|
};
|
|
40
61
|
|