hvp-shared 3.1.0 → 3.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.
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Collaborator Constants and Enums
3
+ *
4
+ * Shared enums used by both backend and frontend for collaborator management.
5
+ */
6
+ /**
7
+ * Web Application Roles
8
+ *
9
+ * Defines user roles for authorization and access control.
10
+ * Used in JWT tokens, middleware, and UI role-based rendering.
11
+ */
12
+ export declare enum WebAppRole {
13
+ admin = "Administrador",
14
+ manager = "Gerente",
15
+ collaborator = "Colaborador",
16
+ user = "User",
17
+ guest = "Invitado"
18
+ }
19
+ /**
20
+ * Educational Degree
21
+ *
22
+ * Academic level of collaborators for HR records.
23
+ */
24
+ export declare enum Degree {
25
+ HighSchool = "Bachillerato",
26
+ UniversityStudent = "Estudiante universitario",
27
+ BachelorComplete = "Licenciatura completa",
28
+ Graduated = "Titulado",
29
+ Masters = "Maestr\u00EDa",
30
+ Doctorate = "Doctorado",
31
+ Other = "Otros"
32
+ }
33
+ /**
34
+ * Gender
35
+ *
36
+ * Gender identification for HR and demographic records.
37
+ */
38
+ export declare enum Gender {
39
+ Male = "Masculino",
40
+ Female = "Femenino",
41
+ Other = "Otro"
42
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ /**
3
+ * Collaborator Constants and Enums
4
+ *
5
+ * Shared enums used by both backend and frontend for collaborator management.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.Gender = exports.Degree = exports.WebAppRole = void 0;
9
+ /**
10
+ * Web Application Roles
11
+ *
12
+ * Defines user roles for authorization and access control.
13
+ * Used in JWT tokens, middleware, and UI role-based rendering.
14
+ */
15
+ var WebAppRole;
16
+ (function (WebAppRole) {
17
+ WebAppRole["admin"] = "Administrador";
18
+ WebAppRole["manager"] = "Gerente";
19
+ WebAppRole["collaborator"] = "Colaborador";
20
+ WebAppRole["user"] = "User";
21
+ WebAppRole["guest"] = "Invitado";
22
+ })(WebAppRole || (exports.WebAppRole = WebAppRole = {}));
23
+ /**
24
+ * Educational Degree
25
+ *
26
+ * Academic level of collaborators for HR records.
27
+ */
28
+ var Degree;
29
+ (function (Degree) {
30
+ Degree["HighSchool"] = "Bachillerato";
31
+ Degree["UniversityStudent"] = "Estudiante universitario";
32
+ Degree["BachelorComplete"] = "Licenciatura completa";
33
+ Degree["Graduated"] = "Titulado";
34
+ Degree["Masters"] = "Maestr\u00EDa";
35
+ Degree["Doctorate"] = "Doctorado";
36
+ Degree["Other"] = "Otros";
37
+ })(Degree || (exports.Degree = Degree = {}));
38
+ /**
39
+ * Gender
40
+ *
41
+ * Gender identification for HR and demographic records.
42
+ */
43
+ var Gender;
44
+ (function (Gender) {
45
+ Gender["Male"] = "Masculino";
46
+ Gender["Female"] = "Femenino";
47
+ Gender["Other"] = "Otro";
48
+ })(Gender || (exports.Gender = Gender = {}));
@@ -3,3 +3,4 @@
3
3
  */
4
4
  export * from './mexican-states';
5
5
  export * from './sat-catalogs';
6
+ export * from './collaborator.constants';
@@ -19,3 +19,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
19
  */
20
20
  __exportStar(require("./mexican-states"), exports);
21
21
  __exportStar(require("./sat-catalogs"), exports);
22
+ __exportStar(require("./collaborator.constants"), exports);
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Collaborator API Contracts
3
+ * Request and Response types for Collaborator endpoints
4
+ */
5
+ export * from './responses';
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /**
3
+ * Collaborator API Contracts
4
+ * Request and Response types for Collaborator endpoints
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ __exportStar(require("./responses"), exports);
22
+ // export * from './requests'; // TODO: Create when needed
@@ -0,0 +1,106 @@
1
+ import { WebAppRole } from '../../constants/collaborator.constants';
2
+ import { AddressValidationProps } from '../../validation/address.validation';
3
+ /**
4
+ * Public Collaborator Response
5
+ *
6
+ * Minimal data for public endpoints (no authentication required).
7
+ * Used for: Public website, service listings, team pages.
8
+ *
9
+ * @example GET /api/collaborators/public
10
+ */
11
+ export interface PublicCollaboratorResponse {
12
+ id: string;
13
+ col_code: string;
14
+ first_name: string;
15
+ last_name: string;
16
+ photoURL?: string;
17
+ role: WebAppRole;
18
+ isActive: boolean;
19
+ }
20
+ /**
21
+ * Collaborator View Response
22
+ *
23
+ * Extended data for authenticated collaborators viewing other collaborators.
24
+ * Excludes sensitive information (fiscal data, salary, banking).
25
+ *
26
+ * Used for: Collaborators viewing team members, scheduling, contact info.
27
+ *
28
+ * @example GET /api/collaborators/:id (authenticated collaborator)
29
+ */
30
+ export interface CollaboratorViewResponse {
31
+ id: string;
32
+ col_code: string;
33
+ first_name: string;
34
+ last_name: string;
35
+ email?: string;
36
+ phone?: string;
37
+ photoURL?: string;
38
+ birthDate?: Date;
39
+ role: WebAppRole;
40
+ isActive: boolean;
41
+ isDisplayedWeb: boolean;
42
+ isRegistered: boolean;
43
+ job?: string;
44
+ branch?: string;
45
+ hireDate?: Date;
46
+ address?: AddressValidationProps;
47
+ facebook?: string;
48
+ instagram?: string;
49
+ createdAt?: Date;
50
+ updatedAt?: Date;
51
+ }
52
+ /**
53
+ * Admin Collaborator Response
54
+ *
55
+ * Complete data including all sensitive information.
56
+ * Only for admin users.
57
+ *
58
+ * Used for: Admin dashboard, payroll management, HR operations, CFDI generation.
59
+ *
60
+ * @example GET /api/collaborators/:id (admin authenticated)
61
+ */
62
+ export interface AdminCollaboratorResponse {
63
+ id: string;
64
+ col_code: string;
65
+ first_name: string;
66
+ last_name: string;
67
+ second_last_name?: string;
68
+ email?: string;
69
+ phone?: string;
70
+ photoURL?: string;
71
+ birthDate?: Date;
72
+ role: WebAppRole;
73
+ isActive: boolean;
74
+ isDisplayedWeb: boolean;
75
+ isRegistered: boolean;
76
+ registeredDate?: Date;
77
+ job?: string;
78
+ branch?: string;
79
+ hireDate?: Date;
80
+ endDate?: Date;
81
+ address?: AddressValidationProps;
82
+ facebook?: string;
83
+ instagram?: string;
84
+ rfcCode?: string;
85
+ curp?: string;
86
+ imssNumber?: string;
87
+ useFiscalAddressSameAsMain: boolean;
88
+ fiscalAddress?: AddressValidationProps;
89
+ taxZipCode?: string;
90
+ contractType?: string;
91
+ regimeType?: string;
92
+ fiscalRegime?: string;
93
+ bank?: string;
94
+ bankAccount?: string;
95
+ baseSalary?: number;
96
+ dailySalary?: number;
97
+ accessCode?: string;
98
+ createdBy?: string;
99
+ updatedBy?: string;
100
+ createdAt?: Date;
101
+ updatedAt?: Date;
102
+ }
103
+ /**
104
+ * Union type for all collaborator response types
105
+ */
106
+ export type CollaboratorResponse = PublicCollaboratorResponse | CollaboratorViewResponse | AdminCollaboratorResponse;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ /**
2
+ * API Contracts
3
+ * Request and Response types for all API endpoints
4
+ */
5
+ export * from './collaborator';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * API Contracts
4
+ * Request and Response types for all API endpoints
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ __exportStar(require("./collaborator"), exports);
package/dist/index.d.ts CHANGED
@@ -4,5 +4,6 @@
4
4
  */
5
5
  export * from './types';
6
6
  export * from './constants';
7
+ export * from './contracts';
7
8
  export * from './validation';
8
9
  export { debugLog } from './utils/debug-logger';
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.debugLog = void 0;
22
22
  __exportStar(require("./types"), exports);
23
23
  __exportStar(require("./constants"), exports);
24
+ __exportStar(require("./contracts"), exports);
24
25
  __exportStar(require("./validation"), exports);
25
26
  var debug_logger_1 = require("./utils/debug-logger");
26
27
  Object.defineProperty(exports, "debugLog", { enumerable: true, get: function () { return debug_logger_1.debugLog; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvp-shared",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "Shared types and utilities for HVP backend and frontend",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",