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

@icapps/chat-astrum

Package Overview
Dependencies
Maintainers
5
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@icapps/chat-astrum - npm Package Compare versions

Comparing version 1.0.7 to 1.1.0

.DS_Store

7

build/constants.d.ts

@@ -0,1 +1,2 @@

import { IConversationType } from './models/conversation.model';
export declare const envs: {

@@ -8,5 +9,5 @@ TEST: string;

export declare const VALID_CHAT_TYPES: {
SINGLE: string;
GROUP: string;
DEPARTMENT: string;
SINGLE: IConversationType;
GROUP: IConversationType;
DEPARTMENT: IConversationType;
};
import * as conversation from './services/conversation.service';
import * as db from './lib/db';
import * as socket from './lib/socket';
export * from './models/index';
export { conversation, db, };
export { conversation, db, socket, };

@@ -7,1 +7,3 @@ "use strict";

exports.db = db;
const socket = require("./lib/socket");
exports.socket = socket;

@@ -0,2 +1,3 @@

import * as mongoose from 'mongoose';
export declare let dbConnection: mongoose.Connection | null;
export declare function openConnection(url: string): Promise<void>;
export declare function closeConnection(): Promise<void>;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const mongoose = require("mongoose");
const logger_1 = require("./logger");
let dbConnection;
mongoose.set('useFindAndModify', false);

@@ -18,8 +9,8 @@ function openConnection(url) {

mongoose.connect(url, { useNewUrlParser: true });
dbConnection = mongoose.connection;
dbConnection.on('error', (err) => {
exports.dbConnection = mongoose.connection;
exports.dbConnection.on('error', (err) => {
logger_1.logger.error(err);
reject(err);
});
dbConnection.once('open', () => {
exports.dbConnection.once('open', () => {
logger_1.logger.info('Connected to the Mongo database!');

@@ -31,8 +22,1 @@ resolve();

exports.openConnection = openConnection;
function closeConnection() {
return __awaiter(this, void 0, void 0, function* () {
if (dbConnection)
return yield dbConnection.close();
});
}
exports.closeConnection = closeConnection;
import { Document, Schema, Model } from 'mongoose';
import { IDBMessage } from './message.model';
export declare type IConversationType = 'SINGLE' | 'GROUP' | 'DEPARTMENT';
export interface IParticipants {
departmentId: string;
employmentIds: string[];
}
export interface IConversationBaseOperation {
firstName: string;
participants: Partial<IParticipants>;
type: IConversationType;
}

@@ -9,7 +15,4 @@ export interface IConversationCreate extends IConversationBaseOperation {

export interface IDBConversation extends Document {
participants: {
departmentId: string;
employmentIds: string[];
};
type: string;
participants: IParticipants;
type: IConversationType;
messages: IDBMessage[];

@@ -16,0 +19,0 @@ meta: {

import { Types } from 'mongoose';
import { IDBConversation } from '../models/conversation.model';
import { IDBConversation, IConversationCreate } from '../models/conversation.model';
import { IConversationRights } from '../models/rights.model';
import { IFilters } from '../models/filter.model';
export declare function findConversationById(id: Types.ObjectId): Promise<IDBConversation>;
export declare function createConversation(values: IConversationCreate): Promise<IDBConversation>;
export declare function findMyConversations(rights: IConversationRights, filters?: IFilters): Promise<{

@@ -7,0 +8,0 @@ data: IDBConversation[];

@@ -16,2 +16,6 @@ "use strict";

exports.findConversationById = findConversationById;
function createConversation(values) {
return conversation_model_1.Conversation.create(values);
}
exports.createConversation = createConversation;
function findMyConversations(rights, filters = { limit: 50, offset: 0 }) {

@@ -18,0 +22,0 @@ return __awaiter(this, void 0, void 0, function* () {

import { Types } from 'mongoose';
import { IDBConversation } from '../models/conversation.model';
import { IDBConversation, IParticipants } from '../models/conversation.model';
import { IConversationRights } from '../models/rights.model';

@@ -10,2 +10,3 @@ import { IFilters } from '../models/filter.model';

}>;
export declare function startConversation(holdingId: string, participants: Partial<IParticipants>): Promise<IDBConversation>;
export declare function markAsRead(conversationId: Types.ObjectId, employmentId: string): Promise<void>;

@@ -11,3 +11,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const socket = require("../lib/socket");
const conversationRepository = require("../repositories/conversation.repository");
const utils_1 = require("../lib/utils");
function findConversationById(id) {

@@ -21,2 +23,11 @@ return conversationRepository.findConversationById(id);

exports.findMyConversations = findMyConversations;
function startConversation(holdingId, participants) {
return __awaiter(this, void 0, void 0, function* () {
const type = utils_1.getConversationType(participants);
const conversation = yield conversationRepository.createConversation({ participants, type });
socket.addNamespace(holdingId);
return conversation;
});
}
exports.startConversation = startConversation;
function markAsRead(conversationId, employmentId) {

@@ -23,0 +34,0 @@ return __awaiter(this, void 0, void 0, function* () {

{
"name": "@icapps/chat-astrum",
"version": "1.0.7",
"version": "1.1.0",
"description": "Chat module ESS",

@@ -26,2 +26,3 @@ "main": "build/index.js",

"mongoose": "~5.5.11",
"socket.io": "~2.2.0",
"winston": "~3.2.1"

@@ -31,2 +32,3 @@ },

"@types/faker": "^4.1.5",
"@types/socket.io": "~2.1.2",
"@types/jest": "^24.0.13",

@@ -33,0 +35,0 @@ "@types/joi": "^14.3.3",

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