@ampsec/platform-client 75.9.0 → 76.1.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.
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.FindingsService = void 0;
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
- const dto_1 = require("../dto");
9
8
  const constants_1 = require("./constants");
10
9
  const entity_service_1 = require("./entity.service");
11
10
  class FindingsService extends entity_service_1.AmpEntityServiceImpl {
@@ -36,54 +35,6 @@ class FindingsService extends entity_service_1.AmpEntityServiceImpl {
36
35
  params: finding,
37
36
  });
38
37
  }
39
- /**
40
- * Returns a page of FindingBucketSummaryDto scoped to a tenant. The page will contain 1
41
- * result for each user + bucket combination. The result will be the MAX(bucketScore) and
42
- * MIN(createdAt). The findings are also joined with flowStates to pull any running flows.
43
- *
44
- * @param tid tenant id
45
- * @param offset Optional offset for pagination. Default 0
46
- * @param limit Optional limit for pagination. Default 50
47
- * @returns Page of FindingBucketSummaryDto scoped to a tenant.
48
- */
49
- async getFindingBuckets(tid, offset = 0, limit = 50, keepOpenThresholdMs) {
50
- const url = `/${this.targetApi}/v1/${this.kind}/_byUserBuckets`;
51
- const res = await this.rest.call({
52
- url,
53
- method: 'GET',
54
- params: {
55
- tid,
56
- limit,
57
- offset,
58
- keepOpenThresholdMs,
59
- },
60
- });
61
- return (0, dto_1.toTypedPage)(dto_1._FindingBucketSummaryDto, res.data);
62
- }
63
- /**
64
- * Returns a page of pending engagement findings scoped to a tenant.
65
- * The page will contain findings that are
66
- * - pending to be engaged i.e no flow state exists for such findings.
67
- * - are not consolidated i.e should not be blocked by consolidation
68
- * - 'OPEN' status
69
- *
70
- * @param tid tenant id
71
- * @param offset Optional offset for pagination. Default 0
72
- * @param limit Optional limit for pagination. Default 50
73
- * @returns Page of FindingDto scoped to a tenant.
74
- */
75
- async getPendingEngagements(tid, offset = 0, limit = 50) {
76
- const url = `/${this.targetApi}/v1/${this.kind}/_pendingEngagements`;
77
- return this.getPage({
78
- url,
79
- method: 'GET',
80
- params: {
81
- tid,
82
- limit,
83
- offset,
84
- },
85
- });
86
- }
87
38
  }
88
39
  exports.FindingsService = FindingsService;
89
40
  //# 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;AACvB,gCAAqK;AAErK,2CAA+D;AAC/D,qDAAsD;AAOtD,MAAa,eAAgB,SAAQ,qCAAkE;IACrG,YAAY,IAAgB,EAAE,YAAuB,KAAK;QACxD,KAAK,CAAC,IAAI,EAAE,gBAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACxC,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;IAED,eAAe,CAAC,OAAmB;QACjC,MAAM,GAAG,GAAG,IAAI,6BAAiB,OAAO,IAAI,CAAC,IAAI,eAAe,CAAC;QACjE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YACpB,GAAG;YACH,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,OAAO;SAChB,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,iBAAiB,CAAC,GAAW,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,mBAA2B;QACtF,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,SAAS,OAAO,IAAI,CAAC,IAAI,iBAAiB,CAAC;QAChE,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YAC/B,GAAG;YACH,MAAM,EAAE,KAAK;YACb,MAAM,EAAE;gBACN,GAAG;gBACH,KAAK;gBACL,MAAM;gBACN,mBAAmB;aACpB;SACF,CAAC,CAAC;QACH,OAAO,IAAA,iBAAW,EAAC,8BAAwB,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,qBAAqB,CAAC,GAAW,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE;QAC7D,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,SAAS,OAAO,IAAI,CAAC,IAAI,sBAAsB,CAAC;QACrE,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,GAAG;YACH,MAAM,EAAE,KAAK;YACb,MAAM,EAAE;gBACN,GAAG;gBACH,KAAK;gBACL,MAAM;aACP;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAjFD,0CAiFC"}
1
+ {"version":3,"file":"findings.service.js","sourceRoot":"","sources":["../../../src/services/findings.service.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAGvB,2CAA+D;AAC/D,qDAAsD;AAOtD,MAAa,eAAgB,SAAQ,qCAAkE;IACrG,YAAY,IAAgB,EAAE,YAAuB,KAAK;QACxD,KAAK,CAAC,IAAI,EAAE,gBAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACxC,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;IAED,eAAe,CAAC,OAAmB;QACjC,MAAM,GAAG,GAAG,IAAI,6BAAiB,OAAO,IAAI,CAAC,IAAI,eAAe,CAAC;QACjE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YACpB,GAAG;YACH,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,OAAO;SAChB,CAAC,CAAC;IACL,CAAC;CACF;AA/BD,0CA+BC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampsec/platform-client",
3
- "version": "75.9.0",
3
+ "version": "76.1.0",
4
4
  "description": "",
5
5
  "main": "build/src/index.js",
6
6
  "runkitExampleFilename": "example/main.js",
@@ -2,7 +2,9 @@ import {z} from 'zod';
2
2
  import {_BaseDto, _BaseUpsertDto} from './base.dto';
3
3
  import {_PaginationFilter, _SortFilter} from '../FilterCriteria';
4
4
  import {FindingStatus} from './enums';
5
- import {_FindingBucketDto} from './findings.dto';
5
+
6
+ export const EMAIL_CID = 'E00000000000';
7
+ export const CUSTOM_FINDINGS_CID = 'C00000000000';
6
8
 
7
9
  export enum FlowSpecStatusKind {
8
10
  ACTIVE = 'ACTIVE',
@@ -144,6 +146,7 @@ export type FlowInterval = z.infer<typeof _FlowInterval>;
144
146
  const _FlowActionDetails = z.object({
145
147
  actionId: z.string().nullable(),
146
148
  findingStatus: z.nativeEnum(FindingStatus).optional().nullable(),
149
+ responseMessage: z.string().optional(),
147
150
  });
148
151
 
149
152
  export const _FlowActions = z.object({
@@ -182,6 +185,12 @@ export const _FlowRewardsConfig = z.object({
182
185
  });
183
186
  export type FlowRewardsConfig = z.infer<typeof _FlowRewardsConfig>;
184
187
 
188
+ export const _EngagementEscalationConfig = z.object({
189
+ interval: _FlowInterval,
190
+ engagementChannelConnectorIds: z.array(z.string()),
191
+ });
192
+ export type EngagementEscalationConfig = z.infer<typeof _EngagementEscalationConfig>;
193
+
185
194
  export const _FlowSpecDto = _BaseDto.merge(
186
195
  z.object({
187
196
  id: z.string(),
@@ -199,7 +208,7 @@ export const _FlowSpecDto = _BaseDto.merge(
199
208
  triage: z.object({message: z.string(), yesAction: _FlowActionDetails, noAction: _FlowActionDetails}).optional(),
200
209
  reminderInterval: _FlowInterval.optional(),
201
210
  actions: _FlowActions.optional(),
202
- emailEscalation: _FlowInterval.optional(),
211
+ escalation: _EngagementEscalationConfig.optional(),
203
212
  rewards: z.array(_FlowRewardsConfig).optional(),
204
213
  customMessage: z.object({template: z.string().optional(), append: z.boolean().optional()}).optional(),
205
214
  additionalContext: z.object({data: z.string().optional()}).optional(),
@@ -1,5 +1,5 @@
1
1
  import _ from 'lodash';
2
- import {FindingBucketSummaryDto, FindingDto, FindingStatus, Page, PlatformFindingDto, PlatformFindingUpsertDto, _FindingBucketSummaryDto, toTypedPage} from '../dto';
2
+ import {FindingDto, FindingStatus, Page, PlatformFindingDto, PlatformFindingUpsertDto} from '../dto';
3
3
  import {RestClient, RestResponse} from './rest';
4
4
  import {KIND, TARGET_API_ENGAGE, TargetApi} from './constants';
5
5
  import {AmpEntityServiceImpl} from './entity.service';
@@ -40,54 +40,4 @@ export class FindingsService extends AmpEntityServiceImpl<PlatformFindingUpsertD
40
40
  params: finding,
41
41
  });
42
42
  }
43
-
44
- /**
45
- * Returns a page of FindingBucketSummaryDto scoped to a tenant. The page will contain 1
46
- * result for each user + bucket combination. The result will be the MAX(bucketScore) and
47
- * MIN(createdAt). The findings are also joined with flowStates to pull any running flows.
48
- *
49
- * @param tid tenant id
50
- * @param offset Optional offset for pagination. Default 0
51
- * @param limit Optional limit for pagination. Default 50
52
- * @returns Page of FindingBucketSummaryDto scoped to a tenant.
53
- */
54
- async getFindingBuckets(tid: string, offset = 0, limit = 50, keepOpenThresholdMs: number): Promise<Page<FindingBucketSummaryDto>> {
55
- const url = `/${this.targetApi}/v1/${this.kind}/_byUserBuckets`;
56
- const res = await this.rest.call({
57
- url,
58
- method: 'GET',
59
- params: {
60
- tid,
61
- limit,
62
- offset,
63
- keepOpenThresholdMs,
64
- },
65
- });
66
- return toTypedPage(_FindingBucketSummaryDto, res.data);
67
- }
68
-
69
- /**
70
- * Returns a page of pending engagement findings scoped to a tenant.
71
- * The page will contain findings that are
72
- * - pending to be engaged i.e no flow state exists for such findings.
73
- * - are not consolidated i.e should not be blocked by consolidation
74
- * - 'OPEN' status
75
- *
76
- * @param tid tenant id
77
- * @param offset Optional offset for pagination. Default 0
78
- * @param limit Optional limit for pagination. Default 50
79
- * @returns Page of FindingDto scoped to a tenant.
80
- */
81
- async getPendingEngagements(tid: string, offset = 0, limit = 50): Promise<Page<PlatformFindingDto>> {
82
- const url = `/${this.targetApi}/v1/${this.kind}/_pendingEngagements`;
83
- return this.getPage({
84
- url,
85
- method: 'GET',
86
- params: {
87
- tid,
88
- limit,
89
- offset,
90
- },
91
- });
92
- }
93
43
  }