@live-change/user-service 0.9.229 → 0.9.230
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/ownerChangeTriggers.js +24 -8
- package/package.json +4 -4
package/ownerChangeTriggers.js
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import App from '@live-change/framework'
|
|
2
2
|
import { fireChangeTriggers, extractObjectData } from '@live-change/relations-plugin'
|
|
3
3
|
|
|
4
|
+
function fireOwnedChange({
|
|
5
|
+
service, modelName, app, objectType, object, identifiers, oldData, data, trigger
|
|
6
|
+
}) {
|
|
7
|
+
return fireChangeTriggers({
|
|
8
|
+
service,
|
|
9
|
+
modelName,
|
|
10
|
+
app,
|
|
11
|
+
objectType,
|
|
12
|
+
object,
|
|
13
|
+
identifiers,
|
|
14
|
+
oldData,
|
|
15
|
+
data,
|
|
16
|
+
trigger
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
|
|
4
20
|
export function propertyIdFromOwnerParts(ownerParts) {
|
|
5
21
|
return ownerParts.map(p => JSON.stringify(p)).join(':')
|
|
6
22
|
}
|
|
@@ -22,7 +38,7 @@ export async function fireItemOwnerTransferChange({
|
|
|
22
38
|
}) {
|
|
23
39
|
const oldData = extractObjectData(writeableProperties, entity, {})
|
|
24
40
|
const data = App.utils.mergeDeep({}, oldData, to)
|
|
25
|
-
await
|
|
41
|
+
await fireOwnedChange({
|
|
26
42
|
service, modelName, app, objectType, object: entity.id,
|
|
27
43
|
identifiers: { ...to },
|
|
28
44
|
oldData,
|
|
@@ -35,7 +51,7 @@ export async function fireItemUpdateChange({
|
|
|
35
51
|
service, modelName, app, objectType, writeableProperties,
|
|
36
52
|
entity, data, identifiers, trigger
|
|
37
53
|
}) {
|
|
38
|
-
await
|
|
54
|
+
await fireOwnedChange({
|
|
39
55
|
service, modelName, app, objectType, object: entity.id,
|
|
40
56
|
identifiers,
|
|
41
57
|
oldData: extractObjectData(writeableProperties, entity, {}),
|
|
@@ -48,7 +64,7 @@ export async function fireItemDeleteChange({
|
|
|
48
64
|
service, modelName, app, objectType, writeableProperties,
|
|
49
65
|
entity, identifiers, trigger
|
|
50
66
|
}) {
|
|
51
|
-
await
|
|
67
|
+
await fireOwnedChange({
|
|
52
68
|
service, modelName, app, objectType, object: entity.id,
|
|
53
69
|
identifiers: identifiers || {
|
|
54
70
|
sessionOrUserType: entity.sessionOrUserType,
|
|
@@ -65,7 +81,7 @@ export async function fireItemDeleteChange({
|
|
|
65
81
|
export async function firePropertySetChange({
|
|
66
82
|
service, modelName, app, objectType, id, identifiers, data, trigger
|
|
67
83
|
}) {
|
|
68
|
-
await
|
|
84
|
+
await fireOwnedChange({
|
|
69
85
|
service, modelName, app, objectType, object: id,
|
|
70
86
|
identifiers, oldData: null, data, trigger
|
|
71
87
|
})
|
|
@@ -75,7 +91,7 @@ export async function firePropertyUpdateChange({
|
|
|
75
91
|
service, modelName, app, objectType, writeableProperties,
|
|
76
92
|
id, identifiers, entity, data, trigger
|
|
77
93
|
}) {
|
|
78
|
-
await
|
|
94
|
+
await fireOwnedChange({
|
|
79
95
|
service, modelName, app, objectType, object: id,
|
|
80
96
|
identifiers,
|
|
81
97
|
oldData: entity ? extractObjectData(writeableProperties, entity, {}) : null,
|
|
@@ -88,7 +104,7 @@ export async function firePropertyResetChange({
|
|
|
88
104
|
service, modelName, app, objectType, writeableProperties,
|
|
89
105
|
id, identifiers, entity, trigger
|
|
90
106
|
}) {
|
|
91
|
-
await
|
|
107
|
+
await fireOwnedChange({
|
|
92
108
|
service, modelName, app, objectType, object: id,
|
|
93
109
|
identifiers,
|
|
94
110
|
oldData: extractObjectData(writeableProperties, entity, {}),
|
|
@@ -104,14 +120,14 @@ export async function firePropertyTransferChange({
|
|
|
104
120
|
const fromId = polymorphicPropertyId(fromIdentifiers, ownerPrefix, extendedWith)
|
|
105
121
|
const toId = polymorphicPropertyId(toIdentifiers, ownerPrefix, extendedWith)
|
|
106
122
|
const data = extractObjectData(writeableProperties, sourceEntity, {})
|
|
107
|
-
await
|
|
123
|
+
await fireOwnedChange({
|
|
108
124
|
service, modelName, app, objectType, object: fromId,
|
|
109
125
|
identifiers: fromIdentifiers,
|
|
110
126
|
oldData: data,
|
|
111
127
|
data: null,
|
|
112
128
|
trigger
|
|
113
129
|
})
|
|
114
|
-
await
|
|
130
|
+
await fireOwnedChange({
|
|
115
131
|
service, modelName, app, objectType, object: toId,
|
|
116
132
|
identifiers: toIdentifiers,
|
|
117
133
|
oldData: null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/user-service",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.230",
|
|
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.9.
|
|
26
|
-
"@live-change/relations-plugin": "^0.9.
|
|
25
|
+
"@live-change/framework": "^0.9.230",
|
|
26
|
+
"@live-change/relations-plugin": "^0.9.230",
|
|
27
27
|
"pluralize": "^8.0.0"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "dce3ca9bbe8c025874a4927dc1b273566d0bee67"
|
|
30
30
|
}
|