@ampsec/platform-client 50.1.0 → 52.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.
Files changed (36) hide show
  1. package/build/src/dto/enums/callToAction.enum.d.ts +5 -0
  2. package/build/src/dto/enums/callToAction.enum.js +11 -0
  3. package/build/src/dto/enums/callToAction.enum.js.map +1 -0
  4. package/build/src/dto/enums/contact.type.d.ts +3 -0
  5. package/build/src/dto/{messagingChannels/slackMessage.dto.js → enums/contact.type.js} +1 -1
  6. package/build/src/dto/enums/contact.type.js.map +1 -0
  7. package/build/src/dto/enums/index.d.ts +2 -0
  8. package/build/src/dto/enums/index.js +2 -0
  9. package/build/src/dto/enums/index.js.map +1 -1
  10. package/build/src/dto/messagingChannels/channelMessage.dto.d.ts +24 -0
  11. package/build/src/dto/messagingChannels/channelMessage.dto.js +3 -0
  12. package/build/src/dto/messagingChannels/channelMessage.dto.js.map +1 -0
  13. package/build/src/dto/messagingChannels/index.d.ts +1 -1
  14. package/build/src/dto/messagingChannels/index.js +1 -1
  15. package/build/src/dto/messagingChannels/index.js.map +1 -1
  16. package/build/src/services/rest/ConnectorInstallService.d.ts +4 -0
  17. package/build/src/services/rest/ConnectorInstallService.js +12 -0
  18. package/build/src/services/rest/ConnectorInstallService.js.map +1 -1
  19. package/build/src/services/rest/RestClient.d.ts +3 -1
  20. package/build/src/services/rest/RestClient.js +1 -1
  21. package/build/src/services/rest/RestClient.js.map +1 -1
  22. package/build/src/settings.d.ts +7 -4
  23. package/build/src/settings.js +64 -39
  24. package/build/src/settings.js.map +1 -1
  25. package/package.json +1 -1
  26. package/src/dto/enums/callToAction.enum.ts +6 -0
  27. package/src/dto/enums/contact.type.ts +4 -0
  28. package/src/dto/enums/index.ts +2 -0
  29. package/src/dto/messagingChannels/channelMessage.dto.ts +26 -0
  30. package/src/dto/messagingChannels/index.ts +1 -1
  31. package/src/services/rest/ConnectorInstallService.ts +13 -0
  32. package/src/services/rest/RestClient.ts +4 -2
  33. package/src/settings.ts +73 -42
  34. package/build/src/dto/messagingChannels/slackMessage.dto.d.ts +0 -9
  35. package/build/src/dto/messagingChannels/slackMessage.dto.js.map +0 -1
  36. package/src/dto/messagingChannels/slackMessage.dto.ts +0 -10
@@ -0,0 +1,5 @@
1
+ export declare enum CallToAction {
2
+ CONTACT_SECURITY = "CONTACT_SECURITY",
3
+ HELP = "HELP",
4
+ MARK_COMPLETE = "MARK_COMPLETE"
5
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CallToAction = void 0;
4
+ /* eslint-disable no-unused-vars */
5
+ var CallToAction;
6
+ (function (CallToAction) {
7
+ CallToAction["CONTACT_SECURITY"] = "CONTACT_SECURITY";
8
+ CallToAction["HELP"] = "HELP";
9
+ CallToAction["MARK_COMPLETE"] = "MARK_COMPLETE";
10
+ })(CallToAction || (exports.CallToAction = CallToAction = {}));
11
+ //# sourceMappingURL=callToAction.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callToAction.enum.js","sourceRoot":"","sources":["../../../../src/dto/enums/callToAction.enum.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qDAAqC,CAAA;IACrC,6BAAa,CAAA;IACb,+CAA+B,CAAA;AACjC,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB"}
@@ -0,0 +1,3 @@
1
+ export type Contact = {
2
+ email: string;
3
+ };
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=slackMessage.dto.js.map
3
+ //# sourceMappingURL=contact.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contact.type.js","sourceRoot":"","sources":["../../../../src/dto/enums/contact.type.ts"],"names":[],"mappings":""}
@@ -1,8 +1,10 @@
1
1
  export * from './auth.role';
2
2
  export * from './agent.status';
3
3
  export * from './ampSettingKeys.enum';
4
+ export * from './callToAction.enum';
4
5
  export * from './category';
5
6
  export * from './connector.status';
7
+ export * from './contact.type';
6
8
  export * from './contentStrategy.kind';
7
9
  export * from './deliveryStrategy.kind';
8
10
  export * from './findingKind';
@@ -17,8 +17,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./auth.role"), exports);
18
18
  __exportStar(require("./agent.status"), exports);
19
19
  __exportStar(require("./ampSettingKeys.enum"), exports);
20
+ __exportStar(require("./callToAction.enum"), exports);
20
21
  __exportStar(require("./category"), exports);
21
22
  __exportStar(require("./connector.status"), exports);
23
+ __exportStar(require("./contact.type"), exports);
22
24
  __exportStar(require("./contentStrategy.kind"), exports);
23
25
  __exportStar(require("./deliveryStrategy.kind"), exports);
24
26
  __exportStar(require("./findingKind"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,iDAA+B;AAC/B,wDAAsC;AACtC,6CAA2B;AAC3B,qDAAmC;AACnC,yDAAuC;AACvC,0DAAwC;AACxC,gDAA8B;AAC9B,qDAAmC;AACnC,mDAAiC;AACjC,oDAAkC;AAClC,oDAAkC;AAClC,wDAAsC;AACtC,wDAAsC;AACtC,8DAA4C;AAC5C,yDAAuC;AACvC,sDAAoC;AACpC,qEAAmD;AACnD,sDAAoC;AACpC,yDAAuC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,iDAA+B;AAC/B,wDAAsC;AACtC,sDAAoC;AACpC,6CAA2B;AAC3B,qDAAmC;AACnC,iDAA+B;AAC/B,yDAAuC;AACvC,0DAAwC;AACxC,gDAA8B;AAC9B,qDAAmC;AACnC,mDAAiC;AACjC,oDAAkC;AAClC,oDAAkC;AAClC,wDAAsC;AACtC,wDAAsC;AACtC,8DAA4C;AAC5C,yDAAuC;AACvC,sDAAoC;AACpC,qEAAmD;AACnD,sDAAoC;AACpC,yDAAuC"}
@@ -0,0 +1,24 @@
1
+ import { CallToAction } from '../enums';
2
+ import { Notifiable } from './notifiable.dto';
3
+ export type MessageContent = {
4
+ /** Header of the message */
5
+ header?: string;
6
+ /** Body of the message */
7
+ body: string;
8
+ /** Additional information to be included in the message */
9
+ additionalInfo?: string[];
10
+ };
11
+ export type ChannelMessageDto = Notifiable & {
12
+ /** Slack user IDs to which the notification is being sent */
13
+ users: string[] | number[];
14
+ /** Message content to be sent in the Slack message */
15
+ content: MessageContent;
16
+ /** ID of the tenant to which the notification belongs: required if the notificaiton should allow for the user to contact the security or IT team */
17
+ tid: string;
18
+ /** ID of the finding to which the notification is in regards to: required if the notification should allow for the user marking a finding as complete */
19
+ fid?: string;
20
+ /** Metadata for the message */
21
+ meta?: unknown;
22
+ /** Calls to action to be included in the message */
23
+ actions: CallToAction[];
24
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=channelMessage.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channelMessage.dto.js","sourceRoot":"","sources":["../../../../src/dto/messagingChannels/channelMessage.dto.ts"],"names":[],"mappings":""}
@@ -1,3 +1,3 @@
1
- export * from './slackMessage.dto';
1
+ export * from './channelMessage.dto';
2
2
  export * from './email.dto';
3
3
  export * from './notifiable.dto';
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./slackMessage.dto"), exports);
17
+ __exportStar(require("./channelMessage.dto"), exports);
18
18
  __exportStar(require("./email.dto"), exports);
19
19
  __exportStar(require("./notifiable.dto"), exports);
20
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/messagingChannels/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,8CAA4B;AAC5B,mDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/messagingChannels/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,8CAA4B;AAC5B,mDAAiC"}
@@ -6,7 +6,11 @@ export declare class ConnectorInstallService {
6
6
  credentials: (cid: string, credentials: {
7
7
  [key: string]: unknown;
8
8
  }) => Promise<boolean>;
9
+ getOauthInstallUrl: (cid: string, provider: string, clientRedirectUrl: string) => Promise<string>;
10
+ /** @deprecated */
9
11
  getInstallToken: (cid: string) => Promise<string>;
12
+ /** @deprecated */
10
13
  getRedirectUrl: (token: string) => Promise<string>;
14
+ /** @deprecated */
11
15
  buildInstallOAuthUrl: (token: string, redirectUrl: string) => string;
12
16
  }
@@ -12,6 +12,16 @@ class ConnectorInstallService {
12
12
  const success = res.data.success;
13
13
  return success;
14
14
  };
15
+ this.getOauthInstallUrl = async (cid, provider, clientRedirectUrl) => {
16
+ const res = await this.rest.call({
17
+ url: `/${this.targetApi}/v1/install/oauth/token`,
18
+ method: 'POST',
19
+ data: { cid },
20
+ });
21
+ const token = res.data.token;
22
+ return `${this.rest.baseUrl}/${this.targetApi}/v1/install/oauth/${provider}/login?token=${token}&redirectUrl=${encodeURIComponent(clientRedirectUrl)}`;
23
+ };
24
+ /** @deprecated */
15
25
  this.getInstallToken = async (cid) => {
16
26
  const res = await this.rest.call({
17
27
  url: `/${this.targetApi}/v1/install/oauth/token`,
@@ -21,6 +31,7 @@ class ConnectorInstallService {
21
31
  const token = res.data.token;
22
32
  return token;
23
33
  };
34
+ /** @deprecated */
24
35
  this.getRedirectUrl = async (token) => {
25
36
  const res = await this.rest.call({
26
37
  url: `/${this.targetApi}/v1/install/oauth/login`,
@@ -30,6 +41,7 @@ class ConnectorInstallService {
30
41
  const redirectUrl = res.data.redirect;
31
42
  return redirectUrl;
32
43
  };
44
+ /** @deprecated */
33
45
  this.buildInstallOAuthUrl = (token, redirectUrl) => {
34
46
  return `/${this.targetApi}/v1/install/oauth?token=${token}&redirect=${encodeURIComponent(redirectUrl)}`;
35
47
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectorInstallService.js","sourceRoot":"","sources":["../../../../src/services/rest/ConnectorInstallService.ts"],"names":[],"mappings":";;;AAEA,MAAa,uBAAuB;IAIlC,YAAY,IAAgB,EAAE,SAAiB;QAK/C,gBAAW,GAAG,KAAK,EAAE,GAAW,EAAE,WAAqC,EAAoB,EAAE;YAC3F,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC/B,GAAG,EAAE,IAAI,IAAI,CAAC,SAAS,yBAAyB;gBAChD,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,EAAC,GAAG,EAAE,WAAW,EAAC;aACzB,CAAC,CAAC;YACH,MAAM,OAAO,GAAI,GAAG,CAAC,IAA2B,CAAC,OAAO,CAAC;YAEzD,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;QAEF,oBAAe,GAAG,KAAK,EAAE,GAAW,EAAmB,EAAE;YACvD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC/B,GAAG,EAAE,IAAI,IAAI,CAAC,SAAS,yBAAyB;gBAChD,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,EAAC,GAAG,EAAC;aACZ,CAAC,CAAC;YACH,MAAM,KAAK,GAAI,GAAG,CAAC,IAAwB,CAAC,KAAK,CAAC;YAClD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC;QAEF,mBAAc,GAAG,KAAK,EAAE,KAAa,EAAmB,EAAE;YACxD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,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AE,CAAC;QAC1G,CAAC,CAAC;QAlDA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CAiDF;AAxDD,0DAwDC"}
@@ -31,6 +31,7 @@ export type RestClientOptions = {
31
31
  * RestClient is a generic interface for making REST calls.
32
32
  */
33
33
  export interface RestClient {
34
+ baseUrl?: string;
34
35
  strict: boolean;
35
36
  call(_request: RestRequest): Promise<RestResponse>;
36
37
  }
@@ -41,11 +42,12 @@ export interface RestClient {
41
42
  *
42
43
  * These strategies can be useful when scraping 3rd party APIs.
43
44
  */
44
- export declare class DefaultRestClient {
45
+ export declare class DefaultRestClient implements RestClient {
45
46
  protected readonly ampAxios: Axios;
46
47
  protected readonly retryStrategy: RestClientRetryStrategy;
47
48
  protected readonly rateLimitStrategy: RestClientRateLimitStrategy;
48
49
  protected readonly logger: AmpLogger;
50
+ readonly baseUrl?: string;
49
51
  readonly strict: boolean;
50
52
  constructor(options?: RestClientOptions);
51
53
  call: (request: RestRequest) => Promise<RestResponse>;
@@ -81,7 +81,6 @@ class DefaultRestClient {
81
81
  throw err;
82
82
  }
83
83
  };
84
- // TODO: rest client
85
84
  const client = (_a = options.client) !== null && _a !== void 0 ? _a : axios_1.default;
86
85
  this.ampAxios = client.create({
87
86
  baseURL: options.baseUrl,
@@ -100,6 +99,7 @@ class DefaultRestClient {
100
99
  this.ampAxios.defaults.headers.put['Content-Type'] = 'application/json';
101
100
  this.retryStrategy = (_d = options.retryStrategy) !== null && _d !== void 0 ? _d : retry_rest_1.noopRestRetryStrategy;
102
101
  this.rateLimitStrategy = (_e = options.rateLimitStrategy) !== null && _e !== void 0 ? _e : rateLimit_rest_1.noopRestClientRateLimitStrategy;
102
+ this.baseUrl = options.baseUrl;
103
103
  this.strict = (_f = options.strict) !== null && _f !== void 0 ? _f : false;
104
104
  }
105
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RestClient.js","sourceRoot":"","s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E,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;QACxE,IAAI,CAAC,aAAa,GAAG,MAAA,OAAO,CAAC,aAAa,mCAAI,kCAAqB,CAAC;QACpE,IAAI,CAAC,iBAAiB,GAAG,MAAA,OAAO,CAAC,iBAAiB,mCAAI,gDAA+B,CAAC;QACtF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,KAAK,CAAC;IACxC,CAAC;CAoCF;AAhED,8CAgEC;AAEM,MAAM,gBAAgB,GAAG,CAAC,OAA6B,EAAc,EAAE;IAC5E,MAAM,SAAS,GAAG,IAAI,iBAAiB,CAAC;QACtC,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,OAAO,CAAC,KAAK,EAAE;SACzC;QACD,iBAAiB,EAAE,IAAI,kDAAiC,CAAC,EAAE,CAAC;QAC5D,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IACH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAZW,QAAA,gBAAgB,oBAY3B"}
@@ -1,8 +1,9 @@
1
+ import { Contact } from './dto';
1
2
  /**
2
3
  * Collection of hard coded settings to be use centrally across services and user interfaces.
3
4
  *
4
5
  * # Naming convention:
5
- * Keys should be name spaced following dot notation, e.g. notifications.ghost_mode.enabled`.
6
+ * Keys should be name spaced following dot notation and camel case, e.g. notifications.ghostMode.enabled`.
6
7
  *
7
8
  * ## Use Cases
8
9
  * 1. Boolean "enabled" toggles should end in `*.enabled`. You should never use the inverse `*.disabled`
@@ -21,10 +22,14 @@ export declare const AMP_SETTINGS: {
21
22
  * These are tenant level settings that are not meant to be overridden at the connector level
22
23
  */
23
24
  tenant: {
25
+ /** Specifies the default connector for the `messages` delivery strategy. */
26
+ DEFAULT_NOTIFICATION_CONNECTOR_ID: import("./services").TypedAmpSettingsKey<string | undefined>;
24
27
  /** Disables all automated messages from being sent to end users. */
25
28
  GHOST_MODE: import("./services").TypedAmpSettingsKey<boolean>;
26
29
  /** Enables mock providers on the tenant. */
27
30
  ENABLE_MOCKS: import("./services").TypedAmpSettingsKey<boolean>;
31
+ /** Email address for the tenant's IT/Security team */
32
+ IT_SECURITY_CONTACT: import("./services").TypedAmpSettingsKey<Contact | undefined>;
28
33
  /**
29
34
  * Specifies which mock tenant to use.
30
35
  * - `david`: single insecure user
@@ -34,14 +39,12 @@ export declare const AMP_SETTINGS: {
34
39
  * - `ingen`: mocked data for ~250 users
35
40
  */
36
41
  MOCK_TENANT_ID: import("./services").TypedAmpSettingsKey<string>;
37
- /** Specifies the default connector for the `messages` delivery strategy. */
38
- DEFAULT_NOTIFICATION_CONNECTOR_ID: import("./services").TypedAmpSettingsKey<string | undefined>;
39
42
  };
40
43
  /**
41
44
  * GLOBAL
42
45
  * Note: these can be overridden by connector level settings
43
46
  */
44
- inherited: {
47
+ connectorDefaults: {
45
48
  /** Not currently implemented/respected */
46
49
  NOTIFICATIONS_ENABLED: import("./services").TypedAmpSettingsKey<boolean>;
47
50
  };
@@ -2,12 +2,68 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AMP_SETTINGS = void 0;
4
4
  const services_1 = require("./services");
5
- // TODO document this object
5
+ /**************************
6
+ * GLOBAL SETTINGS *
7
+ *************************/
8
+ /**
9
+ * GLOBAL ONLY
10
+ * ===========
11
+ * These are tenant level settings that are not meant to be overridden at the connector level
12
+ */
13
+ const TENANT_SETTINGS = {
14
+ /** Disables all automated messages from being sent to end users. */
15
+ GHOST_MODE: services_1.AmpSettingsMap.asKey('notifications.ghostMode.enabled', true),
16
+ /** Enables mock providers on the tenant. */
17
+ ENABLE_MOCKS: services_1.AmpSettingsMap.asKey('mocks.enabled', false),
18
+ /** Email address for the tenant's IT/Security team */
19
+ IT_SECURITY_CONTACT: services_1.AmpSettingsMap.asKey('tenant.itSecurityContact'),
20
+ /**
21
+ * Specifies which mock tenant to use.
22
+ * - `david`: single insecure user
23
+ * - `ampsec`: founding team of amplifier security with mock data
24
+ * - `stryper`: branded small test tenant
25
+ * - `acme`: mocked data for ~25 users
26
+ * - `ingen`: mocked data for ~250 users
27
+ */
28
+ MOCK_TENANT_ID: services_1.AmpSettingsMap.asKey('mocks.tenant.id', 'stryper'),
29
+ };
30
+ /**
31
+ * GLOBAL CONNECTOR DEFAULTS
32
+ * Note: these can be overridden by connector level settings
33
+ */
34
+ const GLOBAL_CONNECTOR_DEFAULT_SETTINGS = {
35
+ /** Not currently implemented/respected */
36
+ NOTIFICATIONS_ENABLED: services_1.AmpSettingsMap.asKey('notifications.enabled', false),
37
+ };
38
+ /********************
39
+ * PROVIDERS *
40
+ ********************/
41
+ const GOOGLE_SETTINGS = {
42
+ GOOGLE_EXECUTIVE_GROUPS: services_1.AmpSettingsMap.asKey('google.groups.exec.extIds', []),
43
+ GOOGLE_PROD_ACCESS_GROUPS: services_1.AmpSettingsMap.asKey('google.groups.prod.extIds', []),
44
+ GOOGLE_PRIV_ACCESS_GROUPS: services_1.AmpSettingsMap.asKey('google.groups.priv.extIds', []),
45
+ GOOGLE_SERV_ACCT_GROUPS: services_1.AmpSettingsMap.asKey('google.groups.servAcct.extIds', []),
46
+ };
47
+ const OKTA_SETTINGS = {
48
+ OKTA_EXECUTIVE_GROUPS: services_1.AmpSettingsMap.asKey('okta.groups.exec.extIds', []),
49
+ OKTA_PROD_ACCESS_GROUPS: services_1.AmpSettingsMap.asKey('okta.groups.prod.extIds', []),
50
+ OKTA_PRIV_ACCESS_GROUPS: services_1.AmpSettingsMap.asKey('okta.groups.priv.extIds', []),
51
+ OKTA_SERV_ACCT_GROUPS: services_1.AmpSettingsMap.asKey('okta.groups.servAcct.extIds', []),
52
+ };
53
+ const SLACK_SETTINGS = {
54
+ SLACK_EXECUTIVE_GROUPS: services_1.AmpSettingsMap.asKey('slack.groups.exec.extIds', []),
55
+ SLACK_PROD_ACCESS_GROUPS: services_1.AmpSettingsMap.asKey('slack.groups.prod.extIds', []),
56
+ SLACK_PRIV_ACCESS_GROUPS: services_1.AmpSettingsMap.asKey('slack.groups.priv.extIds', []),
57
+ SLACK_SERV_ACCT_GROUPS: services_1.AmpSettingsMap.asKey('slack.groups.servAcct.extIds', []),
58
+ SLACK_CONTACT_SECURITY_CHANNEL: services_1.AmpSettingsMap.asKey('slack.channels.security.extId'),
59
+ // TODO localization... does this get moved to contentful? Does the setting "point" to content in contentful?
60
+ SLACK_CONTACT_SECURITY_TEMPLATE: services_1.AmpSettingsMap.asKey('slack.templates.contactSecurity', 'Thanks for getting in touch! We forwarded your message to our security team and they will get back to you shortly.'),
61
+ };
6
62
  /**
7
63
  * Collection of hard coded settings to be use centrally across services and user interfaces.
8
64
  *
9
65
  * # Naming convention:
10
- * Keys should be name spaced following dot notation, e.g. notifications.ghost_mode.enabled`.
66
+ * Keys should be name spaced following dot notation and camel case, e.g. notifications.ghostMode.enabled`.
11
67
  *
12
68
  * ## Use Cases
13
69
  * 1. Boolean "enabled" toggles should end in `*.enabled`. You should never use the inverse `*.disabled`
@@ -26,19 +82,7 @@ exports.AMP_SETTINGS = {
26
82
  * These are tenant level settings that are not meant to be overridden at the connector level
27
83
  */
28
84
  tenant: {
29
- /** Disables all automated messages from being sent to end users. */
30
- GHOST_MODE: services_1.AmpSettingsMap.asKey('notifications.ghost_mode.enabled', false),
31
- /** Enables mock providers on the tenant. */
32
- ENABLE_MOCKS: services_1.AmpSettingsMap.asKey('mocks.enabled', false),
33
- /**
34
- * Specifies which mock tenant to use.
35
- * - `david`: single insecure user
36
- * - `ampsec`: founding team of amplifier security with mock data
37
- * - `stryper`: branded small test tenant
38
- * - `acme`: mocked data for ~25 users
39
- * - `ingen`: mocked data for ~250 users
40
- */
41
- MOCK_TENANT_ID: services_1.AmpSettingsMap.asKey('mocks.tenant.id', 'stryper'),
85
+ ...TENANT_SETTINGS,
42
86
  /** Specifies the default connector for the `messages` delivery strategy. */
43
87
  DEFAULT_NOTIFICATION_CONNECTOR_ID: services_1.AmpSettingsMap.asKey('notifications.connectors.default.cid'),
44
88
  },
@@ -46,33 +90,14 @@ exports.AMP_SETTINGS = {
46
90
  * GLOBAL
47
91
  * Note: these can be overridden by connector level settings
48
92
  */
49
- inherited: {
50
- /** Not currently implemented/respected */
51
- NOTIFICATIONS_ENABLED: services_1.AmpSettingsMap.asKey('notifications.enabled', false),
93
+ connectorDefaults: {
94
+ ...GLOBAL_CONNECTOR_DEFAULT_SETTINGS,
52
95
  },
53
96
  /********************
54
97
  * PROVIDERS *
55
98
  ********************/
56
- google: {
57
- GOOGLE_EXECUTIVE_GROUPS: services_1.AmpSettingsMap.asKey('google.groups.exec.extIds', []),
58
- GOOGLE_PROD_ACCESS_GROUPS: services_1.AmpSettingsMap.asKey('google.groups.prod.extIds', []),
59
- GOOGLE_PRIV_ACCESS_GROUPS: services_1.AmpSettingsMap.asKey('google.groups.priv.extIds', []),
60
- GOOGLE_SERV_ACCT_GROUPS: services_1.AmpSettingsMap.asKey('google.groups.serv_acct.extIds', []),
61
- },
62
- okta: {
63
- OKTA_EXECUTIVE_GROUPS: services_1.AmpSettingsMap.asKey('okta.groups.exec.extIds', []),
64
- OKTA_PROD_ACCESS_GROUPS: services_1.AmpSettingsMap.asKey('okta.groups.prod.extIds', []),
65
- OKTA_PRIV_ACCESS_GROUPS: services_1.AmpSettingsMap.asKey('okta.groups.priv.extIds', []),
66
- OKTA_SERV_ACCT_GROUPS: services_1.AmpSettingsMap.asKey('okta.groups.serv_acct.extIds', []),
67
- },
68
- slack: {
69
- SLACK_EXECUTIVE_GROUPS: services_1.AmpSettingsMap.asKey('slack.groups.exec.extIds', []),
70
- SLACK_PROD_ACCESS_GROUPS: services_1.AmpSettingsMap.asKey('slack.groups.prod.extIds', []),
71
- SLACK_PRIV_ACCESS_GROUPS: services_1.AmpSettingsMap.asKey('slack.groups.priv.extIds', []),
72
- SLACK_SERV_ACCT_GROUPS: services_1.AmpSettingsMap.asKey('slack.groups.serv_acct.extIds', []),
73
- SLACK_CONTACT_SECURITY_CHANNEL: services_1.AmpSettingsMap.asKey('slack.channels.contact_security.extId'),
74
- // TODO localization... does this get moved to contentful? Does the setting "point" to content in contentful?
75
- SLACK_CONTACT_SECURITY_TEMPLATE: services_1.AmpSettingsMap.asKey('slack.templates.contact_security', 'Thanks for getting in touch! We forwarded your message to our security team and they will get back to you shortly.'),
76
- },
99
+ google: { ...GOOGLE_SETTINGS },
100
+ okta: { ...OKTA_SETTINGS },
101
+ slack: { ...SLACK_SETTINGS },
77
102
  };
78
103
  //# sourceMappingURL=settings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/settings.ts"],"names":[],"mappings":";;;AAAA,yCAA0C;AAE1C,4BAA4B;AAC5B;;;;;;;;;;;;;;;GAeG;AACU,QAAA,YAAY,GAAG;IAC1B;;;;OAIG;IACH,MAAM,EAAE;QACN,oEAAoE;QACpE,UAAU,EAAE,yBAAc,CAAC,KAAK,CAAU,kCAAkC,EAAE,KAAK,CAAC;QACpF,4CAA4C;QAC5C,YAAY,EAAE,yBAAc,CAAC,KAAK,CAAU,eAAe,EAAE,KAAK,CAAC;QACnE;;;;;;;WAOG;QACH,cAAc,EAAE,yBAAc,CAAC,KAAK,CAAS,iBAAiB,EAAE,SAAS,CAAC;QAC1E,4EAA4E;QAC5E,iCAAiC,EAAE,yBAAc,CAAC,KAAK,CAAqB,sCAAsC,CAAC;KACpH;IACD;;;OAGG;IACH,SAAS,EAAE;QACT,0CAA0C;QAC1C,qBAAqB,EAAE,yBAAc,CAAC,KAAK,CAAU,uBAAuB,EAAE,KAAK,CAAC;KACrF;IACD;;0BAEsB;IACtB,MAAM,EAAE;QACN,uBAAuB,EAAE,yBAAc,C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,yBAAc,CAAC,KAAK,CAAW,0BAA0B,EAAE,EAAE,CAAC;IACxF,wBAAwB,EAAE,yBAAc,CAAC,KAAK,CAAW,0BAA0B,EAAE,EAAE,CAAC;IACxF,sBAAsB,EAAE,yBAAc,CAAC,KAAK,CAAW,8BAA8B,EAAE,EAAE,CAAC;IAC1F,8BAA8B,EAAE,yBAAc,CAAC,KAAK,CAAqB,+BAA+B,CAAC;IACzG,6GAA6G;IAC7G,+BAA+B,EAAE,yBAAc,CAAC,KAAK,CACnD,iCAAiC,EACjC,oHAAoH,CACrH;CACF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACU,QAAA,YAAY,GAAG;IAC1B;;;;OAIG;IACH,MAAM,EAAE;QACN,GAAG,eAAe;QAClB,4EAA4E;QAC5E,iCAAiC,EAAE,yBAAc,CAAC,KAAK,CAAqB,sCAAsC,CAAC;KACpH;IACD;;;OAGG;IACH,iBAAiB,EAAE;QACjB,GAAG,iCAAiC;KACrC;IACD;;0BAEsB;IACtB,MAAM,EAAE,EAAC,GAAG,eAAe,EAAC;IAC5B,IAAI,EAAE,EAAC,GAAG,aAAa,EAAC;IACxB,KAAK,EAAE,EAAC,GAAG,cAAc,EAAC;CAC3B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampsec/platform-client",
3
- "version": "50.1.0",
3
+ "version": "52.0.0",
4
4
  "description": "",
5
5
  "main": "build/src/index.js",
6
6
  "runkitExampleFilename": "example/main.js",
@@ -0,0 +1,6 @@
1
+ /* eslint-disable no-unused-vars */
2
+ export enum CallToAction {
3
+ CONTACT_SECURITY = 'CONTACT_SECURITY',
4
+ HELP = 'HELP',
5
+ MARK_COMPLETE = 'MARK_COMPLETE',
6
+ }
@@ -0,0 +1,4 @@
1
+ /* eslint-disable no-unused-vars */
2
+ export type Contact = {
3
+ email: string;
4
+ };
@@ -1,8 +1,10 @@
1
1
  export * from './auth.role';
2
2
  export * from './agent.status';
3
3
  export * from './ampSettingKeys.enum';
4
+ export * from './callToAction.enum';
4
5
  export * from './category';
5
6
  export * from './connector.status';
7
+ export * from './contact.type';
6
8
  export * from './contentStrategy.kind';
7
9
  export * from './deliveryStrategy.kind';
8
10
  export * from './findingKind';
@@ -0,0 +1,26 @@
1
+ import {CallToAction} from '../enums';
2
+ import {Notifiable} from './notifiable.dto';
3
+
4
+ export type MessageContent = {
5
+ /** Header of the message */
6
+ header?: string;
7
+ /** Body of the message */
8
+ body: string;
9
+ /** Additional information to be included in the message */
10
+ additionalInfo?: string[];
11
+ };
12
+
13
+ export type ChannelMessageDto = Notifiable & {
14
+ /** Slack user IDs to which the notification is being sent */
15
+ users: string[] | number[];
16
+ /** Message content to be sent in the Slack message */
17
+ content: MessageContent;
18
+ /** ID of the tenant to which the notification belongs: required if the notificaiton should allow for the user to contact the security or IT team */
19
+ tid: string;
20
+ /** ID of the finding to which the notification is in regards to: required if the notification should allow for the user marking a finding as complete */
21
+ fid?: string;
22
+ /** Metadata for the message */
23
+ meta?: unknown;
24
+ /** Calls to action to be included in the message */
25
+ actions: CallToAction[];
26
+ };
@@ -1,3 +1,3 @@
1
- export * from './slackMessage.dto';
1
+ export * from './channelMessage.dto';
2
2
  export * from './email.dto';
3
3
  export * from './notifiable.dto';
@@ -20,6 +20,17 @@ export class ConnectorInstallService {
20
20
  return success;
21
21
  };
22
22
 
23
+ getOauthInstallUrl = async (cid: string, provider: string, clientRedirectUrl: string): Promise<string> => {
24
+ const res = await this.rest.call({
25
+ url: `/${this.targetApi}/v1/install/oauth/token`,
26
+ method: 'POST',
27
+ data: {cid},
28
+ });
29
+ const token = (res.data as {token: string}).token;
30
+ return `${this.rest.baseUrl}/${this.targetApi}/v1/install/oauth/${provider}/login?token=${token}&redirectUrl=${encodeURIComponent(clientRedirectUrl)}`;
31
+ };
32
+
33
+ /** @deprecated */
23
34
  getInstallToken = async (cid: string): Promise<string> => {
24
35
  const res = await this.rest.call({
25
36
  url: `/${this.targetApi}/v1/install/oauth/token`,
@@ -30,6 +41,7 @@ export class ConnectorInstallService {
30
41
  return token;
31
42
  };
32
43
 
44
+ /** @deprecated */
33
45
  getRedirectUrl = async (token: string): Promise<string> => {
34
46
  const res = await this.rest.call({
35
47
  url: `/${this.targetApi}/v1/install/oauth/login`,
@@ -40,6 +52,7 @@ export class ConnectorInstallService {
40
52
  return redirectUrl;
41
53
  };
42
54
 
55
+ /** @deprecated */
43
56
  buildInstallOAuthUrl = (token: string, redirectUrl: string): string => {
44
57
  return `/${this.targetApi}/v1/install/oauth?token=${token}&redirect=${encodeURIComponent(redirectUrl)}`;
45
58
  };
@@ -36,6 +36,7 @@ export type RestClientOptions = {
36
36
  * RestClient is a generic interface for making REST calls.
37
37
  */
38
38
  export interface RestClient {
39
+ baseUrl?: string;
39
40
  strict: boolean;
40
41
  call(_request: RestRequest): Promise<RestResponse>;
41
42
  }
@@ -47,15 +48,15 @@ export interface RestClient {
47
48
  *
48
49
  * These strategies can be useful when scraping 3rd party APIs.
49
50
  */
50
- export class DefaultRestClient {
51
+ export class DefaultRestClient implements RestClient {
51
52
  protected readonly ampAxios: Axios;
52
53
  protected readonly retryStrategy: RestClientRetryStrategy;
53
54
  protected readonly rateLimitStrategy: RestClientRateLimitStrategy;
54
55
  protected readonly logger: AmpLogger;
56
+ readonly baseUrl?: string;
55
57
  readonly strict: boolean;
56
58
 
57
59
  constructor(options: RestClientOptions = {}) {
58
- // TODO: rest client
59
60
  const client = options.client ?? axios;
60
61
  this.ampAxios = client.create({
61
62
  baseURL: options.baseUrl,
@@ -73,6 +74,7 @@ export class DefaultRestClient {
73
74
  this.ampAxios.defaults.headers.put['Content-Type'] = 'application/json';
74
75
  this.retryStrategy = options.retryStrategy ?? noopRestRetryStrategy;
75
76
  this.rateLimitStrategy = options.rateLimitStrategy ?? noopRestClientRateLimitStrategy;
77
+ this.baseUrl = options.baseUrl;
76
78
  this.strict = options.strict ?? false;
77
79
  }
78
80
  call = async (request: RestRequest): Promise<RestResponse> => {
package/src/settings.ts CHANGED
@@ -1,11 +1,76 @@
1
+ import {Contact} from './dto';
1
2
  import {AmpSettingsMap} from './services';
2
3
 
3
- // TODO document this object
4
+ /**************************
5
+ * GLOBAL SETTINGS *
6
+ *************************/
7
+ /**
8
+ * GLOBAL ONLY
9
+ * ===========
10
+ * These are tenant level settings that are not meant to be overridden at the connector level
11
+ */
12
+ const TENANT_SETTINGS = {
13
+ /** Disables all automated messages from being sent to end users. */
14
+ GHOST_MODE: AmpSettingsMap.asKey<boolean>('notifications.ghostMode.enabled', true),
15
+ /** Enables mock providers on the tenant. */
16
+ ENABLE_MOCKS: AmpSettingsMap.asKey<boolean>('mocks.enabled', false),
17
+ /** Email address for the tenant's IT/Security team */
18
+ IT_SECURITY_CONTACT: AmpSettingsMap.asKey<Contact | undefined>('tenant.itSecurityContact'),
19
+ /**
20
+ * Specifies which mock tenant to use.
21
+ * - `david`: single insecure user
22
+ * - `ampsec`: founding team of amplifier security with mock data
23
+ * - `stryper`: branded small test tenant
24
+ * - `acme`: mocked data for ~25 users
25
+ * - `ingen`: mocked data for ~250 users
26
+ */
27
+ MOCK_TENANT_ID: AmpSettingsMap.asKey<string>('mocks.tenant.id', 'stryper'),
28
+ };
29
+
30
+ /**
31
+ * GLOBAL CONNECTOR DEFAULTS
32
+ * Note: these can be overridden by connector level settings
33
+ */
34
+ const GLOBAL_CONNECTOR_DEFAULT_SETTINGS = {
35
+ /** Not currently implemented/respected */
36
+ NOTIFICATIONS_ENABLED: AmpSettingsMap.asKey<boolean>('notifications.enabled', false),
37
+ };
38
+
39
+ /********************
40
+ * PROVIDERS *
41
+ ********************/
42
+ const GOOGLE_SETTINGS = {
43
+ GOOGLE_EXECUTIVE_GROUPS: AmpSettingsMap.asKey<string[]>('google.groups.exec.extIds', []),
44
+ GOOGLE_PROD_ACCESS_GROUPS: AmpSettingsMap.asKey<string[]>('google.groups.prod.extIds', []),
45
+ GOOGLE_PRIV_ACCESS_GROUPS: AmpSettingsMap.asKey<string[]>('google.groups.priv.extIds', []),
46
+ GOOGLE_SERV_ACCT_GROUPS: AmpSettingsMap.asKey<string[]>('google.groups.servAcct.extIds', []),
47
+ };
48
+
49
+ const OKTA_SETTINGS = {
50
+ OKTA_EXECUTIVE_GROUPS: AmpSettingsMap.asKey<string[]>('okta.groups.exec.extIds', []),
51
+ OKTA_PROD_ACCESS_GROUPS: AmpSettingsMap.asKey<string[]>('okta.groups.prod.extIds', []),
52
+ OKTA_PRIV_ACCESS_GROUPS: AmpSettingsMap.asKey<string[]>('okta.groups.priv.extIds', []),
53
+ OKTA_SERV_ACCT_GROUPS: AmpSettingsMap.asKey<string[]>('okta.groups.servAcct.extIds', []),
54
+ };
55
+
56
+ const SLACK_SETTINGS = {
57
+ SLACK_EXECUTIVE_GROUPS: AmpSettingsMap.asKey<string[]>('slack.groups.exec.extIds', []),
58
+ SLACK_PROD_ACCESS_GROUPS: AmpSettingsMap.asKey<string[]>('slack.groups.prod.extIds', []),
59
+ SLACK_PRIV_ACCESS_GROUPS: AmpSettingsMap.asKey<string[]>('slack.groups.priv.extIds', []),
60
+ SLACK_SERV_ACCT_GROUPS: AmpSettingsMap.asKey<string[]>('slack.groups.servAcct.extIds', []),
61
+ SLACK_CONTACT_SECURITY_CHANNEL: AmpSettingsMap.asKey<string | undefined>('slack.channels.security.extId'),
62
+ // TODO localization... does this get moved to contentful? Does the setting "point" to content in contentful?
63
+ SLACK_CONTACT_SECURITY_TEMPLATE: AmpSettingsMap.asKey<string>(
64
+ 'slack.templates.contactSecurity',
65
+ 'Thanks for getting in touch! We forwarded your message to our security team and they will get back to you shortly.'
66
+ ),
67
+ };
68
+
4
69
  /**
5
70
  * Collection of hard coded settings to be use centrally across services and user interfaces.
6
71
  *
7
72
  * # Naming convention:
8
- * Keys should be name spaced following dot notation, e.g. notifications.ghost_mode.enabled`.
73
+ * Keys should be name spaced following dot notation and camel case, e.g. notifications.ghostMode.enabled`.
9
74
  *
10
75
  * ## Use Cases
11
76
  * 1. Boolean "enabled" toggles should end in `*.enabled`. You should never use the inverse `*.disabled`
@@ -24,19 +89,7 @@ export const AMP_SETTINGS = {
24
89
  * These are tenant level settings that are not meant to be overridden at the connector level
25
90
  */
26
91
  tenant: {
27
- /** Disables all automated messages from being sent to end users. */
28
- GHOST_MODE: AmpSettingsMap.asKey<boolean>('notifications.ghost_mode.enabled', false), // TODO enble by default
29
- /** Enables mock providers on the tenant. */
30
- ENABLE_MOCKS: AmpSettingsMap.asKey<boolean>('mocks.enabled', false),
31
- /**
32
- * Specifies which mock tenant to use.
33
- * - `david`: single insecure user
34
- * - `ampsec`: founding team of amplifier security with mock data
35
- * - `stryper`: branded small test tenant
36
- * - `acme`: mocked data for ~25 users
37
- * - `ingen`: mocked data for ~250 users
38
- */
39
- MOCK_TENANT_ID: AmpSettingsMap.asKey<string>('mocks.tenant.id', 'stryper'),
92
+ ...TENANT_SETTINGS,
40
93
  /** Specifies the default connector for the `messages` delivery strategy. */
41
94
  DEFAULT_NOTIFICATION_CONNECTOR_ID: AmpSettingsMap.asKey<string | undefined>('notifications.connectors.default.cid'),
42
95
  },
@@ -44,35 +97,13 @@ export const AMP_SETTINGS = {
44
97
  * GLOBAL
45
98
  * Note: these can be overridden by connector level settings
46
99
  */
47
- inherited: {
48
- /** Not currently implemented/respected */
49
- NOTIFICATIONS_ENABLED: AmpSettingsMap.asKey<boolean>('notifications.enabled', false),
100
+ connectorDefaults: {
101
+ ...GLOBAL_CONNECTOR_DEFAULT_SETTINGS,
50
102
  },
51
103
  /********************
52
104
  * PROVIDERS *
53
105
  ********************/
54
- google: {
55
- GOOGLE_EXECUTIVE_GROUPS: AmpSettingsMap.asKey<string[]>('google.groups.exec.extIds', []),
56
- GOOGLE_PROD_ACCESS_GROUPS: AmpSettingsMap.asKey<string[]>('google.groups.prod.extIds', []),
57
- GOOGLE_PRIV_ACCESS_GROUPS: AmpSettingsMap.asKey<string[]>('google.groups.priv.extIds', []),
58
- GOOGLE_SERV_ACCT_GROUPS: AmpSettingsMap.asKey<string[]>('google.groups.serv_acct.extIds', []),
59
- },
60
- okta: {
61
- OKTA_EXECUTIVE_GROUPS: AmpSettingsMap.asKey<string[]>('okta.groups.exec.extIds', []),
62
- OKTA_PROD_ACCESS_GROUPS: AmpSettingsMap.asKey<string[]>('okta.groups.prod.extIds', []),
63
- OKTA_PRIV_ACCESS_GROUPS: AmpSettingsMap.asKey<string[]>('okta.groups.priv.extIds', []),
64
- OKTA_SERV_ACCT_GROUPS: AmpSettingsMap.asKey<string[]>('okta.groups.serv_acct.extIds', []),
65
- },
66
- slack: {
67
- SLACK_EXECUTIVE_GROUPS: AmpSettingsMap.asKey<string[]>('slack.groups.exec.extIds', []),
68
- SLACK_PROD_ACCESS_GROUPS: AmpSettingsMap.asKey<string[]>('slack.groups.prod.extIds', []),
69
- SLACK_PRIV_ACCESS_GROUPS: AmpSettingsMap.asKey<string[]>('slack.groups.priv.extIds', []),
70
- SLACK_SERV_ACCT_GROUPS: AmpSettingsMap.asKey<string[]>('slack.groups.serv_acct.extIds', []),
71
- SLACK_CONTACT_SECURITY_CHANNEL: AmpSettingsMap.asKey<string | undefined>('slack.channels.contact_security.extId'),
72
- // TODO localization... does this get moved to contentful? Does the setting "point" to content in contentful?
73
- SLACK_CONTACT_SECURITY_TEMPLATE: AmpSettingsMap.asKey<string>(
74
- 'slack.templates.contact_security',
75
- 'Thanks for getting in touch! We forwarded your message to our security team and they will get back to you shortly.'
76
- ),
77
- },
106
+ google: {...GOOGLE_SETTINGS},
107
+ okta: {...OKTA_SETTINGS},
108
+ slack: {...SLACK_SETTINGS},
78
109
  };
@@ -1,9 +0,0 @@
1
- import { Notifiable } from './notifiable.dto';
2
- export type SlackMessageDto = Notifiable & {
3
- /** ID of the Slack team to which the user(s) belong */
4
- teamId: string;
5
- /** Slack user IDs to which the notification is being sent */
6
- users: string[];
7
- /** Message to be sent to the users */
8
- message: string;
9
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"slackMessage.dto.js","sourceRoot":"","sources":["../../../../src/dto/messagingChannels/slackMessage.dto.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- import {Notifiable} from './notifiable.dto';
2
-
3
- export type SlackMessageDto = Notifiable & {
4
- /** ID of the Slack team to which the user(s) belong */
5
- teamId: string;
6
- /** Slack user IDs to which the notification is being sent */
7
- users: string[];
8
- /** Message to be sent to the users */
9
- message: string;
10
- };