@infoxchange/make-it-so 2.12.0-internal-testing-add-ix-ses-idenity.1 → 2.12.0-internal-testing-add-ix-ses-idenity.3

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/README.md CHANGED
@@ -268,18 +268,26 @@ new IxDnsRecord(scope, "IxDnsRecord", {
268
268
  import { IxSESIdentity } from "@infoxchange/make-it-so/cdk-constructs";
269
269
 
270
270
  new IxSESIdentity(scope, "IxSESIdentity", {
271
+ // Email identity domain will be: example.dev.ixapps.org
272
+ // Custom mail from domain will be: info.example.dev.ixapps.org
271
273
  domain: "example.dev.ixapps.org",
272
274
  mailFromSubdomain: "info",
273
275
  });
276
+ // or
277
+ new IxSESIdentity(scope, "IxSESIdentity", {
278
+ // Email identity domain will be: example.dev.ixapps.org
279
+ // Custom mail from domain will be: info.example.dev.ixapps.org
280
+ from: "anything@info.example.dev.ixapps.org",
281
+ });
274
282
  ```
275
283
 
276
284
  #### Options:
277
285
 
278
- | Prop | Type | Description |
279
- | ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
280
- | domain | string | The domain of the identity. Either this for `from` must be specified. |
281
- | from | string | An email address from get domain of the identity. Either this for `domain` must be specified. |
282
- | mailFromSubdomain | string | (optional) by default the custom mail from domain will be `mail.${domain}`. This lets you change that. It should be given as just the subdomain part, not the fully qualified domain. |
286
+ | Prop | Type | Description |
287
+ | ----------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
288
+ | domain | string | The domain of the identity. Either this for `from` must be specified. |
289
+ | mailFromSubdomain | string | (optional) by default the custom mail from domain will be `mail.${domain}`. This lets you change that. It should be given as just the subdomain part, not the fully qualified domain. It's not used if from is given since the mail from domain is extracted from the from email address. |
290
+ | from | string | An email address from get domain of the identity. Either this for `domain` must be specified. |
283
291
 
284
292
  </details>
285
293
 
@@ -2,12 +2,11 @@ import { Construct } from "constructs";
2
2
  type ConstructScope = ConstructorParameters<typeof Construct>[0];
3
3
  type ConstructId = ConstructorParameters<typeof Construct>[1];
4
4
  type Props = {
5
- mailFromSubdomain?: string;
6
- } & ({
7
5
  domain: string;
6
+ mailFromSubdomain?: string;
8
7
  } | {
9
8
  from: string;
10
- });
9
+ };
11
10
  export declare class IxSESIdentity extends Construct {
12
11
  constructor(scope: ConstructScope, id: ConstructId, props: Props);
13
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"IxSESIdentity.d.ts","sourceRoot":"","sources":["../../src/cdk-constructs/IxSESIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKvC,KAAK,cAAc,GAAG,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AACjE,KAAK,WAAW,GAAG,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9D,KAAK,KAAK,GAAG;IACX,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GAAG,CACA;IACE,MAAM,EAAE,MAAM,CAAC;CAChB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;CACd,CACJ,CAAC;AAEF,qBAAa,aAAc,SAAQ,SAAS;gBAC9B,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK;CAqDjE"}
1
+ {"version":3,"file":"IxSESIdentity.d.ts","sourceRoot":"","sources":["../../src/cdk-constructs/IxSESIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKvC,KAAK,cAAc,GAAG,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AACjE,KAAK,WAAW,GAAG,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9D,KAAK,KAAK,GACN;IACE,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GACD;IACE,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEN,qBAAa,aAAc,SAAQ,SAAS;gBAC9B,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK;CA2DjE"}
@@ -4,10 +4,14 @@ import * as ses from "aws-cdk-lib/aws-ses";
4
4
  import * as cdk from "aws-cdk-lib";
5
5
  export class IxSESIdentity extends Construct {
6
6
  constructor(scope, id, props) {
7
- const domain = "domain" in props ? props.domain : props.from.split("@")[1];
8
- const mailFromDomain = `${props.mailFromSubdomain ?? "mail"}.${domain}`;
7
+ const mailFromDomain = "from" in props
8
+ ? props.from.split("@")[1]
9
+ : `${props.mailFromSubdomain ?? "mail"}.${props.domain}`;
10
+ const domain = "from" in props
11
+ ? mailFromDomain.split(".").slice(1).join(".")
12
+ : props.domain;
9
13
  super(scope, id);
10
- const identity = new ses.EmailIdentity(scope, "EmailIdentity", {
14
+ const identity = new ses.EmailIdentity(scope, `${id}EmailIdentity`, {
11
15
  identity: ses.Identity.domain(domain),
12
16
  mailFromDomain,
13
17
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infoxchange/make-it-so",
3
- "version": "2.12.0-internal-testing-add-ix-ses-idenity.1",
3
+ "version": "2.12.0-internal-testing-add-ix-ses-idenity.3",
4
4
  "description": "Makes deploying services to IX infra easy",
5
5
  "repository": "github:infoxchange/make-it-so",
6
6
  "type": "module",
@@ -6,25 +6,29 @@ import * as cdk from "aws-cdk-lib";
6
6
  type ConstructScope = ConstructorParameters<typeof Construct>[0];
7
7
  type ConstructId = ConstructorParameters<typeof Construct>[1];
8
8
 
9
- type Props = {
10
- mailFromSubdomain?: string;
11
- } & (
9
+ type Props =
12
10
  | {
13
11
  domain: string;
12
+ mailFromSubdomain?: string;
14
13
  }
15
14
  | {
16
15
  from: string;
17
- }
18
- );
16
+ };
19
17
 
20
18
  export class IxSESIdentity extends Construct {
21
19
  constructor(scope: ConstructScope, id: ConstructId, props: Props) {
22
- const domain = "domain" in props ? props.domain : props.from.split("@")[1];
23
- const mailFromDomain = `${props.mailFromSubdomain ?? "mail"}.${domain}`;
20
+ const mailFromDomain =
21
+ "from" in props
22
+ ? props.from.split("@")[1]
23
+ : `${props.mailFromSubdomain ?? "mail"}.${props.domain}`;
24
+ const domain =
25
+ "from" in props
26
+ ? mailFromDomain.split(".").slice(1).join(".")
27
+ : props.domain;
24
28
 
25
29
  super(scope, id);
26
30
 
27
- const identity = new ses.EmailIdentity(scope, "EmailIdentity", {
31
+ const identity = new ses.EmailIdentity(scope, `${id}EmailIdentity`, {
28
32
  identity: ses.Identity.domain(domain),
29
33
  mailFromDomain,
30
34
  });