@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.
Files changed (60) hide show
  1. package/README.md +27 -34
  2. package/dist/index.d.ts +1 -1
  3. package/dist/v1/errors/DataValidationError.d.ts +1 -1
  4. package/dist/v1/errors/DataValidationError.js +1 -1
  5. package/dist/v1/errors/ParameterValidationError.d.ts +1 -1
  6. package/dist/v1/errors/ParameterValidationError.js +1 -1
  7. package/dist/v1/errors/ValidationError.d.ts +1 -1
  8. package/dist/v1/errors/ValidationError.js +1 -1
  9. package/dist/v1/errors/index.d.ts +4 -4
  10. package/dist/v1/errors/types.d.ts +1 -1
  11. package/dist/v1/index.d.ts +5 -5
  12. package/dist/v1/schemas/certification.d.ts +1 -1
  13. package/dist/v1/schemas/certification.js +13 -19
  14. package/dist/v1/schemas/common.d.ts +1 -1
  15. package/dist/v1/schemas/common.js +8 -16
  16. package/dist/v1/schemas/criteria-tree.d.ts +1 -49
  17. package/dist/v1/schemas/criteria-tree.js +5 -13
  18. package/dist/v1/schemas/criterion.d.ts +1 -10
  19. package/dist/v1/schemas/criterion.js +4 -4
  20. package/dist/v1/schemas/data-map.d.ts +1 -1
  21. package/dist/v1/schemas/data-map.js +1 -1
  22. package/dist/v1/schemas/documentation.d.ts +1 -1
  23. package/dist/v1/schemas/documentation.js +5 -9
  24. package/dist/v1/schemas/index.d.ts +13 -13
  25. package/dist/v1/schemas/metadata.d.ts +1 -1
  26. package/dist/v1/schemas/metadata.js +6 -6
  27. package/dist/v1/schemas/quality.d.ts +141 -469
  28. package/dist/v1/schemas/quality.js +7 -7
  29. package/dist/v1/schemas/request/criteria-set-id-param-schema.d.ts +1 -1
  30. package/dist/v1/schemas/request/criteria-set-id-param-schema.js +2 -3
  31. package/dist/v1/schemas/request/index.d.ts +4 -4
  32. package/dist/v1/schemas/request/matrix-body-schema.d.ts +1 -1
  33. package/dist/v1/schemas/request/matrix-body-schema.js +3 -5
  34. package/dist/v1/schemas/request/matrix-request-body-schema.d.ts +1 -1
  35. package/dist/v1/schemas/request/matrix-request-body-schema.js +6 -8
  36. package/dist/v1/schemas/request/tree-and-data-body-schema.d.ts +1 -1
  37. package/dist/v1/schemas/request/tree-and-data-body-schema.js +3 -5
  38. package/dist/v1/schemas/request/tree-and-data-request-body-schema.d.ts +1 -1
  39. package/dist/v1/schemas/request/tree-and-data-request-body-schema.js +5 -7
  40. package/dist/v1/schemas/request/version-param-schema.d.ts +1 -1
  41. package/dist/v1/schemas/request/version-param-schema.js +2 -3
  42. package/dist/v1/schemas/response.d.ts +2 -2
  43. package/dist/v1/schemas/response.js +1 -1
  44. package/dist/v1/schemas/task-group.d.ts +1 -8
  45. package/dist/v1/schemas/task-group.js +5 -5
  46. package/dist/v1/schemas/task-item.d.ts +1 -4
  47. package/dist/v1/schemas/task-item.js +27 -35
  48. package/dist/v1/schemas/task.d.ts +1 -6
  49. package/dist/v1/schemas/task.js +4 -4
  50. package/dist/v1/schemas/theme.d.ts +1 -12
  51. package/dist/v1/schemas/theme.js +4 -4
  52. package/dist/v1/services/i-criteria-set.service.d.ts +1 -1
  53. package/dist/v1/services/index.d.ts +2 -2
  54. package/dist/v1/services/manager.service.js +1 -4
  55. package/dist/v1/types/criteria.d.ts +2 -2
  56. package/dist/v1/types/express.d.ts +3 -3
  57. package/dist/v1/types/index.d.ts +2 -2
  58. package/dist/v1/utils.d.ts +3 -8
  59. package/dist/v1/utils.js +6 -6
  60. 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
- | Type | Remarks |
27
- | -------------------------- | --------------------------------------------------- |
28
- | **Metadata types** | |
29
- | `Metadata` | |
30
- | `Theme` | |
31
- | `ThemeStyle` | |
32
- | `Color` | |
33
- | **Task tree types** | |
34
- | `CriteriaTree` | |
35
- | `Theme` | |
36
- | `Criterion` | |
37
- | `TaskGroup` | |
38
- | `Task` | |
39
- | `TaskItem` | |
40
- | **TaskItem value types** | |
41
- | `SelectSingleType` | |
42
- | `SelectMultipleType` | |
43
- | `NumberType` | |
44
- | `BooleanType` | |
45
- | `PointOption` | Used by `SelectSingleType` and `SelectMultipleType` |
46
- | `TaskItemValue` | The raw value of a TaskItem, which can be an array |
47
- | `TaskItemScalarValue` | The raw value of a TaskItem |
48
- | **Express types** | |
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` | Matrix streaming endpoints response body |
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 "./v1";
1
+ export * as v1 from './v1';
@@ -1,4 +1,4 @@
1
- import { ValidationError } from "./ValidationError";
1
+ import { ValidationError } from './ValidationError';
2
2
  export declare class DataValidationError extends ValidationError {
3
3
  code: string;
4
4
  path?: string | undefined;
@@ -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("data", code, path, args);
7
+ super('data', code, path, args);
8
8
  this.code = code;
9
9
  this.path = path;
10
10
  }
@@ -1,4 +1,4 @@
1
- import { ValidationError } from "./ValidationError";
1
+ import { ValidationError } from './ValidationError';
2
2
  export declare class ParameterValidationError extends ValidationError {
3
3
  code: string;
4
4
  path?: string | undefined;
@@ -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("parameter", code, path, args);
7
+ super('parameter', code, path, args);
8
8
  this.code = code;
9
9
  this.path = path;
10
10
  }
@@ -1,4 +1,4 @@
1
- import { ValidationErrorType } from "./types";
1
+ import { ValidationErrorType } from './types';
2
2
  export declare abstract class ValidationError extends Error {
3
3
  errorType: ValidationErrorType;
4
4
  code: string;
@@ -14,7 +14,7 @@ class ValidationError extends Error {
14
14
  errorType: this.errorType,
15
15
  code: this.code,
16
16
  path: this.path,
17
- arguments: this.arguments,
17
+ arguments: this.arguments
18
18
  };
19
19
  }
20
20
  }
@@ -1,4 +1,4 @@
1
- export * from "./ValidationError";
2
- export * from "./DataValidationError";
3
- export * from "./ParameterValidationError";
4
- export * from "./types";
1
+ export * from './ValidationError';
2
+ export * from './DataValidationError';
3
+ export * from './ParameterValidationError';
4
+ export * from './types';
@@ -1 +1 @@
1
- export type ValidationErrorType = "data" | "parameter";
1
+ export type ValidationErrorType = 'data' | 'parameter';
@@ -1,5 +1,5 @@
1
- export * from "./schemas";
2
- export * from "./services";
3
- export * from "./types";
4
- export * from "./utils";
5
- export * from "./errors";
1
+ export * from './schemas';
2
+ export * from './services';
3
+ export * from './types';
4
+ export * from './utils';
5
+ export * from './errors';
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod';
2
2
  export declare const certificationDefinitionTypeSchema: z.ZodEnum<["number", "percentage"]>;
3
3
  export declare const numberBasedCertificationDefinitionRulesSchema: z.ZodObject<{
4
4
  minimum: z.ZodOptional<z.ZodNumber>;
@@ -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().optional(),
11
- exclusiveMinimum: zod_1.z.number().optional(),
12
- maximum: zod_1.z.number().optional(),
13
- exclusiveMaximum: zod_1.z.number().optional(),
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().optional(),
16
+ icon: (0, zod_1.optional)(zod_1.z.string()),
20
17
  name: zod_1.z.string(),
21
- description: zod_1.z.string().optional(),
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("number"),
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("percentage"),
30
- rules: exports.percentageBasedCertificationDefinitionRulesSchema,
26
+ type: zod_1.z.literal('percentage'),
27
+ rules: exports.percentageBasedCertificationDefinitionRulesSchema
31
28
  });
32
- exports.certificationDefinitionSchema = zod_1.z.discriminatedUnion("type", [
33
- exports.numberBasedCertificationDefinitionSchema,
34
- exports.percentageBasedCertificationDefinitionSchema,
35
- ]);
29
+ exports.certificationDefinitionSchema = zod_1.z.discriminatedUnion('type', [exports.numberBasedCertificationDefinitionSchema, exports.percentageBasedCertificationDefinitionSchema]);
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod';
2
2
  export declare const colorSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3
3
  red: z.ZodNumber;
4
4
  green: z.ZodNumber;
@@ -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().optional(),
19
- })
20
- .partial());
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()).optional(),
33
- documentation: zod_1.z.array(documentation_1.documentationItemSchema).optional(),
34
- data: exports.elementDataSchema.optional(),
35
- sortOrder: zod_1.z.number().optional(),
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
  });