@dvsa/cvs-type-definitions 9.0.0 → 9.2.0
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/json-schemas/v1/activity/index.json +12 -0
- package/json-schemas/v1/dynamics-test-station/index.json +70 -0
- package/json-schemas/v1/enums/closureReason.enum.json +12 -0
- package/package.json +1 -1
- package/schema-validator.d.ts +1 -0
- package/schema-validator.js +18 -1
- package/schemas.d.ts +1 -1
- package/schemas.js +2 -0
- package/types/v1/activity/index.d.ts +5 -0
- package/types/v1/dynamics-test-station/index.d.ts +25 -0
- package/types/v1/enums/closureReason.enum.d.ts +9 -0
- package/types/v1/enums/closureReason.enum.js +14 -0
- package/types/v1/enums/closureReason.enum.ts +11 -0
|
@@ -133,6 +133,18 @@
|
|
|
133
133
|
},
|
|
134
134
|
"activityDay": {
|
|
135
135
|
"type": "string"
|
|
136
|
+
},
|
|
137
|
+
"closureReason": {
|
|
138
|
+
"title": "Closure Reason Type",
|
|
139
|
+
"type": "string",
|
|
140
|
+
"tsEnumNames": [
|
|
141
|
+
"AUTOCLOSE",
|
|
142
|
+
"MANUAL"
|
|
143
|
+
],
|
|
144
|
+
"enum": [
|
|
145
|
+
"Autoclose",
|
|
146
|
+
"Manual"
|
|
147
|
+
]
|
|
136
148
|
}
|
|
137
149
|
},
|
|
138
150
|
"additionalProperties": false,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Dynamics Test Station Schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"testStationId": {
|
|
6
|
+
"type": "string"
|
|
7
|
+
},
|
|
8
|
+
"testStationPNumber": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"testStationName": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"testStationContactNumber": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"testStationAccessNotes": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"testStationGeneralNotes": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"testStationTown": {
|
|
24
|
+
"type": "string"
|
|
25
|
+
},
|
|
26
|
+
"testStationAddress": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
},
|
|
29
|
+
"testStationPostcode": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
"testStationLongitude": {
|
|
33
|
+
"type": "integer"
|
|
34
|
+
},
|
|
35
|
+
"testStationLatitude": {
|
|
36
|
+
"type": "integer"
|
|
37
|
+
},
|
|
38
|
+
"testStationType": {
|
|
39
|
+
"type": "string"
|
|
40
|
+
},
|
|
41
|
+
"testStationEmails": {
|
|
42
|
+
"type": "array",
|
|
43
|
+
"items": {
|
|
44
|
+
"type": "string"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"searchProperty": {
|
|
48
|
+
"type": "string"
|
|
49
|
+
},
|
|
50
|
+
"testStationCountry": {
|
|
51
|
+
"type": "string"
|
|
52
|
+
},
|
|
53
|
+
"testStationStatus": {
|
|
54
|
+
"type": "string"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"required": [
|
|
58
|
+
"testStationId",
|
|
59
|
+
"testStationPNumber",
|
|
60
|
+
"testStationName",
|
|
61
|
+
"testStationContactNumber",
|
|
62
|
+
"testStationTown",
|
|
63
|
+
"testStationAddress",
|
|
64
|
+
"testStationPostcode",
|
|
65
|
+
"testStationType",
|
|
66
|
+
"testStationEmails",
|
|
67
|
+
"testStationStatus"
|
|
68
|
+
],
|
|
69
|
+
"additionalProperties": false
|
|
70
|
+
}
|
package/package.json
CHANGED
package/schema-validator.d.ts
CHANGED
|
@@ -12,3 +12,4 @@ export declare type Schema = typeof schemas[number];
|
|
|
12
12
|
export declare function isValidObject<B extends boolean | undefined>(schemaName: Schema, objectToValidate: object): boolean;
|
|
13
13
|
export declare function isValidObject<B extends boolean | undefined>(schemaName: Schema, objectToValidate: object, returnErrors: B): B extends false ? boolean : ErrorObject[];
|
|
14
14
|
export declare function isValidObject<B extends boolean | undefined>(schemaName: Schema, objectToValidate: object, returnErrors: B, logErrors: boolean | undefined): B extends false ? boolean : ErrorObject[];
|
|
15
|
+
export declare function validate<B extends boolean | undefined>(schemaObject: object, objectToValidate: object, returnErrors: B, logErrors?: boolean): boolean | ErrorObject<string, Record<string, any>, unknown>[];
|
package/schema-validator.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isValidObject = void 0;
|
|
3
|
+
exports.validate = exports.isValidObject = void 0;
|
|
4
4
|
var ajv_1 = require("ajv");
|
|
5
5
|
var ajv_formats_1 = require("ajv-formats");
|
|
6
6
|
var fs_1 = require("fs");
|
|
@@ -22,3 +22,20 @@ function isValidObject(schemaName, objectToValidate, returnErrors, logErrors) {
|
|
|
22
22
|
return isValid;
|
|
23
23
|
}
|
|
24
24
|
exports.isValidObject = isValidObject;
|
|
25
|
+
function validate(schemaObject, objectToValidate, returnErrors, logErrors) {
|
|
26
|
+
var _a;
|
|
27
|
+
if (logErrors === void 0) { logErrors = false; }
|
|
28
|
+
var ajv = new ajv_1.default({ removeAdditional: true, allErrors: true });
|
|
29
|
+
(0, ajv_formats_1.default)(ajv);
|
|
30
|
+
ajv.addKeyword('tsEnumNames');
|
|
31
|
+
var validateFunction = ajv.compile(schemaObject);
|
|
32
|
+
var isValid = validateFunction(objectToValidate);
|
|
33
|
+
if (logErrors && validateFunction.errors) {
|
|
34
|
+
console.error(validateFunction.errors);
|
|
35
|
+
}
|
|
36
|
+
if (returnErrors) {
|
|
37
|
+
return (_a = validateFunction.errors) !== null && _a !== void 0 ? _a : [];
|
|
38
|
+
}
|
|
39
|
+
return isValid;
|
|
40
|
+
}
|
|
41
|
+
exports.validate = validate;
|
package/schemas.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const schemas: readonly ["enums/euVehicleCategory.enum.json", "enums/vehicleConfiguration.enum.json", "enums/vehicleSize.enum.json", "enums/vehicleSubclass.enum.json", "enums/vehicleType.enum.json", "required-standards/defects/enums/euVehicleCategory.enum.json", "required-standards/defects/get/index.json", "required-standards/defects/requiredStandardTaxonomySection.json", "test-type/enums/testTypeClassification.enum.json", "test-type/get/index.json", "test-type/nextTestTypesOrCategory.json", "test-type/testCode.json", "v1/activity/index.json", "v1/defect-category-reference-data/index.json", "v1/defect-details/index.json", "v1/defect-location/index.json", "v1/enums/activityType.enum.json", "v1/enums/emissionStandard.enum.json", "v1/enums/fuelType.enum.json", "v1/enums/odometerReadingUnits.enum.json", "v1/enums/sources.enum.json", "v1/enums/testResult.enum.json", "v1/enums/testStationType.enum.json", "v1/enums/testStatus.enum.json", "v1/enums/typeOfTest.enum.json", "v1/enums/vehicleType.enum.json", "v1/enums/waitReason.enum.json", "v1/reason-item/index.json", "v1/recalls/index.json", "v1/tech-record/index.json", "v1/test/index.json", "v1/test-result/index.json", "v1/test-result-test-type/index.json", "v1/test-station/index.json", "v1/vehicle/index.json", "v1/vehicle-tech-record/index.json", "v1/visit/index.json", "v3/tech-record/enums/adrAdditionalNotesNumber.enum.json", "v3/tech-record/enums/adrBodyDeclarationType.enum.json", "v3/tech-record/enums/adrBodyType.enum.json", "v3/tech-record/enums/adrCertificateTypes.enum.json", "v3/tech-record/enums/adrCompatibilityGroupJ.enum.json", "v3/tech-record/enums/adrDangerousGood.enum.json", "v3/tech-record/enums/adrTankDetailsTankStatementSelect.enum.json", "v3/tech-record/enums/adrTankStatementSubstancePermitted.json", "v3/tech-record/enums/approvalType.enum.json", "v3/tech-record/enums/approvalTypeHgvOrPsv.enum.json", "v3/tech-record/enums/euVehicleCategory.enum.json", "v3/tech-record/enums/euVehicleCategoryCar.enum.json", "v3/tech-record/enums/euVehicleCategoryHgv.enum.json", "v3/tech-record/enums/euVehicleCategoryLgv.enum.json", "v3/tech-record/enums/euVehicleCategoryPsv.enum.json", "v3/tech-record/enums/euVehicleCategorySmallTrl.enum.json", "v3/tech-record/enums/euVehicleCategoryTrl.enum.json", "v3/tech-record/enums/radioButtonOptions.enum.json", "v3/tech-record/enums/tc3Types.enum.json", "v3/tech-record/enums/tyreUseCodeHgv.enum.json", "v3/tech-record/enums/tyreUseCodeTrl.enum.json", "v3/tech-record/enums/vehicleClassDescription.enum.json", "v3/tech-record/enums/vehicleClassDescriptionPSV.enum.json", "v3/tech-record/enums/vehicleConfigurationHgvPsv.enum.json", "v3/tech-record/enums/vehicleConfigurationLightVehicle.enum.json", "v3/tech-record/enums/vehicleConfigurationTrl.enum.json", "v3/tech-record/enums/vehicleSize.enum.json", "v3/tech-record/get/car/complete/index.json", "v3/tech-record/get/car/skeleton/index.json", "v3/tech-record/get/hgv/complete/index.json", "v3/tech-record/get/hgv/skeleton/index.json", "v3/tech-record/get/hgv/testable/index.json", "v3/tech-record/get/lgv/complete/index.json", "v3/tech-record/get/lgv/skeleton/index.json", "v3/tech-record/get/motorcycle/complete/index.json", "v3/tech-record/get/motorcycle/skeleton/index.json", "v3/tech-record/get/psv/complete/index.json", "v3/tech-record/get/psv/skeleton/index.json", "v3/tech-record/get/psv/testable/index.json", "v3/tech-record/get/search/index.json", "v3/tech-record/get/small trl/complete/index.json", "v3/tech-record/get/small trl/skeleton/index.json", "v3/tech-record/get/trl/complete/index.json", "v3/tech-record/get/trl/skeleton/index.json", "v3/tech-record/get/trl/testable/index.json", "v3/tech-record/put/car/complete/index.json", "v3/tech-record/put/car/skeleton/index.json", "v3/tech-record/put/hgv/complete/index.json", "v3/tech-record/put/hgv/skeleton/index.json", "v3/tech-record/put/hgv/testable/index.json", "v3/tech-record/put/lgv/complete/index.json", "v3/tech-record/put/lgv/skeleton/index.json", "v3/tech-record/put/motorcycle/complete/index.json", "v3/tech-record/put/motorcycle/skeleton/index.json", "v3/tech-record/put/psv/complete/index.json", "v3/tech-record/put/psv/skeleton/index.json", "v3/tech-record/put/psv/testable/index.json", "v3/tech-record/put/small trl/complete/index.json", "v3/tech-record/put/small trl/skeleton/index.json", "v3/tech-record/put/trl/complete/index.json", "v3/tech-record/put/trl/skeleton/index.json", "v3/tech-record/put/trl/testable/index.json"];
|
|
1
|
+
export declare const schemas: readonly ["enums/euVehicleCategory.enum.json", "enums/vehicleConfiguration.enum.json", "enums/vehicleSize.enum.json", "enums/vehicleSubclass.enum.json", "enums/vehicleType.enum.json", "required-standards/defects/enums/euVehicleCategory.enum.json", "required-standards/defects/get/index.json", "required-standards/defects/requiredStandardTaxonomySection.json", "test-type/enums/testTypeClassification.enum.json", "test-type/get/index.json", "test-type/nextTestTypesOrCategory.json", "test-type/testCode.json", "v1/activity/index.json", "v1/defect-category-reference-data/index.json", "v1/defect-details/index.json", "v1/defect-location/index.json", "v1/dynamics-test-station/index.json", "v1/enums/activityType.enum.json", "v1/enums/closureReason.enum.json", "v1/enums/emissionStandard.enum.json", "v1/enums/fuelType.enum.json", "v1/enums/odometerReadingUnits.enum.json", "v1/enums/sources.enum.json", "v1/enums/testResult.enum.json", "v1/enums/testStationType.enum.json", "v1/enums/testStatus.enum.json", "v1/enums/typeOfTest.enum.json", "v1/enums/vehicleType.enum.json", "v1/enums/waitReason.enum.json", "v1/reason-item/index.json", "v1/recalls/index.json", "v1/tech-record/index.json", "v1/test/index.json", "v1/test-result/index.json", "v1/test-result-test-type/index.json", "v1/test-station/index.json", "v1/vehicle/index.json", "v1/vehicle-tech-record/index.json", "v1/visit/index.json", "v3/tech-record/enums/adrAdditionalNotesNumber.enum.json", "v3/tech-record/enums/adrBodyDeclarationType.enum.json", "v3/tech-record/enums/adrBodyType.enum.json", "v3/tech-record/enums/adrCertificateTypes.enum.json", "v3/tech-record/enums/adrCompatibilityGroupJ.enum.json", "v3/tech-record/enums/adrDangerousGood.enum.json", "v3/tech-record/enums/adrTankDetailsTankStatementSelect.enum.json", "v3/tech-record/enums/adrTankStatementSubstancePermitted.json", "v3/tech-record/enums/approvalType.enum.json", "v3/tech-record/enums/approvalTypeHgvOrPsv.enum.json", "v3/tech-record/enums/euVehicleCategory.enum.json", "v3/tech-record/enums/euVehicleCategoryCar.enum.json", "v3/tech-record/enums/euVehicleCategoryHgv.enum.json", "v3/tech-record/enums/euVehicleCategoryLgv.enum.json", "v3/tech-record/enums/euVehicleCategoryPsv.enum.json", "v3/tech-record/enums/euVehicleCategorySmallTrl.enum.json", "v3/tech-record/enums/euVehicleCategoryTrl.enum.json", "v3/tech-record/enums/radioButtonOptions.enum.json", "v3/tech-record/enums/tc3Types.enum.json", "v3/tech-record/enums/tyreUseCodeHgv.enum.json", "v3/tech-record/enums/tyreUseCodeTrl.enum.json", "v3/tech-record/enums/vehicleClassDescription.enum.json", "v3/tech-record/enums/vehicleClassDescriptionPSV.enum.json", "v3/tech-record/enums/vehicleConfigurationHgvPsv.enum.json", "v3/tech-record/enums/vehicleConfigurationLightVehicle.enum.json", "v3/tech-record/enums/vehicleConfigurationTrl.enum.json", "v3/tech-record/enums/vehicleSize.enum.json", "v3/tech-record/get/car/complete/index.json", "v3/tech-record/get/car/skeleton/index.json", "v3/tech-record/get/hgv/complete/index.json", "v3/tech-record/get/hgv/skeleton/index.json", "v3/tech-record/get/hgv/testable/index.json", "v3/tech-record/get/lgv/complete/index.json", "v3/tech-record/get/lgv/skeleton/index.json", "v3/tech-record/get/motorcycle/complete/index.json", "v3/tech-record/get/motorcycle/skeleton/index.json", "v3/tech-record/get/psv/complete/index.json", "v3/tech-record/get/psv/skeleton/index.json", "v3/tech-record/get/psv/testable/index.json", "v3/tech-record/get/search/index.json", "v3/tech-record/get/small trl/complete/index.json", "v3/tech-record/get/small trl/skeleton/index.json", "v3/tech-record/get/trl/complete/index.json", "v3/tech-record/get/trl/skeleton/index.json", "v3/tech-record/get/trl/testable/index.json", "v3/tech-record/put/car/complete/index.json", "v3/tech-record/put/car/skeleton/index.json", "v3/tech-record/put/hgv/complete/index.json", "v3/tech-record/put/hgv/skeleton/index.json", "v3/tech-record/put/hgv/testable/index.json", "v3/tech-record/put/lgv/complete/index.json", "v3/tech-record/put/lgv/skeleton/index.json", "v3/tech-record/put/motorcycle/complete/index.json", "v3/tech-record/put/motorcycle/skeleton/index.json", "v3/tech-record/put/psv/complete/index.json", "v3/tech-record/put/psv/skeleton/index.json", "v3/tech-record/put/psv/testable/index.json", "v3/tech-record/put/small trl/complete/index.json", "v3/tech-record/put/small trl/skeleton/index.json", "v3/tech-record/put/trl/complete/index.json", "v3/tech-record/put/trl/skeleton/index.json", "v3/tech-record/put/trl/testable/index.json"];
|
package/schemas.js
CHANGED
|
@@ -18,7 +18,9 @@ exports.schemas = [
|
|
|
18
18
|
"v1/defect-category-reference-data/index.json",
|
|
19
19
|
"v1/defect-details/index.json",
|
|
20
20
|
"v1/defect-location/index.json",
|
|
21
|
+
"v1/dynamics-test-station/index.json",
|
|
21
22
|
"v1/enums/activityType.enum.json",
|
|
23
|
+
"v1/enums/closureReason.enum.json",
|
|
22
24
|
"v1/enums/emissionStandard.enum.json",
|
|
23
25
|
"v1/enums/fuelType.enum.json",
|
|
24
26
|
"v1/enums/odometerReadingUnits.enum.json",
|
|
@@ -21,6 +21,7 @@ export interface ActivitySchema {
|
|
|
21
21
|
waitReason?: WaitReason[];
|
|
22
22
|
notes?: string | null;
|
|
23
23
|
activityDay?: string;
|
|
24
|
+
closureReason?: ClosureReasonType;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export enum ActivityType {
|
|
@@ -42,3 +43,7 @@ export enum WaitReason {
|
|
|
42
43
|
SITE_ISSUE = "Site issue",
|
|
43
44
|
OTHER = "Other"
|
|
44
45
|
}
|
|
46
|
+
export enum ClosureReasonType {
|
|
47
|
+
AUTOCLOSE = "Autoclose",
|
|
48
|
+
MANUAL = "Manual"
|
|
49
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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 DynamicsTestStationSchema {
|
|
9
|
+
testStationId: string;
|
|
10
|
+
testStationPNumber: string;
|
|
11
|
+
testStationName: string;
|
|
12
|
+
testStationContactNumber: string;
|
|
13
|
+
testStationAccessNotes?: string;
|
|
14
|
+
testStationGeneralNotes?: string;
|
|
15
|
+
testStationTown: string;
|
|
16
|
+
testStationAddress: string;
|
|
17
|
+
testStationPostcode: string;
|
|
18
|
+
testStationLongitude?: number;
|
|
19
|
+
testStationLatitude?: number;
|
|
20
|
+
testStationType: string;
|
|
21
|
+
testStationEmails: string[];
|
|
22
|
+
searchProperty?: string;
|
|
23
|
+
testStationCountry?: string;
|
|
24
|
+
testStationStatus: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
4
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum ClosureReasonType {
|
|
7
|
+
AUTOCLOSE = "Autoclose",
|
|
8
|
+
MANUAL = "Manual"
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/**
|
|
4
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
5
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
6
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ClosureReasonType = void 0;
|
|
10
|
+
var ClosureReasonType;
|
|
11
|
+
(function (ClosureReasonType) {
|
|
12
|
+
ClosureReasonType["AUTOCLOSE"] = "Autoclose";
|
|
13
|
+
ClosureReasonType["MANUAL"] = "Manual";
|
|
14
|
+
})(ClosureReasonType = exports.ClosureReasonType || (exports.ClosureReasonType = {}));
|
|
@@ -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 enum ClosureReasonType {
|
|
9
|
+
AUTOCLOSE = "Autoclose",
|
|
10
|
+
MANUAL = "Manual"
|
|
11
|
+
}
|