
- 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.
56 lines
1.7 KiB
JavaScript
56 lines
1.7 KiB
JavaScript
"use strict";
|
|
module.exports =
|
|
function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {
|
|
var util = require("./util");
|
|
var tryCatch = util.tryCatch;
|
|
|
|
Promise.method = function (fn) {
|
|
if (typeof fn !== "function") {
|
|
throw new Promise.TypeError("expecting a function but got " + util.classString(fn));
|
|
}
|
|
return function () {
|
|
var ret = new Promise(INTERNAL);
|
|
ret._captureStackTrace();
|
|
ret._pushContext();
|
|
var value = tryCatch(fn).apply(this, arguments);
|
|
var promiseCreated = ret._popContext();
|
|
debug.checkForgottenReturns(
|
|
value, promiseCreated, "Promise.method", ret);
|
|
ret._resolveFromSyncValue(value);
|
|
return ret;
|
|
};
|
|
};
|
|
|
|
Promise.attempt = Promise["try"] = function (fn) {
|
|
if (typeof fn !== "function") {
|
|
return apiRejection("expecting a function but got " + util.classString(fn));
|
|
}
|
|
var ret = new Promise(INTERNAL);
|
|
ret._captureStackTrace();
|
|
ret._pushContext();
|
|
var value;
|
|
if (arguments.length > 1) {
|
|
debug.deprecated("calling Promise.try with more than 1 argument");
|
|
var arg = arguments[1];
|
|
var ctx = arguments[2];
|
|
value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg)
|
|
: tryCatch(fn).call(ctx, arg);
|
|
} else {
|
|
value = tryCatch(fn)();
|
|
}
|
|
var promiseCreated = ret._popContext();
|
|
debug.checkForgottenReturns(
|
|
value, promiseCreated, "Promise.try", ret);
|
|
ret._resolveFromSyncValue(value);
|
|
return ret;
|
|
};
|
|
|
|
Promise.prototype._resolveFromSyncValue = function (value) {
|
|
if (value === util.errorObj) {
|
|
this._rejectCallback(value.e, false);
|
|
} else {
|
|
this._resolveCallback(value, true);
|
|
}
|
|
};
|
|
};
|