
- 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.
90 lines
1.9 KiB
JavaScript
90 lines
1.9 KiB
JavaScript
'use strict';
|
|
const path = require('path');
|
|
const locatePath = require('locate-path');
|
|
const pathExists = require('path-exists');
|
|
|
|
const stop = Symbol('findUp.stop');
|
|
|
|
module.exports = async (name, options = {}) => {
|
|
let directory = path.resolve(options.cwd || '');
|
|
const {root} = path.parse(directory);
|
|
const paths = [].concat(name);
|
|
|
|
const runMatcher = async locateOptions => {
|
|
if (typeof name !== 'function') {
|
|
return locatePath(paths, locateOptions);
|
|
}
|
|
|
|
const foundPath = await name(locateOptions.cwd);
|
|
if (typeof foundPath === 'string') {
|
|
return locatePath([foundPath], locateOptions);
|
|
}
|
|
|
|
return foundPath;
|
|
};
|
|
|
|
// eslint-disable-next-line no-constant-condition
|
|
while (true) {
|
|
// eslint-disable-next-line no-await-in-loop
|
|
const foundPath = await runMatcher({...options, cwd: directory});
|
|
|
|
if (foundPath === stop) {
|
|
return;
|
|
}
|
|
|
|
if (foundPath) {
|
|
return path.resolve(directory, foundPath);
|
|
}
|
|
|
|
if (directory === root) {
|
|
return;
|
|
}
|
|
|
|
directory = path.dirname(directory);
|
|
}
|
|
};
|
|
|
|
module.exports.sync = (name, options = {}) => {
|
|
let directory = path.resolve(options.cwd || '');
|
|
const {root} = path.parse(directory);
|
|
const paths = [].concat(name);
|
|
|
|
const runMatcher = locateOptions => {
|
|
if (typeof name !== 'function') {
|
|
return locatePath.sync(paths, locateOptions);
|
|
}
|
|
|
|
const foundPath = name(locateOptions.cwd);
|
|
if (typeof foundPath === 'string') {
|
|
return locatePath.sync([foundPath], locateOptions);
|
|
}
|
|
|
|
return foundPath;
|
|
};
|
|
|
|
// eslint-disable-next-line no-constant-condition
|
|
while (true) {
|
|
const foundPath = runMatcher({...options, cwd: directory});
|
|
|
|
if (foundPath === stop) {
|
|
return;
|
|
}
|
|
|
|
if (foundPath) {
|
|
return path.resolve(directory, foundPath);
|
|
}
|
|
|
|
if (directory === root) {
|
|
return;
|
|
}
|
|
|
|
directory = path.dirname(directory);
|
|
}
|
|
};
|
|
|
|
module.exports.exists = pathExists;
|
|
|
|
module.exports.sync.exists = pathExists.sync;
|
|
|
|
module.exports.stop = stop;
|