create-warlock 4.0.28 → 4.0.30

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.
Files changed (51) hide show
  1. package/package.json +1 -1
  2. package/templates/warlock/package.json +69 -0
  3. package/templates/warlock/src/app/auth/controllers/forgot-password.controller.ts +46 -0
  4. package/templates/warlock/src/app/auth/controllers/login.controller.ts +31 -0
  5. package/templates/warlock/src/app/auth/controllers/logout-all.controller.ts +16 -0
  6. package/templates/warlock/src/app/auth/controllers/logout.controller.ts +16 -0
  7. package/templates/warlock/src/app/auth/controllers/me.controller.ts +13 -0
  8. package/templates/warlock/src/app/auth/controllers/refresh-token.controller.ts +31 -0
  9. package/templates/warlock/src/app/auth/controllers/reset-password.controller.ts +25 -0
  10. package/templates/warlock/src/app/auth/main.ts +9 -0
  11. package/templates/warlock/src/app/auth/models/otp/index.ts +1 -0
  12. package/templates/warlock/src/app/auth/models/otp/migrations/22-12-2025_10-30-20.otp-migration.ts +22 -0
  13. package/templates/warlock/src/app/auth/models/otp/otp.model.ts +75 -0
  14. package/templates/warlock/src/app/auth/requests/login.request.ts +10 -0
  15. package/templates/warlock/src/app/auth/requests/reset-password.request.ts +11 -0
  16. package/templates/warlock/src/app/auth/routes.ts +22 -0
  17. package/templates/warlock/src/app/auth/services/auth.service.ts +47 -0
  18. package/templates/warlock/src/app/auth/services/otp.service.ts +174 -0
  19. package/templates/warlock/src/app/auth/services/reset-password.service.ts +35 -0
  20. package/templates/warlock/src/app/auth/utils/auth-error-code.ts +6 -0
  21. package/templates/warlock/src/app/auth/utils/locales.ts +89 -0
  22. package/templates/warlock/src/app/auth/utils/types.ts +14 -0
  23. package/templates/warlock/src/app/shared/services/scheduler.service.ts +3 -0
  24. package/templates/warlock/src/app/shared/utils/locales.ts +728 -0
  25. package/templates/warlock/src/app/users/commands/hello-world.command.ts +8 -0
  26. package/templates/warlock/src/app/users/controllers/get-users.controller.ts +10 -0
  27. package/templates/warlock/src/app/users/main.ts +0 -0
  28. package/templates/warlock/src/app/users/models/user/index.ts +1 -0
  29. package/templates/warlock/src/app/users/models/user/migrations/11-12-2025_23-58-03-user.migration.ts +14 -0
  30. package/templates/warlock/src/app/users/models/user/user.model.ts +46 -0
  31. package/templates/warlock/src/app/users/repositories/users-repository.ts +66 -0
  32. package/templates/warlock/src/app/users/repositories/users.repository.ts +27 -0
  33. package/templates/warlock/src/app/users/routes.ts +4 -0
  34. package/templates/warlock/src/app/users/services/get-new-customers.ts +5 -0
  35. package/templates/warlock/src/app/users/services/get-users.service.ts +5 -0
  36. package/templates/warlock/src/app/users/services/list-users.service.ts +7 -0
  37. package/templates/warlock/src/app/users/services/login-social.ts +19 -0
  38. package/templates/warlock/src/app/utils/output.ts +5 -0
  39. package/templates/warlock/src/app/utils/router.ts +30 -0
  40. package/templates/warlock/src/config/app.ts +12 -0
  41. package/templates/warlock/src/config/auth.ts +18 -0
  42. package/templates/warlock/src/config/cache.ts +60 -0
  43. package/templates/warlock/src/config/database.ts +19 -0
  44. package/templates/warlock/src/config/google.ts +22 -0
  45. package/templates/warlock/src/config/http.ts +23 -0
  46. package/templates/warlock/src/config/log.ts +22 -0
  47. package/templates/warlock/src/config/mail.ts +16 -0
  48. package/templates/warlock/src/config/notifications.ts +11 -0
  49. package/templates/warlock/src/config/storage.ts +21 -0
  50. package/templates/warlock/src/config/tests.ts +5 -0
  51. package/templates/warlock/src/config/validation.ts +7 -0
@@ -0,0 +1,6 @@
1
+ export enum AuthErrorCode {
2
+ OTP_NOT_FOUND = "OTX001", // OTP Not Found
3
+ OTP_EXPIRED = "OTX002", // OTP Expired
4
+ OTP_MAX_ATTEMPTS = "OTX003", // OTP Max Attempts
5
+ OTP_INVALID = "OTX004", // OTP Invalid
6
+ }
@@ -0,0 +1,89 @@
1
+ import { groupedTranslations } from "@mongez/localization";
2
+
3
+ groupedTranslations("auth", {
4
+ // App-level translations
5
+ invalidCredentials: {
6
+ en: "Invalid email or password",
7
+ ar: "البريد الالكتروني أو كلمة المرور غير صحيحة",
8
+ },
9
+ loggedOut: {
10
+ en: "Logged out successfully",
11
+ ar: "تم تسجيل الخروج بنجاح",
12
+ },
13
+ loggedOutAll: {
14
+ en: "Logged out from all devices",
15
+ ar: "تم تسجيل الخروج من جميع الأجهزة",
16
+ },
17
+ refreshTokenRequired: {
18
+ en: "Refresh token is required",
19
+ ar: "رمز التحديث مطلوب",
20
+ },
21
+ invalidRefreshToken: {
22
+ en: "Invalid or expired refresh token",
23
+ ar: "رمز التحديث غير صالح أو منتهي الصلاحية",
24
+ },
25
+
26
+ userNotFound: {
27
+ en: "User not found",
28
+ ar: "المستخدم غير موجود",
29
+ },
30
+
31
+ // OTP translations
32
+ otpSent: {
33
+ en: "Verification code sent",
34
+ ar: "تم إرسال رمز التحقق",
35
+ },
36
+ missingOtp: {
37
+ en: "Verification code not found",
38
+ ar: "رمز التحقق غير موجود",
39
+ },
40
+ otpInvalid: {
41
+ en: "Invalid verification code",
42
+ ar: "رمز التحقق غير صالح",
43
+ },
44
+ otpExpired: {
45
+ en: "Verification code has expired",
46
+ ar: "رمز التحقق منتهي الصلاحية",
47
+ },
48
+ otpMaxAttempts: {
49
+ en: "Too many failed attempts",
50
+ ar: "عدد المحاولات تجاوز الحد المسموح",
51
+ },
52
+ passwordResetSuccess: {
53
+ en: "Password reset successfully",
54
+ ar: "تم إعادة تعيين كلمة المرور بنجاح",
55
+ },
56
+
57
+ /**
58
+ * ============================================
59
+ * @warlock.js/auth package translations
60
+ * ============================================
61
+ * The following translations are used by the @warlock.js/auth package
62
+ * in the auth middleware. They must be defined here so they can be
63
+ * translated in your application.
64
+ */
65
+ errors: {
66
+ /**
67
+ * Called when the access token is missing from Authorization header
68
+ */
69
+ missingAccessToken: {
70
+ en: "Access token is required",
71
+ ar: "رمز الوصول مطلوب",
72
+ },
73
+ /**
74
+ * Called when an access token is invalid or expired
75
+ */
76
+ invalidAccessToken: {
77
+ en: "Invalid or expired access token",
78
+ ar: "رمز الوصول غير صالح أو منتهي الصلاحية",
79
+ },
80
+ /**
81
+ * Called when the current user type is not authorized to
82
+ * access a protected resource for certain user types
83
+ */
84
+ unauthorized: {
85
+ en: "You are not authorized to access this resource",
86
+ ar: "غير مصرح لك بالوصول إلى هذا المورد",
87
+ },
88
+ },
89
+ });
@@ -0,0 +1,14 @@
1
+ /**
2
+ * OTP delivery channels
3
+ */
4
+ export type OTPChannel = "email" | "sms" | "whatsapp" | "push";
5
+
6
+ /**
7
+ * Common OTP types
8
+ */
9
+ export type OTPType =
10
+ | "password-reset"
11
+ | "email-verification"
12
+ | "phone-verification"
13
+ | "two-factor"
14
+ | string;
@@ -0,0 +1,3 @@
1
+ import { Scheduler } from "@warlock.js/scheduler";
2
+
3
+ export const scheduler = new Scheduler();