UNPKG

23.8 kBJavaScriptView Raw
1'use strict';
2var equal = require('ajv/lib/compile/equal');
3var validate = (function() {
4 var pattern0 = new RegExp('^[0-9]+$');
5 var refVal = [];
6 var refVal1 = (function() {
7 var pattern0 = new RegExp('^[0-9]+$');
8 return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
9 'use strict';
10 var vErrors = null;
11 var errors = 0;
12 if (rootData === undefined) rootData = data;
13 if ((data && typeof data === "object" && !Array.isArray(data))) {
14 var errs__0 = errors;
15 var valid1 = true;
16 for (var key0 in data) {
17 var isAdditional0 = !(false || validate.schema.properties.hasOwnProperty(key0));
18 if (isAdditional0) {
19 valid1 = false;
20 var err = {
21 keyword: 'additionalProperties',
22 dataPath: (dataPath || '') + "",
23 schemaPath: '#/additionalProperties',
24 params: {
25 additionalProperty: '' + key0 + ''
26 },
27 message: 'should NOT have additional properties'
28 };
29 if (vErrors === null) vErrors = [err];
30 else vErrors.push(err);
31 errors++;
32 }
33 }
34 if (data.topBody !== undefined) {
35 var errs_1 = errors;
36 if (!refVal2(data.topBody, (dataPath || '') + '.topBody', data, 'topBody', rootData)) {
37 if (vErrors === null) vErrors = refVal2.errors;
38 else vErrors = vErrors.concat(refVal2.errors);
39 errors = vErrors.length;
40 }
41 var valid1 = errors === errs_1;
42 }
43 if (data.topJoin !== undefined) {
44 var errs_1 = errors;
45 if (!refVal[2](data.topJoin, (dataPath || '') + '.topJoin', data, 'topJoin', rootData)) {
46 if (vErrors === null) vErrors = refVal[2].errors;
47 else vErrors = vErrors.concat(refVal[2].errors);
48 errors = vErrors.length;
49 }
50 var valid1 = errors === errs_1;
51 }
52 if (data.topLeft !== undefined) {
53 var errs_1 = errors;
54 if (!refVal[2](data.topLeft, (dataPath || '') + '.topLeft', data, 'topLeft', rootData)) {
55 if (vErrors === null) vErrors = refVal[2].errors;
56 else vErrors = vErrors.concat(refVal[2].errors);
57 errors = vErrors.length;
58 }
59 var valid1 = errors === errs_1;
60 }
61 if (data.topRight !== undefined) {
62 var errs_1 = errors;
63 if (!refVal[2](data.topRight, (dataPath || '') + '.topRight', data, 'topRight', rootData)) {
64 if (vErrors === null) vErrors = refVal[2].errors;
65 else vErrors = vErrors.concat(refVal[2].errors);
66 errors = vErrors.length;
67 }
68 var valid1 = errors === errs_1;
69 }
70 if (data.bottomBody !== undefined) {
71 var errs_1 = errors;
72 if (!refVal[2](data.bottomBody, (dataPath || '') + '.bottomBody', data, 'bottomBody', rootData)) {
73 if (vErrors === null) vErrors = refVal[2].errors;
74 else vErrors = vErrors.concat(refVal[2].errors);
75 errors = vErrors.length;
76 }
77 var valid1 = errors === errs_1;
78 }
79 if (data.bottomJoin !== undefined) {
80 var errs_1 = errors;
81 if (!refVal[2](data.bottomJoin, (dataPath || '') + '.bottomJoin', data, 'bottomJoin', rootData)) {
82 if (vErrors === null) vErrors = refVal[2].errors;
83 else vErrors = vErrors.concat(refVal[2].errors);
84 errors = vErrors.length;
85 }
86 var valid1 = errors === errs_1;
87 }
88 if (data.bottomLeft !== undefined) {
89 var errs_1 = errors;
90 if (!refVal[2](data.bottomLeft, (dataPath || '') + '.bottomLeft', data, 'bottomLeft', rootData)) {
91 if (vErrors === null) vErrors = refVal[2].errors;
92 else vErrors = vErrors.concat(refVal[2].errors);
93 errors = vErrors.length;
94 }
95 var valid1 = errors === errs_1;
96 }
97 if (data.bottomRight !== undefined) {
98 var errs_1 = errors;
99 if (!refVal[2](data.bottomRight, (dataPath || '') + '.bottomRight', data, 'bottomRight', rootData)) {
100 if (vErrors === null) vErrors = refVal[2].errors;
101 else vErrors = vErrors.concat(refVal[2].errors);
102 errors = vErrors.length;
103 }
104 var valid1 = errors === errs_1;
105 }
106 if (data.bodyLeft !== undefined) {
107 var errs_1 = errors;
108 if (!refVal[2](data.bodyLeft, (dataPath || '') + '.bodyLeft', data, 'bodyLeft', rootData)) {
109 if (vErrors === null) vErrors = refVal[2].errors;
110 else vErrors = vErrors.concat(refVal[2].errors);
111 errors = vErrors.length;
112 }
113 var valid1 = errors === errs_1;
114 }
115 if (data.bodyRight !== undefined) {
116 var errs_1 = errors;
117 if (!refVal[2](data.bodyRight, (dataPath || '') + '.bodyRight', data, 'bodyRight', rootData)) {
118 if (vErrors === null) vErrors = refVal[2].errors;
119 else vErrors = vErrors.concat(refVal[2].errors);
120 errors = vErrors.length;
121 }
122 var valid1 = errors === errs_1;
123 }
124 if (data.bodyJoin !== undefined) {
125 var errs_1 = errors;
126 if (!refVal[2](data.bodyJoin, (dataPath || '') + '.bodyJoin', data, 'bodyJoin', rootData)) {
127 if (vErrors === null) vErrors = refVal[2].errors;
128 else vErrors = vErrors.concat(refVal[2].errors);
129 errors = vErrors.length;
130 }
131 var valid1 = errors === errs_1;
132 }
133 if (data.joinBody !== undefined) {
134 var errs_1 = errors;
135 if (!refVal[2](data.joinBody, (dataPath || '') + '.joinBody', data, 'joinBody', rootData)) {
136 if (vErrors === null) vErrors = refVal[2].errors;
137 else vErrors = vErrors.concat(refVal[2].errors);
138 errors = vErrors.length;
139 }
140 var valid1 = errors === errs_1;
141 }
142 if (data.joinLeft !== undefined) {
143 var errs_1 = errors;
144 if (!refVal[2](data.joinLeft, (dataPath || '') + '.joinLeft', data, 'joinLeft', rootData)) {
145 if (vErrors === null) vErrors = refVal[2].errors;
146 else vErrors = vErrors.concat(refVal[2].errors);
147 errors = vErrors.length;
148 }
149 var valid1 = errors === errs_1;
150 }
151 if (data.joinRight !== undefined) {
152 var errs_1 = errors;
153 if (!refVal[2](data.joinRight, (dataPath || '') + '.joinRight', data, 'joinRight', rootData)) {
154 if (vErrors === null) vErrors = refVal[2].errors;
155 else vErrors = vErrors.concat(refVal[2].errors);
156 errors = vErrors.length;
157 }
158 var valid1 = errors === errs_1;
159 }
160 if (data.joinJoin !== undefined) {
161 var errs_1 = errors;
162 if (!refVal[2](data.joinJoin, (dataPath || '') + '.joinJoin', data, 'joinJoin', rootData)) {
163 if (vErrors === null) vErrors = refVal[2].errors;
164 else vErrors = vErrors.concat(refVal[2].errors);
165 errors = vErrors.length;
166 }
167 var valid1 = errors === errs_1;
168 }
169 } else {
170 var err = {
171 keyword: 'type',
172 dataPath: (dataPath || '') + "",
173 schemaPath: '#/type',
174 params: {
175 type: 'object'
176 },
177 message: 'should be object'
178 };
179 if (vErrors === null) vErrors = [err];
180 else vErrors.push(err);
181 errors++;
182 }
183 validate.errors = vErrors;
184 return errors === 0;
185 };
186 })();
187 refVal1.schema = {
188 "type": "object",
189 "properties": {
190 "topBody": {
191 "$ref": "#/definitions/border"
192 },
193 "topJoin": {
194 "$ref": "#/definitions/border"
195 },
196 "topLeft": {
197 "$ref": "#/definitions/border"
198 },
199 "topRight": {
200 "$ref": "#/definitions/border"
201 },
202 "bottomBody": {
203 "$ref": "#/definitions/border"
204 },
205 "bottomJoin": {
206 "$ref": "#/definitions/border"
207 },
208 "bottomLeft": {
209 "$ref": "#/definitions/border"
210 },
211 "bottomRight": {
212 "$ref": "#/definitions/border"
213 },
214 "bodyLeft": {
215 "$ref": "#/definitions/border"
216 },
217 "bodyRight": {
218 "$ref": "#/definitions/border"
219 },
220 "bodyJoin": {
221 "$ref": "#/definitions/border"
222 },
223 "joinBody": {
224 "$ref": "#/definitions/border"
225 },
226 "joinLeft": {
227 "$ref": "#/definitions/border"
228 },
229 "joinRight": {
230 "$ref": "#/definitions/border"
231 },
232 "joinJoin": {
233 "$ref": "#/definitions/border"
234 }
235 },
236 "additionalProperties": false
237 };
238 refVal1.errors = null;
239 refVal[1] = refVal1;
240 var refVal2 = (function() {
241 var pattern0 = new RegExp('^[0-9]+$');
242 return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
243 'use strict';
244 var vErrors = null;
245 var errors = 0;
246 if (typeof data !== "string") {
247 var err = {
248 keyword: 'type',
249 dataPath: (dataPath || '') + "",
250 schemaPath: '#/type',
251 params: {
252 type: 'string'
253 },
254 message: 'should be string'
255 };
256 if (vErrors === null) vErrors = [err];
257 else vErrors.push(err);
258 errors++;
259 }
260 validate.errors = vErrors;
261 return errors === 0;
262 };
263 })();
264 refVal2.schema = {
265 "type": "string"
266 };
267 refVal2.errors = null;
268 refVal[2] = refVal2;
269 var refVal3 = (function() {
270 var pattern0 = new RegExp('^[0-9]+$');
271 return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
272 'use strict';
273 var vErrors = null;
274 var errors = 0;
275 if (rootData === undefined) rootData = data;
276 if ((data && typeof data === "object" && !Array.isArray(data))) {
277 var errs__0 = errors;
278 var valid1 = true;
279 for (var key0 in data) {
280 var isAdditional0 = !(false || pattern0.test(key0));
281 if (isAdditional0) {
282 valid1 = false;
283 var err = {
284 keyword: 'additionalProperties',
285 dataPath: (dataPath || '') + "",
286 schemaPath: '#/additionalProperties',
287 params: {
288 additionalProperty: '' + key0 + ''
289 },
290 message: 'should NOT have additional properties'
291 };
292 if (vErrors === null) vErrors = [err];
293 else vErrors.push(err);
294 errors++;
295 }
296 }
297 for (var key0 in data) {
298 if (pattern0.test(key0)) {
299 var errs_1 = errors;
300 if (!refVal4(data[key0], (dataPath || '') + '[\'' + key0 + '\']', data, key0, rootData)) {
301 if (vErrors === null) vErrors = refVal4.errors;
302 else vErrors = vErrors.concat(refVal4.errors);
303 errors = vErrors.length;
304 }
305 var valid1 = errors === errs_1;
306 }
307 }
308 } else {
309 var err = {
310 keyword: 'type',
311 dataPath: (dataPath || '') + "",
312 schemaPath: '#/type',
313 params: {
314 type: 'object'
315 },
316 message: 'should be object'
317 };
318 if (vErrors === null) vErrors = [err];
319 else vErrors.push(err);
320 errors++;
321 }
322 validate.errors = vErrors;
323 return errors === 0;
324 };
325 })();
326 refVal3.schema = {
327 "type": "object",
328 "patternProperties": {
329 "^[0-9]+$": {
330 "$ref": "#/definitions/column"
331 }
332 },
333 "additionalProperties": false
334 };
335 refVal3.errors = null;
336 refVal[3] = refVal3;
337 var refVal4 = (function() {
338 var pattern0 = new RegExp('^[0-9]+$');
339 return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
340 'use strict';
341 var vErrors = null;
342 var errors = 0;
343 if ((data && typeof data === "object" && !Array.isArray(data))) {
344 var errs__0 = errors;
345 var valid1 = true;
346 for (var key0 in data) {
347 var isAdditional0 = !(false || key0 == 'alignment' || key0 == 'width' || key0 == 'wrapWord' || key0 == 'truncate' || key0 == 'paddingLeft' || key0 == 'paddingRight');
348 if (isAdditional0) {
349 valid1 = false;
350 var err = {
351 keyword: 'additionalProperties',
352 dataPath: (dataPath || '') + "",
353 schemaPath: '#/additionalProperties',
354 params: {
355 additionalProperty: '' + key0 + ''
356 },
357 message: 'should NOT have additional properties'
358 };
359 if (vErrors === null) vErrors = [err];
360 else vErrors.push(err);
361 errors++;
362 }
363 }
364 var data1 = data.alignment;
365 if (data1 !== undefined) {
366 var errs_1 = errors;
367 if (typeof data1 !== "string") {
368 var err = {
369 keyword: 'type',
370 dataPath: (dataPath || '') + '.alignment',
371 schemaPath: '#/properties/alignment/type',
372 params: {
373 type: 'string'
374 },
375 message: 'should be string'
376 };
377 if (vErrors === null) vErrors = [err];
378 else vErrors.push(err);
379 errors++;
380 }
381 var schema1 = validate.schema.properties.alignment.enum;
382 var valid1;
383 valid1 = false;
384 for (var i1 = 0; i1 < schema1.length; i1++)
385 if (equal(data1, schema1[i1])) {
386 valid1 = true;
387 break;
388 } if (!valid1) {
389 var err = {
390 keyword: 'enum',
391 dataPath: (dataPath || '') + '.alignment',
392 schemaPath: '#/properties/alignment/enum',
393 params: {
394 allowedValues: schema1
395 },
396 message: 'should be equal to one of the allowed values'
397 };
398 if (vErrors === null) vErrors = [err];
399 else vErrors.push(err);
400 errors++;
401 }
402 var valid1 = errors === errs_1;
403 }
404 if (data.width !== undefined) {
405 var errs_1 = errors;
406 if (typeof data.width !== "number") {
407 var err = {
408 keyword: 'type',
409 dataPath: (dataPath || '') + '.width',
410 schemaPath: '#/properties/width/type',
411 params: {
412 type: 'number'
413 },
414 message: 'should be number'
415 };
416 if (vErrors === null) vErrors = [err];
417 else vErrors.push(err);
418 errors++;
419 }
420 var valid1 = errors === errs_1;
421 }
422 if (data.wrapWord !== undefined) {
423 var errs_1 = errors;
424 if (typeof data.wrapWord !== "boolean") {
425 var err = {
426 keyword: 'type',
427 dataPath: (dataPath || '') + '.wrapWord',
428 schemaPath: '#/properties/wrapWord/type',
429 params: {
430 type: 'boolean'
431 },
432 message: 'should be boolean'
433 };
434 if (vErrors === null) vErrors = [err];
435 else vErrors.push(err);
436 errors++;
437 }
438 var valid1 = errors === errs_1;
439 }
440 if (data.truncate !== undefined) {
441 var errs_1 = errors;
442 if (typeof data.truncate !== "number") {
443 var err = {
444 keyword: 'type',
445 dataPath: (dataPath || '') + '.truncate',
446 schemaPath: '#/properties/truncate/type',
447 params: {
448 type: 'number'
449 },
450 message: 'should be number'
451 };
452 if (vErrors === null) vErrors = [err];
453 else vErrors.push(err);
454 errors++;
455 }
456 var valid1 = errors === errs_1;
457 }
458 if (data.paddingLeft !== undefined) {
459 var errs_1 = errors;
460 if (typeof data.paddingLeft !== "number") {
461 var err = {
462 keyword: 'type',
463 dataPath: (dataPath || '') + '.paddingLeft',
464 schemaPath: '#/properties/paddingLeft/type',
465 params: {
466 type: 'number'
467 },
468 message: 'should be number'
469 };
470 if (vErrors === null) vErrors = [err];
471 else vErrors.push(err);
472 errors++;
473 }
474 var valid1 = errors === errs_1;
475 }
476 if (data.paddingRight !== undefined) {
477 var errs_1 = errors;
478 if (typeof data.paddingRight !== "number") {
479 var err = {
480 keyword: 'type',
481 dataPath: (dataPath || '') + '.paddingRight',
482 schemaPath: '#/properties/paddingRight/type',
483 params: {
484 type: 'number'
485 },
486 message: 'should be number'
487 };
488 if (vErrors === null) vErrors = [err];
489 else vErrors.push(err);
490 errors++;
491 }
492 var valid1 = errors === errs_1;
493 }
494 } else {
495 var err = {
496 keyword: 'type',
497 dataPath: (dataPath || '') + "",
498 schemaPath: '#/type',
499 params: {
500 type: 'object'
501 },
502 message: 'should be object'
503 };
504 if (vErrors === null) vErrors = [err];
505 else vErrors.push(err);
506 errors++;
507 }
508 validate.errors = vErrors;
509 return errors === 0;
510 };
511 })();
512 refVal4.schema = {
513 "type": "object",
514 "properties": {
515 "alignment": {
516 "type": "string",
517 "enum": ["left", "right", "center"]
518 },
519 "width": {
520 "type": "number"
521 },
522 "wrapWord": {
523 "type": "boolean"
524 },
525 "truncate": {
526 "type": "number"
527 },
528 "paddingLeft": {
529 "type": "number"
530 },
531 "paddingRight": {
532 "type": "number"
533 }
534 },
535 "additionalProperties": false
536 };
537 refVal4.errors = null;
538 refVal[4] = refVal4;
539 return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
540 'use strict'; /*# sourceURL=streamConfig.json */
541 var vErrors = null;
542 var errors = 0;
543 if (rootData === undefined) rootData = data;
544 if ((data && typeof data === "object" && !Array.isArray(data))) {
545 var errs__0 = errors;
546 var valid1 = true;
547 for (var key0 in data) {
548 var isAdditional0 = !(false || key0 == 'border' || key0 == 'columns' || key0 == 'columnDefault' || key0 == 'columnCount');
549 if (isAdditional0) {
550 valid1 = false;
551 var err = {
552 keyword: 'additionalProperties',
553 dataPath: (dataPath || '') + "",
554 schemaPath: '#/additionalProperties',
555 params: {
556 additionalProperty: '' + key0 + ''
557 },
558 message: 'should NOT have additional properties'
559 };
560 if (vErrors === null) vErrors = [err];
561 else vErrors.push(err);
562 errors++;
563 }
564 }
565 if (data.border !== undefined) {
566 var errs_1 = errors;
567 if (!refVal1(data.border, (dataPath || '') + '.border', data, 'border', rootData)) {
568 if (vErrors === null) vErrors = refVal1.errors;
569 else vErrors = vErrors.concat(refVal1.errors);
570 errors = vErrors.length;
571 }
572 var valid1 = errors === errs_1;
573 }
574 if (data.columns !== undefined) {
575 var errs_1 = errors;
576 if (!refVal3(data.columns, (dataPath || '') + '.columns', data, 'columns', rootData)) {
577 if (vErrors === null) vErrors = refVal3.errors;
578 else vErrors = vErrors.concat(refVal3.errors);
579 errors = vErrors.length;
580 }
581 var valid1 = errors === errs_1;
582 }
583 if (data.columnDefault !== undefined) {
584 var errs_1 = errors;
585 if (!refVal[4](data.columnDefault, (dataPath || '') + '.columnDefault', data, 'columnDefault', rootData)) {
586 if (vErrors === null) vErrors = refVal[4].errors;
587 else vErrors = vErrors.concat(refVal[4].errors);
588 errors = vErrors.length;
589 }
590 var valid1 = errors === errs_1;
591 }
592 if (data.columnCount !== undefined) {
593 var errs_1 = errors;
594 if (typeof data.columnCount !== "number") {
595 var err = {
596 keyword: 'type',
597 dataPath: (dataPath || '') + '.columnCount',
598 schemaPath: '#/properties/columnCount/type',
599 params: {
600 type: 'number'
601 },
602 message: 'should be number'
603 };
604 if (vErrors === null) vErrors = [err];
605 else vErrors.push(err);
606 errors++;
607 }
608 var valid1 = errors === errs_1;
609 }
610 } else {
611 var err = {
612 keyword: 'type',
613 dataPath: (dataPath || '') + "",
614 schemaPath: '#/type',
615 params: {
616 type: 'object'
617 },
618 message: 'should be object'
619 };
620 if (vErrors === null) vErrors = [err];
621 else vErrors.push(err);
622 errors++;
623 }
624 validate.errors = vErrors;
625 return errors === 0;
626 };
627})();
628validate.schema = {
629 "$id": "streamConfig.json",
630 "$schema": "http://json-schema.org/draft-07/schema#",
631 "type": "object",
632 "properties": {
633 "border": {
634 "$ref": "#/definitions/borders"
635 },
636 "columns": {
637 "$ref": "#/definitions/columns"
638 },
639 "columnDefault": {
640 "$ref": "#/definitions/column"
641 },
642 "columnCount": {
643 "type": "number"
644 }
645 },
646 "additionalProperties": false,
647 "definitions": {
648 "columns": {
649 "type": "object",
650 "patternProperties": {
651 "^[0-9]+$": {
652 "$ref": "#/definitions/column"
653 }
654 },
655 "additionalProperties": false
656 },
657 "column": {
658 "type": "object",
659 "properties": {
660 "alignment": {
661 "type": "string",
662 "enum": ["left", "right", "center"]
663 },
664 "width": {
665 "type": "number"
666 },
667 "wrapWord": {
668 "type": "boolean"
669 },
670 "truncate": {
671 "type": "number"
672 },
673 "paddingLeft": {
674 "type": "number"
675 },
676 "paddingRight": {
677 "type": "number"
678 }
679 },
680 "additionalProperties": false
681 },
682 "borders": {
683 "type": "object",
684 "properties": {
685 "topBody": {
686 "$ref": "#/definitions/border"
687 },
688 "topJoin": {
689 "$ref": "#/definitions/border"
690 },
691 "topLeft": {
692 "$ref": "#/definitions/border"
693 },
694 "topRight": {
695 "$ref": "#/definitions/border"
696 },
697 "bottomBody": {
698 "$ref": "#/definitions/border"
699 },
700 "bottomJoin": {
701 "$ref": "#/definitions/border"
702 },
703 "bottomLeft": {
704 "$ref": "#/definitions/border"
705 },
706 "bottomRight": {
707 "$ref": "#/definitions/border"
708 },
709 "bodyLeft": {
710 "$ref": "#/definitions/border"
711 },
712 "bodyRight": {
713 "$ref": "#/definitions/border"
714 },
715 "bodyJoin": {
716 "$ref": "#/definitions/border"
717 },
718 "joinBody": {
719 "$ref": "#/definitions/border"
720 },
721 "joinLeft": {
722 "$ref": "#/definitions/border"
723 },
724 "joinRight": {
725 "$ref": "#/definitions/border"
726 },
727 "joinJoin": {
728 "$ref": "#/definitions/border"
729 }
730 },
731 "additionalProperties": false
732 },
733 "border": {
734 "type": "string"
735 }
736 }
737};
738validate.errors = null;
739module.exports = validate;
\No newline at end of file