@openframe-org/criteria-set-protocol 3.0.0-alpha.11 → 3.0.0-alpha.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.
@@ -6,7 +6,7 @@ export declare const colorSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<
6
6
  }, z.core.$strip>]>;
7
7
  export declare const taskItemScalarValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
8
8
  export declare const taskItemValueSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
9
- export declare const elementDataSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
9
+ export declare const elementDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
10
10
  value: z.ZodNullable<z.ZodNumber>;
11
11
  maximumValue: z.ZodNullable<z.ZodNumber>;
12
12
  minimumValue: z.ZodNullable<z.ZodNumber>;
@@ -20,14 +20,14 @@ export declare const elementDataSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
20
20
  weight: z.ZodNullable<z.ZodNumber>;
21
21
  type: z.ZodLiteral<"percentage">;
22
22
  total: z.ZodOptional<z.ZodNever>;
23
- }, z.core.$catchall<z.ZodAny>>]>, z.ZodObject<{
23
+ }, z.core.$catchall<z.ZodAny>>, z.ZodObject<{
24
24
  type: z.ZodLiteral<"boolean">;
25
25
  value: z.ZodNullable<z.ZodBoolean>;
26
26
  total: z.ZodOptional<z.ZodNever>;
27
27
  maximumValue: z.ZodOptional<z.ZodNever>;
28
28
  minimumValue: z.ZodOptional<z.ZodNever>;
29
29
  weight: z.ZodOptional<z.ZodNever>;
30
- }, z.core.$catchall<z.ZodAny>>]>;
30
+ }, z.core.$catchall<z.ZodAny>>], "type">;
31
31
  export declare const criteriaTreeElementTypeSchema: z.ZodEnum<{
32
32
  theme: "theme";
33
33
  criterion: "criterion";
@@ -62,7 +62,7 @@ export declare const abstractElementSchema: z.ZodObject<{
62
62
  type: z.ZodLiteral<"link">;
63
63
  url: z.ZodString;
64
64
  }, z.core.$strip>], "type">>>;
65
- data: z.ZodNullable<z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
65
+ data: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
66
66
  value: z.ZodNullable<z.ZodNumber>;
67
67
  maximumValue: z.ZodNullable<z.ZodNumber>;
68
68
  minimumValue: z.ZodNullable<z.ZodNumber>;
@@ -76,21 +76,21 @@ export declare const abstractElementSchema: z.ZodObject<{
76
76
  weight: z.ZodNullable<z.ZodNumber>;
77
77
  type: z.ZodLiteral<"percentage">;
78
78
  total: z.ZodOptional<z.ZodNever>;
79
- }, z.core.$catchall<z.ZodAny>>]>, z.ZodObject<{
79
+ }, z.core.$catchall<z.ZodAny>>, z.ZodObject<{
80
80
  type: z.ZodLiteral<"boolean">;
81
81
  value: z.ZodNullable<z.ZodBoolean>;
82
82
  total: z.ZodOptional<z.ZodNever>;
83
83
  maximumValue: z.ZodOptional<z.ZodNever>;
84
84
  minimumValue: z.ZodOptional<z.ZodNever>;
85
85
  weight: z.ZodOptional<z.ZodNever>;
86
- }, z.core.$catchall<z.ZodAny>>]>>;
86
+ }, z.core.$catchall<z.ZodAny>>], "type">>;
87
87
  sortOrder: z.ZodNullable<z.ZodNumber>;
88
88
  }, z.core.$strip>;
89
89
  export declare const breadcrumbOptionsSchema: z.ZodUnion<[z.ZodObject<{
90
90
  hideFromBreadcrumbs: z.ZodLiteral<true>;
91
91
  breadcrumbTextFormat: z.ZodOptional<z.ZodNever>;
92
92
  }, z.core.$strip>, z.ZodObject<{
93
- hideFromBreadcrumbs: z.ZodDefault<z.ZodNullable<z.ZodLiteral<false>>>;
93
+ hideFromBreadcrumbs: z.ZodDefault<z.ZodOptional<z.ZodLiteral<false>>>;
94
94
  breadcrumbTextFormat: z.ZodString;
95
95
  }, z.core.$strip>]>;
96
96
  export declare const documentTreeOptionsSchema: z.ZodUnion<[z.ZodObject<{
@@ -106,7 +106,7 @@ export declare const criteriaTreeOptionsSchema: z.ZodObject<{
106
106
  export declare const reportOptionsSchema: z.ZodObject<{
107
107
  reportTitleTextFormat: z.ZodString;
108
108
  }, z.core.$strip>;
109
- export declare const treeResultSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
109
+ export declare const treeResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
110
110
  type: z.ZodLiteral<"number">;
111
111
  total: z.ZodNullable<z.ZodNumber>;
112
112
  value: z.ZodNullable<z.ZodNumber>;
@@ -114,11 +114,11 @@ export declare const treeResultSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
114
114
  type: z.ZodLiteral<"percentage">;
115
115
  total: z.ZodOptional<z.ZodNever>;
116
116
  value: z.ZodNullable<z.ZodNumber>;
117
- }, z.core.$catchall<z.ZodAny>>]>, z.ZodObject<{
117
+ }, z.core.$catchall<z.ZodAny>>, z.ZodObject<{
118
118
  type: z.ZodLiteral<"boolean">;
119
119
  value: z.ZodNullable<z.ZodBoolean>;
120
120
  total: z.ZodOptional<z.ZodNever>;
121
121
  maximumValue: z.ZodOptional<z.ZodNever>;
122
122
  minimumValue: z.ZodOptional<z.ZodNever>;
123
123
  weight: z.ZodOptional<z.ZodNever>;
124
- }, z.core.$catchall<z.ZodAny>>]>;
124
+ }, z.core.$catchall<z.ZodAny>>], "type">;
@@ -54,7 +54,11 @@ const booleanElementDataSchema = abstractElementDataSchema.extend({
54
54
  minimumValue: zod_1.z.never().optional(),
55
55
  weight: zod_1.z.never().optional(),
56
56
  });
57
- exports.elementDataSchema = numberElementDataSchema.or(percentageElementDataSchema).or(booleanElementDataSchema)
57
+ exports.elementDataSchema = zod_1.z.discriminatedUnion("type", [
58
+ numberElementDataSchema,
59
+ percentageElementDataSchema,
60
+ booleanElementDataSchema
61
+ ])
58
62
  .describe("ElementData - Element data containing value constraints and metadata");
59
63
  exports.criteriaTreeElementTypeSchema = zod_1.z
60
64
  .enum(["theme", "criterion", "task-group", "task", "task-item"])
@@ -90,7 +94,7 @@ exports.breadcrumbOptionsSchema = zod_1.z
90
94
  .or(zod_1.z.object({
91
95
  hideFromBreadcrumbs: zod_1.z
92
96
  .literal(false)
93
- .nullable()
97
+ .optional()
94
98
  .default(false)
95
99
  .describe("Whether to hide the element from the breadcrumbs"),
96
100
  breadcrumbTextFormat: zod_1.z
@@ -125,4 +129,10 @@ exports.reportOptionsSchema = zod_1.z
125
129
  .string()
126
130
  .describe("The format of the report row text, use ':code:' and ':title:' to define where the code and/or title should be inserted")
127
131
  });
128
- exports.treeResultSchema = numberElementDataSchema.omit({ weight: true, minimumValue: true, maximumValue: true }).or(percentageElementDataSchema.omit({ weight: true, minimumValue: true, maximumValue: true })).or(booleanElementDataSchema).describe("TreeResult - The result of the evaluation of a criteria set");
132
+ const numberTreeResult = numberElementDataSchema.omit({ weight: true, minimumValue: true, maximumValue: true });
133
+ const percentageTreeResult = percentageElementDataSchema.omit({ weight: true, minimumValue: true, maximumValue: true });
134
+ exports.treeResultSchema = zod_1.z.discriminatedUnion("type", [
135
+ numberTreeResult,
136
+ percentageTreeResult,
137
+ booleanElementDataSchema
138
+ ]).describe("TreeResult - The result of the evaluation of a criteria set");