@openframe-org/criteria-set-protocol 3.0.0-alpha.9 → 3.0.0-beta.2

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,28 +76,28 @@ 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.ZodLiteral<false>>;
94
94
  breadcrumbTextFormat: z.ZodString;
95
95
  }, z.core.$strip>]>;
96
96
  export declare const documentTreeOptionsSchema: z.ZodUnion<[z.ZodObject<{
97
97
  hideFromDocumentTree: z.ZodLiteral<true>;
98
98
  documentTreeFolderTextFormat: z.ZodOptional<z.ZodNever>;
99
99
  }, z.core.$strip>, z.ZodObject<{
100
- hideFromDocumentTree: z.ZodNullable<z.ZodLiteral<false>>;
100
+ hideFromDocumentTree: z.ZodLiteral<false>;
101
101
  documentTreeFolderTextFormat: z.ZodString;
102
102
  }, z.core.$strip>]>;
103
103
  export declare const criteriaTreeOptionsSchema: 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">;
@@ -20,9 +20,7 @@ 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
- const abstractElementDataSchema = zod_1.z.object({
24
- type: zod_1.z.enum(["number", "percentage", "boolean"])
25
- }).catchall(zod_1.z.any());
23
+ const abstractElementDataSchema = zod_1.z.object().catchall(zod_1.z.any());
26
24
  const abstractNumberElementDataSchema = abstractElementDataSchema.extend({
27
25
  value: zod_1.z.number().nullable().describe("Value of the element"),
28
26
  maximumValue: zod_1.z
@@ -40,21 +38,25 @@ const numberElementDataSchema = abstractNumberElementDataSchema.extend({
40
38
  total: zod_1.z
41
39
  .number()
42
40
  .nullable()
43
- .describe("Total value, understood as 'value'/'total'"),
44
- });
41
+ .describe("Total value, understood as 'value'/'total'")
42
+ }).catchall(zod_1.z.any());
45
43
  const percentageElementDataSchema = abstractNumberElementDataSchema.extend({
46
44
  type: zod_1.z.literal("percentage").describe("Type of data"),
47
45
  total: zod_1.z.never().optional()
48
- });
46
+ }).catchall(zod_1.z.any());
49
47
  const booleanElementDataSchema = abstractElementDataSchema.extend({
50
48
  type: zod_1.z.literal("boolean").describe("Type of data"),
51
49
  value: zod_1.z.boolean().nullable().describe("Value of the element"),
52
50
  total: zod_1.z.never().optional(),
53
51
  maximumValue: zod_1.z.never().optional(),
54
52
  minimumValue: zod_1.z.never().optional(),
55
- weight: zod_1.z.never().optional(),
56
- });
57
- exports.elementDataSchema = numberElementDataSchema.or(percentageElementDataSchema).or(booleanElementDataSchema)
53
+ weight: zod_1.z.never().optional()
54
+ }).catchall(zod_1.z.any());
55
+ exports.elementDataSchema = zod_1.z.discriminatedUnion("type", [
56
+ numberElementDataSchema,
57
+ percentageElementDataSchema,
58
+ booleanElementDataSchema
59
+ ])
58
60
  .describe("ElementData - Element data containing value constraints and metadata");
59
61
  exports.criteriaTreeElementTypeSchema = zod_1.z
60
62
  .enum(["theme", "criterion", "task-group", "task", "task-item"])
@@ -90,7 +92,6 @@ exports.breadcrumbOptionsSchema = zod_1.z
90
92
  .or(zod_1.z.object({
91
93
  hideFromBreadcrumbs: zod_1.z
92
94
  .literal(false)
93
- .nullable()
94
95
  .default(false)
95
96
  .describe("Whether to hide the element from the breadcrumbs"),
96
97
  breadcrumbTextFormat: zod_1.z
@@ -107,7 +108,6 @@ exports.documentTreeOptionsSchema = zod_1.z
107
108
  .or(zod_1.z.object({
108
109
  hideFromDocumentTree: zod_1.z
109
110
  .literal(false)
110
- .nullable()
111
111
  .describe("Whether to hide the element from the document tree folder structure"),
112
112
  documentTreeFolderTextFormat: zod_1.z
113
113
  .string()
@@ -125,4 +125,10 @@ exports.reportOptionsSchema = zod_1.z
125
125
  .string()
126
126
  .describe("The format of the report row text, use ':code:' and ':title:' to define where the code and/or title should be inserted")
127
127
  });
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");
128
+ const numberTreeResult = numberElementDataSchema.omit({ weight: true, minimumValue: true, maximumValue: true });
129
+ const percentageTreeResult = percentageElementDataSchema.omit({ weight: true, minimumValue: true, maximumValue: true });
130
+ exports.treeResultSchema = zod_1.z.discriminatedUnion("type", [
131
+ numberTreeResult,
132
+ percentageTreeResult,
133
+ booleanElementDataSchema
134
+ ]).describe("TreeResult - The result of the evaluation of a criteria set");