@live-change/email-service 0.2.8 → 0.2.9

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.
Files changed (2) hide show
  1. package/auth.js +15 -0
  2. package/package.json +2 -2
package/auth.js CHANGED
@@ -136,6 +136,7 @@ definition.trigger({
136
136
  async execute({ user, email }, { client, service }, emit) {
137
137
  const emailData = await Email.get(email)
138
138
  if(!emailData) throw { properties: { email: 'notFound' } }
139
+ if(emailData.user != user) throw { properties: { email: 'notFound' } }
139
140
  emit({
140
141
  type: 'emailDisconnected',
141
142
  user, email
@@ -162,4 +163,18 @@ definition.trigger({
162
163
  }
163
164
  })
164
165
 
166
+ definition.trigger({
167
+ name: "getConnectedContacts",
168
+ properties: {
169
+ user: {
170
+ type: User,
171
+ validation: ['nonEmpty', 'email']
172
+ }
173
+ },
174
+ async execute({ user }, context, emit) {
175
+ const emails = await Email.indexRangeGet('byUser', user)
176
+ return emails.map(email => ({ ...email, type: 'email', contact: email.email }))
177
+ }
178
+ })
179
+
165
180
  module.exports = { Email }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/email-service",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -28,5 +28,5 @@
28
28
  "jsdom": "^18.1.1",
29
29
  "nodemailer": "^6.7.2"
30
30
  },
31
- "gitHead": "1e8102d02b6745fea401e967c211c6a9cb03e19b"
31
+ "gitHead": "5362172c498a5d131b945c4a2f4644565a5c9a3c"
32
32
  }