
- 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.
59 lines
1.6 KiB
JavaScript
59 lines
1.6 KiB
JavaScript
"use strict";
|
|
module.exports = function(Promise) {
|
|
var util = require("./util");
|
|
var async = Promise._async;
|
|
var tryCatch = util.tryCatch;
|
|
var errorObj = util.errorObj;
|
|
|
|
function spreadAdapter(val, nodeback) {
|
|
var promise = this;
|
|
if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);
|
|
var ret =
|
|
tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val));
|
|
if (ret === errorObj) {
|
|
async.throwLater(ret.e);
|
|
}
|
|
}
|
|
|
|
function successAdapter(val, nodeback) {
|
|
var promise = this;
|
|
var receiver = promise._boundValue();
|
|
var ret = val === undefined
|
|
? tryCatch(nodeback).call(receiver, null)
|
|
: tryCatch(nodeback).call(receiver, null, val);
|
|
if (ret === errorObj) {
|
|
async.throwLater(ret.e);
|
|
}
|
|
}
|
|
function errorAdapter(reason, nodeback) {
|
|
var promise = this;
|
|
if (!reason) {
|
|
var newReason = new Error(reason + "");
|
|
newReason.cause = reason;
|
|
reason = newReason;
|
|
}
|
|
var ret = tryCatch(nodeback).call(promise._boundValue(), reason);
|
|
if (ret === errorObj) {
|
|
async.throwLater(ret.e);
|
|
}
|
|
}
|
|
|
|
Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback,
|
|
options) {
|
|
if (typeof nodeback == "function") {
|
|
var adapter = successAdapter;
|
|
if (options !== undefined && Object(options).spread) {
|
|
adapter = spreadAdapter;
|
|
}
|
|
this._then(
|
|
adapter,
|
|
errorAdapter,
|
|
undefined,
|
|
this,
|
|
nodeback
|
|
);
|
|
}
|
|
return this;
|
|
};
|
|
};
|