@live-change/user-service 0.9.198 → 0.9.200

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.
@@ -115,8 +115,11 @@ definition.processor(function(service, app) {
115
115
  }
116
116
  })
117
117
 
118
+ if (!model.ownerCrud) model.ownerCrud = {}
119
+
118
120
  if(config.ownerReadAccess) {
119
121
  const viewName = 'my' + pluralize(modelName)
122
+ model.ownerCrud.range ??= viewName
120
123
  service.views[viewName] = new ViewDefinition({
121
124
  name: viewName,
122
125
  access(params, context) {
@@ -191,6 +194,7 @@ definition.processor(function(service, app) {
191
194
  return id
192
195
  }
193
196
  })
197
+ model.ownerCrud.create ??= actionName
194
198
  const action = service.actions[actionName]
195
199
  const validators = App.validation.getValidators(action, service, action)
196
200
  }
@@ -233,7 +237,7 @@ definition.processor(function(service, app) {
233
237
  const computedUpdates = App.computeUpdates(model, { ...entity, ...properties }, { client, service })
234
238
  const data = App.utils.mergeDeep({}, updateObject, computedUpdates)
235
239
  const merged = App.utils.mergeDeep({}, entity, data)
236
- await App.validation.validate({ ...identifiers, ...merged }, validators,
240
+ await App.validation.validate({ ...identifiers, ...merged, [modelPropertyName]: entity.id }, validators,
237
241
  { source: action, action, service, app, client })
238
242
  emit({
239
243
  type: eventName,
@@ -243,6 +247,7 @@ definition.processor(function(service, app) {
243
247
  })
244
248
  }
245
249
  })
250
+ model.ownerCrud.update ??= actionName
246
251
  const action = service.actions[actionName]
247
252
  const validators = App.validation.getValidators(action, service, action)
248
253
  }
@@ -281,6 +286,7 @@ definition.processor(function(service, app) {
281
286
  })
282
287
  }
283
288
  })
289
+ model.ownerCrud.delete ??= actionName
284
290
  }
285
291
  }
286
292
  }
@@ -142,8 +142,11 @@ definition.processor(function(service, app) {
142
142
  }
143
143
  })
144
144
 
145
+ if (!model.ownerCrud) model.ownerCrud = {}
146
+
145
147
  if(config.ownerReadAccess) { // single item view
146
148
  const viewName = 'my' + modelName
149
+ model.ownerCrud.read ??= viewName
147
150
  const identifiers = createIdentifiersProperties(extendedWith)
148
151
  service.views[viewName] = new ViewDefinition({
149
152
  name: viewName,
@@ -258,6 +261,7 @@ definition.processor(function(service, app) {
258
261
  })
259
262
  }
260
263
  })
264
+ model.ownerCrud.create ??= actionName
261
265
  const action = service.actions[actionName]
262
266
  const validators = App.validation.getValidators(action, service, action)
263
267
  }
@@ -309,6 +313,7 @@ definition.processor(function(service, app) {
309
313
  })
310
314
  }
311
315
  })
316
+ model.ownerCrud.update ??= actionName
312
317
  const action = service.actions[actionName]
313
318
  const validators = App.validation.getValidators(action, service, action)
314
319
  }
@@ -346,6 +351,7 @@ definition.processor(function(service, app) {
346
351
  })
347
352
  }
348
353
  })
354
+ model.ownerCrud.reset ??= actionName
349
355
  }
350
356
 
351
357
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/user-service",
3
- "version": "0.9.198",
3
+ "version": "0.9.200",
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.9.198",
26
- "@live-change/relations-plugin": "^0.9.198",
25
+ "@live-change/framework": "^0.9.200",
26
+ "@live-change/relations-plugin": "^0.9.200",
27
27
  "pluralize": "^8.0.0"
28
28
  },
29
- "gitHead": "7e485dcbaa2af7fb17052a40238210dc8bdf0c09"
29
+ "gitHead": "a509834e600a546297faa7d1534b6f52e66d2e66"
30
30
  }
@@ -37,6 +37,8 @@ definition.processor(function(service, app) {
37
37
  sessionOrUserTypes: ['session_Session', 'user_User']
38
38
  }
39
39
 
40
+ if (!model.ownerCrud) model.ownerCrud = {}
41
+
40
42
  service.trigger({
41
43
  name: 'signedIn',
42
44
  properties: {
@@ -147,6 +149,7 @@ definition.processor(function(service, app) {
147
149
 
148
150
  if(config.ownerReadAccess) {
149
151
  const viewName = 'my' + pluralize(modelName)
152
+ model.ownerCrud.range ??= viewName
150
153
  service.views[viewName] = new ViewDefinition({
151
154
  name: viewName,
152
155
  access(params, context) {
@@ -179,6 +182,7 @@ definition.processor(function(service, app) {
179
182
 
180
183
  if(config.ownerReadAccess) {
181
184
  const viewName = 'my' + modelName
185
+ model.ownerCrud.read ??= viewName
182
186
  const propertyName = modelName[0].toLowerCase() + modelName.slice(1)
183
187
  service.views[viewName] = new ViewDefinition({
184
188
  name: viewName,
@@ -251,6 +255,7 @@ definition.processor(function(service, app) {
251
255
  return id
252
256
  }
253
257
  })
258
+ model.ownerCrud.create ??= actionName
254
259
  const action = service.actions[actionName]
255
260
  const validators = App.validation.getValidators(action, service, action)
256
261
  }
@@ -296,7 +301,7 @@ definition.processor(function(service, app) {
296
301
  const data = App.utils.mergeDeep({}, updateObject, computedUpdates)
297
302
  const merged = App.utils.mergeDeep({ [modelPropertyName]: properties[modelPropertyName] },
298
303
  entity, data)
299
- await App.validation.validate({ ...identifiers, ...merged }, validators,
304
+ await App.validation.validate({ ...identifiers, ...merged, [modelPropertyName]: entity.id }, validators,
300
305
  { source: action, action, service, app, client })
301
306
  emit({
302
307
  type: eventName,
@@ -306,6 +311,7 @@ definition.processor(function(service, app) {
306
311
  })
307
312
  }
308
313
  })
314
+ model.ownerCrud.update ??= actionName
309
315
  const action = service.actions[actionName]
310
316
  const validators = App.validation.getValidators(action, service, action)
311
317
  }
@@ -346,6 +352,7 @@ definition.processor(function(service, app) {
346
352
  })
347
353
  }
348
354
  })
355
+ model.ownerCrud.delete ??= actionName
349
356
  }
350
357
  }
351
358
  }
@@ -157,10 +157,13 @@ definition.processor(function(service, app) {
157
157
  })
158
158
  */
159
159
 
160
+ if (!model.ownerCrud) model.ownerCrud = {}
161
+
160
162
  const extendedIdentifiersProperties = createIdentifiersProperties(extendedWith)
161
163
 
162
164
  if(config.ownerReadAccess) { // single item view
163
165
  const viewName = 'my' + modelName
166
+ model.ownerCrud.read ??= viewName
164
167
  service.views[viewName] = new ViewDefinition({
165
168
  name: viewName,
166
169
  properties: {
@@ -187,6 +190,7 @@ definition.processor(function(service, app) {
187
190
  const indexName = 'by' + (['SessionOrUser', ...combination])
188
191
  .map(prop => prop[0].toUpperCase() + prop.slice(1))
189
192
  const viewName = 'my' + propsUpperCase.join('And') + pluralize(modelName)
193
+ model.ownerCrud.range ??= viewName
190
194
  const identifiers = createIdentifiersProperties(combination)
191
195
  service.views[viewName] = new ViewDefinition({
192
196
  name: viewName,
@@ -275,6 +279,7 @@ definition.processor(function(service, app) {
275
279
  })
276
280
  }
277
281
  })
282
+ model.ownerCrud.create ??= actionName
278
283
  const action = service.actions[actionName]
279
284
  const validators = App.validation.getValidators(action, service, action)
280
285
  }
@@ -327,6 +332,7 @@ definition.processor(function(service, app) {
327
332
  })
328
333
  }
329
334
  })
335
+ model.ownerCrud.update ??= actionName
330
336
  const action = service.actions[actionName]
331
337
  const validators = App.validation.getValidators(action, service, action)
332
338
  }
@@ -393,6 +399,7 @@ definition.processor(function(service, app) {
393
399
  }
394
400
  }
395
401
  })
402
+ model.ownerCrud.createOrUpdate ??= actionName
396
403
  const action = service.actions[actionName]
397
404
  const validators = App.validation.getValidators(action, service, action)
398
405
  }
@@ -431,6 +438,7 @@ definition.processor(function(service, app) {
431
438
  })
432
439
  }
433
440
  })
441
+ model.ownerCrud.reset ??= actionName
434
442
  }
435
443
 
436
444
  }
package/userItem.js CHANGED
@@ -30,10 +30,13 @@ definition.processor(function(service, app) {
30
30
  ...config
31
31
  }
32
32
 
33
+ if (!model.ownerCrud) model.ownerCrud = {}
34
+
33
35
  /// TODO: delete on userDeleted trigger
34
36
 
35
37
  if(config.userReadAccess) {
36
38
  const viewName = 'myUser' + pluralize(modelName)
39
+ model.ownerCrud.range ??= viewName
37
40
  service.views[viewName] = new ViewDefinition({
38
41
  name: viewName,
39
42
  access(params, context) {
@@ -66,6 +69,7 @@ definition.processor(function(service, app) {
66
69
 
67
70
  if(config.userReadAccess) {
68
71
  const viewName = 'myUser' + modelName
72
+ model.ownerCrud.read ??= viewName
69
73
  service.views[viewName] = new ViewDefinition({
70
74
  name: viewName,
71
75
  async access(params, context) {
@@ -124,6 +128,7 @@ definition.processor(function(service, app) {
124
128
  return id
125
129
  }
126
130
  })
131
+ model.ownerCrud.create ??= actionName
127
132
  const action = service.actions[actionName]
128
133
  const validators = App.validation.getValidators(action, service, action)
129
134
  }
@@ -156,7 +161,7 @@ definition.processor(function(service, app) {
156
161
  const computedUpdates = App.computeUpdates(model, { ...entity, ...properties }, { client, service })
157
162
  const data = App.utils.mergeDeep({}, updateObject, computedUpdates)
158
163
  const merged = App.utils.mergeDeep({}, entity, data)
159
- await App.validation.validate(merged, validators, { source: action, action, service, app, client })
164
+ await App.validation.validate({ ...merged, [modelPropertyName]: entity.id }, validators, { source: action, action, service, app, client })
160
165
  emit({
161
166
  type: eventName,
162
167
  [modelPropertyName]: entity.id,
@@ -167,6 +172,7 @@ definition.processor(function(service, app) {
167
172
  })
168
173
  }
169
174
  })
175
+ model.ownerCrud.update ??= actionName
170
176
  const action = service.actions[actionName]
171
177
  const validators = App.validation.getValidators(action, service, action)
172
178
  }
@@ -197,6 +203,7 @@ definition.processor(function(service, app) {
197
203
  })
198
204
  }
199
205
  })
206
+ model.ownerCrud.delete ??= actionName
200
207
  }
201
208
  }
202
209
  }
package/userProperty.js CHANGED
@@ -30,10 +30,13 @@ definition.processor(function(service, app) {
30
30
  ...config
31
31
  }
32
32
 
33
+ if (!model.ownerCrud) model.ownerCrud = {}
34
+
33
35
  /// TODO: delete on userDeleted trigger
34
36
 
35
37
  if(config.userReadAccess) {
36
38
  const viewName = 'myUser' + modelName
39
+ model.ownerCrud.read ??= viewName
37
40
  service.views[viewName] = new ViewDefinition({
38
41
  name: viewName,
39
42
  access(params, context) {
@@ -95,6 +98,7 @@ definition.processor(function(service, app) {
95
98
  })
96
99
  }
97
100
  })
101
+ model.ownerCrud.create ??= actionName
98
102
  const action = service.actions[actionName]
99
103
  const validators = App.validation.getValidators(action, service, action)
100
104
  }
@@ -134,6 +138,7 @@ definition.processor(function(service, app) {
134
138
  })
135
139
  }
136
140
  })
141
+ model.ownerCrud.update ??= actionName
137
142
  const action = service.actions[actionName]
138
143
  const validators = App.validation.getValidators(action, service, action)
139
144
  }
@@ -157,6 +162,7 @@ definition.processor(function(service, app) {
157
162
  })
158
163
  }
159
164
  })
165
+ model.ownerCrud.reset ??= actionName
160
166
  }
161
167
 
162
168
  }