@ampsec/platform-client 40.1.0 → 41.0.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/enums/{notification.kind.d.ts → contentStrategy.kind.d.ts} +1 -1
- package/build/src/dto/enums/contentStrategy.kind.js +11 -0
- package/build/src/dto/enums/contentStrategy.kind.js.map +1 -0
- package/build/src/dto/enums/deliveryStrategy.kind.d.ts +4 -0
- package/build/src/dto/enums/deliveryStrategy.kind.js +10 -0
- package/build/src/dto/enums/deliveryStrategy.kind.js.map +1 -0
- package/build/src/dto/enums/index.d.ts +2 -1
- package/build/src/dto/enums/index.js +2 -1
- package/build/src/dto/enums/index.js.map +1 -1
- package/build/src/dto/enums/requiredDataProperty.enum.d.ts +8 -0
- package/build/src/dto/enums/requiredDataProperty.enum.js +14 -0
- package/build/src/dto/enums/requiredDataProperty.enum.js.map +1 -0
- package/build/src/dto/notification.dto.d.ts +67 -23
- package/build/src/dto/workflow.dto.d.ts +30 -30
- package/build/src/services/EngageApi.js +3 -3
- package/build/src/services/EngageApi.js.map +1 -1
- package/build/src/services/rest/AgentIdentityService.js +1 -1
- package/build/src/services/rest/AgentIdentityService.js.map +1 -1
- package/build/src/services/rest/UserIdentityService.js +1 -1
- package/build/src/services/rest/UserIdentityService.js.map +1 -1
- package/package.json +1 -1
- package/src/dto/enums/{notification.kind.ts → contentStrategy.kind.ts} +1 -1
- package/src/dto/enums/deliveryStrategy.kind.ts +5 -0
- package/src/dto/enums/index.ts +2 -1
- package/src/dto/enums/requiredDataProperty.enum.ts +9 -0
- package/src/dto/notification.dto.ts +78 -25
- package/src/dto/workflow.dto.ts +32 -30
- package/src/services/EngageApi.ts +3 -3
- package/src/services/rest/AgentIdentityService.ts +1 -1
- package/src/services/rest/UserIdentityService.ts +1 -1
- package/build/src/dto/enums/notification.kind.js +0 -11
- package/build/src/dto/enums/notification.kind.js.map +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentStrategyKind = void 0;
|
|
4
|
+
/* eslint-disable no-unused-vars */
|
|
5
|
+
var ContentStrategyKind;
|
|
6
|
+
(function (ContentStrategyKind) {
|
|
7
|
+
ContentStrategyKind["LLM"] = "LLM";
|
|
8
|
+
ContentStrategyKind["RAW"] = "RAW";
|
|
9
|
+
ContentStrategyKind["TEMPLATE"] = "TEMPLATE";
|
|
10
|
+
})(ContentStrategyKind || (exports.ContentStrategyKind = ContentStrategyKind = {}));
|
|
11
|
+
//# sourceMappingURL=contentStrategy.kind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentStrategy.kind.js","sourceRoot":"","sources":["../../../../src/dto/enums/contentStrategy.kind.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,kCAAW,CAAA;IACX,kCAAW,CAAA;IACX,4CAAqB,CAAA;AACvB,CAAC,EAJW,mBAAmB,mCAAnB,mBAAmB,QAI9B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeliveryStrategyKind = void 0;
|
|
4
|
+
/* eslint-disable no-unused-vars */
|
|
5
|
+
var DeliveryStrategyKind;
|
|
6
|
+
(function (DeliveryStrategyKind) {
|
|
7
|
+
DeliveryStrategyKind["EMAIL"] = "EMAIL";
|
|
8
|
+
DeliveryStrategyKind["SLACK"] = "SLACK";
|
|
9
|
+
})(DeliveryStrategyKind || (exports.DeliveryStrategyKind = DeliveryStrategyKind = {}));
|
|
10
|
+
//# sourceMappingURL=deliveryStrategy.kind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliveryStrategy.kind.js","sourceRoot":"","sources":["../../../../src/dto/enums/deliveryStrategy.kind.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,uCAAe,CAAA;IACf,uCAAe,CAAA;AACjB,CAAC,EAHW,oBAAoB,oCAApB,oBAAoB,QAG/B"}
|
|
@@ -12,4 +12,5 @@ export * from './notification.status';
|
|
|
12
12
|
export * from './riskContributor.type';
|
|
13
13
|
export * from './saasComponentKind';
|
|
14
14
|
export * from './workflowStep.kind';
|
|
15
|
-
export * from './
|
|
15
|
+
export * from './contentStrategy.kind';
|
|
16
|
+
export * from './deliveryStrategy.kind';
|
|
@@ -28,5 +28,6 @@ __exportStar(require("./notification.status"), exports);
|
|
|
28
28
|
__exportStar(require("./riskContributor.type"), exports);
|
|
29
29
|
__exportStar(require("./saasComponentKind"), exports);
|
|
30
30
|
__exportStar(require("./workflowStep.kind"), exports);
|
|
31
|
-
__exportStar(require("./
|
|
31
|
+
__exportStar(require("./contentStrategy.kind"), exports);
|
|
32
|
+
__exportStar(require("./deliveryStrategy.kind"), exports);
|
|
32
33
|
//# 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,gDAA8B;AAC9B,qDAAmC;AACnC,mDAAiC;AACjC,oDAAkC;AAClC,wDAAsC;AACtC,wDAAsC;AACtC,yDAAuC;AACvC,sDAAoC;AACpC,sDAAoC;AACpC,
|
|
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,gDAA8B;AAC9B,qDAAmC;AACnC,mDAAiC;AACjC,oDAAkC;AAClC,wDAAsC;AACtC,wDAAsC;AACtC,yDAAuC;AACvC,sDAAoC;AACpC,sDAAoC;AACpC,yDAAuC;AACvC,0DAAwC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequiredDataProperty = void 0;
|
|
4
|
+
/* eslint-disable no-unused-vars */
|
|
5
|
+
var RequiredDataProperty;
|
|
6
|
+
(function (RequiredDataProperty) {
|
|
7
|
+
RequiredDataProperty["DEVICE_NAME"] = "DEVICE_NAME";
|
|
8
|
+
RequiredDataProperty["DURATION"] = "DURATION";
|
|
9
|
+
RequiredDataProperty["ENROLL_DATE"] = "ENROLL_DATE";
|
|
10
|
+
RequiredDataProperty["SOFTWARE_NAME"] = "SOFTWARE_NAME";
|
|
11
|
+
RequiredDataProperty["START_DATE"] = "START_DATE";
|
|
12
|
+
RequiredDataProperty["TITLE"] = "TITLE";
|
|
13
|
+
})(RequiredDataProperty || (exports.RequiredDataProperty = RequiredDataProperty = {}));
|
|
14
|
+
//# sourceMappingURL=requiredDataProperty.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requiredDataProperty.enum.js","sourceRoot":"","sources":["../../../../src/dto/enums/requiredDataProperty.enum.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,mDAA2B,CAAA;IAC3B,6CAAqB,CAAA;IACrB,mDAA2B,CAAA;IAC3B,uDAA+B,CAAA;IAC/B,iDAAyB,CAAA;IACzB,uCAAe,CAAA;AACjB,CAAC,EAPW,oBAAoB,oCAApB,oBAAoB,QAO/B"}
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import { BaseDto, BaseUpsertDto } from './base.dto';
|
|
2
|
-
import { NotificationStatus } from './enums';
|
|
3
|
-
import {
|
|
4
|
-
import { NotificationStepData, TrainingNotificationStepData } from './workflow.dto';
|
|
5
|
-
export type TemplateNotificationSchema = {
|
|
6
|
-
/** ID of the template to be used for the notification */
|
|
7
|
-
templateId: string;
|
|
8
|
-
};
|
|
9
|
-
export type RawNotificationSchema = {
|
|
10
|
-
/** Optional user provided notification message */
|
|
11
|
-
rawContent: string;
|
|
12
|
-
};
|
|
2
|
+
import { Category, DeliveryStrategyKind, FindingKind, FindingSeverity, NotificationStatus } from './enums';
|
|
3
|
+
import { ContentStrategyKind } from './enums/contentStrategy.kind';
|
|
13
4
|
export type NotificationAddress = {
|
|
14
5
|
/** Connector ID for the notification channel */
|
|
15
|
-
cid
|
|
6
|
+
cid?: string;
|
|
16
7
|
/** Group IDs to which the notification is being sent */
|
|
17
8
|
groups?: string[] | number[];
|
|
18
9
|
/** User IDs to which the notification is being sent */
|
|
@@ -20,24 +11,77 @@ export type NotificationAddress = {
|
|
|
20
11
|
/** Webhook URLs to which the notification is being sent */
|
|
21
12
|
webhooks?: string[];
|
|
22
13
|
};
|
|
14
|
+
export type FindingNotificationContext = {
|
|
15
|
+
/** Severity of the finding */
|
|
16
|
+
severity: FindingSeverity;
|
|
17
|
+
/** Category of the finding */
|
|
18
|
+
category: Category;
|
|
19
|
+
/** Kind of the finding */
|
|
20
|
+
kind: FindingKind;
|
|
21
|
+
};
|
|
22
|
+
export type UserNotificationContext = {
|
|
23
|
+
/** First name of the user */
|
|
24
|
+
firstName: string;
|
|
25
|
+
/** Last name of the user */
|
|
26
|
+
lastName: string;
|
|
27
|
+
/** Title of the user */
|
|
28
|
+
title: string;
|
|
29
|
+
/** Department of the user */
|
|
30
|
+
department: string;
|
|
31
|
+
};
|
|
32
|
+
export type ProviderNotificationContext = {
|
|
33
|
+
/** Name of the provider */
|
|
34
|
+
displayValue: string;
|
|
35
|
+
/** Categories to which the provider applies */
|
|
36
|
+
categories: string[];
|
|
37
|
+
};
|
|
38
|
+
export type NotificationContext = {
|
|
39
|
+
finding?: FindingNotificationContext;
|
|
40
|
+
provider?: ProviderNotificationContext;
|
|
41
|
+
user?: UserNotificationContext;
|
|
42
|
+
};
|
|
43
|
+
export type ContentStrategySpecification = {
|
|
44
|
+
/** Kind of the content strategy */
|
|
45
|
+
kind: ContentStrategyKind;
|
|
46
|
+
/** Data to be used for the notification */
|
|
47
|
+
data?: {
|
|
48
|
+
[propName: string]: string | number | boolean;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export type TemplateContentStrategySpec = ContentStrategySpecification & {
|
|
52
|
+
/** ID of the template to be used for the notification */
|
|
53
|
+
templateId: string;
|
|
54
|
+
/** Context for the notification */
|
|
55
|
+
context: NotificationContext;
|
|
56
|
+
};
|
|
57
|
+
export type RawContentStrategySpec = ContentStrategySpecification & {
|
|
58
|
+
/** Content of the notification */
|
|
59
|
+
content: string;
|
|
60
|
+
};
|
|
61
|
+
export type LlmContentStrategySpec = ContentStrategySpecification & {
|
|
62
|
+
/** Context for the notification */
|
|
63
|
+
context: NotificationContext;
|
|
64
|
+
};
|
|
65
|
+
export type DeliveryStrategySpec = {
|
|
66
|
+
/** Channel type that should be used for sending the notificaiton */
|
|
67
|
+
kind: DeliveryStrategyKind;
|
|
68
|
+
/** Recipient address to which the notification is being sent */
|
|
69
|
+
to: NotificationAddress;
|
|
70
|
+
};
|
|
23
71
|
export type NotificationUpsertDto = BaseUpsertDto & {
|
|
24
|
-
/** Kind of the notification */
|
|
25
|
-
kind: NotificationKind;
|
|
26
72
|
/** Workflow ID for which the notification is being created */
|
|
27
73
|
wfid: string;
|
|
28
|
-
/** Finding ID for which the notification is being created */
|
|
29
|
-
fid?: string;
|
|
30
|
-
/** Recipient address to which the notification is being sent */
|
|
31
|
-
to: NotificationAddress;
|
|
32
|
-
/** ID of the user to which the notification is being sent */
|
|
33
|
-
uid?: string;
|
|
34
74
|
/** Step number in the workflow for which the notification is being created */
|
|
35
75
|
stepNumber: number;
|
|
36
76
|
/** Status of the notification */
|
|
37
77
|
status: NotificationStatus;
|
|
38
78
|
/** Data to be used for the notification */
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
|
|
79
|
+
contentStrategy: TemplateContentStrategySpec | RawContentStrategySpec | LlmContentStrategySpec;
|
|
80
|
+
/** Method of delivery */
|
|
81
|
+
deliveryStrategy: DeliveryStrategySpec;
|
|
82
|
+
/** Finding ID for which the notification is being created */
|
|
83
|
+
fid?: string | null;
|
|
84
|
+
/** ID of the user to which the notification is being sent */
|
|
85
|
+
uid?: string | null;
|
|
42
86
|
};
|
|
43
87
|
export type NotificationDto = NotificationUpsertDto & BaseDto;
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import { BaseDto } from './base.dto';
|
|
2
|
-
import {
|
|
2
|
+
import { ContentStrategyKind, DeliveryStrategyKind } from './enums';
|
|
3
|
+
import { RequiredDataProperty } from './enums/requiredDataProperty.enum';
|
|
3
4
|
import { WorkflowStepKind } from './enums/workflowStep.kind';
|
|
4
5
|
import { WorkflowTriggerKind } from './enums/workflowTrigger.kind';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
export type WorflowStepDescriptor = {
|
|
7
|
+
/** Type of the notification step, either NOTIFICATION or PAUSE */
|
|
8
|
+
kind: WorkflowStepKind;
|
|
9
|
+
/** Optional default values to be used of no other is provided */
|
|
10
|
+
defaults?: {
|
|
11
|
+
[propName: string]: string | number | boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export type NotificationStepDescriptor = WorflowStepDescriptor & {
|
|
15
|
+
/** Delivery strategy to be used for the notification */
|
|
16
|
+
deliveryStrategyKinds: DeliveryStrategyKind[];
|
|
17
|
+
/** Required data properties for the notification */
|
|
18
|
+
requiredData: RequiredDataProperty[];
|
|
19
|
+
};
|
|
20
|
+
export type PauseStepDescriptor = WorflowStepDescriptor & {
|
|
21
|
+
/** Duration, in days, to wait before executing the next step in the workflow */
|
|
22
|
+
pauseDuration: number;
|
|
13
23
|
};
|
|
14
|
-
export type
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
/** Date on which the user enrolled in the training module */
|
|
18
|
-
enrollDate?: string;
|
|
19
|
-
/** Date on which the user started the training module */
|
|
20
|
-
startDate?: string;
|
|
24
|
+
export type ContentDescriptor = {
|
|
25
|
+
/** Kind of the content that will be generated for the notification */
|
|
26
|
+
kind: ContentStrategyKind;
|
|
21
27
|
};
|
|
22
|
-
export type
|
|
23
|
-
/**
|
|
24
|
-
|
|
28
|
+
export type TemplateContentDescriptor = ContentDescriptor & {
|
|
29
|
+
/** ID of the template to be used for the notification */
|
|
30
|
+
templateId: string;
|
|
25
31
|
};
|
|
26
32
|
export type WorkflowStep = {
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
/** Schema for the notification step */
|
|
32
|
-
schema?: TemplateNotificationSchema | RawNotificationSchema;
|
|
33
|
-
/** Data associated with the notification step */
|
|
34
|
-
data: NotificationStepData | TrainingNotificationStepData | PauseStepData;
|
|
33
|
+
/** Indicates the type of workflow step and contains relevant information for each */
|
|
34
|
+
stepDescriptor: NotificationStepDescriptor | PauseStepDescriptor;
|
|
35
|
+
/** Content to be used for the notification */
|
|
36
|
+
contentDescriptor?: ContentDescriptor | TemplateContentDescriptor;
|
|
35
37
|
/** Step number to transition the workflow to on success */
|
|
36
38
|
successStepNumber: number | null;
|
|
37
39
|
/** Step number to transition the workflow to on failure */
|
|
38
40
|
failureStepNumber: number | null;
|
|
39
|
-
/** Duration, in days, to wait before executing the next step in the workflow */
|
|
40
|
-
pauseDuration?: number | null;
|
|
41
41
|
};
|
|
42
42
|
export type WorkflowSteps = {
|
|
43
43
|
[propName: number]: WorkflowStep;
|
|
@@ -48,7 +48,7 @@ export type WorkflowTriggerRule = {
|
|
|
48
48
|
} | WorkflowTriggerRule[];
|
|
49
49
|
};
|
|
50
50
|
export type WorkflowTrigger = {
|
|
51
|
-
/**
|
|
51
|
+
/** Kind of the trigger */
|
|
52
52
|
kind: WorkflowTriggerKind;
|
|
53
53
|
/** Rule to which the applicable entity type must conform to trigger the workflow */
|
|
54
54
|
rule: unknown;
|
|
@@ -29,13 +29,13 @@ const UserIdentityService_1 = require("./rest/UserIdentityService");
|
|
|
29
29
|
*/
|
|
30
30
|
class EngageApi {
|
|
31
31
|
constructor(rest) {
|
|
32
|
-
this.connectors = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.CONNECTORS, constants_1.TARGET_API_ENGAGE);
|
|
32
|
+
this.connectors = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.CONNECTORS, constants_1.TARGET_API_ENGAGE);
|
|
33
33
|
this.findings = new data_service_1.AmpPatchDataServiceImpl(rest, constants_1.KIND.FINDINGS, constants_1.TARGET_API_ENGAGE);
|
|
34
34
|
this.identity = new UserIdentityService_1.UserIdentityService(rest);
|
|
35
|
-
this.notifications = new data_service_1.AmpDataServiceImpl(rest, constants_1.KIND.NOTIFICATIONS, constants_1.TARGET_API_ENGAGE);
|
|
35
|
+
this.notifications = new data_service_1.AmpDataServiceImpl(rest, constants_1.KIND.NOTIFICATIONS, constants_1.TARGET_API_ENGAGE);
|
|
36
36
|
this.providers = new data_service_1.AmpDataServiceImpl(rest, constants_1.KIND.PROVIDERS, constants_1.TARGET_API_AGENT);
|
|
37
37
|
this.reports = new reports_service_1.AmpReportServiceImpl(rest);
|
|
38
|
-
this.settings = new settings_service_1.AmpSettingsService(rest); // TODO:
|
|
38
|
+
this.settings = new settings_service_1.AmpSettingsService(rest); // TODO: confirm it is not needed. Currently returns NOT_IMPLEMENTED error code
|
|
39
39
|
}
|
|
40
40
|
static instance(options) {
|
|
41
41
|
const rest = (0, rest_1.getAmpRestClient)(options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngageApi.js","sourceRoot":"","sources":["../../../src/services/EngageApi.ts"],"names":[],"mappings":";;;AACA,qDAAsD;AACtD,iDAAgH;AAChH,iCAA0E;AAC1E,2CAAsE;AACtE,uDAAyE;AACzE,yDAAsD;AACtD,oEAA+D;AAI/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,SAAS;IASpB,YAAY,IAAgB;QAC1B,IAAI,CAAC,UAAU,GAAG,IAAI,qCAAoB,CAAmC,IAAI,EAAE,gBAAI,CAAC,UAAU,EAAE,6BAAiB,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"EngageApi.js","sourceRoot":"","sources":["../../../src/services/EngageApi.ts"],"names":[],"mappings":";;;AACA,qDAAsD;AACtD,iDAAgH;AAChH,iCAA0E;AAC1E,2CAAsE;AACtE,uDAAyE;AACzE,yDAAsD;AACtD,oEAA+D;AAI/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,SAAS;IASpB,YAAY,IAAgB;QAC1B,IAAI,CAAC,UAAU,GAAG,IAAI,qCAAoB,CAAmC,IAAI,EAAE,gBAAI,CAAC,UAAU,EAAE,6BAAiB,CAAC,CAAC;QACvH,IAAI,CAAC,QAAQ,GAAG,IAAI,sCAAuB,CAAqC,IAAI,EAAE,gBAAI,CAAC,QAAQ,EAAE,6BAAiB,CAAC,CAAC;QACxH,IAAI,CAAC,QAAQ,GAAG,IAAI,yCAAmB,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,aAAa,GAAG,IAAI,iCAAkB,CAAkB,IAAI,EAAE,gBAAI,CAAC,aAAa,EAAE,6BAAiB,CAAC,CAAC;QAC1G,IAAI,CAAC,SAAS,GAAG,IAAI,iCAAkB,CAAc,IAAI,EAAE,gBAAI,CAAC,SAAS,EAAE,4BAAgB,CAAC,CAAC;QAC7F,IAAI,CAAC,OAAO,GAAG,IAAI,sCAAoB,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,QAAQ,GAAG,IAAI,qCAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,+EAA+E;IAC/H,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,OAAyB;QACvC,MAAM,IAAI,GAAG,IAAA,uBAAgB,EAAC,OAAO,CAAC,CAAC;QACvC,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF;AAvBD,8BAuBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentIdentityService.js","sourceRoot":"","sources":["../../../../src/services/rest/AgentIdentityService.ts"],"names":[],"mappings":";;;AAOA,MAAa,oBAAoB;IAE/B,YAAY,IAAgB;QAG5B,kBAAa,GAAG,KAAK,EAAE,cAAsB,EAA0B,EAAE;YACvE,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC/B,GAAG,EAAE,6BAA6B;gBAClC,MAAM,EAAE,KAAK;gBACb,MAAM,EAAE;oBACN,GAAG,EAAE,cAAc;iBACpB;aACF,CAAC,CAAC;YACH,OAAO,GAAG,CAAC,IAAqB,CAAC;QACnC,CAAC,CAAC;QAEF,OAAE,GAAG,KAAK,IAAuB,EAAE;YACjC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC/B,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"AgentIdentityService.js","sourceRoot":"","sources":["../../../../src/services/rest/AgentIdentityService.ts"],"names":[],"mappings":";;;AAOA,MAAa,oBAAoB;IAE/B,YAAY,IAAgB;QAG5B,kBAAa,GAAG,KAAK,EAAE,cAAsB,EAA0B,EAAE;YACvE,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC/B,GAAG,EAAE,6BAA6B;gBAClC,MAAM,EAAE,KAAK;gBACb,MAAM,EAAE;oBACN,GAAG,EAAE,cAAc;iBACpB;aACF,CAAC,CAAC;YACH,OAAO,GAAG,CAAC,IAAqB,CAAC;QACnC,CAAC,CAAC;QAEF,OAAE,GAAG,KAAK,IAAuB,EAAE;YACjC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC/B,GAAG,EAAE,KAAK;gBACV,MAAM,EAAE,KAAK;aACd,CAAC,CAAC;YACH,OAAO,GAAG,CAAC,IAAgB,CAAC;QAC9B,CAAC,CAAC;QAnBA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CAmBF;AAvBD,oDAuBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserIdentityService.js","sourceRoot":"","sources":["../../../../src/services/rest/UserIdentityService.ts"],"names":[],"mappings":";;;AAOA,MAAa,mBAAmB;IAE9B,YAAY,IAAgB;QAG5B,OAAE,GAAG,KAAK,IAA0B,EAAE;YACpC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC/B,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"UserIdentityService.js","sourceRoot":"","sources":["../../../../src/services/rest/UserIdentityService.ts"],"names":[],"mappings":";;;AAOA,MAAa,mBAAmB;IAE9B,YAAY,IAAgB;QAG5B,OAAE,GAAG,KAAK,IAA0B,EAAE;YACpC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC/B,GAAG,EAAE,KAAK;gBACV,MAAM,EAAE,KAAK;aACd,CAAC,CAAC;YACH,OAAO,GAAG,CAAC,IAAmB,CAAC;QACjC,CAAC,CAAC;QARA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CAQF;AAZD,kDAYC"}
|
package/package.json
CHANGED
package/src/dto/enums/index.ts
CHANGED
|
@@ -12,4 +12,5 @@ export * from './notification.status';
|
|
|
12
12
|
export * from './riskContributor.type';
|
|
13
13
|
export * from './saasComponentKind';
|
|
14
14
|
export * from './workflowStep.kind';
|
|
15
|
-
export * from './
|
|
15
|
+
export * from './contentStrategy.kind';
|
|
16
|
+
export * from './deliveryStrategy.kind';
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
import {BaseDto, BaseUpsertDto} from './base.dto';
|
|
2
|
-
import {NotificationStatus} from './enums';
|
|
3
|
-
import {
|
|
4
|
-
import {NotificationStepData, TrainingNotificationStepData} from './workflow.dto';
|
|
5
|
-
|
|
6
|
-
export type TemplateNotificationSchema = {
|
|
7
|
-
/** ID of the template to be used for the notification */
|
|
8
|
-
templateId: string;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export type RawNotificationSchema = {
|
|
12
|
-
/** Optional user provided notification message */
|
|
13
|
-
rawContent: string;
|
|
14
|
-
};
|
|
2
|
+
import {Category, DeliveryStrategyKind, FindingKind, FindingSeverity, NotificationStatus} from './enums';
|
|
3
|
+
import {ContentStrategyKind} from './enums/contentStrategy.kind';
|
|
15
4
|
|
|
16
5
|
export type NotificationAddress = {
|
|
17
6
|
/** Connector ID for the notification channel */
|
|
18
|
-
cid
|
|
7
|
+
cid?: string;
|
|
19
8
|
/** Group IDs to which the notification is being sent */
|
|
20
9
|
groups?: string[] | number[];
|
|
21
10
|
/** User IDs to which the notification is being sent */
|
|
@@ -24,25 +13,89 @@ export type NotificationAddress = {
|
|
|
24
13
|
webhooks?: string[];
|
|
25
14
|
};
|
|
26
15
|
|
|
16
|
+
export type FindingNotificationContext = {
|
|
17
|
+
/** Severity of the finding */
|
|
18
|
+
severity: FindingSeverity;
|
|
19
|
+
/** Category of the finding */
|
|
20
|
+
category: Category;
|
|
21
|
+
/** Kind of the finding */
|
|
22
|
+
kind: FindingKind;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type UserNotificationContext = {
|
|
26
|
+
/** First name of the user */
|
|
27
|
+
firstName: string;
|
|
28
|
+
/** Last name of the user */
|
|
29
|
+
lastName: string;
|
|
30
|
+
/** Title of the user */
|
|
31
|
+
title: string;
|
|
32
|
+
/** Department of the user */
|
|
33
|
+
department: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type ProviderNotificationContext = {
|
|
37
|
+
/** Name of the provider */
|
|
38
|
+
displayValue: string;
|
|
39
|
+
/** Categories to which the provider applies */
|
|
40
|
+
categories: string[];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type NotificationContext = {
|
|
44
|
+
// TODO: determine what this should be
|
|
45
|
+
// component?: ComponentNotificationContext;
|
|
46
|
+
finding?: FindingNotificationContext;
|
|
47
|
+
provider?: ProviderNotificationContext;
|
|
48
|
+
user?: UserNotificationContext;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type ContentStrategySpecification = {
|
|
52
|
+
/** Kind of the content strategy */
|
|
53
|
+
kind: ContentStrategyKind;
|
|
54
|
+
/** Data to be used for the notification */
|
|
55
|
+
data?: {
|
|
56
|
+
[propName: string]: string | number | boolean;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type TemplateContentStrategySpec = ContentStrategySpecification & {
|
|
61
|
+
/** ID of the template to be used for the notification */
|
|
62
|
+
templateId: string;
|
|
63
|
+
/** Context for the notification */
|
|
64
|
+
context: NotificationContext;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type RawContentStrategySpec = ContentStrategySpecification & {
|
|
68
|
+
/** Content of the notification */
|
|
69
|
+
content: string;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export type LlmContentStrategySpec = ContentStrategySpecification & {
|
|
73
|
+
/** Context for the notification */
|
|
74
|
+
context: NotificationContext;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export type DeliveryStrategySpec = {
|
|
78
|
+
/** Channel type that should be used for sending the notificaiton */
|
|
79
|
+
kind: DeliveryStrategyKind;
|
|
80
|
+
/** Recipient address to which the notification is being sent */
|
|
81
|
+
to: NotificationAddress;
|
|
82
|
+
};
|
|
83
|
+
|
|
27
84
|
export type NotificationUpsertDto = BaseUpsertDto & {
|
|
28
|
-
/** Kind of the notification */
|
|
29
|
-
kind: NotificationKind;
|
|
30
85
|
/** Workflow ID for which the notification is being created */
|
|
31
86
|
wfid: string;
|
|
32
|
-
/** Finding ID for which the notification is being created */
|
|
33
|
-
fid?: string;
|
|
34
|
-
/** Recipient address to which the notification is being sent */
|
|
35
|
-
to: NotificationAddress;
|
|
36
|
-
/** ID of the user to which the notification is being sent */
|
|
37
|
-
uid?: string;
|
|
38
87
|
/** Step number in the workflow for which the notification is being created */
|
|
39
88
|
stepNumber: number;
|
|
40
89
|
/** Status of the notification */
|
|
41
90
|
status: NotificationStatus;
|
|
42
91
|
/** Data to be used for the notification */
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
|
|
92
|
+
contentStrategy: TemplateContentStrategySpec | RawContentStrategySpec | LlmContentStrategySpec;
|
|
93
|
+
/** Method of delivery */
|
|
94
|
+
deliveryStrategy: DeliveryStrategySpec;
|
|
95
|
+
/** Finding ID for which the notification is being created */
|
|
96
|
+
fid?: string | null;
|
|
97
|
+
/** ID of the user to which the notification is being sent */
|
|
98
|
+
uid?: string | null;
|
|
46
99
|
};
|
|
47
100
|
|
|
48
101
|
export type NotificationDto = NotificationUpsertDto & BaseDto;
|
package/src/dto/workflow.dto.ts
CHANGED
|
@@ -1,47 +1,49 @@
|
|
|
1
1
|
import {BaseDto} from './base.dto';
|
|
2
|
-
import {
|
|
2
|
+
import {ContentStrategyKind, DeliveryStrategyKind} from './enums';
|
|
3
|
+
import {RequiredDataProperty} from './enums/requiredDataProperty.enum';
|
|
3
4
|
import {WorkflowStepKind} from './enums/workflowStep.kind';
|
|
4
5
|
import {WorkflowTriggerKind} from './enums/workflowTrigger.kind';
|
|
5
|
-
import {TemplateNotificationSchema, RawNotificationSchema} from './notification.dto';
|
|
6
6
|
|
|
7
|
-
export type
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
export type WorflowStepDescriptor = {
|
|
8
|
+
/** Type of the notification step, either NOTIFICATION or PAUSE */
|
|
9
|
+
kind: WorkflowStepKind;
|
|
10
|
+
/** Optional default values to be used of no other is provided */
|
|
11
|
+
defaults?: {
|
|
12
|
+
[propName: string]: string | number | boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type NotificationStepDescriptor = WorflowStepDescriptor & {
|
|
17
|
+
/** Delivery strategy to be used for the notification */
|
|
18
|
+
deliveryStrategyKinds: DeliveryStrategyKind[];
|
|
19
|
+
/** Required data properties for the notification */
|
|
20
|
+
requiredData: RequiredDataProperty[];
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type PauseStepDescriptor = WorflowStepDescriptor & {
|
|
24
|
+
/** Duration, in days, to wait before executing the next step in the workflow */
|
|
25
|
+
pauseDuration: number;
|
|
14
26
|
};
|
|
15
27
|
|
|
16
|
-
export type
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
/** Date on which the user enrolled in the training module */
|
|
20
|
-
enrollDate?: string;
|
|
21
|
-
/** Date on which the user started the training module */
|
|
22
|
-
startDate?: string;
|
|
28
|
+
export type ContentDescriptor = {
|
|
29
|
+
/** Kind of the content that will be generated for the notification */
|
|
30
|
+
kind: ContentStrategyKind;
|
|
23
31
|
};
|
|
24
32
|
|
|
25
|
-
export type
|
|
26
|
-
/**
|
|
27
|
-
|
|
33
|
+
export type TemplateContentDescriptor = ContentDescriptor & {
|
|
34
|
+
/** ID of the template to be used for the notification */
|
|
35
|
+
templateId: string;
|
|
28
36
|
};
|
|
29
37
|
|
|
30
38
|
export type WorkflowStep = {
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
/** Schema for the notification step */
|
|
36
|
-
schema?: TemplateNotificationSchema | RawNotificationSchema;
|
|
37
|
-
/** Data associated with the notification step */
|
|
38
|
-
data: NotificationStepData | TrainingNotificationStepData | PauseStepData;
|
|
39
|
+
/** Indicates the type of workflow step and contains relevant information for each */
|
|
40
|
+
stepDescriptor: NotificationStepDescriptor | PauseStepDescriptor;
|
|
41
|
+
/** Content to be used for the notification */
|
|
42
|
+
contentDescriptor?: ContentDescriptor | TemplateContentDescriptor;
|
|
39
43
|
/** Step number to transition the workflow to on success */
|
|
40
44
|
successStepNumber: number | null;
|
|
41
45
|
/** Step number to transition the workflow to on failure */
|
|
42
46
|
failureStepNumber: number | null;
|
|
43
|
-
/** Duration, in days, to wait before executing the next step in the workflow */
|
|
44
|
-
pauseDuration?: number | null;
|
|
45
47
|
};
|
|
46
48
|
|
|
47
49
|
export type WorkflowSteps = {
|
|
@@ -61,7 +63,7 @@ export type WorkflowTriggerRule = {
|
|
|
61
63
|
};
|
|
62
64
|
|
|
63
65
|
export type WorkflowTrigger = {
|
|
64
|
-
/**
|
|
66
|
+
/** Kind of the trigger */
|
|
65
67
|
kind: WorkflowTriggerKind;
|
|
66
68
|
/** Rule to which the applicable entity type must conform to trigger the workflow */
|
|
67
69
|
rule: unknown;
|
|
@@ -38,13 +38,13 @@ export class EngageApi {
|
|
|
38
38
|
readonly settings: AmpSettingsService;
|
|
39
39
|
|
|
40
40
|
constructor(rest: RestClient) {
|
|
41
|
-
this.connectors = new AmpEntityServiceImpl<ConnectorUpsertDto, ConnectorDto>(rest, KIND.CONNECTORS, TARGET_API_ENGAGE);
|
|
41
|
+
this.connectors = new AmpEntityServiceImpl<ConnectorUpsertDto, ConnectorDto>(rest, KIND.CONNECTORS, TARGET_API_ENGAGE);
|
|
42
42
|
this.findings = new AmpPatchDataServiceImpl<FindingsStatusPatchDto, FindingDto>(rest, KIND.FINDINGS, TARGET_API_ENGAGE);
|
|
43
43
|
this.identity = new UserIdentityService(rest);
|
|
44
|
-
this.notifications = new AmpDataServiceImpl<NotificationDto>(rest, KIND.NOTIFICATIONS, TARGET_API_ENGAGE);
|
|
44
|
+
this.notifications = new AmpDataServiceImpl<NotificationDto>(rest, KIND.NOTIFICATIONS, TARGET_API_ENGAGE);
|
|
45
45
|
this.providers = new AmpDataServiceImpl<ProviderDto>(rest, KIND.PROVIDERS, TARGET_API_AGENT);
|
|
46
46
|
this.reports = new AmpReportServiceImpl(rest);
|
|
47
|
-
this.settings = new AmpSettingsService(rest); // TODO:
|
|
47
|
+
this.settings = new AmpSettingsService(rest); // TODO: confirm it is not needed. Currently returns NOT_IMPLEMENTED error code
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
static instance(options: EngageApiOptions): EngageApi {
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotificationKind = void 0;
|
|
4
|
-
/* eslint-disable no-unused-vars */
|
|
5
|
-
var NotificationKind;
|
|
6
|
-
(function (NotificationKind) {
|
|
7
|
-
NotificationKind["LLM"] = "LLM";
|
|
8
|
-
NotificationKind["RAW"] = "RAW";
|
|
9
|
-
NotificationKind["TEMPLATE"] = "TEMPLATE";
|
|
10
|
-
})(NotificationKind || (exports.NotificationKind = NotificationKind = {}));
|
|
11
|
-
//# sourceMappingURL=notification.kind.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notification.kind.js","sourceRoot":"","sources":["../../../../src/dto/enums/notification.kind.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,+BAAW,CAAA;IACX,yCAAqB,CAAA;AACvB,CAAC,EAJW,gBAAgB,gCAAhB,gBAAgB,QAI3B"}
|