@ampsec/platform-client 47.2.0 → 47.4.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/assetKeys.d.ts +2 -0
- package/build/src/dto/entityIdSummaries.dto.d.ts +22 -0
- package/build/src/dto/entityIdSummaries.dto.js +3 -0
- package/build/src/dto/entityIdSummaries.dto.js.map +1 -0
- package/build/src/dto/enums/globalUser.type.d.ts +1 -0
- package/build/src/dto/enums/globalUser.type.js +1 -0
- package/build/src/dto/enums/globalUser.type.js.map +1 -1
- package/build/src/dto/enums/index.d.ts +1 -0
- package/build/src/dto/enums/index.js +1 -0
- package/build/src/dto/enums/index.js.map +1 -1
- package/build/src/dto/enums/supportedMessageChannelKind.enum.d.ts +5 -0
- package/build/src/dto/enums/supportedMessageChannelKind.enum.js +21 -0
- package/build/src/dto/enums/supportedMessageChannelKind.enum.js.map +1 -0
- package/build/src/dto/extKeyMap.dto.d.ts +2 -0
- package/build/src/dto/index.d.ts +1 -0
- package/build/src/dto/index.js +1 -0
- package/build/src/dto/index.js.map +1 -1
- package/build/src/dto/notification.dto.d.ts +6 -1
- package/build/src/services/AmpSdk.d.ts +8 -7
- package/build/src/services/AmpSdk.js +9 -8
- package/build/src/services/AmpSdk.js.map +1 -1
- package/build/src/services/entity.service.d.ts +12 -10
- package/build/src/services/entity.service.js +81 -16
- package/build/src/services/entity.service.js.map +1 -1
- package/build/src/services/index.d.ts +3 -0
- package/build/src/services/index.js +3 -0
- package/build/src/services/index.js.map +1 -1
- package/build/src/services/lookup.service.d.ts +55 -0
- package/build/src/services/lookup.service.js +173 -0
- package/build/src/services/lookup.service.js.map +1 -0
- package/build/src/services/saasEntity.service.d.ts +32 -0
- package/build/src/services/saasEntity.service.js +154 -0
- package/build/src/services/saasEntity.service.js.map +1 -0
- package/build/src/services/utils.d.ts +1 -0
- package/build/src/services/utils.js +15 -0
- package/build/src/services/utils.js.map +1 -0
- package/package.json +1 -1
- package/src/dto/assetKeys.ts +2 -0
- package/src/dto/entityIdSummaries.dto.ts +27 -0
- package/src/dto/enums/globalUser.type.ts +1 -0
- package/src/dto/enums/index.ts +1 -0
- package/src/dto/enums/supportedMessageChannelKind.enum.ts +17 -0
- package/src/dto/extKeyMap.dto.ts +2 -0
- package/src/dto/index.ts +1 -0
- package/src/dto/notification.dto.ts +7 -1
- package/src/services/AmpSdk.ts +12 -29
- package/src/services/entity.service.ts +87 -24
- package/src/services/index.ts +3 -0
- package/src/services/lookup.service.ts +176 -0
- package/src/services/saasEntity.service.ts +181 -0
- package/src/services/utils.ts +8 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AssetKeys } from './assetKeys';
|
|
2
|
+
export type UserIdDto = {
|
|
3
|
+
id: string;
|
|
4
|
+
etag: string;
|
|
5
|
+
extId?: string;
|
|
6
|
+
emails: string[];
|
|
7
|
+
uid?: string;
|
|
8
|
+
};
|
|
9
|
+
export type AssetIdDto = AssetKeys & {
|
|
10
|
+
id: string;
|
|
11
|
+
etag: string;
|
|
12
|
+
extId?: string;
|
|
13
|
+
aid?: string;
|
|
14
|
+
uid?: string;
|
|
15
|
+
};
|
|
16
|
+
export type SaasComponentIdDto = {
|
|
17
|
+
id: string;
|
|
18
|
+
etag: string;
|
|
19
|
+
extId: string;
|
|
20
|
+
aid?: string;
|
|
21
|
+
uid?: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entityIdSummaries.dto.js","sourceRoot":"","sources":["../../../src/dto/entityIdSummaries.dto.ts"],"names":[],"mappings":""}
|
|
@@ -5,6 +5,7 @@ exports.GlobalUserType = void 0;
|
|
|
5
5
|
var GlobalUserType;
|
|
6
6
|
(function (GlobalUserType) {
|
|
7
7
|
GlobalUserType["USER"] = "USER";
|
|
8
|
+
GlobalUserType["ARCHIVED_USER"] = "ARCHIVED_USER";
|
|
8
9
|
GlobalUserType["BOT"] = "BOT";
|
|
9
10
|
GlobalUserType["SERVICE_ACCOUNT"] = "SERVICE_ACCOUNT";
|
|
10
11
|
})(GlobalUserType || (exports.GlobalUserType = GlobalUserType = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalUser.type.js","sourceRoot":"","sources":["../../../../src/dto/enums/globalUser.type.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,IAAY,
|
|
1
|
+
{"version":3,"file":"globalUser.type.js","sourceRoot":"","sources":["../../../../src/dto/enums/globalUser.type.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,+BAAa,CAAA;IACb,iDAA+B,CAAA;IAC/B,6BAAW,CAAA;IACX,qDAAmC,CAAA;AACrC,CAAC,EALW,cAAc,8BAAd,cAAc,QAKzB"}
|
|
@@ -15,5 +15,6 @@ export * from './notification.status';
|
|
|
15
15
|
export * from './requiredDataProperty.enum';
|
|
16
16
|
export * from './riskContributor.type';
|
|
17
17
|
export * from './saasComponentKind';
|
|
18
|
+
export * from './supportedMessageChannelKind.enum';
|
|
18
19
|
export * from './workflowStep.kind';
|
|
19
20
|
export * from './workflowTrigger.kind';
|
|
@@ -31,6 +31,7 @@ __exportStar(require("./notification.status"), exports);
|
|
|
31
31
|
__exportStar(require("./requiredDataProperty.enum"), exports);
|
|
32
32
|
__exportStar(require("./riskContributor.type"), exports);
|
|
33
33
|
__exportStar(require("./saasComponentKind"), exports);
|
|
34
|
+
__exportStar(require("./supportedMessageChannelKind.enum"), exports);
|
|
34
35
|
__exportStar(require("./workflowStep.kind"), exports);
|
|
35
36
|
__exportStar(require("./workflowTrigger.kind"), exports);
|
|
36
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,iDAA+B;AAC/B,wDAAsC;AACtC,6CAA2B;AAC3B,qDAAmC;AACnC,yDAAuC;AACvC,0DAAwC;AACxC,gDAA8B;AAC9B,qDAAmC;AACnC,mDAAiC;AACjC,oDAAkC;AAClC,oDAAkC;AAClC,wDAAsC;AACtC,wDAAsC;AACtC,8DAA4C;AAC5C,yDAAuC;AACvC,sDAAoC;AACpC,sDAAoC;AACpC,yDAAuC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,iDAA+B;AAC/B,wDAAsC;AACtC,6CAA2B;AAC3B,qDAAmC;AACnC,yDAAuC;AACvC,0DAAwC;AACxC,gDAA8B;AAC9B,qDAAmC;AACnC,mDAAiC;AACjC,oDAAkC;AAClC,oDAAkC;AAClC,wDAAsC;AACtC,wDAAsC;AACtC,8DAA4C;AAC5C,yDAAuC;AACvC,sDAAoC;AACpC,qEAAmD;AACnD,sDAAoC;AACpC,yDAAuC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSupportedMessageChannelKindFrom = exports.SupportedMessageChannelKind = void 0;
|
|
4
|
+
/* eslint-disable no-unused-vars */
|
|
5
|
+
var SupportedMessageChannelKind;
|
|
6
|
+
(function (SupportedMessageChannelKind) {
|
|
7
|
+
SupportedMessageChannelKind["SLACK"] = "SLACK";
|
|
8
|
+
SupportedMessageChannelKind["UNSUPPORTED"] = "UNSUPPORTED";
|
|
9
|
+
})(SupportedMessageChannelKind || (exports.SupportedMessageChannelKind = SupportedMessageChannelKind = {}));
|
|
10
|
+
const getSupportedMessageChannelKindFrom = (description) => {
|
|
11
|
+
if (description) {
|
|
12
|
+
for (const kind in SupportedMessageChannelKind) {
|
|
13
|
+
if (description.toUpperCase().includes(kind)) {
|
|
14
|
+
return SupportedMessageChannelKind[kind];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return SupportedMessageChannelKind.UNSUPPORTED;
|
|
19
|
+
};
|
|
20
|
+
exports.getSupportedMessageChannelKindFrom = getSupportedMessageChannelKindFrom;
|
|
21
|
+
//# sourceMappingURL=supportedMessageChannelKind.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supportedMessageChannelKind.enum.js","sourceRoot":"","sources":["../../../../src/dto/enums/supportedMessageChannelKind.enum.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACrC,8CAAe,CAAA;IACf,0DAA2B,CAAA;AAC7B,CAAC,EAHW,2BAA2B,2CAA3B,2BAA2B,QAGtC;AAEM,MAAM,kCAAkC,GAAG,CAAC,WAA+B,EAA+B,EAAE;IACjH,IAAI,WAAW,EAAE;QACf,KAAK,MAAM,IAAI,IAAI,2BAA2B,EAAE;YAC9C,IAAI,WAAW,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;gBAC5C,OAAO,2BAA2B,CAAC,IAAgD,CAAgC,CAAC;aACrH;SACF;KACF;IAED,OAAO,2BAA2B,CAAC,WAAW,CAAC;AACjD,CAAC,CAAC;AAVW,QAAA,kCAAkC,sCAU7C"}
|
package/build/src/dto/index.d.ts
CHANGED
package/build/src/dto/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __exportStar(require("./assetKeys"), exports);
|
|
|
20
20
|
__exportStar(require("./base.dto"), exports);
|
|
21
21
|
__exportStar(require("./connectors.dto"), exports);
|
|
22
22
|
__exportStar(require("./constants"), exports);
|
|
23
|
+
__exportStar(require("./entityIdSummaries.dto"), exports);
|
|
23
24
|
__exportStar(require("./enum.dto"), exports);
|
|
24
25
|
__exportStar(require("./enums"), exports);
|
|
25
26
|
__exportStar(require("./extKeyMap.dto"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,+CAA6B;AAC7B,8CAA4B;AAC5B,6CAA2B;AAC3B,mDAAiC;AACjC,8CAA4B;AAC5B,6CAA2B;AAC3B,0CAAwB;AACxB,kDAAgC;AAChC,iDAA+B;AAC/B,wCAAsB;AACtB,gDAA8B;AAC9B,qDAAmC;AACnC,6CAA2B;AAC3B,6CAA2B;AAC3B,kDAAgC;AAChC,sDAAoC;AACpC,yDAAuC;AACvC,mDAAiC;AACjC,uDAAqC;AACrC,kDAAgC;AAChC,mDAAiC;AACjC,gDAA8B;AAC9B,8CAA4B;AAC5B,iDAA+B;AAC/B,sDAAoC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,+CAA6B;AAC7B,8CAA4B;AAC5B,6CAA2B;AAC3B,mDAAiC;AACjC,8CAA4B;AAC5B,0DAAwC;AACxC,6CAA2B;AAC3B,0CAAwB;AACxB,kDAAgC;AAChC,iDAA+B;AAC/B,wCAAsB;AACtB,gDAA8B;AAC9B,qDAAmC;AACnC,6CAA2B;AAC3B,6CAA2B;AAC3B,kDAAgC;AAChC,sDAAoC;AACpC,yDAAuC;AACvC,mDAAiC;AACjC,uDAAqC;AACrC,kDAAgC;AAChC,mDAAiC;AACjC,gDAA8B;AAC9B,8CAA4B;AAC5B,iDAA+B;AAC/B,sDAAoC"}
|
|
@@ -2,6 +2,7 @@ import { BaseDto, BaseUpsertDto } from './base.dto';
|
|
|
2
2
|
import { Category, DeliveryStrategyKind, FindingKind, FindingSeverity, NotificationStatus } from './enums';
|
|
3
3
|
import { ContentStrategyKind } from './enums/contentStrategy.kind';
|
|
4
4
|
import { FindingOutcome } from './enums/finding.outcome';
|
|
5
|
+
import { SupportedMessageChannelKind } from './enums/supportedMessageChannelKind.enum';
|
|
5
6
|
export type NotificationAddress = {
|
|
6
7
|
/** Connector ID for the notification channel */
|
|
7
8
|
cid?: string;
|
|
@@ -12,7 +13,11 @@ export type NotificationAddress = {
|
|
|
12
13
|
/** Webhook URLs to which the notification is being sent */
|
|
13
14
|
webhooks?: string[];
|
|
14
15
|
};
|
|
15
|
-
export type
|
|
16
|
+
export type MessageNotificationAddress = NotificationAddress & {
|
|
17
|
+
/** Channel kind for messaging applications */
|
|
18
|
+
kind: SupportedMessageChannelKind;
|
|
19
|
+
};
|
|
20
|
+
export type SlackNotificationAddress = MessageNotificationAddress & {
|
|
16
21
|
teamId: string;
|
|
17
22
|
};
|
|
18
23
|
export type AssetNotificationContext = {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { PlatformAgentDto, PlatformAgentUpsertDto,
|
|
2
|
-
import { AmpEntityService,
|
|
1
|
+
import { PlatformAgentDto, PlatformAgentUpsertDto, PlatformConnectorDto, PlatformConnectorUpsertDto, PlatformFindingDto, PlatformFindingUpsertDto, PlatformNotificationDto, PlatformNotificationUpsertDto, PlatformProviderUpsertDto, PlatformReportResultDto, PlatformReportResultUpsertDto, PlatformRiskContributorDto, PlatformRiskContributorUpsertDto, PlatformWorkflowProgressDto, PlatformWorkflowProgressUpsertDto, ProviderDto, TenantDto, TenantUpsertDto } from '../dto';
|
|
2
|
+
import { AmpEntityService, AmpSdkAssetService, AmpSdkTenantService, AmpSdkUserService } from './entity.service';
|
|
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
6
|
import { EnumService } from './rest/EnumService';
|
|
7
7
|
import { AmpSettingsService } from './settings.service';
|
|
8
|
+
import { AmpSaaSEntityService, AmpSdkSaasAssetService, AmpSdkSaasComponentService, AmpSdkSaasUserService } from './saasEntity.service';
|
|
8
9
|
export type AmpSdkOptions = AmpRestClientOptions;
|
|
9
10
|
/**
|
|
10
11
|
* AMP API
|
|
@@ -17,7 +18,7 @@ export type AmpSdkOptions = AmpRestClientOptions;
|
|
|
17
18
|
*/
|
|
18
19
|
export declare class AmpSdkServices {
|
|
19
20
|
readonly agents: AmpEntityService<PlatformAgentUpsertDto, PlatformAgentDto>;
|
|
20
|
-
readonly asset:
|
|
21
|
+
readonly asset: AmpSdkAssetService;
|
|
21
22
|
readonly connectors: AmpEntityService<PlatformConnectorUpsertDto, PlatformConnectorDto>;
|
|
22
23
|
readonly enums: EnumService;
|
|
23
24
|
readonly findings: AmpSaaSEntityService<PlatformFindingUpsertDto, PlatformFindingDto>;
|
|
@@ -27,12 +28,12 @@ export declare class AmpSdkServices {
|
|
|
27
28
|
readonly providers: AmpEntityService<PlatformProviderUpsertDto, ProviderDto>;
|
|
28
29
|
readonly reportResults: AmpSaaSEntityService<PlatformReportResultUpsertDto, PlatformReportResultDto>;
|
|
29
30
|
readonly riskContributors: AmpSaaSEntityService<PlatformRiskContributorUpsertDto, PlatformRiskContributorDto>;
|
|
30
|
-
readonly saasAssets:
|
|
31
|
-
readonly saasComponents:
|
|
32
|
-
readonly saasUsers:
|
|
31
|
+
readonly saasAssets: AmpSdkSaasAssetService;
|
|
32
|
+
readonly saasComponents: AmpSdkSaasComponentService;
|
|
33
|
+
readonly saasUsers: AmpSdkSaasUserService;
|
|
33
34
|
readonly settings: AmpSettingsService;
|
|
34
35
|
readonly tenants: AmpSdkTenantService<TenantUpsertDto, TenantDto>;
|
|
35
|
-
readonly users:
|
|
36
|
+
readonly users: AmpSdkUserService;
|
|
36
37
|
readonly workflowsProgress: AmpEntityService<PlatformWorkflowProgressUpsertDto, PlatformWorkflowProgressDto>;
|
|
37
38
|
constructor(rest: RestClient);
|
|
38
39
|
static instance(options: AmpSdkOptions): AmpSdkServices;
|
|
@@ -6,6 +6,7 @@ const rest_1 = require("./rest");
|
|
|
6
6
|
const constants_1 = require("./constants");
|
|
7
7
|
const EnumService_1 = require("./rest/EnumService");
|
|
8
8
|
const settings_service_1 = require("./settings.service");
|
|
9
|
+
const saasEntity_service_1 = require("./saasEntity.service");
|
|
9
10
|
/**
|
|
10
11
|
* AMP API
|
|
11
12
|
* This client is a wrapper around the AMP REST API meant to be used by
|
|
@@ -18,22 +19,22 @@ const settings_service_1 = require("./settings.service");
|
|
|
18
19
|
class AmpSdkServices {
|
|
19
20
|
constructor(rest) {
|
|
20
21
|
this.agents = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.AGENTS, constants_1.TARGET_API_PLATFORM);
|
|
21
|
-
this.asset = new entity_service_1.
|
|
22
|
+
this.asset = new entity_service_1.AmpSdkAssetService(rest, constants_1.TARGET_API_PLATFORM);
|
|
22
23
|
this.connectors = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.CONNECTORS, constants_1.TARGET_API_PLATFORM);
|
|
23
24
|
this.enums = new EnumService_1.DefaultEnumService(rest, constants_1.TARGET_API_PLATFORM);
|
|
24
|
-
this.findings = new
|
|
25
|
+
this.findings = new saasEntity_service_1.AmpSaaSEntityServiceImpl(rest, constants_1.KIND.FINDINGS, constants_1.TARGET_API_PLATFORM);
|
|
25
26
|
this.jobExecutions = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.JOB_EXECUTIONS, constants_1.TARGET_API_PLATFORM);
|
|
26
27
|
this.jobs = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.JOB_SPEC, constants_1.TARGET_API_PLATFORM);
|
|
27
28
|
this.notifications = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.NOTIFICATIONS, constants_1.TARGET_API_PLATFORM);
|
|
28
29
|
this.providers = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.PROVIDERS, constants_1.TARGET_API_PLATFORM);
|
|
29
|
-
this.reportResults = new
|
|
30
|
-
this.riskContributors = new
|
|
31
|
-
this.saasAssets = new
|
|
32
|
-
this.saasComponents = new
|
|
33
|
-
this.saasUsers = new
|
|
30
|
+
this.reportResults = new saasEntity_service_1.AmpSaaSEntityServiceImpl(rest, constants_1.KIND.REPORT_RESULTS, constants_1.TARGET_API_PLATFORM);
|
|
31
|
+
this.riskContributors = new saasEntity_service_1.AmpSaaSEntityServiceImpl(rest, constants_1.KIND.RISK_CONTRIBUTORS, constants_1.TARGET_API_PLATFORM);
|
|
32
|
+
this.saasAssets = new saasEntity_service_1.AmpSdkSaasAssetService(rest, constants_1.TARGET_API_PLATFORM);
|
|
33
|
+
this.saasComponents = new saasEntity_service_1.AmpSdkSaasComponentService(rest, constants_1.TARGET_API_PLATFORM);
|
|
34
|
+
this.saasUsers = new saasEntity_service_1.AmpSdkSaasUserService(rest, constants_1.TARGET_API_PLATFORM);
|
|
34
35
|
this.settings = new settings_service_1.AmpSettingsService(rest, constants_1.TARGET_API_PLATFORM);
|
|
35
36
|
this.tenants = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.TENANTS, constants_1.TARGET_API_PLATFORM);
|
|
36
|
-
this.users = new entity_service_1.
|
|
37
|
+
this.users = new entity_service_1.AmpSdkUserService(rest, constants_1.TARGET_API_PLATFORM);
|
|
37
38
|
this.workflowsProgress = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.WORKFLOW_PROGRESS, constants_1.TARGET_API_PLATFORM);
|
|
38
39
|
}
|
|
39
40
|
static instance(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmpSdk.js","sourceRoot":"","sources":["../../../src/services/AmpSdk.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"AmpSdk.js","sourceRoot":"","sources":["../../../src/services/AmpSdk.ts"],"names":[],"mappings":";;;AAoBA,qDAAoI;AACpI,iCAA0E;AAC1E,2CAAsD;AAGtD,oDAAmE;AACnE,yDAAsD;AACtD,6DAA+J;AAI/J;;;;;;;;GAQG;AACH,MAAa,cAAc;IAoBzB,YAAY,IAAgB;QAC1B,IAAI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,CAAC;QACxE,IAAI,CAAC,cAAc,GAAG,IAAI,+CAA0B,CAAC,IAAI,EAAE,+BAAmB,CAAC,CAAC;QAChF,IAAI,CAAC,SAAS,GAAG,IAAI,0CAAqB,CAAC,IAAI,EAAE,+BAAmB,CAAC,CAAC;QACtE,IAAI,CAAC,QAAQ,GAAG,IAAI,qCAAkB,CAAC,IAAI,EAAE,+BAAmB,CAAC,CAAC;QAClE,IAAI,CAAC,OAAO,GAAG,IAAI,qCAAoB,CAA6B,IAAI,EAAE,gBAAI,CAAC,OAAO,EAAE,+BAAmB,CAAC,CAAC;QAC7G,IAAI,CAAC,KAAK,GAAG,IAAI,kCAAiB,CAAC,IAAI,EAAE,+BAAmB,CAAC,CAAC;QAC9D,IAAI,CAAC,iBAAiB,GAAG,IAAI,qCAAoB,CAAiE,IAAI,EAAE,gBAAI,CAAC,iBAAiB,EAAE,+BAAmB,CAAC,CAAC;IACvK,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;AA7CD,wCA6CC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { BaseDto, BaseUpsertDto, ExtKeyMap, Page } from '../dto';
|
|
1
|
+
import { BaseDto, BaseUpsertDto, ExtKeyMap, Page, PlatformAssetDto, PlatformAssetUpsertDto, PlatformUserDto, PlatformUserUpsertDto } from '../dto';
|
|
2
2
|
import { TargetApi } from './constants';
|
|
3
3
|
import { AmpDataService, AmpDataServiceImpl } from './data.service';
|
|
4
4
|
import { RestClient } from './rest';
|
|
5
|
+
import { AssetLookupService, UserLookupService } from './lookup.service';
|
|
5
6
|
export type EntityCallOptions = {
|
|
6
7
|
params: unknown;
|
|
7
8
|
};
|
|
@@ -21,12 +22,6 @@ export interface AmpGlobalEntityService<WriteT extends BaseUpsertDto, ReadT exte
|
|
|
21
22
|
delete(_id: string, _options?: EntityCallOptions): Promise<Page<ReadT>>;
|
|
22
23
|
getLookupIds(_tid: string, _options?: EntityCallOptions): Promise<ExtKeyMap>;
|
|
23
24
|
}
|
|
24
|
-
export interface AmpSaaSEntityService<WriteT extends BaseUpsertDto, ReadT extends BaseDto> extends AmpDataService<ReadT> {
|
|
25
|
-
create(_model: WriteT | WriteT[], _options?: EntityCallOptions): Promise<Page<ReadT>>;
|
|
26
|
-
update(_model: WriteT | WriteT[], _options?: EntityCallOptions): Promise<Page<ReadT>>;
|
|
27
|
-
delete(_id: string, _options?: EntityCallOptions): Promise<Page<ReadT>>;
|
|
28
|
-
getLookupIds(_cid: string, _options?: EntityCallOptions): Promise<ExtKeyMap>;
|
|
29
|
-
}
|
|
30
25
|
export declare class AmpEntityServiceImpl<WriteT extends BaseUpsertDto, ReadT extends BaseDto> extends AmpDataServiceImpl<ReadT> implements AmpEntityService<WriteT, ReadT> {
|
|
31
26
|
constructor(rest: RestClient, kind: string, targetApi?: TargetApi);
|
|
32
27
|
create: (model: WriteT | WriteT[], options?: EntityCallOptions) => Promise<Page<ReadT>>;
|
|
@@ -35,9 +30,16 @@ export declare class AmpEntityServiceImpl<WriteT extends BaseUpsertDto, ReadT ex
|
|
|
35
30
|
}
|
|
36
31
|
export declare class AmpGlobalEntityServiceImpl<WriteT extends BaseUpsertDto, ReadT extends BaseDto> extends AmpEntityServiceImpl<WriteT, ReadT> implements AmpGlobalEntityService<WriteT, ReadT> {
|
|
37
32
|
constructor(rest: RestClient, kind: string, targetApi?: TargetApi);
|
|
33
|
+
/** @deprecated */
|
|
38
34
|
getLookupIds: (tid: string, options?: EntityCallOptions) => Promise<ExtKeyMap>;
|
|
39
35
|
}
|
|
40
|
-
export declare class
|
|
41
|
-
constructor(rest: RestClient,
|
|
42
|
-
|
|
36
|
+
export declare class AmpSdkUserService extends AmpGlobalEntityServiceImpl<PlatformUserUpsertDto, PlatformUserDto> {
|
|
37
|
+
constructor(rest: RestClient, targetApi?: TargetApi);
|
|
38
|
+
getLookup: (tid: string, options?: EntityCallOptions) => Promise<UserLookupService>;
|
|
39
|
+
refreshLookup: (lookup: UserLookupService, tid: string, options?: EntityCallOptions) => Promise<UserLookupService>;
|
|
40
|
+
}
|
|
41
|
+
export declare class AmpSdkAssetService extends AmpGlobalEntityServiceImpl<PlatformAssetUpsertDto, PlatformAssetDto> {
|
|
42
|
+
constructor(rest: RestClient, targetApi?: TargetApi);
|
|
43
|
+
getLookup: (tid: string, options?: EntityCallOptions) => Promise<AssetLookupService>;
|
|
44
|
+
refreshLookup: (lookup: AssetLookupService, tid: string, options?: EntityCallOptions) => Promise<AssetLookupService>;
|
|
43
45
|
}
|
|
@@ -3,10 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.AmpSdkAssetService = exports.AmpSdkUserService = exports.AmpGlobalEntityServiceImpl = exports.AmpEntityServiceImpl = void 0;
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
const constants_1 = require("./constants");
|
|
9
9
|
const data_service_1 = require("./data.service");
|
|
10
|
+
const lookup_service_1 = require("./lookup.service");
|
|
11
|
+
const LOOKUP_ID_PAGE_SIZE = 50;
|
|
10
12
|
class AmpEntityServiceImpl extends data_service_1.AmpDataServiceImpl {
|
|
11
13
|
constructor(rest, kind, targetApi = constants_1.TARGET_API_AGENT) {
|
|
12
14
|
super(rest, kind, targetApi);
|
|
@@ -59,6 +61,7 @@ const extIdMapErrorHandler = (error) => {
|
|
|
59
61
|
class AmpGlobalEntityServiceImpl extends AmpEntityServiceImpl {
|
|
60
62
|
constructor(rest, kind, targetApi = constants_1.TARGET_API_AGENT) {
|
|
61
63
|
super(rest, kind, targetApi);
|
|
64
|
+
/** @deprecated */
|
|
62
65
|
this.getLookupIds = (tid, options) => {
|
|
63
66
|
var _a;
|
|
64
67
|
const req = {
|
|
@@ -74,22 +77,84 @@ class AmpGlobalEntityServiceImpl extends AmpEntityServiceImpl {
|
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
79
|
exports.AmpGlobalEntityServiceImpl = AmpGlobalEntityServiceImpl;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
80
|
+
const errorHandler = (error) => {
|
|
81
|
+
if (error instanceof Error) {
|
|
82
|
+
console.error(error.message);
|
|
83
|
+
}
|
|
84
|
+
throw error;
|
|
85
|
+
};
|
|
86
|
+
class AmpSdkUserService extends AmpGlobalEntityServiceImpl {
|
|
87
|
+
constructor(rest, targetApi = constants_1.TARGET_API_AGENT) {
|
|
88
|
+
super(rest, constants_1.KIND.USERS, targetApi);
|
|
89
|
+
this.getLookup = async (tid, options) => {
|
|
90
|
+
const lookup = new lookup_service_1.UserLookupService();
|
|
91
|
+
return this.refreshLookup(lookup, tid, options);
|
|
92
|
+
};
|
|
93
|
+
this.refreshLookup = async (lookup, tid, options) => {
|
|
94
|
+
var _a, _b, _c;
|
|
95
|
+
const limit = LOOKUP_ID_PAGE_SIZE;
|
|
96
|
+
let offset = 0;
|
|
97
|
+
let hasMore = true;
|
|
98
|
+
if (!options) {
|
|
99
|
+
options = { params: {} };
|
|
100
|
+
}
|
|
101
|
+
lodash_1.default.set(options, 'params.updatedAt', { $gt: lookup.getLastUpdated() });
|
|
102
|
+
while (hasMore) {
|
|
103
|
+
const req = {
|
|
104
|
+
url: `/${this.targetApi}/v1/${this.kind}/id_summary`,
|
|
105
|
+
method: 'GET',
|
|
106
|
+
params: {
|
|
107
|
+
...((_a = options === null || options === void 0 ? void 0 : options.params) !== null && _a !== void 0 ? _a : {}),
|
|
108
|
+
tid,
|
|
109
|
+
limit,
|
|
110
|
+
offset,
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
const page = await this.call(req, errorHandler);
|
|
114
|
+
page.data.forEach(ids => lookup.add(ids));
|
|
115
|
+
offset = ((_b = page.hints.offset) !== null && _b !== void 0 ? _b : offset) + limit;
|
|
116
|
+
hasMore = (_c = page.hints.hasMore) !== null && _c !== void 0 ? _c : false;
|
|
117
|
+
}
|
|
118
|
+
return lookup;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.AmpSdkUserService = AmpSdkUserService;
|
|
123
|
+
class AmpSdkAssetService extends AmpGlobalEntityServiceImpl {
|
|
124
|
+
constructor(rest, targetApi = constants_1.TARGET_API_AGENT) {
|
|
125
|
+
super(rest, constants_1.KIND.ASSETS, targetApi);
|
|
126
|
+
this.getLookup = async (tid, options) => {
|
|
127
|
+
const lookup = new lookup_service_1.AssetLookupService();
|
|
128
|
+
return this.refreshLookup(lookup, tid, options);
|
|
129
|
+
};
|
|
130
|
+
this.refreshLookup = async (lookup, tid, options) => {
|
|
131
|
+
var _a, _b, _c;
|
|
132
|
+
const limit = LOOKUP_ID_PAGE_SIZE;
|
|
133
|
+
let offset = 0;
|
|
134
|
+
let hasMore = true;
|
|
135
|
+
if (!options) {
|
|
136
|
+
options = { params: {} };
|
|
137
|
+
}
|
|
138
|
+
lodash_1.default.set(options, 'params.updatedAt', { $gt: lookup.getLastUpdated() });
|
|
139
|
+
while (hasMore) {
|
|
140
|
+
const req = {
|
|
141
|
+
url: `/${this.targetApi}/v1/${this.kind}/id_summary`,
|
|
142
|
+
method: 'GET',
|
|
143
|
+
params: {
|
|
144
|
+
...((_a = options === null || options === void 0 ? void 0 : options.params) !== null && _a !== void 0 ? _a : {}),
|
|
145
|
+
tid,
|
|
146
|
+
limit,
|
|
147
|
+
offset,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
const page = await this.call(req, errorHandler);
|
|
151
|
+
page.data.forEach(ids => lookup.add(ids));
|
|
152
|
+
offset = ((_b = page.hints.offset) !== null && _b !== void 0 ? _b : offset) + limit;
|
|
153
|
+
hasMore = (_c = page.hints.hasMore) !== null && _c !== void 0 ? _c : false;
|
|
154
|
+
}
|
|
155
|
+
return lookup;
|
|
91
156
|
};
|
|
92
157
|
}
|
|
93
158
|
}
|
|
94
|
-
exports.
|
|
159
|
+
exports.AmpSdkAssetService = AmpSdkAssetService;
|
|
95
160
|
//# sourceMappingURL=entity.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.service.js","sourceRoot":"","sources":["../../../src/services/entity.service.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAEvB,
|
|
1
|
+
{"version":3,"file":"entity.service.js","sourceRoot":"","sources":["../../../src/services/entity.service.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAEvB,2CAA4E;AAC5E,iDAAkE;AAGlE,qDAAuE;AAEvE,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAyB/B,MAAa,oBAA0E,SAAQ,iCAAyB;IACtH,YAAY,IAAgB,EAAE,IAAY,EAAE,YAAuB,4BAAgB;QACjF,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QAG/B,WAAM,GAAG,CAAC,KAAwB,EAAE,OAA2B,EAAwB,EAAE;YACvF,OAAO,IAAI,CAAC,OAAO,CAAC;gBAClB,GAAG,EAAE,IAAI,IAAI,CAAC,SAAS,OAAO,IAAI,CAAC,IAAI,EAAE;gBACzC,MAAM,EAAE,MAAM;gBACd,MAAM,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAkB;gBACnC,IAAI,EAAE,KAAK;aACZ,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,WAAM,GAAG,CAAC,KAAwB,EAAE,OAA2B,EAAwB,EAAE;YACvF,MAAM,GAAG,GAAG,gBAAC,CAAC,OAAO,CAAC,KAAK,C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AAE,YAA8C,CAAC,CAAC;gBAClF,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC1C,MAAM,GAAG,CAAC,MAAA,IAAI,CAAC,KAAK,CAAC,MAAM,mCAAI,MAAM,CAAC,GAAG,KAAK,CAAC;gBAC/C,OAAO,GAAG,MAAA,IAAI,CAAC,KAAK,CAAC,OAAO,mCAAI,KAAK,CAAC;aACvC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;IAhCF,CAAC;CAiCF;AApCD,gDAoCC"}
|
|
@@ -5,5 +5,8 @@ export * from './constants';
|
|
|
5
5
|
export * from './data.service';
|
|
6
6
|
export * from './entity.service';
|
|
7
7
|
export * from './findings.service';
|
|
8
|
+
export * from './lookup.service';
|
|
8
9
|
export * from './rest';
|
|
10
|
+
export * from './saasEntity.service';
|
|
9
11
|
export * from './settings.service';
|
|
12
|
+
export * from './utils';
|
|
@@ -21,6 +21,9 @@ __exportStar(require("./constants"), exports);
|
|
|
21
21
|
__exportStar(require("./data.service"), exports);
|
|
22
22
|
__exportStar(require("./entity.service"), exports);
|
|
23
23
|
__exportStar(require("./findings.service"), exports);
|
|
24
|
+
__exportStar(require("./lookup.service"), exports);
|
|
24
25
|
__exportStar(require("./rest"), exports);
|
|
26
|
+
__exportStar(require("./saasEntity.service"), exports);
|
|
25
27
|
__exportStar(require("./settings.service"), exports);
|
|
28
|
+
__exportStar(require("./utils"), exports);
|
|
26
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,iDAA+B;AAC/B,mDAAiC;AACjC,qDAAmC;AACnC,yCAAuB;AACvB,qDAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,iDAA+B;AAC/B,mDAAiC;AACjC,qDAAmC;AACnC,mDAAiC;AACjC,yCAAuB;AACvB,uDAAqC;AACrC,qDAAmC;AACnC,0CAAwB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { AssetIdDto, AssetKeys, RawUserIds, SaasComponentIdDto, UserIdDto } from '../dto';
|
|
2
|
+
export declare class UserLookupService {
|
|
3
|
+
private readonly emailLookupMap;
|
|
4
|
+
private readonly extIdLookupMap;
|
|
5
|
+
private lastUpdated;
|
|
6
|
+
getLastUpdated(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Emails are normalized to lower case but external IDs are case sensitive
|
|
9
|
+
*/
|
|
10
|
+
add(user: UserIdDto): void;
|
|
11
|
+
/**
|
|
12
|
+
* Calls through to `byEmails` and `byExtId`
|
|
13
|
+
*/
|
|
14
|
+
lookup(userIds?: RawUserIds): UserIdDto[];
|
|
15
|
+
/**
|
|
16
|
+
* Emails are normalized to lower case
|
|
17
|
+
*/
|
|
18
|
+
byEmails(emails: string[]): UserIdDto[];
|
|
19
|
+
/**
|
|
20
|
+
* Emails are normalized to lower case
|
|
21
|
+
*/
|
|
22
|
+
byEmail(email: string): UserIdDto | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* External IDs are case sensitive
|
|
25
|
+
*/
|
|
26
|
+
byExtId(extId: string): UserIdDto | undefined;
|
|
27
|
+
}
|
|
28
|
+
export declare class AssetLookupService {
|
|
29
|
+
private readonly macsLookupMap;
|
|
30
|
+
private readonly snLookupMap;
|
|
31
|
+
private readonly extIdLookupMap;
|
|
32
|
+
private lastUpdated;
|
|
33
|
+
getLastUpdated(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Macs are normalized to standard format using `formatMacAddress` but serial numbers and external IDs are case sensitive
|
|
36
|
+
*/
|
|
37
|
+
add(asset: AssetIdDto): void;
|
|
38
|
+
lookup(keys: AssetKeys): AssetIdDto[];
|
|
39
|
+
/**
|
|
40
|
+
* Macs are normalized to standard format using `formatMacAddress`
|
|
41
|
+
*/
|
|
42
|
+
byMacs(macs: string | string[]): AssetIdDto[];
|
|
43
|
+
bySn(sn?: string): AssetIdDto | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* External IDs are case sensitive
|
|
46
|
+
*/
|
|
47
|
+
byExtId(extId: string): AssetIdDto | undefined;
|
|
48
|
+
}
|
|
49
|
+
export declare class SaasComponentLookupService {
|
|
50
|
+
private readonly extIdLookupMap;
|
|
51
|
+
private lastUpdated;
|
|
52
|
+
getLastUpdated(): string;
|
|
53
|
+
add(sc: SaasComponentIdDto): void;
|
|
54
|
+
byExtId(extId: string): SaasComponentIdDto | undefined;
|
|
55
|
+
}
|