@furo/open-models 1.2.2 → 1.2.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"BusinessValidators.js","sourceRoot":"","sources":["../../protoc-gen-open-models/BusinessValidators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAA0B,MAAM,wBAAwB,CAAC;AAO5E,UAAU,CAAC,GAAG,CAAC,wBAAwB,EAAE,CAAC,IAAkB,EAAE,EAAE;IAC9D,IACE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACvC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,EACrC,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE;YACrC,wCAAwC;SACzC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,GAAG,CAAC,oBAAoB,EAAE,CAAC,IAAc,EAAE,EAAE;IACtD,IAAI,IAAI,CAAC,EAAE,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QAC7B,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE;YACxC,0BAA0B;YAC1B,MAAM;SACP,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,GAAG,CAAC,mBAAmB,EAAE,CAAC,IAAa,EAAE,EAA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AK,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;YAClC,WAAW,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;YACrC,WAAW,CAAC,OAAO;gBACjB,uFAAuF,CAAC;YAC1F,OAAO,GAAG,KAAK,CAAC;QAClB,CAAC;QACD,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,CAAC,kBAAkB,CAAC,GAAG,iBAAiB,CAAC,CAAC;IAE9C,wCAAwC;IACxC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC,CAAC,CAAC","sourcesContent":["import { Validators } from '@furo/open-models/dist/Validator';\nimport { ValueState, type ValueStateSummary } from '@furo/open-models/dist';\nimport { CubeDefinition } from './furo/cube/CubeDefinition';\n\nimport { DecimalRange } from './furo/type/DecimalRange';\nimport { Defaults } from './furo/type/Defaults';\nimport { Decimal } from './furo/type/Decimal';\n\nValidators.set('furo.type.DecimalRange', (node: DecimalRange) => {\n if (\n parseFloat(node.start.value.toString()) >\n parseFloat(node.end.value.toString())\n ) {\n node.__setValueState(ValueState.Error, [\n 'decimal.start.must.be.smaller.then.end',\n ]);\n } else {\n node.__setValueState(ValueState.None, ['']);\n }\n});\n\nValidators.set('furo.type.Defaults', (node: Defaults) => {\n if (node.id.value === '----') {\n node.id.__setValueState(ValueState.Error, [\n 'defaults.id.can.not.be.4',\n '----',\n ]);\n } else {\n node.__setValueState(ValueState.None, ['']);\n }\n});\n\nValidators.set('furo.type.Decimal', (node: Decimal) => {\n if (!node.value.value.match(/^[+-]?(\\d*\\.)?\\d+$/)) {\n // maybe ^[+-]?(\\d*\\.)?\\d*$ ???\n node.__setValueState(ValueState.Error, [\n 'decimal.invalid.number',\n node.value.value,\n ]);\n } else {\n const fieldConstraints = node.__getConstraints();\n if (fieldConstraints) {\n for (const [constraint, value] of Object.entries(fieldConstraints)) {\n if (constraint === 'minimum') {\n if (parseFloat(node.value.value) < value) {\n node.__setValueState(ValueState.Error, [\n 'constraint.violation.minimum',\n value,\n node.value.value,\n ]);\n return;\n }\n }\n }\n }\n\n node.__setValueState(ValueState.None, ['']);\n }\n});\n\nValidators.set('furo.cube.CubeDefinition', (cube: CubeDefinition) => {\n // make sure the cubes are cube-ish enough\n /**\n * Implemented Business Validators\n * To ensure that we have a good cube, following business validators are implemented:\n * When l == b == h, we have a perfect cube (value state \"Success\").\n * When we have a deviation of 10% to the average sizes, we recommend adjusting the deviating values (value state \"Informative\").\n * When we have a deviation of 20% to the average sizes, we strongly recommend adjusting the deviating values (value state \"Warning\").\n * When we have a deviation of 30% to the average sizes, we force adjusting the deviating values (value state \"Error\").\n */\n const valueStateSummary: ValueStateSummary[] = [];\n const avg = (cube.length.value + cube.breadth.value + cube.height.value) / 3;\n\n let isValid = true;\n\n if (cube.length.value >= 100 && cube.length.value <= 1000) {\n const lengthState: ValueStateSummary = {\n field: 'length',\n message: '',\n state: ValueState.None,\n };\n\n if (cube.length.value < avg * 0.9) {\n lengthState.state = ValueState.Information;\n lengthState.message =\n 'Please consider to make this value bigger, to have a perfect cube';\n }\n if (cube.length.value < avg * 0.8) {\n lengthState.state = ValueState.Warning;\n lengthState.message =\n 'A perfect cube should have the same length, breadth and height.\\n It is strongly recommended to increase this value';\n }\n if (cube.length.value < avg * 0.7) {\n lengthState.state = ValueState.Error;\n lengthState.message =\n 'A perfect cube should have the same length, breadth and height.\\n Increase this value';\n isValid = false;\n }\n if (\n cube.length.value === cube.breadth.value &&\n cube.length.value === cube.height.value\n ) {\n lengthState.state = ValueState.Success;\n }\n if (cube.length.value > avg * 1.1) {\n lengthState.state = ValueState.Information;\n lengthState.message =\n 'Please consider to make this value smaller, to have a perfect cube';\n }\n if (cube.length.value > avg * 1.2) {\n lengthState.state = ValueState.Warning;\n lengthState.message =\n 'A perfect cube should have the same length, breadth and height.\\n It is strongly recommended to decrease this value';\n }\n if (cube.length.value > avg * 1.3) {\n lengthState.state = ValueState.Error;\n lengthState.message =\n 'A perfect cube should have the same length, breadth and height.\\n Decrease this value';\n isValid = false;\n }\n valueStateSummary.push(lengthState);\n }\n\n if (cube.breadth.value >= 100 && cube.breadth.value <= 1000) {\n const breadthState: ValueStateSummary = {\n field: 'breadth',\n message: '',\n state: ValueState.None,\n };\n\n if (cube.breadth.value < avg * 0.9) {\n breadthState.state = ValueState.Information;\n breadthState.message =\n 'Please consider to make this value bigger, to have a perfect cube';\n }\n\n if (cube.breadth.value < avg * 0.8) {\n breadthState.state = ValueState.Warning;\n breadthState.message =\n 'A perfect cube should have the same breadth, breadth and height.\\n It is strongly recommended to increase this value';\n }\n if (cube.breadth.value < avg * 0.7) {\n breadthState.state = ValueState.Error;\n breadthState.message =\n 'A perfect cube should have the same breadth, breadth and height.\\n Increase this value';\n isValid = false;\n }\n if (\n cube.length.value === cube.breadth.value &&\n cube.length.value === cube.height.value\n ) {\n breadthState.state = ValueState.Success;\n }\n if (cube.breadth.value > avg * 1.1) {\n breadthState.state = ValueState.Information;\n breadthState.message =\n 'Please consider to make this value smaller, to have a perfect cube';\n }\n if (cube.breadth.value > avg * 1.2) {\n breadthState.state = ValueState.Warning;\n breadthState.message =\n 'A perfect cube should have the same breadth, breadth and height.\\n It is strongly recommended to decrease this value';\n }\n if (cube.breadth.value > avg * 1.3) {\n breadthState.state = ValueState.Error;\n breadthState.message =\n 'A perfect cube should have the same breadth, breadth and height.\\n Decrease this value';\n isValid = false;\n }\n valueStateSummary.push(breadthState);\n }\n\n if (cube.height.value >= 100 && cube.height.value <= 1000) {\n const heightState: ValueStateSummary = {\n field: 'height',\n message: '',\n state: ValueState.None,\n };\n\n if (cube.height.value < avg * 0.9) {\n heightState.state = ValueState.Information;\n heightState.message =\n 'Please consider to make this value bigger, to have a perfect cube';\n }\n\n if (cube.height.value < avg * 0.8) {\n heightState.state = ValueState.Warning;\n heightState.message =\n 'A perfect cube should have the same height, height and height.\\n It is strongly recommended to increase this value';\n }\n if (cube.height.value < avg * 0.7) {\n heightState.state = ValueState.Error;\n heightState.message =\n 'A perfect cube should have the same height, height and height.\\n Increase this value';\n isValid = false;\n }\n if (\n cube.length.value === cube.breadth.value &&\n cube.length.value === cube.height.value\n ) {\n heightState.state = ValueState.Success;\n }\n if (cube.height.value > avg * 1.1) {\n heightState.state = ValueState.Information;\n heightState.message =\n 'Please consider to make this value smaller, to have a perfect cube';\n }\n if (cube.height.value > avg * 1.2) {\n heightState.state = ValueState.Warning;\n heightState.message =\n 'A perfect cube should have the same height, breadth and height.\\n It is strongly recommended to decrease this value';\n }\n if (cube.height.value > avg * 1.3) {\n heightState.state = ValueState.Error;\n heightState.message =\n 'A perfect cube should have the same height, breadth and height.\\n Decrease this value';\n isValid = false;\n }\n valueStateSummary.push(heightState);\n }\n\n cube.__applyValueStates(...valueStateSummary);\n\n // set the validity of the entity itself\n cube.__setValidState(isValid);\n});\n"]}
1
+ {"version":3,"file":"BusinessValidators.js","sourceRoot":"","sources":["../../protoc-gen-open-models/BusinessValidators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAA0B,MAAM,wBAAwB,CAAC;AAO5E,UAAU,CAAC,GAAG,CAAC,wBAAwB,EAAE,CAAC,IAAkB,EAAE,EAAE;IAC9D,IACE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACvC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,EACrC,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,QAAQ,EAAE;YACxC,wCAAwC;SACzC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,GAAG,CAAC,oBAAoB,EAAE,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C;QAC1C,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;YAClC,WAAW,CAAC,KAAK,GAAG,UAAU,CAAC,WAAW,CAAC;YAC3C,WAAW,CAAC,OAAO;gBACjB,oEAAoE,CAAC;QACzE,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;YAClC,WAAW,CAAC,KAAK,GAAG,UAAU,CAAC,QAAQ,CAAC;YACxC,WAAW,CAAC,OAAO;gBACjB,qHAAqH,CAAC;QAC1H,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;YAClC,WAAW,CAAC,KAAK,GAAG,UAAU,CAAC,QAAQ,CAAC;YACxC,WAAW,CAAC,OAAO;gBACjB,uFAAuF,CAAC;YAC1F,OAAO,GAAG,KAAK,CAAC;QAClB,CAAC;QACD,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,CAAC,kBAAkB,CAAC,GAAG,iBAAiB,CAAC,CAAC;IAE9C,wCAAwC;IACxC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC,CAAC,CAAC","sourcesContent":["import { Validators } from '@furo/open-models/dist/Validator';\nimport { ValueState, type ValueStateSummary } from '@furo/open-models/dist';\nimport { CubeDefinition } from './furo/cube/CubeDefinition';\n\nimport { DecimalRange } from './furo/type/DecimalRange';\nimport { Defaults } from './furo/type/Defaults';\nimport { Decimal } from './furo/type/Decimal';\n\nValidators.set('furo.type.DecimalRange', (node: DecimalRange) => {\n if (\n parseFloat(node.start.value.toString()) >\n parseFloat(node.end.value.toString())\n ) {\n node.__setValueState(ValueState.Negative, [\n 'decimal.start.must.be.smaller.then.end',\n ]);\n } else {\n node.__setValueState(ValueState.None, ['']);\n }\n});\n\nValidators.set('furo.type.Defaults', (node: Defaults) => {\n if (node.id.value === '----') {\n node.id.__setValueState(ValueState.Negative, [\n 'defaults.id.can.not.be.4',\n '----',\n ]);\n } else {\n node.__setValueState(ValueState.None, ['']);\n }\n});\n\nValidators.set('furo.type.Decimal', (node: Decimal) => {\n if (!node.value.value.match(/^[+-]?(\\d*\\.)?\\d+$/)) {\n // maybe ^[+-]?(\\d*\\.)?\\d*$ ???\n node.__setValueState(ValueState.Negative, [\n 'decimal.invalid.number',\n node.value.value,\n ]);\n } else {\n const fieldConstraints = node.__getConstraints();\n if (fieldConstraints) {\n for (const [constraint, value] of Object.entries(fieldConstraints)) {\n if (constraint === 'minimum') {\n if (parseFloat(node.value.value) < value) {\n node.__setValueState(ValueState.Negative, [\n 'constraint.violation.minimum',\n value,\n node.value.value,\n ]);\n return;\n }\n }\n }\n }\n\n node.__setValueState(ValueState.None, ['']);\n }\n});\n\nValidators.set('furo.cube.CubeDefinition', (cube: CubeDefinition) => {\n // make sure the cubes are cube-ish enough\n /**\n * Implemented Business Validators\n * To ensure that we have a good cube, following business validators are implemented:\n * When l == b == h, we have a perfect cube (value state \"Success\").\n * When we have a deviation of 10% to the average sizes, we recommend adjusting the deviating values (value state \"Informative\").\n * When we have a deviation of 20% to the average sizes, we strongly recommend adjusting the deviating values (value state \"Warning\").\n * When we have a deviation of 30% to the average sizes, we force adjusting the deviating values (value state \"Error\").\n */\n const valueStateSummary: ValueStateSummary[] = [];\n const avg = (cube.length.value + cube.breadth.value + cube.height.value) / 3;\n\n let isValid = true;\n\n if (cube.length.value >= 100 && cube.length.value <= 1000) {\n const lengthState: ValueStateSummary = {\n field: 'length',\n message: '',\n state: ValueState.None,\n };\n\n if (cube.length.value < avg * 0.9) {\n lengthState.state = ValueState.Information;\n lengthState.message =\n 'Please consider to make this value bigger, to have a perfect cube';\n }\n if (cube.length.value < avg * 0.8) {\n lengthState.state = ValueState.Critical;\n lengthState.message =\n 'A perfect cube should have the same length, breadth and height.\\n It is strongly recommended to increase this value';\n }\n if (cube.length.value < avg * 0.7) {\n lengthState.state = ValueState.Negative;\n lengthState.message =\n 'A perfect cube should have the same length, breadth and height.\\n Increase this value';\n isValid = false;\n }\n if (\n cube.length.value === cube.breadth.value &&\n cube.length.value === cube.height.value\n ) {\n lengthState.state = ValueState.Positive;\n }\n if (cube.length.value > avg * 1.1) {\n lengthState.state = ValueState.Information;\n lengthState.message =\n 'Please consider to make this value smaller, to have a perfect cube';\n }\n if (cube.length.value > avg * 1.2) {\n lengthState.state = ValueState.Critical;\n lengthState.message =\n 'A perfect cube should have the same length, breadth and height.\\n It is strongly recommended to decrease this value';\n }\n if (cube.length.value > avg * 1.3) {\n lengthState.state = ValueState.Negative;\n lengthState.message =\n 'A perfect cube should have the same length, breadth and height.\\n Decrease this value';\n isValid = false;\n }\n valueStateSummary.push(lengthState);\n }\n\n if (cube.breadth.value >= 100 && cube.breadth.value <= 1000) {\n const breadthState: ValueStateSummary = {\n field: 'breadth',\n message: '',\n state: ValueState.None,\n };\n\n if (cube.breadth.value < avg * 0.9) {\n breadthState.state = ValueState.Information;\n breadthState.message =\n 'Please consider to make this value bigger, to have a perfect cube';\n }\n\n if (cube.breadth.value < avg * 0.8) {\n breadthState.state = ValueState.Critical;\n breadthState.message =\n 'A perfect cube should have the same breadth, breadth and height.\\n It is strongly recommended to increase this value';\n }\n if (cube.breadth.value < avg * 0.7) {\n breadthState.state = ValueState.Negative;\n breadthState.message =\n 'A perfect cube should have the same breadth, breadth and height.\\n Increase this value';\n isValid = false;\n }\n if (\n cube.length.value === cube.breadth.value &&\n cube.length.value === cube.height.value\n ) {\n breadthState.state = ValueState.Positive;\n }\n if (cube.breadth.value > avg * 1.1) {\n breadthState.state = ValueState.Information;\n breadthState.message =\n 'Please consider to make this value smaller, to have a perfect cube';\n }\n if (cube.breadth.value > avg * 1.2) {\n breadthState.state = ValueState.Critical;\n breadthState.message =\n 'A perfect cube should have the same breadth, breadth and height.\\n It is strongly recommended to decrease this value';\n }\n if (cube.breadth.value > avg * 1.3) {\n breadthState.state = ValueState.Negative;\n breadthState.message =\n 'A perfect cube should have the same breadth, breadth and height.\\n Decrease this value';\n isValid = false;\n }\n valueStateSummary.push(breadthState);\n }\n\n if (cube.height.value >= 100 && cube.height.value <= 1000) {\n const heightState: ValueStateSummary = {\n field: 'height',\n message: '',\n state: ValueState.None,\n };\n\n if (cube.height.value < avg * 0.9) {\n heightState.state = ValueState.Information;\n heightState.message =\n 'Please consider to make this value bigger, to have a perfect cube';\n }\n\n if (cube.height.value < avg * 0.8) {\n heightState.state = ValueState.Critical;\n heightState.message =\n 'A perfect cube should have the same height, height and height.\\n It is strongly recommended to increase this value';\n }\n if (cube.height.value < avg * 0.7) {\n heightState.state = ValueState.Negative;\n heightState.message =\n 'A perfect cube should have the same height, height and height.\\n Increase this value';\n isValid = false;\n }\n if (\n cube.length.value === cube.breadth.value &&\n cube.length.value === cube.height.value\n ) {\n heightState.state = ValueState.Positive;\n }\n if (cube.height.value > avg * 1.1) {\n heightState.state = ValueState.Information;\n heightState.message =\n 'Please consider to make this value smaller, to have a perfect cube';\n }\n if (cube.height.value > avg * 1.2) {\n heightState.state = ValueState.Critical;\n heightState.message =\n 'A perfect cube should have the same height, breadth and height.\\n It is strongly recommended to decrease this value';\n }\n if (cube.height.value > avg * 1.3) {\n heightState.state = ValueState.Negative;\n heightState.message =\n 'A perfect cube should have the same height, breadth and height.\\n Decrease this value';\n isValid = false;\n }\n valueStateSummary.push(heightState);\n }\n\n cube.__applyValueStates(...valueStateSummary);\n\n // set the validity of the entity itself\n cube.__setValidState(isValid);\n});\n"]}
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "homepage": "https://github.com/eclipse/eclipsefuro-web/tree/main/packages",
6
6
  "repository": "git@github.com:eclipse/eclipsefuro-web.git",
7
7
  "author": "eclipse furo",
8
- "version": "1.2.2",
8
+ "version": "1.2.3",
9
9
  "type": "module",
10
10
  "main": "dist/index.js",
11
11
  "module": "dist/index.js",
@@ -81,5 +81,5 @@
81
81
  "prettier --write"
82
82
  ]
83
83
  },
84
- "gitHead": "f85a725bd58bfcb1ec2be2d8bfe617f06aea660b"
84
+ "gitHead": "d1b0073f95c861ec41b7c48414acd98fb5e1cd65"
85
85
  }