@atlantjs/backend 7.0.2 → 7.0.4

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.
@@ -1,2 +0,0 @@
1
- import { ValidationOptions } from "class-validator";
2
- export declare function IsTimeString(validationOptions?: ValidationOptions): (object: Object, propertyName: string) => void;
@@ -1,39 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.IsTimeString = IsTimeString;
10
- const class_validator_1 = require("class-validator");
11
- function isValidTimeFormat(value) {
12
- const regex = /^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/;
13
- return regex.test(value);
14
- }
15
- let IsTimeStringConstraint = class IsTimeStringConstraint {
16
- validate(value, _args) {
17
- if (typeof value !== "string") {
18
- return false;
19
- }
20
- return isValidTimeFormat(value);
21
- }
22
- defaultMessage(_args) {
23
- return "Invalid time format. Please provide time in 'HH:mm' format.";
24
- }
25
- };
26
- IsTimeStringConstraint = __decorate([
27
- (0, class_validator_1.ValidatorConstraint)({ name: "isTimeString", async: false })
28
- ], IsTimeStringConstraint);
29
- function IsTimeString(validationOptions) {
30
- return (object, propertyName) => {
31
- (0, class_validator_1.registerDecorator)({
32
- target: object.constructor,
33
- propertyName,
34
- options: validationOptions,
35
- constraints: [],
36
- validator: IsTimeStringConstraint,
37
- });
38
- };
39
- }