create-forgeon 0.1.37 → 0.1.38

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": "create-forgeon",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "description": "Forgeon project generator CLI",
5
5
  "license": "MIT",
6
6
  "author": "Forgeon",
@@ -94,6 +94,13 @@ function assertJwtAuthWiring(projectRoot, withPrismaStore) {
94
94
 
95
95
  const readme = fs.readFileSync(path.join(projectRoot, 'README.md'), 'utf8');
96
96
  assert.match(readme, /## JWT Auth Module/);
97
+
98
+ const authServiceSource = fs.readFileSync(
99
+ path.join(projectRoot, 'packages', 'auth-api', 'src', 'auth.service.ts'),
100
+ 'utf8',
101
+ );
102
+ assert.match(authServiceSource, /import type \{/);
103
+ assert.doesNotMatch(authServiceSource, /import\s*\{\s*AUTH_ERROR_CODES/);
97
104
  }
98
105
 
99
106
  function stripDbPrismaArtifacts(projectRoot) {
@@ -1,4 +1,4 @@
1
- import { AuthUser } from '@forgeon/auth-contracts';
1
+ import type { AuthUser } from '@forgeon/auth-contracts';
2
2
  import {
3
3
  Body,
4
4
  Controller,
@@ -1,5 +1,5 @@
1
- import {
2
- AUTH_ERROR_CODES,
1
+ import type {
2
+ AuthErrorCode,
3
3
  AuthUser,
4
4
  LoginResponse,
5
5
  RefreshResponse,
@@ -19,6 +19,15 @@ import { AuthJwtPayload } from './auth.types';
19
19
 
20
20
  type JwtExpiresIn = NonNullable<JwtSignOptions['expiresIn']>;
21
21
 
22
+ const AUTH_ERROR_CODES: Record<
23
+ 'invalidCredentials' | 'tokenExpired' | 'refreshInvalid',
24
+ AuthErrorCode
25
+ > = {
26
+ invalidCredentials: 'AUTH_INVALID_CREDENTIALS',
27
+ tokenExpired: 'AUTH_TOKEN_EXPIRED',
28
+ refreshInvalid: 'AUTH_REFRESH_INVALID',
29
+ };
30
+
22
31
  @Injectable()
23
32
  export class AuthService {
24
33
  constructor(
@@ -1,4 +1,4 @@
1
- import { LoginRequest } from '@forgeon/auth-contracts';
1
+ import type { LoginRequest } from '@forgeon/auth-contracts';
2
2
  import { IsEmail, IsString, MinLength } from 'class-validator';
3
3
 
4
4
  export class LoginDto implements LoginRequest {
@@ -1,4 +1,4 @@
1
- import { RefreshRequest } from '@forgeon/auth-contracts';
1
+ import type { RefreshRequest } from '@forgeon/auth-contracts';
2
2
  import { IsString, MinLength } from 'class-validator';
3
3
 
4
4
  export class RefreshDto implements RefreshRequest {