@live-change/user-service
Advanced tools
Comparing version 0.2.28 to 0.2.29
@@ -42,2 +42,5 @@ const definition = require("./definition.js") | ||
const transferEventName = ['contactOrUser', ...(extendedWith.map(e => e[0].toUpperCase() + e.slice(1)))] | ||
.join('And') + 'Owned' + modelName + 'Transferred' | ||
service.trigger({ | ||
@@ -62,4 +65,10 @@ name: 'contactConnected', | ||
const contactPropertyId = contactPath.map(p => JSON.stringify(p)).join(':') | ||
const contactProperty = await modelRuntime().get(contactPropertyId) | ||
if(contactProperty) { | ||
const range = { | ||
gte: contactPropertyId + '', // '' because it can be not-extended | ||
lte: contactPropertyId + ':\xFF' | ||
} | ||
const contactProperties = await modelRuntime().rangeGet(range) | ||
/// TODO: list based merge method | ||
for(const contactProperty of contactProperties) { | ||
console.log("CONTACT PROPERTY FOUND!", contactProperty, "MERGE =", config.merge) | ||
const userPath = ['user_User', user] | ||
@@ -74,4 +83,4 @@ const userPropertyId = userPath.map(p => JSON.stringify(p)).join(':') | ||
identifiers: { | ||
ownerType: 'user_User', | ||
owner: user | ||
contactOrUserType: 'user_User', | ||
contactOrUser: user | ||
}, | ||
@@ -84,4 +93,4 @@ data: mergeResult | ||
identifiers: { | ||
ownerType: 'user_User', | ||
owner: user | ||
contactOrUserType: 'user_User', | ||
contactOrUser: user | ||
}, | ||
@@ -94,4 +103,4 @@ data: mergeResult | ||
identifiers: { | ||
ownerType: contactType, | ||
owner: contact | ||
contactOrUserType: contactType, | ||
contactOrUser: contact | ||
} | ||
@@ -101,11 +110,18 @@ }) | ||
if(!userProperty) { | ||
const extendedIdentifiers = {} | ||
for(const key of extendedWith) { | ||
extendedIdentifiers[key+'Type'] = contactProperty[key+'Type'] | ||
extendedIdentifiers[key] = contactProperty[key] | ||
} | ||
emit({ | ||
type: 'contactOrUserOwned' + modelName + 'Transferred', | ||
type: transferEventName, | ||
from: { | ||
ownerType: contactType, | ||
owner: contact | ||
contactOrUserType: contactType, | ||
contactOrUser: contact, | ||
...extendedIdentifiers | ||
}, | ||
to: { | ||
ownerType: 'user_User', | ||
owner: user | ||
contactOrUserType: 'user_User', | ||
contactOrUser: user, | ||
...extendedIdentifiers | ||
} | ||
@@ -112,0 +128,0 @@ }) |
{ | ||
"name": "@live-change/user-service", | ||
"version": "0.2.28", | ||
"version": "0.2.29", | ||
"description": "", | ||
@@ -24,7 +24,7 @@ "main": "index.js", | ||
"dependencies": { | ||
"@live-change/framework": "0.6.0", | ||
"@live-change/relations-plugin": "0.6.0", | ||
"@live-change/framework": "0.6.3", | ||
"@live-change/relations-plugin": "0.6.3", | ||
"pluralize": "8.0.0" | ||
}, | ||
"gitHead": "34309fef58572e1a8794b52438430dd421c57d65" | ||
"gitHead": "37d229ac05adf5e045ae3dcc826c6945d5dc3670" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61950
1536
+ Added@live-change/framework@0.6.3(transitive)
+ Added@live-change/relations-plugin@0.6.3(transitive)
- Removed@live-change/framework@0.6.0(transitive)
- Removed@live-change/relations-plugin@0.6.0(transitive)
Updated@live-change/framework@0.6.3