@live-change/user-service 0.8.149 → 0.9.0

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.
@@ -65,7 +65,7 @@ definition.processor(function(service, app) {
65
65
  const { transferred, updated, deleted } = mergeResult
66
66
  for(const entity of transferred) {
67
67
  emit({
68
- type: 'ownerOwned' + modelName + 'Transferred',
68
+ type: modelName + 'Transferred',
69
69
  [modelPropertyName]: entity.id,
70
70
  to: {
71
71
  id: entity.id,
@@ -76,7 +76,7 @@ definition.processor(function(service, app) {
76
76
  }
77
77
  for(const entity of updated) {
78
78
  emit({
79
- type: 'ownerOwned' + modelName + 'Updated',
79
+ type: modelName + 'Updated',
80
80
  [modelPropertyName]: entity.id,
81
81
  identifiers: {
82
82
  id: entity.id,
@@ -88,7 +88,7 @@ definition.processor(function(service, app) {
88
88
  }
89
89
  for(const entity of deleted) {
90
90
  emit({
91
- type: 'ownerOwned' + modelName + 'Deleted',
91
+ type: modelName + 'Deleted',
92
92
  [modelPropertyName]: entity.id,
93
93
  })
94
94
  }
@@ -96,7 +96,7 @@ definition.processor(function(service, app) {
96
96
  } else {
97
97
  for(const entity of contactItems) {
98
98
  emit({
99
- type: 'ownerOwned' + modelName + 'Transferred',
99
+ type: modelName + 'Transferred',
100
100
  [modelPropertyName]: entity.id,
101
101
  identifiers: {
102
102
  id: entity.id,
@@ -142,7 +142,7 @@ definition.processor(function(service, app) {
142
142
  }
143
143
 
144
144
  if(config.ownerCreateAccess || config.ownerWriteAccess) {
145
- const eventName = 'ownerOwned' + modelName + 'Created'
145
+ const eventName = modelName + 'Created'
146
146
  const actionName = 'createMy' + modelName
147
147
  service.actions[actionName] = new ActionDefinition({
148
148
  name: actionName,
@@ -176,7 +176,7 @@ definition.processor(function(service, app) {
176
176
  })
177
177
  }
178
178
  if(config.ownerUpdateAccess || config.ownerWriteAccess) {
179
- const eventName = 'ownerOwned' + modelName + 'Updated'
179
+ const eventName = modelName + 'Updated'
180
180
  const actionName = 'updateMy' + modelName
181
181
  service.actions[actionName] = new ActionDefinition({
182
182
  name: actionName,
@@ -225,7 +225,7 @@ definition.processor(function(service, app) {
225
225
  const validators = App.validation.getValidators(action, service, action)
226
226
  }
227
227
  if(config.userDeleteAccess || config.userWriteAccess) {
228
- const eventName = 'userOwned' + modelName + 'Deleted'
228
+ const eventName = modelName + 'Deleted'
229
229
  const actionName = 'deleteMyUser' + modelName
230
230
  service.actions[actionName] = new ActionDefinition({
231
231
  name: actionName,
@@ -40,8 +40,7 @@ definition.processor(function(service, app) {
40
40
  to: ['contactOrUser', ...extendedWith]
41
41
  }
42
42
 
43
- const transferEventName = ['contactOrUser', ...(extendedWith.map(e => e[0].toUpperCase() + e.slice(1)))]
44
- .join('And') + 'Owned' + modelName + 'Transferred'
43
+ const transferEventName = modelName + 'Transferred'
45
44
 
46
45
  service.trigger({
47
46
  name: 'contactConnected',
@@ -77,7 +76,7 @@ definition.processor(function(service, app) {
77
76
  const mergeResult = await config.merge(contactProperty, userProperty)
78
77
  if(mergeResult && userProperty) {
79
78
  emit({
80
- type: 'contactOrUserOwned' + modelName + 'Updated',
79
+ type: modelName + 'Updated',
81
80
  identifiers: {
82
81
  contactOrUserType: 'user_User',
83
82
  contactOrUser: user
@@ -86,7 +85,7 @@ definition.processor(function(service, app) {
86
85
  })
87
86
  } else {
88
87
  emit({
89
- type: 'contactOrUserOwned' + modelName + 'Set',
88
+ type: modelName + 'Set',
90
89
  identifiers: {
91
90
  contactOrUserType: 'user_User',
92
91
  contactOrUser: user
@@ -95,7 +94,7 @@ definition.processor(function(service, app) {
95
94
  })
96
95
  }
97
96
  emit({
98
- type: 'contactOrUserOwned' + modelName + 'Reset',
97
+ type: modelName + 'Reset',
99
98
  identifiers: {
100
99
  contactOrUserType: contactType,
101
100
  contactOrUser: contact
@@ -108,7 +107,7 @@ definition.processor(function(service, app) {
108
107
  extendedIdentifiers[key+'Type'] = contactProperty[key+'Type']
109
108
  extendedIdentifiers[key] = contactProperty[key]
110
109
  }
111
- await service.trigger({ type: 'contactOrUserOwned' + modelName + 'Moved' }, {
110
+ await service.trigger({ type: modelName + 'Moved' }, {
112
111
  from: {
113
112
  contactOrUserType: contactType,
114
113
  contactOrUser: contact
@@ -206,9 +205,7 @@ definition.processor(function(service, app) {
206
205
  }
207
206
  }
208
207
 
209
- const eventPrefix = ['contactOrUser',
210
- ...(extendedWith.map(p => p[0].toUpperCase()+p.slice(1)))
211
- ].join('And') +'Owned'
208
+ const eventPrefix = ''
212
209
 
213
210
  if(config.ownerSetAccess || config.ownerWriteAccess) {
214
211
  const eventName = eventPrefix + modelName + 'Set'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/user-service",
3
- "version": "0.8.149",
3
+ "version": "0.9.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,9 +22,9 @@
22
22
  },
23
23
  "type": "module",
24
24
  "dependencies": {
25
- "@live-change/framework": "^0.8.149",
26
- "@live-change/relations-plugin": "^0.8.149",
25
+ "@live-change/framework": "^0.9.0",
26
+ "@live-change/relations-plugin": "^0.9.0",
27
27
  "pluralize": "^8.0.0"
28
28
  },
29
- "gitHead": "0854ef672e27b8f3ea70ffeb788a33638844121e"
29
+ "gitHead": "b82513f5b400afcc4b8cc3ae1f9dfe4ac3a2a6eb"
30
30
  }
@@ -59,7 +59,7 @@ definition.processor(function(service, app) {
59
59
  const { transferred, updated, deleted } = mergeResult
60
60
  for(const entity of transferred) {
61
61
  emit({
62
- type: 'sessionOrUserOwned' + modelName + 'Transferred',
62
+ type: modelName + 'Transferred',
63
63
  [modelPropertyName]: entity.id,
64
64
  to: {
65
65
  sessionOrUserType: 'user_User',
@@ -69,7 +69,7 @@ definition.processor(function(service, app) {
69
69
  }
70
70
  for(const entity of updated) {
71
71
  emit({
72
- type: 'sessionOrUserOwned' + modelName + 'Updated',
72
+ type: modelName + 'Updated',
73
73
  [modelPropertyName]: entity.id,
74
74
  identifiers: {
75
75
  id: entity.id,
@@ -81,7 +81,7 @@ definition.processor(function(service, app) {
81
81
  }
82
82
  for(const entity of deleted) {
83
83
  emit({
84
- type: 'sessionOrUserOwned' + modelName + 'Deleted',
84
+ type: modelName + 'Deleted',
85
85
  [modelPropertyName]: entity.id,
86
86
  })
87
87
  }
@@ -89,7 +89,7 @@ definition.processor(function(service, app) {
89
89
  } else {
90
90
  for(const entity of sessionItems) {
91
91
  emit({
92
- type: 'sessionOrUserOwned' + modelName + 'Transferred',
92
+ type: modelName + 'Transferred',
93
93
  [modelPropertyName]: entity.id,
94
94
  identifiers: {
95
95
  id: entity.id
@@ -177,7 +177,7 @@ definition.processor(function(service, app) {
177
177
  }
178
178
 
179
179
  if(config.ownerCreateAccess || config.ownerWriteAccess) {
180
- const eventName = 'sessionOrUserOwned' + modelName + 'Created'
180
+ const eventName = modelName + 'Created'
181
181
  const actionName = 'createMy' + modelName
182
182
  service.actions[actionName] = new ActionDefinition({
183
183
  name: actionName,
@@ -213,7 +213,7 @@ definition.processor(function(service, app) {
213
213
  })
214
214
  }
215
215
  if(config.ownerUpdateAccess || config.ownerWriteAccess) {
216
- const eventName = 'sessionOrUserOwned' + modelName + 'Updated'
216
+ const eventName = modelName + 'Updated'
217
217
  const actionName = 'updateMy' + modelName
218
218
  service.actions[actionName] = new ActionDefinition({
219
219
  name: actionName,
@@ -41,8 +41,7 @@ definition.processor(function(service, app) {
41
41
 
42
42
  modelProperties.push(...extendedWith.map(p => [p, p+'Type']).flat())
43
43
 
44
- const transferEventName = ['sessionOrUser', ...(extendedWith.map(e => e[0].toUpperCase() + e.slice(1)))]
45
- .join('And') + 'Owned' + modelName + 'Transferred'
44
+ const transferEventName = modelName + 'Transferred'
46
45
 
47
46
  service.trigger({
48
47
  name: 'signedIn',
@@ -83,7 +82,7 @@ definition.processor(function(service, app) {
83
82
  const mergeResult = await config.merge(sessionProperty, userProperty)
84
83
  if(mergeResult && userProperty) {
85
84
  emit({
86
- type: 'sessionOrUserOwned' + modelName + 'Updated',
85
+ type: modelName + 'Updated',
87
86
  identifiers: {
88
87
  sessionOrUserType: 'user_User',
89
88
  sessionOrUser: user
@@ -92,7 +91,7 @@ definition.processor(function(service, app) {
92
91
  })
93
92
  } else {
94
93
  emit({
95
- type: 'sessionOrUserOwned' + modelName + 'Set',
94
+ type: modelName + 'Set',
96
95
  identifiers: {
97
96
  sessionOrUserType: 'user_User',
98
97
  sessionOrUser: user
@@ -102,7 +101,7 @@ definition.processor(function(service, app) {
102
101
  }
103
102
  if(!config.mergeWithoutDelete) {
104
103
  emit({
105
- type: 'sessionOrUserOwned' + modelName + 'Reset',
104
+ type: modelName + 'Reset',
106
105
  identifiers: {
107
106
  sessionOrUserType: 'session_Session',
108
107
  sessionOrUser: session
@@ -111,7 +110,7 @@ definition.processor(function(service, app) {
111
110
  }
112
111
  } else {
113
112
  if(!userProperty) {
114
- await service.trigger({ type: 'contactOrUserOwned' + modelName + 'Moved' }, {
113
+ await service.trigger({ type: modelName + 'Moved' }, {
115
114
  from: {
116
115
  sessionOrUserType: 'session_Session',
117
116
  sessionOrUser: session,
@@ -228,10 +227,7 @@ definition.processor(function(service, app) {
228
227
  }
229
228
  }
230
229
 
231
- const eventPrefix = ['sessionOrUser',
232
- ...(extendedWith.map(p => p[0].toUpperCase()+p.slice(1)))
233
- ].join('And') +'Owned'
234
-
230
+ const eventPrefix = ''
235
231
  if(config.ownerSetAccess || config.ownerWriteAccess) {
236
232
  const eventName = eventPrefix + modelName + 'Set'
237
233
  const actionName = 'setMy' + modelName
package/userItem.js CHANGED
@@ -64,7 +64,7 @@ definition.processor(function(service, app) {
64
64
  }
65
65
 
66
66
  if(config.userCreateAccess || config.userWriteAccess) {
67
- const eventName = 'userOwned' + modelName + 'Created'
67
+ const eventName = modelName + 'Created'
68
68
  const actionName = 'createMyUser' + modelName
69
69
  service.actions[actionName] = new ActionDefinition({
70
70
  name: actionName,
@@ -95,7 +95,7 @@ definition.processor(function(service, app) {
95
95
  })
96
96
  }
97
97
  if(config.userUpdateAccess || config.userWriteAccess) {
98
- const eventName = 'userOwned' + modelName + 'Updated'
98
+ const eventName = modelName + 'Updated'
99
99
  const actionName = 'updateMyUser' + modelName
100
100
  service.actions[actionName] = new ActionDefinition({
101
101
  name: actionName,
@@ -136,7 +136,7 @@ definition.processor(function(service, app) {
136
136
  const validators = App.validation.getValidators(action, service, action)
137
137
  }
138
138
  if(config.userDeleteAccess || config.userWriteAccess) {
139
- const eventName = 'userOwned' + modelName + 'Deleted'
139
+ const eventName = modelName + 'Deleted'
140
140
  const actionName = 'deleteMyUser' + modelName
141
141
  service.actions[actionName] = new ActionDefinition({
142
142
  name: actionName,
package/userProperty.js CHANGED
@@ -65,7 +65,7 @@ definition.processor(function(service, app) {
65
65
  }
66
66
 
67
67
  if(config.userSetAccess || config.userWriteAccess) {
68
- const eventName = 'userOwned' + modelName + 'Set'
68
+ const eventName = modelName + 'Set'
69
69
  const actionName = 'setMyUser' + modelName
70
70
  service.actions[actionName] = new ActionDefinition({
71
71
  name: actionName,
@@ -100,7 +100,7 @@ definition.processor(function(service, app) {
100
100
  }
101
101
 
102
102
  if(config.userUpdateAccess || config.userWriteAccess) {
103
- const eventName = 'userOwned' + modelName + 'Updated'
103
+ const eventName = modelName + 'Updated'
104
104
  const actionName = 'updateMyUser' + modelName
105
105
  service.actions[actionName] = new ActionDefinition({
106
106
  name: actionName,
@@ -136,7 +136,7 @@ definition.processor(function(service, app) {
136
136
  }
137
137
 
138
138
  if(config.userResetAccess || config.userWriteAccess) {
139
- const eventName = 'userOwned' + modelName + 'Reset'
139
+ const eventName = modelName + 'Reset'
140
140
  const actionName = 'resetMyUser' + modelName
141
141
  service.actions[actionName] = new ActionDefinition({
142
142
  name: actionName,