@unifig/validation-presenter-table
Advanced tools
Comparing version 0.12.2-dev.7 to 0.12.2-dev.8
@@ -5,2 +5,3 @@ import { ConfigPropertyValidationError, ConfigSubtemplateValidationError, FailedConstraint } from '@unifig/core'; | ||
property: string; | ||
type?: string; | ||
source?: string; | ||
@@ -10,4 +11,5 @@ currentValue?: any; | ||
static fromValidationError(error: ConfigPropertyValidationError | ConfigSubtemplateValidationError, propertyParentPrefix?: string): TemplateRow; | ||
toArray(): [string, string, string, string, string]; | ||
toArray(): [string, string, string, string, string, string]; | ||
private failedConstraintsToNames; | ||
private formatValue; | ||
} |
@@ -10,2 +10,3 @@ "use strict"; | ||
row.property = error.property; | ||
row.type = error instanceof core_1.ConfigPropertyValidationError ? error.type : undefined; | ||
row.failedConstraints = error.failedConstraints; | ||
@@ -23,4 +24,5 @@ if (error instanceof core_1.ConfigPropertyValidationError) { | ||
((_a = this.propertyParentPrefix) !== null && _a !== void 0 ? _a : '') + this.property, | ||
(_b = this.source) !== null && _b !== void 0 ? _b : '', | ||
(_c = this.currentValue) !== null && _c !== void 0 ? _c : 'undefined', | ||
(_b = this.type) !== null && _b !== void 0 ? _b : '', | ||
(_c = this.source) !== null && _c !== void 0 ? _c : '', | ||
this.formatValue(), | ||
this.failedConstraintsToNames(), | ||
@@ -34,3 +36,9 @@ ]; | ||
} | ||
formatValue() { | ||
if (Number.isNaN(this.currentValue)) { | ||
return 'Not-A-Number'; | ||
} | ||
return JSON.stringify(this.currentValue); | ||
} | ||
} | ||
exports.TemplateRow = TemplateRow; |
@@ -7,3 +7,3 @@ "use strict"; | ||
const template_row_1 = require("./template-row/template-row"); | ||
const HEADER = ['Template', 'Property', 'Source', 'Current Value', 'Failed constraints']; | ||
const HEADER = ['Template', 'Property', 'Type', 'Source', 'Current Value', 'Failed constraints']; | ||
const toTable = (validationException, options = {}) => { | ||
@@ -10,0 +10,0 @@ var _a; |
{ | ||
"name": "@unifig/validation-presenter-table", | ||
"version": "0.12.2-dev.7+81708c8", | ||
"version": "0.12.2-dev.8+a7b3463", | ||
"description": "Table validation presenter for unifig", | ||
@@ -34,3 +34,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@unifig/core": "^0.12.2-dev.7+81708c8" | ||
"@unifig/core": "^0.12.2-dev.8+a7b3463" | ||
}, | ||
@@ -40,3 +40,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "81708c8a2ee0d0b8c85fb64b488d21ee08bd6a9c" | ||
"gitHead": "a7b346307e0b0449861241868401d38c3aa53dd7" | ||
} |
@@ -50,13 +50,11 @@ # Table validation presenter for [Unifig](https://github.com/Matii96/unifig) | ||
``` | ||
┌──────────────────┬─────────────┬─────────────┬───────────────┬────────────────────┐ | ||
│ Template │ Property │ Source │ Current Value │ Failed constraints │ | ||
├──────────────────┼─────────────┼─────────────┼───────────────┼────────────────────┤ | ||
│ │ port │ PORT │ not-a-port │ isInt │ | ||
│ ├─────────────┼─────────────┼───────────────┼────────────────────┤ | ||
│ StorageOptions │ db.url │ DB_URL │ undefined │ isString │ | ||
│ ├─────────────┼─────────────┼───────────────┼────────────────────┤ | ||
│ │ db.password │ DB_PASSWORD │ undefined │ isString │ | ||
├──────────────────┼─────────────┼─────────────┼───────────────┼────────────────────┤ | ||
│ NetworkOptions │ ipRange │ IP_RANGE │ undefined │ isDefined │ | ||
└──────────────────┴─────────────┴─────────────┴───────────────┴────────────────────┘ | ||
┌──────────────────┬─────────────┬────────┬─────────────┬───────────────┬────────────────────┐ | ||
│ Template │ Property │ Type │ Source │ Current Value │ Failed constraints │ | ||
├──────────────────┼─────────────┼────────┼─────────────┼───────────────┼────────────────────┤ | ||
│ │ port │ Number │ PORT │ "not-a-port" │ isInt │ | ||
│ ├─────────────┼────────┼─────────────┼───────────────┼────────────────────┤ | ||
│ TemplateMock │ db.url │ String │ DB_URL │ undefined │ isString │ | ||
│ ├─────────────┼────────┼─────────────┼───────────────┼────────────────────┤ | ||
│ │ db.password │ String │ DB_PASSWORD │ undefined │ isString │ | ||
└──────────────────┴─────────────┴────────┴─────────────┴───────────────┴────────────────────┘ | ||
``` | ||
@@ -63,0 +61,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
10956
131
70