@live-change/email-service 0.9.31 → 0.9.33

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
@@ -167,8 +167,8 @@ definition.trigger({
167
167
  async execute({ user, email }, { client, service }, emit) {
168
168
  email = preFilter(email)
169
169
  const emailData = await Email.get(email)
170
- if(!emailData) throw { properties: { email: 'notFound' } }
171
- if(emailData.user !== user) throw { properties: { email: 'notFound' } }
170
+ if(!emailData) throw { properties: { email: 'emailNotFound' } }
171
+ if(emailData.user !== user) throw { properties: { email: 'emailNotFound' } }
172
172
  emit({
173
173
  type: 'emailDisconnected',
174
174
  user, email
@@ -188,7 +188,7 @@ definition.trigger({
188
188
  async execute({ email, session }, { service }, _emit) {
189
189
  email = preFilter(email)
190
190
  const emailData = await Email.get(email)
191
- if(!emailData) throw { properties: { email: 'notFound' } }
191
+ if(!emailData) throw { properties: { email: 'emailNotFound' } }
192
192
  const { user } = emailData
193
193
  return service.trigger({ type: 'signIn' }, {
194
194
  user, session
package/index.js CHANGED
@@ -5,6 +5,7 @@ import definition from './definition.js'
5
5
 
6
6
  import './send.js'
7
7
  import './auth.js'
8
+ import './notiifcations.js'
8
9
 
9
10
  import validator from './emailValidator.js'
10
11
  definition.validator('email', validator)
@@ -0,0 +1,50 @@
1
+ import App from '@live-change/framework'
2
+ const app = App.app()
3
+ import definition from './definition.js'
4
+
5
+ definition.trigger({
6
+ name: 'notificationCreated',
7
+ properties: {
8
+ notification: {
9
+ type: Object
10
+ },
11
+ sessionOrUserType: {
12
+ type: String,
13
+ validation: ['nonEmpty']
14
+ },
15
+ sessionOrUser: {
16
+ type: String,
17
+ validation: ['nonEmpty']
18
+ },
19
+ notificationType: {
20
+ type: String,
21
+ validation: ['nonEmpty']
22
+ }
23
+ },
24
+ async execute(params , { service }, emit) {
25
+ /// TODO: think if this mechanism along with grouping could be moved to notification service
26
+ /// TODO: check if user enabled email for this type of notification
27
+ }
28
+ })
29
+
30
+ definition.trigger({
31
+ name: 'checkEmailNotificationState',
32
+ properties: {
33
+ sessionOrUserType: {
34
+ type: String,
35
+ validation: ['nonEmpty']
36
+ },
37
+ sessionOrUser: {
38
+ type: String,
39
+ validation: ['nonEmpty']
40
+ },
41
+ },
42
+ async execute(params , { service }, emit) {
43
+
44
+ /// TODO: 1. get notifications by user
45
+ /// TODO: 2. check if there are any notifications that are not emailed yed
46
+ /// TODO: 3. decide if notifications should be grouped, partition notifications to grouped and non-grouped
47
+ /// TODO: 4. send email for each group of notifications, and each non-grouped notification
48
+ /// TODO: 5. mark notifications as emailed
49
+ }
50
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/email-service",
3
- "version": "0.9.31",
3
+ "version": "0.9.33",
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.9.31",
24
+ "@live-change/framework": "^0.9.33",
25
25
  "got": "^11.8.6",
26
26
  "html-to-text": "8.1.0",
27
27
  "inline-css": "4.0.2",
@@ -29,6 +29,6 @@
29
29
  "juice": "11.0.0",
30
30
  "nodemailer": "^6.7.2"
31
31
  },
32
- "gitHead": "4e12be9d3f339492bb9ddc3c6c77581e52d1ba60",
32
+ "gitHead": "c6eaa7764dc12b9489b74386b1227b71d0640e09",
33
33
  "type": "module"
34
34
  }