@openframe-org/criteria-set-protocol 1.5.20 → 2.0.0-beta.10
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/README.md +3 -3
- package/dist/services/i-versioned.service.d.ts +16 -0
- package/dist/services/i-versioned.service.js +2 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +18 -0
- package/dist/services/versions.service.d.ts +38 -0
- package/dist/services/versions.service.js +49 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +2 -0
- package/dist/v1/schemas/certification.d.ts +21 -50
- package/dist/v1/schemas/certification.js +8 -9
- package/dist/v1/schemas/common.d.ts +143 -0
- package/dist/v1/schemas/common.js +44 -0
- package/dist/v1/schemas/criteria-set-id-param-schema.d.ts +11 -0
- package/dist/v1/schemas/criteria-set-id-param-schema.js +11 -0
- package/dist/v1/schemas/criteria-tree.d.ts +5662 -235
- package/dist/v1/schemas/criteria-tree.js +14 -3
- package/dist/v1/schemas/criterion.d.ts +423 -146
- package/dist/v1/schemas/criterion.js +9 -10
- package/dist/v1/schemas/documentation.d.ts +101 -0
- package/dist/v1/schemas/documentation.js +25 -0
- package/dist/v1/schemas/download-matrix-body-schema.d.ts +15 -0
- package/dist/v1/schemas/download-matrix-body-schema.js +36 -0
- package/dist/v1/schemas/index.d.ts +7 -4
- package/dist/v1/schemas/index.js +7 -4
- package/dist/v1/schemas/matrix-body-schema.d.ts +20 -0
- package/dist/v1/schemas/matrix-body-schema.js +14 -0
- package/dist/v1/schemas/metadata.d.ts +2 -2
- package/dist/v1/schemas/quality.d.ts +498 -181
- package/dist/v1/schemas/quality.js +2 -2
- package/dist/v1/schemas/request/index.d.ts +2 -2
- package/dist/v1/schemas/request/index.js +2 -2
- package/dist/v1/schemas/request/matrix-request-body-schema.d.ts +20 -0
- package/dist/v1/schemas/request/matrix-request-body-schema.js +16 -0
- package/dist/v1/schemas/request/tree-and-data-request-body-schema.d.ts +17 -0
- package/dist/v1/schemas/request/tree-and-data-request-body-schema.js +15 -0
- package/dist/v1/schemas/response.d.ts +62 -0
- package/dist/v1/schemas/response.js +12 -0
- package/dist/v1/schemas/task-group.d.ts +302 -108
- package/dist/v1/schemas/task-group.js +9 -10
- package/dist/v1/schemas/task-item.d.ts +180 -170
- package/dist/v1/schemas/task-item.js +23 -48
- package/dist/v1/schemas/task.d.ts +196 -74
- package/dist/v1/schemas/task.js +8 -9
- package/dist/v1/schemas/theme.d.ts +1882 -0
- package/dist/v1/schemas/theme.js +19 -0
- package/dist/v1/schemas/tree-and-data-body-schema.d.ts +17 -0
- package/dist/v1/schemas/tree-and-data-body-schema.js +13 -0
- package/dist/v1/schemas/tree-and-matrix-body-schema.d.ts +19 -0
- package/dist/v1/schemas/tree-and-matrix-body-schema.js +38 -0
- package/dist/v1/schemas/tree-body-schema.d.ts +17 -0
- package/dist/v1/schemas/tree-body-schema.js +37 -0
- package/dist/v1/schemas/version-param-schema.d.ts +11 -0
- package/dist/v1/schemas/version-param-schema.js +11 -0
- package/dist/v1/services/i-protocol-v1.service.d.ts +26 -0
- package/dist/v1/services/i-protocol-v1.service.js +2 -0
- package/dist/v1/types/criteria.d.ts +41 -157
- package/dist/v1/types/criteria.js +0 -9
- package/dist/v1/types/express.d.ts +6 -16
- package/dist/v1/utils/color.d.ts +2 -0
- package/dist/v1/utils/color.js +10 -0
- package/dist/v1/utils/index.d.ts +7 -0
- package/dist/v1/utils/index.js +15 -0
- package/dist/v1/utils.d.ts +632 -19
- package/dist/v1/utils.js +8 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,12 +27,12 @@ The library contains the types defined in the protocol v1 specification, and a s
|
|
|
27
27
|
| -------------------------- | --------------------------------------------------- |
|
|
28
28
|
| **Metadata types** | |
|
|
29
29
|
| `Metadata` | |
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
30
|
+
| `Theme` | |
|
|
31
|
+
| `ThemeStyle` | |
|
|
32
32
|
| `Color` | |
|
|
33
33
|
| **Task tree types** | |
|
|
34
34
|
| `CriteriaTree` | |
|
|
35
|
-
| `
|
|
35
|
+
| `Theme` | |
|
|
36
36
|
| `Criterion` | |
|
|
37
37
|
| `TaskGroup` | |
|
|
38
38
|
| `Task` | |
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ProtocolVersionServiceMap } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for versioned services
|
|
4
|
+
*
|
|
5
|
+
* Services that implement this interface can be managed by the VersionsService
|
|
6
|
+
*/
|
|
7
|
+
export interface IVersionedService {
|
|
8
|
+
/**
|
|
9
|
+
* The SemVer version of the service
|
|
10
|
+
*/
|
|
11
|
+
version: string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the service supports the given protocol version
|
|
14
|
+
*/
|
|
15
|
+
supportsProtocol: <ProtocolVersion extends number>(protocolVersion: ProtocolVersion) => this is ProtocolVersionServiceMap<ProtocolVersion>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./i-versioned.service"), exports);
|
|
18
|
+
__exportStar(require("./versions.service"), exports);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { IVersionedService } from './i-versioned.service';
|
|
2
|
+
import { ProtocolVersionServiceMap } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Service for managing versions of services
|
|
5
|
+
*
|
|
6
|
+
* The VersionsService class is a utility class for services which implement different versions of the protocol, and different versions of their
|
|
7
|
+
* own service. For example, say you have a v1service, v11service, v2service and v21service with versions 1.0, 1.1, 2.0 and 2.1 respectively.
|
|
8
|
+
* The VersionsService class can be used to manage these services:
|
|
9
|
+
*
|
|
10
|
+
* const versionsService = new VersionsService([v1service, v11service, v2service, v21service]);
|
|
11
|
+
* versionsService.getLatestVersion(); // v21service
|
|
12
|
+
* versionsService.getServiceVersions(1); // [v1service, v11service]
|
|
13
|
+
* versionsService.getServiceVersions(2); // [v2service, v21service]
|
|
14
|
+
* versionsService.get('1.1'); // v11service
|
|
15
|
+
*/
|
|
16
|
+
export declare class VersionsService {
|
|
17
|
+
protected versions: IVersionedService[];
|
|
18
|
+
/**
|
|
19
|
+
* @param versions An array of services implementing IVersionedService
|
|
20
|
+
*/
|
|
21
|
+
constructor(versions: IVersionedService[]);
|
|
22
|
+
/**
|
|
23
|
+
* Get all services
|
|
24
|
+
*/
|
|
25
|
+
getAll(): IVersionedService[];
|
|
26
|
+
/**
|
|
27
|
+
* Retrieve the services which are compatible with the requested protocol version
|
|
28
|
+
*/
|
|
29
|
+
getServiceVersions<ProtocolVersion extends number, ProtocolImplementingService = ProtocolVersionServiceMap<ProtocolVersion>>(protocolVersion: ProtocolVersion): ProtocolImplementingService[];
|
|
30
|
+
/**
|
|
31
|
+
* Retrieve a service by version
|
|
32
|
+
*/
|
|
33
|
+
get(version: string): IVersionedService | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Retrieve the latest service
|
|
36
|
+
*/
|
|
37
|
+
getLatestVersion(): IVersionedService;
|
|
38
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VersionsService = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Service for managing versions of services
|
|
6
|
+
*
|
|
7
|
+
* The VersionsService class is a utility class for services which implement different versions of the protocol, and different versions of their
|
|
8
|
+
* own service. For example, say you have a v1service, v11service, v2service and v21service with versions 1.0, 1.1, 2.0 and 2.1 respectively.
|
|
9
|
+
* The VersionsService class can be used to manage these services:
|
|
10
|
+
*
|
|
11
|
+
* const versionsService = new VersionsService([v1service, v11service, v2service, v21service]);
|
|
12
|
+
* versionsService.getLatestVersion(); // v21service
|
|
13
|
+
* versionsService.getServiceVersions(1); // [v1service, v11service]
|
|
14
|
+
* versionsService.getServiceVersions(2); // [v2service, v21service]
|
|
15
|
+
* versionsService.get('1.1'); // v11service
|
|
16
|
+
*/
|
|
17
|
+
class VersionsService {
|
|
18
|
+
/**
|
|
19
|
+
* @param versions An array of services implementing IVersionedService
|
|
20
|
+
*/
|
|
21
|
+
constructor(versions) {
|
|
22
|
+
this.versions = versions;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get all services
|
|
26
|
+
*/
|
|
27
|
+
getAll() {
|
|
28
|
+
return this.versions;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Retrieve the services which are compatible with the requested protocol version
|
|
32
|
+
*/
|
|
33
|
+
getServiceVersions(protocolVersion) {
|
|
34
|
+
return this.versions.filter((service) => service.supportsProtocol(protocolVersion));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Retrieve a service by version
|
|
38
|
+
*/
|
|
39
|
+
get(version) {
|
|
40
|
+
return this.versions.find((service) => service.version === version);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Retrieve the latest service
|
|
44
|
+
*/
|
|
45
|
+
getLatestVersion() {
|
|
46
|
+
return this.versions[this.versions.length - 1];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.VersionsService = VersionsService;
|
package/dist/types.d.ts
ADDED
package/dist/types.js
ADDED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const certificationDefinitionTypeSchema: z.
|
|
2
|
+
export declare const certificationDefinitionTypeSchema: z.ZodEnum<["number", "percentage"]>;
|
|
3
3
|
export declare const numberBasedCertificationDefinitionRulesSchema: z.ZodObject<{
|
|
4
4
|
minimum: z.ZodOptional<z.ZodNumber>;
|
|
5
5
|
exclusiveMinimum: z.ZodOptional<z.ZodNumber>;
|
|
@@ -32,38 +32,12 @@ export declare const percentageBasedCertificationDefinitionRulesSchema: z.ZodObj
|
|
|
32
32
|
exclusiveMinimum?: number | undefined;
|
|
33
33
|
exclusiveMaximum?: number | undefined;
|
|
34
34
|
}>;
|
|
35
|
-
export declare const abstractCertificationDefinitionSchema: z.ZodObject<{
|
|
36
|
-
code: z.ZodString;
|
|
37
|
-
type: z.ZodUnion<[z.ZodLiteral<"number">, z.ZodLiteral<"percentage">]>;
|
|
38
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
39
|
-
name: z.ZodString;
|
|
40
|
-
description: z.ZodOptional<z.ZodString>;
|
|
41
|
-
rules: z.ZodAny;
|
|
42
|
-
rulesText: z.ZodString;
|
|
43
|
-
}, "strip", z.ZodTypeAny, {
|
|
44
|
-
code: string;
|
|
45
|
-
name: string;
|
|
46
|
-
type: "number" | "percentage";
|
|
47
|
-
rulesText: string;
|
|
48
|
-
description?: string | undefined;
|
|
49
|
-
icon?: string | undefined;
|
|
50
|
-
rules?: any;
|
|
51
|
-
}, {
|
|
52
|
-
code: string;
|
|
53
|
-
name: string;
|
|
54
|
-
type: "number" | "percentage";
|
|
55
|
-
rulesText: string;
|
|
56
|
-
description?: string | undefined;
|
|
57
|
-
icon?: string | undefined;
|
|
58
|
-
rules?: any;
|
|
59
|
-
}>;
|
|
60
35
|
export declare const numberBasedCertificationDefinitionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
36
|
+
type: z.ZodEnum<["number", "percentage"]>;
|
|
61
37
|
code: z.ZodString;
|
|
62
|
-
type: z.ZodUnion<[z.ZodLiteral<"number">, z.ZodLiteral<"percentage">]>;
|
|
63
38
|
icon: z.ZodOptional<z.ZodString>;
|
|
64
39
|
name: z.ZodString;
|
|
65
40
|
description: z.ZodOptional<z.ZodString>;
|
|
66
|
-
rules: z.ZodAny;
|
|
67
41
|
rulesText: z.ZodString;
|
|
68
42
|
}, {
|
|
69
43
|
type: z.ZodLiteral<"number">;
|
|
@@ -84,39 +58,38 @@ export declare const numberBasedCertificationDefinitionSchema: z.ZodObject<z.obj
|
|
|
84
58
|
exclusiveMaximum?: number | undefined;
|
|
85
59
|
}>;
|
|
86
60
|
}>, "strip", z.ZodTypeAny, {
|
|
61
|
+
type: "number";
|
|
87
62
|
code: string;
|
|
88
63
|
name: string;
|
|
89
|
-
|
|
64
|
+
rulesText: string;
|
|
90
65
|
rules: {
|
|
91
66
|
minimum?: number | undefined;
|
|
92
67
|
maximum?: number | undefined;
|
|
93
68
|
exclusiveMinimum?: number | undefined;
|
|
94
69
|
exclusiveMaximum?: number | undefined;
|
|
95
70
|
};
|
|
96
|
-
rulesText: string;
|
|
97
71
|
description?: string | undefined;
|
|
98
72
|
icon?: string | undefined;
|
|
99
73
|
}, {
|
|
74
|
+
type: "number";
|
|
100
75
|
code: string;
|
|
101
76
|
name: string;
|
|
102
|
-
|
|
77
|
+
rulesText: string;
|
|
103
78
|
rules: {
|
|
104
79
|
minimum?: number | undefined;
|
|
105
80
|
maximum?: number | undefined;
|
|
106
81
|
exclusiveMinimum?: number | undefined;
|
|
107
82
|
exclusiveMaximum?: number | undefined;
|
|
108
83
|
};
|
|
109
|
-
rulesText: string;
|
|
110
84
|
description?: string | undefined;
|
|
111
85
|
icon?: string | undefined;
|
|
112
86
|
}>;
|
|
113
87
|
export declare const percentageBasedCertificationDefinitionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
88
|
+
type: z.ZodEnum<["number", "percentage"]>;
|
|
114
89
|
code: z.ZodString;
|
|
115
|
-
type: z.ZodUnion<[z.ZodLiteral<"number">, z.ZodLiteral<"percentage">]>;
|
|
116
90
|
icon: z.ZodOptional<z.ZodString>;
|
|
117
91
|
name: z.ZodString;
|
|
118
92
|
description: z.ZodOptional<z.ZodString>;
|
|
119
|
-
rules: z.ZodAny;
|
|
120
93
|
rulesText: z.ZodString;
|
|
121
94
|
}, {
|
|
122
95
|
type: z.ZodLiteral<"percentage">;
|
|
@@ -137,39 +110,38 @@ export declare const percentageBasedCertificationDefinitionSchema: z.ZodObject<z
|
|
|
137
110
|
exclusiveMaximum?: number | undefined;
|
|
138
111
|
}>;
|
|
139
112
|
}>, "strip", z.ZodTypeAny, {
|
|
113
|
+
type: "percentage";
|
|
140
114
|
code: string;
|
|
141
115
|
name: string;
|
|
142
|
-
|
|
116
|
+
rulesText: string;
|
|
143
117
|
rules: {
|
|
144
118
|
minimum?: number | undefined;
|
|
145
119
|
maximum?: number | undefined;
|
|
146
120
|
exclusiveMinimum?: number | undefined;
|
|
147
121
|
exclusiveMaximum?: number | undefined;
|
|
148
122
|
};
|
|
149
|
-
rulesText: string;
|
|
150
123
|
description?: string | undefined;
|
|
151
124
|
icon?: string | undefined;
|
|
152
125
|
}, {
|
|
126
|
+
type: "percentage";
|
|
153
127
|
code: string;
|
|
154
128
|
name: string;
|
|
155
|
-
|
|
129
|
+
rulesText: string;
|
|
156
130
|
rules: {
|
|
157
131
|
minimum?: number | undefined;
|
|
158
132
|
maximum?: number | undefined;
|
|
159
133
|
exclusiveMinimum?: number | undefined;
|
|
160
134
|
exclusiveMaximum?: number | undefined;
|
|
161
135
|
};
|
|
162
|
-
rulesText: string;
|
|
163
136
|
description?: string | undefined;
|
|
164
137
|
icon?: string | undefined;
|
|
165
138
|
}>;
|
|
166
139
|
export declare const certificationDefinitionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<z.objectUtil.extendShape<{
|
|
140
|
+
type: z.ZodEnum<["number", "percentage"]>;
|
|
167
141
|
code: z.ZodString;
|
|
168
|
-
type: z.ZodUnion<[z.ZodLiteral<"number">, z.ZodLiteral<"percentage">]>;
|
|
169
142
|
icon: z.ZodOptional<z.ZodString>;
|
|
170
143
|
name: z.ZodString;
|
|
171
144
|
description: z.ZodOptional<z.ZodString>;
|
|
172
|
-
rules: z.ZodAny;
|
|
173
145
|
rulesText: z.ZodString;
|
|
174
146
|
}, {
|
|
175
147
|
type: z.ZodLiteral<"number">;
|
|
@@ -190,38 +162,37 @@ export declare const certificationDefinitionSchema: z.ZodDiscriminatedUnion<"typ
|
|
|
190
162
|
exclusiveMaximum?: number | undefined;
|
|
191
163
|
}>;
|
|
192
164
|
}>, "strip", z.ZodTypeAny, {
|
|
165
|
+
type: "number";
|
|
193
166
|
code: string;
|
|
194
167
|
name: string;
|
|
195
|
-
|
|
168
|
+
rulesText: string;
|
|
196
169
|
rules: {
|
|
197
170
|
minimum?: number | undefined;
|
|
198
171
|
maximum?: number | undefined;
|
|
199
172
|
exclusiveMinimum?: number | undefined;
|
|
200
173
|
exclusiveMaximum?: number | undefined;
|
|
201
174
|
};
|
|
202
|
-
rulesText: string;
|
|
203
175
|
description?: string | undefined;
|
|
204
176
|
icon?: string | undefined;
|
|
205
177
|
}, {
|
|
178
|
+
type: "number";
|
|
206
179
|
code: string;
|
|
207
180
|
name: string;
|
|
208
|
-
|
|
181
|
+
rulesText: string;
|
|
209
182
|
rules: {
|
|
210
183
|
minimum?: number | undefined;
|
|
211
184
|
maximum?: number | undefined;
|
|
212
185
|
exclusiveMinimum?: number | undefined;
|
|
213
186
|
exclusiveMaximum?: number | undefined;
|
|
214
187
|
};
|
|
215
|
-
rulesText: string;
|
|
216
188
|
description?: string | undefined;
|
|
217
189
|
icon?: string | undefined;
|
|
218
190
|
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
191
|
+
type: z.ZodEnum<["number", "percentage"]>;
|
|
219
192
|
code: z.ZodString;
|
|
220
|
-
type: z.ZodUnion<[z.ZodLiteral<"number">, z.ZodLiteral<"percentage">]>;
|
|
221
193
|
icon: z.ZodOptional<z.ZodString>;
|
|
222
194
|
name: z.ZodString;
|
|
223
195
|
description: z.ZodOptional<z.ZodString>;
|
|
224
|
-
rules: z.ZodAny;
|
|
225
196
|
rulesText: z.ZodString;
|
|
226
197
|
}, {
|
|
227
198
|
type: z.ZodLiteral<"percentage">;
|
|
@@ -242,29 +213,29 @@ export declare const certificationDefinitionSchema: z.ZodDiscriminatedUnion<"typ
|
|
|
242
213
|
exclusiveMaximum?: number | undefined;
|
|
243
214
|
}>;
|
|
244
215
|
}>, "strip", z.ZodTypeAny, {
|
|
216
|
+
type: "percentage";
|
|
245
217
|
code: string;
|
|
246
218
|
name: string;
|
|
247
|
-
|
|
219
|
+
rulesText: string;
|
|
248
220
|
rules: {
|
|
249
221
|
minimum?: number | undefined;
|
|
250
222
|
maximum?: number | undefined;
|
|
251
223
|
exclusiveMinimum?: number | undefined;
|
|
252
224
|
exclusiveMaximum?: number | undefined;
|
|
253
225
|
};
|
|
254
|
-
rulesText: string;
|
|
255
226
|
description?: string | undefined;
|
|
256
227
|
icon?: string | undefined;
|
|
257
228
|
}, {
|
|
229
|
+
type: "percentage";
|
|
258
230
|
code: string;
|
|
259
231
|
name: string;
|
|
260
|
-
|
|
232
|
+
rulesText: string;
|
|
261
233
|
rules: {
|
|
262
234
|
minimum?: number | undefined;
|
|
263
235
|
maximum?: number | undefined;
|
|
264
236
|
exclusiveMinimum?: number | undefined;
|
|
265
237
|
exclusiveMaximum?: number | undefined;
|
|
266
238
|
};
|
|
267
|
-
rulesText: string;
|
|
268
239
|
description?: string | undefined;
|
|
269
240
|
icon?: string | undefined;
|
|
270
241
|
}>]>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.certificationDefinitionSchema = exports.percentageBasedCertificationDefinitionSchema = exports.numberBasedCertificationDefinitionSchema = exports.
|
|
3
|
+
exports.certificationDefinitionSchema = exports.percentageBasedCertificationDefinitionSchema = exports.numberBasedCertificationDefinitionSchema = exports.percentageBasedCertificationDefinitionRulesSchema = exports.numberBasedCertificationDefinitionRulesSchema = exports.certificationDefinitionTypeSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
exports.certificationDefinitionTypeSchema = zod_1.z.
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
exports.certificationDefinitionTypeSchema = zod_1.z.enum([
|
|
6
|
+
"number",
|
|
7
|
+
"percentage",
|
|
8
8
|
]);
|
|
9
9
|
exports.numberBasedCertificationDefinitionRulesSchema = zod_1.z.object({
|
|
10
10
|
minimum: zod_1.z.number().optional(),
|
|
@@ -13,20 +13,19 @@ exports.numberBasedCertificationDefinitionRulesSchema = zod_1.z.object({
|
|
|
13
13
|
exclusiveMaximum: zod_1.z.number().optional(),
|
|
14
14
|
});
|
|
15
15
|
exports.percentageBasedCertificationDefinitionRulesSchema = exports.numberBasedCertificationDefinitionRulesSchema;
|
|
16
|
-
|
|
17
|
-
code: zod_1.z.string(),
|
|
16
|
+
const abstractCertificationDefinitionSchema = zod_1.z.object({
|
|
18
17
|
type: exports.certificationDefinitionTypeSchema,
|
|
18
|
+
code: zod_1.z.string(),
|
|
19
19
|
icon: zod_1.z.string().optional(),
|
|
20
20
|
name: zod_1.z.string(),
|
|
21
21
|
description: zod_1.z.string().optional(),
|
|
22
|
-
rules: zod_1.z.any(),
|
|
23
22
|
rulesText: zod_1.z.string(),
|
|
24
23
|
});
|
|
25
|
-
exports.numberBasedCertificationDefinitionSchema =
|
|
24
|
+
exports.numberBasedCertificationDefinitionSchema = abstractCertificationDefinitionSchema.extend({
|
|
26
25
|
type: zod_1.z.literal("number"),
|
|
27
26
|
rules: exports.numberBasedCertificationDefinitionRulesSchema,
|
|
28
27
|
});
|
|
29
|
-
exports.percentageBasedCertificationDefinitionSchema =
|
|
28
|
+
exports.percentageBasedCertificationDefinitionSchema = abstractCertificationDefinitionSchema.extend({
|
|
30
29
|
type: zod_1.z.literal("percentage"),
|
|
31
30
|
rules: exports.percentageBasedCertificationDefinitionRulesSchema,
|
|
32
31
|
});
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const colorSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
3
|
+
red: z.ZodNumber;
|
|
4
|
+
green: z.ZodNumber;
|
|
5
|
+
blue: z.ZodNumber;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
red: number;
|
|
8
|
+
green: number;
|
|
9
|
+
blue: number;
|
|
10
|
+
}, {
|
|
11
|
+
red: number;
|
|
12
|
+
green: number;
|
|
13
|
+
blue: number;
|
|
14
|
+
}>]>;
|
|
15
|
+
export declare const taskItemScalarValueSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
16
|
+
export declare const taskItemValueSchema: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "many">]>;
|
|
17
|
+
export declare const elementDataSchema: z.ZodObject<{
|
|
18
|
+
value: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "many">]>>;
|
|
19
|
+
text: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
value?: string | number | boolean | (string | number | boolean | null)[] | null | undefined;
|
|
22
|
+
text?: string | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
value?: string | number | boolean | (string | number | boolean | null)[] | null | undefined;
|
|
25
|
+
text?: string | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const criteriaTreeElementTypeSchema: z.ZodEnum<["theme", "criterion", "task-group", "task", "task-item"]>;
|
|
28
|
+
export declare const abstractElementSchema: z.ZodObject<{
|
|
29
|
+
type: z.ZodEnum<["theme", "criterion", "task-group", "task", "task-item"]>;
|
|
30
|
+
title: z.ZodString;
|
|
31
|
+
code: z.ZodString;
|
|
32
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
33
|
+
documentation: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<z.objectUtil.extendShape<{
|
|
34
|
+
type: z.ZodEnum<["pdf", "text", "link"]>;
|
|
35
|
+
label: z.ZodString;
|
|
36
|
+
text: z.ZodString;
|
|
37
|
+
}, {
|
|
38
|
+
type: z.ZodLiteral<"pdf">;
|
|
39
|
+
url: z.ZodString;
|
|
40
|
+
}>, "strip", z.ZodTypeAny, {
|
|
41
|
+
type: "pdf";
|
|
42
|
+
url: string;
|
|
43
|
+
label: string;
|
|
44
|
+
text: string;
|
|
45
|
+
}, {
|
|
46
|
+
type: "pdf";
|
|
47
|
+
url: string;
|
|
48
|
+
label: string;
|
|
49
|
+
text: string;
|
|
50
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
51
|
+
type: z.ZodEnum<["pdf", "text", "link"]>;
|
|
52
|
+
label: z.ZodString;
|
|
53
|
+
text: z.ZodString;
|
|
54
|
+
}, {
|
|
55
|
+
type: z.ZodLiteral<"text">;
|
|
56
|
+
}>, "strip", z.ZodTypeAny, {
|
|
57
|
+
type: "text";
|
|
58
|
+
label: string;
|
|
59
|
+
text: string;
|
|
60
|
+
}, {
|
|
61
|
+
type: "text";
|
|
62
|
+
label: string;
|
|
63
|
+
text: string;
|
|
64
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
65
|
+
type: z.ZodEnum<["pdf", "text", "link"]>;
|
|
66
|
+
label: z.ZodString;
|
|
67
|
+
text: z.ZodString;
|
|
68
|
+
}, {
|
|
69
|
+
type: z.ZodLiteral<"link">;
|
|
70
|
+
url: z.ZodString;
|
|
71
|
+
}>, "strip", z.ZodTypeAny, {
|
|
72
|
+
type: "link";
|
|
73
|
+
url: string;
|
|
74
|
+
label: string;
|
|
75
|
+
text: string;
|
|
76
|
+
}, {
|
|
77
|
+
type: "link";
|
|
78
|
+
url: string;
|
|
79
|
+
label: string;
|
|
80
|
+
text: string;
|
|
81
|
+
}>]>, "many">>;
|
|
82
|
+
data: z.ZodOptional<z.ZodObject<{
|
|
83
|
+
value: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "many">]>>;
|
|
84
|
+
text: z.ZodOptional<z.ZodString>;
|
|
85
|
+
}, "strip", z.ZodTypeAny, {
|
|
86
|
+
value?: string | number | boolean | (string | number | boolean | null)[] | null | undefined;
|
|
87
|
+
text?: string | undefined;
|
|
88
|
+
}, {
|
|
89
|
+
value?: string | number | boolean | (string | number | boolean | null)[] | null | undefined;
|
|
90
|
+
text?: string | undefined;
|
|
91
|
+
}>>;
|
|
92
|
+
sortOrder: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
type: "theme" | "criterion" | "task-group" | "task" | "task-item";
|
|
95
|
+
code: string;
|
|
96
|
+
title: string;
|
|
97
|
+
data?: {
|
|
98
|
+
value?: string | number | boolean | (string | number | boolean | null)[] | null | undefined;
|
|
99
|
+
text?: string | undefined;
|
|
100
|
+
} | undefined;
|
|
101
|
+
tags?: string[] | undefined;
|
|
102
|
+
documentation?: ({
|
|
103
|
+
type: "pdf";
|
|
104
|
+
url: string;
|
|
105
|
+
label: string;
|
|
106
|
+
text: string;
|
|
107
|
+
} | {
|
|
108
|
+
type: "text";
|
|
109
|
+
label: string;
|
|
110
|
+
text: string;
|
|
111
|
+
} | {
|
|
112
|
+
type: "link";
|
|
113
|
+
url: string;
|
|
114
|
+
label: string;
|
|
115
|
+
text: string;
|
|
116
|
+
})[] | undefined;
|
|
117
|
+
sortOrder?: number | undefined;
|
|
118
|
+
}, {
|
|
119
|
+
type: "theme" | "criterion" | "task-group" | "task" | "task-item";
|
|
120
|
+
code: string;
|
|
121
|
+
title: string;
|
|
122
|
+
data?: {
|
|
123
|
+
value?: string | number | boolean | (string | number | boolean | null)[] | null | undefined;
|
|
124
|
+
text?: string | undefined;
|
|
125
|
+
} | undefined;
|
|
126
|
+
tags?: string[] | undefined;
|
|
127
|
+
documentation?: ({
|
|
128
|
+
type: "pdf";
|
|
129
|
+
url: string;
|
|
130
|
+
label: string;
|
|
131
|
+
text: string;
|
|
132
|
+
} | {
|
|
133
|
+
type: "text";
|
|
134
|
+
label: string;
|
|
135
|
+
text: string;
|
|
136
|
+
} | {
|
|
137
|
+
type: "link";
|
|
138
|
+
url: string;
|
|
139
|
+
label: string;
|
|
140
|
+
text: string;
|
|
141
|
+
})[] | undefined;
|
|
142
|
+
sortOrder?: number | undefined;
|
|
143
|
+
}>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.abstractElementSchema = exports.criteriaTreeElementTypeSchema = exports.elementDataSchema = exports.taskItemValueSchema = exports.taskItemScalarValueSchema = exports.colorSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const documentation_1 = require("./documentation");
|
|
6
|
+
exports.colorSchema = zod_1.z.union([
|
|
7
|
+
zod_1.z.string(),
|
|
8
|
+
zod_1.z.object({
|
|
9
|
+
red: zod_1.z.number(),
|
|
10
|
+
green: zod_1.z.number(),
|
|
11
|
+
blue: zod_1.z.number(),
|
|
12
|
+
}),
|
|
13
|
+
]);
|
|
14
|
+
// These are not "common" and are task-item specific, but generate a circular dependency if moved to task-item.ts
|
|
15
|
+
exports.taskItemScalarValueSchema = zod_1.z.union([
|
|
16
|
+
zod_1.z.string(),
|
|
17
|
+
zod_1.z.number(),
|
|
18
|
+
zod_1.z.boolean(),
|
|
19
|
+
zod_1.z.null(),
|
|
20
|
+
]);
|
|
21
|
+
exports.taskItemValueSchema = zod_1.z.union([
|
|
22
|
+
exports.taskItemScalarValueSchema,
|
|
23
|
+
zod_1.z.array(exports.taskItemScalarValueSchema),
|
|
24
|
+
]);
|
|
25
|
+
exports.elementDataSchema = zod_1.z.object({
|
|
26
|
+
value: exports.taskItemValueSchema.optional(),
|
|
27
|
+
text: zod_1.z.string().optional(),
|
|
28
|
+
});
|
|
29
|
+
exports.criteriaTreeElementTypeSchema = zod_1.z.enum([
|
|
30
|
+
"theme",
|
|
31
|
+
"criterion",
|
|
32
|
+
"task-group",
|
|
33
|
+
"task",
|
|
34
|
+
"task-item",
|
|
35
|
+
]);
|
|
36
|
+
exports.abstractElementSchema = zod_1.z.object({
|
|
37
|
+
type: exports.criteriaTreeElementTypeSchema,
|
|
38
|
+
title: zod_1.z.string(),
|
|
39
|
+
code: zod_1.z.string(),
|
|
40
|
+
tags: zod_1.z.array(zod_1.z.string()).optional(),
|
|
41
|
+
documentation: zod_1.z.array(documentation_1.documentationItemSchema).optional(),
|
|
42
|
+
data: exports.elementDataSchema.optional(),
|
|
43
|
+
sortOrder: zod_1.z.number().optional(),
|
|
44
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Validates the criteriaSetId parameter for endpoints which use it
|
|
4
|
+
*/
|
|
5
|
+
export declare const criteriaSetIdParamSchema: z.ZodObject<{
|
|
6
|
+
criteriaSetId: z.ZodString;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
criteriaSetId: string;
|
|
9
|
+
}, {
|
|
10
|
+
criteriaSetId: string;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.criteriaSetIdParamSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Validates the criteriaSetId parameter for endpoints which use it
|
|
7
|
+
*/
|
|
8
|
+
exports.criteriaSetIdParamSchema = zod_1.z.object({
|
|
9
|
+
criteriaSetId: zod_1.z.string()
|
|
10
|
+
.regex(/^[a-zA-Z0-9.\-_]+$/, 'Criteria set ID must contain only full stops, alphanumeric characters, dashes and underscores')
|
|
11
|
+
});
|