@live-change/relations-plugin
Advanced tools
Comparing version 0.8.51 to 0.8.52
@@ -9,21 +9,18 @@ import { extractObjectData, extractIdentifiers } from "./dataUtils.js" | ||
const changeType = data ? (oldData ? 'update' : 'create') : 'delete' | ||
//console.log("FIRE CHANGE TRIGGERS", { context, objectType, identifiers, object, oldData, data }) | ||
//console.trace() | ||
const triggerParameters = { objectType, object, identifiers, data, oldData, changeType } | ||
await Promise.all([ | ||
app.trigger({ | ||
type: changeType + service.name[0].toUpperCase() + service.name.slice(1) + '_' + modelName, | ||
}, { | ||
objectType, | ||
object, | ||
identifiers, | ||
data, | ||
oldData | ||
}), | ||
}, triggerParameters), | ||
app.trigger({ | ||
type: changeType + 'Object', | ||
}, { | ||
objectType, | ||
object, | ||
identifiers, | ||
data, | ||
oldData | ||
}) | ||
}, triggerParameters), | ||
app.trigger({ | ||
type: 'change' + service.name[0].toUpperCase() + service.name.slice(1) + '_' + modelName, | ||
}, triggerParameters), | ||
app.trigger({ | ||
type: 'changeObject', | ||
}, triggerParameters) | ||
]) | ||
@@ -205,3 +202,3 @@ } | ||
//console.log("COPY TRIGGER RESULTS", copyTriggerResults) | ||
if(copyTriggerResults.length == 0) { // normal copy, without special logic | ||
if(copyTriggerResults.length === 0) { // normal copy, without special logic | ||
await copyObject(context, myType, fromId, objectType, object, identifiers, data, emit) | ||
@@ -208,0 +205,0 @@ } |
@@ -195,3 +195,3 @@ import { | ||
validationContext) | ||
await fireChangeTriggers(context, null, id, | ||
await fireChangeTriggers(context, objectType, null, id, | ||
entity ? extractObjectData(writeableProperties, entity, {}) : null, data) | ||
@@ -198,0 +198,0 @@ emit({ |
{ | ||
"name": "@live-change/relations-plugin", | ||
"version": "0.8.51", | ||
"version": "0.8.52", | ||
"description": "", | ||
@@ -25,6 +25,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"@live-change/framework": "^0.8.51", | ||
"@live-change/framework": "^0.8.52", | ||
"pluralize": "^8.0.0" | ||
}, | ||
"gitHead": "ba8da813894eeb717223aa8d5e364649e4ac0347" | ||
"gitHead": "d06ad62415cc92e15b5dee87078614d4f883eb83" | ||
} |
@@ -219,3 +219,3 @@ import App from '@live-change/framework' | ||
const eventName = joinedOthersPropertyName + 'Owned' + modelName + 'Updated' | ||
const actionName = 'update' + joinedOthersClassName + 'Owned' + modelName | ||
const actionName = 'setOrUpdate' + joinedOthersClassName + 'Owned' + modelName | ||
const accessControl = config.updateAccessControl || config.writeAccessControl | ||
@@ -246,3 +246,3 @@ prepareAccessControl(accessControl, otherPropertyNames, others) | ||
} = context | ||
const actionName = 'update' + joinedOthersClassName + 'Owned' + modelName | ||
const actionName = 'setOrUpdate' + joinedOthersClassName + 'Owned' + modelName | ||
const triggerName = `${service.name}_${actionName}` | ||
@@ -249,0 +249,0 @@ const trigger = new TriggerDefinition({ |
128413
3174