@vynelix/nestjs-multi-auth 0.1.11 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vynelix/nestjs-multi-auth",
3
- "version": "0.1.11",
3
+ "version": "0.2.0",
4
4
  "description": "An authentication service/module for NestJs that supports multiple authentication methods such as email, phone, username, OAuth, SSO, etc",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,16 @@
1
+ import { validateSync } from 'class-validator';
2
+ import { SignupDto } from './src/auth/dto/requests/signup.dto';
3
+ import { AuthStrategy } from './src/auth/enums/auth-type.enum';
4
+
5
+ const testDto = (phone: string) => {
6
+ const dto = new SignupDto();
7
+ dto.method = AuthStrategy.PHONE;
8
+ dto.phone = phone;
9
+ const errors = validateSync(dto);
10
+ console.log(`Validation errors for ${phone}:`, errors.length > 0 ? errors.map(e => e.constraints) : 'None (Valid!)');
11
+ };
12
+
13
+ console.log('--- Testing SignupDto with @Matches() ---');
14
+ testDto('+447455731149'); // without leading zero
15
+ testDto('+4407455731149'); // with leading zero
16
+ testDto('invalid_phone'); // invalid string