@ampsec/platform-client 13.3.0 → 13.6.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/FilterCriteria.d.ts +39 -7
- package/build/src/dto/agents.dto.d.ts +2 -0
- package/build/src/dto/findings.dto.d.ts +1 -1
- package/build/src/dto/users.dto.d.ts +4 -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 +2 -0
- package/build/src/services/AmpSdk.js +2 -0
- package/build/src/services/AmpSdk.js.map +1 -1
- package/build/src/services/constants.d.ts +2 -0
- package/build/src/services/constants.js +2 -0
- package/build/src/services/constants.js.map +1 -1
- package/build/src/services/rest/EnumService.d.ts +16 -0
- package/build/src/services/rest/EnumService.js +26 -0
- package/build/src/services/rest/EnumService.js.map +1 -0
- package/package.json +1 -1
- package/src/FilterCriteria.ts +40 -7
- package/src/dto/agents.dto.ts +2 -0
- package/src/dto/findings.dto.ts +1 -1
- package/src/dto/users.dto.ts +4 -0
- package/src/services/AmpApi.ts +3 -0
- package/src/services/AmpSdk.ts +3 -0
- package/src/services/constants.ts +2 -0
- package/src/services/rest/EnumService.ts +42 -0
|
@@ -1,20 +1,52 @@
|
|
|
1
|
+
export type IdMatcher = string & {
|
|
2
|
+
$eq?: string;
|
|
3
|
+
$ne?: string;
|
|
4
|
+
$in?: string[];
|
|
5
|
+
$nin?: string[];
|
|
6
|
+
};
|
|
7
|
+
export type StringMatcher = string & {
|
|
8
|
+
$eq?: string;
|
|
9
|
+
$neq?: string;
|
|
10
|
+
$lt?: string;
|
|
11
|
+
$gt?: string;
|
|
12
|
+
$lte?: string;
|
|
13
|
+
$gte?: string;
|
|
14
|
+
$like?: string;
|
|
15
|
+
$nlike?: string;
|
|
16
|
+
$in?: string[];
|
|
17
|
+
$nin?: string[];
|
|
18
|
+
};
|
|
19
|
+
export type NumberMatcher = number & {
|
|
20
|
+
$eq?: number;
|
|
21
|
+
$neq?: number;
|
|
22
|
+
$lt?: number;
|
|
23
|
+
$gt?: number;
|
|
24
|
+
$lte?: number;
|
|
25
|
+
$gte?: number;
|
|
26
|
+
$in?: number[];
|
|
27
|
+
$nin?: number[];
|
|
28
|
+
};
|
|
29
|
+
export type DateMatcher = {
|
|
30
|
+
$lt?: string;
|
|
31
|
+
$gt?: string;
|
|
32
|
+
};
|
|
1
33
|
export type FilterCriteria = {
|
|
2
34
|
/** Number of records to return. */
|
|
3
35
|
limit?: number;
|
|
4
36
|
/** Number of records to skip before capturing results. */
|
|
5
37
|
offset?: number;
|
|
6
38
|
/** Tenant ID */
|
|
7
|
-
tid?:
|
|
39
|
+
tid?: IdMatcher;
|
|
8
40
|
/** Connector ID */
|
|
9
|
-
cid?:
|
|
41
|
+
cid?: IdMatcher;
|
|
10
42
|
/** Organization name. Defaults to `*` which matches all organizations. */
|
|
11
|
-
organization?: '*' | 'EXTERNAL' |
|
|
43
|
+
organization?: '*' | 'EXTERNAL' | IdMatcher;
|
|
12
44
|
/** Department name. Defaults to `*` which matches all departments. */
|
|
13
|
-
department?: '*' |
|
|
45
|
+
department?: '*' | IdMatcher;
|
|
14
46
|
/** User ID */
|
|
15
|
-
uid?:
|
|
47
|
+
uid?: IdMatcher;
|
|
16
48
|
/** Asset ID */
|
|
17
|
-
aid?:
|
|
49
|
+
aid?: IdMatcher;
|
|
18
50
|
/** catch all bucket for other fields */
|
|
19
|
-
[key: string]: string | number | boolean | undefined;
|
|
51
|
+
[key: string]: string | number | boolean | undefined | StringMatcher | NumberMatcher;
|
|
20
52
|
};
|
|
@@ -21,6 +21,6 @@ export type FindingUpsertDto = BaseUpsertDto & {
|
|
|
21
21
|
/** Id of the user to which the finding applies */
|
|
22
22
|
uid?: string | undefined;
|
|
23
23
|
/** Id of the SaasComponent related to the given finding */
|
|
24
|
-
scid
|
|
24
|
+
scid?: string | undefined | null;
|
|
25
25
|
};
|
|
26
26
|
export type FindingDto = BaseDto & FindingUpsertDto;
|
|
@@ -16,6 +16,10 @@ export type UserUpsertDto = ChangeAwareUpsertDto & {
|
|
|
16
16
|
title?: string;
|
|
17
17
|
/** Human readable name of the user's tenant, e.g. tenant.displayName */
|
|
18
18
|
organization?: string;
|
|
19
|
+
/** User's manager */
|
|
20
|
+
managerEmail?: string;
|
|
21
|
+
/** User's picture */
|
|
22
|
+
pictureUrl?: string;
|
|
19
23
|
/** Employment start date used for calculating tenure */
|
|
20
24
|
startDate?: string;
|
|
21
25
|
/** Risk Contributors associated with the user */
|
|
@@ -3,6 +3,7 @@ import { AmpEntityService } from './entity.service';
|
|
|
3
3
|
import { AmpDataService } from './data.service';
|
|
4
4
|
import { AmpRestClientOptions, RestClient } from './rest';
|
|
5
5
|
import { AmpReportService } from './reports.service';
|
|
6
|
+
import { EnumService } from './rest/EnumService';
|
|
6
7
|
export type AmpApiOptions = AmpRestClientOptions;
|
|
7
8
|
/**
|
|
8
9
|
* AMP API
|
|
@@ -20,6 +21,7 @@ export declare class AmpApi {
|
|
|
20
21
|
readonly agents: AmpEntityService<AgentUpsertDto, AgentDto>;
|
|
21
22
|
readonly asset: AmpDataService<AssetDto>;
|
|
22
23
|
readonly connectors: AmpEntityService<ConnectorUpsertDto, ConnectorDto>;
|
|
24
|
+
readonly enums: EnumService;
|
|
23
25
|
readonly findings: AmpDataService<FindingDto>;
|
|
24
26
|
readonly providers: AmpDataService<ProviderDto>;
|
|
25
27
|
readonly reportResults: AmpDataService<ReportResultDto>;
|
|
@@ -6,6 +6,7 @@ const data_service_1 = require("./data.service");
|
|
|
6
6
|
const rest_1 = require("./rest");
|
|
7
7
|
const constants_1 = require("./constants");
|
|
8
8
|
const reports_service_1 = require("./reports.service");
|
|
9
|
+
const EnumService_1 = require("./rest/EnumService");
|
|
9
10
|
/**
|
|
10
11
|
* AMP API
|
|
11
12
|
* This client is a wrapper around the AMP REST API meant to be used by
|
|
@@ -23,6 +24,7 @@ class AmpApi {
|
|
|
23
24
|
this.agents = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.AGENTS);
|
|
24
25
|
this.asset = new data_service_1.AmpDataServiceImpl(rest, constants_1.KIND.ASSETS);
|
|
25
26
|
this.connectors = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.CONNECTORS);
|
|
27
|
+
this.enums = new EnumService_1.DefaultEnumService(rest);
|
|
26
28
|
this.findings = new data_service_1.AmpDataServiceImpl(rest, constants_1.KIND.FINDINGS);
|
|
27
29
|
this.providers = new data_service_1.AmpDataServiceImpl(rest, constants_1.KIND.PROVIDERS);
|
|
28
30
|
this.reportResults = new data_service_1.AmpDataServiceImpl(rest, constants_1.KIND.REPORT_RESULTS);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmpApi.js","sourceRoot":"","sources":["../../../src/services/AmpApi.ts"],"names":[],"mappings":";;;AAgBA,qDAAwE;AACxE,iDAAkE;AAClE,iCAA0E;AAC1E,2CAAiC;AACjC,uDAAyE;
|
|
1
|
+
{"version":3,"file":"AmpApi.js","sourceRoot":"","sources":["../../../src/services/AmpApi.ts"],"names":[],"mappings":";;;AAgBA,qDAAwE;AACxE,iDAAkE;AAClE,iCAA0E;AAC1E,2CAAiC;AACjC,uDAAyE;AACzE,oDAAmE;AAInE;;;;;;;;;;;GAWG;AACH,MAAa,MAAM;IAejB,YAAY,IAAgB;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,qCAAoB,CAA2B,IAAI,EAAE,gBAAI,CAAC,MAAM,CAAC,CAAC;QACpF,IAAI,CAAC,KAAK,GAAG,IAAI,iCAAkB,CAAW,IAAI,EAAE,gBAAI,CAAC,MAAM,CAAC,CAAC;QACjE,IAAI,CAAC,UAAU,GAAG,IAAI,qCAAoB,CAAmC,IAAI,EAAE,gBAAI,CAAC,UAAU,CAAC,CAAC;QACpG,IAAI,CAAC,KAAK,GAAG,IAAI,gCAAkB,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,QAAQ,GAAG,IAAI,iCAAkB,CAAa,IAAI,EAAE,gBAAI,CAAC,QAAQ,CAAC,CAAC;QACxE,IAAI,CAAC,SAAS,GAAG,IAAI,iCAAkB,CAAc,IAAI,EAAE,gBAAI,CAAC,SAAS,CAAC,CAAC;QAC3E,IAAI,CAAC,aAAa,GAAG,IAAI,iCAAkB,CAAkB,IAAI,EAAE,gBAAI,CAAC,cAAc,CAAC,CAAC;QACxF,IAAI,CAAC,OAAO,GAAG,IAAI,sCAAoB,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,UAAU,GAAG,IAAI,iCAAkB,CAAe,IAAI,EAAE,gBAAI,CAAC,WAAW,CAAC,CAAC;QAC/E,IAAI,CAAC,cAAc,GAAG,IAAI,iCAAkB,CAAmB,IAAI,EAAE,gBAAI,CAAC,eAAe,CAAC,CAAC;QAC3F,IAAI,CAAC,SAAS,GAAG,IAAI,iCAAkB,CAAc,IAAI,EAAE,gBAAI,CAAC,UAAU,CAAC,CAAC;QAC5E,IAAI,CAAC,OAAO,GAAG,IAAI,qCAAoB,CAA6B,IAAI,EAAE,gBAAI,CAAC,OAAO,CAAC,CAAC;QACxF,IAAI,CAAC,KAAK,GAAG,IAAI,iCAAkB,CAAU,IAAI,EAAE,gBAAI,CAAC,KAAK,CAAC,CAAC;IACjE,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;AAnCD,wBAmCC"}
|
|
@@ -3,6 +3,7 @@ import { AmpEntityService, AmpGlobalEntityService, AmpSaaSEntityService } from '
|
|
|
3
3
|
import { AmpRestClientOptions, RestClient } from './rest';
|
|
4
4
|
import { PlatformJobSpecDto, PlatformJobSpecUpsertDto } from '../dto/platform/platform.jobSpec.dto';
|
|
5
5
|
import { PlatformJobExecutionStateDto, PlatformJobExecutionStateUpsertDto } from '../dto/platform/platform.jobExecutionState.dto';
|
|
6
|
+
import { EnumService } from './rest/EnumService';
|
|
6
7
|
export type AmpSdkOptions = AmpRestClientOptions;
|
|
7
8
|
/**
|
|
8
9
|
* AMP API
|
|
@@ -17,6 +18,7 @@ export declare class AmpSdkServices {
|
|
|
17
18
|
readonly agents: AmpEntityService<PlatformAgentUpsertDto, PlatformAgentDto>;
|
|
18
19
|
readonly asset: AmpGlobalEntityService<PlatformAssetUpsertDto, PlatformAssetDto>;
|
|
19
20
|
readonly connectors: AmpEntityService<PlatformConnectorUpsertDto, PlatformConnectorDto>;
|
|
21
|
+
readonly enums: EnumService;
|
|
20
22
|
readonly findings: AmpSaaSEntityService<PlatformFindingUpsertDto, PlatformFindingDto>;
|
|
21
23
|
readonly jobExecutions: AmpEntityService<PlatformJobExecutionStateUpsertDto, PlatformJobExecutionStateDto>;
|
|
22
24
|
readonly jobs: AmpEntityService<PlatformJobSpecUpsertDto, PlatformJobSpecDto>;
|
|
@@ -4,6 +4,7 @@ exports.AmpSdkServices = void 0;
|
|
|
4
4
|
const entity_service_1 = require("./entity.service");
|
|
5
5
|
const rest_1 = require("./rest");
|
|
6
6
|
const constants_1 = require("./constants");
|
|
7
|
+
const EnumService_1 = require("./rest/EnumService");
|
|
7
8
|
/**
|
|
8
9
|
* AMP API
|
|
9
10
|
* This client is a wrapper around the AMP REST API meant to be used by
|
|
@@ -18,6 +19,7 @@ class AmpSdkServices {
|
|
|
18
19
|
this.agents = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.AGENTS, constants_1.TARGET_API_PLATFORM);
|
|
19
20
|
this.asset = new entity_service_1.AmpGlobalEntityServiceImpl(rest, constants_1.KIND.ASSETS, constants_1.TARGET_API_PLATFORM);
|
|
20
21
|
this.connectors = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.CONNECTORS, constants_1.TARGET_API_PLATFORM);
|
|
22
|
+
this.enums = new EnumService_1.DefaultEnumService(rest, constants_1.TARGET_API_PLATFORM);
|
|
21
23
|
this.findings = new entity_service_1.AmpSaaSEntityServiceImpl(rest, constants_1.KIND.FINDINGS, constants_1.TARGET_API_PLATFORM);
|
|
22
24
|
this.jobExecutions = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.JOB_EXECUTIONS, constants_1.TARGET_API_PLATFORM);
|
|
23
25
|
this.jobs = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.JOB_SPEC, constants_1.TARGET_API_PLATFORM);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmpSdk.js","sourceRoot":"","sources":["../../../src/services/AmpSdk.ts"],"names":[],"mappings":";;;AAwBA,qDAA4K;AAC5K,iCAA0E;AAC1E,2CAAsD;
|
|
1
|
+
{"version":3,"file":"AmpSdk.js","sourceRoot":"","sources":["../../../src/services/AmpSdk.ts"],"names":[],"mappings":";;;AAwBA,qDAA4K;AAC5K,iCAA0E;AAC1E,2CAAsD;AAGtD,oDAAmE;AAInE;;;;;;;;GAQG;AACH,MAAa,cAAc;IAgBzB,YAAY,IAAgB;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,qCAAoB,CAA2C,IAAI,EAAE,gBAAI,CAAC,MAAM,EAAE,+BAAmB,CAAC,CAAC;QACzH,IAAI,CAAC,KAAK,GAAG,IAAI,2CAA0B,CAA2C,IAAI,EAAE,gBAAI,CAAC,MAAM,EAAE,+BAAmB,CAAC,CAAC;QAC9H,IAAI,CAAC,UAAU,GAAG,IAAI,qCAAoB,CAAmD,IAAI,EAAE,gBAAI,CAAC,UAAU,EAAE,+BAAmB,CAAC,CAAC;QACzI,IAAI,CAAC,KAAK,GAAG,IAAI,gCAAkB,CAAC,IAAI,EAAE,+BAAmB,CAAC,CAAC;QAC/D,IAAI,CAAC,QAAQ,GAAG,IAAI,yCAAwB,CAA+C,IAAI,EAAE,gBAAI,CAAC,QAAQ,EAAE,+BAAmB,CAAC,CAAC;QACrI,IAAI,CAAC,aAAa,GAAG,IAAI,qCAAoB,CAAmE,IAAI,EAAE,gBAAI,CAAC,cAAc,EAAE,+BAAmB,CAAC,CAAC;QAChK,IAAI,CAAC,IAAI,GAAG,IAAI,qCAAoB,CAA+C,IAAI,EAAE,gBAAI,CAAC,QAAQ,EAAE,+BAAmB,CAAC,CAAC;QAC7H,IAAI,CAAC,SAAS,GAAG,IAAI,qCAAoB,CAAyC,IAAI,EAAE,gBAAI,CAAC,SAAS,EAAE,+BAAmB,CAAC,CAAC;QAC7H,IAAI,CAAC,aAAa,GAAG,IAAI,yCAAwB,CAAyD,IAAI,EAAE,gBAAI,CAAC,cAAc,EAAE,+BAAmB,CAAC,CAAC;QAC1J,IAAI,CAAC,UAAU,GAAG,IAAI,yCAAwB,CAAmD,IAAI,EAAE,gBAAI,CAAC,WAAW,EAAE,+BAAmB,CAAC,CAAC;QAC9I,IAAI,CAAC,cAAc,GAAG,IAAI,yCAAwB,CAA2D,IAAI,EAAE,gBAAI,CAAC,eAAe,EAAE,+BAAmB,CAAC,CAAC;QAC9J,IAAI,CAAC,SAAS,GAAG,IAAI,yCAAwB,CAAiD,IAAI,EAAE,gBAAI,CAAC,UAAU,EAAE,+BAAmB,CAAC,CAAC;QAC1I,IAAI,CAAC,OAAO,GAAG,IAAI,qCAAoB,CAA6B,IAAI,EAAE,gBAAI,CAAC,OAAO,EAAE,+BAAmB,CAAC,CAAC;QAC7G,IAAI,CAAC,KAAK,GAAG,IAAI,2CAA0B,CAAyC,IAAI,EAAE,gBAAI,CAAC,KAAK,EAAE,+BAAmB,CAAC,CAAC;IAC7H,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,OAAsB;QACpC,MAAM,IAAI,GAAG,IAAA,uBAAgB,EAAC,OAAO,CAAC,CAAC;QACvC,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACF;AArCD,wCAqCC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/services/constants.ts"],"names":[],"mappings":";;;AAIa,QAAA,2BAA2B,GAAG,CAAC,CAAC;AAGhC,QAAA,mBAAmB,GAAc,UAAU,CAAC;AAC5C,QAAA,gBAAgB,GAAc,KAAK,CAAC;AAEpC,QAAA,IAAI,GAAG;IAClB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,YAAY;IACxB,QAAQ,EAAE,UAAU;IACpB,cAAc,EAAE,gBAAgB;IAChC,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,WAAW;IACtB,cAAc,EAAE,gBAAgB;IAChC,WAAW,EAAE,aAAa;IAC1B,eAAe,EAAE,iBAAiB;IAClC,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACf,CAAC;AAEW,QAAA,OAAO,GAAG;IACrB,YAAY,EAAE,cAAc;IAC5B,yBAAyB,EAAE,qCAAqC;IAChE,yBAAyB,EAAE,qCAAqC;IAChE,iBAAiB,EAAE,mBAAmB;IACtC,qBAAqB,EAAE,uBAAuB;IAC9C,YAAY,EAAE,0BAA0B;IACxC,qBAAqB,EAAE,uBAAuB;IAC9C,gBAAgB,EAAE,kBAAkB;IACpC,mBAAmB;IACnB,kBAAkB,EAAE,cAAc;CACnC,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/services/constants.ts"],"names":[],"mappings":";;;AAIa,QAAA,2BAA2B,GAAG,CAAC,CAAC;AAGhC,QAAA,mBAAmB,GAAc,UAAU,CAAC;AAC5C,QAAA,gBAAgB,GAAc,KAAK,CAAC;AAEpC,QAAA,IAAI,GAAG;IAClB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,YAAY;IACxB,gBAAgB,EAAE,aAAa;IAC/B,kBAAkB,EAAE,eAAe;IACnC,QAAQ,EAAE,UAAU;IACpB,cAAc,EAAE,gBAAgB;IAChC,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,WAAW;IACtB,cAAc,EAAE,gBAAgB;IAChC,WAAW,EAAE,aAAa;IAC1B,eAAe,EAAE,iBAAiB;IAClC,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACf,CAAC;AAEW,QAAA,OAAO,GAAG;IACrB,YAAY,EAAE,cAAc;IAC5B,yBAAyB,EAAE,qCAAqC;IAChE,yBAAyB,EAAE,qCAAqC;IAChE,iBAAiB,EAAE,mBAAmB;IACtC,qBAAqB,EAAE,uBAAuB;IAC9C,YAAY,EAAE,0BAA0B;IACxC,qBAAqB,EAAE,uBAAuB;IAC9C,gBAAgB,EAAE,kBAAkB;IACpC,mBAAmB;IACnB,kBAAkB,EAAE,cAAc;CACnC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Page, EnumDto } from '../../dto';
|
|
2
|
+
import { RestClient } from './RestClient';
|
|
3
|
+
type EnumCollection = {
|
|
4
|
+
list: () => Promise<Page<EnumDto>>;
|
|
5
|
+
};
|
|
6
|
+
export type EnumService = {
|
|
7
|
+
departments: EnumCollection;
|
|
8
|
+
organizations: EnumCollection;
|
|
9
|
+
};
|
|
10
|
+
export declare class DefaultEnumService implements EnumService {
|
|
11
|
+
private readonly rest;
|
|
12
|
+
readonly departments: EnumCollection;
|
|
13
|
+
readonly organizations: EnumCollection;
|
|
14
|
+
constructor(rest: RestClient, targetApi?: import("../constants").TargetApi);
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultEnumService = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
class DefaultEnumCollection {
|
|
6
|
+
constructor(rest, kind, targetApi) {
|
|
7
|
+
this.rest = rest;
|
|
8
|
+
this.kind = kind;
|
|
9
|
+
this.targetApi = targetApi;
|
|
10
|
+
}
|
|
11
|
+
async list() {
|
|
12
|
+
const res = await this.rest.call({
|
|
13
|
+
url: `/${this.targetApi}/v1/enum/${this.kind}`,
|
|
14
|
+
});
|
|
15
|
+
return res.data;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
class DefaultEnumService {
|
|
19
|
+
constructor(rest, targetApi = constants_1.TARGET_API_AGENT) {
|
|
20
|
+
this.rest = rest;
|
|
21
|
+
this.departments = new DefaultEnumCollection(rest, constants_1.KIND.ENUM_DEPARTMENTS, targetApi);
|
|
22
|
+
this.organizations = new DefaultEnumCollection(rest, constants_1.KIND.ENUM_ORGANIZATIONS, targetApi);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.DefaultEnumService = DefaultEnumService;
|
|
26
|
+
//# sourceMappingURL=EnumService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnumService.js","sourceRoot":"","sources":["../../../../src/services/rest/EnumService.ts"],"names":[],"mappings":";;;AACA,4CAAoD;AAYpD,MAAM,qBAAqB;IAKzB,YAAY,IAAgB,EAAE,IAAY,EAAE,SAAiB;QAC3D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IACD,KAAK,CAAC,IAAI;QACR,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YAC/B,GAAG,EAAE,IAAI,IAAI,CAAC,SAAS,YAAY,IAAI,CAAC,IAAI,EAAE;SAC/C,CAAC,CAAC;QACH,OAAO,GAAG,CAAC,IAAqB,CAAC;IACnC,CAAC;CACF;AAED,MAAa,kBAAkB;IAK7B,YAAY,IAAgB,EAAE,SAAS,GAAG,4BAAgB;QACxD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,IAAI,qBAAqB,CAAC,IAAI,EAAE,gBAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;QACrF,IAAI,CAAC,aAAa,GAAG,IAAI,qBAAqB,CAAC,IAAI,EAAE,gBAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC;IAC3F,CAAC;CACF;AAVD,gDAUC"}
|
package/package.json
CHANGED
package/src/FilterCriteria.ts
CHANGED
|
@@ -1,20 +1,53 @@
|
|
|
1
|
+
export type IdMatcher = string & {
|
|
2
|
+
$eq?: string;
|
|
3
|
+
$ne?: string;
|
|
4
|
+
$in?: string[];
|
|
5
|
+
$nin?: string[];
|
|
6
|
+
};
|
|
7
|
+
export type StringMatcher = string & {
|
|
8
|
+
$eq?: string;
|
|
9
|
+
$neq?: string;
|
|
10
|
+
$lt?: string;
|
|
11
|
+
$gt?: string;
|
|
12
|
+
$lte?: string;
|
|
13
|
+
$gte?: string;
|
|
14
|
+
$like?: string;
|
|
15
|
+
$nlike?: string;
|
|
16
|
+
$in?: string[];
|
|
17
|
+
$nin?: string[];
|
|
18
|
+
};
|
|
19
|
+
export type NumberMatcher = number & {
|
|
20
|
+
$eq?: number;
|
|
21
|
+
$neq?: number;
|
|
22
|
+
$lt?: number;
|
|
23
|
+
$gt?: number;
|
|
24
|
+
$lte?: number;
|
|
25
|
+
$gte?: number;
|
|
26
|
+
$in?: number[];
|
|
27
|
+
$nin?: number[];
|
|
28
|
+
};
|
|
29
|
+
export type DateMatcher = {
|
|
30
|
+
$lt?: string;
|
|
31
|
+
$gt?: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
1
34
|
export type FilterCriteria = {
|
|
2
35
|
/** Number of records to return. */
|
|
3
36
|
limit?: number;
|
|
4
37
|
/** Number of records to skip before capturing results. */
|
|
5
38
|
offset?: number;
|
|
6
39
|
/** Tenant ID */
|
|
7
|
-
tid?:
|
|
40
|
+
tid?: IdMatcher;
|
|
8
41
|
/** Connector ID */
|
|
9
|
-
cid?:
|
|
42
|
+
cid?: IdMatcher;
|
|
10
43
|
/** Organization name. Defaults to `*` which matches all organizations. */
|
|
11
|
-
organization?: '*' | 'EXTERNAL' |
|
|
44
|
+
organization?: '*' | 'EXTERNAL' | IdMatcher;
|
|
12
45
|
/** Department name. Defaults to `*` which matches all departments. */
|
|
13
|
-
department?: '*' |
|
|
46
|
+
department?: '*' | IdMatcher;
|
|
14
47
|
/** User ID */
|
|
15
|
-
uid?:
|
|
48
|
+
uid?: IdMatcher;
|
|
16
49
|
/** Asset ID */
|
|
17
|
-
aid?:
|
|
50
|
+
aid?: IdMatcher;
|
|
18
51
|
/** catch all bucket for other fields */
|
|
19
|
-
[key: string]: string | number | boolean | undefined;
|
|
52
|
+
[key: string]: string | number | boolean | undefined | StringMatcher | NumberMatcher;
|
|
20
53
|
};
|
package/src/dto/agents.dto.ts
CHANGED
|
@@ -11,6 +11,8 @@ export type AgentUpsertDto = BaseUpsertDto & {
|
|
|
11
11
|
status: AgentStatus;
|
|
12
12
|
/** External Id */
|
|
13
13
|
email: string;
|
|
14
|
+
/** Agent profile picture */
|
|
15
|
+
pictureUrl?: string;
|
|
14
16
|
/** Agent role */
|
|
15
17
|
// TODO: role: AgentRole; // for now all agents are `OWNER`. Need to map role to tenant
|
|
16
18
|
};
|
package/src/dto/findings.dto.ts
CHANGED
|
@@ -22,7 +22,7 @@ export type FindingUpsertDto = BaseUpsertDto & {
|
|
|
22
22
|
/** Id of the user to which the finding applies */
|
|
23
23
|
uid?: string | undefined;
|
|
24
24
|
/** Id of the SaasComponent related to the given finding */
|
|
25
|
-
scid
|
|
25
|
+
scid?: string | undefined | null;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
export type FindingDto = BaseDto & FindingUpsertDto;
|
package/src/dto/users.dto.ts
CHANGED
|
@@ -17,6 +17,10 @@ export type UserUpsertDto = ChangeAwareUpsertDto & {
|
|
|
17
17
|
title?: string;
|
|
18
18
|
/** Human readable name of the user's tenant, e.g. tenant.displayName */
|
|
19
19
|
organization?: string;
|
|
20
|
+
/** User's manager */
|
|
21
|
+
managerEmail?: string;
|
|
22
|
+
/** User's picture */
|
|
23
|
+
pictureUrl?: string;
|
|
20
24
|
/** Employment start date used for calculating tenure */
|
|
21
25
|
startDate?: string;
|
|
22
26
|
/** Risk Contributors associated with the user */
|
package/src/services/AmpApi.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {AmpDataService, AmpDataServiceImpl} from './data.service';
|
|
|
19
19
|
import {AmpRestClientOptions, RestClient, getAmpRestClient} from './rest';
|
|
20
20
|
import {KIND} from './constants';
|
|
21
21
|
import {AmpReportService, AmpReportServiceImpl} from './reports.service';
|
|
22
|
+
import {DefaultEnumService, EnumService} from './rest/EnumService';
|
|
22
23
|
|
|
23
24
|
export type AmpApiOptions = AmpRestClientOptions;
|
|
24
25
|
|
|
@@ -38,6 +39,7 @@ export class AmpApi {
|
|
|
38
39
|
readonly agents: AmpEntityService<AgentUpsertDto, AgentDto>;
|
|
39
40
|
readonly asset: AmpDataService<AssetDto>;
|
|
40
41
|
readonly connectors: AmpEntityService<ConnectorUpsertDto, ConnectorDto>;
|
|
42
|
+
readonly enums: EnumService;
|
|
41
43
|
readonly findings: AmpDataService<FindingDto>;
|
|
42
44
|
readonly providers: AmpDataService<ProviderDto>;
|
|
43
45
|
readonly reportResults: AmpDataService<ReportResultDto>;
|
|
@@ -52,6 +54,7 @@ export class AmpApi {
|
|
|
52
54
|
this.agents = new AmpEntityServiceImpl<AgentUpsertDto, AgentDto>(rest, KIND.AGENTS);
|
|
53
55
|
this.asset = new AmpDataServiceImpl<AssetDto>(rest, KIND.ASSETS);
|
|
54
56
|
this.connectors = new AmpEntityServiceImpl<ConnectorUpsertDto, ConnectorDto>(rest, KIND.CONNECTORS);
|
|
57
|
+
this.enums = new DefaultEnumService(rest);
|
|
55
58
|
this.findings = new AmpDataServiceImpl<FindingDto>(rest, KIND.FINDINGS);
|
|
56
59
|
this.providers = new AmpDataServiceImpl<ProviderDto>(rest, KIND.PROVIDERS);
|
|
57
60
|
this.reportResults = new AmpDataServiceImpl<ReportResultDto>(rest, KIND.REPORT_RESULTS);
|
package/src/services/AmpSdk.ts
CHANGED
|
@@ -27,6 +27,7 @@ import {AmpRestClientOptions, RestClient, getAmpRestClient} from './rest';
|
|
|
27
27
|
import {KIND, TARGET_API_PLATFORM} from './constants';
|
|
28
28
|
import {PlatformJobSpecDto, PlatformJobSpecUpsertDto} from '../dto/platform/platform.jobSpec.dto';
|
|
29
29
|
import {PlatformJobExecutionStateDto, PlatformJobExecutionStateUpsertDto} from '../dto/platform/platform.jobExecutionState.dto';
|
|
30
|
+
import {DefaultEnumService, EnumService} from './rest/EnumService';
|
|
30
31
|
|
|
31
32
|
export type AmpSdkOptions = AmpRestClientOptions;
|
|
32
33
|
|
|
@@ -43,6 +44,7 @@ export class AmpSdkServices {
|
|
|
43
44
|
readonly agents: AmpEntityService<PlatformAgentUpsertDto, PlatformAgentDto>;
|
|
44
45
|
readonly asset: AmpGlobalEntityService<PlatformAssetUpsertDto, PlatformAssetDto>;
|
|
45
46
|
readonly connectors: AmpEntityService<PlatformConnectorUpsertDto, PlatformConnectorDto>;
|
|
47
|
+
readonly enums: EnumService;
|
|
46
48
|
readonly findings: AmpSaaSEntityService<PlatformFindingUpsertDto, PlatformFindingDto>;
|
|
47
49
|
readonly jobExecutions: AmpEntityService<PlatformJobExecutionStateUpsertDto, PlatformJobExecutionStateDto>;
|
|
48
50
|
readonly jobs: AmpEntityService<PlatformJobSpecUpsertDto, PlatformJobSpecDto>;
|
|
@@ -58,6 +60,7 @@ export class AmpSdkServices {
|
|
|
58
60
|
this.agents = new AmpEntityServiceImpl<PlatformAgentUpsertDto, PlatformAgentDto>(rest, KIND.AGENTS, TARGET_API_PLATFORM);
|
|
59
61
|
this.asset = new AmpGlobalEntityServiceImpl<PlatformAssetUpsertDto, PlatformAssetDto>(rest, KIND.ASSETS, TARGET_API_PLATFORM);
|
|
60
62
|
this.connectors = new AmpEntityServiceImpl<PlatformConnectorUpsertDto, PlatformConnectorDto>(rest, KIND.CONNECTORS, TARGET_API_PLATFORM);
|
|
63
|
+
this.enums = new DefaultEnumService(rest, TARGET_API_PLATFORM);
|
|
61
64
|
this.findings = new AmpSaaSEntityServiceImpl<PlatformFindingUpsertDto, PlatformFindingDto>(rest, KIND.FINDINGS, TARGET_API_PLATFORM);
|
|
62
65
|
this.jobExecutions = new AmpEntityServiceImpl<PlatformJobExecutionStateUpsertDto, PlatformJobExecutionStateDto>(rest, KIND.JOB_EXECUTIONS, TARGET_API_PLATFORM);
|
|
63
66
|
this.jobs = new AmpEntityServiceImpl<PlatformJobSpecUpsertDto, PlatformJobSpecDto>(rest, KIND.JOB_SPEC, TARGET_API_PLATFORM);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {Page, EnumDto} from '../../dto';
|
|
2
|
+
import {KIND, TARGET_API_AGENT} from '../constants';
|
|
3
|
+
import {RestClient} from './RestClient';
|
|
4
|
+
|
|
5
|
+
type EnumCollection = {
|
|
6
|
+
list: () => Promise<Page<EnumDto>>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type EnumService = {
|
|
10
|
+
departments: EnumCollection;
|
|
11
|
+
organizations: EnumCollection;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
class DefaultEnumCollection implements EnumCollection {
|
|
15
|
+
private readonly rest: RestClient;
|
|
16
|
+
private readonly kind: string;
|
|
17
|
+
private readonly targetApi: string;
|
|
18
|
+
|
|
19
|
+
constructor(rest: RestClient, kind: string, targetApi: string) {
|
|
20
|
+
this.rest = rest;
|
|
21
|
+
this.kind = kind;
|
|
22
|
+
this.targetApi = targetApi;
|
|
23
|
+
}
|
|
24
|
+
async list(): Promise<Page<EnumDto>> {
|
|
25
|
+
const res = await this.rest.call({
|
|
26
|
+
url: `/${this.targetApi}/v1/enum/${this.kind}`,
|
|
27
|
+
});
|
|
28
|
+
return res.data as Page<EnumDto>;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class DefaultEnumService implements EnumService {
|
|
33
|
+
private readonly rest: RestClient;
|
|
34
|
+
readonly departments: EnumCollection;
|
|
35
|
+
readonly organizations: EnumCollection;
|
|
36
|
+
|
|
37
|
+
constructor(rest: RestClient, targetApi = TARGET_API_AGENT) {
|
|
38
|
+
this.rest = rest;
|
|
39
|
+
this.departments = new DefaultEnumCollection(rest, KIND.ENUM_DEPARTMENTS, targetApi);
|
|
40
|
+
this.organizations = new DefaultEnumCollection(rest, KIND.ENUM_ORGANIZATIONS, targetApi);
|
|
41
|
+
}
|
|
42
|
+
}
|