waltronics-types 1.0.11 → 1.0.12
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/{Appointment.ts → dist/Appointment.d.ts} +35 -36
- package/dist/Appointment.js +2 -0
- package/{AppointmentList.ts → dist/AppointmentList.d.ts} +27 -29
- package/dist/AppointmentList.js +2 -0
- package/{Diagnosis.ts → dist/Diagnosis.d.ts} +5 -5
- package/dist/Diagnosis.js +2 -0
- package/{Employee.ts → dist/Employee.d.ts} +16 -18
- package/dist/Employee.js +2 -0
- package/{Event.ts → dist/Event.d.ts} +17 -18
- package/dist/Event.js +2 -0
- package/{Information.ts → dist/Information.d.ts} +20 -23
- package/dist/Information.js +2 -0
- package/{Label.ts → dist/Label.d.ts} +12 -16
- package/dist/Label.js +2 -0
- package/{Note.ts → dist/Note.d.ts} +31 -34
- package/dist/Note.js +2 -0
- package/{Part.ts → dist/Part.d.ts} +7 -7
- package/dist/Part.js +2 -0
- package/{Payment.ts → dist/Payment.d.ts} +10 -10
- package/dist/Payment.js +2 -0
- package/{ProtectedAppointment.ts → dist/ProtectedAppointment.d.ts} +30 -31
- package/dist/ProtectedAppointment.js +2 -0
- package/{Repair.ts → dist/Repair.d.ts} +4 -4
- package/dist/Repair.js +2 -0
- package/dist/Service.d.ts +8 -0
- package/dist/Service.js +2 -0
- package/dist/Validation.d.ts +40 -0
- package/dist/Validation.js +128 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +29 -0
- package/package.json +12 -5
- package/tsconfig.json +10 -0
- package/Service.ts +0 -12
- package/index.d.ts +0 -13
- package/index.js +0 -13
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
import { EmployeeNote } from "./Note";
|
|
2
|
-
import { AppointmentLabels } from "./Label";
|
|
3
|
-
import { Part } from "./Part";
|
|
4
|
-
import { Repair } from "./Repair";
|
|
5
|
-
import { Payment } from "./Payment";
|
|
6
|
-
import { Service } from "./Service";
|
|
7
|
-
import { Diagnosis } from "./Diagnosis";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
1
|
+
import { EmployeeNote } from "./Note";
|
|
2
|
+
import { AppointmentLabels } from "./Label";
|
|
3
|
+
import { Part } from "./Part";
|
|
4
|
+
import { Repair } from "./Repair";
|
|
5
|
+
import { Payment } from "./Payment";
|
|
6
|
+
import { Service } from "./Service";
|
|
7
|
+
import { Diagnosis } from "./Diagnosis";
|
|
8
|
+
export type Appointment = {
|
|
9
|
+
CustomerID: string;
|
|
10
|
+
AppointmentID: string;
|
|
11
|
+
FName: string;
|
|
12
|
+
LName: string;
|
|
13
|
+
Email: string;
|
|
14
|
+
Phone: string;
|
|
15
|
+
CreationDate: Date;
|
|
16
|
+
UpdationDate: Date;
|
|
17
|
+
StartDate: string | null;
|
|
18
|
+
EndDate: string | null;
|
|
19
|
+
Cost: number;
|
|
20
|
+
StatusID: number;
|
|
21
|
+
Status: string;
|
|
22
|
+
Make: string;
|
|
23
|
+
Model: string;
|
|
24
|
+
ModelYear: number;
|
|
25
|
+
VIN: string;
|
|
26
|
+
Mileage: number;
|
|
27
|
+
LicensePlate: string;
|
|
28
|
+
Labels: AppointmentLabels;
|
|
29
|
+
Notes: Array<EmployeeNote>;
|
|
30
|
+
Parts: Array<Part>;
|
|
31
|
+
Repairs: Array<Repair>;
|
|
32
|
+
Payments: Array<Payment>;
|
|
33
|
+
Services: Array<Service>;
|
|
34
|
+
Diagnoses: Array<Diagnosis>;
|
|
35
|
+
};
|
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
import { AppointmentLabels } from "./Label";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Appointments: Array<AppointmentEntry>;
|
|
29
|
-
}
|
|
1
|
+
import { AppointmentLabels } from "./Label";
|
|
2
|
+
export type AppointmentEntry = {
|
|
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
|
+
StatusID: number;
|
|
15
|
+
Status: 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 AppointmentList = {
|
|
25
|
+
Count: number;
|
|
26
|
+
Appointments: Array<AppointmentEntry>;
|
|
27
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type Diagnosis = {
|
|
2
|
-
DiagnosisID: number;
|
|
3
|
-
Code: string;
|
|
4
|
-
Message: string;
|
|
5
|
-
}
|
|
1
|
+
export type Diagnosis = {
|
|
2
|
+
DiagnosisID: number;
|
|
3
|
+
Code: string;
|
|
4
|
+
Message: string;
|
|
5
|
+
};
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
export type Employee = {
|
|
2
|
-
EmployeeID: string;
|
|
3
|
-
FName: string;
|
|
4
|
-
LName: string;
|
|
5
|
-
Email: string;
|
|
6
|
-
Phone: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
FullName: string;
|
|
18
|
-
}
|
|
1
|
+
export type Employee = {
|
|
2
|
+
EmployeeID: string;
|
|
3
|
+
FName: string;
|
|
4
|
+
LName: string;
|
|
5
|
+
Email: string;
|
|
6
|
+
Phone: string;
|
|
7
|
+
};
|
|
8
|
+
export type EmployeeName = {
|
|
9
|
+
EmployeeID: string;
|
|
10
|
+
FName: string;
|
|
11
|
+
LName: string;
|
|
12
|
+
};
|
|
13
|
+
export type EmployeeFullName = {
|
|
14
|
+
EmployeeID: string;
|
|
15
|
+
FullName: string;
|
|
16
|
+
};
|
package/dist/Employee.js
ADDED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
export type Event = {
|
|
2
|
-
EventID: number;
|
|
3
|
-
EmployeeID: string;
|
|
4
|
-
Name: string;
|
|
5
|
-
Date: string;
|
|
6
|
-
Summary: string;
|
|
7
|
-
AppointmentID: string|null;
|
|
8
|
-
Sharees: Array<{
|
|
9
|
-
ShareeID: string;
|
|
10
|
-
EventID: string;
|
|
11
|
-
}>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
1
|
+
export type Event = {
|
|
2
|
+
EventID: number;
|
|
3
|
+
EmployeeID: string;
|
|
4
|
+
Name: string;
|
|
5
|
+
Date: string;
|
|
6
|
+
Summary: string;
|
|
7
|
+
AppointmentID: string | null;
|
|
8
|
+
Sharees: Array<{
|
|
9
|
+
ShareeID: string;
|
|
10
|
+
EventID: string;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
export type EventSharee = {
|
|
14
|
+
ShareeFName: string;
|
|
15
|
+
ShareeLName: string;
|
|
16
|
+
ShareeID: string;
|
|
17
|
+
};
|
package/dist/Event.js
ADDED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
export type InfoMake = {
|
|
2
|
-
Make: string;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Division: string;
|
|
22
|
-
Service: string;
|
|
23
|
-
}
|
|
1
|
+
export type InfoMake = {
|
|
2
|
+
Make: string;
|
|
3
|
+
};
|
|
4
|
+
export type InfoLabel = {
|
|
5
|
+
LabelID: number;
|
|
6
|
+
Label: string;
|
|
7
|
+
};
|
|
8
|
+
export type InfoStatus = {
|
|
9
|
+
StatusID: number;
|
|
10
|
+
Status: string;
|
|
11
|
+
Description: string;
|
|
12
|
+
};
|
|
13
|
+
export type InfoService = {
|
|
14
|
+
ClassID: number;
|
|
15
|
+
DivisionID: number;
|
|
16
|
+
ServiceID: number;
|
|
17
|
+
Class: string;
|
|
18
|
+
Division: string;
|
|
19
|
+
Service: string;
|
|
20
|
+
};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
export type Label = {
|
|
2
|
-
LabelID: number;
|
|
3
|
-
Label: string;
|
|
4
|
-
Value: number|null;
|
|
5
|
-
AppointmentID: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type MultipleAppointmentLabels = {
|
|
15
|
-
[AppointmentID: string]: AppointmentLabels;
|
|
16
|
-
}
|
|
1
|
+
export type Label = {
|
|
2
|
+
LabelID: number;
|
|
3
|
+
Label: string;
|
|
4
|
+
Value: number | null;
|
|
5
|
+
AppointmentID: string;
|
|
6
|
+
};
|
|
7
|
+
export type AppointmentLabels = {
|
|
8
|
+
[LabelName: string]: Label;
|
|
9
|
+
};
|
|
10
|
+
export type MultipleAppointmentLabels = {
|
|
11
|
+
[AppointmentID: string]: AppointmentLabels;
|
|
12
|
+
};
|
package/dist/Label.js
ADDED
|
@@ -1,34 +1,31 @@
|
|
|
1
|
-
export type Note = {
|
|
2
|
-
NoteID: string;
|
|
3
|
-
EmployeeID: string;
|
|
4
|
-
AppointmentID: string;
|
|
5
|
-
Head: string;
|
|
6
|
-
Body: string;
|
|
7
|
-
ShowCustomer: string;
|
|
8
|
-
CreationDate: Date;
|
|
9
|
-
UpdationDate: Date;
|
|
10
|
-
Sharees: Array<{
|
|
11
|
-
ShareeID: string;
|
|
12
|
-
NoteID: string;
|
|
13
|
-
}>;
|
|
14
|
-
Attachments: Array<NoteAttachment>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
OwnerLName: string;
|
|
33
|
-
OwnerID: string;
|
|
34
|
-
}
|
|
1
|
+
export type Note = {
|
|
2
|
+
NoteID: string;
|
|
3
|
+
EmployeeID: string;
|
|
4
|
+
AppointmentID: string;
|
|
5
|
+
Head: string;
|
|
6
|
+
Body: string;
|
|
7
|
+
ShowCustomer: string;
|
|
8
|
+
CreationDate: Date;
|
|
9
|
+
UpdationDate: Date;
|
|
10
|
+
Sharees: Array<{
|
|
11
|
+
ShareeID: string;
|
|
12
|
+
NoteID: string;
|
|
13
|
+
}>;
|
|
14
|
+
Attachments: Array<NoteAttachment>;
|
|
15
|
+
};
|
|
16
|
+
export type NoteAttachment = {
|
|
17
|
+
NoteID: number;
|
|
18
|
+
AttachmentID: number;
|
|
19
|
+
URL: string;
|
|
20
|
+
Name: string;
|
|
21
|
+
};
|
|
22
|
+
export type NoteSharee = {
|
|
23
|
+
ShareeFName: string;
|
|
24
|
+
ShareeLName: string;
|
|
25
|
+
ShareeID: string;
|
|
26
|
+
};
|
|
27
|
+
export type EmployeeNote = Note & {
|
|
28
|
+
OwnerFName: string;
|
|
29
|
+
OwnerLName: string;
|
|
30
|
+
OwnerID: string;
|
|
31
|
+
};
|
package/dist/Note.js
ADDED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export type Part = {
|
|
2
|
-
PartID: number;
|
|
3
|
-
PartName: string;
|
|
4
|
-
PartNumber: string;
|
|
5
|
-
Quantity: number;
|
|
6
|
-
UnitCost: number;
|
|
7
|
-
}
|
|
1
|
+
export type Part = {
|
|
2
|
+
PartID: number;
|
|
3
|
+
PartName: string;
|
|
4
|
+
PartNumber: string;
|
|
5
|
+
Quantity: number;
|
|
6
|
+
UnitCost: number;
|
|
7
|
+
};
|
package/dist/Part.js
ADDED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export type Payment = {
|
|
2
|
-
PaymentID: string;
|
|
3
|
-
AppointmentID: string;
|
|
4
|
-
Payment: number;
|
|
5
|
-
PaymentDate: Date;
|
|
6
|
-
Name: string;
|
|
7
|
-
Type: string;
|
|
8
|
-
CCN: string;
|
|
9
|
-
EXP: string;
|
|
10
|
-
}
|
|
1
|
+
export type Payment = {
|
|
2
|
+
PaymentID: string;
|
|
3
|
+
AppointmentID: string;
|
|
4
|
+
Payment: number;
|
|
5
|
+
PaymentDate: Date;
|
|
6
|
+
Name: string;
|
|
7
|
+
Type: string;
|
|
8
|
+
CCN: string;
|
|
9
|
+
EXP: string;
|
|
10
|
+
};
|
package/dist/Payment.js
ADDED
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import { Note } from "./Note";
|
|
2
|
-
import { Repair } from "./Repair";
|
|
3
|
-
import { Service } from "./Service";
|
|
4
|
-
import { Diagnosis } from "./Diagnosis";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
1
|
+
import { Note } from "./Note";
|
|
2
|
+
import { Repair } from "./Repair";
|
|
3
|
+
import { Service } from "./Service";
|
|
4
|
+
import { Diagnosis } from "./Diagnosis";
|
|
5
|
+
export type ProtectedAppointment = {
|
|
6
|
+
AppointmentID: string;
|
|
7
|
+
CustomerID: number;
|
|
8
|
+
FName: string;
|
|
9
|
+
LName: string;
|
|
10
|
+
Email: string;
|
|
11
|
+
Phone: string;
|
|
12
|
+
CreationDate: Date;
|
|
13
|
+
UpdationDate: Date;
|
|
14
|
+
StartDate: Date;
|
|
15
|
+
EndDate: Date;
|
|
16
|
+
Cost: number;
|
|
17
|
+
StatusID: number;
|
|
18
|
+
Status: string;
|
|
19
|
+
StatusDescription: string;
|
|
20
|
+
Make: string;
|
|
21
|
+
Model: string;
|
|
22
|
+
ModelYear: number;
|
|
23
|
+
VIN: string;
|
|
24
|
+
Mileage: number;
|
|
25
|
+
LicensePlate: string;
|
|
26
|
+
Notes: Array<Note>;
|
|
27
|
+
Repairs: Array<Repair>;
|
|
28
|
+
Services: Array<Service>;
|
|
29
|
+
Diagnoses: Array<Diagnosis>;
|
|
30
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type Repair = {
|
|
2
|
-
RepairID: number;
|
|
3
|
-
Repair: string;
|
|
4
|
-
}
|
|
1
|
+
export type Repair = {
|
|
2
|
+
RepairID: number;
|
|
3
|
+
Repair: string;
|
|
4
|
+
};
|
package/dist/Repair.js
ADDED
package/dist/Service.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const VIN: RegExp;
|
|
3
|
+
export declare const UUID: RegExp;
|
|
4
|
+
export declare const SQL_DATE: RegExp;
|
|
5
|
+
export declare const isName: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
6
|
+
export declare const isEmail: z.ZodEmail;
|
|
7
|
+
export declare const isPhone: z.ZodString;
|
|
8
|
+
export declare const isDate: z.ZodString;
|
|
9
|
+
export declare const isMoney: z.ZodCoercedNumber<unknown>;
|
|
10
|
+
export declare const isVIN: z.ZodString;
|
|
11
|
+
export declare const isInteger: z.ZodCoercedNumber<unknown>;
|
|
12
|
+
export declare const isIntegerArray: z.ZodArray<z.ZodCoercedNumber<unknown>>;
|
|
13
|
+
export declare const isUUID: z.ZodUUID;
|
|
14
|
+
export declare const isUUIDArray: z.ZodArray<z.ZodString>;
|
|
15
|
+
export declare const isBit: z.ZodEnum<{
|
|
16
|
+
"0, 1": "0, 1";
|
|
17
|
+
}>;
|
|
18
|
+
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
|
+
export declare const isCode: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
25
|
+
export declare const isMessage: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
26
|
+
export declare const isHead: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
27
|
+
export declare const isBody: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
28
|
+
export declare const isPartName: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
29
|
+
export declare const isPartNumber: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
30
|
+
export declare const isCreditCardNumber: z.ZodString;
|
|
31
|
+
export declare const isExpirationDate: z.ZodString;
|
|
32
|
+
export declare const isCreditCardType: z.ZodEnum<{
|
|
33
|
+
VISA: "VISA";
|
|
34
|
+
MASTERCARD: "MASTERCARD";
|
|
35
|
+
AMEX: "AMEX";
|
|
36
|
+
}>;
|
|
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>>;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isService = exports.isDivision = exports.isClass = exports.isRepair = exports.isCreditCardType = exports.isExpirationDate = exports.isCreditCardNumber = exports.isPartNumber = exports.isPartName = exports.isBody = exports.isHead = exports.isMessage = exports.isCode = exports.hasLengthAndClean = exports.isID = exports.isBit = exports.isUUIDArray = exports.isUUID = exports.isIntegerArray = exports.isInteger = exports.isVIN = exports.isMoney = exports.isDate = exports.isPhone = exports.isEmail = exports.isName = exports.SQL_DATE = exports.UUID = exports.VIN = void 0;
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
const validator_1 = __importDefault(require("validator"));
|
|
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
|
+
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
|
+
exports.isName = zod_1.z.string().trim().min(2, "Must enter a name.").max(50, "Must enter a name less than 50 characters.").regex(/^[A-Za-z\s'-]*$/, "Must enter a name without symbols.").transform(s => {
|
|
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) => {
|
|
39
|
+
return zod_1.z
|
|
40
|
+
.string()
|
|
41
|
+
.trim()
|
|
42
|
+
.min(data.min, `Must enter a ${data.name}.`)
|
|
43
|
+
.max(data.max, `Must enter a ${data.name} less than 50 characters.`)
|
|
44
|
+
.transform(s => s.replace(/\s+/g, ' '))
|
|
45
|
+
.refine(s => s.length > 0, `Must enter a ${data.name}.`);
|
|
46
|
+
};
|
|
47
|
+
exports.hasLengthAndClean = hasLengthAndClean;
|
|
48
|
+
exports.isCode = (0, exports.hasLengthAndClean)({
|
|
49
|
+
min: 1,
|
|
50
|
+
max: 100,
|
|
51
|
+
name: "code"
|
|
52
|
+
});
|
|
53
|
+
exports.isMessage = (0, exports.hasLengthAndClean)({
|
|
54
|
+
min: 1,
|
|
55
|
+
max: 500,
|
|
56
|
+
name: "message"
|
|
57
|
+
});
|
|
58
|
+
exports.isHead = (0, exports.hasLengthAndClean)({
|
|
59
|
+
min: 1,
|
|
60
|
+
max: 100,
|
|
61
|
+
name: "value"
|
|
62
|
+
});
|
|
63
|
+
exports.isBody = (0, exports.hasLengthAndClean)({
|
|
64
|
+
min: 1,
|
|
65
|
+
max: 500,
|
|
66
|
+
name: "value"
|
|
67
|
+
});
|
|
68
|
+
exports.isPartName = (0, exports.hasLengthAndClean)({
|
|
69
|
+
min: 1,
|
|
70
|
+
max: 100,
|
|
71
|
+
name: "name"
|
|
72
|
+
});
|
|
73
|
+
exports.isPartNumber = (0, exports.hasLengthAndClean)({
|
|
74
|
+
min: 1,
|
|
75
|
+
max: 100,
|
|
76
|
+
name: "name"
|
|
77
|
+
});
|
|
78
|
+
exports.isCreditCardNumber = zod_1.z.string().trim().refine(s => {
|
|
79
|
+
const validLength = s.length >= 13 && s.length <= 16;
|
|
80
|
+
const providers = ["visa", "amex", "mastercard"];
|
|
81
|
+
let validCreditCardNumber = false;
|
|
82
|
+
for (const provider of providers) {
|
|
83
|
+
const validCreditCardNumberForProvider = validator_1.default.isCreditCard(s, { provider });
|
|
84
|
+
if (validCreditCardNumberForProvider) {
|
|
85
|
+
validCreditCardNumber = true;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return validLength && validCreditCardNumber;
|
|
90
|
+
}, "Must enter a valid credit card number.");
|
|
91
|
+
exports.isExpirationDate = zod_1.z.string().trim().regex(/^(0[1-9]|1[0-2])[0-9]{2}$/, "Must enter a valid expiration date.").refine(s => {
|
|
92
|
+
const month = parseInt(s.substring(0, 2));
|
|
93
|
+
const year = 2000 + parseInt(s.substring(2, 4));
|
|
94
|
+
const now = new Date();
|
|
95
|
+
const currentYear = now.getFullYear();
|
|
96
|
+
const currentMonth = now.getMonth() + 1;
|
|
97
|
+
if (year > currentYear)
|
|
98
|
+
return true;
|
|
99
|
+
if (year === currentYear)
|
|
100
|
+
return month >= currentMonth;
|
|
101
|
+
return false;
|
|
102
|
+
}, "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
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./Appointment";
|
|
2
|
+
export * from "./AppointmentList";
|
|
3
|
+
export * from "./Diagnosis";
|
|
4
|
+
export * from "./Employee";
|
|
5
|
+
export * from "./Event";
|
|
6
|
+
export * from "./Information";
|
|
7
|
+
export * from "./Label";
|
|
8
|
+
export * from "./Note";
|
|
9
|
+
export * from "./Part";
|
|
10
|
+
export * from "./Payment";
|
|
11
|
+
export * from "./ProtectedAppointment";
|
|
12
|
+
export * from "./Repair";
|
|
13
|
+
export * from "./Service";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
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("./Appointment"), exports);
|
|
18
|
+
__exportStar(require("./AppointmentList"), exports);
|
|
19
|
+
__exportStar(require("./Diagnosis"), exports);
|
|
20
|
+
__exportStar(require("./Employee"), exports);
|
|
21
|
+
__exportStar(require("./Event"), exports);
|
|
22
|
+
__exportStar(require("./Information"), exports);
|
|
23
|
+
__exportStar(require("./Label"), exports);
|
|
24
|
+
__exportStar(require("./Note"), exports);
|
|
25
|
+
__exportStar(require("./Part"), exports);
|
|
26
|
+
__exportStar(require("./Payment"), exports);
|
|
27
|
+
__exportStar(require("./ProtectedAppointment"), exports);
|
|
28
|
+
__exportStar(require("./Repair"), exports);
|
|
29
|
+
__exportStar(require("./Service"), exports);
|
package/package.json
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "waltronics-types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "Contains the types used in the Waltronics application.",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"types": "index.d.ts",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"
|
|
8
|
+
"prepublish": "npm run build",
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"test": "echo \"Error: No Test Specified\" && exit 1"
|
|
9
11
|
},
|
|
10
12
|
"author": "",
|
|
11
13
|
"license": "ISC",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"validator": "^13.15.26",
|
|
16
|
+
"zod": "^4.3.5"
|
|
17
|
+
},
|
|
12
18
|
"devDependencies": {
|
|
13
|
-
"@types/validator": "^13.15.10"
|
|
19
|
+
"@types/validator": "^13.15.10",
|
|
20
|
+
"typescript": "^5.9.3"
|
|
14
21
|
}
|
|
15
22
|
}
|
package/tsconfig.json
ADDED
package/Service.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type Service = {
|
|
2
|
-
// It's kind of confusing, but "AppointmentServiceID"
|
|
3
|
-
// refers to the unique ID given to each Service instance.
|
|
4
|
-
// "ServiceID" refers to the Info.Service information that this
|
|
5
|
-
// Service has.
|
|
6
|
-
AppointmentServiceID: number;
|
|
7
|
-
AppointmentID: string;
|
|
8
|
-
Class: string;
|
|
9
|
-
Division: string;
|
|
10
|
-
Service: string;
|
|
11
|
-
ServiceID: number|null;
|
|
12
|
-
}
|
package/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from "./Appointment.ts";
|
|
2
|
-
export * from "./AppointmentList.ts";
|
|
3
|
-
export * from "./Diagnosis.ts";
|
|
4
|
-
export * from "./Employee.ts";
|
|
5
|
-
export * from "./Event.ts";
|
|
6
|
-
export * from "./Information.ts";
|
|
7
|
-
export * from "./Label.ts";
|
|
8
|
-
export * from "./Note.ts";
|
|
9
|
-
export * from "./Part.ts";
|
|
10
|
-
export * from "./Payment.ts";
|
|
11
|
-
export * from "./ProtectedAppointment.ts";
|
|
12
|
-
export * from "./Repair.ts";
|
|
13
|
-
export * from "./Service.ts";
|
package/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from "./Appointment.ts";
|
|
2
|
-
export * from "./AppointmentList.ts";
|
|
3
|
-
export * from "./Diagnosis.ts";
|
|
4
|
-
export * from "./Employee.ts";
|
|
5
|
-
export * from "./Event.ts";
|
|
6
|
-
export * from "./Information.ts";
|
|
7
|
-
export * from "./Label.ts";
|
|
8
|
-
export * from "./Note.ts";
|
|
9
|
-
export * from "./Part.ts";
|
|
10
|
-
export * from "./Payment.ts";
|
|
11
|
-
export * from "./ProtectedAppointment.ts";
|
|
12
|
-
export * from "./Repair.ts";
|
|
13
|
-
export * from "./Service.ts";
|