@live-change/access-control-service 0.2.32 → 0.2.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.
Files changed (2) hide show
  1. package/invite.js +51 -2
  2. package/package.json +3 -3
package/invite.js CHANGED
@@ -60,6 +60,47 @@ definition.event({
60
60
  }
61
61
  })
62
62
 
63
+ definition.trigger({
64
+ name: 'contactOrUserOwnedInvitationMoved',
65
+ properties: {
66
+ ...contactProperties,
67
+ from: {
68
+ contactOrUserType: {
69
+ type: String
70
+ },
71
+ contactOrUser: {
72
+ type: String
73
+ }
74
+ },
75
+ to: {
76
+ contactOrUserType: {
77
+ type: String
78
+ },
79
+ contactOrUser: {
80
+ type: String
81
+ }
82
+ },
83
+ objectType: {
84
+ type: String
85
+ },
86
+ object: {
87
+ type: String
88
+ }
89
+ },
90
+ async execute({ from, to, objectType, object }, { service }, emit) {
91
+ if(to.contactOrUserType == 'user_User') {
92
+ await service.trigger({
93
+ type: 'notify',
94
+ sessionOrUserType: 'user_User',
95
+ sessionOrUser: to.contactOrUser,
96
+ notificationType: 'accessControl_Invitation',
97
+ objectType,
98
+ object
99
+ })
100
+ }
101
+ }
102
+ })
103
+
63
104
  definition.trigger({
64
105
  name: 'inviteWithMessageAuthenticated',
65
106
  waitForEvents: true,
@@ -144,10 +185,18 @@ for(const contactType of config.contactTypes) {
144
185
  [contactType]: contact,
145
186
  }))[0]
146
187
  if(contactData?.user) { // user exists
147
- /// TODO: Trigger notification
188
+ const { user } = contactData
189
+ await service.trigger({
190
+ type: 'notify',
191
+ sessionOrUserType: 'user_User',
192
+ sessionOrUser: user,
193
+ notificationType: 'accessControl_Invitation',
194
+ objectType,
195
+ object
196
+ })
148
197
  emit({
149
198
  type: 'userInvited',
150
- user: contactData.user,
199
+ user,
151
200
  objectType, object,
152
201
  ...invitationData
153
202
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/access-control-service",
3
- "version": "0.2.32",
3
+ "version": "0.2.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.6.4"
24
+ "@live-change/framework": "0.6.5"
25
25
  },
26
- "gitHead": "91f89af637893c2dbc0e1f55b2886345d408a9ea"
26
+ "gitHead": "8918e5113c031c3d9766df32283de7fb6421e0be"
27
27
  }