@ampsec/platform-client 55.6.0 → 55.7.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/notification.dto.d.ts +2 -0
- package/build/src/services/AmpSdk.js +1 -1
- package/build/src/services/AmpSdk.js.map +1 -1
- package/build/src/services/contentful.service.d.ts +20 -6
- package/build/src/services/contentful.service.js +22 -3
- package/build/src/services/contentful.service.js.map +1 -1
- package/package.json +1 -1
- package/src/dto/notification.dto.ts +2 -0
- package/src/services/AmpSdk.ts +1 -1
- package/src/services/contentful.service.ts +24 -8
|
@@ -65,6 +65,8 @@ export type VulnerabilityNotificationContext = {
|
|
|
65
65
|
solution?: string;
|
|
66
66
|
/** CVSS score of the vulnerability. */
|
|
67
67
|
cvss?: number;
|
|
68
|
+
/** CVE of the vulnerability */
|
|
69
|
+
cve?: string;
|
|
68
70
|
};
|
|
69
71
|
export type TrainingNotificationContext = {
|
|
70
72
|
/** Title of the training */
|
|
@@ -22,7 +22,7 @@ class AmpSdkServices {
|
|
|
22
22
|
this.agents = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.AGENTS, constants_1.TARGET_API_PLATFORM);
|
|
23
23
|
this.asset = new entity_service_1.AmpSdkAssetService(rest, constants_1.TARGET_API_PLATFORM);
|
|
24
24
|
this.connectors = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.CONNECTORS, constants_1.TARGET_API_PLATFORM);
|
|
25
|
-
this.contentful = new contentful_service_1.ContentfulService(
|
|
25
|
+
this.contentful = new contentful_service_1.ContentfulService();
|
|
26
26
|
this.enums = new EnumService_1.DefaultEnumService(rest, constants_1.TARGET_API_PLATFORM);
|
|
27
27
|
this.findings = new saasEntity_service_1.AmpSaaSEntityServiceImpl(rest, constants_1.KIND.FINDINGS, constants_1.TARGET_API_PLATFORM);
|
|
28
28
|
this.jobExecutions = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.JOB_EXECUTIONS, constants_1.TARGET_API_PLATFORM);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmpSdk.js","sourceRoot":"","sources":["../../../src/services/AmpSdk.ts"],"names":[],"mappings":";;;AAoBA,qDAAoI;AACpI,iCAA0E;AAC1E,2CAAsD;AAGtD,oDAAmE;AACnE,yDAAyD;AACzD,6DAA+J;AAC/J,6DAAuD;AAIvD;;;;;;;;GAQG;AACH,MAAa,cAAc;IAqBzB,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,mCAAkB,CAAC,IAAI,EAAE,+BAAmB,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU,GAAG,IAAI,qCAAoB,CAAmD,IAAI,EAAE,gBAAI,CAAC,UAAU,EAAE,+BAAmB,CAAC,CAAC;QACzI,IAAI,CAAC,UAAU,GAAG,IAAI,sCAAiB,
|
|
1
|
+
{"version":3,"file":"AmpSdk.js","sourceRoot":"","sources":["../../../src/services/AmpSdk.ts"],"names":[],"mappings":";;;AAoBA,qDAAoI;AACpI,iCAA0E;AAC1E,2CAAsD;AAGtD,oDAAmE;AACnE,yDAAyD;AACzD,6DAA+J;AAC/J,6DAAuD;AAIvD;;;;;;;;GAQG;AACH,MAAa,cAAc;IAqBzB,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,mCAAkB,CAAC,IAAI,EAAE,+BAAmB,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU,GAAG,IAAI,qCAAoB,CAAmD,IAAI,EAAE,gBAAI,CAAC,UAAU,EAAE,+BAAmB,CAAC,CAAC;QACzI,IAAI,CAAC,UAAU,GA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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;AA/CD,wCA+CC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { TargetApi } from './constants';
|
|
2
|
-
import { RestClient } from './rest';
|
|
3
1
|
import type { Entry, EntrySkeletonType, EntryFieldTypes, EntryCollection } from 'contentful/dist/types';
|
|
4
2
|
import * as contentful from 'contentful';
|
|
5
3
|
export type MessageTemplate = EntrySkeletonType & {
|
|
@@ -8,14 +6,30 @@ export type MessageTemplate = EntrySkeletonType & {
|
|
|
8
6
|
id: EntryFieldTypes.Text;
|
|
9
7
|
body: EntryFieldTypes.Text;
|
|
10
8
|
subject: EntryFieldTypes.Text;
|
|
11
|
-
|
|
9
|
+
callToActionsCsv: EntryFieldTypes.Text;
|
|
12
10
|
};
|
|
13
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* ContentfulService
|
|
14
|
+
*
|
|
15
|
+
* This client is a wrapper around the Contentful REST API meant to be used by
|
|
16
|
+
* service accounts, i.e. plugins and platform extensions. This class requires
|
|
17
|
+
* the following environment variables to be set:
|
|
18
|
+
* - CONTENTFUL_SPACE_ID
|
|
19
|
+
* - CONTENTFUL_ACCESS_TOKEN
|
|
20
|
+
* If these are not set, a warning will be logged.
|
|
21
|
+
**/
|
|
14
22
|
export declare class ContentfulService {
|
|
15
|
-
protected readonly rest: RestClient;
|
|
16
|
-
protected readonly targetApi: TargetApi;
|
|
17
23
|
protected readonly contentfulClient: contentful.ContentfulClientApi<undefined>;
|
|
18
|
-
|
|
24
|
+
/**
|
|
25
|
+
* This contructs the ContentfulService. The following environment variables
|
|
26
|
+
* must be set:
|
|
27
|
+
* - CONTENTFUL_SPACE_ID
|
|
28
|
+
* - CONTENTFUL_ACCESS_TOKEN
|
|
29
|
+
*
|
|
30
|
+
* These can be found in Contentful under Settings > API Keys
|
|
31
|
+
*/
|
|
32
|
+
constructor();
|
|
19
33
|
getMessageTemplates: () => Promise<EntryCollection<MessageTemplate>>;
|
|
20
34
|
getContentfulEntries: <T extends EntrySkeletonType>(contentType: string, include?: number) => Promise<EntryCollection<T>>;
|
|
21
35
|
getContentfulEntry: <T extends EntrySkeletonType>(entryId: string) => Promise<Entry<T>>;
|
|
@@ -25,8 +25,26 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.ContentfulService = void 0;
|
|
27
27
|
const contentful = __importStar(require("contentful"));
|
|
28
|
+
/**
|
|
29
|
+
* ContentfulService
|
|
30
|
+
*
|
|
31
|
+
* This client is a wrapper around the Contentful REST API meant to be used by
|
|
32
|
+
* service accounts, i.e. plugins and platform extensions. This class requires
|
|
33
|
+
* the following environment variables to be set:
|
|
34
|
+
* - CONTENTFUL_SPACE_ID
|
|
35
|
+
* - CONTENTFUL_ACCESS_TOKEN
|
|
36
|
+
* If these are not set, a warning will be logged.
|
|
37
|
+
**/
|
|
28
38
|
class ContentfulService {
|
|
29
|
-
|
|
39
|
+
/**
|
|
40
|
+
* This contructs the ContentfulService. The following environment variables
|
|
41
|
+
* must be set:
|
|
42
|
+
* - CONTENTFUL_SPACE_ID
|
|
43
|
+
* - CONTENTFUL_ACCESS_TOKEN
|
|
44
|
+
*
|
|
45
|
+
* These can be found in Contentful under Settings > API Keys
|
|
46
|
+
*/
|
|
47
|
+
constructor() {
|
|
30
48
|
this.getMessageTemplates = async () => {
|
|
31
49
|
const messageTemplates = await this.getContentfulEntries('messageTemplate', 0);
|
|
32
50
|
return messageTemplates;
|
|
@@ -42,8 +60,9 @@ class ContentfulService {
|
|
|
42
60
|
const entry = await this.contentfulClient.getEntry(entryId);
|
|
43
61
|
return entry;
|
|
44
62
|
};
|
|
45
|
-
|
|
46
|
-
|
|
63
|
+
if (!process.env.CONTENTFUL_SPACE_ID || !process.env.CONTENTFUL_ACCESS_TOKEN) {
|
|
64
|
+
console.warn('CONTENTFUL_SPACE_ID and CONTENTFUL_ACCESS_TOKEN must be set in the environment');
|
|
65
|
+
}
|
|
47
66
|
this.contentfulClient = contentful.createClient({
|
|
48
67
|
space: process.env.CONTENTFUL_SPACE_ID || '',
|
|
49
68
|
accessToken: process.env.CONTENTFUL_ACCESS_TOKEN || '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contentful.service.js","sourceRoot":"","sources":["../../../src/services/contentful.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"contentful.service.js","sourceRoot":"","sources":["../../../src/services/contentful.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uDAAyC;AAYzC;;;;;;;;;IASI;AACJ,MAAa,iBAAiB;IAE5B;;;;;;;OAOG;IACH;QAWA,wBAAmB,GAAG,KAAK,IAA+C,EAAE;YAC1E,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAkB,iBAAiB,EAAE,CAAC,CAAC,CAAC;YAChG,OAAO,gBAAgB,CAAC;QAC1B,CAAC,CAAC;QAEF,yBAAoB,GAAG,KAAK,EAA+B,WAAmB,EAAE,OAAgB,EAA+B,EAAE;YAC/H,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAI;gBACxD,YAAY,EAAE,WAAW;gBACzB,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAC,OAAO,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;aAC9B,CAAC,CAAC;YACH,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;QAEF,uBAAkB,GAAG,KAAK,EAA+B,OAAe,EAAqB,EAAE;YAC7F,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAI,OAAO,CAAC,CAAC;YAC/D,OAAO,KAAK,CAAC;QACf,CAAC,CAAC;QA1BA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE;YAC5E,OAAO,CAAC,IAAI,CAAC,gFAAgF,CAAC,CAAC;SAChG;QAED,IAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC,YAAY,CAAC;YAC9C,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,EAAE;YAC5C,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,EAAE;SACvD,CAAC,CAAC;IACL,CAAC;CAmBF;AAtCD,8CAsCC"}
|
package/package.json
CHANGED
package/src/services/AmpSdk.ts
CHANGED
|
@@ -64,7 +64,7 @@ export class AmpSdkServices {
|
|
|
64
64
|
this.agents = new AmpEntityServiceImpl<PlatformAgentUpsertDto, PlatformAgentDto>(rest, KIND.AGENTS, TARGET_API_PLATFORM);
|
|
65
65
|
this.asset = new AmpSdkAssetService(rest, TARGET_API_PLATFORM);
|
|
66
66
|
this.connectors = new AmpEntityServiceImpl<PlatformConnectorUpsertDto, PlatformConnectorDto>(rest, KIND.CONNECTORS, TARGET_API_PLATFORM);
|
|
67
|
-
this.contentful = new ContentfulService(
|
|
67
|
+
this.contentful = new ContentfulService();
|
|
68
68
|
this.enums = new DefaultEnumService(rest, TARGET_API_PLATFORM);
|
|
69
69
|
this.findings = new AmpSaaSEntityServiceImpl<PlatformFindingUpsertDto, PlatformFindingDto>(rest, KIND.FINDINGS, TARGET_API_PLATFORM);
|
|
70
70
|
this.jobExecutions = new AmpEntityServiceImpl<PlatformJobExecutionStateUpsertDto, PlatformJobExecutionStateDto>(rest, KIND.JOB_EXECUTIONS, TARGET_API_PLATFORM);
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {TargetApi} from './constants';
|
|
2
|
-
import {RestClient} from './rest';
|
|
3
1
|
import type {Entry, EntrySkeletonType, EntryFieldTypes, EntryCollection} from 'contentful/dist/types';
|
|
4
2
|
import * as contentful from 'contentful';
|
|
5
3
|
|
|
@@ -9,17 +7,35 @@ export type MessageTemplate = EntrySkeletonType & {
|
|
|
9
7
|
id: EntryFieldTypes.Text;
|
|
10
8
|
body: EntryFieldTypes.Text;
|
|
11
9
|
subject: EntryFieldTypes.Text;
|
|
12
|
-
|
|
10
|
+
callToActionsCsv: EntryFieldTypes.Text;
|
|
13
11
|
};
|
|
14
12
|
};
|
|
15
13
|
|
|
14
|
+
/**
|
|
15
|
+
* ContentfulService
|
|
16
|
+
*
|
|
17
|
+
* This client is a wrapper around the Contentful REST API meant to be used by
|
|
18
|
+
* service accounts, i.e. plugins and platform extensions. This class requires
|
|
19
|
+
* the following environment variables to be set:
|
|
20
|
+
* - CONTENTFUL_SPACE_ID
|
|
21
|
+
* - CONTENTFUL_ACCESS_TOKEN
|
|
22
|
+
* If these are not set, a warning will be logged.
|
|
23
|
+
**/
|
|
16
24
|
export class ContentfulService {
|
|
17
|
-
protected readonly rest: RestClient;
|
|
18
|
-
protected readonly targetApi: TargetApi;
|
|
19
25
|
protected readonly contentfulClient;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
/**
|
|
27
|
+
* This contructs the ContentfulService. The following environment variables
|
|
28
|
+
* must be set:
|
|
29
|
+
* - CONTENTFUL_SPACE_ID
|
|
30
|
+
* - CONTENTFUL_ACCESS_TOKEN
|
|
31
|
+
*
|
|
32
|
+
* These can be found in Contentful under Settings > API Keys
|
|
33
|
+
*/
|
|
34
|
+
constructor() {
|
|
35
|
+
if (!process.env.CONTENTFUL_SPACE_ID || !process.env.CONTENTFUL_ACCESS_TOKEN) {
|
|
36
|
+
console.warn('CONTENTFUL_SPACE_ID and CONTENTFUL_ACCESS_TOKEN must be set in the environment');
|
|
37
|
+
}
|
|
38
|
+
|
|
23
39
|
this.contentfulClient = contentful.createClient({
|
|
24
40
|
space: process.env.CONTENTFUL_SPACE_ID || '',
|
|
25
41
|
accessToken: process.env.CONTENTFUL_ACCESS_TOKEN || '',
|