123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752 |
- 'use strict';
- var equal = require('ajv/lib/compile/equal');
- var validate = (function() {
- var pattern0 = new RegExp('^[0-9]+$');
- var refVal = [];
- var refVal1 = (function() {
- var pattern0 = new RegExp('^[0-9]+$');
- return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
- 'use strict';
- var vErrors = null;
- var errors = 0;
- if (rootData === undefined) rootData = data;
- if ((data && typeof data === "object" && !Array.isArray(data))) {
- var errs__0 = errors;
- var valid1 = true;
- for (var key0 in data) {
- var isAdditional0 = !(false || validate.schema.properties.hasOwnProperty(key0));
- if (isAdditional0) {
- valid1 = false;
- var err = {
- keyword: 'additionalProperties',
- dataPath: (dataPath || '') + "",
- schemaPath: '#/additionalProperties',
- params: {
- additionalProperty: '' + key0 + ''
- },
- message: 'should NOT have additional properties'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- }
- }
- if (data.topBody !== undefined) {
- var errs_1 = errors;
- if (!refVal2(data.topBody, (dataPath || '') + '.topBody', data, 'topBody', rootData)) {
- if (vErrors === null) vErrors = refVal2.errors;
- else vErrors = vErrors.concat(refVal2.errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.topJoin !== undefined) {
- var errs_1 = errors;
- if (!refVal[2](data.topJoin, (dataPath || '') + '.topJoin', data, 'topJoin', rootData)) {
- if (vErrors === null) vErrors = refVal[2].errors;
- else vErrors = vErrors.concat(refVal[2].errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.topLeft !== undefined) {
- var errs_1 = errors;
- if (!refVal[2](data.topLeft, (dataPath || '') + '.topLeft', data, 'topLeft', rootData)) {
- if (vErrors === null) vErrors = refVal[2].errors;
- else vErrors = vErrors.concat(refVal[2].errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.topRight !== undefined) {
- var errs_1 = errors;
- if (!refVal[2](data.topRight, (dataPath || '') + '.topRight', data, 'topRight', rootData)) {
- if (vErrors === null) vErrors = refVal[2].errors;
- else vErrors = vErrors.concat(refVal[2].errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.bottomBody !== undefined) {
- var errs_1 = errors;
- if (!refVal[2](data.bottomBody, (dataPath || '') + '.bottomBody', data, 'bottomBody', rootData)) {
- if (vErrors === null) vErrors = refVal[2].errors;
- else vErrors = vErrors.concat(refVal[2].errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.bottomJoin !== undefined) {
- var errs_1 = errors;
- if (!refVal[2](data.bottomJoin, (dataPath || '') + '.bottomJoin', data, 'bottomJoin', rootData)) {
- if (vErrors === null) vErrors = refVal[2].errors;
- else vErrors = vErrors.concat(refVal[2].errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.bottomLeft !== undefined) {
- var errs_1 = errors;
- if (!refVal[2](data.bottomLeft, (dataPath || '') + '.bottomLeft', data, 'bottomLeft', rootData)) {
- if (vErrors === null) vErrors = refVal[2].errors;
- else vErrors = vErrors.concat(refVal[2].errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.bottomRight !== undefined) {
- var errs_1 = errors;
- if (!refVal[2](data.bottomRight, (dataPath || '') + '.bottomRight', data, 'bottomRight', rootData)) {
- if (vErrors === null) vErrors = refVal[2].errors;
- else vErrors = vErrors.concat(refVal[2].errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.bodyLeft !== undefined) {
- var errs_1 = errors;
- if (!refVal[2](data.bodyLeft, (dataPath || '') + '.bodyLeft', data, 'bodyLeft', rootData)) {
- if (vErrors === null) vErrors = refVal[2].errors;
- else vErrors = vErrors.concat(refVal[2].errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.bodyRight !== undefined) {
- var errs_1 = errors;
- if (!refVal[2](data.bodyRight, (dataPath || '') + '.bodyRight', data, 'bodyRight', rootData)) {
- if (vErrors === null) vErrors = refVal[2].errors;
- else vErrors = vErrors.concat(refVal[2].errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.bodyJoin !== undefined) {
- var errs_1 = errors;
- if (!refVal[2](data.bodyJoin, (dataPath || '') + '.bodyJoin', data, 'bodyJoin', rootData)) {
- if (vErrors === null) vErrors = refVal[2].errors;
- else vErrors = vErrors.concat(refVal[2].errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.joinBody !== undefined) {
- var errs_1 = errors;
- if (!refVal[2](data.joinBody, (dataPath || '') + '.joinBody', data, 'joinBody', rootData)) {
- if (vErrors === null) vErrors = refVal[2].errors;
- else vErrors = vErrors.concat(refVal[2].errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.joinLeft !== undefined) {
- var errs_1 = errors;
- if (!refVal[2](data.joinLeft, (dataPath || '') + '.joinLeft', data, 'joinLeft', rootData)) {
- if (vErrors === null) vErrors = refVal[2].errors;
- else vErrors = vErrors.concat(refVal[2].errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.joinRight !== undefined) {
- var errs_1 = errors;
- if (!refVal[2](data.joinRight, (dataPath || '') + '.joinRight', data, 'joinRight', rootData)) {
- if (vErrors === null) vErrors = refVal[2].errors;
- else vErrors = vErrors.concat(refVal[2].errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.joinJoin !== undefined) {
- var errs_1 = errors;
- if (!refVal[2](data.joinJoin, (dataPath || '') + '.joinJoin', data, 'joinJoin', rootData)) {
- if (vErrors === null) vErrors = refVal[2].errors;
- else vErrors = vErrors.concat(refVal[2].errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- } else {
- var err = {
- keyword: 'type',
- dataPath: (dataPath || '') + "",
- schemaPath: '#/type',
- params: {
- type: 'object'
- },
- message: 'should be object'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- }
- validate.errors = vErrors;
- return errors === 0;
- };
- })();
- refVal1.schema = {
- "type": "object",
- "properties": {
- "topBody": {
- "$ref": "#/definitions/border"
- },
- "topJoin": {
- "$ref": "#/definitions/border"
- },
- "topLeft": {
- "$ref": "#/definitions/border"
- },
- "topRight": {
- "$ref": "#/definitions/border"
- },
- "bottomBody": {
- "$ref": "#/definitions/border"
- },
- "bottomJoin": {
- "$ref": "#/definitions/border"
- },
- "bottomLeft": {
- "$ref": "#/definitions/border"
- },
- "bottomRight": {
- "$ref": "#/definitions/border"
- },
- "bodyLeft": {
- "$ref": "#/definitions/border"
- },
- "bodyRight": {
- "$ref": "#/definitions/border"
- },
- "bodyJoin": {
- "$ref": "#/definitions/border"
- },
- "joinBody": {
- "$ref": "#/definitions/border"
- },
- "joinLeft": {
- "$ref": "#/definitions/border"
- },
- "joinRight": {
- "$ref": "#/definitions/border"
- },
- "joinJoin": {
- "$ref": "#/definitions/border"
- }
- },
- "additionalProperties": false
- };
- refVal1.errors = null;
- refVal[1] = refVal1;
- var refVal2 = (function() {
- var pattern0 = new RegExp('^[0-9]+$');
- return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
- 'use strict';
- var vErrors = null;
- var errors = 0;
- if (typeof data !== "string") {
- var err = {
- keyword: 'type',
- dataPath: (dataPath || '') + "",
- schemaPath: '#/type',
- params: {
- type: 'string'
- },
- message: 'should be string'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- }
- validate.errors = vErrors;
- return errors === 0;
- };
- })();
- refVal2.schema = {
- "type": "string"
- };
- refVal2.errors = null;
- refVal[2] = refVal2;
- var refVal3 = (function() {
- var pattern0 = new RegExp('^[0-9]+$');
- return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
- 'use strict';
- var vErrors = null;
- var errors = 0;
- if (rootData === undefined) rootData = data;
- if ((data && typeof data === "object" && !Array.isArray(data))) {
- var errs__0 = errors;
- var valid1 = true;
- for (var key0 in data) {
- var isAdditional0 = !(false || pattern0.test(key0));
- if (isAdditional0) {
- valid1 = false;
- var err = {
- keyword: 'additionalProperties',
- dataPath: (dataPath || '') + "",
- schemaPath: '#/additionalProperties',
- params: {
- additionalProperty: '' + key0 + ''
- },
- message: 'should NOT have additional properties'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- }
- }
- for (var key0 in data) {
- if (pattern0.test(key0)) {
- var errs_1 = errors;
- if (!refVal4(data[key0], (dataPath || '') + '[\'' + key0 + '\']', data, key0, rootData)) {
- if (vErrors === null) vErrors = refVal4.errors;
- else vErrors = vErrors.concat(refVal4.errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- }
- } else {
- var err = {
- keyword: 'type',
- dataPath: (dataPath || '') + "",
- schemaPath: '#/type',
- params: {
- type: 'object'
- },
- message: 'should be object'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- }
- validate.errors = vErrors;
- return errors === 0;
- };
- })();
- refVal3.schema = {
- "type": "object",
- "patternProperties": {
- "^[0-9]+$": {
- "$ref": "#/definitions/column"
- }
- },
- "additionalProperties": false
- };
- refVal3.errors = null;
- refVal[3] = refVal3;
- var refVal4 = (function() {
- var pattern0 = new RegExp('^[0-9]+$');
- return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
- 'use strict';
- var vErrors = null;
- var errors = 0;
- if ((data && typeof data === "object" && !Array.isArray(data))) {
- var errs__0 = errors;
- var valid1 = true;
- for (var key0 in data) {
- var isAdditional0 = !(false || key0 == 'alignment' || key0 == 'width' || key0 == 'wrapWord' || key0 == 'truncate' || key0 == 'paddingLeft' || key0 == 'paddingRight');
- if (isAdditional0) {
- valid1 = false;
- var err = {
- keyword: 'additionalProperties',
- dataPath: (dataPath || '') + "",
- schemaPath: '#/additionalProperties',
- params: {
- additionalProperty: '' + key0 + ''
- },
- message: 'should NOT have additional properties'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- }
- }
- var data1 = data.alignment;
- if (data1 !== undefined) {
- var errs_1 = errors;
- if (typeof data1 !== "string") {
- var err = {
- keyword: 'type',
- dataPath: (dataPath || '') + '.alignment',
- schemaPath: '#/properties/alignment/type',
- params: {
- type: 'string'
- },
- message: 'should be string'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- }
- var schema1 = validate.schema.properties.alignment.enum;
- var valid1;
- valid1 = false;
- for (var i1 = 0; i1 < schema1.length; i1++)
- if (equal(data1, schema1[i1])) {
- valid1 = true;
- break;
- } if (!valid1) {
- var err = {
- keyword: 'enum',
- dataPath: (dataPath || '') + '.alignment',
- schemaPath: '#/properties/alignment/enum',
- params: {
- allowedValues: schema1
- },
- message: 'should be equal to one of the allowed values'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- }
- var valid1 = errors === errs_1;
- }
- if (data.width !== undefined) {
- var errs_1 = errors;
- if (typeof data.width !== "number") {
- var err = {
- keyword: 'type',
- dataPath: (dataPath || '') + '.width',
- schemaPath: '#/properties/width/type',
- params: {
- type: 'number'
- },
- message: 'should be number'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- }
- var valid1 = errors === errs_1;
- }
- if (data.wrapWord !== undefined) {
- var errs_1 = errors;
- if (typeof data.wrapWord !== "boolean") {
- var err = {
- keyword: 'type',
- dataPath: (dataPath || '') + '.wrapWord',
- schemaPath: '#/properties/wrapWord/type',
- params: {
- type: 'boolean'
- },
- message: 'should be boolean'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- }
- var valid1 = errors === errs_1;
- }
- if (data.truncate !== undefined) {
- var errs_1 = errors;
- if (typeof data.truncate !== "number") {
- var err = {
- keyword: 'type',
- dataPath: (dataPath || '') + '.truncate',
- schemaPath: '#/properties/truncate/type',
- params: {
- type: 'number'
- },
- message: 'should be number'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- }
- var valid1 = errors === errs_1;
- }
- if (data.paddingLeft !== undefined) {
- var errs_1 = errors;
- if (typeof data.paddingLeft !== "number") {
- var err = {
- keyword: 'type',
- dataPath: (dataPath || '') + '.paddingLeft',
- schemaPath: '#/properties/paddingLeft/type',
- params: {
- type: 'number'
- },
- message: 'should be number'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- }
- var valid1 = errors === errs_1;
- }
- if (data.paddingRight !== undefined) {
- var errs_1 = errors;
- if (typeof data.paddingRight !== "number") {
- var err = {
- keyword: 'type',
- dataPath: (dataPath || '') + '.paddingRight',
- schemaPath: '#/properties/paddingRight/type',
- params: {
- type: 'number'
- },
- message: 'should be number'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- }
- var valid1 = errors === errs_1;
- }
- } else {
- var err = {
- keyword: 'type',
- dataPath: (dataPath || '') + "",
- schemaPath: '#/type',
- params: {
- type: 'object'
- },
- message: 'should be object'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- }
- validate.errors = vErrors;
- return errors === 0;
- };
- })();
- refVal4.schema = {
- "type": "object",
- "properties": {
- "alignment": {
- "type": "string",
- "enum": ["left", "right", "center"]
- },
- "width": {
- "type": "number"
- },
- "wrapWord": {
- "type": "boolean"
- },
- "truncate": {
- "type": "number"
- },
- "paddingLeft": {
- "type": "number"
- },
- "paddingRight": {
- "type": "number"
- }
- },
- "additionalProperties": false
- };
- refVal4.errors = null;
- refVal[4] = refVal4;
- return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
- 'use strict'; /*# sourceURL=config.json */
- var vErrors = null;
- var errors = 0;
- if (rootData === undefined) rootData = data;
- if ((data && typeof data === "object" && !Array.isArray(data))) {
- var errs__0 = errors;
- var valid1 = true;
- for (var key0 in data) {
- var isAdditional0 = !(false || key0 == 'border' || key0 == 'columns' || key0 == 'columnDefault' || key0 == 'drawHorizontalLine');
- if (isAdditional0) {
- valid1 = false;
- var err = {
- keyword: 'additionalProperties',
- dataPath: (dataPath || '') + "",
- schemaPath: '#/additionalProperties',
- params: {
- additionalProperty: '' + key0 + ''
- },
- message: 'should NOT have additional properties'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- }
- }
- if (data.border !== undefined) {
- var errs_1 = errors;
- if (!refVal1(data.border, (dataPath || '') + '.border', data, 'border', rootData)) {
- if (vErrors === null) vErrors = refVal1.errors;
- else vErrors = vErrors.concat(refVal1.errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.columns !== undefined) {
- var errs_1 = errors;
- if (!refVal3(data.columns, (dataPath || '') + '.columns', data, 'columns', rootData)) {
- if (vErrors === null) vErrors = refVal3.errors;
- else vErrors = vErrors.concat(refVal3.errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.columnDefault !== undefined) {
- var errs_1 = errors;
- if (!refVal[4](data.columnDefault, (dataPath || '') + '.columnDefault', data, 'columnDefault', rootData)) {
- if (vErrors === null) vErrors = refVal[4].errors;
- else vErrors = vErrors.concat(refVal[4].errors);
- errors = vErrors.length;
- }
- var valid1 = errors === errs_1;
- }
- if (data.drawHorizontalLine !== undefined) {
- var errs_1 = errors;
- var errs__1 = errors;
- var valid1;
- valid1 = typeof data.drawHorizontalLine == "function";
- if (!valid1) {
- if (errs__1 == errors) {
- var err = {
- keyword: 'typeof',
- dataPath: (dataPath || '') + '.drawHorizontalLine',
- schemaPath: '#/properties/drawHorizontalLine/typeof',
- params: {
- keyword: 'typeof'
- },
- message: 'should pass "typeof" keyword validation'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- } else {
- for (var i1 = errs__1; i1 < errors; i1++) {
- var ruleErr1 = vErrors[i1];
- if (ruleErr1.dataPath === undefined) ruleErr1.dataPath = (dataPath || '') + '.drawHorizontalLine';
- if (ruleErr1.schemaPath === undefined) {
- ruleErr1.schemaPath = "#/properties/drawHorizontalLine/typeof";
- }
- }
- }
- }
- var valid1 = errors === errs_1;
- }
- } else {
- var err = {
- keyword: 'type',
- dataPath: (dataPath || '') + "",
- schemaPath: '#/type',
- params: {
- type: 'object'
- },
- message: 'should be object'
- };
- if (vErrors === null) vErrors = [err];
- else vErrors.push(err);
- errors++;
- }
- validate.errors = vErrors;
- return errors === 0;
- };
- })();
- validate.schema = {
- "$id": "config.json",
- "$schema": "http://json-schema.org/draft-07/schema#",
- "type": "object",
- "properties": {
- "border": {
- "$ref": "#/definitions/borders"
- },
- "columns": {
- "$ref": "#/definitions/columns"
- },
- "columnDefault": {
- "$ref": "#/definitions/column"
- },
- "drawHorizontalLine": {
- "typeof": "function"
- }
- },
- "additionalProperties": false,
- "definitions": {
- "columns": {
- "type": "object",
- "patternProperties": {
- "^[0-9]+$": {
- "$ref": "#/definitions/column"
- }
- },
- "additionalProperties": false
- },
- "column": {
- "type": "object",
- "properties": {
- "alignment": {
- "type": "string",
- "enum": ["left", "right", "center"]
- },
- "width": {
- "type": "number"
- },
- "wrapWord": {
- "type": "boolean"
- },
- "truncate": {
- "type": "number"
- },
- "paddingLeft": {
- "type": "number"
- },
- "paddingRight": {
- "type": "number"
- }
- },
- "additionalProperties": false
- },
- "borders": {
- "type": "object",
- "properties": {
- "topBody": {
- "$ref": "#/definitions/border"
- },
- "topJoin": {
- "$ref": "#/definitions/border"
- },
- "topLeft": {
- "$ref": "#/definitions/border"
- },
- "topRight": {
- "$ref": "#/definitions/border"
- },
- "bottomBody": {
- "$ref": "#/definitions/border"
- },
- "bottomJoin": {
- "$ref": "#/definitions/border"
- },
- "bottomLeft": {
- "$ref": "#/definitions/border"
- },
- "bottomRight": {
- "$ref": "#/definitions/border"
- },
- "bodyLeft": {
- "$ref": "#/definitions/border"
- },
- "bodyRight": {
- "$ref": "#/definitions/border"
- },
- "bodyJoin": {
- "$ref": "#/definitions/border"
- },
- "joinBody": {
- "$ref": "#/definitions/border"
- },
- "joinLeft": {
- "$ref": "#/definitions/border"
- },
- "joinRight": {
- "$ref": "#/definitions/border"
- },
- "joinJoin": {
- "$ref": "#/definitions/border"
- }
- },
- "additionalProperties": false
- },
- "border": {
- "type": "string"
- }
- }
- };
- validate.errors = null;
- module.exports = validate;
|