medusa-plugin-ses 2.0.3 → 2.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "medusa-plugin-ses",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "AWS SES transactional emails using local handlebars templates",
5
5
  "main": "index.js",
6
6
  "repository": {
package/.babelrc DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "plugins": [
3
- "@babel/plugin-proposal-class-properties",
4
- "@babel/plugin-transform-instanceof",
5
- "@babel/plugin-transform-classes"
6
- ],
7
- "presets": ["@babel/preset-env"],
8
- "env": {
9
- "test": {
10
- "plugins": ["@babel/plugin-transform-runtime"]
11
- }
12
- }
13
- }
package/jest.config.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- testEnvironment: "node",
3
- }
package/src/api/index.js DELETED
@@ -1,33 +0,0 @@
1
- import { Router } from "express"
2
- import bodyParser from "body-parser"
3
- import { Validator, MedusaError } from "medusa-core-utils"
4
-
5
- const router = Router()
6
-
7
- export default (app) => {
8
- router.use(bodyParser.json())
9
-
10
- router.post("/ses/send",(req, res) => {
11
- const sesService = req.scope.resolve("sesService")
12
-
13
- const schema = Validator.object().keys({
14
- template_id: Validator.string().required(),
15
- from: Validator.string().required(),
16
- to: Validator.string().required(),
17
- data: Validator.object().optional().default({}),
18
- })
19
-
20
- const { value, error } = schema.validate(req.body)
21
- if (error) {
22
- throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
23
- }
24
-
25
- sesService.sendEmail(value.template_id, value.from, value.to, value.data).then((result) => {
26
- return res.json({
27
- result
28
- })
29
- })
30
- })
31
-
32
- return router
33
- }