@zerosls/clm-sdk 1.0.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.
Files changed (81) hide show
  1. package/.docs/publicacion-npm.md +111 -0
  2. package/.env.example +14 -0
  3. package/.gitlab-ci.yml +23 -0
  4. package/README.md +202 -0
  5. package/dist/config/config.d.ts +3 -0
  6. package/dist/config/config.js +21 -0
  7. package/dist/core/api-client.d.ts +27 -0
  8. package/dist/core/api-client.js +183 -0
  9. package/dist/core/api-error.d.ts +15 -0
  10. package/dist/core/api-error.js +46 -0
  11. package/dist/core/event-emitter.d.ts +11 -0
  12. package/dist/core/event-emitter.js +32 -0
  13. package/dist/index.d.ts +41 -0
  14. package/dist/index.js +59 -0
  15. package/dist/modules/legacy/areas/areas-api.d.ts +34 -0
  16. package/dist/modules/legacy/areas/areas-api.js +44 -0
  17. package/dist/modules/legacy/areas/types.d.ts +37 -0
  18. package/dist/modules/legacy/areas/types.js +1 -0
  19. package/dist/modules/legacy/classificationtypes/classificationtypes-api.d.ts +34 -0
  20. package/dist/modules/legacy/classificationtypes/classificationtypes-api.js +46 -0
  21. package/dist/modules/legacy/classificationtypes/types.d.ts +41 -0
  22. package/dist/modules/legacy/classificationtypes/types.js +1 -0
  23. package/dist/modules/v1/auth/auth-api.d.ts +17 -0
  24. package/dist/modules/v1/auth/auth-api.js +63 -0
  25. package/dist/modules/v1/auth/types.d.ts +18 -0
  26. package/dist/modules/v1/auth/types.js +1 -0
  27. package/dist/modules/v1/main/main-api.d.ts +11 -0
  28. package/dist/modules/v1/main/main-api.js +14 -0
  29. package/dist/modules/v1/main/types.d.ts +3 -0
  30. package/dist/modules/v1/main/types.js +1 -0
  31. package/dist/modules/v1/notifications/notification-api.d.ts +16 -0
  32. package/dist/modules/v1/notifications/notification-api.js +26 -0
  33. package/dist/modules/v1/notifications/types.d.ts +53 -0
  34. package/dist/modules/v1/notifications/types.js +1 -0
  35. package/dist/modules/v1/users/types.d.ts +64 -0
  36. package/dist/modules/v1/users/types.js +1 -0
  37. package/dist/modules/v1/users/users-api.d.ts +81 -0
  38. package/dist/modules/v1/users/users-api.js +113 -0
  39. package/dist/types/common.d.ts +18 -0
  40. package/dist/types/common.js +1 -0
  41. package/dist/types/sdk.d.ts +42 -0
  42. package/dist/types/sdk.js +11 -0
  43. package/dist/utils/cache.d.ts +10 -0
  44. package/dist/utils/cache.js +43 -0
  45. package/dist/utils/http.d.ts +5 -0
  46. package/dist/utils/http.js +56 -0
  47. package/package.json +38 -0
  48. package/src/config/config.ts +24 -0
  49. package/src/core/api-client.ts +272 -0
  50. package/src/core/api-error.ts +54 -0
  51. package/src/core/event-emitter.ts +43 -0
  52. package/src/index.ts +89 -0
  53. package/src/modules/legacy/areas/areas-api.ts +73 -0
  54. package/src/modules/legacy/areas/types.ts +49 -0
  55. package/src/modules/legacy/classificationtypes/classificationtypes-api.ts +80 -0
  56. package/src/modules/legacy/classificationtypes/types.ts +52 -0
  57. package/src/modules/v1/auth/auth-api.ts +75 -0
  58. package/src/modules/v1/auth/types.ts +20 -0
  59. package/src/modules/v1/main/main-api.ts +20 -0
  60. package/src/modules/v1/main/types.ts +3 -0
  61. package/src/modules/v1/notifications/notification-api.ts +55 -0
  62. package/src/modules/v1/notifications/types.ts +58 -0
  63. package/src/modules/v1/users/types.ts +83 -0
  64. package/src/modules/v1/users/users-api.ts +148 -0
  65. package/src/types/common.ts +22 -0
  66. package/src/types/sdk.ts +38 -0
  67. package/src/utils/cache.ts +58 -0
  68. package/src/utils/http.ts +77 -0
  69. package/tests/integration/legacy/auth-areas.test.ts +115 -0
  70. package/tests/integration/legacy/auth-classification-types.test.ts +80 -0
  71. package/tests/integration/v1/auth-logs.test.ts +145 -0
  72. package/tests/integration/v1/auth-users.test.ts +189 -0
  73. package/tests/modules/legacy/areas/areas-api.test.ts +232 -0
  74. package/tests/modules/legacy/classification-types/classification-types-api.test.ts +100 -0
  75. package/tests/modules/v1/auth/auth-api.test.ts +134 -0
  76. package/tests/modules/v1/users/users-api.test.ts +176 -0
  77. package/tests/setup.ts +12 -0
  78. package/tests/utils/test-utils.ts +453 -0
  79. package/tsconfig.json +16 -0
  80. package/tsconfig.test.json +13 -0
  81. package/vitest.config.ts +16 -0
@@ -0,0 +1,41 @@
1
+ import { SdkConfig } from "./types/sdk";
2
+ import { SdkEventType } from "./types/sdk";
3
+ import { AuthApi } from "./modules/v1/auth/auth-api";
4
+ import { UsersApi } from "./modules/v1/users/users-api";
5
+ import { MainApi } from "./modules/v1/main/main-api";
6
+ import { NotificationsApi } from "./modules/v1/notifications/notification-api";
7
+ import { AreasApi } from "./modules/legacy/areas/areas-api";
8
+ import { ClassificationTypesApi } from "./modules/legacy/classificationtypes/classificationtypes-api";
9
+ /**
10
+ * Main SDK for consuming CLM API
11
+ */
12
+ export declare class ClmSdk {
13
+ private apiClient;
14
+ private eventEmitter;
15
+ private cacheInstance;
16
+ auth: AuthApi;
17
+ users: UsersApi;
18
+ main: MainApi;
19
+ notifications: NotificationsApi;
20
+ areas: AreasApi;
21
+ classificationTypes: ClassificationTypesApi;
22
+ constructor(config: Partial<SdkConfig>);
23
+ /**
24
+ * Access to events system
25
+ */
26
+ on(event: SdkEventType, listener: any): ReturnType<typeof this.eventEmitter.on>;
27
+ /**
28
+ * Access to cache functions
29
+ */
30
+ cache: {
31
+ clear: () => void;
32
+ clearByPrefix: (prefix: string) => void;
33
+ };
34
+ }
35
+ export * from "./types/common";
36
+ export * from "./types/sdk";
37
+ export * from "./modules/v1/auth/types";
38
+ export * from "./modules/v1/users/types";
39
+ export * from "./modules/v1/notifications/types";
40
+ export * from "./modules/legacy/areas/types";
41
+ export * from "./modules/legacy/classificationtypes/types";
package/dist/index.js ADDED
@@ -0,0 +1,59 @@
1
+ import { mergeWithDefaultConfig } from "./config/config";
2
+ import { ApiClient } from "./core/api-client";
3
+ import { EventEmitter } from "./core/event-emitter";
4
+ import { Cache } from "./utils/cache";
5
+ // v1
6
+ import { AuthApi } from "./modules/v1/auth/auth-api";
7
+ import { UsersApi } from "./modules/v1/users/users-api";
8
+ import { MainApi } from "./modules/v1/main/main-api";
9
+ import { NotificationsApi } from "./modules/v1/notifications/notification-api";
10
+ //import { LogsApi } from "./modules/v1/logs/logs-api";
11
+ // Legacy
12
+ import { AreasApi } from "./modules/legacy/areas/areas-api";
13
+ import { ClassificationTypesApi } from "./modules/legacy/classificationtypes/classificationtypes-api";
14
+ /**
15
+ * Main SDK for consuming CLM API
16
+ */
17
+ export class ClmSdk {
18
+ constructor(config) {
19
+ var _a;
20
+ /**
21
+ * Access to cache functions
22
+ */
23
+ this.cache = {
24
+ clear: () => this.cacheInstance.clear(),
25
+ clearByPrefix: (prefix) => this.cacheInstance.clearByPrefix(prefix),
26
+ };
27
+ this.eventEmitter = new EventEmitter();
28
+ // Apply default configuration
29
+ const fullConfig = mergeWithDefaultConfig(config);
30
+ // Initialize core utilities
31
+ this.cacheInstance = new Cache((_a = fullConfig.cache) === null || _a === void 0 ? void 0 : _a.ttl);
32
+ this.apiClient = new ApiClient(fullConfig, this.eventEmitter);
33
+ // Initialize modules v1
34
+ this.auth = new AuthApi(this.apiClient);
35
+ this.users = new UsersApi(this.apiClient);
36
+ this.main = new MainApi(this.apiClient);
37
+ this.notifications = new NotificationsApi(this.apiClient);
38
+ //this.logs = new LogsApi(this.apiClient);
39
+ // Initialize legacy modules
40
+ this.areas = new AreasApi(this.apiClient);
41
+ this.classificationTypes = new ClassificationTypesApi(this.apiClient);
42
+ }
43
+ /**
44
+ * Access to events system
45
+ */
46
+ on(event, listener) {
47
+ return this.eventEmitter.on(event, listener);
48
+ }
49
+ }
50
+ export * from "./types/common";
51
+ export * from "./types/sdk";
52
+ // Export v1 types
53
+ export * from "./modules/v1/auth/types";
54
+ export * from "./modules/v1/users/types";
55
+ export * from "./modules/v1/notifications/types";
56
+ //export * from "./modules/v1/logs/types";
57
+ // Export legacy types
58
+ export * from "./modules/legacy/areas/types";
59
+ export * from "./modules/legacy/classificationtypes/types";
@@ -0,0 +1,34 @@
1
+ import { ApiClient } from "../../../core/api-client";
2
+ import { CreateAreaRequest, UpdateAreaRequest, DeleteAreaRequest, AreaResponse, AreasResponse } from "./types";
3
+ export declare class AreasApi {
4
+ private apiClient;
5
+ private readonly basePath;
6
+ constructor(apiClient: ApiClient);
7
+ /**
8
+ * GET - Obtener todas las áreas
9
+ */
10
+ getAreas(): Promise<AreasResponse>;
11
+ /**
12
+ * POST - Crear una nueva área
13
+ */
14
+ createArea(data: CreateAreaRequest): Promise<AreaResponse>;
15
+ /**
16
+ * PATCH - Actualizar datos de un área existente
17
+ */
18
+ updateArea(data: UpdateAreaRequest): Promise<AreaResponse>;
19
+ /**
20
+ * DELETE - Eliminar un área existente
21
+ */
22
+ deleteArea(data: DeleteAreaRequest): Promise<AreaResponse>;
23
+ /**
24
+ * Helper: Generar datos de auditoría actuales
25
+ */
26
+ generateAuditData(userId: string, userName: string): {
27
+ createdBy: string;
28
+ createdByName: string;
29
+ createdOn: string;
30
+ lastModBy: string;
31
+ lastModByName: string;
32
+ lastModOn: string;
33
+ };
34
+ }
@@ -0,0 +1,44 @@
1
+ export class AreasApi {
2
+ constructor(apiClient) {
3
+ this.basePath = "/legacy/catalog/areas"; //Siempre debe empezar con /legacy/ por que lo usa en el Gateway del API para que todas las request de API LEGACY y API V1 salgan de http://localhost:3001 URL del API que fusiona el API LEGACY y el API V1 y que el puerto lo toma por defecto del manifest
4
+ this.apiClient = apiClient;
5
+ }
6
+ /**
7
+ * GET - Obtener todas las áreas
8
+ */
9
+ async getAreas() {
10
+ return await this.apiClient.get(this.basePath, undefined, { useCache: false });
11
+ }
12
+ /**
13
+ * POST - Crear una nueva área
14
+ */
15
+ async createArea(data) {
16
+ return await this.apiClient.post(this.basePath, data);
17
+ }
18
+ /**
19
+ * PATCH - Actualizar datos de un área existente
20
+ */
21
+ async updateArea(data) {
22
+ return await this.apiClient.patch(this.basePath, data);
23
+ }
24
+ /**
25
+ * DELETE - Eliminar un área existente
26
+ */
27
+ async deleteArea(data) {
28
+ return await this.apiClient.delete(this.basePath, data);
29
+ }
30
+ /**
31
+ * Helper: Generar datos de auditoría actuales
32
+ */
33
+ generateAuditData(userId, userName) {
34
+ const now = new Date().toISOString();
35
+ return {
36
+ createdBy: userId,
37
+ createdByName: userName,
38
+ createdOn: now,
39
+ lastModBy: userId,
40
+ lastModByName: userName,
41
+ lastModOn: now
42
+ };
43
+ }
44
+ }
@@ -0,0 +1,37 @@
1
+ export interface AreaBase {
2
+ createdBy: string;
3
+ createdByName: string;
4
+ createdOn: string;
5
+ lastModBy: string;
6
+ lastModByName: string;
7
+ lastModOn: string;
8
+ name: string;
9
+ description: string;
10
+ }
11
+ export interface Area extends AreaBase {
12
+ id: number;
13
+ }
14
+ export interface CreateAreaRequest extends AreaBase {
15
+ }
16
+ export interface UpdateAreaRequest extends AreaBase {
17
+ id: number;
18
+ }
19
+ export interface DeleteAreaRequest {
20
+ id: number;
21
+ }
22
+ export interface AreasResponse {
23
+ dataResult: Area[];
24
+ statusResponse: {
25
+ code: number;
26
+ success: boolean;
27
+ message: string;
28
+ };
29
+ }
30
+ export interface AreaResponse {
31
+ dataResult?: Area;
32
+ statusResponse: {
33
+ code: number;
34
+ success: boolean;
35
+ message: string;
36
+ };
37
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,34 @@
1
+ import { ApiClient } from "../../../core/api-client";
2
+ import { CreateClassificationTypeRequest, UpdateClassificationTypeRequest, DeleteClassificationTypeRequest, ClassificationTypeResponse, ClassificationTypesResponse } from "./types";
3
+ export declare class ClassificationTypesApi {
4
+ private apiClient;
5
+ private readonly basePath;
6
+ constructor(apiClient: ApiClient);
7
+ /**
8
+ * GET - Obtener todos los tipos de clasificación
9
+ */
10
+ getClassificationTypes(): Promise<ClassificationTypesResponse>;
11
+ /**
12
+ * POST - Crear un nuevo tipo de clasificación
13
+ */
14
+ createClassificationType(data: CreateClassificationTypeRequest): Promise<ClassificationTypeResponse>;
15
+ /**
16
+ * PUT - Actualizar un tipo de clasificación existente
17
+ */
18
+ updateClassificationType(data: UpdateClassificationTypeRequest): Promise<ClassificationTypeResponse>;
19
+ /**
20
+ * DELETE - Eliminar un tipo de clasificación
21
+ */
22
+ deleteClassificationType(data: DeleteClassificationTypeRequest): Promise<ClassificationTypeResponse>;
23
+ /**
24
+ * Helper: Generar datos de auditoría actuales
25
+ */
26
+ generateAuditData(userId: string, userName: string): {
27
+ createdBy: string;
28
+ createdByName: string;
29
+ createdOn: string;
30
+ lastModBy: string;
31
+ lastModByName: string;
32
+ lastModOn: string;
33
+ };
34
+ }
@@ -0,0 +1,46 @@
1
+ export class ClassificationTypesApi {
2
+ constructor(apiClient) {
3
+ this.basePath = "/legacy/catalog/clasificationtype";
4
+ this.apiClient = apiClient;
5
+ }
6
+ /**
7
+ * GET - Obtener todos los tipos de clasificación
8
+ */
9
+ async getClassificationTypes() {
10
+ return await this.apiClient.get(this.basePath, undefined, { useCache: false });
11
+ }
12
+ /**
13
+ * POST - Crear un nuevo tipo de clasificación
14
+ */
15
+ async createClassificationType(data) {
16
+ const response = await this.apiClient.post(`${this.basePath}/create`, data);
17
+ return response;
18
+ }
19
+ /**
20
+ * PUT - Actualizar un tipo de clasificación existente
21
+ */
22
+ async updateClassificationType(data) {
23
+ return await this.apiClient.put(`${this.basePath}/update`, // Puede necesitar /update
24
+ data);
25
+ }
26
+ /**
27
+ * DELETE - Eliminar un tipo de clasificación
28
+ */
29
+ async deleteClassificationType(data) {
30
+ return await this.apiClient.delete(`${this.basePath}/delete`, data);
31
+ }
32
+ /**
33
+ * Helper: Generar datos de auditoría actuales
34
+ */
35
+ generateAuditData(userId, userName) {
36
+ const now = new Date().toISOString();
37
+ return {
38
+ createdBy: userId,
39
+ createdByName: userName,
40
+ createdOn: now,
41
+ lastModBy: userId,
42
+ lastModByName: userName,
43
+ lastModOn: now
44
+ };
45
+ }
46
+ }
@@ -0,0 +1,41 @@
1
+ export interface ClassificationTypeBase {
2
+ createdBy: string;
3
+ createdByName: string;
4
+ createdOn: string;
5
+ lastModBy: string;
6
+ lastModByName: string;
7
+ lastModOn: string;
8
+ name: string;
9
+ description: string | null;
10
+ }
11
+ export interface ClassificationType {
12
+ id: number;
13
+ name: string;
14
+ description: string | null;
15
+ }
16
+ export interface CreateClassificationTypeRequest extends ClassificationTypeBase {
17
+ }
18
+ export interface UpdateClassificationTypeRequest {
19
+ id: number;
20
+ name: string;
21
+ description: string | null;
22
+ }
23
+ export interface DeleteClassificationTypeRequest {
24
+ id: number;
25
+ }
26
+ export interface ClassificationTypesResponse {
27
+ dataResult: ClassificationType[];
28
+ statusResponse: {
29
+ code: number;
30
+ success: boolean;
31
+ message: string;
32
+ };
33
+ }
34
+ export interface ClassificationTypeResponse {
35
+ dataResult?: ClassificationType;
36
+ statusResponse: {
37
+ code: number;
38
+ success: boolean;
39
+ message: string;
40
+ };
41
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { ApiClient } from "../../../core/api-client";
2
+ import { LoginCredentials, LoginResponse, RefreshTokenRequest } from "./types";
3
+ export declare class AuthApi {
4
+ private apiClient;
5
+ constructor(apiClient: ApiClient);
6
+ /**
7
+ * Login con POST JSON (evita el modal del navegador).
8
+ * El servidor setea cookie HttpOnly (zero_token).
9
+ */
10
+ login(credentials: LoginCredentials): Promise<{
11
+ ok: boolean;
12
+ }>;
13
+ refreshToken(request?: RefreshTokenRequest): Promise<LoginResponse>;
14
+ logout(): Promise<void>;
15
+ isAuthenticated(): boolean;
16
+ setToken(token: string | null): void;
17
+ }
@@ -0,0 +1,63 @@
1
+ export class AuthApi {
2
+ constructor(apiClient) {
3
+ this.apiClient = apiClient;
4
+ }
5
+ /**
6
+ * Login con POST JSON (evita el modal del navegador).
7
+ * El servidor setea cookie HttpOnly (zero_token).
8
+ */
9
+ async login(credentials) {
10
+ try {
11
+ const response = await fetch(`${this.apiClient['baseUrl']}/auth/login`, {
12
+ method: 'POST',
13
+ headers: {
14
+ 'Content-Type': 'application/json',
15
+ 'X-Organization': this.apiClient['organization'] || 'default-org'
16
+ },
17
+ credentials: 'include', // ← Importante para cookies
18
+ body: JSON.stringify({
19
+ email: credentials.email,
20
+ password: credentials.password
21
+ })
22
+ });
23
+ if (!response.ok) {
24
+ if (response.status === 401) {
25
+ throw new Error('Invalid credentials');
26
+ }
27
+ throw new Error(`Login failed: ${response.status}`);
28
+ }
29
+ const data = await response.json();
30
+ // No guardar token en memoria, solo usar cookie
31
+ this.apiClient.setToken(null);
32
+ console.log('✅ Login exitoso, cookie establecida');
33
+ return { ok: true };
34
+ }
35
+ catch (error) {
36
+ console.error('❌ SDK Login error:', error);
37
+ throw error;
38
+ }
39
+ }
40
+ async refreshToken(request) {
41
+ const response = await this.apiClient.post("/auth/refresh", request);
42
+ if (response === null || response === void 0 ? void 0 : response.token)
43
+ this.apiClient.setToken(response.token);
44
+ return response;
45
+ }
46
+ async logout() {
47
+ try {
48
+ await this.apiClient.post("/auth/logout");
49
+ }
50
+ catch (error) {
51
+ console.error("Error during logout:", error);
52
+ }
53
+ finally {
54
+ this.apiClient.setToken(null);
55
+ }
56
+ }
57
+ isAuthenticated() {
58
+ return this.apiClient.getToken() !== null;
59
+ }
60
+ setToken(token) {
61
+ this.apiClient.setToken(token);
62
+ }
63
+ }
@@ -0,0 +1,18 @@
1
+ export interface LoginCredentials {
2
+ email: string;
3
+ password: string;
4
+ }
5
+ export interface LoginResponse {
6
+ token: string;
7
+ refreshToken?: string;
8
+ expiresIn: number;
9
+ user: {
10
+ id: string;
11
+ name: string;
12
+ email: string;
13
+ role: string;
14
+ };
15
+ }
16
+ export interface RefreshTokenRequest {
17
+ refreshToken: string;
18
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { ApiClient } from "../../../core/api-client";
2
+ export declare class MainApi {
3
+ private apiClient;
4
+ constructor(apiClient: ApiClient);
5
+ /**
6
+ * Get api status
7
+ *
8
+ * @returns true or false
9
+ */
10
+ status(): Promise<Boolean>;
11
+ }
@@ -0,0 +1,14 @@
1
+ export class MainApi {
2
+ constructor(apiClient) {
3
+ this.apiClient = apiClient;
4
+ }
5
+ /**
6
+ * Get api status
7
+ *
8
+ * @returns true or false
9
+ */
10
+ async status() {
11
+ const response = await this.apiClient.get("/status");
12
+ return response.message === "Ok" || false;
13
+ }
14
+ }
@@ -0,0 +1,3 @@
1
+ export interface StatusResponse {
2
+ message: String;
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import { ApiClient } from "../../../core/api-client";
2
+ import { GetTasksQueryParams, TasksResponse, NotFoundTaskResponse, StartTaskResponse, RemoveTaskResponse } from "./types";
3
+ export declare class NotificationsApi {
4
+ private apiClient;
5
+ constructor(apiClient: ApiClient);
6
+ getWithParams(query: GetTasksQueryParams): Promise<TasksResponse>;
7
+ /**
8
+ * Inicia un proceso de notificacion especificando su Id
9
+ */
10
+ startJob(taskId: string): Promise<NotFoundTaskResponse | StartTaskResponse>;
11
+ /**
12
+ * Elimina tareas especificando un limite y
13
+ * una cantidad de tiempo
14
+ */
15
+ deletedJobsByHours(limit: number, hours: number, status: string): Promise<RemoveTaskResponse>;
16
+ }
@@ -0,0 +1,26 @@
1
+ import { buildQueryParams } from "../../../utils/http";
2
+ export class NotificationsApi {
3
+ constructor(apiClient) {
4
+ this.apiClient = apiClient;
5
+ }
6
+ async getWithParams(query) {
7
+ const queryParams = buildQueryParams(query);
8
+ const tasks = await this.apiClient.get("/tasks" + queryParams, undefined, { useCache: false });
9
+ return tasks;
10
+ }
11
+ /**
12
+ * Inicia un proceso de notificacion especificando su Id
13
+ */
14
+ async startJob(taskId) {
15
+ const processResponse = await this.apiClient.post(`/tasks/${taskId}/process`, undefined);
16
+ return processResponse;
17
+ }
18
+ /**
19
+ * Elimina tareas especificando un limite y
20
+ * una cantidad de tiempo
21
+ */
22
+ async deletedJobsByHours(limit, hours, status) {
23
+ const processResponse = await this.apiClient.delete(`/tasks?hours=${hours}&limit=${limit}&status=${status}`, undefined);
24
+ return processResponse;
25
+ }
26
+ }
@@ -0,0 +1,53 @@
1
+ export interface Task {
2
+ id: string;
3
+ name: string;
4
+ description: string;
5
+ end_date: string;
6
+ number_period: string;
7
+ select_period: string;
8
+ actity_time: string;
9
+ notification_date: string;
10
+ userManager: string;
11
+ status: string;
12
+ created_by: string;
13
+ created_at: string;
14
+ updated_by: string;
15
+ updated_at: string;
16
+ start_date: string;
17
+ notification_type: string;
18
+ notification_type_id: string;
19
+ company_id: number;
20
+ metadata_request: {
21
+ id: string;
22
+ name: string;
23
+ };
24
+ request_id: number | null;
25
+ }
26
+ export interface TasksResponse {
27
+ data: Task[];
28
+ }
29
+ export interface GetTasksQueryParams {
30
+ status?: string;
31
+ notification_type?: string;
32
+ from_date?: string;
33
+ to_date?: string;
34
+ upcoming?: string;
35
+ page?: string;
36
+ limit?: string;
37
+ }
38
+ export interface StartTaskResponse {
39
+ success: boolean;
40
+ message: string;
41
+ jobId: string;
42
+ taskId: string;
43
+ taskName: string;
44
+ status: string;
45
+ }
46
+ export interface NotFoundTaskResponse {
47
+ statusCode: number;
48
+ error: string;
49
+ message: string;
50
+ }
51
+ export interface RemoveTaskResponse {
52
+ count: number;
53
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,64 @@
1
+ export interface User {
2
+ id: string;
3
+ email: string;
4
+ full_name: string;
5
+ role_id: number;
6
+ is_deleted: boolean;
7
+ deleted_at: string | null;
8
+ is_active: boolean;
9
+ created_at: string;
10
+ updated_at: string;
11
+ phone: string | null;
12
+ area: string | null;
13
+ area_id: number | null;
14
+ organization_id: number;
15
+ }
16
+ export interface UsersResponse {
17
+ data: User[];
18
+ meta: {
19
+ total: number;
20
+ page: number;
21
+ limit: number;
22
+ pages: number;
23
+ };
24
+ }
25
+ export interface UsersQuery {
26
+ page?: number;
27
+ limit?: number;
28
+ email?: string;
29
+ full_name?: string;
30
+ phone?: string;
31
+ area?: string;
32
+ role_id?: number;
33
+ area_id?: number;
34
+ showDeleted?: boolean;
35
+ }
36
+ export interface UserCreate {
37
+ id?: string;
38
+ email: string;
39
+ password?: string;
40
+ full_name: string;
41
+ phone?: string;
42
+ area?: string;
43
+ area_id?: number;
44
+ role_id?: number;
45
+ organization_id?: number;
46
+ }
47
+ export interface UserUpdate {
48
+ password?: string;
49
+ email?: string;
50
+ full_name?: string;
51
+ phone?: string;
52
+ area?: string;
53
+ area_id?: number;
54
+ role_id?: number;
55
+ }
56
+ export interface ApiResponse<T> {
57
+ statusCode: number;
58
+ message: string;
59
+ data?: T;
60
+ }
61
+ export type UserCreatedResponse = ApiResponse<User>;
62
+ export type UserUpdatedResponse = ApiResponse<User>;
63
+ export type UserDeletedResponse = ApiResponse<undefined>;
64
+ export type UserDeactivatedResponse = ApiResponse<User>;
@@ -0,0 +1 @@
1
+ export {};