@openframe-org/criteria-set-protocol 2.2.5 → 2.2.7

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.
@@ -14,9 +14,7 @@ export declare const colorSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
14
14
  }>]>;
15
15
  export declare const taskItemScalarValueSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
16
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
- type: z.ZodOptional<z.ZodEnum<["number", "percentage", "boolean"]>>;
19
- value: z.ZodOptional<z.ZodNumber>;
17
+ export declare const elementDataSchema: z.ZodIntersection<z.ZodObject<{
20
18
  text: z.ZodOptional<z.ZodString>;
21
19
  total: z.ZodOptional<z.ZodNumber>;
22
20
  maximumValue: z.ZodOptional<z.ZodNumber>;
@@ -24,24 +22,38 @@ export declare const elementDataSchema: z.ZodObject<{
24
22
  exclusiveMaximum: z.ZodOptional<z.ZodNumber>;
25
23
  exclusiveMinimum: z.ZodOptional<z.ZodNumber>;
26
24
  }, "strip", z.ZodTypeAny, {
27
- type?: "number" | "boolean" | "percentage" | undefined;
28
25
  total?: number | undefined;
29
- value?: number | undefined;
30
26
  text?: string | undefined;
31
27
  maximumValue?: number | undefined;
32
28
  minimumValue?: number | undefined;
33
29
  exclusiveMaximum?: number | undefined;
34
30
  exclusiveMinimum?: number | undefined;
35
31
  }, {
36
- type?: "number" | "boolean" | "percentage" | undefined;
37
32
  total?: number | undefined;
38
- value?: number | undefined;
39
33
  text?: string | undefined;
40
34
  maximumValue?: number | undefined;
41
35
  minimumValue?: number | undefined;
42
36
  exclusiveMaximum?: number | undefined;
43
37
  exclusiveMinimum?: number | undefined;
44
- }>;
38
+ }>, z.ZodUnion<[z.ZodObject<{
39
+ type: z.ZodOptional<z.ZodEnum<["number", "percentage"]>>;
40
+ value: z.ZodOptional<z.ZodNumber>;
41
+ }, "strip", z.ZodTypeAny, {
42
+ type?: "number" | "percentage" | undefined;
43
+ value?: number | undefined;
44
+ }, {
45
+ type?: "number" | "percentage" | undefined;
46
+ value?: number | undefined;
47
+ }>, z.ZodObject<{
48
+ type: z.ZodLiteral<"boolean">;
49
+ value: z.ZodOptional<z.ZodBoolean>;
50
+ }, "strip", z.ZodTypeAny, {
51
+ type: "boolean";
52
+ value?: boolean | undefined;
53
+ }, {
54
+ type: "boolean";
55
+ value?: boolean | undefined;
56
+ }>]>>;
45
57
  export declare const criteriaTreeElementTypeSchema: z.ZodEnum<["theme", "criterion", "task-group", "task", "task-item"]>;
46
58
  export declare const abstractElementSchema: z.ZodObject<{
47
59
  type: z.ZodEnum<["theme", "criterion", "task-group", "task", "task-item"]>;
@@ -95,9 +107,7 @@ export declare const abstractElementSchema: z.ZodObject<{
95
107
  label: string;
96
108
  text: string;
97
109
  }>]>, "many">>;
98
- data: z.ZodOptional<z.ZodObject<{
99
- type: z.ZodOptional<z.ZodEnum<["number", "percentage", "boolean"]>>;
100
- value: z.ZodOptional<z.ZodNumber>;
110
+ data: z.ZodOptional<z.ZodIntersection<z.ZodObject<{
101
111
  text: z.ZodOptional<z.ZodString>;
102
112
  total: z.ZodOptional<z.ZodNumber>;
103
113
  maximumValue: z.ZodOptional<z.ZodNumber>;
@@ -105,40 +115,58 @@ export declare const abstractElementSchema: z.ZodObject<{
105
115
  exclusiveMaximum: z.ZodOptional<z.ZodNumber>;
106
116
  exclusiveMinimum: z.ZodOptional<z.ZodNumber>;
107
117
  }, "strip", z.ZodTypeAny, {
108
- type?: "number" | "boolean" | "percentage" | undefined;
109
118
  total?: number | undefined;
110
- value?: number | undefined;
111
119
  text?: string | undefined;
112
120
  maximumValue?: number | undefined;
113
121
  minimumValue?: number | undefined;
114
122
  exclusiveMaximum?: number | undefined;
115
123
  exclusiveMinimum?: number | undefined;
116
124
  }, {
117
- type?: "number" | "boolean" | "percentage" | undefined;
118
125
  total?: number | undefined;
119
- value?: number | undefined;
120
126
  text?: string | undefined;
121
127
  maximumValue?: number | undefined;
122
128
  minimumValue?: number | undefined;
123
129
  exclusiveMaximum?: number | undefined;
124
130
  exclusiveMinimum?: number | undefined;
125
- }>>;
131
+ }>, z.ZodUnion<[z.ZodObject<{
132
+ type: z.ZodOptional<z.ZodEnum<["number", "percentage"]>>;
133
+ value: z.ZodOptional<z.ZodNumber>;
134
+ }, "strip", z.ZodTypeAny, {
135
+ type?: "number" | "percentage" | undefined;
136
+ value?: number | undefined;
137
+ }, {
138
+ type?: "number" | "percentage" | undefined;
139
+ value?: number | undefined;
140
+ }>, z.ZodObject<{
141
+ type: z.ZodLiteral<"boolean">;
142
+ value: z.ZodOptional<z.ZodBoolean>;
143
+ }, "strip", z.ZodTypeAny, {
144
+ type: "boolean";
145
+ value?: boolean | undefined;
146
+ }, {
147
+ type: "boolean";
148
+ value?: boolean | undefined;
149
+ }>]>>>;
126
150
  sortOrder: z.ZodOptional<z.ZodNumber>;
127
151
  }, "strip", z.ZodTypeAny, {
128
152
  code: string;
129
153
  type: "theme" | "criterion" | "task-group" | "task" | "task-item";
130
154
  title: string;
131
155
  longFormTitle: string;
132
- data?: {
133
- type?: "number" | "boolean" | "percentage" | undefined;
156
+ data?: ({
134
157
  total?: number | undefined;
135
- value?: number | undefined;
136
158
  text?: string | undefined;
137
159
  maximumValue?: number | undefined;
138
160
  minimumValue?: number | undefined;
139
161
  exclusiveMaximum?: number | undefined;
140
162
  exclusiveMinimum?: number | undefined;
141
- } | undefined;
163
+ } & ({
164
+ type?: "number" | "percentage" | undefined;
165
+ value?: number | undefined;
166
+ } | {
167
+ type: "boolean";
168
+ value?: boolean | undefined;
169
+ })) | undefined;
142
170
  tags?: string[] | undefined;
143
171
  documentation?: ({
144
172
  type: "pdf";
@@ -161,16 +189,20 @@ export declare const abstractElementSchema: z.ZodObject<{
161
189
  type: "theme" | "criterion" | "task-group" | "task" | "task-item";
162
190
  title: string;
163
191
  longFormTitle: string;
164
- data?: {
165
- type?: "number" | "boolean" | "percentage" | undefined;
192
+ data?: ({
166
193
  total?: number | undefined;
167
- value?: number | undefined;
168
194
  text?: string | undefined;
169
195
  maximumValue?: number | undefined;
170
196
  minimumValue?: number | undefined;
171
197
  exclusiveMaximum?: number | undefined;
172
198
  exclusiveMinimum?: number | undefined;
173
- } | undefined;
199
+ } & ({
200
+ type?: "number" | "percentage" | undefined;
201
+ value?: number | undefined;
202
+ } | {
203
+ type: "boolean";
204
+ value?: boolean | undefined;
205
+ })) | undefined;
174
206
  tags?: string[] | undefined;
175
207
  documentation?: ({
176
208
  type: "pdf";
@@ -227,9 +259,14 @@ export declare const documentTreeOptionsSchema: z.ZodUnion<[z.ZodObject<{
227
259
  documentTreeFolderTextFormat: string;
228
260
  hideFromDocumentTree?: false | undefined;
229
261
  }>]>;
230
- export declare const treeResultSchema: z.ZodObject<{
231
- type: z.ZodOptional<z.ZodEnum<["number", "percentage", "boolean"]>>;
232
- value: z.ZodOptional<z.ZodNumber>;
262
+ export declare const criteriaTreeOptionsSchema: z.ZodObject<{
263
+ criteriaTreeElementTextFormat: z.ZodString;
264
+ }, "strip", z.ZodTypeAny, {
265
+ criteriaTreeElementTextFormat: string;
266
+ }, {
267
+ criteriaTreeElementTextFormat: string;
268
+ }>;
269
+ export declare const treeResultSchema: z.ZodIntersection<z.ZodObject<{
233
270
  text: z.ZodOptional<z.ZodString>;
234
271
  total: z.ZodOptional<z.ZodNumber>;
235
272
  maximumValue: z.ZodOptional<z.ZodNumber>;
@@ -237,21 +274,35 @@ export declare const treeResultSchema: z.ZodObject<{
237
274
  exclusiveMaximum: z.ZodOptional<z.ZodNumber>;
238
275
  exclusiveMinimum: z.ZodOptional<z.ZodNumber>;
239
276
  }, "strip", z.ZodTypeAny, {
240
- type?: "number" | "boolean" | "percentage" | undefined;
241
277
  total?: number | undefined;
242
- value?: number | undefined;
243
278
  text?: string | undefined;
244
279
  maximumValue?: number | undefined;
245
280
  minimumValue?: number | undefined;
246
281
  exclusiveMaximum?: number | undefined;
247
282
  exclusiveMinimum?: number | undefined;
248
283
  }, {
249
- type?: "number" | "boolean" | "percentage" | undefined;
250
284
  total?: number | undefined;
251
- value?: number | undefined;
252
285
  text?: string | undefined;
253
286
  maximumValue?: number | undefined;
254
287
  minimumValue?: number | undefined;
255
288
  exclusiveMaximum?: number | undefined;
256
289
  exclusiveMinimum?: number | undefined;
257
- }>;
290
+ }>, z.ZodUnion<[z.ZodObject<{
291
+ type: z.ZodOptional<z.ZodEnum<["number", "percentage"]>>;
292
+ value: z.ZodOptional<z.ZodNumber>;
293
+ }, "strip", z.ZodTypeAny, {
294
+ type?: "number" | "percentage" | undefined;
295
+ value?: number | undefined;
296
+ }, {
297
+ type?: "number" | "percentage" | undefined;
298
+ value?: number | undefined;
299
+ }>, z.ZodObject<{
300
+ type: z.ZodLiteral<"boolean">;
301
+ value: z.ZodOptional<z.ZodBoolean>;
302
+ }, "strip", z.ZodTypeAny, {
303
+ type: "boolean";
304
+ value?: boolean | undefined;
305
+ }, {
306
+ type: "boolean";
307
+ value?: boolean | undefined;
308
+ }>]>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.treeResultSchema = exports.documentTreeOptionsSchema = exports.breadcrumbOptionsSchema = exports.abstractElementSchema = exports.criteriaTreeElementTypeSchema = exports.elementDataSchema = exports.taskItemValueSchema = exports.taskItemScalarValueSchema = exports.colorSchema = void 0;
3
+ exports.treeResultSchema = exports.criteriaTreeOptionsSchema = exports.documentTreeOptionsSchema = exports.breadcrumbOptionsSchema = exports.abstractElementSchema = exports.criteriaTreeElementTypeSchema = exports.elementDataSchema = exports.taskItemValueSchema = exports.taskItemScalarValueSchema = exports.colorSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const documentation_1 = require("./documentation");
6
6
  exports.colorSchema = zod_1.z
@@ -9,8 +9,8 @@ exports.colorSchema = zod_1.z
9
9
  zod_1.z.object({
10
10
  red: zod_1.z.number().describe("Red component (0-255)"),
11
11
  green: zod_1.z.number().describe("Green component (0-255)"),
12
- blue: zod_1.z.number().describe("Blue component (0-255)"),
13
- }),
12
+ blue: zod_1.z.number().describe("Blue component (0-255)")
13
+ })
14
14
  ])
15
15
  .describe("Color");
16
16
  // These are not "common" and are task-item specific, but generate a circular dependency if moved to task-item.ts
@@ -22,11 +22,6 @@ exports.taskItemValueSchema = zod_1.z
22
22
  .describe("TaskItemValue - Can be either a scalar value or an array of scalar values");
23
23
  exports.elementDataSchema = zod_1.z
24
24
  .object({
25
- type: zod_1.z
26
- .enum(["number", "percentage", "boolean"])
27
- .optional()
28
- .describe("Type of data"),
29
- value: zod_1.z.number().optional().describe("Value of the element"),
30
25
  text: zod_1.z.string().optional().describe("Text representation of the value"),
31
26
  total: zod_1.z
32
27
  .number()
@@ -47,8 +42,20 @@ exports.elementDataSchema = zod_1.z
47
42
  exclusiveMinimum: zod_1.z
48
43
  .number()
49
44
  .optional()
50
- .describe("Minimum allowed value (exclusive)"),
45
+ .describe("Minimum allowed value (exclusive)")
51
46
  })
47
+ .and(zod_1.z.union([zod_1.z.object({
48
+ type: zod_1.z
49
+ .enum(["number", "percentage"])
50
+ .optional()
51
+ .describe("Type of data"),
52
+ value: zod_1.z.number().optional().describe("Value of the element"),
53
+ }), zod_1.z.object({
54
+ type: zod_1.z
55
+ .literal('boolean')
56
+ .describe("Type of data"),
57
+ value: zod_1.z.boolean().optional().describe("Value of the element"),
58
+ })]))
52
59
  .describe("ElementData - Element data containing value constraints and metadata");
53
60
  exports.criteriaTreeElementTypeSchema = zod_1.z
54
61
  .enum(["theme", "criterion", "task-group", "task", "task-item"])
@@ -71,7 +78,7 @@ exports.abstractElementSchema = zod_1.z
71
78
  sortOrder: zod_1.z
72
79
  .number()
73
80
  .optional()
74
- .describe("Custom sorting position within parent"),
81
+ .describe("Custom sorting position within parent")
75
82
  })
76
83
  .describe("AbstractElement - Base schema for all tree elements");
77
84
  exports.breadcrumbOptionsSchema = zod_1.z
@@ -79,7 +86,7 @@ exports.breadcrumbOptionsSchema = zod_1.z
79
86
  hideFromBreadcrumbs: zod_1.z
80
87
  .literal(true)
81
88
  .describe("Whether to hide the element from the breadcrumbs"),
82
- breadcrumbTextFormat: zod_1.z.never().optional(),
89
+ breadcrumbTextFormat: zod_1.z.never().optional()
83
90
  })
84
91
  .or(zod_1.z.object({
85
92
  hideFromBreadcrumbs: zod_1.z
@@ -89,14 +96,14 @@ exports.breadcrumbOptionsSchema = zod_1.z
89
96
  .describe("Whether to hide the element from the breadcrumbs"),
90
97
  breadcrumbTextFormat: zod_1.z
91
98
  .string()
92
- .describe("The format of the breadcrumb text, use ':code:' and ':title:' to define where the code and/or title should be inserted"),
99
+ .describe("The format of the breadcrumb text, use ':code:' and ':title:' to define where the code and/or title should be inserted")
93
100
  }));
94
101
  exports.documentTreeOptionsSchema = zod_1.z
95
102
  .object({
96
103
  hideFromDocumentTree: zod_1.z
97
104
  .literal(true)
98
105
  .describe("Whether to hide the element from the document tree folder structure"),
99
- documentTreeFolderTextFormat: zod_1.z.never().optional(),
106
+ documentTreeFolderTextFormat: zod_1.z.never().optional()
100
107
  })
101
108
  .or(zod_1.z.object({
102
109
  hideFromDocumentTree: zod_1.z
@@ -105,6 +112,12 @@ exports.documentTreeOptionsSchema = zod_1.z
105
112
  .describe("Whether to hide the element from the document tree folder structure"),
106
113
  documentTreeFolderTextFormat: zod_1.z
107
114
  .string()
108
- .describe("The format of the document tree folder text, use ':code:' and ':title:' to define where the code and/or title should be inserted"),
115
+ .describe("The format of the document tree folder text, use ':code:' and ':title:' to define where the code and/or title should be inserted")
109
116
  }));
110
- exports.treeResultSchema = exports.elementDataSchema.describe('TreeResult - The result of the evaluation of a criteria set');
117
+ exports.criteriaTreeOptionsSchema = zod_1.z
118
+ .object({
119
+ criteriaTreeElementTextFormat: zod_1.z
120
+ .string()
121
+ .describe("The format of the criteria tree element text, use ':code:' and ':title:' to define where the code and/or title should be inserted")
122
+ });
123
+ exports.treeResultSchema = exports.elementDataSchema.describe("TreeResult - The result of the evaluation of a criteria set");