@carlosdiazz/lottodiz-shared 5.1.0 → 5.1.2

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.
@@ -148,13 +148,6 @@ export declare class MethodValid {
148
148
  static PAGE_WEBSCRAPING_FIND_ALL: string;
149
149
  static PAGE_WEBSCRAPING_UPDATE: string;
150
150
  static PAGE_WEBSCRAPING_REMOVE: string;
151
- static VERIFY_STATUS_LOTTERY: string;
152
- static VERIFY_STATUS_GATEWAY: string;
153
- static VERIFY_STATUS_CRON: string;
154
- static VERIFY_STATUS_WEBSCRAPING: string;
155
- static VERIFY_STATUS_TOOLS: string;
156
- static VERIFY_STATUS_AUTH: string;
157
- static VERIFY_STATUS_SALE: string;
158
151
  static COMPANY_CREATE: string;
159
152
  static COMPANY_FIND_ONE: string;
160
153
  static COMPANY_FIND_ALL: string;
@@ -177,13 +177,6 @@ MethodValid.PAGE_WEBSCRAPING_FIND_ONE = "PAGE_WEBSCRAPING_FIND_ONE";
177
177
  MethodValid.PAGE_WEBSCRAPING_FIND_ALL = "PAGE_WEBSCRAPING_FIND_ALL";
178
178
  MethodValid.PAGE_WEBSCRAPING_UPDATE = "PAGE_WEBSCRAPING_UPDATE";
179
179
  MethodValid.PAGE_WEBSCRAPING_REMOVE = "PAGE_WEBSCRAPING_REMOVE";
180
- MethodValid.VERIFY_STATUS_LOTTERY = "VERIFY_STATUS_LOTTERY";
181
- MethodValid.VERIFY_STATUS_GATEWAY = "VERIFY_STATUS_GATEWAY";
182
- MethodValid.VERIFY_STATUS_CRON = "VERIFY_STATUS_CRON";
183
- MethodValid.VERIFY_STATUS_WEBSCRAPING = "VERIFY_STATUS_WEBSCRAPING";
184
- MethodValid.VERIFY_STATUS_TOOLS = "VERIFY_STATUS_TOOLS";
185
- MethodValid.VERIFY_STATUS_AUTH = "VERIFY_STATUS_AUTH";
186
- MethodValid.VERIFY_STATUS_SALE = "VERIFY_STATUS_SALE";
187
180
  //COMPANY
188
181
  MethodValid.COMPANY_CREATE = "COMPANY_CREATE";
189
182
  MethodValid.COMPANY_FIND_ONE = "COMPANY_FIND_ONE";
@@ -10,5 +10,4 @@ export interface CompanyControllerInterface {
10
10
  findOne(id: string): Promise<CompanyInterface>;
11
11
  update(dto: UpdateCompanyInterface): Promise<CompanyInterface>;
12
12
  remove(id: string): Promise<ResponseInterface>;
13
- verify_status_sale(): Promise<ResponseInterface>;
14
13
  }
@@ -10,5 +10,4 @@ export interface CompanyServiceInterface {
10
10
  findOne(id: string): Promise<CompanyInterface>;
11
11
  update(dto: UpdateCompanyInterface): Promise<CompanyInterface>;
12
12
  remove(id: string): Promise<ResponseInterface>;
13
- verify_status_sale(): Promise<ResponseInterface>;
14
13
  }
@@ -10,5 +10,4 @@ export interface CountryControllerInterface {
10
10
  findOne(id: string): Promise<CountryInterface>;
11
11
  update(dto: UpdateCountryInterface): Promise<CountryInterface>;
12
12
  remove(id: string): Promise<ResponseInterface>;
13
- verify_status_lottery(): Promise<ResponseInterface>;
14
13
  }
@@ -11,5 +11,4 @@ export interface CountryServiceInterface {
11
11
  findOne(id: string): Promise<CountryInterface>;
12
12
  update(dto: UpdateCountryInterface): Promise<CountryInterface>;
13
13
  remove(id: string): Promise<ResponseInterface>;
14
- verify_status_lottery(): Promise<ResponseInterface>;
15
14
  }
@@ -1,7 +1,5 @@
1
- import { ResponseInterface } from "../common";
2
1
  import { DrawResultInterface } from "../draw_result";
3
2
  import { CreateDrawWebscrapingAutomaticInterface } from "../draw_webscraping/create-draw_webscraping.base";
4
3
  export interface DrawWebscrapingAutomaticControllerInterface {
5
4
  exectDrawWebscrapingAutomatic(createDrawWebscrapingAutomatic: CreateDrawWebscrapingAutomaticInterface): Promise<DrawResultInterface>;
6
- verify_status_webscraping(): Promise<ResponseInterface>;
7
5
  }
@@ -1,7 +1,5 @@
1
- import { ResponseInterface } from "../common";
2
1
  import { DrawResultInterface } from "../draw_result";
3
2
  import { CreateDrawWebscrapingAutomaticInterface } from "../draw_webscraping/create-draw_webscraping.base";
4
3
  export interface DrawWebscrapingAutomaticServiceInterface {
5
4
  exectDrawWebscrapingAutomatic(createDrawWebscrapingAutomatic: CreateDrawWebscrapingAutomaticInterface): Promise<DrawResultInterface>;
6
- verify_status_webscraping(): Promise<ResponseInterface>;
7
5
  }
@@ -10,5 +10,4 @@ export interface PlatformControllerInterface {
10
10
  update(dto: UpdatePlatformInterface): Promise<PlatformInterface>;
11
11
  remove(id: string): Promise<ResponseInterface>;
12
12
  findOneByTopic(topic: string): Promise<PlatformInterface>;
13
- verify_status_tools(): Promise<ResponseInterface>;
14
13
  }
@@ -11,5 +11,4 @@ export interface PlatformServiceInterface {
11
11
  update(dto: UpdatePlatformInterface): Promise<PlatformInterface>;
12
12
  remove(id: string): Promise<ResponseInterface>;
13
13
  findOneByTopic(topic: string): Promise<PlatformInterface>;
14
- verify_status_tools(): Promise<ResponseInterface>;
15
14
  }
@@ -8,6 +8,5 @@ export interface QueueControllerInterface {
8
8
  createJobsDrawWebScraping(drawWebscraping: DrawWebscrapingInterface): Promise<ResponseInterface>;
9
9
  createJobsVideoTemplateDraw(template_draw: TemplateDrawInterface): Promise<ResponseInterface>;
10
10
  createJobsConfigObs(dto: CreateJobsObsDtoInterface): Promise<ResponseInterface>;
11
- verify_status_cron(): Promise<ResponseInterface>;
12
11
  createJobRemoveTemporaryCode(id: string): Promise<ResponseInterface>;
13
12
  }
@@ -7,7 +7,6 @@ export interface QueueServiceInterface {
7
7
  createJobsDraw(draw: DrawInterface): Promise<ResponseInterface>;
8
8
  createJobsDrawWebScraping(drawWebscraping: DrawWebscrapingInterface): Promise<ResponseInterface>;
9
9
  createJobsVideoTemplateDraw(template_draw: TemplateDrawInterface): Promise<ResponseInterface>;
10
- verify_status_cron(): Promise<ResponseInterface>;
11
10
  createJobsConfigObs(dto: CreateJobsObsDtoInterface): Promise<ResponseInterface>;
12
11
  createJobRemoveTemporaryCode(id: string): Promise<ResponseInterface>;
13
12
  }
@@ -9,5 +9,4 @@ export interface RoleControllerInterface {
9
9
  findOne(id: string): Promise<RoleInterface>;
10
10
  update(dto: UpdateRoleInterface): Promise<RoleInterface>;
11
11
  remove(id: string): Promise<ResponseInterface>;
12
- verify_status_auth(): Promise<ResponseInterface>;
13
12
  }
@@ -9,5 +9,4 @@ export interface RoleServiceInterface {
9
9
  findOne(id: string): Promise<RoleInterface>;
10
10
  update(dto: UpdateRoleInterface): Promise<RoleInterface>;
11
11
  remove(id: string): Promise<ResponseInterface>;
12
- verify_status_auth(): Promise<ResponseInterface>;
13
12
  }
@@ -1,5 +1,5 @@
1
1
  export interface CreateTemplateDrawWebscrapingInterface {
2
- name: string;
2
+ name?: string;
3
3
  active?: boolean;
4
4
  number_of_attempts?: number;
5
5
  delay?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carlosdiazz/lottodiz-shared",
3
- "version": "5.1.0",
3
+ "version": "5.1.2",
4
4
  "description": "Shared Dtos, models, constants and utils",
5
5
  "main": "dist/index.js",
6
6
  "private": false,
@@ -9,7 +9,7 @@
9
9
  "dist"
10
10
  ],
11
11
  "scripts": {
12
- "build": "tsc",
12
+ "build": "rm -rf dist && tsc",
13
13
  "prepare": "npm run build"
14
14
  },
15
15
  "license": "MIT",
@@ -1,10 +0,0 @@
1
- import * as joi from "joi";
2
- /**
3
- * Convierte una hora entre zonas horarias con soporte DST y límites entre 00:00:00 y 23:59:00
4
- * @param time - Hora base en formato "HH:mm:ss"
5
- * @param timeZone - Zona horaria original (ej: "America/Santo_Domingo")
6
- * @param timeZoneChange - Zona horaria destino (ej: "America/New_York")
7
- * @returns Nueva hora en formato "HH:mm:ss"
8
- */
9
- export declare function convertTimeZone(time: string, timeZone: string, timeZoneChange: string): string;
10
- export declare const timeZoneValidator: joi.CustomValidator<string>;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.timeZoneValidator = void 0;
4
- exports.convertTimeZone = convertTimeZone;
5
- const luxon_1 = require("luxon");
6
- /**
7
- * Convierte una hora entre zonas horarias con soporte DST y límites entre 00:00:00 y 23:59:00
8
- * @param time - Hora base en formato "HH:mm:ss"
9
- * @param timeZone - Zona horaria original (ej: "America/Santo_Domingo")
10
- * @param timeZoneChange - Zona horaria destino (ej: "America/New_York")
11
- * @returns Nueva hora en formato "HH:mm:ss"
12
- */
13
- function convertTimeZone(time, timeZone, timeZoneChange) {
14
- // Si las zonas son iguales, retornamos la misma hora
15
- if (timeZone === timeZoneChange)
16
- return time;
17
- // Parseamos la hora base
18
- const [hours, minutes, seconds] = time.split(":").map(Number);
19
- // Fecha base (hoy)
20
- const base = luxon_1.DateTime.now()
21
- .setZone(timeZone)
22
- .set({ hour: hours, minute: minutes, second: seconds, millisecond: 0 });
23
- // Convertimos a la nueva zona horaria
24
- const converted = base.setZone(timeZoneChange);
25
- // Si el cambio de zona altera el día (por ejemplo pasa de 23:30 a 00:30 del día siguiente)
26
- // entonces ajustamos a los límites
27
- if (converted.day > base.day) {
28
- // Se pasó al día siguiente → límite superior
29
- return "23:59:00";
30
- }
31
- if (converted.day < base.day) {
32
- // Retrocedió al día anterior → límite inferior
33
- return "00:00:00";
34
- }
35
- // Si el día no cambió, devolvemos la hora real convertida
36
- const hh = converted.hour;
37
- const mm = converted.minute;
38
- const ss = converted.second;
39
- const pad = (n) => n.toString().padStart(2, "0");
40
- return `${pad(hh)}:${pad(mm)}:${pad(ss)}`;
41
- }
42
- const timeZoneValidator = (value, helpers) => {
43
- const valid = luxon_1.DateTime.local().setZone(value).isValid;
44
- if (!valid) {
45
- return helpers.error("any.invalid", { value });
46
- }
47
- return value;
48
- };
49
- exports.timeZoneValidator = timeZoneValidator;
@@ -1 +0,0 @@
1
- export declare function diffMinutesFromDates(baseDate: Date, timeString: string): number;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.diffMinutesFromDates = diffMinutesFromDates;
7
- const dayjs_1 = __importDefault(require("dayjs"));
8
- function diffMinutesFromDates(baseDate, timeString) {
9
- // Tomamos el día REAL exacto sin que la zona cambie
10
- const year = baseDate.getUTCFullYear();
11
- const month = String(baseDate.getUTCMonth() + 1).padStart(2, "0");
12
- const day = String(baseDate.getUTCDate()).padStart(2, "0");
13
- // Construimos la fecha base REAL
14
- const baseDateOnly = `${year}-${month}-${day}`;
15
- // Crear date1 = fecha base + hora
16
- const date1 = (0, dayjs_1.default)(`${baseDateOnly} ${timeString}`, "YYYY-MM-DD HH:mm:ss");
17
- // Fecha actual local
18
- const date2 = (0, dayjs_1.default)();
19
- return date2.diff(date1, "minute");
20
- }
@@ -1,2 +0,0 @@
1
- export declare const getDelayFromDateTime: (date: Date, time: string) => number;
2
- export declare const getDelayFromDateStringTime: (date: string, time: string) => number;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getDelayFromDateStringTime = exports.getDelayFromDateTime = void 0;
7
- const dayjs_1 = __importDefault(require("dayjs"));
8
- const utc_1 = __importDefault(require("dayjs/plugin/utc"));
9
- const convert_date_to_string_1 = require("./convert-date-to-string");
10
- dayjs_1.default.extend(utc_1.default);
11
- const getDelayFromDateTime = (date, time) => {
12
- const new_date = (0, convert_date_to_string_1.convertDateToString)(date);
13
- const dateTime = `${new_date} ${time}`;
14
- const target = (0, dayjs_1.default)(dateTime);
15
- if (!target.isValid()) {
16
- throw new Error(`Invalid date or time: "${dateTime}"`);
17
- }
18
- const now = (0, dayjs_1.default)();
19
- const diff = target.diff(now);
20
- return diff > 0 ? diff : 0;
21
- };
22
- exports.getDelayFromDateTime = getDelayFromDateTime;
23
- const getDelayFromDateStringTime = (date, time) => {
24
- const dateTime = `${date} ${time}`;
25
- const target = (0, dayjs_1.default)(dateTime);
26
- if (!target.isValid()) {
27
- throw new Error(`Invalid date or time: "${dateTime}"`);
28
- }
29
- const now = (0, dayjs_1.default)();
30
- const diff = target.diff(now);
31
- return diff > 0 ? diff : 0;
32
- };
33
- exports.getDelayFromDateStringTime = getDelayFromDateStringTime;
@@ -1 +0,0 @@
1
- export declare const getDelayFromTime: (time: string) => number;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getDelayFromTime = void 0;
7
- const dayjs_1 = __importDefault(require("dayjs"));
8
- const getDelayFromTime = (time) => {
9
- const timeRegex = /^([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d))?$/;
10
- if (!timeRegex.test(time)) {
11
- throw new Error(`Invalid time: "${time}". Must be in HH:mm or HH:mm:ss format (00:00:00–23:59:59).`);
12
- }
13
- const now = (0, dayjs_1.default)();
14
- const target = (0, dayjs_1.default)(`${now.format("YYYY-MM-DD")} ${time}`);
15
- const diff = target.diff(now);
16
- return diff > 0 ? diff : 0;
17
- };
18
- exports.getDelayFromTime = getDelayFromTime;