@dvsa/cvs-type-definitions 1.0.11

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.
Files changed (33) hide show
  1. package/README.md +53 -0
  2. package/json-schemas/.DS_Store +0 -0
  3. package/json-schemas/activity/index.json +62 -0
  4. package/json-schemas/defect-category-reference-data/index.json +440 -0
  5. package/json-schemas/defect-details/index.json +265 -0
  6. package/json-schemas/defect-location/index.json +49 -0
  7. package/json-schemas/reason-item/index.json +17 -0
  8. package/json-schemas/tech-record/index.json +639 -0
  9. package/json-schemas/test/index.json +1843 -0
  10. package/json-schemas/test-result/index.json +636 -0
  11. package/json-schemas/test-station/index.json +67 -0
  12. package/json-schemas/test-type/index.json +479 -0
  13. package/json-schemas/vehicle/index.json +1804 -0
  14. package/json-schemas/vehicle-tech-record/index.json +683 -0
  15. package/json-schemas/visit/index.json +1895 -0
  16. package/lib/schemas.d.ts +1 -0
  17. package/lib/schemas.js +18 -0
  18. package/lib/src/schema-validation/schema-validator.d.ts +3 -0
  19. package/lib/src/schema-validation/schema-validator.js +22 -0
  20. package/package.json +35 -0
  21. package/types/activity/index.d.ts +23 -0
  22. package/types/defect-category-reference-data/index.d.ts +52 -0
  23. package/types/defect-details/index.d.ts +53 -0
  24. package/types/defect-location/index.d.ts +16 -0
  25. package/types/reason-item/index.d.ts +11 -0
  26. package/types/tech-record/index.d.ts +202 -0
  27. package/types/test/index.d.ts +353 -0
  28. package/types/test-result/index.d.ts +136 -0
  29. package/types/test-station/index.d.ts +23 -0
  30. package/types/test-type/index.d.ts +98 -0
  31. package/types/vehicle/index.d.ts +345 -0
  32. package/types/vehicle-tech-record/index.d.ts +212 -0
  33. package/types/visit/index.d.ts +366 -0
@@ -0,0 +1 @@
1
+ export declare const schemas: readonly ["test", "visit", "test-station", "defect-category-reference-data", "defect-details", "defect-location", "tech-record", "vehicle", "test-result", "vehicle-tech-record", "activity", "test-type", "reason-item"];
package/lib/schemas.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.schemas = void 0;
4
+ exports.schemas = [
5
+ 'test',
6
+ 'visit',
7
+ 'test-station',
8
+ 'defect-category-reference-data',
9
+ 'defect-details',
10
+ 'defect-location',
11
+ 'tech-record',
12
+ 'vehicle',
13
+ 'test-result',
14
+ 'vehicle-tech-record',
15
+ 'activity',
16
+ 'test-type',
17
+ 'reason-item'
18
+ ];
@@ -0,0 +1,3 @@
1
+ import { schemas } from '../../schemas';
2
+ export declare type Schema = typeof schemas[number];
3
+ export declare const isValidObject: (schemaName: Schema, objectToValidate: object) => boolean;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidObject = void 0;
4
+ var Enjoi = require('enjoi');
5
+ var isValidObject = function (schemaName, objectToValidate) {
6
+ var schemaPath = "json-schemas/".concat(schemaName, "/index.json");
7
+ var schemaFile = require(schemaPath);
8
+ var schema = Enjoi.schema(schemaFile);
9
+ var error = schema.validate(objectToValidate).error;
10
+ if (error) {
11
+ console.error("Object failed validation against ".concat(schemaName, " Schema. Failures: "));
12
+ error.details.forEach(function (errorDetail) {
13
+ console.log(errorDetail.message);
14
+ });
15
+ }
16
+ else {
17
+ console.log('*********schema passes validation********');
18
+ }
19
+ return !error;
20
+ };
21
+ exports.isValidObject = isValidObject;
22
+ (0, exports.isValidObject)('test-result', {});
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@dvsa/cvs-type-definitions",
3
+ "version": "1.0.11",
4
+ "description": "type definitions for cvs vta application",
5
+ "main": "index.js",
6
+ "files": [
7
+ "lib/**/*",
8
+ "json-schemas/**/*",
9
+ "types/**/*"
10
+ ],
11
+ "repository": {
12
+ "url": "git://github.com/dvsa/cvs-type-definitions.git"
13
+ },
14
+ "scripts": {
15
+ "build": "tsc",
16
+ "test": "test",
17
+ "generate": "ts-node generateSchemas.ts"
18
+ },
19
+ "author": "dvsa",
20
+ "license": "ISC",
21
+ "devDependencies": {
22
+ "@types/node": "^18.11.5",
23
+ "json-schema-to-typescript": "^11.0.2",
24
+ "ts-node": "^10.9.1",
25
+ "tsconfig-paths": "^4.1.0",
26
+ "typescript": "^4.8.4"
27
+ },
28
+ "dependencies": {
29
+ "enjoi": "^9.0.1",
30
+ "joi": "^17.6.4",
31
+ "json-schema-deref-sync": "^0.14.0",
32
+ "pretty-js": "^0.2.2",
33
+ "util": "^0.12.5"
34
+ }
35
+ }
@@ -0,0 +1,23 @@
1
+ /* tslint:disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+
8
+ export interface ActivitySchema {
9
+ activityType: string;
10
+ testStationName: string;
11
+ testStationPNumber: string;
12
+ testStationEmail: string;
13
+ testStationType: string;
14
+ testerName: string;
15
+ testerStaffId: string;
16
+ testerEmail?: string;
17
+ startTime: string;
18
+ endTime?: string;
19
+ parentId?: string;
20
+ waitReason?: string[];
21
+ notes?: string;
22
+ id?: string;
23
+ }
@@ -0,0 +1,52 @@
1
+ /* tslint:disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+
8
+ export interface DefectCategoryReferenceDataSchema {
9
+ imNumber: number;
10
+ imDescription: string;
11
+ forVehicleType: string[];
12
+ additionalInfo: AdditionalInfoSchema;
13
+ items: DefectItemReferenceDataSchema[];
14
+ }
15
+ export interface AdditionalInfoSchema {
16
+ psv: {
17
+ location?: DefectLocationMetadataSchema;
18
+ notes?: boolean;
19
+ };
20
+ hgv: {
21
+ location?: DefectLocationMetadataSchema;
22
+ notes?: boolean;
23
+ };
24
+ trl: {
25
+ location?: DefectLocationMetadataSchema;
26
+ notes?: boolean;
27
+ };
28
+ }
29
+ export interface DefectLocationMetadataSchema {
30
+ vertical?: string[] | null;
31
+ horizontal?: string[] | null;
32
+ lateral?: string[] | null;
33
+ longitudinal?: string[] | null;
34
+ rowNumber?: number[] | null;
35
+ seatNumber?: number[] | null;
36
+ axleNumber?: number[] | null;
37
+ }
38
+ export interface DefectItemReferenceDataSchema {
39
+ itemNumber?: number;
40
+ itemDescription?: string;
41
+ forVehicleType?: string[];
42
+ deficiencies?: DefectDeficiencyReferenceDataSchema[];
43
+ }
44
+ export interface DefectDeficiencyReferenceDataSchema {
45
+ ref: string;
46
+ deficiencyId: string | null;
47
+ deficiencySubId: string;
48
+ deficiencyCategory: string;
49
+ deficiencyText: string;
50
+ stdForProhibition: boolean;
51
+ forVehicleType: string[] | ("psv" | "hgv" | "trl" | "car" | "lgv" | "motorcycle");
52
+ }
@@ -0,0 +1,53 @@
1
+ /* tslint:disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+
8
+ export interface DefectDetailsSchema {
9
+ imNumber: number;
10
+ imDescription: string;
11
+ additionalInformation: {
12
+ location: DefectLocationSchema;
13
+ notes: string;
14
+ };
15
+ itemNumber: number;
16
+ itemDescription: string;
17
+ deficiencyRef: string;
18
+ deficiencyId: string | null;
19
+ deficiencySubId: string | null;
20
+ deficiencyCategory: string;
21
+ deficiencyText: string | null;
22
+ stdForProhibition: boolean | null;
23
+ prs: boolean | null;
24
+ prohibitionIssued: boolean | null;
25
+ metadata: DefectMetadataSchema;
26
+ }
27
+ export interface DefectLocationSchema {
28
+ vertical?: string | null;
29
+ horizontal?: string | null;
30
+ lateral?: string | null;
31
+ longitudinal?: string | null;
32
+ rowNumber?: number | null;
33
+ seatNumber?: number | null;
34
+ axleNumber?: number | null;
35
+ }
36
+ export interface DefectMetadataSchema {
37
+ category: {
38
+ additionalInfo?: DefectAdditionalDetailsMetadataSchema;
39
+ };
40
+ }
41
+ export interface DefectAdditionalDetailsMetadataSchema {
42
+ location: DefectLocationMetadataSchema;
43
+ notes: boolean;
44
+ }
45
+ export interface DefectLocationMetadataSchema {
46
+ vertical?: string[] | null;
47
+ horizontal?: string[] | null;
48
+ lateral?: string[] | null;
49
+ longitudinal?: string[] | null;
50
+ rowNumber?: number[] | null;
51
+ seatNumber?: number[] | null;
52
+ axleNumber?: number[] | null;
53
+ }
@@ -0,0 +1,16 @@
1
+ /* tslint:disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+
8
+ export interface DefectLocationSchema {
9
+ vertical?: string | null;
10
+ horizontal?: string | null;
11
+ lateral?: string | null;
12
+ longitudinal?: string | null;
13
+ rowNumber?: number | null;
14
+ seatNumber?: number | null;
15
+ axleNumber?: number | null;
16
+ }
@@ -0,0 +1,11 @@
1
+ /* tslint:disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+
8
+ export interface ReasonItemSchema {
9
+ text: string;
10
+ isChecked: boolean;
11
+ }
@@ -0,0 +1,202 @@
1
+ /* tslint:disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+
8
+ export interface TechRecordSchema {
9
+ bodyType: {
10
+ code: string;
11
+ description: string;
12
+ };
13
+ manufactureYear: number;
14
+ regnDate: string;
15
+ ntaNumber: string;
16
+ conversionRefNo: string;
17
+ speedLimiterMrk: boolean;
18
+ tachoExemptMrk: boolean;
19
+ reasonForCreation: string;
20
+ statusCode: string;
21
+ grossKerbWeight: number;
22
+ grossLadenWeight: number;
23
+ noOfAxles: number;
24
+ brakeCode: string;
25
+ vehicleType: string;
26
+ euVehicleCategory: string;
27
+ axles: AxleSchema[];
28
+ vehicleClass: VehicleClassSchema;
29
+ vehicleSubclass: string[];
30
+ vehicleConfiguration: string;
31
+ recordCompleteness?: string;
32
+ chassisMake?: string;
33
+ chassisModel?: string;
34
+ bodyMake?: string;
35
+ bodyModel?: string;
36
+ vehicleSize?: string;
37
+ coifDate?: string;
38
+ unladenWeight?: number;
39
+ grossGbWeight?: number;
40
+ grossDesignWeight?: number;
41
+ grossUnladenWeight?: number;
42
+ seatsLowerDeck?: number;
43
+ seatsUpperDeck?: number;
44
+ standingCapacity?: number;
45
+ speedRestriction?: number;
46
+ dispensations?: string;
47
+ remarks?: string;
48
+ brakes?: Brake;
49
+ make?: string;
50
+ model?: string;
51
+ functionCode?: string;
52
+ typeUseCode?: string;
53
+ roadFriendly?: boolean;
54
+ drawbarCouplingFitted?: boolean;
55
+ dimensions?: DimensionsSchema;
56
+ notes: string;
57
+ adrDetails?: ADRDetailsSchema;
58
+ trainGbWeight?: number;
59
+ trainDesignWeight?: number;
60
+ maxTrainGbWeight?: number;
61
+ maxTrainDesignWeight?: number;
62
+ euroStandard?: number;
63
+ frontAxleTo5thWheelMin?: number;
64
+ frontAxleTo5thWheelMax?: number;
65
+ frontAxleTo5thWheelCouplingMin?: number;
66
+ frontAxleTo5thWheelCouplingMax?: number;
67
+ firstUseDate?: string;
68
+ maxLoadOnCoupling?: number;
69
+ suspensionType?: string;
70
+ couplingType?: string;
71
+ frontAxleToRearAxle?: number;
72
+ rearAxleToRearTrl?: number;
73
+ couplingCenterToRearAxleMin?: number;
74
+ couplingCenterToRearAxleMax?: number;
75
+ couplingCenterToRearTrlMin?: number;
76
+ couplingCenterToRearTrlMax?: number;
77
+ numberOfWheelsDriven?: number;
78
+ }
79
+ export interface AxleSchema {
80
+ parkingBrakeMrk?: boolean;
81
+ axleNumber: number;
82
+ weights?: WeightsSchema;
83
+ tyres: TyresSchema;
84
+ brakes?: AxleBrakePropertiesSchema;
85
+ }
86
+ export interface WeightsSchema {
87
+ kerbWeight?: number;
88
+ ladenWeight?: number;
89
+ gbWeight: number;
90
+ designWeight: number;
91
+ }
92
+ export interface TyresSchema {
93
+ tyreSize: string;
94
+ plyRating: string;
95
+ fitmentCode: string;
96
+ dataTrPsvAxles?: number;
97
+ tyreCode: number;
98
+ dataTrAxles?: number;
99
+ /**
100
+ * PSV only
101
+ */
102
+ speedCategorySymbol?: string;
103
+ }
104
+ export interface AxleBrakePropertiesSchema {
105
+ brakeActuator: number;
106
+ leverLength: number;
107
+ springBrakeParking: boolean;
108
+ }
109
+ export interface VehicleClassSchema {
110
+ code: string;
111
+ description: string;
112
+ }
113
+ export interface Brake {
114
+ brakeCode?: string;
115
+ dataTrBrakeOne?: string;
116
+ dataTrBrakeTwo?: string;
117
+ dataTrBrakeThree?: string;
118
+ retarderBrakeOne?: string;
119
+ retarderBrakeTwo?: string;
120
+ brakeCodeOriginal?: string;
121
+ brakeForceWheelsNotLocked?: BrakeForceWheel;
122
+ brakeForceWheelsUpToHalfLocked?: BrakeForceWheel;
123
+ dtpNumber?: string;
124
+ loadSensingValve?: boolean;
125
+ antilockBrakingSystem?: boolean;
126
+ }
127
+ export interface BrakeForceWheel {
128
+ serviceBrakeForce: number;
129
+ secondaryBrakeForce: number;
130
+ parkingBrakeForce: number;
131
+ }
132
+ export interface DimensionsSchema {
133
+ length: number;
134
+ width: number;
135
+ /**
136
+ * @minItems 1
137
+ * @maxItems 1
138
+ */
139
+ axleSpacing: [
140
+ {
141
+ axles: string;
142
+ value: number;
143
+ }
144
+ ];
145
+ }
146
+ export interface ADRDetailsSchema {
147
+ vehicleDetails?: {
148
+ type?: string;
149
+ approvalDate?: string;
150
+ };
151
+ listStatementApplicable?: boolean;
152
+ batteryListNumber?: string;
153
+ permittedDangerousGoods?: string[];
154
+ additionalExaminerNotes?: string;
155
+ applicantDetails?: ApplicantDetailsSchema;
156
+ memosApply?: string[];
157
+ additionalNotes?: {
158
+ number?: string[];
159
+ guidanceNotes?: string[];
160
+ };
161
+ adrTypeApprovalNo?: string;
162
+ compatibilityGroupJ?: boolean;
163
+ tank?: TankSchema;
164
+ }
165
+ export interface ApplicantDetailsSchema {
166
+ name?: string;
167
+ street?: string;
168
+ town?: string;
169
+ city?: string;
170
+ postcode?: string;
171
+ }
172
+ export interface TankSchema {
173
+ tankDetails?: TankDetailsSchema;
174
+ tankStatement?: TankStatementSchema;
175
+ }
176
+ export interface TankDetailsSchema {
177
+ tankManufacturer?: string;
178
+ tc2Details?: TC2DetailsSchema;
179
+ tc3Details?: TC3DetailsSchema[];
180
+ yearOfManufacture?: string;
181
+ tankCode?: string;
182
+ specialProvisions?: string;
183
+ tankManufacturerSerialNo?: string;
184
+ tankTypeAppNo?: string;
185
+ }
186
+ export interface TC2DetailsSchema {
187
+ tc2Type?: string;
188
+ tc2IntermediateApprovalNo?: string;
189
+ tc2IntermediateExpiryDate?: string;
190
+ }
191
+ export interface TC3DetailsSchema {
192
+ tc3Type?: string;
193
+ tc3IntermediateApprovalNo?: string;
194
+ tc3IntermediateExpiryDate?: string;
195
+ }
196
+ export interface TankStatementSchema {
197
+ substancesPermitted?: string;
198
+ statement?: string;
199
+ productList?: string;
200
+ productListRefNo?: string;
201
+ productListUnNo?: string[];
202
+ }