@data-fair/lib-node 2.6.0 → 2.7.0
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/events-queue.js +20 -10
- package/package.json +2 -2
package/events-queue.js
CHANGED
|
@@ -70,16 +70,26 @@ export class EventsQueue {
|
|
|
70
70
|
if (this.stopped) { throw new Error('events queue has been stopped') }
|
|
71
71
|
event.date = new Date().toISOString()
|
|
72
72
|
debug('pushEvent', event)
|
|
73
|
-
if (sessionState && sessionState.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
name: sessionState.
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
if (!event.originator && sessionState?.user && sessionState.account) {
|
|
74
|
+
if (sessionState.user.asAdmin) {
|
|
75
|
+
event.originator = {
|
|
76
|
+
user: { ...sessionState.user.asAdmin, admin: true }
|
|
77
|
+
}
|
|
78
|
+
} else if (sessionState.user.adminMode && (sessionState.account.type !== event.sender?.type || sessionState.account.id !== event.sender?.id)) {
|
|
79
|
+
event.originator = {
|
|
80
|
+
user: { id: sessionState.user.id, name: sessionState.user.name, admin: true }
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
event.originator = {
|
|
84
|
+
user: { id: sessionState.user.id, name: sessionState.user.name }
|
|
85
|
+
}
|
|
86
|
+
if (sessionState.organization) {
|
|
87
|
+
event.originator.organization = {
|
|
88
|
+
id: sessionState.organization.id,
|
|
89
|
+
name: sessionState.organization.name,
|
|
90
|
+
department: sessionState.organization.department,
|
|
91
|
+
departmentName: sessionState.organization.departmentName
|
|
92
|
+
}
|
|
83
93
|
}
|
|
84
94
|
}
|
|
85
95
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@data-fair/lib-node",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Small nodejs related utility functions for the data-fair stack.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"build": "cd .. && npm run build"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@data-fair/lib-common-types": "^1.
|
|
17
|
+
"@data-fair/lib-common-types": "^1.8.4",
|
|
18
18
|
"@data-fair/lib-validation": "^1.0.0",
|
|
19
19
|
"@data-fair/lib-utils": "^1.1.0",
|
|
20
20
|
"agentkeepalive": "^4.5.0",
|