hvp-shared 3.1.0 → 3.2.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.
@@ -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,6 @@
1
+ /**
2
+ * Collaborator API Contracts
3
+ * Request and Response types for Collaborator endpoints
4
+ */
5
+ export * from './responses';
6
+ export * from './requests';
@@ -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
+ __exportStar(require("./requests"), exports);
@@ -0,0 +1,132 @@
1
+ import { WebAppRole } from '../../constants/collaborator.constants';
2
+ import { AddressValidationProps } from '../../validation/address.validation';
3
+ /**
4
+ * Create Collaborator Request
5
+ *
6
+ * Data required to create a new collaborator.
7
+ * Used by admin/manager roles.
8
+ *
9
+ * @example POST /api/collaborators/create
10
+ */
11
+ export interface CreateCollaboratorRequest {
12
+ first_name: string;
13
+ last_name: string;
14
+ col_code: string;
15
+ role: WebAppRole;
16
+ isActive: boolean;
17
+ isDisplayedWeb: boolean;
18
+ isRegistered: boolean;
19
+ second_last_name?: string;
20
+ email?: string;
21
+ phone?: string;
22
+ photoURL?: string;
23
+ birthDate?: string;
24
+ job?: string;
25
+ branch?: string;
26
+ startDate?: string;
27
+ hireDate?: string;
28
+ endDate?: string;
29
+ address?: AddressValidationProps;
30
+ facebook?: string;
31
+ instagram?: string;
32
+ rfcCode?: string;
33
+ curp?: string;
34
+ imssNumber?: string;
35
+ useFiscalAddressSameAsMain?: boolean;
36
+ fiscalAddress?: AddressValidationProps;
37
+ taxZipCode?: string;
38
+ contractType?: string;
39
+ regimeType?: string;
40
+ fiscalRegime?: string;
41
+ bank?: string;
42
+ bankAccount?: string;
43
+ baseSalary?: number;
44
+ dailySalary?: number;
45
+ accessCode?: string;
46
+ password?: string;
47
+ }
48
+ /**
49
+ * Update Collaborator Request
50
+ *
51
+ * Partial data to update an existing collaborator.
52
+ * All fields optional - only provided fields will be updated.
53
+ *
54
+ * @example PATCH /api/collaborators/:id
55
+ */
56
+ export interface UpdateCollaboratorRequest {
57
+ first_name?: string;
58
+ last_name?: string;
59
+ second_last_name?: string;
60
+ email?: string;
61
+ phone?: string;
62
+ photoURL?: string;
63
+ birthDate?: string;
64
+ role?: WebAppRole;
65
+ isActive?: boolean;
66
+ isDisplayedWeb?: boolean;
67
+ isRegistered?: boolean;
68
+ job?: string;
69
+ branch?: string;
70
+ startDate?: string;
71
+ hireDate?: string;
72
+ endDate?: string;
73
+ address?: AddressValidationProps;
74
+ facebook?: string;
75
+ instagram?: string;
76
+ rfcCode?: string;
77
+ curp?: string;
78
+ imssNumber?: string;
79
+ useFiscalAddressSameAsMain?: boolean;
80
+ fiscalAddress?: AddressValidationProps;
81
+ taxZipCode?: string;
82
+ contractType?: string;
83
+ regimeType?: string;
84
+ fiscalRegime?: string;
85
+ bank?: string;
86
+ bankAccount?: string;
87
+ baseSalary?: number;
88
+ dailySalary?: number;
89
+ accessCode?: string;
90
+ password?: string;
91
+ }
92
+ /**
93
+ * Register Collaborator Request
94
+ *
95
+ * Public registration flow for collaborators.
96
+ * Collaborator provides col_code, accessCode, email and password to register.
97
+ *
98
+ * @example PATCH /api/collaborators/register
99
+ */
100
+ export interface RegisterCollaboratorRequest {
101
+ col_code: string;
102
+ accessCode: string;
103
+ email: string;
104
+ password: string;
105
+ }
106
+ /**
107
+ * Update Many Collaborators Request
108
+ *
109
+ * Batch update multiple collaborators.
110
+ * Each item must include id + fields to update.
111
+ *
112
+ * @example PATCH /api/collaborators
113
+ */
114
+ export interface UpdateManyCollaboratorsRequest {
115
+ collaborators: Array<{
116
+ id: string;
117
+ } & Partial<UpdateCollaboratorRequest>>;
118
+ }
119
+ /**
120
+ * Collaborator Query Filters
121
+ *
122
+ * Query parameters for filtering collaborators list.
123
+ *
124
+ * @example GET /api/collaborators?isActive=true&role=Colaborador
125
+ */
126
+ export interface CollaboratorQueryFilters {
127
+ isActive?: boolean;
128
+ role?: WebAppRole;
129
+ branch?: string;
130
+ isRegistered?: boolean;
131
+ isDisplayedWeb?: boolean;
132
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,80 @@
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 extends PublicCollaboratorResponse {
31
+ email?: string;
32
+ phone?: string;
33
+ birthDate?: string;
34
+ isDisplayedWeb: boolean;
35
+ isRegistered: boolean;
36
+ job?: string;
37
+ branch?: string;
38
+ startDate?: string;
39
+ hireDate?: string;
40
+ endDate?: string;
41
+ address?: AddressValidationProps;
42
+ facebook?: string;
43
+ instagram?: string;
44
+ createdAt?: string;
45
+ updatedAt?: string;
46
+ }
47
+ /**
48
+ * Admin Collaborator Response
49
+ *
50
+ * Complete data including all sensitive information.
51
+ * Only for admin users.
52
+ *
53
+ * Used for: Admin dashboard, payroll management, HR operations, CFDI generation.
54
+ *
55
+ * @example GET /api/collaborators/:id (admin authenticated)
56
+ */
57
+ export interface AdminCollaboratorResponse extends CollaboratorViewResponse {
58
+ second_last_name?: string;
59
+ registeredDate?: string;
60
+ rfcCode?: string;
61
+ curp?: string;
62
+ imssNumber?: string;
63
+ useFiscalAddressSameAsMain: boolean;
64
+ fiscalAddress?: AddressValidationProps;
65
+ taxZipCode?: string;
66
+ contractType?: string;
67
+ regimeType?: string;
68
+ fiscalRegime?: string;
69
+ bank?: string;
70
+ bankAccount?: string;
71
+ baseSalary?: number;
72
+ dailySalary?: number;
73
+ accessCode?: string;
74
+ createdBy?: string;
75
+ updatedBy?: string;
76
+ }
77
+ /**
78
+ * Union type for all collaborator response types
79
+ */
80
+ 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.1",
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",