@live-change/user-service 0.8.14 → 0.8.16

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/definition.js CHANGED
@@ -8,4 +8,10 @@ const definition = app.createServiceDefinition({
8
8
  use: [ relationsPlugin ]
9
9
  })
10
10
 
11
+ const config = definition.config
12
+
13
+ definition.clientConfig = {
14
+ remoteAccountTypes: config.remoteAccountTypes
15
+ }
16
+
11
17
  export default definition
package/index.js CHANGED
@@ -60,6 +60,7 @@ definition.trigger({
60
60
 
61
61
  definition.action({
62
62
  name: 'signOut',
63
+ waitForEvents: true,
63
64
  async execute({ }, { client, service }, emit) {
64
65
  if(!client.user) throw "notSignedIn"
65
66
  await service.trigger({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/user-service",
3
- "version": "0.8.14",
3
+ "version": "0.8.16",
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.14",
26
- "@live-change/relations-plugin": "^0.8.14",
25
+ "@live-change/framework": "^0.8.16",
26
+ "@live-change/relations-plugin": "^0.8.16",
27
27
  "pluralize": "^8.0.0"
28
28
  },
29
- "gitHead": "d81b573fb8891746ae1c67f4f68558123c9f85f7"
29
+ "gitHead": "b8ac84cbe1a8c435c7b5003dfc64ddc41a4e15a6"
30
30
  }
@@ -139,7 +139,7 @@ definition.processor(function(service, app) {
139
139
  lte: '_'+ params[propertyName]
140
140
  }
141
141
  const path = modelRuntime().indexObjectPath('bySessionOrUser', owner, range )
142
- //console.log("DAO PATH", path, "range", range, 'params', params)
142
+ //console.log("DAO PATH", path, "range", range, 'params', params, 'result', await app.dao.get(path))
143
143
  return path
144
144
  }
145
145
  })
@@ -171,7 +171,7 @@ definition.processor(function(service, app) {
171
171
  properties: App.rangeProperties,
172
172
  daoPath(range, { client, context }) {
173
173
  const owner = client.user ? ['user_User', client.user] : ['session_Session', client.session]
174
- return modelRuntime().sortedIndexRangePath('bySsessionOrUser' + sortFieldUc, owner, App.extractRange(range))
174
+ return modelRuntime().sortedIndexRangePath('bySessionOrUser' + sortFieldUc, owner, App.extractRange(range))
175
175
  }
176
176
  })
177
177
  }
@@ -232,11 +232,11 @@ definition.processor(function(service, app) {
232
232
  async execute(properties, { client, service }, emit) {
233
233
  const entity = await modelRuntime().get(properties[modelPropertyName])
234
234
  if(!entity) throw 'not_found'
235
- if(entity.sessionOrUserType == 'user_User') {
236
- if(entity.sessionOrUser != client.user) throw 'not_authorized'
235
+ if(entity.sessionOrUserType === 'user_User') {
236
+ if(entity.sessionOrUser !== client.user) throw 'not_authorized'
237
237
  }
238
- if(entity.sessionOrUserType == 'session_Session') {
239
- if(entity.sessionOrUser != client.session) throw 'not_authorized'
238
+ if(entity.sessionOrUserType === 'session_Session') {
239
+ if(entity.sessionOrUser !== client.session) throw 'not_authorized'
240
240
  }
241
241
  let updateObject = {}
242
242
  for(const propertyName of writeableProperties) {
@@ -244,7 +244,9 @@ definition.processor(function(service, app) {
244
244
  updateObject[propertyName] = properties[propertyName]
245
245
  }
246
246
  }
247
- const merged = App.utils.mergeDeep({}, entity, updateObject)
247
+ const merged = App.utils.mergeDeep({ [modelPropertyName]: properties[modelPropertyName] },
248
+ entity, updateObject)
249
+
248
250
  await App.validation.validate(merged, validators, { source: action, action, service, app, client })
249
251
  const identifiers = client.user ? {
250
252
  sessionOrUserType: 'user_User',
@@ -281,11 +283,11 @@ definition.processor(function(service, app) {
281
283
  async execute(properties, { client, service }, emit) {
282
284
  const entity = await modelRuntime().get(properties[modelPropertyName])
283
285
  if(!entity) throw 'not_found'
284
- if(entity.sessionOrUserType == 'user_User') {
285
- if(entity.sessionOrUser != client.user) throw 'not_authorized'
286
+ if(entity.sessionOrUserType === 'user_User') {
287
+ if(entity.sessionOrUser !== client.user) throw 'not_authorized'
286
288
  }
287
- if(entity.sessionOrUserType == 'session_Session') {
288
- if(entity.sessionOrUser != client.session) throw 'not_authorized'
289
+ if(entity.sessionOrUserType === 'session_Session') {
290
+ if(entity.sessionOrUser !== client.session) throw 'not_authorized'
289
291
  }
290
292
  const identifiers = client.user ? {
291
293
  sessionOrUserType: 'user_User',