@live-change/notification-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/config.js ADDED
@@ -0,0 +1,20 @@
1
+ import definition from './definition.js'
2
+
3
+ const {
4
+ contactTypes,
5
+ notificationTypes,
6
+ defaultSettings
7
+ } = definition.config
8
+
9
+ definition.clientConfig = {
10
+ contactTypes,
11
+ notificationTypes,
12
+ defaultSettings
13
+ }
14
+
15
+ const config = {
16
+ contactTypes,
17
+ notificationTypes
18
+ }
19
+
20
+ export default config
package/definition.js CHANGED
@@ -9,11 +9,4 @@ const definition = app.createServiceDefinition({
9
9
  use: [ userService, relationsPlugin ]
10
10
  })
11
11
 
12
- const config = definition.config
13
-
14
- definition.clientConfig = {
15
- contactTypes: config.contactTypes,
16
- notificationTypes: config.notificationTypes
17
- }
18
-
19
12
  export default definition
package/index.js CHANGED
@@ -5,5 +5,6 @@ import definition from './definition.js'
5
5
 
6
6
  import './notification.js'
7
7
  import './settings.js'
8
+ import './config.js'
8
9
 
9
10
  export default definition
package/notification.js CHANGED
@@ -212,7 +212,7 @@ definition.trigger({
212
212
  },
213
213
  ...config.fields
214
214
  },
215
- async execute(params , { service }, emit) {
215
+ async execute(params , { service, trigger }, emit) {
216
216
  const { sessionOrUserType, sessionOrUser, notificationType } = params
217
217
  if(!sessionOrUserType || !sessionOrUser) throw new Error("session or user required")
218
218
  const notification = app.generateUid()
@@ -224,8 +224,11 @@ definition.trigger({
224
224
  notification,
225
225
  data: { ...data, sessionOrUserType, sessionOrUser, time, readState: 'new' }
226
226
  })
227
- await app.trigger({ type: 'notificationCreated' }, {
227
+ await trigger({ type: 'notificationCreated' }, {
228
228
  notification,
229
+ sessionOrUser,
230
+ sessionOrUserType,
231
+ time,
229
232
  ...data
230
233
  })
231
234
  return notification
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/notification-service",
3
- "version": "0.9.31",
3
+ "version": "0.9.33",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,8 +21,8 @@
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
  },
26
- "gitHead": "4e12be9d3f339492bb9ddc3c6c77581e52d1ba60",
26
+ "gitHead": "c6eaa7764dc12b9489b74386b1227b71d0640e09",
27
27
  "type": "module"
28
28
  }
package/settings.js CHANGED
@@ -10,7 +10,7 @@ async function clientOwnsContact({ user }, { contactType, contact }) {
10
10
  const [service, model] = contactType.split('_')
11
11
  if(!config.contactTypes.includes(service)) return false
12
12
  const contactData = await app.dao.get(['database', 'tableObject', app.databaseName, contactType, contact ])
13
- return contactData.user == user
13
+ return contactData.user === user
14
14
  }
15
15
 
16
16
  const NotificationSetting = definition.model({