Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@borodindmitriy/base-code

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@borodindmitriy/base-code - npm Package Compare versions

Comparing version
3.0.0
to
3.0.1
+20
lib/back/interfaces/IAppConfig.d.ts
import { JwtFromRequestFunction } from "passport-jwt";
export interface IAppConfig {
jwt: {
form_request: JwtFromRequestFunction;
secret_key: string;
};
db: {
name: string;
url: string;
};
server: {
host: string;
port: number;
};
ws: {
host: string;
port: number;
};
production: boolean;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { Strategy as PassportStrategy } from "passport-strategy";
export interface IAuthStrategy {
getStrategy(): PassportStrategy;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { IConnection } from "./IConnection";
export interface IChannels {
addConnection(a_connection: IConnection): void;
deleteConnection(a_connection: IConnection): void;
on(chName: string, uid: string, wsid: string): void;
off(chName: string, uid: string, wsid: string): void;
send(chName: string, payload: {
[key: string]: any;
}, uid: string, wsid: string, excludeCurrentDevice?: boolean): void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export interface IConnection {
wsid: string;
uid: string | void;
getConnectionID(): string;
isOwner(uid: string): boolean;
isItSelf(uid: string, wsid: string): boolean;
setUserID(uid: string): void;
send(data: any): void;
wasTermintate(): boolean;
close(message?: string): void;
terminate(message?: string): void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { Db } from "mongodb";
export interface IDBConnection {
connection(): Promise<Db>;
disconnect(): Promise<void>;
getDB(): Promise<Db>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export interface IModel<P, I> {
read(): Promise<P[]>;
readById(id: string): Promise<P | null>;
getMap(): Promise<Map<string, P>>;
create(data: object, uid: string, wsid: string): Promise<P | null>;
update(data: object, uid: string, wsid: string): Promise<P | null>;
remove(id: string, uid: string, wsid: string): Promise<P | null>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { Collection, CollectionInsertManyOptions, CollectionInsertOneOptions, CommonOptions, FindOneAndReplaceOption, FindOneOptions, ReplaceOneOptions } from "mongodb";
export interface IRepository<T> {
getCollection(): Promise<Collection<T>>;
onValidation(): Promise<void>;
offValidation(): Promise<void>;
insertMany(docs: object[], options?: CollectionInsertManyOptions): Promise<T[]>;
insertOne(doc: object, options?: CollectionInsertOneOptions): Promise<T>;
find(query: object, options?: FindOneOptions): Promise<T[]>;
updateOne(query: object, update: object, options?: ReplaceOneOptions): Promise<void>;
updateMany(query: object, update: object, options?: ReplaceOneOptions): Promise<void>;
findOne(query: object, options?: FindOneOptions): Promise<T | null>;
findById(id: string, options?: FindOneOptions): Promise<T | null>;
findOneAndUpdate(query: object, update: object, options?: FindOneAndReplaceOption): Promise<T | null>;
deleteOne(query: object, options?: CommonOptions): Promise<void>;
deleteMany(query: object, options?: CommonOptions): Promise<void>;
findOneAndRemove(query: object, options?: {
projection?: object;
sort?: object;
}): Promise<T | null>;
findByIdAndRemove(id: string, options?: {
projection?: object;
sort?: object;
}): Promise<T | null>;
prepareId(data: any): T;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { IInsert } from "interfaces/IInsert";
import { IPersist } from "../../interfaces/IPersist";
import { IUserGroup } from "../../interfaces/IUserGroup";
import { IModel } from "./IModel";
export interface IUserModel<P extends IPersist, I extends IInsert, G extends IUserGroup> extends IModel<P, I> {
signUp(login: string, group: G, password: string, password_confirm: string): Promise<string>;
signIn(login: string, password: string): Promise<string | null>;
updateLogin(id: string, login: string, uid: string, wsid: string): Promise<P | null>;
updatePassword(id: string, password: string, passwordConfirm: string, uid: string, wsid: string): Promise<P | null>;
updateGroup(ids: string[], group: G): Promise<P[]>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { ObservableMap } from "mobx";
import { IStore } from "./IStore";
export interface IRepositoryStore<T> extends IStore {
list: T[];
plainMap: Map<string, T>;
map: ObservableMap<string, T>;
init(): Promise<void>;
create(data: object): Promise<T | void>;
update(data: object): Promise<T | void>;
remove(id: string): Promise<T | void>;
receiveMessage(message: [string, any]): T | void | Promise<void>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export interface IService<T> {
collection: () => Promise<T[] | void>;
model: (id: string) => Promise<T | void>;
create: (data: object) => Promise<T | void>;
update: (data: object) => Promise<T | void>;
remove: (id: string) => Promise<T | void>;
onChannel: () => Promise<void>;
offChannel: () => Promise<void>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export interface IStore {
loading: boolean;
wasInit: boolean;
receiveMessage: (message: any) => void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { IUserGroup } from "interfaces/IUserGroup";
import { IPersist } from "../../interfaces/IPersist";
import { IUser } from "../../interfaces/IUser";
import { IService } from "./IService";
export interface IUserService<U extends IUser<G> & IPersist, G extends IUserGroup> extends IService<U> {
signIn(login: string, password: string): Promise<string | void>;
signUp(login: string, password: string, password_confirm: string, group: G): Promise<string | void>;
load(token: string): Promise<U | void>;
updateLogin(id: string, login: string): Promise<U | void>;
updatePassword(id: string, password: string, password_confirm: string): Promise<U | void>;
updateGroup(ids: string[], group: G): Promise<U[] | void>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { IEventEmitter } from "interfaces/IEventEmitter";
import { IPersist } from "interfaces/IPersist";
import { IUser } from "interfaces/IUser";
import { IUserGroup } from "interfaces/IUserGroup";
export interface IUserStore<U extends IUser<G>, G extends IUserGroup> extends IEventEmitter {
loading: boolean;
user: U & IPersist | null;
userList: Array<U & IPersist>;
id: string;
isToken: boolean;
isUserData: boolean;
isAdmin: boolean;
isAuthorized: boolean;
authorization: boolean;
load(token: string): Promise<void>;
login(login: string, password: string): Promise<string>;
registration(login: string, password: string, password_confirm: string, group: string): Promise<string | void>;
logout(): Promise<void>;
loadUserList(): Promise<void>;
updateLogin(id: string, login: string): Promise<void>;
updatePassword(id: string, password: string, password_confirm: string): Promise<void>;
updateGroup(ids: string[], updateGroup: G): Promise<void>;
remove(id: string): Promise<void>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { IEventEmitter } from "interfaces/IEventEmitter";
export interface IWSClient extends IEventEmitter {
readyState: number;
isAssigment: boolean;
wsid: string;
setUserID(uid: string): void;
connect(): Promise<void>;
reconnect(): void;
disconnect(reason?: string): void;
send(channelName: string, payload: {
[key: string]: any;
}): void;
assigmentToUserOfTheConnection(): Promise<void>;
cancelAssigmentToUserOfTheConnection(): Promise<void>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { ObservableMap } from "mobx";
import { IUser } from "../../interfaces/IUser";
import { IUserGroup } from "../../interfaces/IUserGroup";
import { Store } from "../Store";
import { IRepositoryStore } from "./IRepositoryStore";
import { IService } from "./IService";
import { IUserStore } from "./IUserStore";
import { IWSClient } from "./IWSClient";
export declare class RepositoryStore<T extends {
id: string | void;
}, S extends IService<T>, US extends IUserStore<U, G>, U extends IUser<G>, G extends IUserGroup> extends Store<T, S, US, U, G> implements IRepositoryStore<T> {
protected collection: ObservableMap<string, T>;
protected repoName: string;
protected chName: string;
protected Constructor: {
new (data?: any): T;
};
constructor(service: S, name: string, chName: string, Constructor: {
new (data?: any): T;
}, wsClient: IWSClient, userStore: US);
readonly map: ObservableMap<string, T>;
readonly plainMap: Map<string, T>;
readonly list: T[];
init(): Promise<void>;
create(data: object): Promise<T | void>;
update(data: object): Promise<T | void>;
remove(id: string): Promise<T | void>;
receiveMessage([chName, payload]: [string, any]): T | void | Promise<void>;
protected destroy(): void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const mobx_1 = require("mobx");
const isType_1 = require("../../utils/isType");
const Store_1 = require("../Store");
class RepositoryStore extends Store_1.Store {
constructor(service, name, chName, Constructor, wsClient, userStore) {
super(service, wsClient, userStore);
this.collection = mobx_1.observable.map();
this.repoName = name.toUpperCase();
this.chName = chName;
this.Constructor = Constructor;
this.init = this.init.bind(this);
this.create = this.create.bind(this);
this.update = this.update.bind(this);
this.remove = this.remove.bind(this);
this.receiveMessage = this.receiveMessage.bind(this);
this.destroy = this.destroy.bind(this);
}
get map() {
return this.collection;
}
get plainMap() {
const map = new Map();
this.collection.forEach((val, key) => map.set(key, val));
return map;
}
get list() {
const list = [];
this.collection.forEach((item) => {
list.push(item);
});
return list;
}
init() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (!this.wasInit) {
this.startLoad();
try {
const collection = yield this.service.collection();
if (collection) {
mobx_1.runInAction(`[ REPOSITORY_BASE ][ INIT ][ SUCCESS ]`, () => {
this.collection = collection.reduce((preValue, item) => {
if (isType_1.isString(item.id)) {
preValue.set(item.id, item);
}
return preValue;
}, mobx_1.observable.map());
this.wasInit = true;
});
}
}
catch (error) {
console.error(error);
}
finally {
this.endLoad();
}
}
});
}
create(data) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (!this.loading) {
this.startLoad();
try {
const item = yield this.service.create(data);
if (item) {
mobx_1.runInAction(`[ REPOSITORY_BASE ][ CREATE ][ SUCCESS ]`, () => {
if (isType_1.isString(item.id)) {
this.collection.set(item.id, item);
}
else {
console.error(`[ REPOSITORY_BASE ][ CREATE ] - must have id as string;`, item);
}
});
}
return item;
}
catch (error) {
console.error(error);
}
finally {
this.endLoad();
}
}
});
}
update(data) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (!this.loading) {
this.startLoad();
try {
const item = yield this.service.update(data);
if (item) {
mobx_1.runInAction(`[ REPOSITORY_BASE ][ UPDATE ][ SUCCESS ]`, () => {
if (isType_1.isString(item.id)) {
this.collection.set(item.id, item);
}
else {
console.error(`[ REPOSITORY_BASE ][ UPDATE ][ ERROR ] - must have id as string;`, item);
}
});
}
return item;
}
catch (error) {
return Promise.reject(error);
}
finally {
this.endLoad();
}
}
});
}
remove(id) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (!this.loading) {
this.startLoad();
try {
const item = yield this.service.remove(id);
if (item) {
mobx_1.runInAction(`[ REPOSITORY_BASE ][ REMOVE ][ SUCCESS ]`, () => {
if (isType_1.isString(item.id)) {
this.collection.delete(item.id);
}
else {
console.error(`[ REPOSITORY_BASE ][ REMOVE ][ ERROR ] - must have id as string;`, item);
}
});
}
return item;
}
catch (error) {
console.error(error);
return Promise.reject(error);
}
finally {
this.endLoad();
}
}
});
}
receiveMessage([chName, payload]) {
console.log(`[ ${this.repoName} ][ RECEIVE_MESSAGE ]`, [chName, payload]);
if (this.chName === chName) {
if (payload.create) {
const item = new this.Constructor(payload.create);
if (isType_1.isString(item.id)) {
this.collection.set(item.id, item);
}
else {
console.error(`[ ${this.repoName} ][ RECEIVE_CREATE ] - must have id as string;`, item);
}
return item;
}
if (payload.update) {
const item = new this.Constructor(payload.update);
if (isType_1.isString(item.id)) {
this.collection.set(item.id, item);
}
else {
console.error(`[ ${this.repoName} ][ RECEIVE_UPDATE ] - must have id as string;`, item);
}
return item;
}
if (payload.remove) {
const item = this.collection.get(payload.remove.id);
this.collection.delete(payload.remove.id);
return item;
}
}
}
destroy() {
super.destroy();
this.collection.clear();
}
}
tslib_1.__decorate([
mobx_1.observable
], RepositoryStore.prototype, "collection", void 0);
tslib_1.__decorate([
mobx_1.computed
], RepositoryStore.prototype, "map", null);
tslib_1.__decorate([
mobx_1.computed
], RepositoryStore.prototype, "plainMap", null);
tslib_1.__decorate([
mobx_1.computed
], RepositoryStore.prototype, "list", null);
tslib_1.__decorate([
mobx_1.action(`[ REPOSITORY_BASE ][ UPDATE ]`)
], RepositoryStore.prototype, "update", null);
tslib_1.__decorate([
mobx_1.action(`[ REPOSITORY_BASE ][ RECEIVE_MESSAGE ]`)
], RepositoryStore.prototype, "receiveMessage", null);
exports.RepositoryStore = RepositoryStore;
+8
-0

@@ -0,1 +1,9 @@

export { IUserModel } from "./back/interfaces/IUserModel";
export { IAppConfig } from "./back/interfaces/IAppConfig";
export { IChannels } from "./back/interfaces/IChannels";
export { IConnection } from "./back/interfaces/IConnection";
export { IDBConnection } from "./back/interfaces/IDBConnection";
export { IModel } from "./back/interfaces/IModel";
export { IRepository } from "./back/interfaces/IRepository";
export { IAuthStrategy } from "./back/interfaces/IAuthStrategy";
export { toMongo } from "./back/toMongo";

@@ -2,0 +10,0 @@ export { DBConnection } from "./back/DBConnection";

+1
-1
import { JwtFromRequestFunction } from "passport-jwt";
import { IAppConfig } from "../interfaces/IAppConfig";
import { IAppConfig } from "./interfaces/IAppConfig";
export declare class AppConfig implements IAppConfig {

@@ -4,0 +4,0 @@ readonly jwt: {

import * as express from "express";
import { IAuthStrategy } from "../interfaces/IAuthStrategy";
import { IAppConfig } from "./../interfaces/IAppConfig";
import { IAppConfig } from "./interfaces/IAppConfig";
import { IAuthStrategy } from "./interfaces/IAuthStrategy";
export declare class APPServer {

@@ -5,0 +5,0 @@ private wasRun;

@@ -0,8 +1,8 @@

import { IPersist } from "interfaces/IPersist";
import { IUser } from "interfaces/IUser";
import { IUserGroup } from "interfaces/IUserGroup";
import { Strategy as PassportStrategy } from "passport-strategy";
import { IAppConfig } from "../interfaces/IAppConfig";
import { IAuthStrategy } from "../interfaces/IAuthStrategy";
import { IPersist } from "../interfaces/IPersist";
import { IUser } from "../interfaces/IUser";
import { IUserGroup } from "../interfaces/IUserGroup";
import { IUserModel } from "./../interfaces/IUserModel";
import { IAppConfig } from "./interfaces/IAppConfig";
import { IAuthStrategy } from "./interfaces/IAuthStrategy";
import { IUserModel } from "./interfaces/IUserModel";
export declare class AuthStrategy<P extends IUser<G> & IPersist, I extends IUser<G>, G extends IUserGroup> implements IAuthStrategy {

@@ -9,0 +9,0 @@ protected readonly strategy: PassportStrategy;

import { Db, MongoClient } from "mongodb";
import { IAppConfig } from "../interfaces/IAppConfig";
import { IDBConnection } from "../interfaces/IDBConnection";
import { IAppConfig } from "./interfaces/IAppConfig";
import { IDBConnection } from "./interfaces/IDBConnection";
export declare class DBConnection implements IDBConnection {

@@ -5,0 +5,0 @@ protected client: MongoClient | undefined;

import { CollectionInsertOneOptions, FindOneAndReplaceOption, FindOneOptions } from "mongodb";
import { IInsert, IPersist } from "../interface";
import { IModel } from "../interfaces/IModel";
import { IRepository } from "../interfaces/IRepository";
import { IInsert } from "../interfaces/IInsert";
import { IPersist } from "../interfaces/IPersist";
import { IModel } from "./interfaces/IModel";
import { IRepository } from "./interfaces/IRepository";
export declare class Model<P extends IPersist, I extends IInsert> implements IModel<P, I> {

@@ -6,0 +7,0 @@ protected readonly repository: IRepository<P>;

import { Collection, CollectionCreateOptions, CollectionInsertManyOptions, CollectionInsertOneOptions, CommonOptions, FindOneAndReplaceOption, FindOneOptions, ReplaceOneOptions } from "mongodb";
import { IDBConnection } from "../interfaces/IDBConnection";
import { IRepository } from "../interfaces/IRepository";
import { IDBConnection } from "./interfaces/IDBConnection";
import { IRepository } from "./interfaces/IRepository";
export declare class MongoDBRepository<D> implements IRepository<D> {

@@ -5,0 +5,0 @@ private readonly name;

import * as express from "express";
import { IChannels } from "../interfaces/IChannels";
import { IPersist } from "interfaces/IPersist";
import { IUserGroup } from "interfaces/IUserGroup";
import { IInsert } from "../interfaces/IInsert";
import { IModel } from "../interfaces/IModel";
import { IPersist } from "../interfaces/IPersist";
import { IUserGroup } from "../interfaces/IUserGroup";
import { IChannels } from "./interfaces/IChannels";
import { IModel } from "./interfaces/IModel";
export declare class Service<P extends IPersist, I extends IInsert, C extends IChannels, G extends IUserGroup> {

@@ -8,0 +8,0 @@ protected readonly name: string;

import { ObjectId } from "bson";
import { IInsert } from "../interfaces/IInsert";
import { IInsert } from "interfaces/IInsert";
export declare function toMongo<T extends IInsert>(instance: T): {

@@ -4,0 +4,0 @@ [key: string]: any;

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

const bson_1 = require("bson");
const isType_1 = require("../utils/isType");
const isType_1 = require("utils/isType");
function toMongo(instance) {

@@ -8,0 +8,0 @@ const _a = instance.toJS(), { id } = _a, data = tslib_1.__rest(_a, ["id"]);

@@ -1,7 +0,7 @@

import { IAppConfig } from "../interfaces/IAppConfig";
import { IPersist } from "../interfaces/IPersist";
import { IRepository } from "../interfaces/IRepository";
import { IUser } from "../interfaces/IUser";
import { IUserGroup } from "../interfaces/IUserGroup";
import { IUserModel } from "../interfaces/IUserModel";
import { IUser } from "./../interfaces/IUser";
import { IAppConfig } from "./interfaces/IAppConfig";
import { IRepository } from "./interfaces/IRepository";
import { IUserModel } from "./interfaces/IUserModel";
import { Model } from "./Model";

@@ -8,0 +8,0 @@ export declare class UserModel<P extends IUser<G> & IPersist, I extends IUser<G>, G extends IUserGroup> extends Model<P, I> implements IUserModel<P, I, G> {

@@ -6,7 +6,7 @@ "use strict";

const jwt = require("jsonwebtoken");
const checkPassword_1 = require("utils/checkPassword");
const encryptPassword_1 = require("utils/encryptPassword");
const getSalt_1 = require("utils/getSalt");
const userGroupEnum_1 = require("../enums/userGroupEnum");
const authenticate_1 = require("../utils/authenticate");
const checkPassword_1 = require("../utils/checkPassword");
const encryptPassword_1 = require("../utils/encryptPassword");
const getSalt_1 = require("../utils/getSalt");
const userGroupEnum_1 = require("./../enums/userGroupEnum");
const Model_1 = require("./Model");

@@ -13,0 +13,0 @@ class UserModel extends Model_1.Model {

import * as express from "express";
import { IChannels } from "../interfaces/IChannels";
import { IUser } from "interfaces/IUser";
import { IUserGroup } from "interfaces/IUserGroup";
import { IPersist } from "../interfaces/IPersist";
import { IUser } from "../interfaces/IUser";
import { IUserGroup } from "../interfaces/IUserGroup";
import { IUserModel } from "../interfaces/IUserModel";
import { IChannels } from "./interfaces/IChannels";
import { IUserModel } from "./interfaces/IUserModel";
import { Service } from "./Service";

@@ -8,0 +8,0 @@ export declare class UserService<M extends IUserModel<U & IPersist, U, G>, U extends IUser<G>, G extends IUserGroup> extends Service<U & IPersist, U, IChannels, G> {

@@ -0,1 +1,7 @@

export { IUserStore } from "./front/interfaces/IUserStore";
export { IWSClient } from "./front/interfaces/IWSClient";
export { IService } from "./front/interfaces/IService";
export { IUserService } from "./front/interfaces/IUserService";
export { IStore } from "./front/interfaces/IStore";
export { IRepositoryStore } from "./front/interfaces/IRepositoryStore";
export { UserStore } from "./front/UserStore";

@@ -5,3 +11,3 @@ export { UserService } from "./front/UserService";

export { WSClient } from "./front/WSClient";
export { RepositoryStore } from "./front/RepositoryStore";
export { RepositoryStore } from "./front/interfaces/RepositoryStore";
export { Store } from "./front/Store";

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

exports.WSClient = WSClient_1.WSClient;
var RepositoryStore_1 = require("./front/RepositoryStore");
var RepositoryStore_1 = require("./front/interfaces/RepositoryStore");
exports.RepositoryStore = RepositoryStore_1.RepositoryStore;
var Store_1 = require("./front/Store");
exports.Store = Store_1.Store;

@@ -1,4 +0,4 @@

import { IClientService } from "../interfaces/IClientService";
import { IWSClient } from "../interfaces/IWSClient";
export declare class Service<T> implements IClientService<T> {
import { IService } from "./interfaces/IService";
import { IWSClient } from "./interfaces/IWSClient";
export declare class Service<T> implements IService<T> {
protected name: string;

@@ -5,0 +5,0 @@ protected Class: {

@@ -1,8 +0,8 @@

import { IClientService } from "../interfaces/IClientService";
import { IStore } from "../interfaces/IStore";
import { IUserGroup } from "interfaces/IUserGroup";
import { IUser } from "../interfaces/IUser";
import { IUserGroup } from "../interfaces/IUserGroup";
import { IUserStore } from "../interfaces/IUserStore";
import { IWSClient } from "../interfaces/IWSClient";
export declare class Store<T, S extends IClientService<T>, US extends IUserStore<U, G>, U extends IUser<G>, G extends IUserGroup> implements IStore {
import { IService } from "./interfaces/IService";
import { IStore } from "./interfaces/IStore";
import { IUserStore } from "./interfaces/IUserStore";
import { IWSClient } from "./interfaces/IWSClient";
export declare class Store<T, S extends IService<T>, US extends IUserStore<U, G>, U extends IUser<G>, G extends IUserGroup> implements IStore {
loading: boolean;

@@ -9,0 +9,0 @@ wasInit: boolean;

@@ -1,7 +0,7 @@

import { IClientUserService } from "../interfaces/IClientUserService";
import { IPersist } from "../interfaces/IPersist";
import { IUser } from "../interfaces/IUser";
import { IUserGroup } from "../interfaces/IUserGroup";
import { IUserService } from "./interfaces/IUserService";
import { Service } from "./Service";
export declare class UserService<U extends IUser<G>, G extends IUserGroup> extends Service<U & IPersist> implements IClientUserService<U & IPersist, G> {
export declare class UserService<U extends IUser<G>, G extends IUserGroup> extends Service<U & IPersist> implements IUserService<U & IPersist, G> {
signIn(login: string, password: string): Promise<string | void>;

@@ -8,0 +8,0 @@ signUp(login: string, group: string, password: string, password_confirm: string): Promise<string | void>;

@@ -1,8 +0,8 @@

import { IClientUserService } from "../interfaces/IClientUserService";
import { IUser } from "interfaces/IUser";
import { IUserGroup } from "interfaces/IUserGroup";
import { IPersist } from "../interfaces/IPersist";
import { IUser } from "../interfaces/IUser";
import { IUserGroup } from "../interfaces/IUserGroup";
import { IUserStore } from "../interfaces/IUserStore";
import { IWSClient } from "../interfaces/IWSClient";
import { EventEmitter } from "../isomorphic/EventEmitter";
import { IUserService } from "./interfaces/IUserService";
import { IUserStore } from "./interfaces/IUserStore";
import { IWSClient } from "./interfaces/IWSClient";
export declare class UserStore<U extends IUser<G> & IPersist, G extends IUserGroup> extends EventEmitter implements IUserStore<U, G> {

@@ -16,5 +16,5 @@ authorization: boolean;

};
protected service: IClientUserService<U, G>;
protected service: IUserService<U, G>;
protected WSClient: IWSClient;
constructor(service: IClientUserService<U, G>, WSClient: IWSClient, User: {
constructor(service: IUserService<U, G>, WSClient: IWSClient, User: {
new (data: any): U;

@@ -21,0 +21,0 @@ });

@@ -5,6 +5,6 @@ "use strict";

const mobx_1 = require("mobx");
const isType_1 = require("utils/isType");
const userGroupEnum_1 = require("../enums/userGroupEnum");
const userStoreEventEnum_1 = require("../enums/userStoreEventEnum");
const EventEmitter_1 = require("../isomorphic/EventEmitter");
const isType_1 = require("../utils/isType");
class UserStore extends EventEmitter_1.EventEmitter {

@@ -11,0 +11,0 @@ constructor(service, WSClient, User) {

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

import { IWSClient } from "../interfaces/IWSClient";
import { EventEmitter } from "../isomorphic/EventEmitter";
import { IWSClient } from "./interfaces/IWSClient";
export declare class WSClient extends EventEmitter implements IWSClient {

@@ -4,0 +4,0 @@ readyState: number;

@@ -5,6 +5,6 @@ "use strict";

const mobx_1 = require("mobx");
const const_1 = require("webSocket/const");
const helpers_1 = require("webSocket/helpers");
const wsEventEnum_1 = require("../enums/wsEventEnum");
const EventEmitter_1 = require("../isomorphic/EventEmitter");
const const_1 = require("../WebSocket/const");
const helpers_1 = require("../WebSocket/helpers");
class WSClient extends EventEmitter_1.EventEmitter {

@@ -11,0 +11,0 @@ constructor(path = "ws", TLS = true, pingPongDelay = 1000, reconnectionDelay = 5000) {

export { IPersist } from "./interfaces/IPersist";
export { IInsert } from "./interfaces/IInsert";
export { IUser } from "./interfaces/IUser";
export { IUserModel } from "./interfaces/IUserModel";
export { IAppConfig } from "./interfaces/IAppConfig";
export { IAuthStrategy } from "./interfaces/IAuthStrategy";
export { IChannels } from "./interfaces/IChannels";
export { IConnection } from "./interfaces/IConnection";
export { IDBConnection } from "./interfaces/IDBConnection";
export { IModel } from "./interfaces/IModel";
export { IRepository } from "./interfaces/IRepository";
export { IUserGroup } from "./interfaces/IUserGroup";
export { IUserStore } from "./interfaces/IUserStore";
export { IWSClient } from "./interfaces/IWSClient";
export { IClientService } from "./interfaces/IClientService";
export { IClientUserService } from "./interfaces/IClientUserService";
export { IStore } from "./interfaces/IStore";
export { IRepositoryStore } from "./interfaces/IRepositoryStore";

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

import { IUserGroup } from "../interfaces/IUserGroup";
import { IInsert } from "./IInsert";
import { IUserGroup } from "./IUserGroup";
export interface IUser<G extends IUserGroup> extends IInsert {

@@ -4,0 +4,0 @@ login: string;

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

import { userGroupEnum } from "./../enums/userGroupEnum";
import { userGroupEnum } from "enums/userGroupEnum";
export declare type IUserGroup = string;
export declare const userGroups: userGroupEnum[];
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const userGroupEnum_1 = require("./../enums/userGroupEnum");
const userGroupEnum_1 = require("enums/userGroupEnum");
exports.userGroups = [userGroupEnum_1.userGroupEnum.admin];

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

import { IEventEmitter } from "../interfaces/IEventEmitter";
import { IEventEmitter } from "interfaces/IEventEmitter";
export declare class EventEmitter implements IEventEmitter {

@@ -3,0 +3,0 @@ private subscriptions;

@@ -1,4 +0,4 @@

import { IPersist } from "../../interfaces/IPersist";
import { IUser } from "../../interfaces/IUser";
import { IUserGroup } from "../../interfaces/IUserGroup";
import { IPersist } from "interfaces/IPersist";
import { IUser } from "interfaces/IUser";
import { IUserGroup } from "interfaces/IUserGroup";
import { UserInsert } from "./UserInsert";

@@ -5,0 +5,0 @@ export declare class User<G extends IUserGroup> extends UserInsert<G> implements IUser<G>, IPersist {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const detectID_1 = require("../../utils/detectID");
const detectID_1 = require("utils/detectID");
const UserInsert_1 = require("./UserInsert");

@@ -5,0 +5,0 @@ class User extends UserInsert_1.UserInsert {

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

import { IUser } from "../../interfaces/IUser";
import { IUserGroup } from "../../interfaces/IUserGroup";
import { IUser } from "interfaces/IUser";
import { IUserGroup } from "interfaces/IUserGroup";
export declare class UserInsert<G extends IUserGroup> implements IUser<G> {

@@ -4,0 +4,0 @@ readonly login: string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const isType_1 = require("../../utils/isType");
const isType_1 = require("utils/isType");
class UserInsert {

@@ -5,0 +5,0 @@ constructor(data) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const isType_1 = require("../utils/isType");
const isType_1 = require("./isType");
function detectID(data) {

@@ -5,0 +5,0 @@ if (data) {

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

import { IChannels } from "../interfaces/IChannels";
import { IConnection } from "../interfaces/IConnection";
import { IChannels } from "../back/interfaces/IChannels";
import { IConnection } from "../back/interfaces/IConnection";
export declare class Channels implements IChannels {

@@ -4,0 +4,0 @@ private connections;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const chalk_1 = require("chalk");
const helpers_1 = require("../WebSocket/helpers");
const Connection_1 = require("./Connection");
const helpers_1 = require("./helpers");
class Channels {

@@ -7,0 +7,0 @@ constructor() {

import * as WebSocket from "ws";
import { IConnection } from "../interfaces/IConnection";
import { IConnection } from "../back/interfaces/IConnection";
export declare class Connection implements IConnection {

@@ -4,0 +4,0 @@ static getConnectionID(uid: string, wsid: string): string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const isType_1 = require("../utils/isType");
const isType_1 = require("utils/isType");
const const_1 = require("./const");

@@ -5,0 +5,0 @@ exports.recognizeMessage = (message) => {

@@ -1,8 +0,8 @@

import { IAppConfig } from "../interfaces/IAppConfig";
import { IChannels } from "../interfaces/IChannels";
import { IConnection } from "../interfaces/IConnection";
import { IAppConfig } from "../back/interfaces/IAppConfig";
import { IChannels } from "../back/interfaces/IChannels";
import { IConnection } from "../back/interfaces/IConnection";
import { IUserModel } from "../back/interfaces/IUserModel";
import { IPersist } from "../interfaces/IPersist";
import { IUser } from "../interfaces/IUser";
import { IUserGroup } from "../interfaces/IUserGroup";
import { IUserModel } from "../interfaces/IUserModel";
export declare class WSServer<U extends IUserModel<IUser<G> & IPersist, IUser<G>, G>, G extends IUserGroup> {

@@ -9,0 +9,0 @@ private config;

{
"name": "@borodindmitriy/base-code",
"description": "Common classes's library.",
"version": "3.0.0",
"version": "3.0.1",
"engines": {

@@ -6,0 +6,0 @@ "node": ">=8",

export declare enum wsEventEnum {
OPEN = "OPEN",
CLOSE = "CLOSE",
ASSIGMENT = "ASSIGMENT",
CANCEL_ASSIGMENT = "CANCEL_ASSIGMENT",
MESSAGE_RECEIVE = "MESSAGE_RECEIVE",
ERROR = "ERROR",
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var wsEventEnum;
(function (wsEventEnum) {
wsEventEnum["OPEN"] = "OPEN";
wsEventEnum["CLOSE"] = "CLOSE";
wsEventEnum["ASSIGMENT"] = "ASSIGMENT";
wsEventEnum["CANCEL_ASSIGMENT"] = "CANCEL_ASSIGMENT";
wsEventEnum["MESSAGE_RECEIVE"] = "MESSAGE_RECEIVE";
wsEventEnum["ERROR"] = "ERROR";
})(wsEventEnum = exports.wsEventEnum || (exports.wsEventEnum = {}));
export declare enum wsEventEnum {
OPEN = "OPEN",
CLOSE = "CLOSE",
ASSIGMENT = "ASSIGMENT",
CANCEL_ASSIGMENT = "CANCEL_ASSIGMENT",
MESSAGE_RECEIVE = "MESSAGE_RECEIVE",
ERROR = "ERROR",
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var wsEventEnum;
(function (wsEventEnum) {
wsEventEnum["OPEN"] = "OPEN";
wsEventEnum["CLOSE"] = "CLOSE";
wsEventEnum["ASSIGMENT"] = "ASSIGMENT";
wsEventEnum["CANCEL_ASSIGMENT"] = "CANCEL_ASSIGMENT";
wsEventEnum["MESSAGE_RECEIVE"] = "MESSAGE_RECEIVE";
wsEventEnum["ERROR"] = "ERROR";
})(wsEventEnum = exports.wsEventEnum || (exports.wsEventEnum = {}));
import { ObservableMap } from "mobx";
import { IClientService } from "../interfaces/IClientService";
import { IRepositoryStore } from "../interfaces/IRepositoryStore";
import { IUser } from "../interfaces/IUser";
import { IUserGroup } from "../interfaces/IUserGroup";
import { IUserStore } from "../interfaces/IUserStore";
import { IWSClient } from "../interfaces/IWSClient";
import { Store } from "./Store";
export declare class RepositoryStore<T extends {
id: string | void;
}, S extends IClientService<T>, US extends IUserStore<U, G>, U extends IUser<G>, G extends IUserGroup> extends Store<T, S, US, U, G> implements IRepositoryStore<T> {
protected collection: ObservableMap<string, T>;
protected repoName: string;
protected chName: string;
protected Constructor: {
new (data?: any): T;
};
constructor(service: S, name: string, chName: string, Constructor: {
new (data?: any): T;
}, wsClient: IWSClient, userStore: US);
readonly map: ObservableMap<string, T>;
readonly plainMap: Map<string, T>;
readonly list: T[];
init(): Promise<void>;
create(data: object): Promise<T | void>;
update(data: object): Promise<T | void>;
remove(id: string): Promise<T | void>;
receiveMessage([chName, payload]: [string, any]): T | void | Promise<void>;
protected destroy(): void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const mobx_1 = require("mobx");
const isType_1 = require("../utils/isType");
const Store_1 = require("./Store");
class RepositoryStore extends Store_1.Store {
constructor(service, name, chName, Constructor, wsClient, userStore) {
super(service, wsClient, userStore);
this.collection = mobx_1.observable.map();
this.repoName = name.toUpperCase();
this.chName = chName;
this.Constructor = Constructor;
this.init = this.init.bind(this);
this.create = this.create.bind(this);
this.update = this.update.bind(this);
this.remove = this.remove.bind(this);
this.receiveMessage = this.receiveMessage.bind(this);
this.destroy = this.destroy.bind(this);
}
get map() {
return this.collection;
}
get plainMap() {
const map = new Map();
this.collection.forEach((val, key) => map.set(key, val));
return map;
}
get list() {
const list = [];
this.collection.forEach((item) => {
list.push(item);
});
return list;
}
init() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (!this.wasInit) {
this.startLoad();
try {
const collection = yield this.service.collection();
if (collection) {
mobx_1.runInAction(`[ REPOSITORY_BASE ][ INIT ][ SUCCESS ]`, () => {
this.collection = collection.reduce((preValue, item) => {
if (isType_1.isString(item.id)) {
preValue.set(item.id, item);
}
return preValue;
}, mobx_1.observable.map());
this.wasInit = true;
});
}
}
catch (error) {
console.error(error);
}
finally {
this.endLoad();
}
}
});
}
create(data) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (!this.loading) {
this.startLoad();
try {
const item = yield this.service.create(data);
if (item) {
mobx_1.runInAction(`[ REPOSITORY_BASE ][ CREATE ][ SUCCESS ]`, () => {
if (isType_1.isString(item.id)) {
this.collection.set(item.id, item);
}
else {
console.error(`[ REPOSITORY_BASE ][ CREATE ] - must have id as string;`, item);
}
});
}
return item;
}
catch (error) {
console.error(error);
}
finally {
this.endLoad();
}
}
});
}
update(data) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (!this.loading) {
this.startLoad();
try {
const item = yield this.service.update(data);
if (item) {
mobx_1.runInAction(`[ REPOSITORY_BASE ][ UPDATE ][ SUCCESS ]`, () => {
if (isType_1.isString(item.id)) {
this.collection.set(item.id, item);
}
else {
console.error(`[ REPOSITORY_BASE ][ UPDATE ][ ERROR ] - must have id as string;`, item);
}
});
}
return item;
}
catch (error) {
return Promise.reject(error);
}
finally {
this.endLoad();
}
}
});
}
remove(id) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (!this.loading) {
this.startLoad();
try {
const item = yield this.service.remove(id);
if (item) {
mobx_1.runInAction(`[ REPOSITORY_BASE ][ REMOVE ][ SUCCESS ]`, () => {
if (isType_1.isString(item.id)) {
this.collection.delete(item.id);
}
else {
console.error(`[ REPOSITORY_BASE ][ REMOVE ][ ERROR ] - must have id as string;`, item);
}
});
}
return item;
}
catch (error) {
console.error(error);
return Promise.reject(error);
}
finally {
this.endLoad();
}
}
});
}
receiveMessage([chName, payload]) {
console.log(`[ ${this.repoName} ][ RECEIVE_MESSAGE ]`, [chName, payload]);
if (this.chName === chName) {
if (payload.create) {
const item = new this.Constructor(payload.create);
if (isType_1.isString(item.id)) {
this.collection.set(item.id, item);
}
else {
console.error(`[ ${this.repoName} ][ RECEIVE_CREATE ] - must have id as string;`, item);
}
return item;
}
if (payload.update) {
const item = new this.Constructor(payload.update);
if (isType_1.isString(item.id)) {
this.collection.set(item.id, item);
}
else {
console.error(`[ ${this.repoName} ][ RECEIVE_UPDATE ] - must have id as string;`, item);
}
return item;
}
if (payload.remove) {
const item = this.collection.get(payload.remove.id);
this.collection.delete(payload.remove.id);
return item;
}
}
}
destroy() {
super.destroy();
this.collection.clear();
}
}
tslib_1.__decorate([
mobx_1.observable
], RepositoryStore.prototype, "collection", void 0);
tslib_1.__decorate([
mobx_1.computed
], RepositoryStore.prototype, "map", null);
tslib_1.__decorate([
mobx_1.computed
], RepositoryStore.prototype, "plainMap", null);
tslib_1.__decorate([
mobx_1.computed
], RepositoryStore.prototype, "list", null);
tslib_1.__decorate([
mobx_1.action(`[ REPOSITORY_BASE ][ UPDATE ]`)
], RepositoryStore.prototype, "update", null);
tslib_1.__decorate([
mobx_1.action(`[ REPOSITORY_BASE ][ RECEIVE_MESSAGE ]`)
], RepositoryStore.prototype, "receiveMessage", null);
exports.RepositoryStore = RepositoryStore;
import { JwtFromRequestFunction } from "passport-jwt";
export interface IAppConfig {
jwt: {
form_request: JwtFromRequestFunction;
secret_key: string;
};
db: {
name: string;
url: string;
};
server: {
host: string;
port: number;
};
ws: {
host: string;
port: number;
};
production: boolean;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { Strategy as PassportStrategy } from "passport-strategy";
export interface IAuthStrategy {
getStrategy(): PassportStrategy;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { IConnection } from "./IConnection";
export interface IChannels {
addConnection(a_connection: IConnection): void;
deleteConnection(a_connection: IConnection): void;
on(chName: string, uid: string, wsid: string): void;
off(chName: string, uid: string, wsid: string): void;
send(chName: string, payload: {
[key: string]: any;
}, uid: string, wsid: string, excludeCurrentDevice?: boolean): void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { ObservableMap } from "mobx";
import { IStore } from "./IStore";
export interface IClientRepository<T> extends IStore {
list: T[];
plainMap: Map<string, T>;
map: ObservableMap<string, T>;
init(): Promise<void>;
create(data: object): Promise<T | void>;
update(data: object): Promise<T | void>;
remove(id: string): Promise<T | void>;
receiveMessage(message: [string, any]): T | void | Promise<void>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export interface IClientService<T> {
collection: () => Promise<T[] | void>;
model: (id: string) => Promise<T | void>;
create: (data: object) => Promise<T | void>;
update: (data: object) => Promise<T | void>;
remove: (id: string) => Promise<T | void>;
onChannel: () => Promise<void>;
offChannel: () => Promise<void>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { IClientService } from "./IClientService";
import { IPersist } from "./IPersist";
import { IUser } from "./IUser";
import { IUserGroup } from "./IUserGroup";
export interface IClientUserService<U extends IUser<G> & IPersist, G extends IUserGroup> extends IClientService<U> {
signIn(login: string, password: string): Promise<string | void>;
signUp(login: string, password: string, password_confirm: string, group: G): Promise<string | void>;
load(token: string): Promise<U | void>;
updateLogin(id: string, login: string): Promise<U | void>;
updatePassword(id: string, password: string, password_confirm: string): Promise<U | void>;
updateGroup(ids: string[], group: G): Promise<U[] | void>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export interface IConnection {
wsid: string;
uid: string | void;
getConnectionID(): string;
isOwner(uid: string): boolean;
isItSelf(uid: string, wsid: string): boolean;
setUserID(uid: string): void;
send(data: any): void;
wasTermintate(): boolean;
close(message?: string): void;
terminate(message?: string): void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { Db } from "mongodb";
export interface IDBConnection {
connection(): Promise<Db>;
disconnect(): Promise<void>;
getDB(): Promise<Db>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export interface IModel<P, I> {
read(): Promise<P[]>;
readById(id: string): Promise<P | null>;
getMap(): Promise<Map<string, P>>;
create(data: object, uid: string, wsid: string): Promise<P | null>;
update(data: object, uid: string, wsid: string): Promise<P | null>;
remove(id: string, uid: string, wsid: string): Promise<P | null>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { Collection, CollectionInsertManyOptions, CollectionInsertOneOptions, CommonOptions, FindOneAndReplaceOption, FindOneOptions, ReplaceOneOptions } from "mongodb";
export interface IRepository<T> {
getCollection(): Promise<Collection<T>>;
onValidation(): Promise<void>;
offValidation(): Promise<void>;
insertMany(docs: object[], options?: CollectionInsertManyOptions): Promise<T[]>;
insertOne(doc: object, options?: CollectionInsertOneOptions): Promise<T>;
find(query: object, options?: FindOneOptions): Promise<T[]>;
updateOne(query: object, update: object, options?: ReplaceOneOptions): Promise<void>;
updateMany(query: object, update: object, options?: ReplaceOneOptions): Promise<void>;
findOne(query: object, options?: FindOneOptions): Promise<T | null>;
findById(id: string, options?: FindOneOptions): Promise<T | null>;
findOneAndUpdate(query: object, update: object, options?: FindOneAndReplaceOption): Promise<T | null>;
deleteOne(query: object, options?: CommonOptions): Promise<void>;
deleteMany(query: object, options?: CommonOptions): Promise<void>;
findOneAndRemove(query: object, options?: {
projection?: object;
sort?: object;
}): Promise<T | null>;
findByIdAndRemove(id: string, options?: {
projection?: object;
sort?: object;
}): Promise<T | null>;
prepareId(data: any): T;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { ObservableMap } from "mobx";
import { IStore } from "./IStore";
export interface IRepositoryStore<T> extends IStore {
list: T[];
plainMap: Map<string, T>;
map: ObservableMap<string, T>;
init(): Promise<void>;
create(data: object): Promise<T | void>;
update(data: object): Promise<T | void>;
remove(id: string): Promise<T | void>;
receiveMessage(message: [string, any]): T | void | Promise<void>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export interface IStore {
loading: boolean;
wasInit: boolean;
receiveMessage: (message: any) => void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { IInsert } from "./IInsert";
import { IModel } from "./IModel";
import { IPersist } from "./IPersist";
import { IUserGroup } from "./IUserGroup";
export interface IUserModel<P extends IPersist, I extends IInsert, G extends IUserGroup> extends IModel<P, I> {
signUp(login: string, group: G, password: string, password_confirm: string): Promise<string>;
signIn(login: string, password: string): Promise<string | null>;
updateLogin(id: string, login: string, uid: string, wsid: string): Promise<P | null>;
updatePassword(id: string, password: string, passwordConfirm: string, uid: string, wsid: string): Promise<P | null>;
updateGroup(ids: string[], group: G): Promise<P[]>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { IEventEmitter } from "./IEventEmitter";
import { IPersist } from "./IPersist";
import { IUser } from "./IUser";
import { IUserGroup } from "./IUserGroup";
export interface IUserStore<U extends IUser<G>, G extends IUserGroup> extends IEventEmitter {
loading: boolean;
user: U & IPersist | null;
userList: Array<U & IPersist>;
id: string;
isToken: boolean;
isUserData: boolean;
isAdmin: boolean;
isAuthorized: boolean;
authorization: boolean;
load(token: string): Promise<void>;
login(login: string, password: string): Promise<string>;
registration(login: string, password: string, password_confirm: string, group: string): Promise<string | void>;
logout(): Promise<void>;
loadUserList(): Promise<void>;
updateLogin(id: string, login: string): Promise<void>;
updatePassword(id: string, password: string, password_confirm: string): Promise<void>;
updateGroup(ids: string[], updateGroup: G): Promise<void>;
remove(id: string): Promise<void>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { IEventEmitter } from "./IEventEmitter";
export interface IWSClient extends IEventEmitter {
readyState: number;
isAssigment: boolean;
wsid: string;
setUserID(uid: string): void;
connect(): Promise<void>;
reconnect(): void;
disconnect(reason?: string): void;
send(channelName: string, payload: {
[key: string]: any;
}): void;
assigmentToUserOfTheConnection(): Promise<void>;
cancelAssigmentToUserOfTheConnection(): Promise<void>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });