@live-change/relations-plugin 0.8.34 → 0.8.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/relations-plugin",
3
- "version": "0.8.34",
3
+ "version": "0.8.36",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "type": "module",
24
24
  "dependencies": {
25
- "@live-change/framework": "^0.8.34",
25
+ "@live-change/framework": "^0.8.36",
26
26
  "pluralize": "^8.0.0"
27
27
  },
28
- "gitHead": "40e61928bf43b35352c76fc135f36a2d8bd76c4a"
28
+ "gitHead": "24694d1687f0ab2d6eb7edd95e5274428cfd44eb"
29
29
  }
@@ -100,12 +100,14 @@ function defineRangeViews(config, context, external = true) {
100
100
 
101
101
  function getSetFunction( validators, validationContext, config, context) {
102
102
  const {
103
- service, app, model, objectType,
103
+ service, app, model, objectType, modelRuntime,
104
104
  otherPropertyNames, joinedOthersPropertyName, modelName, writeableProperties, joinedOthersClassName
105
105
  } = context
106
106
  const eventName = joinedOthersPropertyName + context.reverseRelationWord + modelName + 'Set'
107
107
  return async function execute(properties, { client, service }, emit) {
108
108
  const identifiers = extractIdentifiersWithTypes(otherPropertyNames, properties)
109
+ const id = generateAnyId(otherPropertyNames, properties)
110
+ const entity = await modelRuntime().get(id)
109
111
  const data = extractObjectData(writeableProperties, properties,
110
112
  App.computeDefaults(model, properties, { client, service } ))
111
113
  await App.validation.validate({ ...identifiers, ...data }, validators,
@@ -115,6 +117,7 @@ function getSetFunction( validators, validationContext, config, context) {
115
117
  type: eventName,
116
118
  identifiers, data
117
119
  })
120
+ return id
118
121
  }
119
122
  }
120
123