
- 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.
42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
// This is an example of using tokens to add a custom behaviour.
|
|
//
|
|
// This adds a option order check so that --some-unstable-option
|
|
// may only be used after --enable-experimental-options
|
|
//
|
|
// Note: this is not a common behaviour, the order of different options
|
|
// does not usually matter.
|
|
|
|
import { parseArgs } from '../index.js';
|
|
|
|
function findTokenIndex(tokens, target) {
|
|
return tokens.findIndex((token) => token.kind === 'option' &&
|
|
token.name === target
|
|
);
|
|
}
|
|
|
|
const experimentalName = 'enable-experimental-options';
|
|
const unstableName = 'some-unstable-option';
|
|
|
|
const options = {
|
|
[experimentalName]: { type: 'boolean' },
|
|
[unstableName]: { type: 'boolean' },
|
|
};
|
|
|
|
const { values, tokens } = parseArgs({ options, tokens: true });
|
|
|
|
const experimentalIndex = findTokenIndex(tokens, experimentalName);
|
|
const unstableIndex = findTokenIndex(tokens, unstableName);
|
|
if (unstableIndex !== -1 &&
|
|
((experimentalIndex === -1) || (unstableIndex < experimentalIndex))) {
|
|
throw new Error(`'--${experimentalName}' must be specified before '--${unstableName}'`);
|
|
}
|
|
|
|
console.log(values);
|
|
|
|
/* eslint-disable max-len */
|
|
// Try the following:
|
|
// node ordered-options.mjs
|
|
// node ordered-options.mjs --some-unstable-option
|
|
// node ordered-options.mjs --some-unstable-option --enable-experimental-options
|
|
// node ordered-options.mjs --enable-experimental-options --some-unstable-option
|