@openframe-org/criteria-set-protocol 1.0.12 → 1.0.13

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.
@@ -10,56 +10,43 @@ export type PdfDocumentationItem = {
10
10
  type: 'pdf';
11
11
  label: string;
12
12
  url: string;
13
+ text: string;
13
14
  };
14
15
  export type InlineDocumentationItem = {
15
16
  type: 'text';
16
- label?: string;
17
+ label: string;
17
18
  text: string;
18
19
  };
19
20
  export type LinkDocumentationItem = {
20
21
  type: 'link';
21
22
  label: string;
22
23
  url: string;
24
+ text: string;
23
25
  };
24
26
  export type DocumentationItem = PdfDocumentationItem | InlineDocumentationItem | LinkDocumentationItem;
25
27
  export type CriteriaTree = Criterion[];
26
- export type Criterion = {
27
- type: 'criterion';
28
- id?: string;
29
- quality: string;
28
+ type BaseElement<Type extends CriteriaTreeElementType> = {
29
+ type: Type;
30
+ id: string;
30
31
  title: string;
31
32
  label?: string;
32
33
  tags?: string[];
33
- items: (Task | TaskGroup)[];
34
34
  documentation?: DocumentationItem[];
35
35
  };
36
- export type TaskGroup = {
37
- type: 'task-group';
38
- id?: string;
39
- title: string;
40
- label?: string;
41
- tags?: string[];
36
+ export type Criterion = BaseElement<'criterion'> & {
37
+ quality: string;
42
38
  items: (Task | TaskGroup)[];
43
- documentation?: DocumentationItem[];
44
39
  };
45
- export type Task = {
46
- type: 'task';
47
- id?: string;
48
- title: string;
49
- label?: string;
40
+ export type TaskGroup = BaseElement<'task-group'> & {
41
+ items: (Task | TaskGroup)[];
42
+ };
43
+ export type Task = BaseElement<'task'> & {
50
44
  description?: string;
51
- tags?: string[];
52
45
  items: TaskItem[];
53
- documentation?: DocumentationItem[];
54
46
  };
55
- export type TaskItem = {
56
- type: 'task-item';
57
- id: string;
47
+ export type TaskItem = Omit<BaseElement<'task-item'>, 'title'> & {
58
48
  description?: string;
59
- label?: string;
60
- tags?: string[];
61
49
  definition: SelectSingleType | SelectMultipleType | NumberType | BooleanType;
62
- documentation?: DocumentationItem[];
63
50
  providedData?: Record<string, TaskItemValue>;
64
51
  calculatedData?: Record<string, any>;
65
52
  };
@@ -89,3 +76,4 @@ export type PointOption = {
89
76
  export type TaskItemValue = string | number | boolean | null | Array<string | number | boolean | null>;
90
77
  export type CriteriaTreeElement = Criterion | TaskGroup | Task | TaskItem;
91
78
  export type CriteriaTreeElementType = 'criterion' | 'task-group' | 'task' | 'task-item';
79
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openframe-org/criteria-set-protocol",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "A protocol and tools for defining and working with criteria sets",
5
5
  "private": false,
6
6
  "author": "Andrés Angulo <aa@openframe.org>",