@live-change/message-authentication-service 0.8.117 → 0.8.119

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/authentication.js CHANGED
@@ -34,6 +34,18 @@ const targetProperties = {
34
34
  type: Object
35
35
  }
36
36
  }
37
+ },
38
+ fallbackPage: {
39
+ type: Object,
40
+ properties: {
41
+ name: {
42
+ type: String,
43
+ validation: ['nonEmpty']
44
+ },
45
+ params: {
46
+ type: Object
47
+ }
48
+ }
37
49
  }
38
50
  }
39
51
 
@@ -64,11 +76,12 @@ const Authentication = definition.model({
64
76
 
65
77
  definition.event({
66
78
  name: 'authenticationCreated',
67
- execute({ authentication, contactType, contact, action, actionProperties, targetPage, messageData }) {
79
+ execute({ authentication, contactType, contact, action, actionProperties,
80
+ targetPage, fallbackPage, messageData }) {
68
81
  return Authentication.create({
69
82
  id: authentication,
70
83
  contactType, contact,
71
- action, actionProperties, targetPage,
84
+ action, actionProperties, targetPage, fallbackPage,
72
85
  messageData,
73
86
  state: 'created'
74
87
  })
@@ -102,7 +115,7 @@ definition.trigger({
102
115
  ...targetProperties,
103
116
  ...messageProperties
104
117
  },
105
- async execute({ contactType, contact, action, actionProperties, targetPage, messageData },
118
+ async execute({ contactType, contact, action, actionProperties, targetPage, fallbackPage, messageData },
106
119
  { client, service }, emit) {
107
120
  const authentication = app.generateUid()
108
121
  const secrets = await service.trigger({ type: 'authenticationSecret' }, {
@@ -127,6 +140,7 @@ definition.trigger({
127
140
  action,
128
141
  actionProperties,
129
142
  targetPage,
143
+ fallbackPage,
130
144
  messageData
131
145
  })
132
146
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/message-authentication-service",
3
- "version": "0.8.117",
3
+ "version": "0.8.119",
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.117",
24
+ "@live-change/framework": "^0.8.119",
25
25
  "nodemailer": "^6.7.2"
26
26
  },
27
- "gitHead": "10546047b3799e2dae072c9270b9469af92ea48f",
27
+ "gitHead": "1f0bb577d5bfe8b8d355775d7adbd73c789cd1d5",
28
28
  "type": "module"
29
29
  }
package/sign.js CHANGED
@@ -99,9 +99,8 @@ for(const contactType of config.contactTypes) {
99
99
  ...contactTypeProperties
100
100
  },
101
101
  async execute({ [contactTypeName]: contact }, { _client, service }, _emit) {
102
- const contactData = await service.trigger({ type: 'get' + contactTypeUName }, {
103
- [contactTypeName]: contact,
104
- })
102
+ const contactData = await app.viewGet('get'+contactTypeUName, { [contactType]: contact })
103
+ if(!contactData) throw { properties: { email: 'notFound' } }
105
104
  const messageData = {
106
105
  user: contactData.user
107
106
  }
@@ -179,9 +178,7 @@ for(const contactType of config.contactTypes) {
179
178
  ...contactTypeProperties
180
179
  },
181
180
  async execute({ [contactTypeName]: contact }, { client, service }, _emit) {
182
- const contactData = await service.trigger({ type: 'get' + contactTypeUName + 'OrNull' }, {
183
- [contactTypeName]: contact,
184
- })
181
+ const contactData = await app.viewGet('get'+contactTypeUName, { [contactType]: contact })
185
182
  if(contactData) {
186
183
  const messageData = {
187
184
  user: contactData.user