@live-change/message-authentication-service 0.8.14 → 0.8.15
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/package.json +3 -3
- package/sign.js +12 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/message-authentication-service",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.15",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"url": "https://www.viamage.com/"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@live-change/framework": "^0.8.
|
|
24
|
+
"@live-change/framework": "^0.8.15",
|
|
25
25
|
"nodemailer": "^6.7.2"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "4897eefbf3ce9ace57630127da89503c71114563",
|
|
28
28
|
"type": "module"
|
|
29
29
|
}
|
package/sign.js
CHANGED
|
@@ -11,7 +11,7 @@ definition.trigger({
|
|
|
11
11
|
properties: {
|
|
12
12
|
...contactProperties
|
|
13
13
|
},
|
|
14
|
-
async execute({ contactType, contact, session }, { service },
|
|
14
|
+
async execute({ contactType, contact, session }, { service }, _emit) {
|
|
15
15
|
const contactTypeUpperCase = contactType[0].toUpperCase() + contactType.slice(1)
|
|
16
16
|
const user = app.generateUid()
|
|
17
17
|
await service.trigger({
|
|
@@ -33,7 +33,7 @@ definition.trigger({
|
|
|
33
33
|
properties: {
|
|
34
34
|
...contactProperties
|
|
35
35
|
},
|
|
36
|
-
async execute({ contactType, contact, session }, {
|
|
36
|
+
async execute({ contactType, contact, session }, { service }, _emit) {
|
|
37
37
|
const contactTypeUpperCase = contactType[0].toUpperCase() + contactType.slice(1)
|
|
38
38
|
const user = await service.trigger({
|
|
39
39
|
type: 'signIn' + contactTypeUpperCase,
|
|
@@ -50,7 +50,7 @@ definition.trigger({
|
|
|
50
50
|
properties: {
|
|
51
51
|
...contactProperties
|
|
52
52
|
},
|
|
53
|
-
async execute({ contactType, contact, user }, { client, service },
|
|
53
|
+
async execute({ contactType, contact, user }, { client, service }, _emit) {
|
|
54
54
|
const contactTypeUpperCase = contactType[0].toUpperCase() + contactType.slice(1)
|
|
55
55
|
await service.trigger({
|
|
56
56
|
type: 'connect' + contactTypeUpperCase,
|
|
@@ -81,7 +81,7 @@ for(const contactType of config.contactTypes) {
|
|
|
81
81
|
properties: {
|
|
82
82
|
...contactTypeProperties
|
|
83
83
|
},
|
|
84
|
-
async execute({ [contactTypeName]: contact }, {
|
|
84
|
+
async execute({ [contactTypeName]: contact }, { service }, _emit) {
|
|
85
85
|
await service.trigger({
|
|
86
86
|
type: 'checkNew' + contactTypeUName,
|
|
87
87
|
[contactTypeName]: contact,
|
|
@@ -104,7 +104,7 @@ for(const contactType of config.contactTypes) {
|
|
|
104
104
|
properties: {
|
|
105
105
|
...contactTypeProperties
|
|
106
106
|
},
|
|
107
|
-
async execute({ [contactTypeName]: contact }, {
|
|
107
|
+
async execute({ [contactTypeName]: contact }, { _client, service }, _emit) {
|
|
108
108
|
const contactData = await service.trigger({
|
|
109
109
|
type: 'get' + contactTypeUName,
|
|
110
110
|
[contactTypeName]: contact,
|
|
@@ -133,7 +133,7 @@ for(const contactType of config.contactTypes) {
|
|
|
133
133
|
access: (params, { client }) => {
|
|
134
134
|
return !!client.user
|
|
135
135
|
},
|
|
136
|
-
async execute({ [contactTypeName]: contact }, { client, service },
|
|
136
|
+
async execute({ [contactTypeName]: contact }, { client, service }, _emit) {
|
|
137
137
|
await service.trigger({
|
|
138
138
|
type: 'checkNew' + contactTypeUName,
|
|
139
139
|
[contactTypeName]: contact,
|
|
@@ -162,15 +162,17 @@ for(const contactType of config.contactTypes) {
|
|
|
162
162
|
access: (params, { client }) => {
|
|
163
163
|
return !!client.user
|
|
164
164
|
},
|
|
165
|
-
async execute({ [contactTypeName]: contact }, { client, service },
|
|
165
|
+
async execute({ [contactTypeName]: contact }, { client, service }, _emit) {
|
|
166
166
|
const contacts = (await service.trigger({
|
|
167
167
|
type: 'getConnectedContacts',
|
|
168
168
|
user: client.user
|
|
169
169
|
})).flat()
|
|
170
170
|
console.log("CONTACTS", contacts, contactTypeName, contact)
|
|
171
|
-
const contactData = contacts.find(c =>
|
|
171
|
+
const contactData = contacts.find(c =>
|
|
172
|
+
c.type === contactTypeName && c.contact === contact
|
|
173
|
+
)
|
|
172
174
|
if(!contactData) throw 'notFound'
|
|
173
|
-
if(contacts.length
|
|
175
|
+
if(contacts.length === 1) throw 'lastOne'
|
|
174
176
|
console.log("DISCONNECT", contact)
|
|
175
177
|
return await service.trigger({
|
|
176
178
|
type: 'disconnect' + contactTypeUName,
|
|
@@ -188,7 +190,7 @@ for(const contactType of config.contactTypes) {
|
|
|
188
190
|
properties: {
|
|
189
191
|
...contactTypeProperties
|
|
190
192
|
},
|
|
191
|
-
async execute({ [contactTypeName]: contact }, { client, service },
|
|
193
|
+
async execute({ [contactTypeName]: contact }, { client, service }, _emit) {
|
|
192
194
|
const contactData = await service.trigger({
|
|
193
195
|
type: 'get' + contactTypeUName + 'OrNull',
|
|
194
196
|
[contactTypeName]: contact,
|