@orangewall/customer-notifications-util 0.1.0 → 0.2.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.
@@ -55,7 +55,7 @@ function _sendMessage(message, topicArn, snsClient) {
55
55
  return snsClient.send(command);
56
56
  }
57
57
  function validateMessage(message) {
58
- var _a, _b, _c, _d;
58
+ var _a, _b, _c;
59
59
  if (!message.organizationId) {
60
60
  throw new Error(`Organization Id is required!`);
61
61
  }
@@ -69,11 +69,11 @@ function validateMessage(message) {
69
69
  if (!((_b = message.template) === null || _b === void 0 ? void 0 : _b.name)) {
70
70
  throw new Error(`template.name is required!`);
71
71
  }
72
- if (!((_c = message.template) === null || _c === void 0 ? void 0 : _c.channelType)) {
73
- throw new Error(`template.channelType is required!`);
74
- }
75
- if (!((_d = message.template) === null || _d === void 0 ? void 0 : _d.version)) {
72
+ if (!((_c = message.template) === null || _c === void 0 ? void 0 : _c.version)) {
76
73
  throw new Error(`template.version is required!`);
77
74
  }
78
75
  }
76
+ if (!message.channelType) {
77
+ throw new Error(`channelType is required on the message object!`);
78
+ }
79
79
  }
@@ -2,9 +2,10 @@ export type Message = {
2
2
  organizationId: String;
3
3
  recipient: Recipient;
4
4
  type: String;
5
- template: Template;
5
+ template?: Template;
6
6
  substitutions?: String;
7
7
  body?: String;
8
+ channelType: String;
8
9
  };
9
10
  export type Recipient = {
10
11
  employeeId?: String;
@@ -13,7 +14,6 @@ export type Recipient = {
13
14
  };
14
15
  export type Template = {
15
16
  name: String;
16
- channelType: String;
17
17
  version: Number;
18
18
  };
19
19
  //# sourceMappingURL=message.model.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"message.model.d.mts","sourceRoot":"","sources":["../../../../src/models/message.model.mts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAA"}
1
+ {"version":3,"file":"message.model.d.mts","sourceRoot":"","sources":["../../../../src/models/message.model.mts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACvB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB,CAAA"}
@@ -50,11 +50,11 @@ function validateMessage(message) {
50
50
  if (!message.template?.name) {
51
51
  throw new Error(`template.name is required!`);
52
52
  }
53
- if (!message.template?.channelType) {
54
- throw new Error(`template.channelType is required!`);
55
- }
56
53
  if (!message.template?.version) {
57
54
  throw new Error(`template.version is required!`);
58
55
  }
59
56
  }
57
+ if (!message.channelType) {
58
+ throw new Error(`channelType is required on the message object!`);
59
+ }
60
60
  }
@@ -2,9 +2,10 @@ export type Message = {
2
2
  organizationId: String;
3
3
  recipient: Recipient;
4
4
  type: String;
5
- template: Template;
5
+ template?: Template;
6
6
  substitutions?: String;
7
7
  body?: String;
8
+ channelType: String;
8
9
  };
9
10
  export type Recipient = {
10
11
  employeeId?: String;
@@ -13,7 +14,6 @@ export type Recipient = {
13
14
  };
14
15
  export type Template = {
15
16
  name: String;
16
- channelType: String;
17
17
  version: Number;
18
18
  };
19
19
  //# sourceMappingURL=message.model.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"message.model.d.mts","sourceRoot":"","sources":["../../../../src/models/message.model.mts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAA"}
1
+ {"version":3,"file":"message.model.d.mts","sourceRoot":"","sources":["../../../../src/models/message.model.mts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACvB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orangewall/customer-notifications-util",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "library to send customer notifications ",
5
5
  "exports": {
6
6
  ".": {