Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@evo/chat-core

Package Overview
Dependencies
Maintainers
12
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evo/chat-core - npm Package Compare versions

Comparing version 0.8.3 to 0.8.4

2

lib/besida.js

@@ -341,5 +341,5 @@ 'use strict';

mutatedChat = mutatedChat.set('isThereNewMsgs', true);
mutatedChat = mutatedChat.set('room_status', c.CHAT_STATUS_ACTIVE);
}
mutatedChat = mutatedChat.set('last_message_counter', lastMessage);
mutatedChat = mutatedChat.set('room_status', c.CHAT_STATUS_ACTIVE);
mutatedChat = mutatedChat.set('last_read_counter', lastRead);

@@ -346,0 +346,0 @@

@@ -6,19 +6,4 @@ 'use strict';

});
var _isEmpty2 = require('lodash/isEmpty');
var _isEmpty3 = _interopRequireDefault(_isEmpty2);
var _max2 = require('lodash/max');
var _max3 = _interopRequireDefault(_max2);
var _find2 = require('lodash/find');
var _find3 = _interopRequireDefault(_find2);
var _filter2 = require('lodash/filter');
var _filter3 = _interopRequireDefault(_filter2);
exports.isEmpty = isEmpty;
exports.findObjInArr = findObjInArr;
exports.transformChatsBansCntx = transformChatsBansCntx;

@@ -58,2 +43,26 @@ exports.updateChatsByRegistry = updateChatsByRegistry;

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function isEmpty(obj) {
if (!obj) return true;
if (typeof obj === 'string' || Array.isArray(obj)) return obj.length === 0;
if (obj.constructor.name !== 'Object') return true;
for (var prop in obj) {
// eslint-disable-line
if (obj.hasOwnProperty(prop)) return false;
}
return JSON.stringify(obj) === JSON.stringify({});
}
function findObjInArr(arrObjects, func) {
if (!arrObjects) return {};
var foundObj = arrObjects.find(func);
return foundObj || {};
}
function transformChatsBansCntx(besidaStore) {

@@ -150,3 +159,3 @@ var mutateMarksAndBans = function mutateMarksAndBans(chats) {

if (newMainDialogOponent) {
registryBucket = (0, _filter3.default)(registryBucket, function (bucket) {
registryBucket = (registryBucket || []).filter(function (bucket) {
return bucket.userId === newMainDialogOponent;

@@ -157,4 +166,4 @@ });

var onlineRegistry = (0, _find3.default)(registryBucket, {
status: c.REGISTRY_STATUS_ACTIVE
var onlineRegistry = findObjInArr(registryBucket, function (registry) {
return registry.status === c.REGISTRY_STATUS_ACTIVE;
});

@@ -167,10 +176,10 @@ if (onlineRegistry) {

var inactiveRegistry = (0, _filter3.default)(registryBucket, function (regObj) {
var inactiveRegistry = (registryBucket || []).filter(function (regObj) {
return regObj.status === c.REGISTRY_STATUS_INACTIVE;
});
if (inactiveRegistry.length > 0) {
var maxInactiveUser = (0, _find3.default)(inactiveRegistry, {
lastActivity: (0, _max3.default)(inactiveRegistry.map(function (regObj) {
var maxInactiveUser = findObjInArr(inactiveRegistry, function (registry) {
return registry.lastActivity === Math.max.apply(Math, _toConsumableArray(inactiveRegistry.map(function (regObj) {
return regObj.lastActivity;
}))
})));
});

@@ -183,6 +192,6 @@ mutatedChat = mutatedChat.merge(_immutable2.default.fromJS(maxInactiveUser));

// coz only offline registry left
mutatedChat = mutatedChat.merge(_immutable2.default.fromJS((0, _find3.default)(registryBucket, {
lastActivity: (0, _max3.default)(registryBucket.map(function (regObj) {
mutatedChat = mutatedChat.merge(_immutable2.default.fromJS(findObjInArr(registryBucket, function (registry) {
return registry.lastActivity === Math.max.apply(Math, _toConsumableArray(registryBucket.map(function (regObj) {
return regObj.lastActivity;
}))
})));
})));

@@ -252,3 +261,3 @@ return mutatedChat;

function validateConfig(swindonObj, userRole) {
if ((0, _isEmpty3.default)(swindonObj) && (0, _isEmpty3.default)(userRole)) throw new Error(c.ERROR_MSG_CONFIG_CANT_BE_EMPTY);
if (isEmpty(swindonObj) && isEmpty(userRole)) throw new Error(c.ERROR_MSG_CONFIG_CANT_BE_EMPTY);

@@ -255,0 +264,0 @@ var baseRoles = [c.BESIDA_ROLE_COMPANY, c.BESIDA_ROLE_BUYER];

{
"name": "@evo/chat-core",
"version": "0.8.3",
"version": "0.8.4",
"description": "core Besida module with base functional set for chat",

@@ -26,9 +26,7 @@ "author": "d.medvinskiy",

"swindon": "0.5.1",
"immutable": "^3.7.4",
"lodash": "4.17.10"
"immutable": "^3.7.4"
},
"peerDependencies": {
"swindon": "0.5.1",
"immutable": "^3.7.4",
"lodash": "4.17.10"
"immutable": "^3.7.4"
},

@@ -35,0 +33,0 @@ "jest": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc