@duvdu-v1/duvdu 1.1.355 → 1.1.360

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 (56) hide show
  1. package/build/errors/pdf-generation-error.d.ts +9 -0
  2. package/build/errors/pdf-generation-error.js +15 -0
  3. package/build/guards/isEmailVerified.guard.d.ts +2 -0
  4. package/build/guards/isEmailVerified.guard.js +15 -0
  5. package/build/guards/isPhoneNumberVerified.guard.d.ts +2 -0
  6. package/build/guards/isPhoneNumberVerified.guard.js +15 -0
  7. package/build/index.d.ts +7 -1
  8. package/build/index.js +7 -1
  9. package/build/mailer/mailer.interface.d.ts +68 -0
  10. package/build/mailer/mailer.interface.js +12 -0
  11. package/build/mailer/mailer.service.d.ts +10 -0
  12. package/build/mailer/mailer.service.js +149 -0
  13. package/build/mailer/strategies/resend.strategy.d.ts +6 -0
  14. package/build/mailer/strategies/resend.strategy.js +48 -0
  15. package/build/mailer/strategies/smtp.strategy.d.ts +6 -0
  16. package/build/mailer/strategies/smtp.strategy.js +50 -0
  17. package/build/mailer/templates/layouts/main.hbs +103 -0
  18. package/build/mailer/templates/partials/footer.hbs +4 -0
  19. package/build/mailer/templates/partials/header.hbs +4 -0
  20. package/build/mailer/templates/views/account-update.hbs +20 -0
  21. package/build/mailer/templates/views/complaint-escalation.hbs +23 -0
  22. package/build/mailer/templates/views/invoice.hbs +29 -0
  23. package/build/mailer/templates/views/new-user.hbs +23 -0
  24. package/build/mailer/templates/views/organization-user-created.hbs +25 -0
  25. package/build/mailer/templates/views/reset-password.hbs +14 -0
  26. package/build/mailer/templates/views/verify-email.hbs +14 -0
  27. package/build/mailer/templates/views/welcome.hbs +22 -0
  28. package/build/middlewares/auth.middleware.js +2 -1
  29. package/build/middlewares/optional-auth.middleware.js +2 -1
  30. package/build/models/User.model.d.ts +2 -2
  31. package/build/models/User.model.js +23 -16
  32. package/build/models/contracts.model.d.ts +7 -0
  33. package/build/models/contracts.model.js +7 -0
  34. package/build/models/settings.model.d.ts +6 -0
  35. package/build/models/settings.model.js +6 -0
  36. package/build/services/pdf-templates/layouts/main.hbs +91 -0
  37. package/build/services/pdf-templates/partials/footer.hbs +4 -0
  38. package/build/services/pdf-templates/partials/header.hbs +4 -0
  39. package/build/services/pdf-templates/views/invoice.hbs +60 -0
  40. package/build/services/pdfGenerator.service.d.ts +16 -0
  41. package/build/services/pdfGenerator.service.js +198 -0
  42. package/build/services/rank.service.d.ts +2 -2
  43. package/build/types/JwtPayload.d.ts +2 -1
  44. package/build/types/User.d.ts +18 -7
  45. package/build/types/User.js +4 -0
  46. package/build/types/model-names.d.ts +1 -0
  47. package/build/types/model-names.js +1 -0
  48. package/build/types/pdf.types.d.ts +30 -0
  49. package/build/types/pdf.types.js +7 -0
  50. package/build/types/systemRoles.d.ts +1 -2
  51. package/build/types/systemRoles.js +3 -2
  52. package/build/utils/{bucket.d.ts → bucket-wasabi.d.ts} +10 -9
  53. package/build/utils/{bucket.js → bucket-wasabi.js} +102 -124
  54. package/build/utils/mask.d.ts +5 -0
  55. package/build/utils/mask.js +49 -0
  56. package/package.json +10 -2
@@ -1,9 +1,9 @@
1
1
  import { Document } from 'mongoose';
2
2
  import { Iuser } from '../types/User';
3
3
  export type UserDocument = Document & Iuser;
4
- export declare const updateRankForUser: (userId: string) => Promise<(Document<unknown, {}, Iuser, {}, {}> & Iuser & {
4
+ export declare const updateRankForUser: (userId: string) => Promise<(Document<unknown, {}, Iuser, {}, {}> & Iuser & Required<{
5
5
  _id: import("mongoose").Types.ObjectId;
6
- } & {
6
+ }> & {
7
7
  __v: number;
8
8
  }) | undefined>;
9
9
  export declare const updateUsersAfterRankDeletion: (deletedRankTitle: string) => Promise<void>;
@@ -1,7 +1,8 @@
1
1
  import { PERMISSIONS } from './Permissions';
2
2
  export interface IjwtPayload {
3
3
  id: string;
4
- isVerified: boolean;
4
+ isEmailVerified: boolean;
5
+ isPhoneNumberVerified: boolean;
5
6
  isBlocked: {
6
7
  value: boolean;
7
8
  reason?: string;
@@ -1,4 +1,4 @@
1
- import { Types } from 'mongoose';
1
+ import { Document, Types } from 'mongoose';
2
2
  import { Icategory } from './Category';
3
3
  import { Irole } from './Role';
4
4
  export declare enum VerificationReason {
@@ -6,13 +6,18 @@ export declare enum VerificationReason {
6
6
  updateOldPhoneNumberVerified = "update-old-phone-number-verified",
7
7
  updateNewPhoneNumber = "update-new-phone-number",
8
8
  verifyUpdatedPhoneNumber = "verify-updated-phone-number",
9
+ updateOldEmail = "update-old-email",
10
+ updateOldEmailVerified = "update-old-email-verified",
11
+ updateNewEmail = "update-new-email",
9
12
  forgetPassword = "forget-password",
10
13
  forgetPasswordVerified = "forget-password-verified",
11
14
  signup = "signup",
15
+ verifyPhoneNumber = "verify-phone-number",
12
16
  completeSginUp = "complete-sginup",
13
17
  CompleteSginUpVerfied = "complete-sginup-verified"
14
18
  }
15
19
  export interface Iuser {
20
+ _id: Types.ObjectId;
16
21
  id: string;
17
22
  googleId?: string;
18
23
  appleId?: string;
@@ -24,12 +29,7 @@ export interface Iuser {
24
29
  };
25
30
  username: string;
26
31
  password?: string;
27
- verificationCode?: {
28
- code?: string;
29
- expireAt?: string;
30
- reason?: VerificationReason;
31
- };
32
- isVerified: boolean;
32
+ verificationCode: IverificationCode;
33
33
  refreshTokens?: {
34
34
  deviceId: string;
35
35
  token: string;
@@ -46,6 +46,8 @@ export interface Iuser {
46
46
  about?: string;
47
47
  isOnline: boolean;
48
48
  isAvaliableToInstantProjects: boolean;
49
+ isEmailVerified: boolean;
50
+ isPhoneNumberVerified: boolean;
49
51
  pricePerHour: number;
50
52
  role: Types.ObjectId | Irole;
51
53
  hasVerificationBadge: boolean;
@@ -87,3 +89,12 @@ export interface Iuser {
87
89
  isDeleted: boolean;
88
90
  hasFreeTime: boolean;
89
91
  }
92
+ export interface IverificationCode extends Document {
93
+ id: string;
94
+ expireAt: Date | null;
95
+ reason: VerificationReason | null;
96
+ code: string | null;
97
+ isVerified: boolean;
98
+ createdAt: string;
99
+ updatedAt: string;
100
+ }
@@ -7,9 +7,13 @@ var VerificationReason;
7
7
  VerificationReason["updateOldPhoneNumberVerified"] = "update-old-phone-number-verified";
8
8
  VerificationReason["updateNewPhoneNumber"] = "update-new-phone-number";
9
9
  VerificationReason["verifyUpdatedPhoneNumber"] = "verify-updated-phone-number";
10
+ VerificationReason["updateOldEmail"] = "update-old-email";
11
+ VerificationReason["updateOldEmailVerified"] = "update-old-email-verified";
12
+ VerificationReason["updateNewEmail"] = "update-new-email";
10
13
  VerificationReason["forgetPassword"] = "forget-password";
11
14
  VerificationReason["forgetPasswordVerified"] = "forget-password-verified";
12
15
  VerificationReason["signup"] = "signup";
16
+ VerificationReason["verifyPhoneNumber"] = "verify-phone-number";
13
17
  VerificationReason["completeSginUp"] = "complete-sginup";
14
18
  VerificationReason["CompleteSginUpVerfied"] = "complete-sginup-verified";
15
19
  })(VerificationReason || (exports.VerificationReason = VerificationReason = {}));
@@ -1,5 +1,6 @@
1
1
  export declare enum MODELS {
2
2
  user = "users",
3
+ userVerification = "user_verification",
3
4
  category = "categories",
4
5
  plan = "plans",
5
6
  role = "roles",
@@ -4,6 +4,7 @@ exports.MODELS = void 0;
4
4
  var MODELS;
5
5
  (function (MODELS) {
6
6
  MODELS["user"] = "users";
7
+ MODELS["userVerification"] = "user_verification";
7
8
  MODELS["category"] = "categories";
8
9
  MODELS["plan"] = "plans";
9
10
  MODELS["role"] = "roles";
@@ -0,0 +1,30 @@
1
+ export declare enum PdfType {
2
+ INVOICE = "invoice"
3
+ }
4
+ export interface PartyDetails {
5
+ name?: string;
6
+ email?: string;
7
+ phone?: string;
8
+ }
9
+ export interface FeeItem {
10
+ label: string;
11
+ value: number;
12
+ }
13
+ export interface InvoiceBreakdown {
14
+ base: number;
15
+ vat: number;
16
+ fees: FeeItem[];
17
+ }
18
+ export interface InvoiceContext {
19
+ transactionId: string;
20
+ date: Date | string;
21
+ currency?: string;
22
+ breakdown: InvoiceBreakdown;
23
+ total: number;
24
+ sp?: PartyDetails;
25
+ client?: PartyDetails;
26
+ recipient?: 'client' | 'sp';
27
+ }
28
+ export interface PdfContextMap {
29
+ [PdfType.INVOICE]: InvoiceContext;
30
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PdfType = void 0;
4
+ var PdfType;
5
+ (function (PdfType) {
6
+ PdfType["INVOICE"] = "invoice";
7
+ })(PdfType || (exports.PdfType = PdfType = {}));
@@ -1,5 +1,4 @@
1
1
  export declare enum SystemRoles {
2
- verified = "verified",
3
- unverified = "unverified",
2
+ user = "user",
4
3
  admin = "admin"
5
4
  }
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SystemRoles = void 0;
4
4
  var SystemRoles;
5
5
  (function (SystemRoles) {
6
- SystemRoles["verified"] = "verified";
7
- SystemRoles["unverified"] = "unverified";
6
+ // verified = 'verified',
7
+ // unverified = 'unverified',
8
+ SystemRoles["user"] = "user";
8
9
  SystemRoles["admin"] = "admin";
9
10
  })(SystemRoles || (exports.SystemRoles = SystemRoles = {}));
@@ -1,12 +1,15 @@
1
- export declare class Bucket {
2
- private s3;
3
- private bucketName;
4
- private rekognition;
5
- constructor();
1
+ declare class BucketWasabi {
2
+ private _s3;
3
+ private _rekognition;
4
+ private get s3();
5
+ private get rekognition();
6
+ private get bucketName();
6
7
  saveBucketFiles(folder: string, ...files: Express.Multer.File[]): Promise<void>;
7
8
  private uploadSmallFile;
8
9
  removeBucketFiles(...filePaths: string[]): Promise<void>;
9
10
  private getContentType;
11
+ getPresignedUrl(fileKey: string): Promise<string>;
12
+ private getImageBytes;
10
13
  validateFace(imageKey: string): Promise<{
11
14
  isValid: boolean;
12
15
  error?: {
@@ -18,10 +21,6 @@ export declare class Bucket {
18
21
  private performAntiSpoofingChecks;
19
22
  private validateEyesForLiveness;
20
23
  private validatePoseForLiveness;
21
- /**
22
- * Comprehensive face validation with advanced liveness detection
23
- * This method provides additional verification by analyzing multiple image properties
24
- */
25
24
  validateFaceWithAdvancedLiveness(imageKey: string): Promise<{
26
25
  isValid: boolean;
27
26
  livenessScore: number;
@@ -36,3 +35,5 @@ export declare class Bucket {
36
35
  };
37
36
  }>;
38
37
  }
38
+ export declare const bucketWasabi: BucketWasabi;
39
+ export {};