@fonderie/auth 1.0.0 → 1.1.1

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/dist/index.d.cts CHANGED
@@ -2,10 +2,11 @@ export { IMfaChallenge, ISession, IUser } from './types.cjs';
2
2
  import { IFonderieModule, IFonderieApp } from '@fonderie/core';
3
3
  import { IStoreAdapter } from '@fonderie/store';
4
4
  import { EventBus } from '@fonderie/events';
5
- import { I as IAuthConfig } from './session-CLD1WPJs.cjs';
6
- export { A as AUTH_CONFIG_KEYS, a as AuthMessageKey, b as IAuthRuntimeConfig, c as IAuthSecrets, M as MESSAGE_KEYS, w as withSession } from './session-CLD1WPJs.cjs';
5
+ import { I as IAuthConfig } from './session-BGjjwz5_.cjs';
6
+ export { A as AUTH_CONFIG_KEYS, a as AuthMessageKey, b as IAuthRuntimeConfig, c as IAuthSecrets, M as MESSAGE_KEYS, w as withSession } from './session-BGjjwz5_.cjs';
7
7
  export { IUserDTO, toUserDTO } from './dtos/user.cjs';
8
- export { requireAuth } from '@fonderie/core/middlewares';
8
+ export { requireAuth, validate } from '@fonderie/core/middlewares';
9
+ import { z } from 'zod';
9
10
 
10
11
  declare class AuthModule implements IFonderieModule {
11
12
  private store;
@@ -16,7 +17,85 @@ declare class AuthModule implements IFonderieModule {
16
17
  install(app: IFonderieApp): void;
17
18
  }
18
19
 
20
+ declare const registerSchema: z.ZodUnion<readonly [z.ZodObject<{
21
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
22
+ password: z.ZodString;
23
+ firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
+ lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
+ }, z.core.$strip>, z.ZodObject<{
26
+ phone: z.ZodString;
27
+ }, z.core.$strip>]>;
28
+ declare const loginSchema: z.ZodUnion<readonly [z.ZodObject<{
29
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
30
+ password: z.ZodString;
31
+ }, z.core.$strip>, z.ZodObject<{
32
+ phone: z.ZodString;
33
+ }, z.core.$strip>]>;
34
+ declare const refreshSchema: z.ZodObject<{
35
+ refreshToken: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strip>;
37
+ declare const forgotPasswordSchema: z.ZodObject<{
38
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
39
+ }, z.core.$strip>;
40
+ declare const resetPasswordSchema: z.ZodObject<{
41
+ pin: z.ZodString;
42
+ password: z.ZodString;
43
+ }, z.core.$strip>;
44
+ declare const verifySchema: z.ZodObject<{
45
+ token: z.ZodString;
46
+ }, z.core.$strip>;
47
+ declare const updateProfileSchema: z.ZodObject<{
48
+ firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ avatarUrl: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodURL>>>;
51
+ }, z.core.$strip>;
52
+ declare const updatePreferencesSchema: z.ZodObject<{
53
+ locale: z.ZodOptional<z.ZodString>;
54
+ timezone: z.ZodOptional<z.ZodString>;
55
+ notifications: z.ZodOptional<z.ZodUnknown>;
56
+ emailDigest: z.ZodOptional<z.ZodUnknown>;
57
+ dateFormat: z.ZodOptional<z.ZodUnknown>;
58
+ timeFormat: z.ZodOptional<z.ZodUnknown>;
59
+ }, z.core.$strip>;
60
+ declare const updateEmailSchema: z.ZodObject<{
61
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
62
+ }, z.core.$strip>;
63
+ declare const updatePhoneSchema: z.ZodObject<{
64
+ phone: z.ZodString;
65
+ }, z.core.$strip>;
66
+ declare const changePasswordSchema: z.ZodObject<{
67
+ currentPassword: z.ZodString;
68
+ newPassword: z.ZodString;
69
+ }, z.core.$strip>;
70
+ declare const mfaTokenSchema: z.ZodObject<{
71
+ token: z.ZodString;
72
+ }, z.core.$strip>;
73
+ type RegisterInput = z.infer<typeof registerSchema>;
74
+ type LoginInput = z.infer<typeof loginSchema>;
75
+ type ResetPasswordInput = z.infer<typeof resetPasswordSchema>;
76
+ type ChangePasswordInput = z.infer<typeof changePasswordSchema>;
77
+
78
+ type schemas_ChangePasswordInput = ChangePasswordInput;
79
+ type schemas_LoginInput = LoginInput;
80
+ type schemas_RegisterInput = RegisterInput;
81
+ type schemas_ResetPasswordInput = ResetPasswordInput;
82
+ declare const schemas_changePasswordSchema: typeof changePasswordSchema;
83
+ declare const schemas_forgotPasswordSchema: typeof forgotPasswordSchema;
84
+ declare const schemas_loginSchema: typeof loginSchema;
85
+ declare const schemas_mfaTokenSchema: typeof mfaTokenSchema;
86
+ declare const schemas_refreshSchema: typeof refreshSchema;
87
+ declare const schemas_registerSchema: typeof registerSchema;
88
+ declare const schemas_resetPasswordSchema: typeof resetPasswordSchema;
89
+ declare const schemas_updateEmailSchema: typeof updateEmailSchema;
90
+ declare const schemas_updatePhoneSchema: typeof updatePhoneSchema;
91
+ declare const schemas_updatePreferencesSchema: typeof updatePreferencesSchema;
92
+ declare const schemas_updateProfileSchema: typeof updateProfileSchema;
93
+ declare const schemas_verifySchema: typeof verifySchema;
94
+ declare namespace schemas {
95
+ export { type schemas_ChangePasswordInput as ChangePasswordInput, type schemas_LoginInput as LoginInput, type schemas_RegisterInput as RegisterInput, type schemas_ResetPasswordInput as ResetPasswordInput, schemas_changePasswordSchema as changePasswordSchema, schemas_forgotPasswordSchema as forgotPasswordSchema, schemas_loginSchema as loginSchema, schemas_mfaTokenSchema as mfaTokenSchema, schemas_refreshSchema as refreshSchema, schemas_registerSchema as registerSchema, schemas_resetPasswordSchema as resetPasswordSchema, schemas_updateEmailSchema as updateEmailSchema, schemas_updatePhoneSchema as updatePhoneSchema, schemas_updatePreferencesSchema as updatePreferencesSchema, schemas_updateProfileSchema as updateProfileSchema, schemas_verifySchema as verifySchema };
96
+ }
97
+
19
98
  declare function normalizeEmail(email: string): string;
20
99
  declare function normalizeEmailSafe(email: string): string | null;
21
100
 
22
- export { AuthModule, IAuthConfig, normalizeEmail, normalizeEmailSafe };
101
+ export { AuthModule, type ChangePasswordInput, IAuthConfig, type LoginInput, type RegisterInput, type ResetPasswordInput, normalizeEmail, normalizeEmailSafe, schemas };
package/dist/index.d.ts CHANGED
@@ -2,10 +2,11 @@ export { IMfaChallenge, ISession, IUser } from './types.js';
2
2
  import { IFonderieModule, IFonderieApp } from '@fonderie/core';
3
3
  import { IStoreAdapter } from '@fonderie/store';
4
4
  import { EventBus } from '@fonderie/events';
5
- import { I as IAuthConfig } from './session-CLD1WPJs.js';
6
- export { A as AUTH_CONFIG_KEYS, a as AuthMessageKey, b as IAuthRuntimeConfig, c as IAuthSecrets, M as MESSAGE_KEYS, w as withSession } from './session-CLD1WPJs.js';
5
+ import { I as IAuthConfig } from './session-BGjjwz5_.js';
6
+ export { A as AUTH_CONFIG_KEYS, a as AuthMessageKey, b as IAuthRuntimeConfig, c as IAuthSecrets, M as MESSAGE_KEYS, w as withSession } from './session-BGjjwz5_.js';
7
7
  export { IUserDTO, toUserDTO } from './dtos/user.js';
8
- export { requireAuth } from '@fonderie/core/middlewares';
8
+ export { requireAuth, validate } from '@fonderie/core/middlewares';
9
+ import { z } from 'zod';
9
10
 
10
11
  declare class AuthModule implements IFonderieModule {
11
12
  private store;
@@ -16,7 +17,85 @@ declare class AuthModule implements IFonderieModule {
16
17
  install(app: IFonderieApp): void;
17
18
  }
18
19
 
20
+ declare const registerSchema: z.ZodUnion<readonly [z.ZodObject<{
21
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
22
+ password: z.ZodString;
23
+ firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
+ lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
+ }, z.core.$strip>, z.ZodObject<{
26
+ phone: z.ZodString;
27
+ }, z.core.$strip>]>;
28
+ declare const loginSchema: z.ZodUnion<readonly [z.ZodObject<{
29
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
30
+ password: z.ZodString;
31
+ }, z.core.$strip>, z.ZodObject<{
32
+ phone: z.ZodString;
33
+ }, z.core.$strip>]>;
34
+ declare const refreshSchema: z.ZodObject<{
35
+ refreshToken: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strip>;
37
+ declare const forgotPasswordSchema: z.ZodObject<{
38
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
39
+ }, z.core.$strip>;
40
+ declare const resetPasswordSchema: z.ZodObject<{
41
+ pin: z.ZodString;
42
+ password: z.ZodString;
43
+ }, z.core.$strip>;
44
+ declare const verifySchema: z.ZodObject<{
45
+ token: z.ZodString;
46
+ }, z.core.$strip>;
47
+ declare const updateProfileSchema: z.ZodObject<{
48
+ firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ avatarUrl: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodURL>>>;
51
+ }, z.core.$strip>;
52
+ declare const updatePreferencesSchema: z.ZodObject<{
53
+ locale: z.ZodOptional<z.ZodString>;
54
+ timezone: z.ZodOptional<z.ZodString>;
55
+ notifications: z.ZodOptional<z.ZodUnknown>;
56
+ emailDigest: z.ZodOptional<z.ZodUnknown>;
57
+ dateFormat: z.ZodOptional<z.ZodUnknown>;
58
+ timeFormat: z.ZodOptional<z.ZodUnknown>;
59
+ }, z.core.$strip>;
60
+ declare const updateEmailSchema: z.ZodObject<{
61
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
62
+ }, z.core.$strip>;
63
+ declare const updatePhoneSchema: z.ZodObject<{
64
+ phone: z.ZodString;
65
+ }, z.core.$strip>;
66
+ declare const changePasswordSchema: z.ZodObject<{
67
+ currentPassword: z.ZodString;
68
+ newPassword: z.ZodString;
69
+ }, z.core.$strip>;
70
+ declare const mfaTokenSchema: z.ZodObject<{
71
+ token: z.ZodString;
72
+ }, z.core.$strip>;
73
+ type RegisterInput = z.infer<typeof registerSchema>;
74
+ type LoginInput = z.infer<typeof loginSchema>;
75
+ type ResetPasswordInput = z.infer<typeof resetPasswordSchema>;
76
+ type ChangePasswordInput = z.infer<typeof changePasswordSchema>;
77
+
78
+ type schemas_ChangePasswordInput = ChangePasswordInput;
79
+ type schemas_LoginInput = LoginInput;
80
+ type schemas_RegisterInput = RegisterInput;
81
+ type schemas_ResetPasswordInput = ResetPasswordInput;
82
+ declare const schemas_changePasswordSchema: typeof changePasswordSchema;
83
+ declare const schemas_forgotPasswordSchema: typeof forgotPasswordSchema;
84
+ declare const schemas_loginSchema: typeof loginSchema;
85
+ declare const schemas_mfaTokenSchema: typeof mfaTokenSchema;
86
+ declare const schemas_refreshSchema: typeof refreshSchema;
87
+ declare const schemas_registerSchema: typeof registerSchema;
88
+ declare const schemas_resetPasswordSchema: typeof resetPasswordSchema;
89
+ declare const schemas_updateEmailSchema: typeof updateEmailSchema;
90
+ declare const schemas_updatePhoneSchema: typeof updatePhoneSchema;
91
+ declare const schemas_updatePreferencesSchema: typeof updatePreferencesSchema;
92
+ declare const schemas_updateProfileSchema: typeof updateProfileSchema;
93
+ declare const schemas_verifySchema: typeof verifySchema;
94
+ declare namespace schemas {
95
+ export { type schemas_ChangePasswordInput as ChangePasswordInput, type schemas_LoginInput as LoginInput, type schemas_RegisterInput as RegisterInput, type schemas_ResetPasswordInput as ResetPasswordInput, schemas_changePasswordSchema as changePasswordSchema, schemas_forgotPasswordSchema as forgotPasswordSchema, schemas_loginSchema as loginSchema, schemas_mfaTokenSchema as mfaTokenSchema, schemas_refreshSchema as refreshSchema, schemas_registerSchema as registerSchema, schemas_resetPasswordSchema as resetPasswordSchema, schemas_updateEmailSchema as updateEmailSchema, schemas_updatePhoneSchema as updatePhoneSchema, schemas_updatePreferencesSchema as updatePreferencesSchema, schemas_updateProfileSchema as updateProfileSchema, schemas_verifySchema as verifySchema };
96
+ }
97
+
19
98
  declare function normalizeEmail(email: string): string;
20
99
  declare function normalizeEmailSafe(email: string): string | null;
21
100
 
22
- export { AuthModule, IAuthConfig, normalizeEmail, normalizeEmailSafe };
101
+ export { AuthModule, type ChangePasswordInput, IAuthConfig, type LoginInput, type RegisterInput, type ResetPasswordInput, normalizeEmail, normalizeEmailSafe, schemas };