@live-change/email-service 0.3.40 → 0.4.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.
- package/auth.js +2 -3
- package/definition.js +4 -3
- package/emailValidator.js +1 -1
- package/index.js +9 -6
- package/package.json +4 -3
- package/render.js +9 -9
- package/send.js +5 -4
package/auth.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const definition = require('./definition.js')
|
|
1
|
+
import definition from './definition.js'
|
|
3
2
|
|
|
4
3
|
const User = definition.foreignModel('user', 'User')
|
|
5
4
|
|
|
@@ -212,4 +211,4 @@ definition.trigger({
|
|
|
212
211
|
}
|
|
213
212
|
})
|
|
214
213
|
|
|
215
|
-
|
|
214
|
+
export { Email }
|
package/definition.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
1
|
+
import App from '@live-change/framework'
|
|
2
|
+
const app = App.app()
|
|
3
|
+
import user from '@live-change/user-service'
|
|
3
4
|
|
|
4
5
|
const definition = app.createServiceDefinition({
|
|
5
6
|
name: "email",
|
|
6
7
|
use: [ user ]
|
|
7
8
|
})
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
export default definition
|
package/emailValidator.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export default (settings) => (email) => {
|
|
2
2
|
if(!email || !email.trim()) return
|
|
3
3
|
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
4
4
|
if (!re.test(String(email).toLowerCase())) return "wrongEmail"
|
package/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import App from '@live-change/framework'
|
|
2
|
+
const app = App.app()
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
import definition from './definition.js'
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
import './send.js'
|
|
7
|
+
import './auth.js'
|
|
8
|
+
|
|
9
|
+
import validator from './emailValidator.js'
|
|
7
10
|
|
|
8
11
|
definition.processor(function(service, app) {
|
|
9
|
-
service.validators.email =
|
|
12
|
+
service.validators.email = validator
|
|
10
13
|
})
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
export default definition
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/email-service",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://www.viamage.com/"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@live-change/framework": "0.
|
|
24
|
+
"@live-change/framework": "0.8.0",
|
|
25
25
|
"got": "^11.8.3",
|
|
26
26
|
"html-to-text": "8.1.0",
|
|
27
27
|
"inline-css": "4.0.2",
|
|
@@ -29,5 +29,6 @@
|
|
|
29
29
|
"juice": "9.1.0",
|
|
30
30
|
"nodemailer": "^6.7.2"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "87010b19907140a326943f22cd538eafdc9c28f1",
|
|
33
|
+
"type": "module"
|
|
33
34
|
}
|
package/render.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import got from 'got'
|
|
2
|
+
import inlineCss from 'inline-css'
|
|
3
|
+
import juice from 'juice'
|
|
4
|
+
import { JSDOM } from 'jsdom'
|
|
5
|
+
import { convert as htmlToText } from 'html-to-text'
|
|
6
|
+
import path from 'path'
|
|
7
|
+
import { URL } from 'url'
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
import definition from './definition.js'
|
|
10
10
|
const config = definition.config
|
|
11
11
|
|
|
12
12
|
const publicDir = config.publicDir || 'front/public/'
|
|
@@ -112,4 +112,4 @@ async function renderEmail(data) {
|
|
|
112
112
|
return email
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
export default renderEmail
|
package/send.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import definition from './definition.js'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import nodemailer from 'nodemailer'
|
|
4
|
+
import App from '@live-change/framework'
|
|
5
|
+
const app = App.app()
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
import renderEmail from './render.js'
|
|
7
8
|
|
|
8
9
|
const config = definition.config
|
|
9
10
|
|