
- 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.
117 lines
3.6 KiB
JavaScript
117 lines
3.6 KiB
JavaScript
"use strict";
|
|
var es5 = require("./es5");
|
|
var Objectfreeze = es5.freeze;
|
|
var util = require("./util");
|
|
var inherits = util.inherits;
|
|
var notEnumerableProp = util.notEnumerableProp;
|
|
|
|
function subError(nameProperty, defaultMessage) {
|
|
function SubError(message) {
|
|
if (!(this instanceof SubError)) return new SubError(message);
|
|
notEnumerableProp(this, "message",
|
|
typeof message === "string" ? message : defaultMessage);
|
|
notEnumerableProp(this, "name", nameProperty);
|
|
if (Error.captureStackTrace) {
|
|
Error.captureStackTrace(this, this.constructor);
|
|
} else {
|
|
Error.call(this);
|
|
}
|
|
}
|
|
inherits(SubError, Error);
|
|
return SubError;
|
|
}
|
|
|
|
var _TypeError, _RangeError;
|
|
var Warning = subError("Warning", "warning");
|
|
var CancellationError = subError("CancellationError", "cancellation error");
|
|
var TimeoutError = subError("TimeoutError", "timeout error");
|
|
var AggregateError = subError("AggregateError", "aggregate error");
|
|
try {
|
|
_TypeError = TypeError;
|
|
_RangeError = RangeError;
|
|
} catch(e) {
|
|
_TypeError = subError("TypeError", "type error");
|
|
_RangeError = subError("RangeError", "range error");
|
|
}
|
|
|
|
var methods = ("join pop push shift unshift slice filter forEach some " +
|
|
"every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" ");
|
|
|
|
for (var i = 0; i < methods.length; ++i) {
|
|
if (typeof Array.prototype[methods[i]] === "function") {
|
|
AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];
|
|
}
|
|
}
|
|
|
|
es5.defineProperty(AggregateError.prototype, "length", {
|
|
value: 0,
|
|
configurable: false,
|
|
writable: true,
|
|
enumerable: true
|
|
});
|
|
AggregateError.prototype["isOperational"] = true;
|
|
var level = 0;
|
|
AggregateError.prototype.toString = function() {
|
|
var indent = Array(level * 4 + 1).join(" ");
|
|
var ret = "\n" + indent + "AggregateError of:" + "\n";
|
|
level++;
|
|
indent = Array(level * 4 + 1).join(" ");
|
|
for (var i = 0; i < this.length; ++i) {
|
|
var str = this[i] === this ? "[Circular AggregateError]" : this[i] + "";
|
|
var lines = str.split("\n");
|
|
for (var j = 0; j < lines.length; ++j) {
|
|
lines[j] = indent + lines[j];
|
|
}
|
|
str = lines.join("\n");
|
|
ret += str + "\n";
|
|
}
|
|
level--;
|
|
return ret;
|
|
};
|
|
|
|
function OperationalError(message) {
|
|
if (!(this instanceof OperationalError))
|
|
return new OperationalError(message);
|
|
notEnumerableProp(this, "name", "OperationalError");
|
|
notEnumerableProp(this, "message", message);
|
|
this.cause = message;
|
|
this["isOperational"] = true;
|
|
|
|
if (message instanceof Error) {
|
|
notEnumerableProp(this, "message", message.message);
|
|
notEnumerableProp(this, "stack", message.stack);
|
|
} else if (Error.captureStackTrace) {
|
|
Error.captureStackTrace(this, this.constructor);
|
|
}
|
|
|
|
}
|
|
inherits(OperationalError, Error);
|
|
|
|
var errorTypes = Error["__BluebirdErrorTypes__"];
|
|
if (!errorTypes) {
|
|
errorTypes = Objectfreeze({
|
|
CancellationError: CancellationError,
|
|
TimeoutError: TimeoutError,
|
|
OperationalError: OperationalError,
|
|
RejectionError: OperationalError,
|
|
AggregateError: AggregateError
|
|
});
|
|
es5.defineProperty(Error, "__BluebirdErrorTypes__", {
|
|
value: errorTypes,
|
|
writable: false,
|
|
enumerable: false,
|
|
configurable: false
|
|
});
|
|
}
|
|
|
|
module.exports = {
|
|
Error: Error,
|
|
TypeError: _TypeError,
|
|
RangeError: _RangeError,
|
|
CancellationError: errorTypes.CancellationError,
|
|
OperationalError: errorTypes.OperationalError,
|
|
TimeoutError: errorTypes.TimeoutError,
|
|
AggregateError: errorTypes.AggregateError,
|
|
Warning: Warning
|
|
};
|