
- 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.
87 lines
3.3 KiB
JavaScript
87 lines
3.3 KiB
JavaScript
import _parsePhoneNumber from './parsePhoneNumber.js';
|
|
import metadata from '../metadata.min.json' assert { type: 'json' };
|
|
|
|
function parsePhoneNumber() {
|
|
for (var _len = arguments.length, parameters = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
parameters[_key] = arguments[_key];
|
|
}
|
|
|
|
parameters.push(metadata);
|
|
return _parsePhoneNumber.apply(this, parameters);
|
|
}
|
|
|
|
var USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;
|
|
describe('parsePhoneNumber', function () {
|
|
it('should parse phone numbers from string', function () {
|
|
parsePhoneNumber('Phone: 8 (800) 555 35 35.', 'RU').nationalNumber.should.equal('8005553535');
|
|
expect(parsePhoneNumber('3', 'RU')).to.be.undefined;
|
|
});
|
|
it('should work in edge cases', function () {
|
|
expect(parsePhoneNumber('')).to.be.undefined;
|
|
});
|
|
it('should parse phone numbers when invalid country code is passed', function () {
|
|
parsePhoneNumber('Phone: +7 (800) 555 35 35.', 'XX').nationalNumber.should.equal('8005553535');
|
|
expect(parsePhoneNumber('Phone: 8 (800) 555-35-35.', 'XX')).to.be.undefined;
|
|
});
|
|
it('should parse non-geographic numbering plan phone numbers (extended)', function () {
|
|
var phoneNumber = parsePhoneNumber('+870773111632');
|
|
phoneNumber.number.should.equal('+870773111632');
|
|
|
|
if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
|
|
phoneNumber.country.should.equal('001');
|
|
} else {
|
|
expect(phoneNumber.country).to.be.undefined;
|
|
}
|
|
|
|
phoneNumber.countryCallingCode.should.equal('870');
|
|
});
|
|
it('should parse non-geographic numbering plan phone numbers (default country code) (extended)', function () {
|
|
var phoneNumber = parsePhoneNumber('773111632', {
|
|
defaultCallingCode: '870'
|
|
});
|
|
phoneNumber.number.should.equal('+870773111632');
|
|
|
|
if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
|
|
phoneNumber.country.should.equal('001');
|
|
} else {
|
|
expect(phoneNumber.country).to.be.undefined;
|
|
}
|
|
|
|
phoneNumber.countryCallingCode.should.equal('870');
|
|
});
|
|
it('should determine the possibility of non-geographic phone numbers', function () {
|
|
var phoneNumber = parsePhoneNumber('+870773111632');
|
|
phoneNumber.isPossible().should.equal(true);
|
|
var phoneNumber2 = parsePhoneNumber('+8707731116321');
|
|
phoneNumber2.isPossible().should.equal(false);
|
|
});
|
|
it('should support `extract: false` flag', function () {
|
|
var testCorrectness = function testCorrectness(number, expectedResult) {
|
|
var result = expect(parsePhoneNumber(number, {
|
|
extract: false,
|
|
defaultCountry: 'US'
|
|
}));
|
|
|
|
if (expectedResult) {
|
|
result.to.not.be.undefined;
|
|
} else {
|
|
result.to.be.undefined;
|
|
}
|
|
};
|
|
|
|
testCorrectness('Call: (213) 373-4253', false);
|
|
testCorrectness('(213) 373-4253x', false);
|
|
testCorrectness('(213) 373-4253', true);
|
|
testCorrectness('- (213) 373-4253 -', true);
|
|
testCorrectness('+1 (213) 373-4253', true);
|
|
testCorrectness(' +1 (213) 373-4253', false);
|
|
});
|
|
it('should not prematurely strip a possible national prefix from Chinese numbers', function () {
|
|
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/57
|
|
var phoneNumber = parsePhoneNumber('+86123456789');
|
|
phoneNumber.isPossible().should.equal(true);
|
|
phoneNumber.isValid().should.equal(false);
|
|
phoneNumber.nationalNumber.should.equal('123456789');
|
|
});
|
|
});
|
|
//# sourceMappingURL=parsePhoneNumber.test.js.map
|