@ampsec/platform-client 84.39.1 → 84.41.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.
@@ -38,3 +38,120 @@ export declare const _FindingMetricsSeriesDto: z.ZodObject<{
38
38
  averageDaysToHeal?: number | undefined;
39
39
  }>;
40
40
  export type FindingMetricsSeriesDto = z.infer<typeof _FindingMetricsSeriesDto>;
41
+ /**
42
+ * Department-level finding metrics for the analytics dashboard.
43
+ * count = total findings; findingsClosed = completed; engaged = in progress; healed = closed after flow trigger.
44
+ */
45
+ export declare const _DepartmentMetricsDto: z.ZodObject<{
46
+ department: z.ZodString;
47
+ count: z.ZodNumber;
48
+ findingsClosed: z.ZodNumber;
49
+ engaged: z.ZodNumber;
50
+ healed: z.ZodNumber;
51
+ }, "strip", z.ZodTypeAny, {
52
+ department: string;
53
+ count: number;
54
+ findingsClosed: number;
55
+ engaged: number;
56
+ healed: number;
57
+ }, {
58
+ department: string;
59
+ count: number;
60
+ findingsClosed: number;
61
+ engaged: number;
62
+ healed: number;
63
+ }>;
64
+ export type DepartmentMetricsDto = z.infer<typeof _DepartmentMetricsDto>;
65
+ /** Single use case option for the analytics dashboard (FlowSpec-derived or category-based). */
66
+ export declare const _AnalyticsUseCaseOption: z.ZodObject<{
67
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
68
+ value: z.ZodString;
69
+ displayValue: z.ZodString;
70
+ group: z.ZodEnum<["flowSpec", "category"]>;
71
+ findingKinds: z.ZodOptional<z.ZodString>;
72
+ }, "strip", z.ZodTypeAny, {
73
+ group: "category" | "flowSpec";
74
+ value: string;
75
+ id: string | number;
76
+ displayValue: string;
77
+ findingKinds?: string | undefined;
78
+ }, {
79
+ group: "category" | "flowSpec";
80
+ value: string;
81
+ id: string | number;
82
+ displayValue: string;
83
+ findingKinds?: string | undefined;
84
+ }>;
85
+ export type AnalyticsUseCaseOption = z.infer<typeof _AnalyticsUseCaseOption>;
86
+ /** Response from GET /analytics/use-cases. FlowSpec use cases first, then category use cases. */
87
+ export declare const _AnalyticsUseCasesResponse: z.ZodObject<{
88
+ flowSpecUseCases: z.ZodArray<z.ZodObject<{
89
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
90
+ value: z.ZodString;
91
+ displayValue: z.ZodString;
92
+ group: z.ZodEnum<["flowSpec", "category"]>;
93
+ findingKinds: z.ZodOptional<z.ZodString>;
94
+ }, "strip", z.ZodTypeAny, {
95
+ group: "category" | "flowSpec";
96
+ value: string;
97
+ id: string | number;
98
+ displayValue: string;
99
+ findingKinds?: string | undefined;
100
+ }, {
101
+ group: "category" | "flowSpec";
102
+ value: string;
103
+ id: string | number;
104
+ displayValue: string;
105
+ findingKinds?: string | undefined;
106
+ }>, "many">;
107
+ categoryUseCases: z.ZodArray<z.ZodObject<{
108
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
109
+ value: z.ZodString;
110
+ displayValue: z.ZodString;
111
+ group: z.ZodEnum<["flowSpec", "category"]>;
112
+ findingKinds: z.ZodOptional<z.ZodString>;
113
+ }, "strip", z.ZodTypeAny, {
114
+ group: "category" | "flowSpec";
115
+ value: string;
116
+ id: string | number;
117
+ displayValue: string;
118
+ findingKinds?: string | undefined;
119
+ }, {
120
+ group: "category" | "flowSpec";
121
+ value: string;
122
+ id: string | number;
123
+ displayValue: string;
124
+ findingKinds?: string | undefined;
125
+ }>, "many">;
126
+ }, "strip", z.ZodTypeAny, {
127
+ flowSpecUseCases: {
128
+ group: "category" | "flowSpec";
129
+ value: string;
130
+ id: string | number;
131
+ displayValue: string;
132
+ findingKinds?: string | undefined;
133
+ }[];
134
+ categoryUseCases: {
135
+ group: "category" | "flowSpec";
136
+ value: string;
137
+ id: string | number;
138
+ displayValue: string;
139
+ findingKinds?: string | undefined;
140
+ }[];
141
+ }, {
142
+ flowSpecUseCases: {
143
+ group: "category" | "flowSpec";
144
+ value: string;
145
+ id: string | number;
146
+ displayValue: string;
147
+ findingKinds?: string | undefined;
148
+ }[];
149
+ categoryUseCases: {
150
+ group: "category" | "flowSpec";
151
+ value: string;
152
+ id: string | number;
153
+ displayValue: string;
154
+ findingKinds?: string | undefined;
155
+ }[];
156
+ }>;
157
+ export type AnalyticsUseCasesResponse = z.infer<typeof _AnalyticsUseCasesResponse>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._FindingMetricsSeriesDto = void 0;
3
+ exports._AnalyticsUseCasesResponse = exports._AnalyticsUseCaseOption = exports._DepartmentMetricsDto = exports._FindingMetricsSeriesDto = void 0;
4
4
  const zod_1 = require("zod");
5
5
  /**
6
6
  * One period of finding metrics from the analytics API.
@@ -18,4 +18,28 @@ exports._FindingMetricsSeriesDto = zod_1.z.object({
18
18
  healed: zod_1.z.number().optional(),
19
19
  averageDaysToHeal: zod_1.z.number().optional(),
20
20
  });
21
+ /**
22
+ * Department-level finding metrics for the analytics dashboard.
23
+ * count = total findings; findingsClosed = completed; engaged = in progress; healed = closed after flow trigger.
24
+ */
25
+ exports._DepartmentMetricsDto = zod_1.z.object({
26
+ department: zod_1.z.string(),
27
+ count: zod_1.z.number(),
28
+ findingsClosed: zod_1.z.number(),
29
+ engaged: zod_1.z.number(),
30
+ healed: zod_1.z.number(),
31
+ });
32
+ /** Single use case option for the analytics dashboard (FlowSpec-derived or category-based). */
33
+ exports._AnalyticsUseCaseOption = zod_1.z.object({
34
+ id: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]),
35
+ value: zod_1.z.string(),
36
+ displayValue: zod_1.z.string(),
37
+ group: zod_1.z.enum(['flowSpec', 'category']),
38
+ findingKinds: zod_1.z.string().optional(),
39
+ });
40
+ /** Response from GET /analytics/use-cases. FlowSpec use cases first, then category use cases. */
41
+ exports._AnalyticsUseCasesResponse = zod_1.z.object({
42
+ flowSpecUseCases: zod_1.z.array(exports._AnalyticsUseCaseOption),
43
+ categoryUseCases: zod_1.z.array(exports._AnalyticsUseCaseOption),
44
+ });
21
45
  //# sourceMappingURL=analytics.dto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.dto.js","sourceRoot":"","sources":["../../../src/dto/analytics.dto.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AAEtB;;;GAGG;AACU,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;IACtB,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE;IAC5B,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE;IAC5B,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE;IAC1B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE;IAC1B,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,iBAAiB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAC"}
1
+ {"version":3,"file":"analytics.dto.js","sourceRoot":"","sources":["../../../src/dto/analytics.dto.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AAEtB;;;GAGG;AACU,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;IACtB,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE;IAC5B,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE;IAC5B,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE;IAC1B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE;IAC1B,OAAO,EAAE,OAAC,CAAC,MAAM,EA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
+ };
43
46
  finding: {
44
47
  id: string;
45
48
  uid: string;
@@ -47,15 +50,15 @@ export declare const _EngagementMappingDto: z.ZodObject<{
47
50
  score: number;
48
51
  bucket: string;
49
52
  };
50
- flowSpec: {
51
- id: string;
52
- };
53
53
  engagementConfig?: {
54
54
  consolidation?: boolean | undefined;
55
55
  overrideGhostMode?: boolean | undefined;
56
56
  forceTrigger?: boolean | undefined;
57
57
  } | undefined;
58
58
  }, {
59
+ flowSpec: {
60
+ id: string;
61
+ };
59
62
  finding: {
60
63
  id: string;
61
64
  uid: string;
@@ -63,9 +66,6 @@ export declare const _EngagementMappingDto: z.ZodObject<{
63
66
  score: number;
64
67
  bucket: string;
65
68
  };
66
- flowSpec: {
67
- id: string;
68
- };
69
69
  engagementConfig?: {
70
70
  consolidation?: boolean | undefined;
71
71
  overrideGhostMode?: boolean | undefined;
@@ -25,6 +25,98 @@ export declare const _FindingBucketDto: z.ZodObject<{
25
25
  key: string;
26
26
  }>;
27
27
  export type FindingBucketDto = z.infer<typeof _FindingBucketDto>;
28
+ /**
29
+ * Zod schema for the finding-level keys (BaseDto + FindingUpsertDto).
30
+ * Used to derive template variable paths for Custom Content dynamic variables.
31
+ */
32
+ export declare const _FindingDtoSchema: z.ZodObject<z.objectUtil.extendShape<{
33
+ id: z.ZodString;
34
+ createdAt: z.ZodString;
35
+ updatedAt: z.ZodString;
36
+ deletedAt: z.ZodNullable<z.ZodString>;
37
+ }, {
38
+ discoveredAt: z.ZodOptional<z.ZodString>;
39
+ closedAt: z.ZodOptional<z.ZodString>;
40
+ category: z.ZodString;
41
+ kind: z.ZodString;
42
+ status: z.ZodString;
43
+ severity: z.ZodString;
44
+ outcome: z.ZodOptional<z.ZodString>;
45
+ numberOfEngagements: z.ZodNumber;
46
+ displayValue: z.ZodString;
47
+ description: z.ZodOptional<z.ZodString>;
48
+ cid: z.ZodString;
49
+ pid: z.ZodString;
50
+ aid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
51
+ uid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
+ scid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
+ fsid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
+ verificationCount: z.ZodOptional<z.ZodNumber>;
55
+ bucket: z.ZodOptional<z.ZodObject<{
56
+ /** Bucket key */
57
+ key: z.ZodString;
58
+ /** Severity of the bucket */
59
+ score: z.ZodNumber;
60
+ }, "strip", z.ZodTypeAny, {
61
+ score: number;
62
+ key: string;
63
+ }, {
64
+ score: number;
65
+ key: string;
66
+ }>>;
67
+ }>, "strip", z.ZodTypeAny, {
68
+ status: string;
69
+ id: string;
70
+ cid: string;
71
+ createdAt: string;
72
+ updatedAt: string;
73
+ deletedAt: string | null;
74
+ displayValue: string;
75
+ kind: string;
76
+ category: string;
77
+ severity: string;
78
+ numberOfEngagements: number;
79
+ pid: string;
80
+ description?: string | undefined;
81
+ uid?: string | null | undefined;
82
+ aid?: string | null | undefined;
83
+ discoveredAt?: string | undefined;
84
+ closedAt?: string | undefined;
85
+ outcome?: string | undefined;
86
+ scid?: string | null | undefined;
87
+ fsid?: string | null | undefined;
88
+ verificationCount?: number | undefined;
89
+ bucket?: {
90
+ score: number;
91
+ key: string;
92
+ } | undefined;
93
+ }, {
94
+ status: string;
95
+ id: string;
96
+ cid: string;
97
+ createdAt: string;
98
+ updatedAt: string;
99
+ deletedAt: string | null;
100
+ displayValue: string;
101
+ kind: string;
102
+ category: string;
103
+ severity: string;
104
+ numberOfEngagements: number;
105
+ pid: string;
106
+ description?: string | undefined;
107
+ uid?: string | null | undefined;
108
+ aid?: string | null | undefined;
109
+ discoveredAt?: string | undefined;
110
+ closedAt?: string | undefined;
111
+ outcome?: string | undefined;
112
+ scid?: string | null | undefined;
113
+ fsid?: string | null | undefined;
114
+ verificationCount?: number | undefined;
115
+ bucket?: {
116
+ score: number;
117
+ key: string;
118
+ } | undefined;
119
+ }>;
28
120
  export type FindingUpsertDto = BaseUpsertDto & {
29
121
  /** Date the finding was discoverd by the integration */
30
122
  discoveredAt?: string;
@@ -324,6 +416,7 @@ export declare const _FindingSpecDto: z.ZodObject<z.objectUtil.extendShape<{
324
416
  description?: unknown;
325
417
  cid?: string | null | undefined;
326
418
  score?: number | undefined;
419
+ outcome?: FindingOutcome | undefined;
327
420
  insights?: {
328
421
  meta?: {
329
422
  displayValue: string;
@@ -345,7 +438,6 @@ export declare const _FindingSpecDto: z.ZodObject<z.objectUtil.extendShape<{
345
438
  } | undefined;
346
439
  } | undefined;
347
440
  expireAfterDays?: number | null | undefined;
348
- outcome?: FindingOutcome | undefined;
349
441
  }, {
350
442
  name: string;
351
443
  id: string;
@@ -359,6 +451,7 @@ export declare const _FindingSpecDto: z.ZodObject<z.objectUtil.extendShape<{
359
451
  description?: unknown;
360
452
  cid?: string | null | undefined;
361
453
  score?: number | undefined;
454
+ outcome?: FindingOutcome | undefined;
362
455
  insights?: {
363
456
  meta?: {
364
457
  displayValue: string;
@@ -380,7 +473,6 @@ export declare const _FindingSpecDto: z.ZodObject<z.objectUtil.extendShape<{
380
473
  } | undefined;
381
474
  } | undefined;
382
475
  expireAfterDays?: number | null | undefined;
383
- outcome?: FindingOutcome | undefined;
384
476
  }>;
385
477
  export type FindingSpecDto = z.infer<typeof _FindingSpecDto>;
386
478
  export declare const _FindingSpecUpsertDto: z.ZodObject<{
@@ -396,6 +488,7 @@ export declare const _FindingSpecUpsertDto: z.ZodObject<{
396
488
  eventType: z.ZodString;
397
489
  score: z.ZodOptional<z.ZodNumber>;
398
490
  severity: z.ZodNativeEnum<typeof FindingSeverity>;
491
+ outcome: z.ZodOptional<z.ZodNativeEnum<typeof FindingOutcome>>;
399
492
  insights: z.ZodOptional<z.ZodObject<{
400
493
  meta: z.ZodOptional<z.ZodObject<{
401
494
  kind: z.ZodNativeEnum<typeof FindingKind>;
@@ -495,7 +588,6 @@ export declare const _FindingSpecUpsertDto: z.ZodObject<{
495
588
  } | undefined;
496
589
  }>>;
497
590
  expireAfterDays: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
498
- outcome: z.ZodOptional<z.ZodNativeEnum<typeof FindingOutcome>>;
499
591
  }, "strip", z.ZodTypeAny, {
500
592
  name: string;
501
593
  displayValue: string;
@@ -509,6 +601,7 @@ export declare const _FindingSpecUpsertDto: z.ZodObject<{
509
601
  updatedAt?: string | undefined;
510
602
  deletedAt?: string | null | undefined;
511
603
  score?: number | undefined;
604
+ outcome?: FindingOutcome | undefined;
512
605
  insights?: {
513
606
  meta?: {
514
607
  displayValue: string;
@@ -530,7 +623,6 @@ export declare const _FindingSpecUpsertDto: z.ZodObject<{
530
623
  } | undefined;
531
624
  } | undefined;
532
625
  expireAfterDays?: number | null | undefined;
533
- outcome?: FindingOutcome | undefined;
534
626
  }, {
535
627
  name: string;
536
628
  displayValue: string;
@@ -544,6 +636,7 @@ export declare const _FindingSpecUpsertDto: z.ZodObject<{
544
636
  updatedAt?: string | undefined;
545
637
  deletedAt?: string | null | undefined;
546
638
  score?: number | undefined;
639
+ outcome?: FindingOutcome | undefined;
547
640
  insights?: {
548
641
  meta?: {
549
642
  displayValue: string;
@@ -565,7 +658,6 @@ export declare const _FindingSpecUpsertDto: z.ZodObject<{
565
658
  } | undefined;
566
659
  } | undefined;
567
660
  expireAfterDays?: number | null | undefined;
568
- outcome?: FindingOutcome | undefined;
569
661
  }>;
570
662
  export type FindingSpecUpsertDto = z.infer<typeof _FindingSpecUpsertDto>;
571
663
  export declare const _FindingSummaryDto: z.ZodObject<{
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._CustomFindingPayload = exports._FindingSummaryDto = exports._FindingSpecUpsertDto = exports._FindingSpecDto = exports._FindingSpecInsights = exports._FindingBucketSummaryDto = exports._FindingBucketDto = void 0;
3
+ exports._CustomFindingPayload = exports._FindingSummaryDto = exports._FindingSpecUpsertDto = exports._FindingSpecDto = exports._FindingSpecInsights = exports._FindingBucketSummaryDto = exports._FindingDtoSchema = exports._FindingBucketDto = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const base_dto_1 = require("./base.dto");
6
6
  const enums_1 = require("./enums");
@@ -11,6 +11,31 @@ exports._FindingBucketDto = zod_1.z.object({
11
11
  /** Severity of the bucket */
12
12
  score: zod_1.z.number(),
13
13
  });
14
+ /**
15
+ * Zod schema for the finding-level keys (BaseDto + FindingUpsertDto).
16
+ * Used to derive template variable paths for Custom Content dynamic variables.
17
+ */
18
+ // TODO: Use this schema to infer an exported type for the finding entity.
19
+ exports._FindingDtoSchema = base_dto_1._BaseDto.merge(zod_1.z.object({
20
+ discoveredAt: zod_1.z.string().optional(),
21
+ closedAt: zod_1.z.string().optional(),
22
+ category: zod_1.z.string(),
23
+ kind: zod_1.z.string(),
24
+ status: zod_1.z.string(),
25
+ severity: zod_1.z.string(),
26
+ outcome: zod_1.z.string().optional(),
27
+ numberOfEngagements: zod_1.z.number(),
28
+ displayValue: zod_1.z.string(),
29
+ description: zod_1.z.string().optional(),
30
+ cid: zod_1.z.string(),
31
+ pid: zod_1.z.string(),
32
+ aid: zod_1.z.string().nullable().optional(),
33
+ uid: zod_1.z.string().nullable().optional(),
34
+ scid: zod_1.z.string().nullable().optional(),
35
+ fsid: zod_1.z.string().nullable().optional(),
36
+ verificationCount: zod_1.z.number().optional(),
37
+ bucket: exports._FindingBucketDto.optional(),
38
+ }));
14
39
  exports._FindingBucketSummaryDto = zod_1.z.object({
15
40
  id: zod_1.z.string(),
16
41
  uid: zod_1.z.string(),
@@ -1 +1 @@
1
- {"version":3,"file":"findings.dto.js","sourceRoot":"","sources":["../../../src/dto/findings.dto.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AAEtB,yCAA6E;AAC7E,mCAAkF;AAClF,mCAAuE;AAY1D,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,iBAAiB;IACjB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,6BAA6B;IAC7B,KAAK,EAAE,OAAC,CAAC,MA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C,CAAC,MAAM,CAAC;IAC5C,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB;;OAEG;IACH,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B;;OAEG;IACH,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B;;OAEG;IACH,MAAM,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC7C,wCAAwC;IACxC,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC/B;;;OAGG;IACH,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC;;OAEG;IACH,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,qBAAqB,EAAE,mBAAmB,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC/G,CAAC,CAAC"}
@@ -89,8 +89,8 @@ export declare const _FindingsInsightsDto: z.ZodObject<{
89
89
  description: string;
90
90
  kind: FindingKind;
91
91
  title: string;
92
- severity: FindingSeverity;
93
92
  category: Category;
93
+ severity: FindingSeverity;
94
94
  number_of_engagements: number;
95
95
  active_engagements: {
96
96
  status: "SUCCESS" | "RUNNING" | "ERROR" | "CANCELLED" | "EXPIRED";
@@ -139,8 +139,8 @@ export declare const _FindingsInsightsDto: z.ZodObject<{
139
139
  description: string;
140
140
  kind: FindingKind;
141
141
  title: string;
142
- severity: FindingSeverity;
143
142
  category: Category;
143
+ severity: FindingSeverity;
144
144
  number_of_engagements: number;
145
145
  active_engagements: {
146
146
  status: "SUCCESS" | "RUNNING" | "ERROR" | "CANCELLED" | "EXPIRED";
@@ -43,6 +43,9 @@ export declare const _PlatformEngagementMappingDto: z.ZodObject<z.objectUtil.ext
43
43
  tid: z.ZodString;
44
44
  }>, "strip", z.ZodTypeAny, {
45
45
  tid: string;
46
+ flowSpec: {
47
+ id: string;
48
+ };
46
49
  finding: {
47
50
  id: string;
48
51
  uid: string;
@@ -50,9 +53,6 @@ export declare const _PlatformEngagementMappingDto: z.ZodObject<z.objectUtil.ext
50
53
  score: number;
51
54
  bucket: string;
52
55
  };
53
- flowSpec: {
54
- id: string;
55
- };
56
56
  engagementConfig?: {
57
57
  consolidation?: boolean | undefined;
58
58
  overrideGhostMode?: boolean | undefined;
@@ -60,6 +60,9 @@ export declare const _PlatformEngagementMappingDto: z.ZodObject<z.objectUtil.ext
60
60
  } | undefined;
61
61
  }, {
62
62
  tid: string;
63
+ flowSpec: {
64
+ id: string;
65
+ };
63
66
  finding: {
64
67
  id: string;
65
68
  uid: string;
@@ -67,9 +70,6 @@ export declare const _PlatformEngagementMappingDto: z.ZodObject<z.objectUtil.ext
67
70
  score: number;
68
71
  bucket: string;
69
72
  };
70
- flowSpec: {
71
- id: string;
72
- };
73
73
  engagementConfig?: {
74
74
  consolidation?: boolean | undefined;
75
75
  overrideGhostMode?: boolean | undefined;
@@ -133,6 +133,7 @@ export declare const _PlatformFindingSpecDto: z.ZodObject<z.objectUtil.extendSha
133
133
  description?: unknown;
134
134
  cid?: string | null | undefined;
135
135
  score?: number | undefined;
136
+ outcome?: import("..").FindingOutcome | undefined;
136
137
  insights?: {
137
138
  meta?: {
138
139
  displayValue: string;
@@ -154,7 +155,6 @@ export declare const _PlatformFindingSpecDto: z.ZodObject<z.objectUtil.extendSha
154
155
  } | undefined;
155
156
  } | undefined;
156
157
  expireAfterDays?: number | null | undefined;
157
- outcome?: import("..").FindingOutcome | undefined;
158
158
  }, {
159
159
  name: string;
160
160
  id: string;
@@ -169,6 +169,7 @@ export declare const _PlatformFindingSpecDto: z.ZodObject<z.objectUtil.extendSha
169
169
  description?: unknown;
170
170
  cid?: string | null | undefined;
171
171
  score?: number | undefined;
172
+ outcome?: import("..").FindingOutcome | undefined;
172
173
  insights?: {
173
174
  meta?: {
174
175
  displayValue: string;
@@ -190,7 +191,6 @@ export declare const _PlatformFindingSpecDto: z.ZodObject<z.objectUtil.extendSha
190
191
  } | undefined;
191
192
  } | undefined;
192
193
  expireAfterDays?: number | null | undefined;
193
- outcome?: import("..").FindingOutcome | undefined;
194
194
  }>;
195
195
  export type PlatformFindingSpecDto = z.infer<typeof _PlatformFindingSpecDto>;
196
196
  export declare const _PlatformFindingSpecUpsertDto: z.ZodObject<z.objectUtil.extendShape<{
@@ -206,6 +206,7 @@ export declare const _PlatformFindingSpecUpsertDto: z.ZodObject<z.objectUtil.ext
206
206
  eventType: z.ZodString;
207
207
  score: z.ZodOptional<z.ZodNumber>;
208
208
  severity: z.ZodNativeEnum<typeof import("..").FindingSeverity>;
209
+ outcome: z.ZodOptional<z.ZodNativeEnum<typeof import("..").FindingOutcome>>;
209
210
  insights: z.ZodOptional<z.ZodObject<{
210
211
  meta: z.ZodOptional<z.ZodObject<{
211
212
  kind: z.ZodNativeEnum<typeof import("..").FindingKind>;
@@ -305,7 +306,6 @@ export declare const _PlatformFindingSpecUpsertDto: z.ZodObject<z.objectUtil.ext
305
306
  } | undefined;
306
307
  }>>;
307
308
  expireAfterDays: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
308
- outcome: z.ZodOptional<z.ZodNativeEnum<typeof import("..").FindingOutcome>>;
309
309
  }, {
310
310
  tid: z.ZodString;
311
311
  }>, "strip", z.ZodTypeAny, {
@@ -322,6 +322,7 @@ export declare const _PlatformFindingSpecUpsertDto: z.ZodObject<z.objectUtil.ext
322
322
  updatedAt?: string | undefined;
323
323
  deletedAt?: string | null | undefined;
324
324
  score?: number | undefined;
325
+ outcome?: import("..").FindingOutcome | undefined;
325
326
  insights?: {
326
327
  meta?: {
327
328
  displayValue: string;
@@ -343,7 +344,6 @@ export declare const _PlatformFindingSpecUpsertDto: z.ZodObject<z.objectUtil.ext
343
344
  } | undefined;
344
345
  } | undefined;
345
346
  expireAfterDays?: number | null | undefined;
346
- outcome?: import("..").FindingOutcome | undefined;
347
347
  }, {
348
348
  name: string;
349
349
  tid: string;
@@ -358,6 +358,7 @@ export declare const _PlatformFindingSpecUpsertDto: z.ZodObject<z.objectUtil.ext
358
358
  updatedAt?: string | undefined;
359
359
  deletedAt?: string | null | undefined;
360
360
  score?: number | undefined;
361
+ outcome?: import("..").FindingOutcome | undefined;
361
362
  insights?: {
362
363
  meta?: {
363
364
  displayValue: string;
@@ -379,6 +380,5 @@ export declare const _PlatformFindingSpecUpsertDto: z.ZodObject<z.objectUtil.ext
379
380
  } | undefined;
380
381
  } | undefined;
381
382
  expireAfterDays?: number | null | undefined;
382
- outcome?: import("..").FindingOutcome | undefined;
383
383
  }>;
384
384
  export type PlatformFindingSpecUpsertDto = z.infer<typeof _PlatformFindingSpecUpsertDto>;
@@ -20,8 +20,8 @@ export declare const _PlatformWebhookProviderDto: import("zod").ZodObject<import
20
20
  createdAt: string;
21
21
  updatedAt: string;
22
22
  deletedAt: string | null;
23
- enabled: boolean;
24
23
  pid: string;
24
+ enabled: boolean;
25
25
  supportedEvents: string[];
26
26
  description?: string | null | undefined;
27
27
  timeout?: number | null | undefined;
@@ -33,8 +33,8 @@ export declare const _PlatformWebhookProviderDto: import("zod").ZodObject<import
33
33
  createdAt: string;
34
34
  updatedAt: string;
35
35
  deletedAt: string | null;
36
- enabled: boolean;
37
36
  pid: string;
37
+ enabled: boolean;
38
38
  supportedEvents: string[];
39
39
  description?: string | null | undefined;
40
40
  timeout?: number | null | undefined;
@@ -48,16 +48,16 @@ export declare const _PlatformWebhookProviderUpsertDto: import("zod").ZodObject<
48
48
  createdAt: import("zod").ZodOptional<import("zod").ZodString>;
49
49
  updatedAt: import("zod").ZodOptional<import("zod").ZodString>;
50
50
  deletedAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
51
+ pid: import("zod").ZodString;
51
52
  timeout: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
52
53
  enabled: import("zod").ZodBoolean;
53
54
  displayName: import("zod").ZodOptional<import("zod").ZodString>;
54
- pid: import("zod").ZodString;
55
55
  supportedEvents: import("zod").ZodArray<import("zod").ZodString, "many">;
56
56
  defaultSecret: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
57
57
  retryAttempts: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
58
58
  }, "strip", import("zod").ZodTypeAny, {
59
- enabled: boolean;
60
59
  pid: string;
60
+ enabled: boolean;
61
61
  supportedEvents: string[];
62
62
  description?: string | null | undefined;
63
63
  id?: string | undefined;
@@ -69,8 +69,8 @@ export declare const _PlatformWebhookProviderUpsertDto: import("zod").ZodObject<
69
69
  defaultSecret?: string | null | undefined;
70
70
  retryAttempts?: number | null | undefined;
71
71
  }, {
72
- enabled: boolean;
73
72
  pid: string;
73
+ enabled: boolean;
74
74
  supportedEvents: string[];
75
75
  description?: string | null | undefined;
76
76
  id?: string | undefined;
@@ -18,8 +18,8 @@ export declare const _WebhookProviderDto: z.ZodObject<z.objectUtil.extendShape<{
18
18
  createdAt: string;
19
19
  updatedAt: string;
20
20
  deletedAt: string | null;
21
- enabled: boolean;
22
21
  pid: string;
22
+ enabled: boolean;
23
23
  supportedEvents: string[];
24
24
  description?: string | null | undefined;
25
25
  timeout?: number | null | undefined;
@@ -31,8 +31,8 @@ export declare const _WebhookProviderDto: z.ZodObject<z.objectUtil.extendShape<{
31
31
  createdAt: string;
32
32
  updatedAt: string;
33
33
  deletedAt: string | null;
34
- enabled: boolean;
35
34
  pid: string;
35
+ enabled: boolean;
36
36
  supportedEvents: string[];
37
37
  description?: string | null | undefined;
38
38
  timeout?: number | null | undefined;
@@ -46,16 +46,16 @@ export declare const _WebhookProviderUpsertDto: z.ZodObject<{
46
46
  createdAt: z.ZodOptional<z.ZodString>;
47
47
  updatedAt: z.ZodOptional<z.ZodString>;
48
48
  deletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ pid: z.ZodString;
49
50
  timeout: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
50
51
  enabled: z.ZodBoolean;
51
52
  displayName: z.ZodOptional<z.ZodString>;
52
- pid: z.ZodString;
53
53
  supportedEvents: z.ZodArray<z.ZodString, "many">;
54
54
  defaultSecret: z.ZodOptional<z.ZodNullable<z.ZodString>>;
55
55
  retryAttempts: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
56
56
  }, "strip", z.ZodTypeAny, {
57
- enabled: boolean;
58
57
  pid: string;
58
+ enabled: boolean;
59
59
  supportedEvents: string[];
60
60
  description?: string | null | undefined;
61
61
  id?: string | undefined;
@@ -67,8 +67,8 @@ export declare const _WebhookProviderUpsertDto: z.ZodObject<{
67
67
  defaultSecret?: string | null | undefined;
68
68
  retryAttempts?: number | null | undefined;
69
69
  }, {
70
- enabled: boolean;
71
70
  pid: string;
71
+ enabled: boolean;
72
72
  supportedEvents: string[];
73
73
  description?: string | null | undefined;
74
74
  id?: string | undefined;
@@ -7,4 +7,14 @@ export declare const fillJsonPathTemplate: (raw: string, meta: unknown) => strin
7
7
  * @note Ensure that meta object does not contain any information that should not be exposed to end users
8
8
  */
9
9
  export declare const fillDynamicPropertyTemplate: (rawTemplateString: string, meta: unknown) => string;
10
+ /**
11
+ * Builds the context for dynamic template variables. Exposes the finding and its sub-entities
12
+ * (user, asset, provider, meta) so that any property can be referenced in templates, e.g.
13
+ * {{user.firstName}}, {{finding.displayValue}}, {{meta._vulnerability.cve}}.
14
+ *
15
+ * - Sub-entities can be used without the "finding." prefix (e.g. {{user.firstName}}).
16
+ * - Legacy aliases are preserved: user.email (from user.emails[0]), asset.serialNumber
17
+ * (from meta._asset.sn), asset.macAddress (from meta._asset.macs[0]).
18
+ * - Arrays resolved in templates use the first element (see getTemplateValue).
19
+ */
10
20
  export declare const buildDynamicVariablesContext: (finding: FindingDto) => Map<string, unknown>;
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.buildDynamicVariablesContext = exports.fillDynamicPropertyTemplate = exports.fillJsonPathTemplate = void 0;
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
- const constants_1 = require("./constants");
9
8
  const JSON_PATH_PATTERN = /(\$\.(?:(?:[a-zA-Z0-9_]+)(?:\.[a-zA-Z0-9_]+)*)?)/g;
10
9
  const DYNAMIC_PROPERTY_PATTERN = /\{\{([^}]+)\}\}/g;
11
10
  // @deprecated : consider using fillDynamicPropertyTemplate
@@ -25,6 +24,17 @@ const fillJsonPathTemplate = (raw, meta) => {
25
24
  return result;
26
25
  };
27
26
  exports.fillJsonPathTemplate = fillJsonPathTemplate;
27
+ /**
28
+ * Resolves a value from meta at the given path. When the resolved value is an array,
29
+ * returns the first element (for backwards compatibility with paths like user.emails[0]).
30
+ */
31
+ const getTemplateValue = (meta, path) => {
32
+ const value = lodash_1.default.get(meta, path, undefined);
33
+ if (Array.isArray(value) && value.length > 0) {
34
+ return value[0];
35
+ }
36
+ return value;
37
+ };
28
38
  /**
29
39
  * @param rawTemplateString Template string with placeholders in the format of {{path.to.value}}
30
40
  * @param meta object containing the values to replace the placeholders
@@ -37,10 +47,10 @@ const fillDynamicPropertyTemplate = (rawTemplateString, meta) => {
37
47
  if (matches) {
38
48
  matches.forEach(placeholder => {
39
49
  const path = placeholder.slice(2, -2).trim();
40
- const value = lodash_1.default.get(meta, path, undefined);
50
+ const value = getTemplateValue(meta, path);
41
51
  if (lodash_1.default.isString(value) || lodash_1.default.isNumber(value) || lodash_1.default.isBoolean(value)) {
42
52
  // primitive value type is replaced as is
43
- result = result.replace(placeholder, value);
53
+ result = result.replace(placeholder, String(value));
44
54
  }
45
55
  else if (lodash_1.default.isObject(value) || lodash_1.default.isArray(value)) {
46
56
  // object and array values are stringified
@@ -55,31 +65,47 @@ const fillDynamicPropertyTemplate = (rawTemplateString, meta) => {
55
65
  return result;
56
66
  };
57
67
  exports.fillDynamicPropertyTemplate = fillDynamicPropertyTemplate;
58
- const populateDynamicVariablesEntityData = (entityProperties, baseObject, fallbackObject = undefined) => {
59
- const entityData = {};
60
- for (const key in entityProperties) {
61
- const findingKeyPath = entityProperties[key];
62
- entityData[key] = lodash_1.default.get(baseObject, findingKeyPath) || (fallbackObject ? lodash_1.default.get(fallbackObject, findingKeyPath) : undefined);
63
- }
64
- return entityData;
65
- };
68
+ /**
69
+ * Builds the context for dynamic template variables. Exposes the finding and its sub-entities
70
+ * (user, asset, provider, meta) so that any property can be referenced in templates, e.g.
71
+ * {{user.firstName}}, {{finding.displayValue}}, {{meta._vulnerability.cve}}.
72
+ *
73
+ * - Sub-entities can be used without the "finding." prefix (e.g. {{user.firstName}}).
74
+ * - Legacy aliases are preserved: user.email (from user.emails[0]), asset.serialNumber
75
+ * (from meta._asset.sn), asset.macAddress (from meta._asset.macs[0]).
76
+ * - Arrays resolved in templates use the first element (see getTemplateValue).
77
+ */
66
78
  const buildDynamicVariablesContext = (finding) => {
79
+ var _a, _b;
67
80
  const entityMap = new Map();
68
- for (const entityName in constants_1.DYNAMIC_VARIABLES.ALLOWED_ENTITIES) {
69
- const entityKey = constants_1.DYNAMIC_VARIABLES.ALLOWED_ENTITIES[entityName];
70
- const entityProperties = constants_1.DYNAMIC_VARIABLES.ALLOWED_ENTITY_KEYS[entityKey];
71
- let entityData = {};
72
- if (entityName === 'finding') {
73
- entityData = populateDynamicVariablesEntityData(entityProperties, finding);
81
+ // Full finding at "finding" so {{finding.displayValue}}, {{finding.discoveredAt}}, etc. work
82
+ entityMap.set('finding', finding);
83
+ // User: full object + legacy alias "email" from user.emails[0]
84
+ const userEntity = finding.user
85
+ ? {
86
+ ...finding.user,
87
+ ...(Array.isArray(finding.user.emails) && {
88
+ email: finding.user.emails[0],
89
+ }),
74
90
  }
75
- else if (entityName === 'user') {
76
- entityData = populateDynamicVariablesEntityData(entityProperties, finding.user, finding);
91
+ : {};
92
+ entityMap.set('user', userEntity);
93
+ // Asset: full object + legacy keys from meta (serialNumber, macAddress)
94
+ const assetEntity = finding.asset
95
+ ? {
96
+ ...finding.asset,
97
+ ...(lodash_1.default.get(finding, 'meta._asset.sn') !== undefined && {
98
+ serialNumber: lodash_1.default.get(finding, 'meta._asset.sn'),
99
+ }),
100
+ ...(lodash_1.default.get(finding, 'meta._asset.macs[0]') !== undefined && {
101
+ macAddress: lodash_1.default.get(finding, 'meta._asset.macs[0]'),
102
+ }),
77
103
  }
78
- else if (entityName === 'asset') {
79
- entityData = populateDynamicVariablesEntityData(entityProperties, finding.asset, finding);
80
- }
81
- entityMap.set(entityName, entityData);
82
- }
104
+ : {};
105
+ entityMap.set('asset', assetEntity);
106
+ // Provider and meta: pass through when present
107
+ entityMap.set('provider', (_a = finding.provider) !== null && _a !== void 0 ? _a : {});
108
+ entityMap.set('meta', (_b = finding.meta) !== null && _b !== void 0 ? _b : {});
83
109
  return entityMap;
84
110
  };
85
111
  exports.buildDynamicVariablesContext = buildDynamicVariablesContext;
@@ -1 +1 @@
1
- {"version":3,"file":"ContentTemplateService.js","sourceRoot":"","sources":["../../../src/services/ContentTemplateService.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,2CAA8C;AAE9C,MAAM,iBAAiB,GAAG,mDAAmD,CAAC;AAC9E,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAEpD,2DAA2D;AACpD,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAE,IAAa,EAAE,EAAE;IACjE,MAAM,eAAe,GAAG,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrD,IAAI,MAAM,GAAG,GAAG,CAAC;IACjB,IAAI,eAAe,EAAE,CAAC;QACpB,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YACjC,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wEAAwE;IACxE,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK;QAC/B,CAAC,CAAC;YACE,GAAG,OAAO,CAAC,KAAK;YAChB,GAAG,CAAC,gBAAC,CAAC,GAAG,CAAC,OAAO,EAAE,gBAAgB,CAAC,KAAK,SAAS,IAAI;gBACpD,YAAY,EAAE,gBAAC,CAAC,GAAG,CAAC,OAAO,EAAE,gBAAgB,CAAC;aAC/C,CAAC;YACF,GAAG,CAAC,gBAAC,CAAC,GAAG,CAAC,OAAO,EAAE,qBAAqB,CAAC,KAAK,SAAS,IAAI;gBACzD,UAAU,EAAE,gBAAC,CAAC,GAAG,CAAC,OAAO,EAAE,qBAAqB,CAAC;aAClD,CAAC;SACH;QACH,CAAC,CAAC,EAAE,CAAC;IACP,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAEpC,+CAA+C;IAC/C,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,MAAA,OAAO,CAAC,QAAQ,mCAAI,EAAE,CAAC,CAAC;IAClD,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,MAAA,OAAO,CAAC,IAAI,mCAAI,EAAE,CAAC,CAAC;IAE1C,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AApCW,QAAA,4BAA4B,gCAoCvC"}
@@ -1,14 +1,28 @@
1
- import { FindingMetricsSeriesDto } from '../dto';
1
+ import { AnalyticsUseCasesResponse, DepartmentMetricsDto, FindingMetricsSeriesDto } from '../dto';
2
2
  import { RestClient } from './rest';
3
3
  export interface AnalyticsFindingMetricsParams {
4
4
  /** Comma-separated finding kinds (e.g. "CRITICAL_VULNERABILITY_OUT_OF_SLA,HIGH_VULNERABILITY_OUT_OF_SLA"). Omit for all kinds. */
5
5
  findingKinds?: string;
6
6
  periodType?: string;
7
7
  periodCount?: number;
8
+ /** When true, response includes department-level metrics (departments array). */
9
+ includeDepartments?: boolean;
10
+ }
11
+ export interface AnalyticsUseCasesParams {
12
+ /** When true, include use cases derived from FlowSpecs. Default false. */
13
+ includeFlowSpecUseCases?: boolean;
14
+ }
15
+ export interface AnalyticsFindingMetricsResponse {
16
+ data: FindingMetricsSeriesDto[];
17
+ departments?: DepartmentMetricsDto[];
8
18
  }
9
19
  export declare class AnalyticsService {
10
20
  private rest;
11
21
  constructor(rest: RestClient);
12
- /** Fetches finding metrics series for the tenant.*/
22
+ /** Fetches use cases for the analytics dashboard. FlowSpec-derived use cases only when includeFlowSpecUseCases is true. */
23
+ getUseCases: (params?: AnalyticsUseCasesParams) => Promise<AnalyticsUseCasesResponse>;
24
+ /** Fetches finding metrics series for the tenant. Optionally includes department breakdown when includeDepartments is true. */
13
25
  getFindingMetricsSeries: (params?: AnalyticsFindingMetricsParams) => Promise<FindingMetricsSeriesDto[]>;
26
+ /** Fetches finding metrics series and optional department breakdown. Use when department progress UI is needed. */
27
+ getFindingMetricsSeriesWithDepartments: (params?: AnalyticsFindingMetricsParams) => Promise<AnalyticsFindingMetricsResponse>;
14
28
  }
@@ -5,7 +5,16 @@ const constants_1 = require("./constants");
5
5
  class AnalyticsService {
6
6
  constructor(rest) {
7
7
  this.rest = rest;
8
- /** Fetches finding metrics series for the tenant.*/
8
+ /** Fetches use cases for the analytics dashboard. FlowSpec-derived use cases only when includeFlowSpecUseCases is true. */
9
+ this.getUseCases = async (params) => {
10
+ const res = await this.rest.call({
11
+ url: `/api/v1/${constants_1.KIND.ANALYTICS}/use-cases`,
12
+ method: 'GET',
13
+ params: params,
14
+ });
15
+ return res.data;
16
+ };
17
+ /** Fetches finding metrics series for the tenant. Optionally includes department breakdown when includeDepartments is true. */
9
18
  this.getFindingMetricsSeries = async (params) => {
10
19
  var _a;
11
20
  const res = await this.rest.call({
@@ -16,6 +25,20 @@ class AnalyticsService {
16
25
  const body = res.data;
17
26
  return (_a = body === null || body === void 0 ? void 0 : body.data) !== null && _a !== void 0 ? _a : [];
18
27
  };
28
+ /** Fetches finding metrics series and optional department breakdown. Use when department progress UI is needed. */
29
+ this.getFindingMetricsSeriesWithDepartments = async (params) => {
30
+ var _a;
31
+ const res = await this.rest.call({
32
+ url: `/api/v1/${constants_1.KIND.ANALYTICS}`,
33
+ method: 'GET',
34
+ params: { ...params, includeDepartments: true },
35
+ });
36
+ const body = res.data;
37
+ return {
38
+ data: (_a = body === null || body === void 0 ? void 0 : body.data) !== null && _a !== void 0 ? _a : [],
39
+ ...((body === null || body === void 0 ? void 0 : body.departments) !== undefined && body.departments.length > 0 ? { departments: body.departments } : {}),
40
+ };
41
+ };
19
42
  }
20
43
  }
21
44
  exports.AnalyticsService = AnalyticsService;
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.service.js","sourceRoot":"","sources":["../../../src/services/analytics.service.ts"],"names":[],"mappings":";;;AAEA,2CAAiC;AASjC,MAAa,gBAAgB;IAC3B,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;QAEpC,oDAAoD;QACpD,4BAAuB,GAAG,KAAK,EAAE,MAAsC,EAAsC,EAAE;;YAC7G,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC/B,GAAG,EAAE,WAAW,gBAAI,CAAC,SAAS,EAAE;gBAChC,MAAM,EAAE,KAAK;gBACb,MAAM,EAAE,MAAqD;aAC9D,CAAC,CAAC;YACH,MAAM,IAAI,GAAG,GAAG,CAAC,IAAyC,CAAC;YAC3D,OAAO,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,mCAAI,EAAE,CAAC;QAC1B,CAAC,CAAC;IAXqC,CAAC;CAYzC;AAbD,4CAaC"}
1
+ {"version":3,"file":"analytics.service.js","sourceRoot":"","sources":["../../../src/services/analytics.service.ts"],"names":[],"mappings":";;;AAEA,2CAAiC;AAqBjC,MAAa,gBAAgB;IAC3B,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;QAEpC,2HAA2H;QAC3H,gBAAW,GAAG,KAAK,EAAE,MAAgC,EAAsC,EAAE;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CAAC,CAAC,EAAC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;aAC3G,CAAC;QACJ,CAAC,CAAC;IAnCqC,CAAC;CAoCzC;AArCD,4CAqCC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampsec/platform-client",
3
- "version": "84.39.1",
3
+ "version": "84.41.0",
4
4
  "description": "",
5
5
  "main": "build/src/index.js",
6
6
  "runkitExampleFilename": "example/main.js",
@@ -18,3 +18,34 @@ export const _FindingMetricsSeriesDto = z.object({
18
18
  });
19
19
 
20
20
  export type FindingMetricsSeriesDto = z.infer<typeof _FindingMetricsSeriesDto>;
21
+
22
+ /**
23
+ * Department-level finding metrics for the analytics dashboard.
24
+ * count = total findings; findingsClosed = completed; engaged = in progress; healed = closed after flow trigger.
25
+ */
26
+ export const _DepartmentMetricsDto = z.object({
27
+ department: z.string(),
28
+ count: z.number(),
29
+ findingsClosed: z.number(),
30
+ engaged: z.number(),
31
+ healed: z.number(),
32
+ });
33
+
34
+ export type DepartmentMetricsDto = z.infer<typeof _DepartmentMetricsDto>;
35
+
36
+ /** Single use case option for the analytics dashboard (FlowSpec-derived or category-based). */
37
+ export const _AnalyticsUseCaseOption = z.object({
38
+ id: z.union([z.string(), z.number()]),
39
+ value: z.string(),
40
+ displayValue: z.string(),
41
+ group: z.enum(['flowSpec', 'category']),
42
+ findingKinds: z.string().optional(),
43
+ });
44
+ export type AnalyticsUseCaseOption = z.infer<typeof _AnalyticsUseCaseOption>;
45
+
46
+ /** Response from GET /analytics/use-cases. FlowSpec use cases first, then category use cases. */
47
+ export const _AnalyticsUseCasesResponse = z.object({
48
+ flowSpecUseCases: z.array(_AnalyticsUseCaseOption),
49
+ categoryUseCases: z.array(_AnalyticsUseCaseOption),
50
+ });
51
+ export type AnalyticsUseCasesResponse = z.infer<typeof _AnalyticsUseCasesResponse>;
@@ -22,6 +22,34 @@ export const _FindingBucketDto = z.object({
22
22
  });
23
23
  export type FindingBucketDto = z.infer<typeof _FindingBucketDto>;
24
24
 
25
+ /**
26
+ * Zod schema for the finding-level keys (BaseDto + FindingUpsertDto).
27
+ * Used to derive template variable paths for Custom Content dynamic variables.
28
+ */
29
+ // TODO: Use this schema to infer an exported type for the finding entity.
30
+ export const _FindingDtoSchema = _BaseDto.merge(
31
+ z.object({
32
+ discoveredAt: z.string().optional(),
33
+ closedAt: z.string().optional(),
34
+ category: z.string(),
35
+ kind: z.string(),
36
+ status: z.string(),
37
+ severity: z.string(),
38
+ outcome: z.string().optional(),
39
+ numberOfEngagements: z.number(),
40
+ displayValue: z.string(),
41
+ description: z.string().optional(),
42
+ cid: z.string(),
43
+ pid: z.string(),
44
+ aid: z.string().nullable().optional(),
45
+ uid: z.string().nullable().optional(),
46
+ scid: z.string().nullable().optional(),
47
+ fsid: z.string().nullable().optional(),
48
+ verificationCount: z.number().optional(),
49
+ bucket: _FindingBucketDto.optional(),
50
+ })
51
+ );
52
+
25
53
  export type FindingUpsertDto = BaseUpsertDto & {
26
54
  /** Date the finding was discoverd by the integration */
27
55
  discoveredAt?: string;
@@ -1,6 +1,6 @@
1
1
  import _ from 'lodash';
2
- import {DYNAMIC_VARIABLES} from './constants';
3
2
  import {FindingDto} from '../dto';
3
+
4
4
  const JSON_PATH_PATTERN = /(\$\.(?:(?:[a-zA-Z0-9_]+)(?:\.[a-zA-Z0-9_]+)*)?)/g;
5
5
  const DYNAMIC_PROPERTY_PATTERN = /\{\{([^}]+)\}\}/g;
6
6
 
@@ -21,6 +21,18 @@ export const fillJsonPathTemplate = (raw: string, meta: unknown) => {
21
21
  return result;
22
22
  };
23
23
 
24
+ /**
25
+ * Resolves a value from meta at the given path. When the resolved value is an array,
26
+ * returns the first element (for backwards compatibility with paths like user.emails[0]).
27
+ */
28
+ const getTemplateValue = (meta: unknown, path: string): unknown => {
29
+ const value: unknown = _.get(meta, path, undefined);
30
+ if (Array.isArray(value) && value.length > 0) {
31
+ return value[0];
32
+ }
33
+ return value;
34
+ };
35
+
24
36
  /**
25
37
  * @param rawTemplateString Template string with placeholders in the format of {{path.to.value}}
26
38
  * @param meta object containing the values to replace the placeholders
@@ -33,10 +45,10 @@ export const fillDynamicPropertyTemplate = (rawTemplateString: string, meta: unk
33
45
  if (matches) {
34
46
  matches.forEach(placeholder => {
35
47
  const path = placeholder.slice(2, -2).trim();
36
- const value = _.get(meta, path, undefined);
48
+ const value = getTemplateValue(meta, path);
37
49
  if (_.isString(value) || _.isNumber(value) || _.isBoolean(value)) {
38
50
  // primitive value type is replaced as is
39
- result = result.replace(placeholder, value);
51
+ result = result.replace(placeholder, String(value));
40
52
  } else if (_.isObject(value) || _.isArray(value)) {
41
53
  // object and array values are stringified
42
54
  result = result.replace(placeholder, JSON.stringify(value, null, 2));
@@ -49,39 +61,50 @@ export const fillDynamicPropertyTemplate = (rawTemplateString: string, meta: unk
49
61
  return result;
50
62
  };
51
63
 
52
- const populateDynamicVariablesEntityData = (
53
- entityProperties: Record<string, string>,
54
- baseObject: Record<string, unknown> | undefined,
55
- fallbackObject: Record<string, unknown> | undefined = undefined
56
- ): Record<string, unknown> => {
57
- const entityData: Record<string, unknown> = {};
58
- for (const key in entityProperties) {
59
- const findingKeyPath = entityProperties[key];
60
- entityData[key] = _.get(baseObject, findingKeyPath) || (fallbackObject ? _.get(fallbackObject, findingKeyPath) : undefined);
61
- }
62
-
63
- return entityData;
64
- };
65
-
64
+ /**
65
+ * Builds the context for dynamic template variables. Exposes the finding and its sub-entities
66
+ * (user, asset, provider, meta) so that any property can be referenced in templates, e.g.
67
+ * {{user.firstName}}, {{finding.displayValue}}, {{meta._vulnerability.cve}}.
68
+ *
69
+ * - Sub-entities can be used without the "finding." prefix (e.g. {{user.firstName}}).
70
+ * - Legacy aliases are preserved: user.email (from user.emails[0]), asset.serialNumber
71
+ * (from meta._asset.sn), asset.macAddress (from meta._asset.macs[0]).
72
+ * - Arrays resolved in templates use the first element (see getTemplateValue).
73
+ */
66
74
  export const buildDynamicVariablesContext = (finding: FindingDto): Map<string, unknown> => {
67
- const entityMap: Map<string, unknown> = new Map();
75
+ const entityMap = new Map<string, unknown>();
68
76
 
69
- for (const entityName in DYNAMIC_VARIABLES.ALLOWED_ENTITIES) {
70
- const entityKey = DYNAMIC_VARIABLES.ALLOWED_ENTITIES[entityName as keyof typeof DYNAMIC_VARIABLES.ALLOWED_ENTITIES];
71
- const entityProperties = DYNAMIC_VARIABLES.ALLOWED_ENTITY_KEYS[entityKey as keyof typeof DYNAMIC_VARIABLES.ALLOWED_ENTITY_KEYS];
77
+ // Full finding at "finding" so {{finding.displayValue}}, {{finding.discoveredAt}}, etc. work
78
+ entityMap.set('finding', finding);
72
79
 
73
- let entityData: Record<string, unknown> = {};
80
+ // User: full object + legacy alias "email" from user.emails[0]
81
+ const userEntity = finding.user
82
+ ? {
83
+ ...finding.user,
84
+ ...(Array.isArray((finding.user as {emails?: string[]}).emails) && {
85
+ email: (finding.user as {emails: string[]}).emails[0],
86
+ }),
87
+ }
88
+ : {};
89
+ entityMap.set('user', userEntity);
74
90
 
75
- if (entityName === 'finding') {
76
- entityData = populateDynamicVariablesEntityData(entityProperties, finding);
77
- } else if (entityName === 'user') {
78
- entityData = populateDynamicVariablesEntityData(entityProperties, finding.user, finding);
79
- } else if (entityName === 'asset') {
80
- entityData = populateDynamicVariablesEntityData(entityProperties, finding.asset, finding);
81
- }
91
+ // Asset: full object + legacy keys from meta (serialNumber, macAddress)
92
+ const assetEntity = finding.asset
93
+ ? {
94
+ ...finding.asset,
95
+ ...(_.get(finding, 'meta._asset.sn') !== undefined && {
96
+ serialNumber: _.get(finding, 'meta._asset.sn'),
97
+ }),
98
+ ...(_.get(finding, 'meta._asset.macs[0]') !== undefined && {
99
+ macAddress: _.get(finding, 'meta._asset.macs[0]'),
100
+ }),
101
+ }
102
+ : {};
103
+ entityMap.set('asset', assetEntity);
82
104
 
83
- entityMap.set(entityName, entityData);
84
- }
105
+ // Provider and meta: pass through when present
106
+ entityMap.set('provider', finding.provider ?? {});
107
+ entityMap.set('meta', finding.meta ?? {});
85
108
 
86
109
  return entityMap;
87
110
  };
@@ -1,4 +1,4 @@
1
- import {FindingMetricsSeriesDto} from '../dto';
1
+ import {AnalyticsUseCasesResponse, DepartmentMetricsDto, FindingMetricsSeriesDto} from '../dto';
2
2
  import {RestClient} from './rest';
3
3
  import {KIND} from './constants';
4
4
 
@@ -7,19 +7,55 @@ export interface AnalyticsFindingMetricsParams {
7
7
  findingKinds?: string;
8
8
  periodType?: string;
9
9
  periodCount?: number;
10
+ /** When true, response includes department-level metrics (departments array). */
11
+ includeDepartments?: boolean;
12
+ }
13
+
14
+ export interface AnalyticsUseCasesParams {
15
+ /** When true, include use cases derived from FlowSpecs. Default false. */
16
+ includeFlowSpecUseCases?: boolean;
17
+ }
18
+
19
+ export interface AnalyticsFindingMetricsResponse {
20
+ data: FindingMetricsSeriesDto[];
21
+ departments?: DepartmentMetricsDto[];
10
22
  }
11
23
 
12
24
  export class AnalyticsService {
13
25
  constructor(private rest: RestClient) {}
14
26
 
15
- /** Fetches finding metrics series for the tenant.*/
27
+ /** Fetches use cases for the analytics dashboard. FlowSpec-derived use cases only when includeFlowSpecUseCases is true. */
28
+ getUseCases = async (params?: AnalyticsUseCasesParams): Promise<AnalyticsUseCasesResponse> => {
29
+ const res = await this.rest.call({
30
+ url: `/api/v1/${KIND.ANALYTICS}/use-cases`,
31
+ method: 'GET',
32
+ params: params as Record<string, string | number | boolean | undefined>,
33
+ });
34
+ return res.data as AnalyticsUseCasesResponse;
35
+ };
36
+
37
+ /** Fetches finding metrics series for the tenant. Optionally includes department breakdown when includeDepartments is true. */
16
38
  getFindingMetricsSeries = async (params?: AnalyticsFindingMetricsParams): Promise<FindingMetricsSeriesDto[]> => {
17
39
  const res = await this.rest.call({
18
40
  url: `/api/v1/${KIND.ANALYTICS}`,
19
41
  method: 'GET',
20
- params: params as Record<string, string | number | undefined>,
42
+ params: params as Record<string, string | number | boolean | undefined>,
21
43
  });
22
- const body = res.data as {data: FindingMetricsSeriesDto[]};
44
+ const body = res.data as AnalyticsFindingMetricsResponse;
23
45
  return body?.data ?? [];
24
46
  };
47
+
48
+ /** Fetches finding metrics series and optional department breakdown. Use when department progress UI is needed. */
49
+ getFindingMetricsSeriesWithDepartments = async (params?: AnalyticsFindingMetricsParams): Promise<AnalyticsFindingMetricsResponse> => {
50
+ const res = await this.rest.call({
51
+ url: `/api/v1/${KIND.ANALYTICS}`,
52
+ method: 'GET',
53
+ params: {...params, includeDepartments: true} as Record<string, string | number | boolean | undefined>,
54
+ });
55
+ const body = res.data as AnalyticsFindingMetricsResponse;
56
+ return {
57
+ data: body?.data ?? [],
58
+ ...(body?.departments !== undefined && body.departments.length > 0 ? {departments: body.departments} : {}),
59
+ };
60
+ };
25
61
  }