@openframe-org/criteria-set-protocol 2.1.8 → 2.2.1

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,40 +14,86 @@ 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<["percentage", "number"]>>;
19
- 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">]>>;
20
- text: z.ZodOptional<z.ZodString>;
17
+ export declare const elementDataSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
18
+ type: z.ZodOptional<z.ZodLiteral<"number">>;
19
+ value: z.ZodOptional<z.ZodNumber>;
20
+ total: z.ZodOptional<z.ZodNumber>;
21
21
  maximumValue: z.ZodOptional<z.ZodNumber>;
22
22
  minimumValue: z.ZodOptional<z.ZodNumber>;
23
23
  exclusiveMaximum: z.ZodOptional<z.ZodNumber>;
24
24
  exclusiveMinimum: z.ZodOptional<z.ZodNumber>;
25
- step: z.ZodOptional<z.ZodNumber>;
26
- total: z.ZodOptional<z.ZodNumber>;
27
- readOnly: z.ZodOptional<z.ZodBoolean>;
28
25
  }, "strip", z.ZodTypeAny, {
29
- type?: "number" | "percentage" | undefined;
26
+ type?: "number" | undefined;
30
27
  total?: number | undefined;
31
- value?: string | number | boolean | (string | number | boolean | null)[] | null | undefined;
32
- text?: string | undefined;
28
+ value?: number | undefined;
33
29
  maximumValue?: number | undefined;
34
30
  minimumValue?: number | undefined;
35
31
  exclusiveMaximum?: number | undefined;
36
32
  exclusiveMinimum?: number | undefined;
37
- step?: number | undefined;
38
- readOnly?: boolean | undefined;
39
33
  }, {
40
- type?: "number" | "percentage" | undefined;
34
+ type?: "number" | undefined;
41
35
  total?: number | undefined;
42
- value?: string | number | boolean | (string | number | boolean | null)[] | null | undefined;
43
- text?: string | undefined;
36
+ value?: number | undefined;
44
37
  maximumValue?: number | undefined;
45
38
  minimumValue?: number | undefined;
46
39
  exclusiveMaximum?: number | undefined;
47
40
  exclusiveMinimum?: number | undefined;
48
- step?: number | undefined;
49
- readOnly?: boolean | undefined;
50
- }>;
41
+ }>, z.ZodObject<{
42
+ maximumValue: z.ZodOptional<z.ZodNumber>;
43
+ minimumValue: z.ZodOptional<z.ZodNumber>;
44
+ exclusiveMaximum: z.ZodOptional<z.ZodNumber>;
45
+ exclusiveMinimum: z.ZodOptional<z.ZodNumber>;
46
+ } & {
47
+ type: z.ZodLiteral<"percentage">;
48
+ value: z.ZodOptional<z.ZodNumber>;
49
+ total: z.ZodOptional<z.ZodNever>;
50
+ }, "strip", z.ZodTypeAny, {
51
+ type: "percentage";
52
+ total?: undefined;
53
+ value?: number | undefined;
54
+ maximumValue?: number | undefined;
55
+ minimumValue?: number | undefined;
56
+ exclusiveMaximum?: number | undefined;
57
+ exclusiveMinimum?: number | undefined;
58
+ }, {
59
+ type: "percentage";
60
+ total?: undefined;
61
+ value?: number | undefined;
62
+ maximumValue?: number | undefined;
63
+ minimumValue?: number | undefined;
64
+ exclusiveMaximum?: number | undefined;
65
+ exclusiveMinimum?: number | undefined;
66
+ }>, z.ZodObject<{
67
+ type: z.ZodLiteral<"boolean">;
68
+ value: z.ZodOptional<z.ZodBoolean>;
69
+ total: z.ZodOptional<z.ZodNever>;
70
+ maximumValue: z.ZodOptional<z.ZodNever>;
71
+ minimumValue: z.ZodOptional<z.ZodNever>;
72
+ exclusiveMaximum: z.ZodOptional<z.ZodNever>;
73
+ exclusiveMinimum: z.ZodOptional<z.ZodNever>;
74
+ }, "strip", z.ZodTypeAny, {
75
+ type: "boolean";
76
+ total?: undefined;
77
+ value?: boolean | undefined;
78
+ maximumValue?: undefined;
79
+ minimumValue?: undefined;
80
+ exclusiveMaximum?: undefined;
81
+ exclusiveMinimum?: undefined;
82
+ }, {
83
+ type: "boolean";
84
+ total?: undefined;
85
+ value?: boolean | undefined;
86
+ maximumValue?: undefined;
87
+ minimumValue?: undefined;
88
+ exclusiveMaximum?: undefined;
89
+ exclusiveMinimum?: undefined;
90
+ }>]>, z.ZodObject<{
91
+ text: z.ZodOptional<z.ZodString>;
92
+ }, "strip", z.ZodTypeAny, {
93
+ text?: string | undefined;
94
+ }, {
95
+ text?: string | undefined;
96
+ }>>;
51
97
  export declare const criteriaTreeElementTypeSchema: z.ZodEnum<["theme", "criterion", "task-group", "task", "task-item"]>;
52
98
  export declare const abstractElementSchema: z.ZodObject<{
53
99
  type: z.ZodEnum<["theme", "criterion", "task-group", "task", "task-item"]>;
@@ -101,58 +147,119 @@ export declare const abstractElementSchema: z.ZodObject<{
101
147
  label: string;
102
148
  text: string;
103
149
  }>]>, "many">>;
104
- data: z.ZodOptional<z.ZodObject<{
105
- type: z.ZodOptional<z.ZodEnum<["percentage", "number"]>>;
106
- 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">]>>;
107
- text: z.ZodOptional<z.ZodString>;
150
+ data: z.ZodOptional<z.ZodIntersection<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
151
+ type: z.ZodOptional<z.ZodLiteral<"number">>;
152
+ value: z.ZodOptional<z.ZodNumber>;
153
+ total: z.ZodOptional<z.ZodNumber>;
108
154
  maximumValue: z.ZodOptional<z.ZodNumber>;
109
155
  minimumValue: z.ZodOptional<z.ZodNumber>;
110
156
  exclusiveMaximum: z.ZodOptional<z.ZodNumber>;
111
157
  exclusiveMinimum: z.ZodOptional<z.ZodNumber>;
112
- step: z.ZodOptional<z.ZodNumber>;
113
- total: z.ZodOptional<z.ZodNumber>;
114
- readOnly: z.ZodOptional<z.ZodBoolean>;
115
158
  }, "strip", z.ZodTypeAny, {
116
- type?: "number" | "percentage" | undefined;
159
+ type?: "number" | undefined;
117
160
  total?: number | undefined;
118
- value?: string | number | boolean | (string | number | boolean | null)[] | null | undefined;
119
- text?: string | undefined;
161
+ value?: number | undefined;
120
162
  maximumValue?: number | undefined;
121
163
  minimumValue?: number | undefined;
122
164
  exclusiveMaximum?: number | undefined;
123
165
  exclusiveMinimum?: number | undefined;
124
- step?: number | undefined;
125
- readOnly?: boolean | undefined;
126
166
  }, {
127
- type?: "number" | "percentage" | undefined;
167
+ type?: "number" | undefined;
128
168
  total?: number | undefined;
129
- value?: string | number | boolean | (string | number | boolean | null)[] | null | undefined;
130
- text?: string | undefined;
169
+ value?: number | undefined;
170
+ maximumValue?: number | undefined;
171
+ minimumValue?: number | undefined;
172
+ exclusiveMaximum?: number | undefined;
173
+ exclusiveMinimum?: number | undefined;
174
+ }>, z.ZodObject<{
175
+ maximumValue: z.ZodOptional<z.ZodNumber>;
176
+ minimumValue: z.ZodOptional<z.ZodNumber>;
177
+ exclusiveMaximum: z.ZodOptional<z.ZodNumber>;
178
+ exclusiveMinimum: z.ZodOptional<z.ZodNumber>;
179
+ } & {
180
+ type: z.ZodLiteral<"percentage">;
181
+ value: z.ZodOptional<z.ZodNumber>;
182
+ total: z.ZodOptional<z.ZodNever>;
183
+ }, "strip", z.ZodTypeAny, {
184
+ type: "percentage";
185
+ total?: undefined;
186
+ value?: number | undefined;
131
187
  maximumValue?: number | undefined;
132
188
  minimumValue?: number | undefined;
133
189
  exclusiveMaximum?: number | undefined;
134
190
  exclusiveMinimum?: number | undefined;
135
- step?: number | undefined;
136
- readOnly?: boolean | undefined;
137
- }>>;
191
+ }, {
192
+ type: "percentage";
193
+ total?: undefined;
194
+ value?: number | undefined;
195
+ maximumValue?: number | undefined;
196
+ minimumValue?: number | undefined;
197
+ exclusiveMaximum?: number | undefined;
198
+ exclusiveMinimum?: number | undefined;
199
+ }>, z.ZodObject<{
200
+ type: z.ZodLiteral<"boolean">;
201
+ value: z.ZodOptional<z.ZodBoolean>;
202
+ total: z.ZodOptional<z.ZodNever>;
203
+ maximumValue: z.ZodOptional<z.ZodNever>;
204
+ minimumValue: z.ZodOptional<z.ZodNever>;
205
+ exclusiveMaximum: z.ZodOptional<z.ZodNever>;
206
+ exclusiveMinimum: z.ZodOptional<z.ZodNever>;
207
+ }, "strip", z.ZodTypeAny, {
208
+ type: "boolean";
209
+ total?: undefined;
210
+ value?: boolean | undefined;
211
+ maximumValue?: undefined;
212
+ minimumValue?: undefined;
213
+ exclusiveMaximum?: undefined;
214
+ exclusiveMinimum?: undefined;
215
+ }, {
216
+ type: "boolean";
217
+ total?: undefined;
218
+ value?: boolean | undefined;
219
+ maximumValue?: undefined;
220
+ minimumValue?: undefined;
221
+ exclusiveMaximum?: undefined;
222
+ exclusiveMinimum?: undefined;
223
+ }>]>, z.ZodObject<{
224
+ text: z.ZodOptional<z.ZodString>;
225
+ }, "strip", z.ZodTypeAny, {
226
+ text?: string | undefined;
227
+ }, {
228
+ text?: string | undefined;
229
+ }>>>;
138
230
  sortOrder: z.ZodOptional<z.ZodNumber>;
139
231
  }, "strip", z.ZodTypeAny, {
140
232
  code: string;
141
233
  type: "theme" | "criterion" | "task-group" | "task" | "task-item";
142
234
  title: string;
143
235
  longFormTitle: string;
144
- data?: {
145
- type?: "number" | "percentage" | undefined;
236
+ data?: (({
237
+ type?: "number" | undefined;
146
238
  total?: number | undefined;
147
- value?: string | number | boolean | (string | number | boolean | null)[] | null | undefined;
148
- text?: string | undefined;
239
+ value?: number | undefined;
149
240
  maximumValue?: number | undefined;
150
241
  minimumValue?: number | undefined;
151
242
  exclusiveMaximum?: number | undefined;
152
243
  exclusiveMinimum?: number | undefined;
153
- step?: number | undefined;
154
- readOnly?: boolean | undefined;
155
- } | undefined;
244
+ } | {
245
+ type: "percentage";
246
+ total?: undefined;
247
+ value?: number | undefined;
248
+ maximumValue?: number | undefined;
249
+ minimumValue?: number | undefined;
250
+ exclusiveMaximum?: number | undefined;
251
+ exclusiveMinimum?: number | undefined;
252
+ } | {
253
+ type: "boolean";
254
+ total?: undefined;
255
+ value?: boolean | undefined;
256
+ maximumValue?: undefined;
257
+ minimumValue?: undefined;
258
+ exclusiveMaximum?: undefined;
259
+ exclusiveMinimum?: undefined;
260
+ }) & {
261
+ text?: string | undefined;
262
+ }) | undefined;
156
263
  tags?: string[] | undefined;
157
264
  documentation?: ({
158
265
  type: "pdf";
@@ -175,18 +282,33 @@ export declare const abstractElementSchema: z.ZodObject<{
175
282
  type: "theme" | "criterion" | "task-group" | "task" | "task-item";
176
283
  title: string;
177
284
  longFormTitle: string;
178
- data?: {
179
- type?: "number" | "percentage" | undefined;
285
+ data?: (({
286
+ type?: "number" | undefined;
180
287
  total?: number | undefined;
181
- value?: string | number | boolean | (string | number | boolean | null)[] | null | undefined;
182
- text?: string | undefined;
288
+ value?: number | undefined;
183
289
  maximumValue?: number | undefined;
184
290
  minimumValue?: number | undefined;
185
291
  exclusiveMaximum?: number | undefined;
186
292
  exclusiveMinimum?: number | undefined;
187
- step?: number | undefined;
188
- readOnly?: boolean | undefined;
189
- } | undefined;
293
+ } | {
294
+ type: "percentage";
295
+ total?: undefined;
296
+ value?: number | undefined;
297
+ maximumValue?: number | undefined;
298
+ minimumValue?: number | undefined;
299
+ exclusiveMaximum?: number | undefined;
300
+ exclusiveMinimum?: number | undefined;
301
+ } | {
302
+ type: "boolean";
303
+ total?: undefined;
304
+ value?: boolean | undefined;
305
+ maximumValue?: undefined;
306
+ minimumValue?: undefined;
307
+ exclusiveMaximum?: undefined;
308
+ exclusiveMinimum?: undefined;
309
+ }) & {
310
+ text?: string | undefined;
311
+ }) | undefined;
190
312
  tags?: string[] | undefined;
191
313
  documentation?: ({
192
314
  type: "pdf";
@@ -20,14 +20,16 @@ exports.taskItemScalarValueSchema = zod_1.z
20
20
  exports.taskItemValueSchema = zod_1.z
21
21
  .union([exports.taskItemScalarValueSchema, zod_1.z.array(exports.taskItemScalarValueSchema)])
22
22
  .describe("TaskItemValue - Can be either a scalar value or an array of scalar values");
23
- exports.elementDataSchema = zod_1.z
24
- .object({
23
+ const numberBasedDataSchema = zod_1.z.object({
25
24
  type: zod_1.z
26
- .enum(["percentage", "number"])
25
+ .literal("number")
27
26
  .optional()
28
27
  .describe("Type of numeric data (percentage or number)"),
29
- value: exports.taskItemValueSchema.optional().describe("Value of the element"),
30
- text: zod_1.z.string().optional().describe("Text representation of the value"),
28
+ value: zod_1.z.number().optional().describe("Value of the element"),
29
+ total: zod_1.z
30
+ .number()
31
+ .optional()
32
+ .describe("Total value, understood as 'value'/'total'"),
31
33
  maximumValue: zod_1.z
32
34
  .number()
33
35
  .optional()
@@ -44,20 +46,35 @@ exports.elementDataSchema = zod_1.z
44
46
  .number()
45
47
  .optional()
46
48
  .describe("Minimum allowed value (exclusive)"),
47
- step: zod_1.z
48
- .number()
49
- .optional()
50
- .describe("Increment/decrement step size for numeric inputs"),
51
- total: zod_1.z
52
- .number()
53
- .optional()
54
- .describe("Total value, understood as 'value'/'total'"),
55
- readOnly: zod_1.z
56
- .boolean()
57
- .optional()
58
- .describe("Whether the element value can be modified"),
59
- })
60
- .describe("Element data containing value constraints and metadata");
49
+ });
50
+ const percentageBasedDataSchema = numberBasedDataSchema.omit({
51
+ type: true,
52
+ total: true
53
+ }).extend({
54
+ type: zod_1.z
55
+ .literal("percentage")
56
+ .describe("Type of numeric data (percentage or number)"),
57
+ value: zod_1.z.number().optional().describe("Value of the element"),
58
+ total: zod_1.z.never().optional(),
59
+ });
60
+ const booleanBasedDataSchema = zod_1.z.object({
61
+ type: zod_1.z
62
+ .literal("boolean")
63
+ .describe("Type of numeric data (percentage or number)"),
64
+ value: zod_1.z.boolean().optional().describe("Value of the element"),
65
+ total: zod_1.z.never().optional(),
66
+ maximumValue: zod_1.z.never().optional(),
67
+ minimumValue: zod_1.z.never().optional(),
68
+ exclusiveMaximum: zod_1.z.never().optional(),
69
+ exclusiveMinimum: zod_1.z.never().optional(),
70
+ });
71
+ const valueDataSchema = zod_1.z.discriminatedUnion('type', [numberBasedDataSchema, percentageBasedDataSchema, booleanBasedDataSchema])
72
+ .describe("ValueData - Data containing value constraints and metadata");
73
+ exports.elementDataSchema = valueDataSchema.and(zod_1.z
74
+ .object({
75
+ text: zod_1.z.string().optional().describe("Text representation of the value"),
76
+ }))
77
+ .describe("ElementData - Element data containing value constraints and metadata");
61
78
  exports.criteriaTreeElementTypeSchema = zod_1.z
62
79
  .enum(["theme", "criterion", "task-group", "task", "task-item"])
63
80
  .describe("CriteriaTreeElementType - Types of elements that can exist in the criteria tree hierarchy");