@live-change/relations-plugin 0.9.162 → 0.9.164

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.9.162",
3
+ "version": "0.9.164",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "type": "module",
24
24
  "dependencies": {
25
- "@live-change/framework": "^0.9.162",
25
+ "@live-change/framework": "^0.9.164",
26
26
  "pluralize": "^8.0.0"
27
27
  },
28
28
  "devDependencies": {
@@ -30,5 +30,5 @@
30
30
  "typedoc-plugin-markdown": "^4.6.3",
31
31
  "typedoc-plugin-rename-defaults": "^0.7.3"
32
32
  },
33
- "gitHead": "59cd1485ca6d76bd87a6634a92d6e661e5803d5e"
33
+ "gitHead": "38f9fb8b01a9527d8f6036e174edd1fa41443301"
34
34
  }
@@ -339,9 +339,13 @@ function getResetFunction(config, context) {
339
339
  if (!entity) throw new Error('not_found')
340
340
  await fireChangeTriggers(context, objectType, identifiers, id,
341
341
  entity ? extractObjectData(writeableProperties, entity, {}) : null, null, trigger)
342
+
342
343
  emit({
343
- type: eventName,
344
- identifiers
344
+ type: eventName,
345
+ identifiers: {
346
+ ...identifiers,
347
+ [modelPropertyName]: properties[modelPropertyName]
348
+ }
345
349
  })
346
350
  return id
347
351
  }
package/src/utilsAny.ts CHANGED
@@ -220,22 +220,22 @@ export function addAccessControlAnyParents(context) {
220
220
  )
221
221
  }
222
222
 
223
- export function prepareAccessControl(accessControl, names) {
223
+ export function prepareAccessControl(accessControl, names, types = undefined) {
224
224
  if(typeof accessControl == 'object') {
225
- accessControl.objects = accessControl.objects ?? ((params) => names.map(name => ({
226
- objectType: params[name + 'Type'],
225
+ accessControl.objects = accessControl.objects ?? ((params) => names.map((name, index) => ({
226
+ objectType: types?.[index] ?? params[name + 'Type'],
227
227
  object: params[name]
228
228
  })))
229
229
  }
230
230
  }
231
231
 
232
- export function cloneAndPrepareAccessControl(accessControl, names) {
232
+ export function cloneAndPrepareAccessControl(accessControl, names, types = undefined) {
233
233
  if(!accessControl) return accessControl
234
234
  if(Array.isArray(accessControl)) {
235
235
  accessControl = { roles: accessControl}
236
236
  }
237
237
  const newAccessControl = { ...accessControl }
238
- prepareAccessControl(newAccessControl, names)
238
+ prepareAccessControl(newAccessControl, names, types)
239
239
  return newAccessControl
240
240
  }
241
241