@openframe-org/criteria-set-protocol 2.0.0-beta.7 → 2.0.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/README.md +27 -34
- package/dist/index.d.ts +1 -1
- package/dist/v1/errors/DataValidationError.d.ts +1 -1
- package/dist/v1/errors/DataValidationError.js +1 -1
- package/dist/v1/errors/ParameterValidationError.d.ts +1 -1
- package/dist/v1/errors/ParameterValidationError.js +1 -1
- package/dist/v1/errors/ValidationError.d.ts +1 -1
- package/dist/v1/errors/ValidationError.js +1 -1
- package/dist/v1/errors/index.d.ts +4 -4
- package/dist/v1/errors/types.d.ts +1 -1
- package/dist/v1/index.d.ts +5 -5
- package/dist/v1/schemas/certification.d.ts +1 -1
- package/dist/v1/schemas/certification.js +13 -19
- package/dist/v1/schemas/common.d.ts +1 -1
- package/dist/v1/schemas/common.js +8 -16
- package/dist/v1/schemas/criteria-tree.d.ts +1 -49
- package/dist/v1/schemas/criteria-tree.js +5 -13
- package/dist/v1/schemas/criterion.d.ts +1 -10
- package/dist/v1/schemas/criterion.js +4 -4
- package/dist/v1/schemas/data-map.d.ts +1 -1
- package/dist/v1/schemas/data-map.js +1 -1
- package/dist/v1/schemas/documentation.d.ts +1 -1
- package/dist/v1/schemas/documentation.js +5 -9
- package/dist/v1/schemas/index.d.ts +13 -13
- package/dist/v1/schemas/metadata.d.ts +1 -1
- package/dist/v1/schemas/metadata.js +6 -6
- package/dist/v1/schemas/quality.d.ts +141 -469
- package/dist/v1/schemas/quality.js +7 -7
- package/dist/v1/schemas/request/criteria-set-id-param-schema.d.ts +1 -1
- package/dist/v1/schemas/request/criteria-set-id-param-schema.js +2 -3
- package/dist/v1/schemas/request/index.d.ts +4 -4
- package/dist/v1/schemas/request/matrix-body-schema.d.ts +1 -1
- package/dist/v1/schemas/request/matrix-body-schema.js +3 -5
- package/dist/v1/schemas/request/matrix-request-body-schema.d.ts +1 -1
- package/dist/v1/schemas/request/matrix-request-body-schema.js +6 -8
- package/dist/v1/schemas/request/tree-and-data-body-schema.d.ts +1 -1
- package/dist/v1/schemas/request/tree-and-data-body-schema.js +3 -5
- package/dist/v1/schemas/request/tree-and-data-request-body-schema.d.ts +1 -1
- package/dist/v1/schemas/request/tree-and-data-request-body-schema.js +5 -7
- package/dist/v1/schemas/request/version-param-schema.d.ts +1 -1
- package/dist/v1/schemas/request/version-param-schema.js +2 -3
- package/dist/v1/schemas/response.d.ts +2 -2
- package/dist/v1/schemas/response.js +1 -1
- package/dist/v1/schemas/task-group.d.ts +1 -8
- package/dist/v1/schemas/task-group.js +5 -5
- package/dist/v1/schemas/task-item.d.ts +1 -4
- package/dist/v1/schemas/task-item.js +27 -35
- package/dist/v1/schemas/task.d.ts +1 -6
- package/dist/v1/schemas/task.js +4 -4
- package/dist/v1/schemas/theme.d.ts +1 -12
- package/dist/v1/schemas/theme.js +4 -4
- package/dist/v1/services/i-criteria-set.service.d.ts +1 -1
- package/dist/v1/services/index.d.ts +2 -2
- package/dist/v1/services/manager.service.js +1 -4
- package/dist/v1/types/criteria.d.ts +2 -2
- package/dist/v1/types/express.d.ts +3 -3
- package/dist/v1/types/index.d.ts +2 -2
- package/dist/v1/utils.d.ts +3 -8
- package/dist/v1/utils.js +6 -6
- package/package.json +3 -11
package/README.md
CHANGED
|
@@ -3,67 +3,60 @@
|
|
|
3
3
|
# Criteria Set Protocol
|
|
4
4
|
|
|
5
5
|
## TypeScript library
|
|
6
|
-
|
|
7
6
|
This is a TypeScript library with types and implementations of the Criteria Set Protocol. It is published
|
|
8
7
|
publicly on [npmjs](https://www.npmjs.com/package/@openframe-org/criteria-set-protocol) as `@openframe-org/criteria-set-protocol`.
|
|
9
8
|
|
|
10
9
|
### Installation
|
|
11
|
-
|
|
12
10
|
```bash
|
|
13
11
|
npm install --save @openframe-org/criteria-set-protocol
|
|
14
12
|
```
|
|
15
13
|
|
|
16
14
|
### Contents
|
|
17
|
-
|
|
18
15
|
The library contains a service to work with protocol versions, and an interface to interact with this service.
|
|
19
16
|
|
|
20
17
|
#### Protocol v1
|
|
21
|
-
|
|
22
18
|
The library contains the types defined in the protocol v1 specification, and a service that implements this specification.
|
|
23
19
|
|
|
24
20
|
##### Types
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
| `MetadataResponse` | Metadata endpoint response body |
|
|
21
|
+
| Type | Remarks |
|
|
22
|
+
|-------------------------------|-----------------------------------------------------|
|
|
23
|
+
| **Metadata types** | |
|
|
24
|
+
| `Metadata` | |
|
|
25
|
+
| `Theme` | |
|
|
26
|
+
| `ThemeStyle` | |
|
|
27
|
+
| `Color` | |
|
|
28
|
+
| **Task tree types** | |
|
|
29
|
+
| `CriteriaTree` | |
|
|
30
|
+
| `Theme` | |
|
|
31
|
+
| `Criterion` | |
|
|
32
|
+
| `TaskGroup` | |
|
|
33
|
+
| `Task` | |
|
|
34
|
+
| `TaskItem` | |
|
|
35
|
+
| **TaskItem value types** | |
|
|
36
|
+
| `SelectSingleType` | |
|
|
37
|
+
| `SelectMultipleType` | |
|
|
38
|
+
| `NumberType` | |
|
|
39
|
+
| `BooleanType` | |
|
|
40
|
+
| `PointOption` | Used by `SelectSingleType` and `SelectMultipleType` |
|
|
41
|
+
| `TaskItemValue` | The raw value of a TaskItem, which can be an array |
|
|
42
|
+
| `TaskItemScalarValue` | The raw value of a TaskItem |
|
|
43
|
+
| **Express types** | |
|
|
44
|
+
| `MetadataResponse` | Metadata endpoint response body |
|
|
50
45
|
| `TreeAndMatrixRequestBody` | Request body for the matrix streaming endpoints |
|
|
51
|
-
| `StreamMatrixResponse`
|
|
46
|
+
| `StreamMatrixResponse` | Matrix streaming endpoints response body |
|
|
52
47
|
|
|
53
48
|
##### Schemas
|
|
54
|
-
|
|
55
49
|
Validation schemas are provided for validating the endpoints of the protocol v1 specification.
|
|
56
50
|
|
|
57
51
|
| Schema | Remarks |
|
|
58
|
-
|
|
52
|
+
|----------------------------|------------------------------------------------------------------|
|
|
59
53
|
| `TreeAndMatrixBodySchema` | Validates the request body for the tree and matrix endpoints |
|
|
60
54
|
| `criteriaSetIdParamSchema` | Validates the criteriaSetId parameter for endpoints which use it |
|
|
61
55
|
| `versionParamSchema` | Validates the version parameter for endpoints which use it |
|
|
62
56
|
|
|
63
57
|
##### Services
|
|
58
|
+
The `IProtocolV1Service` interface defines a service which implements the v1 protocol.
|
|
64
59
|
|
|
65
|
-
The `IProtocolV1Service` interface defines a service which implements the v1 protocol.
|
|
66
60
|
|
|
67
61
|
## License
|
|
68
|
-
|
|
69
62
|
<p xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/"><a property="dct:title" rel="cc:attributionURL" href="https://github.com/Frame-ApS/criteria-set-protocol">Openframe Criteria Set Protocol</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://github.com/andresangulo">Openframe ApS</a> is licensed under <a href="http://creativecommons.org/licenses/by-nd/4.0/?ref=chooser-v1" target="_blank" rel="license noopener noreferrer" style="display:inline-block;">CC BY-ND 4.0<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1"><img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1"><img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/nd.svg?ref=chooser-v1"></a></p>
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * as v1 from
|
|
1
|
+
export * as v1 from './v1';
|
|
@@ -4,7 +4,7 @@ exports.DataValidationError = void 0;
|
|
|
4
4
|
const ValidationError_1 = require("./ValidationError");
|
|
5
5
|
class DataValidationError extends ValidationError_1.ValidationError {
|
|
6
6
|
constructor(code, path, args) {
|
|
7
|
-
super(
|
|
7
|
+
super('data', code, path, args);
|
|
8
8
|
this.code = code;
|
|
9
9
|
this.path = path;
|
|
10
10
|
}
|
|
@@ -4,7 +4,7 @@ exports.ParameterValidationError = void 0;
|
|
|
4
4
|
const ValidationError_1 = require("./ValidationError");
|
|
5
5
|
class ParameterValidationError extends ValidationError_1.ValidationError {
|
|
6
6
|
constructor(code, path, args) {
|
|
7
|
-
super(
|
|
7
|
+
super('parameter', code, path, args);
|
|
8
8
|
this.code = code;
|
|
9
9
|
this.path = path;
|
|
10
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
1
|
+
export * from './ValidationError';
|
|
2
|
+
export * from './DataValidationError';
|
|
3
|
+
export * from './ParameterValidationError';
|
|
4
|
+
export * from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type ValidationErrorType =
|
|
1
|
+
export type ValidationErrorType = 'data' | 'parameter';
|
package/dist/v1/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from './schemas';
|
|
2
|
+
export * from './services';
|
|
3
|
+
export * from './types';
|
|
4
|
+
export * from './utils';
|
|
5
|
+
export * from './errors';
|
|
@@ -2,34 +2,28 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
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.enum([
|
|
6
|
-
"number",
|
|
7
|
-
"percentage",
|
|
8
|
-
]);
|
|
5
|
+
exports.certificationDefinitionTypeSchema = zod_1.z.enum(['number', 'percentage']);
|
|
9
6
|
exports.numberBasedCertificationDefinitionRulesSchema = zod_1.z.object({
|
|
10
|
-
minimum: zod_1.z.number()
|
|
11
|
-
exclusiveMinimum: zod_1.z.number()
|
|
12
|
-
maximum: zod_1.z.number()
|
|
13
|
-
exclusiveMaximum: zod_1.z.number()
|
|
7
|
+
minimum: (0, zod_1.optional)(zod_1.z.number()),
|
|
8
|
+
exclusiveMinimum: (0, zod_1.optional)(zod_1.z.number()),
|
|
9
|
+
maximum: (0, zod_1.optional)(zod_1.z.number()),
|
|
10
|
+
exclusiveMaximum: (0, zod_1.optional)(zod_1.z.number()),
|
|
14
11
|
});
|
|
15
12
|
exports.percentageBasedCertificationDefinitionRulesSchema = exports.numberBasedCertificationDefinitionRulesSchema;
|
|
16
13
|
const abstractCertificationDefinitionSchema = zod_1.z.object({
|
|
17
14
|
type: exports.certificationDefinitionTypeSchema,
|
|
18
15
|
code: zod_1.z.string(),
|
|
19
|
-
icon: zod_1.z.string()
|
|
16
|
+
icon: (0, zod_1.optional)(zod_1.z.string()),
|
|
20
17
|
name: zod_1.z.string(),
|
|
21
|
-
description: zod_1.z.string()
|
|
22
|
-
rulesText: zod_1.z.string()
|
|
18
|
+
description: (0, zod_1.optional)(zod_1.z.string()),
|
|
19
|
+
rulesText: zod_1.z.string()
|
|
23
20
|
});
|
|
24
21
|
exports.numberBasedCertificationDefinitionSchema = abstractCertificationDefinitionSchema.extend({
|
|
25
|
-
type: zod_1.z.literal(
|
|
26
|
-
rules: exports.numberBasedCertificationDefinitionRulesSchema
|
|
22
|
+
type: zod_1.z.literal('number'),
|
|
23
|
+
rules: exports.numberBasedCertificationDefinitionRulesSchema
|
|
27
24
|
});
|
|
28
25
|
exports.percentageBasedCertificationDefinitionSchema = abstractCertificationDefinitionSchema.extend({
|
|
29
|
-
type: zod_1.z.literal(
|
|
30
|
-
rules: exports.percentageBasedCertificationDefinitionRulesSchema
|
|
26
|
+
type: zod_1.z.literal('percentage'),
|
|
27
|
+
rules: exports.percentageBasedCertificationDefinitionRulesSchema
|
|
31
28
|
});
|
|
32
|
-
exports.certificationDefinitionSchema = zod_1.z.discriminatedUnion(
|
|
33
|
-
exports.numberBasedCertificationDefinitionSchema,
|
|
34
|
-
exports.percentageBasedCertificationDefinitionSchema,
|
|
35
|
-
]);
|
|
29
|
+
exports.certificationDefinitionSchema = zod_1.z.discriminatedUnion('type', [exports.numberBasedCertificationDefinitionSchema, exports.percentageBasedCertificationDefinitionSchema]);
|
|
@@ -12,25 +12,17 @@ exports.colorSchema = zod_1.z.union([
|
|
|
12
12
|
blue: zod_1.z.number(),
|
|
13
13
|
}),
|
|
14
14
|
]);
|
|
15
|
-
exports.elementDataSchema = zod_1.z.intersection(zod_1.z.record(zod_1.z.string(), zod_1.z.any()), zod_1.z
|
|
16
|
-
.object({
|
|
15
|
+
exports.elementDataSchema = zod_1.z.intersection(zod_1.z.record(zod_1.z.string(), zod_1.z.any()), zod_1.z.object({
|
|
17
16
|
value: task_item_1.taskItemValueSchema,
|
|
18
|
-
text: zod_1.z.string()
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
exports.criteriaTreeElementTypeSchema = zod_1.z.enum([
|
|
22
|
-
"theme",
|
|
23
|
-
"criterion",
|
|
24
|
-
"task-group",
|
|
25
|
-
"task",
|
|
26
|
-
"task-item",
|
|
27
|
-
]);
|
|
17
|
+
text: (0, zod_1.optional)(zod_1.z.string()),
|
|
18
|
+
}).partial());
|
|
19
|
+
exports.criteriaTreeElementTypeSchema = zod_1.z.enum(['theme', 'criterion', 'task-group', 'task', 'task-item']);
|
|
28
20
|
exports.abstractElementSchema = zod_1.z.object({
|
|
29
21
|
type: exports.criteriaTreeElementTypeSchema,
|
|
30
22
|
title: zod_1.z.string(),
|
|
31
23
|
code: zod_1.z.string(),
|
|
32
|
-
tags: zod_1.z.array(zod_1.z.string())
|
|
33
|
-
documentation: zod_1.z.array(documentation_1.documentationItemSchema)
|
|
34
|
-
data: exports.elementDataSchema
|
|
35
|
-
sortOrder: zod_1.z.number()
|
|
24
|
+
tags: (0, zod_1.optional)(zod_1.z.array(zod_1.z.string())),
|
|
25
|
+
documentation: (0, zod_1.optional)(zod_1.z.array(documentation_1.documentationItemSchema)),
|
|
26
|
+
data: (0, zod_1.optional)(exports.elementDataSchema),
|
|
27
|
+
sortOrder: (0, zod_1.optional)(zod_1.z.number()),
|
|
36
28
|
});
|