waltronics-types 1.0.13 → 1.0.15
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/dist/Appointment.d.ts +6 -5
- package/dist/AppointmentsTable.d.ts +27 -0
- package/dist/AppointmentsTable.js +2 -0
- package/dist/Diagnosis.d.ts +2 -1
- package/dist/Employee.d.ts +4 -3
- package/dist/Event.d.ts +7 -6
- package/dist/Information.d.ts +6 -5
- package/dist/Label.d.ts +5 -7
- package/dist/Note.d.ts +18 -17
- package/dist/Part.d.ts +2 -1
- package/dist/Payment.d.ts +3 -2
- package/dist/ProtectedAppointment.d.ts +3 -2
- package/dist/Repair.d.ts +2 -1
- package/dist/Service.d.ts +4 -3
- package/dist/ShortenedAppointments.d.ts +27 -0
- package/dist/ShortenedAppointments.js +2 -0
- package/dist/Types.d.ts +2 -0
- package/dist/Types.js +2 -0
- package/dist/Validation.d.ts +16 -17
- package/dist/Validation.js +79 -66
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
package/dist/Appointment.d.ts
CHANGED
|
@@ -5,19 +5,20 @@ import { Repair } from "./Repair";
|
|
|
5
5
|
import { Payment } from "./Payment";
|
|
6
6
|
import { Service } from "./Service";
|
|
7
7
|
import { Diagnosis } from "./Diagnosis";
|
|
8
|
+
import { ID, UUID } from "./Types";
|
|
8
9
|
export type Appointment = {
|
|
9
|
-
CustomerID:
|
|
10
|
-
AppointmentID:
|
|
10
|
+
CustomerID: UUID;
|
|
11
|
+
AppointmentID: UUID;
|
|
11
12
|
FName: string;
|
|
12
13
|
LName: string;
|
|
13
14
|
Email: string;
|
|
14
15
|
Phone: string;
|
|
15
16
|
CreationDate: Date;
|
|
16
17
|
UpdationDate: Date;
|
|
17
|
-
StartDate:
|
|
18
|
-
EndDate:
|
|
18
|
+
StartDate: Date | null;
|
|
19
|
+
EndDate: Date | null;
|
|
19
20
|
Cost: number;
|
|
20
|
-
StatusID:
|
|
21
|
+
StatusID: ID;
|
|
21
22
|
Status: string;
|
|
22
23
|
Make: string;
|
|
23
24
|
Model: string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AppointmentLabels } from "./Label";
|
|
2
|
+
export type AppointmentRow = {
|
|
3
|
+
AppointmentID: string;
|
|
4
|
+
CustomerID: string;
|
|
5
|
+
FName: string;
|
|
6
|
+
LName: string;
|
|
7
|
+
Email: string;
|
|
8
|
+
Phone: string;
|
|
9
|
+
CreationDate: Date;
|
|
10
|
+
UpdationDate: Date;
|
|
11
|
+
StartDate: Date;
|
|
12
|
+
EndDate: Date;
|
|
13
|
+
Cost: number;
|
|
14
|
+
Status: string;
|
|
15
|
+
StatusID: number;
|
|
16
|
+
Make: string;
|
|
17
|
+
Model: string;
|
|
18
|
+
ModelYear: number;
|
|
19
|
+
VIN: string;
|
|
20
|
+
Mileage: number;
|
|
21
|
+
LicensePlate: string;
|
|
22
|
+
Labels: AppointmentLabels;
|
|
23
|
+
};
|
|
24
|
+
export type AppointmentsTable = {
|
|
25
|
+
Appointments: Array<AppointmentRow>;
|
|
26
|
+
Count: number;
|
|
27
|
+
};
|
package/dist/Diagnosis.d.ts
CHANGED
package/dist/Employee.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { UUID } from "./Types";
|
|
1
2
|
export type Employee = {
|
|
2
|
-
EmployeeID:
|
|
3
|
+
EmployeeID: UUID;
|
|
3
4
|
FName: string;
|
|
4
5
|
LName: string;
|
|
5
6
|
Email: string;
|
|
6
7
|
Phone: string;
|
|
7
8
|
};
|
|
8
9
|
export type EmployeeName = {
|
|
9
|
-
EmployeeID:
|
|
10
|
+
EmployeeID: UUID;
|
|
10
11
|
FName: string;
|
|
11
12
|
LName: string;
|
|
12
13
|
};
|
|
13
14
|
export type EmployeeFullName = {
|
|
14
|
-
EmployeeID:
|
|
15
|
+
EmployeeID: UUID;
|
|
15
16
|
FullName: string;
|
|
16
17
|
};
|
package/dist/Event.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
import { ID, UUID } from "./Types";
|
|
1
2
|
export type Event = {
|
|
2
|
-
EventID:
|
|
3
|
-
EmployeeID:
|
|
3
|
+
EventID: ID;
|
|
4
|
+
EmployeeID: UUID;
|
|
4
5
|
Name: string;
|
|
5
6
|
Date: string;
|
|
6
7
|
Summary: string;
|
|
7
|
-
AppointmentID:
|
|
8
|
+
AppointmentID: UUID | null;
|
|
8
9
|
Sharees: Array<{
|
|
9
|
-
ShareeID:
|
|
10
|
-
EventID:
|
|
10
|
+
ShareeID: UUID;
|
|
11
|
+
EventID: ID;
|
|
11
12
|
}>;
|
|
12
13
|
};
|
|
13
14
|
export type EventSharee = {
|
|
15
|
+
ShareeID: UUID;
|
|
14
16
|
ShareeFName: string;
|
|
15
17
|
ShareeLName: string;
|
|
16
|
-
ShareeID: string;
|
|
17
18
|
};
|
package/dist/Information.d.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import { ID } from "./Types";
|
|
1
2
|
export type InfoMake = {
|
|
2
3
|
Make: string;
|
|
3
4
|
};
|
|
4
5
|
export type InfoLabel = {
|
|
5
|
-
LabelID:
|
|
6
|
+
LabelID: ID;
|
|
6
7
|
Label: string;
|
|
7
8
|
};
|
|
8
9
|
export type InfoStatus = {
|
|
9
|
-
StatusID:
|
|
10
|
+
StatusID: ID;
|
|
10
11
|
Status: string;
|
|
11
12
|
Description: string;
|
|
12
13
|
};
|
|
13
14
|
export type InfoService = {
|
|
14
|
-
ClassID:
|
|
15
|
-
DivisionID: number;
|
|
16
|
-
ServiceID: number;
|
|
15
|
+
ClassID: ID;
|
|
17
16
|
Class: string;
|
|
18
17
|
Division: string;
|
|
18
|
+
DivisionID: ID;
|
|
19
19
|
Service: string;
|
|
20
|
+
ServiceID: ID;
|
|
20
21
|
};
|
package/dist/Label.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
+
import { ID, UUID } from "./Types";
|
|
1
2
|
export type Label = {
|
|
2
|
-
LabelID:
|
|
3
|
+
LabelID: ID;
|
|
3
4
|
Label: string;
|
|
4
|
-
Value:
|
|
5
|
-
AppointmentID:
|
|
5
|
+
Value: boolean | null;
|
|
6
|
+
AppointmentID: UUID;
|
|
6
7
|
};
|
|
7
8
|
export type AppointmentLabels = {
|
|
8
|
-
[
|
|
9
|
-
};
|
|
10
|
-
export type MultipleAppointmentLabels = {
|
|
11
|
-
[AppointmentID: string]: AppointmentLabels;
|
|
9
|
+
[Label: string]: Label;
|
|
12
10
|
};
|
package/dist/Note.d.ts
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
|
+
import { ID, UUID } from "./Types";
|
|
2
|
+
export type NoteAttachment = {
|
|
3
|
+
NoteID: ID;
|
|
4
|
+
AttachmentID: ID;
|
|
5
|
+
URL: string;
|
|
6
|
+
Name: string;
|
|
7
|
+
};
|
|
1
8
|
export type Note = {
|
|
2
|
-
NoteID:
|
|
3
|
-
EmployeeID:
|
|
4
|
-
AppointmentID:
|
|
9
|
+
NoteID: ID;
|
|
10
|
+
EmployeeID: UUID;
|
|
11
|
+
AppointmentID: UUID;
|
|
5
12
|
Head: string;
|
|
6
13
|
Body: string;
|
|
7
|
-
ShowCustomer:
|
|
14
|
+
ShowCustomer: boolean;
|
|
8
15
|
CreationDate: Date;
|
|
9
16
|
UpdationDate: Date;
|
|
10
17
|
Sharees: Array<{
|
|
11
|
-
ShareeID:
|
|
12
|
-
NoteID:
|
|
18
|
+
ShareeID: UUID;
|
|
19
|
+
NoteID: ID;
|
|
13
20
|
}>;
|
|
14
21
|
Attachments: Array<NoteAttachment>;
|
|
15
22
|
};
|
|
16
|
-
export type
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Name: string;
|
|
23
|
+
export type EmployeeNote = Note & {
|
|
24
|
+
OwnerFName: string;
|
|
25
|
+
OwnerLName: string;
|
|
26
|
+
OwnerID: UUID;
|
|
21
27
|
};
|
|
22
28
|
export type NoteSharee = {
|
|
29
|
+
ShareeID: UUID;
|
|
23
30
|
ShareeFName: string;
|
|
24
31
|
ShareeLName: string;
|
|
25
|
-
ShareeID: string;
|
|
26
|
-
};
|
|
27
|
-
export type EmployeeNote = Note & {
|
|
28
|
-
OwnerFName: string;
|
|
29
|
-
OwnerLName: string;
|
|
30
|
-
OwnerID: string;
|
|
31
32
|
};
|
package/dist/Part.d.ts
CHANGED
package/dist/Payment.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { Note } from "./Note";
|
|
|
2
2
|
import { Repair } from "./Repair";
|
|
3
3
|
import { Service } from "./Service";
|
|
4
4
|
import { Diagnosis } from "./Diagnosis";
|
|
5
|
+
import { UUID } from "./Types";
|
|
5
6
|
export type ProtectedAppointment = {
|
|
6
|
-
AppointmentID:
|
|
7
|
-
CustomerID:
|
|
7
|
+
AppointmentID: UUID;
|
|
8
|
+
CustomerID: UUID;
|
|
8
9
|
FName: string;
|
|
9
10
|
LName: string;
|
|
10
11
|
Email: string;
|
package/dist/Repair.d.ts
CHANGED
package/dist/Service.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { ID, UUID } from "./Types";
|
|
1
2
|
export type Service = {
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
AppointmentID: UUID;
|
|
4
|
+
AppointmentServiceID: ID;
|
|
4
5
|
Class: string;
|
|
5
6
|
Division: string;
|
|
6
7
|
Service: string;
|
|
7
|
-
ServiceID:
|
|
8
|
+
ServiceID: ID | null;
|
|
8
9
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AppointmentLabels } from "./Label";
|
|
2
|
+
export type ShortenedAppointment = {
|
|
3
|
+
AppointmentID: string;
|
|
4
|
+
CustomerID: string;
|
|
5
|
+
FName: string;
|
|
6
|
+
LName: string;
|
|
7
|
+
Email: string;
|
|
8
|
+
Phone: string;
|
|
9
|
+
CreationDate: Date;
|
|
10
|
+
UpdationDate: Date;
|
|
11
|
+
StartDate: Date;
|
|
12
|
+
EndDate: Date;
|
|
13
|
+
Cost: number;
|
|
14
|
+
Status: string;
|
|
15
|
+
StatusID: number;
|
|
16
|
+
Make: string;
|
|
17
|
+
Model: string;
|
|
18
|
+
ModelYear: number;
|
|
19
|
+
VIN: string;
|
|
20
|
+
Mileage: number;
|
|
21
|
+
LicensePlate: string;
|
|
22
|
+
Labels: AppointmentLabels;
|
|
23
|
+
};
|
|
24
|
+
export type ShortenedAppointments = {
|
|
25
|
+
Appointments: Array<ShortenedAppointment>;
|
|
26
|
+
Count: number;
|
|
27
|
+
};
|
package/dist/Types.d.ts
ADDED
package/dist/Types.js
ADDED
package/dist/Validation.d.ts
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const VIN: RegExp;
|
|
3
|
-
export declare const UUID: RegExp;
|
|
4
3
|
export declare const SQL_DATE: RegExp;
|
|
5
|
-
export declare const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare const isVIN: z.ZodString;
|
|
4
|
+
export declare const hasLength: (data: {
|
|
5
|
+
min: number;
|
|
6
|
+
max: number;
|
|
7
|
+
name: string;
|
|
8
|
+
}) => z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
11
9
|
export declare const isInteger: z.ZodCoercedNumber<unknown>;
|
|
12
10
|
export declare const isIntegerArray: z.ZodArray<z.ZodCoercedNumber<unknown>>;
|
|
13
11
|
export declare const isUUID: z.ZodUUID;
|
|
14
|
-
export declare const isUUIDArray: z.ZodArray<z.
|
|
12
|
+
export declare const isUUIDArray: z.ZodArray<z.ZodUUID>;
|
|
15
13
|
export declare const isBit: z.ZodEnum<{
|
|
16
14
|
"0, 1": "0, 1";
|
|
17
15
|
}>;
|
|
16
|
+
export declare const isName: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
17
|
+
export declare const isEmail: z.ZodEmail;
|
|
18
|
+
export declare const isPhone: z.ZodString;
|
|
19
|
+
export declare const isDate: z.ZodString;
|
|
20
|
+
export declare const isMoney: z.ZodCoercedNumber<unknown>;
|
|
21
|
+
export declare const isVIN: z.ZodString;
|
|
18
22
|
export declare const isID: z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodCoercedNumber<unknown>]>;
|
|
19
|
-
export declare const hasLengthAndClean: (data: {
|
|
20
|
-
min: number;
|
|
21
|
-
max: number;
|
|
22
|
-
name: string;
|
|
23
|
-
}) => z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
24
23
|
export declare const isCode: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
25
24
|
export declare const isMessage: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
26
25
|
export declare const isHead: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
27
26
|
export declare const isBody: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
28
27
|
export declare const isPartName: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
29
28
|
export declare const isPartNumber: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
29
|
+
export declare const isRepair: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
30
|
+
export declare const isClass: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
31
|
+
export declare const isDivision: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
32
|
+
export declare const isService: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
30
33
|
export declare const isCreditCardNumber: z.ZodString;
|
|
31
34
|
export declare const isExpirationDate: z.ZodString;
|
|
32
35
|
export declare const isCreditCardType: z.ZodEnum<{
|
|
@@ -34,7 +37,3 @@ export declare const isCreditCardType: z.ZodEnum<{
|
|
|
34
37
|
MASTERCARD: "MASTERCARD";
|
|
35
38
|
AMEX: "AMEX";
|
|
36
39
|
}>;
|
|
37
|
-
export declare const isRepair: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
38
|
-
export declare const isClass: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
39
|
-
export declare const isDivision: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
40
|
-
export declare const isService: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
package/dist/Validation.js
CHANGED
|
@@ -3,39 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.isCreditCardType = exports.isExpirationDate = exports.isCreditCardNumber = exports.isService = exports.isDivision = exports.isClass = exports.isRepair = exports.isPartNumber = exports.isPartName = exports.isBody = exports.isHead = exports.isMessage = exports.isCode = exports.isID = exports.isVIN = exports.isMoney = exports.isDate = exports.isPhone = exports.isEmail = exports.isName = exports.isBit = exports.isUUIDArray = exports.isUUID = exports.isIntegerArray = exports.isInteger = exports.hasLength = exports.SQL_DATE = exports.VIN = void 0;
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
8
|
const validator_1 = __importDefault(require("validator"));
|
|
9
9
|
exports.VIN = /^[A-HJ-NPR-Z0-9]{17}$/;
|
|
10
|
-
exports.UUID = /^[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}$/;
|
|
11
10
|
exports.SQL_DATE = /^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}(:[0-9]{2}$|:[0-9]{2}.[0-9]{3}$)/;
|
|
12
|
-
|
|
13
|
-
return s
|
|
14
|
-
.replace(/\s+/g, ' ')
|
|
15
|
-
.split(/\s/)
|
|
16
|
-
.filter(w => w.length > 0)
|
|
17
|
-
.map(w => w[0].toUpperCase() + w.slice(1).toLowerCase())
|
|
18
|
-
.join(" ");
|
|
19
|
-
});
|
|
20
|
-
exports.isEmail = zod_1.z.email("Must enter a valid email.").trim().toLowerCase().max(320, "Must enter a valid email.");
|
|
21
|
-
exports.isPhone = zod_1.z.string().trim().refine(s => {
|
|
22
|
-
const hasFormat = !!s.match(/[0-9]{3}-[0-9]{3}-[0-9]{4}/);
|
|
23
|
-
const isMobilePhone = validator_1.default.isMobilePhone("1" + s.replaceAll("-", ""), "en-US");
|
|
24
|
-
return hasFormat && isMobilePhone;
|
|
25
|
-
}, "Must enter a valid phone number in the format 123-456-7890.");
|
|
26
|
-
exports.isDate = zod_1.z.string().trim().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}(:[0-9]{2}$|:[0-9]{2}.[0-9]{3}$)/, "Must enter a valid date.");
|
|
27
|
-
exports.isMoney = zod_1.z.coerce.number("Must enter a valid value.");
|
|
28
|
-
exports.isVIN = zod_1.z.string().trim().regex(/^[A-HJ-NPR-Z0-9]{17}$/, "Must enter a valid VIN.");
|
|
29
|
-
exports.isInteger = zod_1.z.coerce.number().int();
|
|
30
|
-
exports.isIntegerArray = zod_1.z.array(zod_1.z.coerce.number().int());
|
|
31
|
-
exports.isUUID = zod_1.z.uuid("Must enter a valid ID.");
|
|
32
|
-
exports.isUUIDArray = zod_1.z.array(zod_1.z.string()).refine(ids => ids.every(id => !!id.match(exports.UUID)));
|
|
33
|
-
exports.isBit = zod_1.z.enum(["0, 1"], "Must enter a '0' or '1'.");
|
|
34
|
-
exports.isID = zod_1.z.union([
|
|
35
|
-
zod_1.z.literal(""),
|
|
36
|
-
zod_1.z.coerce.number().int()
|
|
37
|
-
]);
|
|
38
|
-
const hasLengthAndClean = (data) => {
|
|
11
|
+
const hasLength = (data) => {
|
|
39
12
|
return zod_1.z
|
|
40
13
|
.string()
|
|
41
14
|
.trim()
|
|
@@ -44,39 +17,101 @@ const hasLengthAndClean = (data) => {
|
|
|
44
17
|
.transform(s => s.replace(/\s+/g, ' '))
|
|
45
18
|
.refine(s => s.length > 0, `Must enter a ${data.name}.`);
|
|
46
19
|
};
|
|
47
|
-
exports.
|
|
48
|
-
exports.
|
|
20
|
+
exports.hasLength = hasLength;
|
|
21
|
+
exports.isInteger = zod_1.z.coerce.number().int();
|
|
22
|
+
exports.isIntegerArray = zod_1.z.array(zod_1.z.coerce.number().int());
|
|
23
|
+
exports.isUUID = zod_1.z.uuid("Must enter a valid ID.");
|
|
24
|
+
exports.isUUIDArray = zod_1.z.array(zod_1.z.uuid());
|
|
25
|
+
exports.isBit = zod_1.z.enum(["0, 1"], "Must enter a '0' or '1'.");
|
|
26
|
+
exports.isName = zod_1.z.string()
|
|
27
|
+
.trim()
|
|
28
|
+
.min(2, "Must enter a name.")
|
|
29
|
+
.max(50, "Must enter a name less than 50 characters.")
|
|
30
|
+
.regex(/^[A-Za-z\s'-]*$/, "Must enter a name without symbols.")
|
|
31
|
+
.transform(s => s
|
|
32
|
+
.replace(/\s+/g, ' ')
|
|
33
|
+
.split(/\s/)
|
|
34
|
+
.filter(w => w.length > 0)
|
|
35
|
+
.map(w => w[0].toUpperCase() + w.slice(1).toLowerCase())
|
|
36
|
+
.join(" "))
|
|
37
|
+
.refine(s => s.length > 0, "Must enter a name.");
|
|
38
|
+
exports.isEmail = zod_1.z.email("Must enter a valid email.")
|
|
39
|
+
.trim()
|
|
40
|
+
.toLowerCase()
|
|
41
|
+
.max(320, "Must enter a valid email.");
|
|
42
|
+
exports.isPhone = zod_1.z.string()
|
|
43
|
+
.trim()
|
|
44
|
+
.refine(s => {
|
|
45
|
+
const hasFormat = !!s.match(/[0-9]{3}-[0-9]{3}-[0-9]{4}/);
|
|
46
|
+
const isMobilePhone = validator_1.default.isMobilePhone("1" + s.replaceAll("-", ""), "en-US");
|
|
47
|
+
return hasFormat && isMobilePhone;
|
|
48
|
+
}, "Must enter a valid phone number in the format 123-456-7890.");
|
|
49
|
+
exports.isDate = zod_1.z.string()
|
|
50
|
+
.trim()
|
|
51
|
+
.regex(exports.SQL_DATE, "Must enter a valid date.");
|
|
52
|
+
exports.isMoney = zod_1.z
|
|
53
|
+
.coerce
|
|
54
|
+
.number("Must enter a valid value.");
|
|
55
|
+
exports.isVIN = zod_1.z.string()
|
|
56
|
+
.trim()
|
|
57
|
+
.regex(exports.VIN, "Must enter a valid VIN.");
|
|
58
|
+
exports.isID = zod_1.z.union([
|
|
59
|
+
zod_1.z.literal(""),
|
|
60
|
+
zod_1.z.coerce.number().int()
|
|
61
|
+
]);
|
|
62
|
+
exports.isCode = (0, exports.hasLength)({
|
|
49
63
|
min: 1,
|
|
50
64
|
max: 100,
|
|
51
65
|
name: "code"
|
|
52
66
|
});
|
|
53
|
-
exports.isMessage = (0, exports.
|
|
67
|
+
exports.isMessage = (0, exports.hasLength)({
|
|
54
68
|
min: 1,
|
|
55
69
|
max: 500,
|
|
56
70
|
name: "message"
|
|
57
71
|
});
|
|
58
|
-
exports.isHead = (0, exports.
|
|
72
|
+
exports.isHead = (0, exports.hasLength)({
|
|
59
73
|
min: 1,
|
|
60
74
|
max: 100,
|
|
61
75
|
name: "value"
|
|
62
76
|
});
|
|
63
|
-
exports.isBody = (0, exports.
|
|
77
|
+
exports.isBody = (0, exports.hasLength)({
|
|
64
78
|
min: 1,
|
|
65
79
|
max: 500,
|
|
66
80
|
name: "value"
|
|
67
81
|
});
|
|
68
|
-
exports.isPartName = (0, exports.
|
|
82
|
+
exports.isPartName = (0, exports.hasLength)({
|
|
69
83
|
min: 1,
|
|
70
84
|
max: 100,
|
|
71
85
|
name: "name"
|
|
72
86
|
});
|
|
73
|
-
exports.isPartNumber = (0, exports.
|
|
87
|
+
exports.isPartNumber = (0, exports.hasLength)({
|
|
74
88
|
min: 1,
|
|
75
89
|
max: 100,
|
|
76
90
|
name: "name"
|
|
77
91
|
});
|
|
78
|
-
exports.
|
|
79
|
-
|
|
92
|
+
exports.isRepair = (0, exports.hasLength)({
|
|
93
|
+
min: 1,
|
|
94
|
+
max: 500,
|
|
95
|
+
name: "repair"
|
|
96
|
+
});
|
|
97
|
+
exports.isClass = (0, exports.hasLength)({
|
|
98
|
+
min: 1,
|
|
99
|
+
max: 500,
|
|
100
|
+
name: "repair"
|
|
101
|
+
});
|
|
102
|
+
exports.isDivision = (0, exports.hasLength)({
|
|
103
|
+
min: 1,
|
|
104
|
+
max: 50,
|
|
105
|
+
name: "value"
|
|
106
|
+
});
|
|
107
|
+
exports.isService = (0, exports.hasLength)({
|
|
108
|
+
min: 1,
|
|
109
|
+
max: 50,
|
|
110
|
+
name: "value"
|
|
111
|
+
});
|
|
112
|
+
exports.isCreditCardNumber = zod_1.z.string()
|
|
113
|
+
.trim()
|
|
114
|
+
.refine(s => {
|
|
80
115
|
const providers = ["visa", "amex", "mastercard"];
|
|
81
116
|
let validCreditCardNumber = false;
|
|
82
117
|
for (const provider of providers) {
|
|
@@ -86,9 +121,12 @@ exports.isCreditCardNumber = zod_1.z.string().trim().refine(s => {
|
|
|
86
121
|
break;
|
|
87
122
|
}
|
|
88
123
|
}
|
|
89
|
-
return
|
|
124
|
+
return (s.length >= 13 && s.length <= 16) && validCreditCardNumber;
|
|
90
125
|
}, "Must enter a valid credit card number.");
|
|
91
|
-
exports.isExpirationDate = zod_1.z.string()
|
|
126
|
+
exports.isExpirationDate = zod_1.z.string()
|
|
127
|
+
.trim()
|
|
128
|
+
.regex(/^(0[1-9]|1[0-2])[0-9]{2}$/, "Must enter a valid expiration date.")
|
|
129
|
+
.refine(s => {
|
|
92
130
|
const month = parseInt(s.substring(0, 2));
|
|
93
131
|
const year = 2000 + parseInt(s.substring(2, 4));
|
|
94
132
|
const now = new Date();
|
|
@@ -100,29 +138,4 @@ exports.isExpirationDate = zod_1.z.string().trim().regex(/^(0[1-9]|1[0-2])[0-9]{
|
|
|
100
138
|
return month >= currentMonth;
|
|
101
139
|
return false;
|
|
102
140
|
}, "Card has expired.");
|
|
103
|
-
;
|
|
104
|
-
exports.isCreditCardType = zod_1.z.enum([
|
|
105
|
-
'VISA',
|
|
106
|
-
'MASTERCARD',
|
|
107
|
-
'AMEX'
|
|
108
|
-
]);
|
|
109
|
-
exports.isRepair = (0, exports.hasLengthAndClean)({
|
|
110
|
-
min: 1,
|
|
111
|
-
max: 500,
|
|
112
|
-
name: "repair"
|
|
113
|
-
});
|
|
114
|
-
exports.isClass = (0, exports.hasLengthAndClean)({
|
|
115
|
-
min: 1,
|
|
116
|
-
max: 500,
|
|
117
|
-
name: "repair"
|
|
118
|
-
});
|
|
119
|
-
exports.isDivision = (0, exports.hasLengthAndClean)({
|
|
120
|
-
min: 1,
|
|
121
|
-
max: 50,
|
|
122
|
-
name: "value"
|
|
123
|
-
});
|
|
124
|
-
exports.isService = (0, exports.hasLengthAndClean)({
|
|
125
|
-
min: 1,
|
|
126
|
-
max: 50,
|
|
127
|
-
name: "value"
|
|
128
|
-
});
|
|
141
|
+
exports.isCreditCardType = zod_1.z.enum(['VISA', 'MASTERCARD', 'AMEX'], "Must use one of the following cards: (VISA, MASTERVARD, AMEX)");
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./Appointment";
|
|
2
|
-
export * from "./
|
|
2
|
+
export * from "./AppointmentsTable";
|
|
3
3
|
export * from "./Diagnosis";
|
|
4
4
|
export * from "./Employee";
|
|
5
5
|
export * from "./Event";
|
|
@@ -11,3 +11,4 @@ export * from "./Payment";
|
|
|
11
11
|
export * from "./ProtectedAppointment";
|
|
12
12
|
export * from "./Repair";
|
|
13
13
|
export * from "./Service";
|
|
14
|
+
export * from "./Validation";
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./Appointment"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./AppointmentsTable"), exports);
|
|
19
19
|
__exportStar(require("./Diagnosis"), exports);
|
|
20
20
|
__exportStar(require("./Employee"), exports);
|
|
21
21
|
__exportStar(require("./Event"), exports);
|
|
@@ -27,3 +27,4 @@ __exportStar(require("./Payment"), exports);
|
|
|
27
27
|
__exportStar(require("./ProtectedAppointment"), exports);
|
|
28
28
|
__exportStar(require("./Repair"), exports);
|
|
29
29
|
__exportStar(require("./Service"), exports);
|
|
30
|
+
__exportStar(require("./Validation"), exports);
|