@openbox/shared-types 0.1.47 → 0.1.49

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.
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { GetServicesRequest, GetServicesResponse, IManyServicesResponse } from './services';
2
+ export { GetServicesRequest, GetServicesResponse, IManyServicesResponse };
package/lib/index.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ export interface IFilter {
2
+ limit?: number;
3
+ page?: number;
4
+ search?: string;
5
+ prop?: string;
6
+ order?: string;
7
+ active?: boolean;
8
+ }
9
+ export interface IResponse {
10
+ id?: string | number;
11
+ data?: Record<string, any> | Record<string, any>[];
12
+ message?: string;
13
+ count?: number;
14
+ page?: number;
15
+ limit?: number;
16
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { IFilter } from '../../interfaces';
2
+ export interface GetServicesRequest extends IFilter {
3
+ types?: number[];
4
+ fromAmount?: number;
5
+ toAmount?: number;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Request.js","sourceRoot":"","sources":["../../../src/services/GetMany/Request.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { IResponse } from '../../interfaces';
2
+ export interface IManyServicesResponse {
3
+ id: string;
4
+ name: string;
5
+ }
6
+ export interface GetServicesResponse extends IResponse {
7
+ data: IManyServicesResponse[];
8
+ count: number;
9
+ page: number;
10
+ limit: number;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Response.js","sourceRoot":"","sources":["../../../src/services/GetMany/Response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { GetServicesRequest } from './GetMany/Request';
2
+ import { GetServicesResponse, IManyServicesResponse } from './GetMany/Response';
3
+ export { GetServicesRequest, GetServicesResponse, IManyServicesResponse };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":""}
package/lib/tools.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function validationMessage(fieldname: string, type: string): string;
package/lib/tools.js ADDED
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validationMessage = void 0;
4
+ function validationMessage(fieldname, type) {
5
+ switch (type) {
6
+ case 'IsBoolean':
7
+ return `El campo '${fieldname}' debe ser del valor true o false`;
8
+ case 'IsInt':
9
+ return `El campo '${fieldname}' debe ser un numero entero.`;
10
+ case 'IsNotEmpty':
11
+ return `El campo '${fieldname}' es requerido.`;
12
+ case 'IsString':
13
+ return `El campo '${fieldname}' debe ser del tipo texto.`;
14
+ case 'IsISO8601':
15
+ return `El campo '${fieldname}' debe ser una fecha en el formato yyyy-MM-dd.`;
16
+ case 'IsUUID':
17
+ return `El campo '${fieldname}' debe ser del tipo uuid.`;
18
+ case 'IsNumber':
19
+ return `El campo '${fieldname}' debe ser un numero y debe contener dos decimales.`;
20
+ case 'IsArray':
21
+ return `El campo '${fieldname}' debe ser de tipo arreglo.`;
22
+ case 'ArrayNotEmpty':
23
+ return `El arreglo '${fieldname}' debe contener minimo un elemento.`;
24
+ case 'status':
25
+ return `La venta no puede ser ${fieldname} porque tiene un estado que no lo permite.`;
26
+ case 'IsDecimal':
27
+ return `El campo '${fieldname}' debe ser un numero y debe contener dos decimales.`;
28
+ case 'IsEnum':
29
+ return `El campo '${fieldname}' debe ser 'automatic' o 'manual'.`;
30
+ case 'IsEmail':
31
+ return `El campo '${fieldname}' debe tener un formato de correo correcto.`;
32
+ case 'IsNumberArray':
33
+ return `El campo '${fieldname}' debe ser un arreglo de numeros.`;
34
+ default:
35
+ return 'Validación inválida';
36
+ }
37
+ }
38
+ exports.validationMessage = validationMessage;
39
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":";;;AAAA,SAAgB,iBAAiB,CAAC,SAAiB,EAAE,IAAY;IAC/D,QAAQ,IAAI,EAAE;QACZ,KAAK,WAAW;YACd,OAAO,aAAa,SAAS,mCAAmC,CAAA;QAClE,KAAK,OAAO;YACV,OAAO,aAAa,SAAS,8BAA8B,CAAA;QAC7D,KAAK,YAAY;YACf,OAAO,aAAa,SAAS,iBAAiB,CAAA;QAChD,KAAK,UAAU;YACb,OAAO,aAAa,SAAS,4BAA4B,CAAA;QAC3D,KAAK,WAAW;YACd,OAAO,aAAa,SAAS,gDAAgD,CAAA;QAC/E,KAAK,QAAQ;YACX,OAAO,aAAa,SAAS,2BAA2B,CAAA;QAC1D,KAAK,UAAU;YACb,OAAO,aAAa,SAAS,qDAAqD,CAAA;QACpF,KAAK,SAAS;YACZ,OAAO,aAAa,SAAS,6BAA6B,CAAA;QAC5D,KAAK,eAAe;YAClB,OAAO,eAAe,SAAS,qCAAqC,CAAA;QACtE,KAAK,QAAQ;YACX,OAAO,yBAAyB,SAAS,4CAA4C,CAAA;QACvF,KAAK,WAAW;YACd,OAAO,aAAa,SAAS,qDAAqD,CAAA;QACpF,KAAK,QAAQ;YACX,OAAO,aAAa,SAAS,oCAAoC,CAAA;QACnE,KAAK,SAAS;YACZ,OAAO,aAAa,SAAS,6CAA6C,CAAA;QAC5E,KAAK,eAAe;YAClB,OAAO,aAAa,SAAS,mCAAmC,CAAA;QAClE;YACE,OAAO,qBAAqB,CAAA;KAC/B;AACH,CAAC;AAjCD,8CAiCC"}
package/package.json CHANGED
@@ -1,21 +1,17 @@
1
1
  {
2
2
  "name": "@openbox/shared-types",
3
- "version": "0.1.47",
3
+ "version": "0.1.49",
4
4
  "description": "Shared Types for Openbox Cloud. ",
5
- "types": "src/index.ts",
6
- "main": "src/index.ts",
5
+ "types": "lib/index.d.js",
6
+ "main": "lib/index.js",
7
7
  "author": "Openbox Development Team",
8
8
  "license": "ISC",
9
9
  "scripts": {
10
+ "prebuild": "rimraf lib",
10
11
  "build": "tsc",
11
12
  "lint": "eslint --ext .ts,.tsx --ignore-path .gitignore .",
12
- "lint:fix": "npm run lint -- --fix"
13
- },
14
- "dependencies": {
15
- "@nestjs/common": "^9.2.1",
16
- "@nestjs/swagger": "^6.1.4",
17
- "class-transformer": "^0.5.1",
18
- "class-validator": "^0.14.0"
13
+ "lint:fix": "npm run lint -- --fix",
14
+ "publish": "npm run build && npm publish"
19
15
  },
20
16
  "devDependencies": {
21
17
  "@typescript-eslint/eslint-plugin": "^5.46.1",
@@ -0,0 +1,7 @@
1
+ import { IFilter } from '../../interfaces'
2
+
3
+ export interface GetServicesRequest extends IFilter {
4
+ types?: number[]
5
+ fromAmount?: number
6
+ toAmount?: number
7
+ }
@@ -0,0 +1,13 @@
1
+ import { IResponse } from '../../interfaces'
2
+
3
+ export interface IManyServicesResponse {
4
+ id: string
5
+ name: string
6
+ }
7
+
8
+ export interface GetServicesResponse extends IResponse {
9
+ data: IManyServicesResponse[]
10
+ count: number
11
+ page: number
12
+ limit: number
13
+ }
@@ -1,28 +1,4 @@
1
- import { ApiProperty } from '@nestjs/swagger'
2
- import { Expose } from 'class-transformer'
3
- import { IFilter, IResponse } from '../interfaces'
1
+ import { GetServicesRequest } from './GetMany/Request'
2
+ import { GetServicesResponse, IManyServicesResponse } from './GetMany/Response'
4
3
 
5
- export class IManyServicesResponse {
6
- @Expose() id: string
7
- @Expose() name: string
8
- }
9
-
10
- export class GetServicesResponse implements IResponse {
11
- @ApiProperty({ type: [IManyServicesResponse] })
12
- data: IManyServicesResponse[]
13
-
14
- @ApiProperty({ type: Number })
15
- count: number
16
-
17
- @ApiProperty({ type: Number, default: 1 })
18
- page: number
19
-
20
- @ApiProperty({ type: Number, default: 10 })
21
- limit: number
22
- }
23
-
24
- export interface GetServicesRequest extends IFilter {
25
- types?: number[]
26
- fromAmount?: number
27
- toAmount?: number
28
- }
4
+ export { GetServicesRequest, GetServicesResponse, IManyServicesResponse }