ac-ses 2.0.0 → 2.0.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ <a name="2.0.2"></a>
2
+
3
+ ## [2.0.2](https://github.com/admiralcloud/ac-ses/compare/v2.0.1..v2.0.2) (2024-09-16 08:11:27)
4
+
5
+
6
+ ### Bug Fix
7
+
8
+ * **App:** Package updates | MP | [e0c2598481e0f87cf5bdb698faf637c0faa5e604](https://github.com/admiralcloud/ac-ses/commit/e0c2598481e0f87cf5bdb698faf637c0faa5e604)
9
+ Package updates
10
+ Related issues: [undefined/undefined#master](undefined/browse/master)
11
+ <a name="2.0.1"></a>
12
+
13
+ ## [2.0.1](https://github.com/admiralcloud/ac-ses/compare/v2.0.0..v2.0.1) (2024-01-07 08:57:43)
14
+
15
+
16
+ ### Bug Fix
17
+
18
+ * **App:** Minor improvements | MP | [e0360e94b9de2b1292c73ef6ac23962186a50d49](https://github.com/admiralcloud/ac-ses/commit/e0360e94b9de2b1292c73ef6ac23962186a50d49)
19
+ Set region during init (default eu-central-1). Use SESv2Client.
20
+ Related issues: [undefined/undefined#master](undefined/browse/master)
21
+ ### Chores
22
+
23
+ * **App:** Updated packages | MP | [1d6b84ff958787d4fea8d23d9700f2f9886299bf](https://github.com/admiralcloud/ac-ses/commit/1d6b84ff958787d4fea8d23d9700f2f9886299bf)
24
+ Updated packages
25
+ Related issues: [undefined/undefined#master](undefined/browse/master)
1
26
  <a name="2.0.0"></a>
2
27
 
3
28
  # [2.0.0](https://github.com/admiralcloud/ac-ses/compare/v1.2.4..v2.0.0) (2024-01-06 09:43:38)
@@ -0,0 +1,30 @@
1
+ const globals = require('globals');
2
+
3
+ module.exports = {
4
+ ignores: [
5
+ 'config/env/**'
6
+ ],
7
+ languageOptions: {
8
+ ecmaVersion: 2022,
9
+ sourceType: 'module',
10
+ globals: {
11
+ ...globals.commonjs,
12
+ ...globals.es6,
13
+ ...globals.node,
14
+ expect: 'readonly',
15
+ describe: 'readonly',
16
+ it: 'readonly'
17
+ }
18
+ },
19
+ rules: {
20
+ 'no-const-assign': 'error', // Ensure this rule is enabled
21
+ 'space-before-function-paren': 'off',
22
+ 'no-extra-semi': 'off',
23
+ 'object-curly-spacing': ['error', 'always'],
24
+ 'brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
25
+ 'no-useless-escape': 'off',
26
+ 'standard/no-callback-literal': 'off',
27
+ 'new-cap': 'off',
28
+ 'no-console': ['warn', { allow: ['warn', 'error'] }]
29
+ }
30
+ };
package/index.js CHANGED
@@ -4,7 +4,7 @@ const { v4: uuidV4 } = require('uuid')
4
4
  const quotedPrintable = require('quoted-printable')
5
5
  const utf8 = require('utf8')
6
6
 
7
- const { SESClient, SendRawEmailCommand } = require("@aws-sdk/client-ses")
7
+ const { SESv2Client, SendEmailCommand } = require("@aws-sdk/client-sesv2")
8
8
 
9
9
  const acses = () => {
10
10
  let ses
@@ -15,7 +15,10 @@ const acses = () => {
15
15
  let useEnvironmentPrefixInSubject = environment !== 'production'
16
16
 
17
17
  const init = function(options) {
18
- ses = new SESClient()
18
+ const awsConfig = {
19
+ region: _.get(options, 'region', 'eu-central-1')
20
+ }
21
+ ses = new SESv2Client(awsConfig)
19
22
  if (_.get(options, 'testMode')) {
20
23
  testMode = _.get(options, 'testMode')
21
24
  }
@@ -112,7 +115,7 @@ const acses = () => {
112
115
 
113
116
  raw += 'Subject: ' + (useEnvironmentPrefixInSubject ? (_.toUpper(environment) + ' | ') : '') + params.subject + '\n'
114
117
  if (params?.debug) {
115
- console.log('ACSES | DEBUG Headers | %j', raw.split('/n'))
118
+ warn.log('ACSES | DEBUG Headers | %j', raw.split('/n'))
116
119
  }
117
120
 
118
121
  // announce multipart/mixed
@@ -141,12 +144,6 @@ const acses = () => {
141
144
  })
142
145
  raw += '--' + boundaryMixed + '--\n'
143
146
  }
144
-
145
- const rawParams = {
146
- RawMessage: { /* required */
147
- Data: Buffer.from(raw)
148
- }
149
- }
150
147
 
151
148
  if (testMode) {
152
149
  // return fake response, but do not send message
@@ -161,7 +158,13 @@ const acses = () => {
161
158
  }
162
159
  return mockResponse
163
160
  }
164
- const command = new SendRawEmailCommand(rawParams)
161
+ const command = new SendEmailCommand({
162
+ Content: {
163
+ Raw: {
164
+ Data: Buffer.from(raw)
165
+ }
166
+ }
167
+ })
165
168
  const response = await ses.send(command)
166
169
  return response
167
170
  }
@@ -172,4 +175,4 @@ const acses = () => {
172
175
  }
173
176
  }
174
177
 
175
- module.exports = acses()
178
+ module.exports = acses()
package/package.json CHANGED
@@ -4,20 +4,20 @@
4
4
  "license": "MIT",
5
5
  "repository": "admiralcloud/ac-ses",
6
6
  "homepage": "https://www.admiralcloud.com",
7
- "version": "2.0.0",
7
+ "version": "2.0.2",
8
8
  "dependencies": {
9
- "@aws-sdk/client-ses": "^3.485.0",
9
+ "@aws-sdk/client-sesv2": "^3.651.1",
10
10
  "lodash": "^4.17.21",
11
11
  "quoted-printable": "^1.0.1",
12
12
  "utf8": "^3.0.0",
13
- "uuid": "^9.x"
13
+ "uuid": "^10.x"
14
14
  },
15
15
  "devDependencies": {
16
16
  "ac-semantic-release": "^0.4.2",
17
- "chai": "^4.4.0",
18
- "eslint": "8.x",
17
+ "chai": "^4.5.0",
18
+ "eslint": "9.x",
19
19
  "expect": "^29.7.0",
20
- "mocha": "^10.2.0",
20
+ "mocha": "^10.7.3",
21
21
  "mocha-jenkins-reporter": "0.4.8"
22
22
  },
23
23
  "scripts": {
package/.eslintrc.js DELETED
@@ -1,27 +0,0 @@
1
- const config = {
2
- root: true,
3
- 'env': {
4
- 'commonjs': true,
5
- 'es6': true,
6
- 'node': true
7
- },
8
- 'extends': 'eslint:recommended',
9
- "rules": {
10
- "space-before-function-paren": 0,
11
- "no-extra-semi": 0,
12
- "object-curly-spacing": ["error", "always"],
13
- "brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
14
- "no-useless-escape": 0,
15
- "standard/no-callback-literal": 0,
16
- "new-cap": 0
17
- },
18
- globals: {
19
- describe: true,
20
- it: true
21
- },
22
- 'parserOptions': {
23
- 'ecmaVersion': 2022
24
- },
25
- }
26
-
27
- module.exports = config