@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 CHANGED
@@ -1,5 +1,4 @@
1
- const { validation } = require('@live-change/framework')
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
- module.exports = { Email }
214
+ export { Email }
package/definition.js CHANGED
@@ -1,9 +1,10 @@
1
- const app = require("@live-change/framework").app()
2
- const user = require('@live-change/user-service')
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
- module.exports = definition
10
+ export default definition
package/emailValidator.js CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = (settings) => (email) => {
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
- const app = require("@live-change/framework").app()
1
+ import App from '@live-change/framework'
2
+ const app = App.app()
2
3
 
3
- const definition = require('./definition.js')
4
+ import definition from './definition.js'
4
5
 
5
- require('./send.js')
6
- require('./auth.js')
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 = require('./emailValidator.js')
12
+ service.validators.email = validator
10
13
  })
11
14
 
12
- module.exports = definition
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.40",
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.7.38",
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": "d72cc68ee4c46242e5f6a51c303be4177a1c33cf"
32
+ "gitHead": "87010b19907140a326943f22cd538eafdc9c28f1",
33
+ "type": "module"
33
34
  }
package/render.js CHANGED
@@ -1,12 +1,12 @@
1
- const got = require('got')
2
- const inlineCss = require('inline-css')
3
- const juice = require('juice')
4
- const { JSDOM } = require("jsdom")
5
- const { convert: htmlToText } = require('html-to-text')
6
- const path = require('path')
7
- const { URL } = require('url')
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
- const definition = require('./definition.js')
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
- module.exports = renderEmail
115
+ export default renderEmail
package/send.js CHANGED
@@ -1,9 +1,10 @@
1
- const definition = require('./definition.js')
1
+ import definition from './definition.js'
2
2
 
3
- const nodemailer = require('nodemailer')
4
- const app = require('@live-change/framework').app()
3
+ import nodemailer from 'nodemailer'
4
+ import App from '@live-change/framework'
5
+ const app = App.app()
5
6
 
6
- const renderEmail = require('./render.js')
7
+ import renderEmail from './render.js'
7
8
 
8
9
  const config = definition.config
9
10