@openframe-org/criteria-set-protocol 3.0.0-alpha.8 → 3.0.0-beta.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,7 +14,6 @@ exports.taskOptionsSchema = zod_1.z
14
14
  .describe("The format of the document tree folder text, use ':code:' and ':title:' to define where the code and/or title should be inserted"),
15
15
  showCodeAsIndicatorTaskViewTitle: zod_1.z
16
16
  .boolean()
17
- .nullable()
18
17
  .default(false)
19
18
  .describe("Whether the title of the indicator task view should show the task code, or the hardcoded description text"),
20
19
  })
@@ -12,18 +12,18 @@ export declare const themeStyleSchema: z.ZodObject<{
12
12
  }, z.core.$strip>]>;
13
13
  }, z.core.$strip>;
14
14
  export declare const themeOptionsSchema: z.ZodIntersection<z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
15
- hideCodeInReport: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
15
+ hideCodeInReport: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
16
16
  }, z.core.$strip>, z.ZodUnion<[z.ZodObject<{
17
17
  hideFromBreadcrumbs: z.ZodLiteral<true>;
18
18
  breadcrumbTextFormat: z.ZodOptional<z.ZodNever>;
19
19
  }, z.core.$strip>, z.ZodObject<{
20
- hideFromBreadcrumbs: z.ZodDefault<z.ZodNullable<z.ZodLiteral<false>>>;
20
+ hideFromBreadcrumbs: z.ZodDefault<z.ZodLiteral<false>>;
21
21
  breadcrumbTextFormat: z.ZodString;
22
22
  }, z.core.$strip>]>>, z.ZodUnion<[z.ZodObject<{
23
23
  hideFromDocumentTree: z.ZodLiteral<true>;
24
24
  documentTreeFolderTextFormat: z.ZodOptional<z.ZodNever>;
25
25
  }, z.core.$strip>, z.ZodObject<{
26
- hideFromDocumentTree: z.ZodNullable<z.ZodLiteral<false>>;
26
+ hideFromDocumentTree: z.ZodLiteral<false>;
27
27
  documentTreeFolderTextFormat: z.ZodString;
28
28
  }, z.core.$strip>]>>, z.ZodObject<{
29
29
  reportTitleTextFormat: z.ZodString;
@@ -48,7 +48,7 @@ export declare const themeSchema: z.ZodObject<{
48
48
  type: z.ZodLiteral<"link">;
49
49
  url: z.ZodString;
50
50
  }, z.core.$strip>], "type">>>;
51
- data: z.ZodNullable<z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
51
+ data: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
52
52
  value: z.ZodNullable<z.ZodNumber>;
53
53
  maximumValue: z.ZodNullable<z.ZodNumber>;
54
54
  minimumValue: z.ZodNullable<z.ZodNumber>;
@@ -62,14 +62,14 @@ export declare const themeSchema: z.ZodObject<{
62
62
  weight: z.ZodNullable<z.ZodNumber>;
63
63
  type: z.ZodLiteral<"percentage">;
64
64
  total: z.ZodOptional<z.ZodNever>;
65
- }, z.core.$catchall<z.ZodAny>>]>, z.ZodObject<{
65
+ }, z.core.$catchall<z.ZodAny>>, z.ZodObject<{
66
66
  type: z.ZodLiteral<"boolean">;
67
67
  value: z.ZodNullable<z.ZodBoolean>;
68
68
  total: z.ZodOptional<z.ZodNever>;
69
69
  maximumValue: z.ZodOptional<z.ZodNever>;
70
70
  minimumValue: z.ZodOptional<z.ZodNever>;
71
71
  weight: z.ZodOptional<z.ZodNever>;
72
- }, z.core.$catchall<z.ZodAny>>]>>;
72
+ }, z.core.$catchall<z.ZodAny>>], "type">>;
73
73
  sortOrder: z.ZodNullable<z.ZodNumber>;
74
74
  type: z.ZodLiteral<"theme">;
75
75
  style: z.ZodNullable<z.ZodObject<{
@@ -104,7 +104,7 @@ export declare const themeSchema: z.ZodObject<{
104
104
  type: z.ZodLiteral<"link">;
105
105
  url: z.ZodString;
106
106
  }, z.core.$strip>], "type">>>;
107
- data: z.ZodNullable<z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
107
+ data: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
108
108
  value: z.ZodNullable<z.ZodNumber>;
109
109
  maximumValue: z.ZodNullable<z.ZodNumber>;
110
110
  minimumValue: z.ZodNullable<z.ZodNumber>;
@@ -118,14 +118,14 @@ export declare const themeSchema: z.ZodObject<{
118
118
  weight: z.ZodNullable<z.ZodNumber>;
119
119
  type: z.ZodLiteral<"percentage">;
120
120
  total: z.ZodOptional<z.ZodNever>;
121
- }, z.core.$catchall<z.ZodAny>>]>, z.ZodObject<{
121
+ }, z.core.$catchall<z.ZodAny>>, z.ZodObject<{
122
122
  type: z.ZodLiteral<"boolean">;
123
123
  value: z.ZodNullable<z.ZodBoolean>;
124
124
  total: z.ZodOptional<z.ZodNever>;
125
125
  maximumValue: z.ZodOptional<z.ZodNever>;
126
126
  minimumValue: z.ZodOptional<z.ZodNever>;
127
127
  weight: z.ZodOptional<z.ZodNever>;
128
- }, z.core.$catchall<z.ZodAny>>]>>;
128
+ }, z.core.$catchall<z.ZodAny>>], "type">>;
129
129
  sortOrder: z.ZodNullable<z.ZodNumber>;
130
130
  type: z.ZodLiteral<"criterion">;
131
131
  items: z.ZodArray<z.ZodLazy<z.ZodObject<{
@@ -148,7 +148,7 @@ export declare const themeSchema: z.ZodObject<{
148
148
  type: z.ZodLiteral<"link">;
149
149
  url: z.ZodString;
150
150
  }, z.core.$strip>], "type">>>;
151
- data: z.ZodNullable<z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
151
+ data: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
152
152
  value: z.ZodNullable<z.ZodNumber>;
153
153
  maximumValue: z.ZodNullable<z.ZodNumber>;
154
154
  minimumValue: z.ZodNullable<z.ZodNumber>;
@@ -162,14 +162,14 @@ export declare const themeSchema: z.ZodObject<{
162
162
  weight: z.ZodNullable<z.ZodNumber>;
163
163
  type: z.ZodLiteral<"percentage">;
164
164
  total: z.ZodOptional<z.ZodNever>;
165
- }, z.core.$catchall<z.ZodAny>>]>, z.ZodObject<{
165
+ }, z.core.$catchall<z.ZodAny>>, z.ZodObject<{
166
166
  type: z.ZodLiteral<"boolean">;
167
167
  value: z.ZodNullable<z.ZodBoolean>;
168
168
  total: z.ZodOptional<z.ZodNever>;
169
169
  maximumValue: z.ZodOptional<z.ZodNever>;
170
170
  minimumValue: z.ZodOptional<z.ZodNever>;
171
171
  weight: z.ZodOptional<z.ZodNever>;
172
- }, z.core.$catchall<z.ZodAny>>]>>;
172
+ }, z.core.$catchall<z.ZodAny>>], "type">>;
173
173
  sortOrder: z.ZodNullable<z.ZodNumber>;
174
174
  type: z.ZodLiteral<"task-group">;
175
175
  description: z.ZodNullable<z.ZodString>;
@@ -194,7 +194,7 @@ export declare const themeSchema: z.ZodObject<{
194
194
  type: z.ZodLiteral<"link">;
195
195
  url: z.ZodString;
196
196
  }, z.core.$strip>], "type">>>;
197
- data: z.ZodNullable<z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
197
+ data: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
198
198
  value: z.ZodNullable<z.ZodNumber>;
199
199
  maximumValue: z.ZodNullable<z.ZodNumber>;
200
200
  minimumValue: z.ZodNullable<z.ZodNumber>;
@@ -208,14 +208,14 @@ export declare const themeSchema: z.ZodObject<{
208
208
  weight: z.ZodNullable<z.ZodNumber>;
209
209
  type: z.ZodLiteral<"percentage">;
210
210
  total: z.ZodOptional<z.ZodNever>;
211
- }, z.core.$catchall<z.ZodAny>>]>, z.ZodObject<{
211
+ }, z.core.$catchall<z.ZodAny>>, z.ZodObject<{
212
212
  type: z.ZodLiteral<"boolean">;
213
213
  value: z.ZodNullable<z.ZodBoolean>;
214
214
  total: z.ZodOptional<z.ZodNever>;
215
215
  maximumValue: z.ZodOptional<z.ZodNever>;
216
216
  minimumValue: z.ZodOptional<z.ZodNever>;
217
217
  weight: z.ZodOptional<z.ZodNever>;
218
- }, z.core.$catchall<z.ZodAny>>]>>;
218
+ }, z.core.$catchall<z.ZodAny>>], "type">>;
219
219
  sortOrder: z.ZodNullable<z.ZodNumber>;
220
220
  type: z.ZodLiteral<"task">;
221
221
  description: z.ZodNullable<z.ZodString>;
@@ -239,7 +239,7 @@ export declare const themeSchema: z.ZodObject<{
239
239
  }, z.core.$strip>], "type">>>;
240
240
  sortOrder: z.ZodNullable<z.ZodNumber>;
241
241
  type: z.ZodLiteral<"task-item">;
242
- data: z.ZodNullable<z.ZodIntersection<z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
242
+ data: z.ZodNullable<z.ZodIntersection<z.ZodDiscriminatedUnion<[z.ZodObject<{
243
243
  value: z.ZodNullable<z.ZodNumber>;
244
244
  maximumValue: z.ZodNullable<z.ZodNumber>;
245
245
  minimumValue: z.ZodNullable<z.ZodNumber>;
@@ -253,14 +253,14 @@ export declare const themeSchema: z.ZodObject<{
253
253
  weight: z.ZodNullable<z.ZodNumber>;
254
254
  type: z.ZodLiteral<"percentage">;
255
255
  total: z.ZodOptional<z.ZodNever>;
256
- }, z.core.$catchall<z.ZodAny>>]>, z.ZodObject<{
256
+ }, z.core.$catchall<z.ZodAny>>, z.ZodObject<{
257
257
  type: z.ZodLiteral<"boolean">;
258
258
  value: z.ZodNullable<z.ZodBoolean>;
259
259
  total: z.ZodOptional<z.ZodNever>;
260
260
  maximumValue: z.ZodOptional<z.ZodNever>;
261
261
  minimumValue: z.ZodOptional<z.ZodNever>;
262
262
  weight: z.ZodOptional<z.ZodNever>;
263
- }, z.core.$catchall<z.ZodAny>>]>, z.ZodObject<{
263
+ }, z.core.$catchall<z.ZodAny>>], "type">, z.ZodObject<{
264
264
  readOnly: z.ZodNullable<z.ZodBoolean>;
265
265
  valueReference: z.ZodNullable<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]>>]>>;
266
266
  }, z.core.$strip>>>;
@@ -295,7 +295,7 @@ export declare const themeSchema: z.ZodObject<{
295
295
  }, z.core.$strip>, z.ZodObject<{
296
296
  label: z.ZodNullable<z.ZodString>;
297
297
  readOnly: z.ZodNullable<z.ZodBoolean>;
298
- type: z.ZodNullable<z.ZodLiteral<"number">>;
298
+ type: z.ZodLiteral<"number">;
299
299
  minimum: z.ZodNullable<z.ZodNumber>;
300
300
  maximum: z.ZodNullable<z.ZodNumber>;
301
301
  step: z.ZodNullable<z.ZodNumber>;
@@ -318,7 +318,7 @@ export declare const themeSchema: z.ZodObject<{
318
318
  options: z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
319
319
  breadcrumbTextFormat: z.ZodString;
320
320
  documentTreeFolderTextFormat: z.ZodString;
321
- showCodeAsIndicatorTaskViewTitle: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
321
+ showCodeAsIndicatorTaskViewTitle: z.ZodDefault<z.ZodBoolean>;
322
322
  }, z.core.$strip>, z.ZodObject<{
323
323
  criteriaTreeElementTextFormat: z.ZodString;
324
324
  }, z.core.$strip>>, z.ZodObject<{
@@ -327,18 +327,18 @@ export declare const themeSchema: z.ZodObject<{
327
327
  }, z.core.$strip>>>;
328
328
  }, z.core.$strip>>>;
329
329
  options: z.ZodIntersection<z.ZodIntersection<z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
330
- hideCodeInReport: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
330
+ hideCodeInReport: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
331
331
  }, z.core.$strip>, z.ZodUnion<[z.ZodObject<{
332
332
  hideFromBreadcrumbs: z.ZodLiteral<true>;
333
333
  breadcrumbTextFormat: z.ZodOptional<z.ZodNever>;
334
334
  }, z.core.$strip>, z.ZodObject<{
335
- hideFromBreadcrumbs: z.ZodDefault<z.ZodNullable<z.ZodLiteral<false>>>;
335
+ hideFromBreadcrumbs: z.ZodDefault<z.ZodLiteral<false>>;
336
336
  breadcrumbTextFormat: z.ZodString;
337
337
  }, z.core.$strip>]>>, z.ZodUnion<[z.ZodObject<{
338
338
  hideFromDocumentTree: z.ZodLiteral<true>;
339
339
  documentTreeFolderTextFormat: z.ZodOptional<z.ZodNever>;
340
340
  }, z.core.$strip>, z.ZodObject<{
341
- hideFromDocumentTree: z.ZodNullable<z.ZodLiteral<false>>;
341
+ hideFromDocumentTree: z.ZodLiteral<false>;
342
342
  documentTreeFolderTextFormat: z.ZodString;
343
343
  }, z.core.$strip>]>>, z.ZodObject<{
344
344
  criteriaTreeElementTextFormat: z.ZodString;
@@ -347,18 +347,18 @@ export declare const themeSchema: z.ZodObject<{
347
347
  }, z.core.$strip>>;
348
348
  }, z.core.$strip>>;
349
349
  options: z.ZodIntersection<z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
350
- hideCodeInReport: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
350
+ hideCodeInReport: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
351
351
  }, z.core.$strip>, z.ZodUnion<[z.ZodObject<{
352
352
  hideFromBreadcrumbs: z.ZodLiteral<true>;
353
353
  breadcrumbTextFormat: z.ZodOptional<z.ZodNever>;
354
354
  }, z.core.$strip>, z.ZodObject<{
355
- hideFromBreadcrumbs: z.ZodDefault<z.ZodNullable<z.ZodLiteral<false>>>;
355
+ hideFromBreadcrumbs: z.ZodDefault<z.ZodLiteral<false>>;
356
356
  breadcrumbTextFormat: z.ZodString;
357
357
  }, z.core.$strip>]>>, z.ZodUnion<[z.ZodObject<{
358
358
  hideFromDocumentTree: z.ZodLiteral<true>;
359
359
  documentTreeFolderTextFormat: z.ZodOptional<z.ZodNever>;
360
360
  }, z.core.$strip>, z.ZodObject<{
361
- hideFromDocumentTree: z.ZodNullable<z.ZodLiteral<false>>;
361
+ hideFromDocumentTree: z.ZodLiteral<false>;
362
362
  documentTreeFolderTextFormat: z.ZodString;
363
363
  }, z.core.$strip>]>>, z.ZodObject<{
364
364
  reportTitleTextFormat: z.ZodString;
@@ -14,7 +14,7 @@ exports.themeOptionsSchema = zod_1.z
14
14
  .object({
15
15
  hideCodeInReport: zod_1.z
16
16
  .boolean()
17
- .nullable()
17
+ .optional()
18
18
  .default(false)
19
19
  .describe("Whether to hide the theme code in the generated PDF report"),
20
20
  })
@@ -2,7 +2,6 @@ import { CriteriaTree, Metadata, DataMap, StreamMatrixResponse, TaskItemValueMap
2
2
  export type TreeAndMapParameters<ParametersType extends Record<string, any> | undefined = undefined> = {
3
3
  parameters: ParametersType extends undefined ? undefined : ParametersType;
4
4
  values?: TaskItemValueMap | null;
5
- locale?: string | null;
6
5
  };
7
6
  export type MatrixParameters<ParametersType extends Record<string, any> | undefined = undefined> = TreeAndMapParameters<ParametersType> & {
8
7
  additional?: any;
package/dist/v1/utils.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCertificationsByValue = exports.applyReportTitleTextFormatFormattingPlaceholders = exports.applyCriteriaTreeElementTextFormatFormattingPlaceholders = exports.applyDocumentTreeFolderTextFormattingPlaceholders = exports.applyBreadcrumbTextFormattingPlaceholders = exports.findInTree = exports.toColorHexString = exports.isTaskItem = exports.isTask = exports.isTaskGroup = exports.isCriterion = exports.isTheme = void 0;
4
+ // No need to import lodash just for this one function
4
5
  const isNil = (value) => value === null || value === undefined;
5
6
  const isTheme = (element) => element.type === "theme";
6
7
  exports.isTheme = isTheme;
@@ -79,10 +80,16 @@ const getCertificationsByValue = (certificationDefinitions, value) => {
79
80
  return undefined;
80
81
  }
81
82
  return certificationDefinitions.filter((definition) => {
82
- return ((isNil(definition.rules.minimum) ||
83
- value > definition.rules.minimum) &&
84
- (isNil(definition.rules.maximum) ||
85
- value < definition.rules.maximum));
83
+ const { rules } = definition;
84
+ const minimum = "minimum" in rules ? rules.minimum : undefined;
85
+ const exclusiveMinimum = "exclusiveMinimum" in rules ? rules.exclusiveMinimum : undefined;
86
+ const maximum = "maximum" in rules ? rules.maximum : undefined;
87
+ const exclusiveMaximum = "exclusiveMaximum" in rules ? rules.exclusiveMaximum : undefined;
88
+ const meetsLowerBound = (isNil(minimum) || value >= minimum) &&
89
+ (isNil(exclusiveMinimum) || value > exclusiveMinimum);
90
+ const meetsUpperBound = (isNil(maximum) || value <= maximum) &&
91
+ (isNil(exclusiveMaximum) || value < exclusiveMaximum);
92
+ return meetsLowerBound && meetsUpperBound;
86
93
  });
87
94
  };
88
95
  exports.getCertificationsByValue = getCertificationsByValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openframe-org/criteria-set-protocol",
3
- "version": "3.0.0-alpha.8",
3
+ "version": "3.0.0-beta.1",
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>",