@alba-cars/common-modules 1.10.35 → 1.10.36

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,32 @@
1
+ import { ValidatorConstraintInterface, ValidationArguments } from "class-validator";
2
+ export declare class IsPhoneConstraint implements ValidatorConstraintInterface {
3
+ validate(phone: string, args: ValidationArguments): boolean;
4
+ defaultMessage(args: ValidationArguments): string;
5
+ }
6
+ export declare class CallbackRequestCreateDTO {
7
+ name: string;
8
+ phone: string;
9
+ enquiryText: string;
10
+ validate(): string[];
11
+ static fromPlain(plain: Record<string, unknown>): CallbackRequestCreateDTO;
12
+ toPlain(): Record<string, unknown>;
13
+ }
14
+ export declare class CallbackRequestUpdateDTO {
15
+ name?: string;
16
+ phone?: string;
17
+ enquiryText?: string;
18
+ validate(): string[];
19
+ static fromPlain(plain: Record<string, unknown>): CallbackRequestUpdateDTO;
20
+ toPlain(): Record<string, unknown>;
21
+ }
22
+ export declare class CallbackRequestResponseDTO {
23
+ id: string;
24
+ name: string;
25
+ phone: string;
26
+ enquiryText: string;
27
+ createdAt: Date;
28
+ updatedAt: Date;
29
+ validate(): string[];
30
+ static fromPlain(plain: Record<string, unknown>): CallbackRequestResponseDTO;
31
+ toPlain(): Record<string, unknown>;
32
+ }
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CallbackRequestResponseDTO = exports.CallbackRequestUpdateDTO = exports.CallbackRequestCreateDTO = exports.IsPhoneConstraint = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const class_transformer_1 = require("class-transformer");
15
+ let IsPhoneConstraint = class IsPhoneConstraint {
16
+ validate(phone, args) {
17
+ return /^\+?[\d\s-]{8,}$/.test(phone);
18
+ }
19
+ defaultMessage(args) {
20
+ return "Phone number ($value) is not in a valid format";
21
+ }
22
+ };
23
+ IsPhoneConstraint = __decorate([
24
+ (0, class_validator_1.ValidatorConstraint)({ name: "isPhone", async: false })
25
+ ], IsPhoneConstraint);
26
+ exports.IsPhoneConstraint = IsPhoneConstraint;
27
+ class CallbackRequestCreateDTO {
28
+ validate() {
29
+ const errors = (0, class_validator_1.validateSync)(this);
30
+ return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
31
+ }
32
+ static fromPlain(plain) {
33
+ return (0, class_transformer_1.plainToClass)(CallbackRequestCreateDTO, plain);
34
+ }
35
+ toPlain() {
36
+ return (0, class_transformer_1.classToPlain)(this);
37
+ }
38
+ }
39
+ __decorate([
40
+ (0, class_validator_1.IsString)(),
41
+ __metadata("design:type", String)
42
+ ], CallbackRequestCreateDTO.prototype, "name", void 0);
43
+ __decorate([
44
+ (0, class_validator_1.IsString)(),
45
+ (0, class_validator_1.Validate)(IsPhoneConstraint),
46
+ __metadata("design:type", String)
47
+ ], CallbackRequestCreateDTO.prototype, "phone", void 0);
48
+ __decorate([
49
+ (0, class_validator_1.IsString)(),
50
+ __metadata("design:type", String)
51
+ ], CallbackRequestCreateDTO.prototype, "enquiryText", void 0);
52
+ exports.CallbackRequestCreateDTO = CallbackRequestCreateDTO;
53
+ class CallbackRequestUpdateDTO {
54
+ validate() {
55
+ const errors = (0, class_validator_1.validateSync)(this);
56
+ return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
57
+ }
58
+ static fromPlain(plain) {
59
+ return (0, class_transformer_1.plainToClass)(CallbackRequestUpdateDTO, plain);
60
+ }
61
+ toPlain() {
62
+ return (0, class_transformer_1.classToPlain)(this);
63
+ }
64
+ }
65
+ __decorate([
66
+ (0, class_validator_1.IsOptional)(),
67
+ (0, class_validator_1.IsString)(),
68
+ __metadata("design:type", String)
69
+ ], CallbackRequestUpdateDTO.prototype, "name", void 0);
70
+ __decorate([
71
+ (0, class_validator_1.IsOptional)(),
72
+ (0, class_validator_1.IsString)(),
73
+ (0, class_validator_1.Validate)(IsPhoneConstraint),
74
+ __metadata("design:type", String)
75
+ ], CallbackRequestUpdateDTO.prototype, "phone", void 0);
76
+ __decorate([
77
+ (0, class_validator_1.IsOptional)(),
78
+ (0, class_validator_1.IsString)(),
79
+ __metadata("design:type", String)
80
+ ], CallbackRequestUpdateDTO.prototype, "enquiryText", void 0);
81
+ exports.CallbackRequestUpdateDTO = CallbackRequestUpdateDTO;
82
+ class CallbackRequestResponseDTO {
83
+ validate() {
84
+ const errors = (0, class_validator_1.validateSync)(this);
85
+ return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
86
+ }
87
+ static fromPlain(plain) {
88
+ return (0, class_transformer_1.plainToClass)(CallbackRequestResponseDTO, plain);
89
+ }
90
+ toPlain() {
91
+ return (0, class_transformer_1.classToPlain)(this);
92
+ }
93
+ }
94
+ __decorate([
95
+ (0, class_validator_1.IsString)(),
96
+ __metadata("design:type", String)
97
+ ], CallbackRequestResponseDTO.prototype, "id", void 0);
98
+ __decorate([
99
+ (0, class_validator_1.IsString)(),
100
+ __metadata("design:type", String)
101
+ ], CallbackRequestResponseDTO.prototype, "name", void 0);
102
+ __decorate([
103
+ (0, class_validator_1.IsString)(),
104
+ __metadata("design:type", String)
105
+ ], CallbackRequestResponseDTO.prototype, "phone", void 0);
106
+ __decorate([
107
+ (0, class_validator_1.IsString)(),
108
+ __metadata("design:type", String)
109
+ ], CallbackRequestResponseDTO.prototype, "enquiryText", void 0);
110
+ exports.CallbackRequestResponseDTO = CallbackRequestResponseDTO;
@@ -0,0 +1 @@
1
+ export * from "./data/dto/CallBackRequestDTO";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./data/dto/CallBackRequestDTO"), exports);
@@ -14,3 +14,4 @@ export * from "./lead";
14
14
  export * from "./faq/";
15
15
  export * from "./tickets";
16
16
  export * from "./models";
17
+ export * from "./callback-request";
@@ -30,3 +30,4 @@ __exportStar(require("./lead"), exports);
30
30
  __exportStar(require("./faq/"), exports);
31
31
  __exportStar(require("./tickets"), exports);
32
32
  __exportStar(require("./models"), exports);
33
+ __exportStar(require("./callback-request"), exports);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.10.35",
6
+ "version": "1.10.36",
7
7
  "description": "A package containing DTOs, validation classes and common modules and interfaces for Alba Cars",
8
8
  "main": "dist/index.js",
9
9
  "types": "dist/index.d.ts",