@ampsec/platform-client 47.1.1 → 47.3.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.
@@ -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,5 @@
1
+ export declare enum SupportedMessageChannelKind {
2
+ SLACK = "SLACK",
3
+ UNSUPPORTED = "UNSUPPORTED"
4
+ }
5
+ export declare const getSupportedMessageChannelKindFrom: (description: string | undefined) => SupportedMessageChannelKind;
@@ -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"}
@@ -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 SlackNotificationAddress = NotificationAddress & {
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 = {
@@ -8,4 +8,5 @@ export interface FindingPatchDto {
8
8
  export declare class FindingsService extends AmpDataServiceImpl<FindingDto> {
9
9
  constructor(rest: RestClient);
10
10
  patch(id: string, values: FindingPatchDto | FindingPatchDto[]): Promise<Page<FindingDto>>;
11
+ patchAll(values: FindingPatchDto[]): Promise<Page<FindingDto>>;
11
12
  }
@@ -19,6 +19,14 @@ class FindingsService extends data_service_1.AmpDataServiceImpl {
19
19
  data: values,
20
20
  });
21
21
  }
22
+ patchAll(values) {
23
+ const url = `/${this.targetApi}/v1/${this.kind}`;
24
+ return this.getPage({
25
+ url,
26
+ method: 'PATCH',
27
+ data: values,
28
+ });
29
+ }
22
30
  }
23
31
  exports.FindingsService = FindingsService;
24
32
  //# sourceMappingURL=findings.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"findings.service.js","sourceRoot":"","sources":["../../../src/services/findings.service.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAEvB,iDAAkD;AAElD,2CAAiC;AAOjC,MAAa,eAAgB,SAAQ,iCAA8B;IACjE,YAAY,IAAgB;QAC1B,KAAK,CAAC,IAAI,EAAE,gBAAI,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,EAAU,EAAE,MAA2C;QAC3D,MAAM,GAAG,GAAG,gBAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,OAAO,IAAI,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;QAClH,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,GAAG;YACH,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,MAAM;SACb,CAAC,CAAC;IACL,CAAC;CACF;AAbD,0CAaC"}
1
+ {"version":3,"file":"findings.service.js","sourceRoot":"","sources":["../../../src/services/findings.service.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAEvB,iDAAkD;AAElD,2CAAiC;AAOjC,MAAa,eAAgB,SAAQ,iCAA8B;IACjE,YAAY,IAAgB;QAC1B,KAAK,CAAC,IAAI,EAAE,gBAAI,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,EAAU,EAAE,MAA2C;QAC3D,MAAM,GAAG,GAAG,gBAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,OAAO,IAAI,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;QAClH,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,GAAG;YACH,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,MAAM;SACb,CAAC,CAAC;IACL,CAAC;IAED,QAAQ,CAAC,MAAyB;QAChC,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,SAAS,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,GAAG;YACH,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,MAAM;SACb,CAAC,CAAC;IACL,CAAC;CACF;AAtBD,0CAsBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampsec/platform-client",
3
- "version": "47.1.1",
3
+ "version": "47.3.0",
4
4
  "description": "",
5
5
  "main": "build/src/index.js",
6
6
  "runkitExampleFilename": "example/main.js",
@@ -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';
@@ -0,0 +1,17 @@
1
+ /* eslint-disable no-unused-vars */
2
+ export enum SupportedMessageChannelKind {
3
+ SLACK = 'SLACK',
4
+ UNSUPPORTED = 'UNSUPPORTED',
5
+ }
6
+
7
+ export const getSupportedMessageChannelKindFrom = (description: string | undefined): SupportedMessageChannelKind => {
8
+ if (description) {
9
+ for (const kind in SupportedMessageChannelKind) {
10
+ if (description.toUpperCase().includes(kind)) {
11
+ return SupportedMessageChannelKind[kind as keyof typeof SupportedMessageChannelKind] as SupportedMessageChannelKind;
12
+ }
13
+ }
14
+ }
15
+
16
+ return SupportedMessageChannelKind.UNSUPPORTED;
17
+ };
@@ -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
 
6
7
  export type NotificationAddress = {
7
8
  /** Connector ID for the notification channel */
@@ -14,7 +15,12 @@ export type NotificationAddress = {
14
15
  webhooks?: string[];
15
16
  };
16
17
 
17
- export type SlackNotificationAddress = NotificationAddress & {
18
+ export type MessageNotificationAddress = NotificationAddress & {
19
+ /** Channel kind for messaging applications */
20
+ kind: SupportedMessageChannelKind;
21
+ };
22
+
23
+ export type SlackNotificationAddress = MessageNotificationAddress & {
18
24
  teamId: string;
19
25
  };
20
26
 
@@ -22,4 +22,13 @@ export class FindingsService extends AmpDataServiceImpl<FindingDto> {
22
22
  data: values,
23
23
  });
24
24
  }
25
+
26
+ patchAll(values: FindingPatchDto[]): Promise<Page<FindingDto>> {
27
+ const url = `/${this.targetApi}/v1/${this.kind}`;
28
+ return this.getPage({
29
+ url,
30
+ method: 'PATCH',
31
+ data: values,
32
+ });
33
+ }
25
34
  }