@openbox/shared-types 0.1.47 → 0.1.48

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,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IManyServicesResponse = exports.GetServicesResponse = void 0;
4
+ const services_1 = require("./services");
5
+ Object.defineProperty(exports, "GetServicesResponse", { enumerable: true, get: function () { return services_1.GetServicesResponse; } });
6
+ Object.defineProperty(exports, "IManyServicesResponse", { enumerable: true, get: function () { return services_1.IManyServicesResponse; } });
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAImB;AAEU,oGAJ3B,8BAAmB,OAI2B;AAAE,sGAHhD,gCAAqB,OAGgD"}
@@ -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,16 @@
1
+ import { IFilter, IResponse } from '../interfaces';
2
+ export declare class IManyServicesResponse {
3
+ id: string;
4
+ name: string;
5
+ }
6
+ export declare class GetServicesResponse implements IResponse {
7
+ data: IManyServicesResponse[];
8
+ count: number;
9
+ page: number;
10
+ limit: number;
11
+ }
12
+ export interface GetServicesRequest extends IFilter {
13
+ types?: number[];
14
+ fromAmount?: number;
15
+ toAmount?: number;
16
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetServicesResponse = exports.IManyServicesResponse = void 0;
4
+ class IManyServicesResponse {
5
+ }
6
+ exports.IManyServicesResponse = IManyServicesResponse;
7
+ class GetServicesResponse {
8
+ }
9
+ exports.GetServicesResponse = GetServicesResponse;
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;AAEA,MAAa,qBAAqB;CAGjC;AAHD,sDAGC;AAED,MAAa,mBAAmB;CAK/B;AALD,kDAKC"}
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.48",
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
- "build": "tsc",
10
+ "prebuild": "rimraf lib",
11
+ "build": "npm run prebuild && 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",
@@ -1,23 +1,14 @@
1
- import { ApiProperty } from '@nestjs/swagger'
2
- import { Expose } from 'class-transformer'
3
1
  import { IFilter, IResponse } from '../interfaces'
4
2
 
5
3
  export class IManyServicesResponse {
6
- @Expose() id: string
7
- @Expose() name: string
4
+ id: string
5
+ name: string
8
6
  }
9
7
 
10
8
  export class GetServicesResponse implements IResponse {
11
- @ApiProperty({ type: [IManyServicesResponse] })
12
9
  data: IManyServicesResponse[]
13
-
14
- @ApiProperty({ type: Number })
15
10
  count: number
16
-
17
- @ApiProperty({ type: Number, default: 1 })
18
11
  page: number
19
-
20
- @ApiProperty({ type: Number, default: 10 })
21
12
  limit: number
22
13
  }
23
14