
- Complete NestJS TypeScript implementation with WebSocket support - Direct messaging (DM) and group chat functionality - End-to-end encryption with AES encryption and key pairs - Media file support (images, videos, audio, documents) up to 100MB - Push notifications with Firebase Cloud Messaging integration - Mention alerts and real-time typing indicators - User authentication with JWT and Passport - SQLite database with TypeORM entities and relationships - Comprehensive API documentation with Swagger/OpenAPI - File upload handling with secure access control - Online/offline status tracking and presence management - Message editing, deletion, and reply functionality - Notification management with automatic cleanup - Health check endpoint for monitoring - CORS configuration for cross-origin requests - Environment-based configuration management - Structured for Flutter SDK integration Features implemented: ✅ Real-time messaging with Socket.IO ✅ User registration and authentication ✅ Direct messages and group chats ✅ Media file uploads and management ✅ End-to-end encryption ✅ Push notifications ✅ Mention alerts ✅ Typing indicators ✅ Message read receipts ✅ Online status tracking ✅ File access control ✅ Comprehensive API documentation Ready for Flutter SDK development and production deployment.
122 lines
2.0 KiB
JavaScript
122 lines
2.0 KiB
JavaScript
|
|
/**
|
|
* Expose `Delegator`.
|
|
*/
|
|
|
|
module.exports = Delegator;
|
|
|
|
/**
|
|
* Initialize a delegator.
|
|
*
|
|
* @param {Object} proto
|
|
* @param {String} target
|
|
* @api public
|
|
*/
|
|
|
|
function Delegator(proto, target) {
|
|
if (!(this instanceof Delegator)) return new Delegator(proto, target);
|
|
this.proto = proto;
|
|
this.target = target;
|
|
this.methods = [];
|
|
this.getters = [];
|
|
this.setters = [];
|
|
this.fluents = [];
|
|
}
|
|
|
|
/**
|
|
* Delegate method `name`.
|
|
*
|
|
* @param {String} name
|
|
* @return {Delegator} self
|
|
* @api public
|
|
*/
|
|
|
|
Delegator.prototype.method = function(name){
|
|
var proto = this.proto;
|
|
var target = this.target;
|
|
this.methods.push(name);
|
|
|
|
proto[name] = function(){
|
|
return this[target][name].apply(this[target], arguments);
|
|
};
|
|
|
|
return this;
|
|
};
|
|
|
|
/**
|
|
* Delegator accessor `name`.
|
|
*
|
|
* @param {String} name
|
|
* @return {Delegator} self
|
|
* @api public
|
|
*/
|
|
|
|
Delegator.prototype.access = function(name){
|
|
return this.getter(name).setter(name);
|
|
};
|
|
|
|
/**
|
|
* Delegator getter `name`.
|
|
*
|
|
* @param {String} name
|
|
* @return {Delegator} self
|
|
* @api public
|
|
*/
|
|
|
|
Delegator.prototype.getter = function(name){
|
|
var proto = this.proto;
|
|
var target = this.target;
|
|
this.getters.push(name);
|
|
|
|
proto.__defineGetter__(name, function(){
|
|
return this[target][name];
|
|
});
|
|
|
|
return this;
|
|
};
|
|
|
|
/**
|
|
* Delegator setter `name`.
|
|
*
|
|
* @param {String} name
|
|
* @return {Delegator} self
|
|
* @api public
|
|
*/
|
|
|
|
Delegator.prototype.setter = function(name){
|
|
var proto = this.proto;
|
|
var target = this.target;
|
|
this.setters.push(name);
|
|
|
|
proto.__defineSetter__(name, function(val){
|
|
return this[target][name] = val;
|
|
});
|
|
|
|
return this;
|
|
};
|
|
|
|
/**
|
|
* Delegator fluent accessor
|
|
*
|
|
* @param {String} name
|
|
* @return {Delegator} self
|
|
* @api public
|
|
*/
|
|
|
|
Delegator.prototype.fluent = function (name) {
|
|
var proto = this.proto;
|
|
var target = this.target;
|
|
this.fluents.push(name);
|
|
|
|
proto[name] = function(val){
|
|
if ('undefined' != typeof val) {
|
|
this[target][name] = val;
|
|
return this;
|
|
} else {
|
|
return this[target][name];
|
|
}
|
|
};
|
|
|
|
return this;
|
|
};
|