@ampsec/platform-client 55.5.0 → 55.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.
@@ -6,6 +6,7 @@ import { PlatformJobExecutionStateDto, PlatformJobExecutionStateUpsertDto } from
6
6
  import { EnumService } from './rest/EnumService';
7
7
  import { AmpSdkSettingsService } from './settings.service';
8
8
  import { AmpSaaSEntityService, AmpSdkSaasAssetService, AmpSdkSaasComponentService, AmpSdkSaasUserService } from './saasEntity.service';
9
+ import { ContentfulService } from './contentful.service';
9
10
  export type AmpSdkOptions = AmpRestClientOptions;
10
11
  /**
11
12
  * AMP API
@@ -20,6 +21,7 @@ export declare class AmpSdkServices {
20
21
  readonly agents: AmpEntityService<PlatformAgentUpsertDto, PlatformAgentDto>;
21
22
  readonly asset: AmpSdkAssetService;
22
23
  readonly connectors: AmpEntityService<PlatformConnectorUpsertDto, PlatformConnectorDto>;
24
+ readonly contentful: ContentfulService;
23
25
  readonly enums: EnumService;
24
26
  readonly findings: AmpSaaSEntityService<PlatformFindingUpsertDto, PlatformFindingDto>;
25
27
  readonly jobExecutions: AmpEntityService<PlatformJobExecutionStateUpsertDto, PlatformJobExecutionStateDto>;
@@ -7,6 +7,7 @@ const constants_1 = require("./constants");
7
7
  const EnumService_1 = require("./rest/EnumService");
8
8
  const settings_service_1 = require("./settings.service");
9
9
  const saasEntity_service_1 = require("./saasEntity.service");
10
+ const contentful_service_1 = require("./contentful.service");
10
11
  /**
11
12
  * AMP API
12
13
  * This client is a wrapper around the AMP REST API meant to be used by
@@ -21,6 +22,7 @@ class AmpSdkServices {
21
22
  this.agents = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.AGENTS, constants_1.TARGET_API_PLATFORM);
22
23
  this.asset = new entity_service_1.AmpSdkAssetService(rest, constants_1.TARGET_API_PLATFORM);
23
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(rest, constants_1.TARGET_API_PLATFORM);
24
26
  this.enums = new EnumService_1.DefaultEnumService(rest, constants_1.TARGET_API_PLATFORM);
25
27
  this.findings = new saasEntity_service_1.AmpSaaSEntityServiceImpl(rest, constants_1.KIND.FINDINGS, constants_1.TARGET_API_PLATFORM);
26
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;AAI/J;;;;;;;;GAQG;AACH,MAAa,cAAc;IAoBzB,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,KAAK,GAAG,IAAI,gCAAkB,CAAC,IAAI,EAAE,+BAAmB,CAAC,CAAC;QAC/D,IAAI,CAAC,QAAQ,GAAG,IAAI,6CAAwB,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,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est';
3
+ import type { Entry, EntrySkeletonType, EntryFieldTypes, EntryCollection } from 'contentful/dist/types';
4
+ import * as contentful from 'contentful';
5
+ export type MessageTemplate = EntrySkeletonType & {
6
+ contentTypeId: 'messageTemplate';
7
+ fields: {
8
+ id: EntryFieldTypes.Text;
9
+ body: EntryFieldTypes.Text;
10
+ subject: EntryFieldTypes.Text;
11
+ callToActions: EntryFieldTypes.Text;
12
+ };
13
+ };
14
+ export declare class ContentfulService {
15
+ protected readonly rest: RestClient;
16
+ protected readonly targetApi: TargetApi;
17
+ protected readonly contentfulClient: contentful.ContentfulClientApi<undefined>;
18
+ constructor(rest: RestClient, targetApi?: TargetApi);
19
+ getMessageTemplates: () => Promise<EntryCollection<MessageTemplate>>;
20
+ getContentfulEntries: <T extends EntrySkeletonType>(contentType: string, include?: number) => Promise<EntryCollection<T>>;
21
+ getContentfulEntry: <T extends EntrySkeletonType>(entryId: string) => Promise<Entry<T>>;
22
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ContentfulService = void 0;
27
+ const contentful = __importStar(require("contentful"));
28
+ class ContentfulService {
29
+ constructor(rest, targetApi = 'api') {
30
+ this.getMessageTemplates = async () => {
31
+ const messageTemplates = await this.getContentfulEntries('messageTemplate', 0);
32
+ return messageTemplates;
33
+ };
34
+ this.getContentfulEntries = async (contentType, include) => {
35
+ const entries = await this.contentfulClient.getEntries({
36
+ content_type: contentType,
37
+ ...(include ? { include } : {}),
38
+ });
39
+ return entries;
40
+ };
41
+ this.getContentfulEntry = async (entryId) => {
42
+ const entry = await this.contentfulClient.getEntry(entryId);
43
+ return entry;
44
+ };
45
+ this.rest = rest;
46
+ this.targetApi = targetApi;
47
+ this.contentfulClient = contentful.createClient({
48
+ space: process.env.CONTENTFUL_SPACE_ID || '',
49
+ accessToken: process.env.CONTENTFUL_ACCESS_TOKEN || '',
50
+ });
51
+ }
52
+ }
53
+ exports.ContentfulService = ContentfulService;
54
+ //# sourceMappingURL=contentful.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contentful.service.js","sourceRoot":"","sources":["../../../src/services/contentful.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,uDAAyC;AAYzC,MAAa,iBAAiB;IAI5B,YAAY,IAAgB,EAAE,YAAuB,KAAK;QAS1D,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;QAxBA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,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;AA9BD,8CA8BC"}
@@ -13,3 +13,4 @@ export * from './utils';
13
13
  export * from './connectors.service';
14
14
  export * from './notification.service';
15
15
  export * from './reports.service';
16
+ export * from './contentful.service';
@@ -29,4 +29,5 @@ __exportStar(require("./utils"), exports);
29
29
  __exportStar(require("./connectors.service"), exports);
30
30
  __exportStar(require("./notification.service"), exports);
31
31
  __exportStar(require("./reports.service"), exports);
32
+ __exportStar(require("./contentful.service"), exports);
32
33
  //# 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,mDAAiC;AACjC,yCAAuB;AACvB,uDAAqC;AACrC,qDAAmC;AACnC,0CAAwB;AACxB,uDAAqC;AACrC,yDAAuC;AACvC,oDAAkC"}
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;AACxB,uDAAqC;AACrC,yDAAuC;AACvC,oDAAkC;AAClC,uDAAqC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampsec/platform-client",
3
- "version": "55.5.0",
3
+ "version": "55.6.0",
4
4
  "description": "",
5
5
  "main": "build/src/index.js",
6
6
  "runkitExampleFilename": "example/main.js",
@@ -24,6 +24,7 @@
24
24
  "dependencies": {
25
25
  "axios": "^1.4.0",
26
26
  "blueimp-md5": "^2.19.0",
27
+ "contentful": "^10.6.9",
27
28
  "immutable": "^5.0.0-beta.4",
28
29
  "lodash": "^4.17.21",
29
30
  "lodash.omit": "^4.5.0",
@@ -26,6 +26,7 @@ import {PlatformJobExecutionStateDto, PlatformJobExecutionStateUpsertDto} from '
26
26
  import {DefaultEnumService, EnumService} from './rest/EnumService';
27
27
  import {AmpSdkSettingsService} from './settings.service';
28
28
  import {AmpSaaSEntityService, AmpSaaSEntityServiceImpl, AmpSdkSaasAssetService, AmpSdkSaasComponentService, AmpSdkSaasUserService} from './saasEntity.service';
29
+ import {ContentfulService} from './contentful.service';
29
30
 
30
31
  export type AmpSdkOptions = AmpRestClientOptions;
31
32
 
@@ -42,6 +43,7 @@ export class AmpSdkServices {
42
43
  readonly agents: AmpEntityService<PlatformAgentUpsertDto, PlatformAgentDto>;
43
44
  readonly asset: AmpSdkAssetService;
44
45
  readonly connectors: AmpEntityService<PlatformConnectorUpsertDto, PlatformConnectorDto>;
46
+ readonly contentful: ContentfulService;
45
47
  readonly enums: EnumService;
46
48
  readonly findings: AmpSaaSEntityService<PlatformFindingUpsertDto, PlatformFindingDto>;
47
49
  readonly jobExecutions: AmpEntityService<PlatformJobExecutionStateUpsertDto, PlatformJobExecutionStateDto>;
@@ -62,6 +64,7 @@ export class AmpSdkServices {
62
64
  this.agents = new AmpEntityServiceImpl<PlatformAgentUpsertDto, PlatformAgentDto>(rest, KIND.AGENTS, TARGET_API_PLATFORM);
63
65
  this.asset = new AmpSdkAssetService(rest, TARGET_API_PLATFORM);
64
66
  this.connectors = new AmpEntityServiceImpl<PlatformConnectorUpsertDto, PlatformConnectorDto>(rest, KIND.CONNECTORS, TARGET_API_PLATFORM);
67
+ this.contentful = new ContentfulService(rest, TARGET_API_PLATFORM);
65
68
  this.enums = new DefaultEnumService(rest, TARGET_API_PLATFORM);
66
69
  this.findings = new AmpSaaSEntityServiceImpl<PlatformFindingUpsertDto, PlatformFindingDto>(rest, KIND.FINDINGS, TARGET_API_PLATFORM);
67
70
  this.jobExecutions = new AmpEntityServiceImpl<PlatformJobExecutionStateUpsertDto, PlatformJobExecutionStateDto>(rest, KIND.JOB_EXECUTIONS, TARGET_API_PLATFORM);
@@ -0,0 +1,46 @@
1
+ import {TargetApi} from './constants';
2
+ import {RestClient} from './rest';
3
+ import type {Entry, EntrySkeletonType, EntryFieldTypes, EntryCollection} from 'contentful/dist/types';
4
+ import * as contentful from 'contentful';
5
+
6
+ export type MessageTemplate = EntrySkeletonType & {
7
+ contentTypeId: 'messageTemplate';
8
+ fields: {
9
+ id: EntryFieldTypes.Text;
10
+ body: EntryFieldTypes.Text;
11
+ subject: EntryFieldTypes.Text;
12
+ callToActions: EntryFieldTypes.Text;
13
+ };
14
+ };
15
+
16
+ export class ContentfulService {
17
+ protected readonly rest: RestClient;
18
+ protected readonly targetApi: TargetApi;
19
+ protected readonly contentfulClient;
20
+ constructor(rest: RestClient, targetApi: TargetApi = 'api') {
21
+ this.rest = rest;
22
+ this.targetApi = targetApi;
23
+ this.contentfulClient = contentful.createClient({
24
+ space: process.env.CONTENTFUL_SPACE_ID || '',
25
+ accessToken: process.env.CONTENTFUL_ACCESS_TOKEN || '',
26
+ });
27
+ }
28
+
29
+ getMessageTemplates = async (): Promise<EntryCollection<MessageTemplate>> => {
30
+ const messageTemplates = await this.getContentfulEntries<MessageTemplate>('messageTemplate', 0);
31
+ return messageTemplates;
32
+ };
33
+
34
+ getContentfulEntries = async <T extends EntrySkeletonType>(contentType: string, include?: number): Promise<EntryCollection<T>> => {
35
+ const entries = await this.contentfulClient.getEntries<T>({
36
+ content_type: contentType,
37
+ ...(include ? {include} : {}),
38
+ });
39
+ return entries;
40
+ };
41
+
42
+ getContentfulEntry = async <T extends EntrySkeletonType>(entryId: string): Promise<Entry<T>> => {
43
+ const entry = await this.contentfulClient.getEntry<T>(entryId);
44
+ return entry;
45
+ };
46
+ }
@@ -13,3 +13,4 @@ export * from './utils';
13
13
  export * from './connectors.service';
14
14
  export * from './notification.service';
15
15
  export * from './reports.service';
16
+ export * from './contentful.service';