@openframe-org/criteria-set-protocol 2.5.0 → 2.5.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.
@@ -3,7 +3,6 @@ export declare const schemaDefinitionSchema: z.ZodRecord<z.ZodString, z.ZodAny>;
3
3
  export declare const schemaDefinitionsSchema: z.ZodObject<{
4
4
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
5
5
  parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
6
- result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
7
6
  }, z.core.$strip>;
8
7
  export declare const metadataSchema: z.ZodObject<{
9
8
  id: z.ZodString;
@@ -15,11 +14,8 @@ export declare const metadataSchema: z.ZodObject<{
15
14
  group: z.ZodString;
16
15
  description: z.ZodString;
17
16
  documentation: z.ZodOptional<z.ZodString>;
18
- locales: z.ZodOptional<z.ZodArray<z.ZodString>>;
19
- defaultLocale: z.ZodOptional<z.ZodString>;
20
17
  schemas: z.ZodOptional<z.ZodObject<{
21
18
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
22
19
  parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
23
- result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
24
20
  }, z.core.$strip>>;
25
21
  }, z.core.$strip>;
@@ -11,9 +11,6 @@ exports.schemaDefinitionsSchema = zod_1.z
11
11
  parameters: exports.schemaDefinitionSchema
12
12
  .optional()
13
13
  .describe("The JSON schema describing the parameters of the criteria set"),
14
- result: exports.schemaDefinitionSchema
15
- .optional()
16
- .describe("The JSON schema describing the result of the criteria set"),
17
14
  })
18
15
  .describe("SchemaDefinitions - The JSON schemas describing the parameters and result of the criteria set, if any");
19
16
  exports.metadataSchema = zod_1.z
@@ -34,14 +31,6 @@ exports.metadataSchema = zod_1.z
34
31
  .string()
35
32
  .optional()
36
33
  .describe("Additional documentation or usage guidelines for the criteria set"),
37
- locales: zod_1.z
38
- .array(zod_1.z.string())
39
- .optional()
40
- .describe("List of supported locale codes for internationalization"),
41
- defaultLocale: zod_1.z
42
- .string()
43
- .optional()
44
- .describe("The default locale to use when no specific locale is specified"),
45
34
  schemas: exports.schemaDefinitionsSchema
46
35
  .optional()
47
36
  .describe("Definitions of property, parameter and result schemas for the criteria set"),
@@ -3,7 +3,6 @@ import { z } from "zod";
3
3
  * Validates the request body for the matrix endpoints
4
4
  */
5
5
  export declare const matrixRequestBodySchema: z.ZodOptional<z.ZodObject<{
6
- locale: z.ZodOptional<z.ZodString>;
7
6
  parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
8
7
  values: z.ZodOptional<z.ZodRecord<z.ZodString, 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
8
  additional: z.ZodOptional<z.ZodAny>;
@@ -8,10 +8,6 @@ const task_item_1 = require("../task-item");
8
8
  */
9
9
  exports.matrixRequestBodySchema = zod_1.z
10
10
  .object({
11
- locale: zod_1.z
12
- .string()
13
- .optional()
14
- .describe("Locale to be passed when generating the matrix"),
15
11
  parameters: zod_1.z
16
12
  .record(zod_1.z.string(), zod_1.z.any())
17
13
  .optional()
@@ -3,7 +3,6 @@ import { z } from "zod";
3
3
  * Validates the request body for the tree and data endpoints
4
4
  */
5
5
  export declare const treeAndDataRequestBodySchema: z.ZodOptional<z.ZodObject<{
6
- locale: z.ZodOptional<z.ZodString>;
7
6
  parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
8
7
  values: z.ZodOptional<z.ZodRecord<z.ZodString, 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
8
  }, z.core.$strip>>;
@@ -8,10 +8,6 @@ const task_item_1 = require("../task-item");
8
8
  */
9
9
  exports.treeAndDataRequestBodySchema = zod_1.z
10
10
  .object({
11
- locale: zod_1.z
12
- .string()
13
- .optional()
14
- .describe("Locale to be passed when generating the matrix"),
15
11
  parameters: zod_1.z
16
12
  .record(zod_1.z.string(), zod_1.z.any())
17
13
  .optional()
@@ -9,12 +9,9 @@ export declare const criteriaSetsAndVersionsSchema: z.ZodRecord<z.ZodString, z.Z
9
9
  group: z.ZodString;
10
10
  description: z.ZodString;
11
11
  documentation: z.ZodOptional<z.ZodString>;
12
- locales: z.ZodOptional<z.ZodArray<z.ZodString>>;
13
- defaultLocale: z.ZodOptional<z.ZodString>;
14
12
  schemas: z.ZodOptional<z.ZodObject<{
15
13
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
16
14
  parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
17
- result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
18
15
  }, z.core.$strip>>;
19
16
  }, z.core.$strip>>>;
20
17
  export declare const streamMatrixResponseSchema: z.ZodObject<{
@@ -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;
@@ -45,6 +45,7 @@ export declare const applyCriteriaTreeElementTextFormatFormattingPlaceholders: A
45
45
  * Apply the text formatting used in the report title
46
46
  */
47
47
  export declare const applyReportTitleTextFormatFormattingPlaceholders: ApplyReportTitleTextFormatFormattingPlaceholdersFunction;
48
+ export declare const isNil: (value: unknown) => value is null | undefined;
48
49
  /**
49
50
  * Given a list of certification definitions, return the ones for which the given value is valid
50
51
  */
package/dist/v1/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
3
+ exports.getCertificationsByValue = exports.isNil = 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
4
  const isTheme = (element) => element.type === "theme";
5
5
  exports.isTheme = isTheme;
6
6
  const isCriterion = (element) => element.type === "criterion";
@@ -70,6 +70,8 @@ const applyReportTitleTextFormatFormattingPlaceholders = ({ reportTitleTextForma
70
70
  .replace(/:code:/g, code)
71
71
  .replace(/:title:/g, title);
72
72
  exports.applyReportTitleTextFormatFormattingPlaceholders = applyReportTitleTextFormatFormattingPlaceholders;
73
+ const isNil = (value) => value === null || value === undefined;
74
+ exports.isNil = isNil;
73
75
  /**
74
76
  * Given a list of certification definitions, return the ones for which the given value is valid
75
77
  */
@@ -78,13 +80,13 @@ const getCertificationsByValue = (certificationDefinitions, value) => {
78
80
  return undefined;
79
81
  }
80
82
  return certificationDefinitions.filter((definition) => {
81
- return ((definition.rules.minimum === undefined ||
83
+ return (((0, exports.isNil)(definition.rules.minimum) ||
82
84
  value > definition.rules.minimum) &&
83
- (definition.rules.exclusiveMinimum === undefined ||
85
+ ((0, exports.isNil)(definition.rules.exclusiveMinimum) ||
84
86
  value >= definition.rules.exclusiveMinimum) &&
85
- (definition.rules.maximum === undefined ||
87
+ ((0, exports.isNil)(definition.rules.maximum) ||
86
88
  value < definition.rules.maximum) &&
87
- (definition.rules.exclusiveMaximum === undefined ||
89
+ ((0, exports.isNil)(definition.rules.exclusiveMaximum) ||
88
90
  value <= definition.rules.exclusiveMaximum));
89
91
  });
90
92
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openframe-org/criteria-set-protocol",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
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>",