forked from enviPath/enviPy
Current Dev State
This commit is contained in:
24
static/js/ketcher2/node_modules/table/LICENSE
generated
vendored
Normal file
24
static/js/ketcher2/node_modules/table/LICENSE
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
Copyright (c) 2016, Gajus Kuizinas (http://gajus.com/)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Gajus Kuizinas (http://gajus.com/) nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL ANUARY BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
652
static/js/ketcher2/node_modules/table/README.md
generated
vendored
Normal file
652
static/js/ketcher2/node_modules/table/README.md
generated
vendored
Normal file
@ -0,0 +1,652 @@
|
||||
<h1 id="table">Table</h1>
|
||||
|
||||
[](https://travis-ci.org/gajus/table)
|
||||
[](https://www.npmjs.com/package/table)
|
||||
[](https://github.com/gajus/canonical)
|
||||
|
||||
* [Table](#table)
|
||||
* [Features](#table-features)
|
||||
* [Usage](#table-usage)
|
||||
* [Cell Content Alignment](#table-usage-cell-content-alignment)
|
||||
* [Column Width](#table-usage-column-width)
|
||||
* [Custom Border](#table-usage-custom-border)
|
||||
* [Draw Horizontal Line](#table-usage-draw-horizontal-line)
|
||||
* [Padding Cell Content](#table-usage-padding-cell-content)
|
||||
* [Predefined Border Templates](#table-usage-predefined-border-templates)
|
||||
* [Streaming](#table-usage-streaming)
|
||||
* [Text Truncation](#table-usage-text-truncation)
|
||||
* [Text Wrapping](#table-usage-text-wrapping)
|
||||
|
||||
|
||||
Produces a string that represents array data in a text table.
|
||||
|
||||

|
||||
|
||||
<h2 id="table-features">Features</h2>
|
||||
|
||||
* Works with strings containing [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) characters.
|
||||
* Works with strings containing [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code).
|
||||
* Configurable border characters.
|
||||
* Configurable content alignment per column.
|
||||
* Configurable content padding per column.
|
||||
* Configurable column width.
|
||||
* Text wrapping.
|
||||
|
||||
<h2 id="table-usage">Usage</h2>
|
||||
|
||||
Table data is described using an array (rows) of array (cells).
|
||||
|
||||
```js
|
||||
import table from 'table';
|
||||
|
||||
let data,
|
||||
output;
|
||||
|
||||
data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
/**
|
||||
* @typedef {string} table~cell
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {table~cell[]} table~row
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} table~columns
|
||||
* @property {string} alignment Cell content alignment (enum: left, center, right) (default: left).
|
||||
* @property {number} width Column width (default: auto).
|
||||
* @property {number} truncate Number of characters are which the content will be truncated (default: Infinity).
|
||||
* @property {number} paddingLeft Cell content padding width left (default: 1).
|
||||
* @property {number} paddingRight Cell content padding width right (default: 1).
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} table~border
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} bottomBody
|
||||
* @property {string} bottomJoin
|
||||
* @property {string} bottomLeft
|
||||
* @property {string} bottomRight
|
||||
* @property {string} bodyLeft
|
||||
* @property {string} bodyRight
|
||||
* @property {string} bodyJoin
|
||||
* @property {string} joinBody
|
||||
* @property {string} joinLeft
|
||||
* @property {string} joinRight
|
||||
* @property {string} joinJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Used to dynamically tell table whether to draw a line separating rows or not.
|
||||
* The default behavior is to always return true.
|
||||
*
|
||||
* @typedef {function} drawJoin
|
||||
* @param {number} index
|
||||
* @param {number} size
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} table~config
|
||||
* @property {table~border} border
|
||||
* @property {table~columns[]} columns Column specific configuration.
|
||||
* @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values.
|
||||
* @property {table~drawJoin} drawHorizontalLine
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generates a text table.
|
||||
*
|
||||
* @param {table~row[]} rows
|
||||
* @param {table~config} config
|
||||
* @return {String}
|
||||
*/
|
||||
output = table(data);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
╔════╤════╤════╗
|
||||
║ 0A │ 0B │ 0C ║
|
||||
╟────┼────┼────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
╟────┼────┼────╢
|
||||
║ 2A │ 2B │ 2C ║
|
||||
╚════╧════╧════╝
|
||||
```
|
||||
|
||||
|
||||
<h3 id="table-usage-cell-content-alignment">Cell Content Alignment</h3>
|
||||
|
||||
`{string} config.columns[{number}].alignment` property controls content horizontal alignment within a cell.
|
||||
|
||||
Valid values are: "left", "right" and "center".
|
||||
|
||||
```js
|
||||
let config,
|
||||
data,
|
||||
output;
|
||||
|
||||
data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
config = {
|
||||
columns: {
|
||||
0: {
|
||||
alignment: 'left',
|
||||
minWidth: 10
|
||||
},
|
||||
1: {
|
||||
alignment: 'center',
|
||||
minWidth: 10
|
||||
},
|
||||
2: {
|
||||
alignment: 'right',
|
||||
minWidth: 10
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
output = table(data, config);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
╔════════════╤════════════╤════════════╗
|
||||
║ 0A │ 0B │ 0C ║
|
||||
╟────────────┼────────────┼────────────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
╟────────────┼────────────┼────────────╢
|
||||
║ 2A │ 2B │ 2C ║
|
||||
╚════════════╧════════════╧════════════╝
|
||||
```
|
||||
|
||||
<h3 id="table-usage-column-width">Column Width</h3>
|
||||
|
||||
`{number} config.columns[{number}].width` property restricts column width to a fixed width.
|
||||
|
||||
```js
|
||||
let data,
|
||||
output,
|
||||
options;
|
||||
|
||||
data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
options = {
|
||||
columns: {
|
||||
1: {
|
||||
width: 10
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
output = table(data, options);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
╔════╤════════════╤════╗
|
||||
║ 0A │ 0B │ 0C ║
|
||||
╟────┼────────────┼────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
╟────┼────────────┼────╢
|
||||
║ 2A │ 2B │ 2C ║
|
||||
╚════╧════════════╧════╝
|
||||
```
|
||||
|
||||
<h3 id="table-usage-custom-border">Custom Border</h3>
|
||||
|
||||
`{object} config.border` property describes characters used to draw the table border.
|
||||
|
||||
```js
|
||||
let config,
|
||||
data,
|
||||
output;
|
||||
|
||||
data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
config = {
|
||||
border: {
|
||||
topBody: `─`,
|
||||
topJoin: `┬`,
|
||||
topLeft: `┌`,
|
||||
topRight: `┐`,
|
||||
|
||||
bottomBody: `─`,
|
||||
bottomJoin: `┴`,
|
||||
bottomLeft: `└`,
|
||||
bottomRight: `┘`,
|
||||
|
||||
bodyLeft: `│`,
|
||||
bodyRight: `│`,
|
||||
bodyJoin: `│`,
|
||||
|
||||
joinBody: `─`,
|
||||
joinLeft: `├`,
|
||||
joinRight: `┤`,
|
||||
joinJoin: `┼`
|
||||
}
|
||||
};
|
||||
|
||||
output = table(data, config);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
┌────┬────┬────┐
|
||||
│ 0A │ 0B │ 0C │
|
||||
├────┼────┼────┤
|
||||
│ 1A │ 1B │ 1C │
|
||||
├────┼────┼────┤
|
||||
│ 2A │ 2B │ 2C │
|
||||
└────┴────┴────┘
|
||||
```
|
||||
|
||||
<h3 id="table-usage-draw-horizontal-line">Draw Horizontal Line</h3>
|
||||
|
||||
`{function} config.drawHorizontalLine` property is a function that is called for every non-content row in the table. The result of the function `{boolean}` determines whether a row is drawn.
|
||||
|
||||
```js
|
||||
let data,
|
||||
output,
|
||||
options;
|
||||
|
||||
data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C'],
|
||||
['3A', '3B', '3C'],
|
||||
['4A', '4B', '4C']
|
||||
];
|
||||
|
||||
options = {
|
||||
/**
|
||||
* @typedef {function} drawJoin
|
||||
* @param {number} index
|
||||
* @param {number} size
|
||||
* @return {boolean}
|
||||
*/
|
||||
drawHorizontalLine: (index, size) => {
|
||||
return index === 0 || index === 1 || index === size - 1 || index === size;
|
||||
}
|
||||
};
|
||||
|
||||
output = table(data, options);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
╔════╤════╤════╗
|
||||
║ 0A │ 0B │ 0C ║
|
||||
╟────┼────┼────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
║ 2A │ 2B │ 2C ║
|
||||
║ 3A │ 3B │ 3C ║
|
||||
╟────┼────┼────╢
|
||||
║ 4A │ 4B │ 4C ║
|
||||
╚════╧════╧════╝
|
||||
```
|
||||
|
||||
<h3 id="table-usage-padding-cell-content">Padding Cell Content</h3>
|
||||
|
||||
`{number} config.columns[{number}].paddingLeft` and `{number} config.columns[{number}].paddingRight` properties control content padding within a cell. Property value represents a number of whitespaces used to pad the content.
|
||||
|
||||
```js
|
||||
let config,
|
||||
data,
|
||||
output;
|
||||
|
||||
data = [
|
||||
['0A', 'AABBCC', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
config = {
|
||||
columns: {
|
||||
0: {
|
||||
paddingLeft: 3
|
||||
},
|
||||
1: {
|
||||
width: 2,
|
||||
paddingRight: 3
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
output = table(data, config);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
╔══════╤══════╤════╗
|
||||
║ 0A │ AA │ 0C ║
|
||||
║ │ BB │ ║
|
||||
║ │ CC │ ║
|
||||
╟──────┼──────┼────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
╟──────┼──────┼────╢
|
||||
║ 2A │ 2B │ 2C ║
|
||||
╚══════╧══════╧════╝
|
||||
```
|
||||
|
||||
<h3 id="table-usage-predefined-border-templates">Predefined Border Templates</h3>
|
||||
|
||||
You can load one of the predefined border templates using `getBorderCharacters` function.
|
||||
|
||||
```js
|
||||
import table, {
|
||||
getBorderCharacters
|
||||
} from 'table';
|
||||
|
||||
let config,
|
||||
data;
|
||||
|
||||
data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
config = {
|
||||
border: getBorderCharacters(`name of the template`)
|
||||
};
|
||||
|
||||
table(data, config);
|
||||
```
|
||||
|
||||
```
|
||||
# honeywell
|
||||
|
||||
╔════╤════╤════╗
|
||||
║ 0A │ 0B │ 0C ║
|
||||
╟────┼────┼────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
╟────┼────┼────╢
|
||||
║ 2A │ 2B │ 2C ║
|
||||
╚════╧════╧════╝
|
||||
|
||||
# norc
|
||||
|
||||
┌────┬────┬────┐
|
||||
│ 0A │ 0B │ 0C │
|
||||
├────┼────┼────┤
|
||||
│ 1A │ 1B │ 1C │
|
||||
├────┼────┼────┤
|
||||
│ 2A │ 2B │ 2C │
|
||||
└────┴────┴────┘
|
||||
|
||||
# ramac (ASCII; for use in terminals that do not support Unicode characters)
|
||||
|
||||
+----+----+----+
|
||||
| 0A | 0B | 0C |
|
||||
|----|----|----|
|
||||
| 1A | 1B | 1C |
|
||||
|----|----|----|
|
||||
| 2A | 2B | 2C |
|
||||
+----+----+----+
|
||||
|
||||
# void (no borders; see "bordless table" section of the documentation)
|
||||
|
||||
0A 0B 0C
|
||||
|
||||
1A 1B 1C
|
||||
|
||||
2A 2B 2C
|
||||
|
||||
```
|
||||
|
||||
Raise [an issue](https://github.com/gajus/table/issues) if you'd like to contribute a new border template.
|
||||
|
||||
<h4 id="table-usage-predefined-border-templates-borderless-table">Borderless Table</h4>
|
||||
|
||||
Simply using "void" border character template creates a table with a lot of unnecessary spacing.
|
||||
|
||||
To create a more plesant to the eye table, reset the padding and remove the joining rows, e.g.
|
||||
|
||||
```js
|
||||
let output;
|
||||
|
||||
output = table(data, {
|
||||
border: getBorderCharacters(`void`),
|
||||
columnDefault: {
|
||||
paddingLeft: 0,
|
||||
paddingRight: 1
|
||||
},
|
||||
drawJoin: () => {
|
||||
return false
|
||||
}
|
||||
});
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
0A 0B 0C
|
||||
1A 1B 1C
|
||||
2A 2B 2C
|
||||
```
|
||||
|
||||
<h3 id="table-usage-streaming">Streaming</h3>
|
||||
|
||||
`table` package exports `createStream` function used to draw a table and append rows.
|
||||
|
||||
`createStream` requires `{number} columnDefault.width` and `{number} columnCount` configuration properties.
|
||||
|
||||
```js
|
||||
import {
|
||||
createStream
|
||||
} from 'table';
|
||||
|
||||
let config,
|
||||
stream;
|
||||
|
||||
config = {
|
||||
columnDefault: {
|
||||
width: 50
|
||||
},
|
||||
columnCount: 1
|
||||
};
|
||||
|
||||
stream = createStream(config);
|
||||
|
||||
setInterval(() => {
|
||||
stream.write([new Date()]);
|
||||
}, 500);
|
||||
```
|
||||
|
||||

|
||||
|
||||
`table` package uses ANSI escape codes to overwrite the output of the last line when a new row is printed.
|
||||
|
||||
The underlying implementation is explained in this [Stack Overflow answer](http://stackoverflow.com/a/32938658/368691).
|
||||
|
||||
Streaming supports all of the configuration properties and functionality of a static table (such as auto text wrapping, alignment and padding), e.g.
|
||||
|
||||
```js
|
||||
import {
|
||||
createStream
|
||||
} from 'table';
|
||||
|
||||
import _ from 'lodash';
|
||||
|
||||
let config,
|
||||
stream,
|
||||
i;
|
||||
|
||||
config = {
|
||||
columnDefault: {
|
||||
width: 50
|
||||
},
|
||||
columnCount: 3,
|
||||
columns: {
|
||||
0: {
|
||||
width: 10,
|
||||
alignment: 'right'
|
||||
},
|
||||
1: {
|
||||
alignment: 'center',
|
||||
},
|
||||
2: {
|
||||
width: 10
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
stream = createStream(config);
|
||||
|
||||
i = 0;
|
||||
|
||||
setInterval(() => {
|
||||
let random;
|
||||
|
||||
random = _.sample('abcdefghijklmnopqrstuvwxyz', _.random(1, 30)).join('');
|
||||
|
||||
stream.write([i++, new Date(), random]);
|
||||
}, 500);
|
||||
```
|
||||
|
||||

|
||||
<h3 id="table-usage-text-truncation">Text Truncation</h3>
|
||||
|
||||
To handle a content that overflows the container width, `table` package implements [text wrapping](#table-usage-text-wrapping). However, sometimes you may want to truncate content that is too long to be displayed in the table.
|
||||
|
||||
`{number} config.columns[{number}].truncate` property (default: `Infinity`) truncates the text at the specified length.
|
||||
|
||||
```js
|
||||
let config,
|
||||
data,
|
||||
output;
|
||||
|
||||
data = [
|
||||
['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.']
|
||||
];
|
||||
|
||||
config = {
|
||||
columns: {
|
||||
0: {
|
||||
width: 20,
|
||||
truncate: 100
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
output = table(data, config);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
╔══════════════════════╗
|
||||
║ Lorem ipsum dolor si ║
|
||||
║ t amet, consectetur ║
|
||||
║ adipiscing elit. Pha ║
|
||||
║ sellus pulvinar nibh ║
|
||||
║ sed mauris conva... ║
|
||||
╚══════════════════════╝
|
||||
```
|
||||
|
||||
<h3 id="table-usage-text-wrapping">Text Wrapping</h3>
|
||||
|
||||
`table` package implements auto text wrapping, i.e. text that has width greater than the container width will be separated into multiple lines, e.g.
|
||||
|
||||
```js
|
||||
let config,
|
||||
data,
|
||||
output;
|
||||
|
||||
data = [
|
||||
['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.']
|
||||
];
|
||||
|
||||
config = {
|
||||
columns: {
|
||||
0: {
|
||||
width: 20
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
output = table(data, config);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
╔══════════════════════╗
|
||||
║ Lorem ipsum dolor si ║
|
||||
║ t amet, consectetur ║
|
||||
║ adipiscing elit. Pha ║
|
||||
║ sellus pulvinar nibh ║
|
||||
║ sed mauris convallis ║
|
||||
║ dapibus. Nunc venena ║
|
||||
║ tis tempus nulla sit ║
|
||||
║ amet viverra. ║
|
||||
╚══════════════════════╝
|
||||
```
|
||||
|
||||
When `wrapWord` is `true` the text is broken at the nearest space or one of the special characters ("-", "_", "\", "/", ".", ",", ";"), e.g.
|
||||
|
||||
```js
|
||||
let config,
|
||||
data,
|
||||
output;
|
||||
|
||||
data = [
|
||||
['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.']
|
||||
];
|
||||
|
||||
config = {
|
||||
columns: {
|
||||
0: {
|
||||
width: 20,
|
||||
wrapWord: true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
output = table(data, config);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
╔══════════════════════╗
|
||||
║ Lorem ipsum dolor ║
|
||||
║ sit amet, ║
|
||||
║ consectetur ║
|
||||
║ adipiscing elit. ║
|
||||
║ Phasellus pulvinar ║
|
||||
║ nibh sed mauris ║
|
||||
║ convallis dapibus. ║
|
||||
║ Nunc venenatis ║
|
||||
║ tempus nulla sit ║
|
||||
║ amet viverra. ║
|
||||
╚══════════════════════╝
|
||||
```
|
||||
|
||||
108
static/js/ketcher2/node_modules/table/dist/alignString.js
generated
vendored
Normal file
108
static/js/ketcher2/node_modules/table/dist/alignString.js
generated
vendored
Normal file
@ -0,0 +1,108 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
var _stringWidth = require('string-width');
|
||||
|
||||
var _stringWidth2 = _interopRequireDefault(_stringWidth);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const alignments = ['left', 'right', 'center'];
|
||||
|
||||
/**
|
||||
* @param {string} subject
|
||||
* @param {number} width
|
||||
* @returns {string}
|
||||
*/
|
||||
const alignLeft = (subject, width) => {
|
||||
return subject + _lodash2.default.repeat(' ', width);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} subject
|
||||
* @param {number} width
|
||||
* @returns {string}
|
||||
*/
|
||||
const alignRight = (subject, width) => {
|
||||
return _lodash2.default.repeat(' ', width) + subject;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} subject
|
||||
* @param {number} width
|
||||
* @returns {string}
|
||||
*/
|
||||
const alignCenter = (subject, width) => {
|
||||
let halfWidth;
|
||||
|
||||
halfWidth = width / 2;
|
||||
|
||||
if (halfWidth % 2 === 0) {
|
||||
return _lodash2.default.repeat(' ', halfWidth) + subject + _lodash2.default.repeat(' ', halfWidth);
|
||||
} else {
|
||||
halfWidth = _lodash2.default.floor(halfWidth);
|
||||
|
||||
return _lodash2.default.repeat(' ', halfWidth) + subject + _lodash2.default.repeat(' ', halfWidth + 1);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Pads a string to the left and/or right to position the subject
|
||||
* text in a desired alignment within a container.
|
||||
*
|
||||
* @param {string} subject
|
||||
* @param {number} containerWidth
|
||||
* @param {string} alignment One of the valid options (left, right, center).
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
exports.default = (subject, containerWidth, alignment) => {
|
||||
if (!_lodash2.default.isString(subject)) {
|
||||
throw new Error('Subject parameter value must be a string.');
|
||||
}
|
||||
|
||||
if (!_lodash2.default.isNumber(containerWidth)) {
|
||||
throw new Error('Container width parameter value must be a number.');
|
||||
}
|
||||
|
||||
const subjectWidth = (0, _stringWidth2.default)(subject);
|
||||
|
||||
if (subjectWidth > containerWidth) {
|
||||
// console.log('subjectWidth', subjectWidth, 'containerWidth', containerWidth, 'subject', subject);
|
||||
|
||||
throw new Error('Subject parameter value width cannot be greater than the container width.');
|
||||
}
|
||||
|
||||
if (!_lodash2.default.isString(alignment)) {
|
||||
throw new Error('Alignment parameter value must be a string.');
|
||||
}
|
||||
|
||||
if (alignments.indexOf(alignment) === -1) {
|
||||
throw new Error('Alignment parameter value must be a known alignment parameter value (left, right, center).');
|
||||
}
|
||||
|
||||
if (subjectWidth === 0) {
|
||||
return _lodash2.default.repeat(' ', containerWidth);
|
||||
}
|
||||
|
||||
const availableWidth = containerWidth - subjectWidth;
|
||||
|
||||
if (alignment === 'left') {
|
||||
return alignLeft(subject, availableWidth);
|
||||
}
|
||||
|
||||
if (alignment === 'right') {
|
||||
return alignRight(subject, availableWidth);
|
||||
}
|
||||
|
||||
return alignCenter(subject, availableWidth);
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
40
static/js/ketcher2/node_modules/table/dist/alignTableData.js
generated
vendored
Normal file
40
static/js/ketcher2/node_modules/table/dist/alignTableData.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
var _stringWidth = require('string-width');
|
||||
|
||||
var _stringWidth2 = _interopRequireDefault(_stringWidth);
|
||||
|
||||
var _alignString = require('./alignString');
|
||||
|
||||
var _alignString2 = _interopRequireDefault(_alignString);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @param {table~row[]} rows
|
||||
* @param {Object} config
|
||||
* @returns {table~row[]}
|
||||
*/
|
||||
exports.default = (rows, config) => {
|
||||
return _lodash2.default.map(rows, cells => {
|
||||
return _lodash2.default.map(cells, (value, index1) => {
|
||||
const column = config.columns[index1];
|
||||
|
||||
if ((0, _stringWidth2.default)(value) === column.width) {
|
||||
return value;
|
||||
} else {
|
||||
return (0, _alignString2.default)(value, column.width, column.alignment);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
49
static/js/ketcher2/node_modules/table/dist/calculateCellHeight.js
generated
vendored
Normal file
49
static/js/ketcher2/node_modules/table/dist/calculateCellHeight.js
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
var _stringWidth = require('string-width');
|
||||
|
||||
var _stringWidth2 = _interopRequireDefault(_stringWidth);
|
||||
|
||||
var _wrapWord = require('./wrapWord');
|
||||
|
||||
var _wrapWord2 = _interopRequireDefault(_wrapWord);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {number} columnWidth
|
||||
* @param {boolean} useWrapWord
|
||||
* @returns {number}
|
||||
*/
|
||||
exports.default = function (value, columnWidth) {
|
||||
let useWrapWord = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
|
||||
if (!_lodash2.default.isString(value)) {
|
||||
throw new Error('Value must be a string.');
|
||||
}
|
||||
|
||||
if (!_lodash2.default.isInteger(columnWidth)) {
|
||||
throw new Error('Column width must be an integer.');
|
||||
}
|
||||
|
||||
if (columnWidth < 1) {
|
||||
throw new Error('Column width must be greater than 0.');
|
||||
}
|
||||
|
||||
if (useWrapWord) {
|
||||
return (0, _wrapWord2.default)(value, columnWidth).length;
|
||||
}
|
||||
|
||||
return _lodash2.default.ceil((0, _stringWidth2.default)(value) / columnWidth);
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
29
static/js/ketcher2/node_modules/table/dist/calculateCellWidthIndex.js
generated
vendored
Normal file
29
static/js/ketcher2/node_modules/table/dist/calculateCellWidthIndex.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
var _stringWidth = require('string-width');
|
||||
|
||||
var _stringWidth2 = _interopRequireDefault(_stringWidth);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Calculates width of each cell contents.
|
||||
*
|
||||
* @param {string[]} cells
|
||||
* @returns {number[]}
|
||||
*/
|
||||
exports.default = cells => {
|
||||
return _lodash2.default.map(cells, value => {
|
||||
return (0, _stringWidth2.default)(value);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
43
static/js/ketcher2/node_modules/table/dist/calculateMaximumColumnWidthIndex.js
generated
vendored
Normal file
43
static/js/ketcher2/node_modules/table/dist/calculateMaximumColumnWidthIndex.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
var _calculateCellWidthIndex = require('./calculateCellWidthIndex');
|
||||
|
||||
var _calculateCellWidthIndex2 = _interopRequireDefault(_calculateCellWidthIndex);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Produces an array of values that describe the largest value length (width) in every column.
|
||||
*
|
||||
* @param {Array[]} rows
|
||||
* @returns {number[]}
|
||||
*/
|
||||
exports.default = rows => {
|
||||
if (!rows[0]) {
|
||||
throw new Error('Dataset must have at least one row.');
|
||||
}
|
||||
|
||||
const columns = _lodash2.default.fill(Array(rows[0].length), 0);
|
||||
|
||||
_lodash2.default.forEach(rows, row => {
|
||||
const columnWidthIndex = (0, _calculateCellWidthIndex2.default)(row);
|
||||
|
||||
_lodash2.default.forEach(columnWidthIndex, (valueWidth, index0) => {
|
||||
if (columns[index0] < valueWidth) {
|
||||
columns[index0] = valueWidth;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return columns;
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
50
static/js/ketcher2/node_modules/table/dist/calculateRowHeightIndex.js
generated
vendored
Normal file
50
static/js/ketcher2/node_modules/table/dist/calculateRowHeightIndex.js
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
var _calculateCellHeight = require('./calculateCellHeight');
|
||||
|
||||
var _calculateCellHeight2 = _interopRequireDefault(_calculateCellHeight);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Calculates the vertical row span index.
|
||||
*
|
||||
* @param {Array[]} rows
|
||||
* @param {Object} config
|
||||
* @returns {number[]}
|
||||
*/
|
||||
exports.default = (rows, config) => {
|
||||
const tableWidth = rows[0].length;
|
||||
|
||||
const rowSpanIndex = [];
|
||||
|
||||
_lodash2.default.forEach(rows, cells => {
|
||||
const cellHeightIndex = _lodash2.default.fill(Array(tableWidth), 1);
|
||||
|
||||
_lodash2.default.forEach(cells, (value, index1) => {
|
||||
if (!_lodash2.default.isNumber(config.columns[index1].width)) {
|
||||
throw new Error('column[index].width must be a number.');
|
||||
}
|
||||
|
||||
if (!_lodash2.default.isBoolean(config.columns[index1].wrapWord)) {
|
||||
throw new Error('column[index].wrapWord must be a boolean.');
|
||||
}
|
||||
|
||||
cellHeightIndex[index1] = (0, _calculateCellHeight2.default)(value, config.columns[index1].width, config.columns[index1].wrapWord);
|
||||
});
|
||||
|
||||
rowSpanIndex.push(_lodash2.default.max(cellHeightIndex));
|
||||
});
|
||||
|
||||
return rowSpanIndex;
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
159
static/js/ketcher2/node_modules/table/dist/createStream.js
generated
vendored
Normal file
159
static/js/ketcher2/node_modules/table/dist/createStream.js
generated
vendored
Normal file
@ -0,0 +1,159 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
var _makeStreamConfig = require('./makeStreamConfig');
|
||||
|
||||
var _makeStreamConfig2 = _interopRequireDefault(_makeStreamConfig);
|
||||
|
||||
var _drawRow = require('./drawRow');
|
||||
|
||||
var _drawRow2 = _interopRequireDefault(_drawRow);
|
||||
|
||||
var _drawBorder = require('./drawBorder');
|
||||
|
||||
var _stringifyTableData = require('./stringifyTableData');
|
||||
|
||||
var _stringifyTableData2 = _interopRequireDefault(_stringifyTableData);
|
||||
|
||||
var _truncateTableData = require('./truncateTableData');
|
||||
|
||||
var _truncateTableData2 = _interopRequireDefault(_truncateTableData);
|
||||
|
||||
var _mapDataUsingRowHeightIndex = require('./mapDataUsingRowHeightIndex');
|
||||
|
||||
var _mapDataUsingRowHeightIndex2 = _interopRequireDefault(_mapDataUsingRowHeightIndex);
|
||||
|
||||
var _alignTableData = require('./alignTableData');
|
||||
|
||||
var _alignTableData2 = _interopRequireDefault(_alignTableData);
|
||||
|
||||
var _padTableData = require('./padTableData');
|
||||
|
||||
var _padTableData2 = _interopRequireDefault(_padTableData);
|
||||
|
||||
var _calculateRowHeightIndex = require('./calculateRowHeightIndex');
|
||||
|
||||
var _calculateRowHeightIndex2 = _interopRequireDefault(_calculateRowHeightIndex);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @param {Array} data
|
||||
* @param {Object} config
|
||||
* @returns {Array}
|
||||
*/
|
||||
const prepareData = (data, config) => {
|
||||
let rows;
|
||||
|
||||
rows = (0, _stringifyTableData2.default)(data);
|
||||
|
||||
rows = (0, _truncateTableData2.default)(data, config);
|
||||
|
||||
const rowHeightIndex = (0, _calculateRowHeightIndex2.default)(rows, config);
|
||||
|
||||
rows = (0, _mapDataUsingRowHeightIndex2.default)(rows, rowHeightIndex, config);
|
||||
rows = (0, _alignTableData2.default)(rows, config);
|
||||
rows = (0, _padTableData2.default)(rows, config);
|
||||
|
||||
return rows;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string[]} row
|
||||
* @param {number[]} columnWidthIndex
|
||||
* @param {Object} config
|
||||
* @returns {undefined}
|
||||
*/
|
||||
const create = (row, columnWidthIndex, config) => {
|
||||
const rows = prepareData([row], config);
|
||||
|
||||
const body = _lodash2.default.map(rows, literalRow => {
|
||||
return (0, _drawRow2.default)(literalRow, config.border);
|
||||
}).join('');
|
||||
|
||||
let output;
|
||||
|
||||
output = '';
|
||||
|
||||
output += (0, _drawBorder.drawBorderTop)(columnWidthIndex, config.border);
|
||||
output += body;
|
||||
output += (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config.border);
|
||||
|
||||
output = _lodash2.default.trimEnd(output);
|
||||
|
||||
process.stdout.write(output);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string[]} row
|
||||
* @param {number[]} columnWidthIndex
|
||||
* @param {Object} config
|
||||
* @returns {undefined}
|
||||
*/
|
||||
const append = (row, columnWidthIndex, config) => {
|
||||
const rows = prepareData([row], config);
|
||||
|
||||
const body = _lodash2.default.map(rows, literalRow => {
|
||||
return (0, _drawRow2.default)(literalRow, config.border);
|
||||
}).join('');
|
||||
|
||||
let output;
|
||||
|
||||
output = '\r\x1b[K';
|
||||
|
||||
output += (0, _drawBorder.drawBorderJoin)(columnWidthIndex, config.border);
|
||||
output += body;
|
||||
output += (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config.border);
|
||||
|
||||
output = _lodash2.default.trimEnd(output);
|
||||
|
||||
process.stdout.write(output);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Object} userConfig
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
||||
exports.default = function () {
|
||||
let userConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
const config = (0, _makeStreamConfig2.default)(userConfig);
|
||||
|
||||
const columnWidthIndex = _lodash2.default.mapValues(config.columns, column => {
|
||||
return column.width + column.paddingLeft + column.paddingRight;
|
||||
});
|
||||
|
||||
let empty;
|
||||
|
||||
empty = true;
|
||||
|
||||
return {
|
||||
/**
|
||||
* @param {string[]} row
|
||||
* @returns {undefined}
|
||||
*/
|
||||
write: row => {
|
||||
if (row.length !== config.columnCount) {
|
||||
throw new Error('Row cell count does not match the config.columnCount.');
|
||||
}
|
||||
|
||||
if (empty) {
|
||||
empty = false;
|
||||
|
||||
return create(row, columnWidthIndex, config);
|
||||
} else {
|
||||
return append(row, columnWidthIndex, config);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
104
static/js/ketcher2/node_modules/table/dist/drawBorder.js
generated
vendored
Normal file
104
static/js/ketcher2/node_modules/table/dist/drawBorder.js
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.drawBorderTop = exports.drawBorderJoin = exports.drawBorderBottom = exports.drawBorder = undefined;
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @typedef drawBorder~parts
|
||||
* @property {string} left
|
||||
* @property {string} right
|
||||
* @property {string} body
|
||||
* @property {string} join
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columnSizeIndex
|
||||
* @param {drawBorder~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
const drawBorder = (columnSizeIndex, parts) => {
|
||||
const columns = _lodash2.default.map(columnSizeIndex, size => {
|
||||
return _lodash2.default.repeat(parts.body, size);
|
||||
}).join(parts.join);
|
||||
|
||||
return parts.left + columns + parts.right + '\n';
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef drawBorderTop~parts
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columnSizeIndex
|
||||
* @param {drawBorderTop~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
const drawBorderTop = (columnSizeIndex, parts) => {
|
||||
return drawBorder(columnSizeIndex, {
|
||||
body: parts.topBody,
|
||||
join: parts.topJoin,
|
||||
left: parts.topLeft,
|
||||
right: parts.topRight
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef drawBorderJoin~parts
|
||||
* @property {string} joinLeft
|
||||
* @property {string} joinRight
|
||||
* @property {string} joinBody
|
||||
* @property {string} joinJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columnSizeIndex
|
||||
* @param {drawBorderJoin~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
const drawBorderJoin = (columnSizeIndex, parts) => {
|
||||
return drawBorder(columnSizeIndex, {
|
||||
body: parts.joinBody,
|
||||
join: parts.joinJoin,
|
||||
left: parts.joinLeft,
|
||||
right: parts.joinRight
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef drawBorderBottom~parts
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columnSizeIndex
|
||||
* @param {drawBorderBottom~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
const drawBorderBottom = (columnSizeIndex, parts) => {
|
||||
return drawBorder(columnSizeIndex, {
|
||||
body: parts.bottomBody,
|
||||
join: parts.bottomJoin,
|
||||
left: parts.bottomLeft,
|
||||
right: parts.bottomRight
|
||||
});
|
||||
};
|
||||
|
||||
exports.drawBorder = drawBorder;
|
||||
exports.drawBorderBottom = drawBorderBottom;
|
||||
exports.drawBorderJoin = drawBorderJoin;
|
||||
exports.drawBorderTop = drawBorderTop;
|
||||
23
static/js/ketcher2/node_modules/table/dist/drawRow.js
generated
vendored
Normal file
23
static/js/ketcher2/node_modules/table/dist/drawRow.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
/**
|
||||
* @typedef {Object} drawRow~border
|
||||
* @property {string} bodyLeft
|
||||
* @property {string} bodyRight
|
||||
* @property {string} bodyJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columns
|
||||
* @param {drawRow~border} border
|
||||
* @returns {string}
|
||||
*/
|
||||
exports.default = (columns, border) => {
|
||||
return border.bodyLeft + columns.join(border.bodyJoin) + border.bodyRight + '\n';
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
63
static/js/ketcher2/node_modules/table/dist/drawTable.js
generated
vendored
Normal file
63
static/js/ketcher2/node_modules/table/dist/drawTable.js
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
var _drawBorder = require('./drawBorder');
|
||||
|
||||
var _drawRow = require('./drawRow');
|
||||
|
||||
var _drawRow2 = _interopRequireDefault(_drawRow);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @param {Array} rows
|
||||
* @param {Object} border
|
||||
* @param {Array} columnSizeIndex
|
||||
* @param {Array} rowSpanIndex
|
||||
* @param {Function} drawHorizontalLine
|
||||
* @returns {string}
|
||||
*/
|
||||
exports.default = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine) => {
|
||||
let output, realRowIndex, rowHeight;
|
||||
|
||||
const rowCount = rows.length;
|
||||
|
||||
realRowIndex = 0;
|
||||
|
||||
output = '';
|
||||
|
||||
if (drawHorizontalLine(realRowIndex, rowCount)) {
|
||||
output += (0, _drawBorder.drawBorderTop)(columnSizeIndex, border);
|
||||
}
|
||||
|
||||
_lodash2.default.forEach(rows, (row, index0) => {
|
||||
output += (0, _drawRow2.default)(row, border);
|
||||
|
||||
if (!rowHeight) {
|
||||
rowHeight = rowSpanIndex[realRowIndex];
|
||||
|
||||
realRowIndex++;
|
||||
}
|
||||
|
||||
rowHeight--;
|
||||
|
||||
if (rowHeight === 0 && index0 !== rowCount - 1 && drawHorizontalLine(realRowIndex, rowCount)) {
|
||||
output += (0, _drawBorder.drawBorderJoin)(columnSizeIndex, border);
|
||||
}
|
||||
});
|
||||
|
||||
if (drawHorizontalLine(realRowIndex, rowCount)) {
|
||||
output += (0, _drawBorder.drawBorderBottom)(columnSizeIndex, border);
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
128
static/js/ketcher2/node_modules/table/dist/getBorderCharacters.js
generated
vendored
Normal file
128
static/js/ketcher2/node_modules/table/dist/getBorderCharacters.js
generated
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
/**
|
||||
* @typedef border
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} bottomBody
|
||||
* @property {string} bottomJoin
|
||||
* @property {string} bottomLeft
|
||||
* @property {string} bottomRight
|
||||
* @property {string} bodyLeft
|
||||
* @property {string} bodyRight
|
||||
* @property {string} bodyJoin
|
||||
* @property {string} joinBody
|
||||
* @property {string} joinLeft
|
||||
* @property {string} joinRight
|
||||
* @property {string} joinJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @returns {border}
|
||||
*/
|
||||
exports.default = name => {
|
||||
if (name === 'honeywell') {
|
||||
return {
|
||||
topBody: '═',
|
||||
topJoin: '╤',
|
||||
topLeft: '╔',
|
||||
topRight: '╗',
|
||||
|
||||
bottomBody: '═',
|
||||
bottomJoin: '╧',
|
||||
bottomLeft: '╚',
|
||||
bottomRight: '╝',
|
||||
|
||||
bodyLeft: '║',
|
||||
bodyRight: '║',
|
||||
bodyJoin: '│',
|
||||
|
||||
joinBody: '─',
|
||||
joinLeft: '╟',
|
||||
joinRight: '╢',
|
||||
joinJoin: '┼'
|
||||
};
|
||||
}
|
||||
|
||||
if (name === 'norc') {
|
||||
return {
|
||||
topBody: '─',
|
||||
topJoin: '┬',
|
||||
topLeft: '┌',
|
||||
topRight: '┐',
|
||||
|
||||
bottomBody: '─',
|
||||
bottomJoin: '┴',
|
||||
bottomLeft: '└',
|
||||
bottomRight: '┘',
|
||||
|
||||
bodyLeft: '│',
|
||||
bodyRight: '│',
|
||||
bodyJoin: '│',
|
||||
|
||||
joinBody: '─',
|
||||
joinLeft: '├',
|
||||
joinRight: '┤',
|
||||
joinJoin: '┼'
|
||||
};
|
||||
}
|
||||
|
||||
if (name === 'ramac') {
|
||||
return {
|
||||
topBody: '-',
|
||||
topJoin: '+',
|
||||
topLeft: '+',
|
||||
topRight: '+',
|
||||
|
||||
bottomBody: '-',
|
||||
bottomJoin: '+',
|
||||
bottomLeft: '+',
|
||||
bottomRight: '+',
|
||||
|
||||
bodyLeft: '|',
|
||||
bodyRight: '|',
|
||||
bodyJoin: '|',
|
||||
|
||||
joinBody: '-',
|
||||
joinLeft: '|',
|
||||
joinRight: '|',
|
||||
joinJoin: '|'
|
||||
};
|
||||
}
|
||||
|
||||
if (name === 'void') {
|
||||
return {
|
||||
topBody: '',
|
||||
topJoin: '',
|
||||
topLeft: '',
|
||||
topRight: '',
|
||||
|
||||
bottomBody: '',
|
||||
bottomJoin: '',
|
||||
bottomLeft: '',
|
||||
bottomRight: '',
|
||||
|
||||
bodyLeft: '',
|
||||
bodyRight: '',
|
||||
bodyJoin: '',
|
||||
|
||||
joinBody: '',
|
||||
joinLeft: '',
|
||||
joinRight: '',
|
||||
joinJoin: ''
|
||||
};
|
||||
}
|
||||
|
||||
throw new Error('Unknown border template "' + name + '".');
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
24
static/js/ketcher2/node_modules/table/dist/index.js
generated
vendored
Normal file
24
static/js/ketcher2/node_modules/table/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getBorderCharacters = exports.createStream = undefined;
|
||||
|
||||
var _table = require('./table');
|
||||
|
||||
var _table2 = _interopRequireDefault(_table);
|
||||
|
||||
var _createStream = require('./createStream');
|
||||
|
||||
var _createStream2 = _interopRequireDefault(_createStream);
|
||||
|
||||
var _getBorderCharacters = require('./getBorderCharacters');
|
||||
|
||||
var _getBorderCharacters2 = _interopRequireDefault(_getBorderCharacters);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.createStream = _createStream2.default;
|
||||
exports.getBorderCharacters = _getBorderCharacters2.default;
|
||||
exports.default = _table2.default;
|
||||
101
static/js/ketcher2/node_modules/table/dist/makeConfig.js
generated
vendored
Normal file
101
static/js/ketcher2/node_modules/table/dist/makeConfig.js
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
var _getBorderCharacters = require('./getBorderCharacters');
|
||||
|
||||
var _getBorderCharacters2 = _interopRequireDefault(_getBorderCharacters);
|
||||
|
||||
var _validateConfig = require('./validateConfig');
|
||||
|
||||
var _validateConfig2 = _interopRequireDefault(_validateConfig);
|
||||
|
||||
var _calculateMaximumColumnWidthIndex = require('./calculateMaximumColumnWidthIndex');
|
||||
|
||||
var _calculateMaximumColumnWidthIndex2 = _interopRequireDefault(_calculateMaximumColumnWidthIndex);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Merges user provided border characters with the default border ("honeywell") characters.
|
||||
*
|
||||
* @param {Object} border
|
||||
* @returns {Object}
|
||||
*/
|
||||
const makeBorder = function makeBorder() {
|
||||
let border = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
return _lodash2.default.assign({}, (0, _getBorderCharacters2.default)('honeywell'), border);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a configuration for every column using default
|
||||
* values for the missing configuration properties.
|
||||
*
|
||||
* @param {Array[]} rows
|
||||
* @param {Object} columns
|
||||
* @param {Object} columnDefault
|
||||
* @returns {Object}
|
||||
*/
|
||||
const makeColumns = function makeColumns(rows) {
|
||||
let columns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
let columnDefault = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
|
||||
const maximumColumnWidthIndex = (0, _calculateMaximumColumnWidthIndex2.default)(rows);
|
||||
|
||||
_lodash2.default.times(rows[0].length, index => {
|
||||
if (_lodash2.default.isUndefined(columns[index])) {
|
||||
columns[index] = {};
|
||||
}
|
||||
|
||||
columns[index] = _lodash2.default.assign({
|
||||
alignment: 'left',
|
||||
paddingLeft: 1,
|
||||
paddingRight: 1,
|
||||
truncate: Infinity,
|
||||
width: maximumColumnWidthIndex[index],
|
||||
wrapWord: false
|
||||
}, columnDefault, columns[index]);
|
||||
});
|
||||
|
||||
return columns;
|
||||
};
|
||||
|
||||
/**
|
||||
* Makes a new configuration object out of the userConfig object
|
||||
* using default values for the missing configuration properties.
|
||||
*
|
||||
* @param {Array[]} rows
|
||||
* @param {Object} userConfig
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
||||
exports.default = function (rows) {
|
||||
let userConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
(0, _validateConfig2.default)('config.json', userConfig);
|
||||
|
||||
const config = _lodash2.default.cloneDeep(userConfig);
|
||||
|
||||
config.border = makeBorder(config.border);
|
||||
config.columns = makeColumns(rows, config.columns, config.columnDefault);
|
||||
|
||||
if (!config.drawHorizontalLine) {
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
config.drawHorizontalLine = () => {
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
return config;
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
109
static/js/ketcher2/node_modules/table/dist/makeStreamConfig.js
generated
vendored
Normal file
109
static/js/ketcher2/node_modules/table/dist/makeStreamConfig.js
generated
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
var _getBorderCharacters = require('./getBorderCharacters');
|
||||
|
||||
var _getBorderCharacters2 = _interopRequireDefault(_getBorderCharacters);
|
||||
|
||||
var _validateConfig = require('./validateConfig');
|
||||
|
||||
var _validateConfig2 = _interopRequireDefault(_validateConfig);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Merges user provided border characters with the default border ("honeywell") characters.
|
||||
*
|
||||
* @param {Object} border
|
||||
* @returns {Object}
|
||||
*/
|
||||
const makeBorder = function makeBorder() {
|
||||
let border = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
return _lodash2.default.assign({}, (0, _getBorderCharacters2.default)('honeywell'), border);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a configuration for every column using default
|
||||
* values for the missing configuration properties.
|
||||
*
|
||||
* @param {number} columnCount
|
||||
* @param {Object} columns
|
||||
* @param {Object} columnDefault
|
||||
* @returns {Object}
|
||||
*/
|
||||
const makeColumns = function makeColumns(columnCount) {
|
||||
let columns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
let columnDefault = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
|
||||
_lodash2.default.times(columnCount, index => {
|
||||
if (_lodash2.default.isUndefined(columns[index])) {
|
||||
columns[index] = {};
|
||||
}
|
||||
|
||||
columns[index] = _lodash2.default.assign({
|
||||
alignment: 'left',
|
||||
paddingLeft: 1,
|
||||
paddingRight: 1,
|
||||
truncate: Infinity,
|
||||
wrapWord: false
|
||||
}, columnDefault, columns[index]);
|
||||
});
|
||||
|
||||
return columns;
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {Object} columnConfig
|
||||
* @property {string} alignment
|
||||
* @property {number} width
|
||||
* @property {number} truncate
|
||||
* @property {number} paddingLeft
|
||||
* @property {number} paddingRight
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} streamConfig
|
||||
* @property {columnConfig} columnDefault
|
||||
* @property {Object} border
|
||||
* @property {columnConfig[]}
|
||||
* @property {number} columnCount Number of columns in the table (required).
|
||||
*/
|
||||
|
||||
/**
|
||||
* Makes a new configuration object out of the userConfig object
|
||||
* using default values for the missing configuration properties.
|
||||
*
|
||||
* @param {streamConfig} userConfig
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
||||
exports.default = function () {
|
||||
let userConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
(0, _validateConfig2.default)('streamConfig.json', userConfig);
|
||||
|
||||
const config = _lodash2.default.cloneDeep(userConfig);
|
||||
|
||||
if (!config.columnDefault || !config.columnDefault.width) {
|
||||
throw new Error('Must provide config.columnDefault.width when creating a stream.');
|
||||
}
|
||||
|
||||
if (!config.columnCount) {
|
||||
throw new Error('Must provide config.columnCount.');
|
||||
}
|
||||
|
||||
config.border = makeBorder(config.border);
|
||||
config.columns = makeColumns(config.columnCount, config.columns, config.columnDefault);
|
||||
|
||||
return config;
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
59
static/js/ketcher2/node_modules/table/dist/mapDataUsingRowHeightIndex.js
generated
vendored
Normal file
59
static/js/ketcher2/node_modules/table/dist/mapDataUsingRowHeightIndex.js
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
var _wrapString = require('./wrapString');
|
||||
|
||||
var _wrapString2 = _interopRequireDefault(_wrapString);
|
||||
|
||||
var _wrapWord = require('./wrapWord');
|
||||
|
||||
var _wrapWord2 = _interopRequireDefault(_wrapWord);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @param {Array} unmappedRows
|
||||
* @param {number[]} rowHeightIndex
|
||||
* @param {Object} config
|
||||
* @returns {Array}
|
||||
*/
|
||||
exports.default = (unmappedRows, rowHeightIndex, config) => {
|
||||
const tableWidth = unmappedRows[0].length;
|
||||
|
||||
const mappedRows = _lodash2.default.map(unmappedRows, (cells, index0) => {
|
||||
const rowHeight = _lodash2.default.times(rowHeightIndex[index0], () => {
|
||||
return _lodash2.default.fill(Array(tableWidth), '');
|
||||
});
|
||||
|
||||
// rowHeight
|
||||
// [{row index within rowSaw; index2}]
|
||||
// [{cell index within a virtual row; index1}]
|
||||
|
||||
_lodash2.default.forEach(cells, (value, index1) => {
|
||||
let chunkedValue;
|
||||
|
||||
if (config.columns[index1].wrapWord) {
|
||||
chunkedValue = (0, _wrapWord2.default)(value, config.columns[index1].width);
|
||||
} else {
|
||||
chunkedValue = (0, _wrapString2.default)(value, config.columns[index1].width);
|
||||
}
|
||||
|
||||
_lodash2.default.forEach(chunkedValue, (part, index2) => {
|
||||
rowHeight[index2][index1] = part;
|
||||
});
|
||||
});
|
||||
|
||||
return rowHeight;
|
||||
});
|
||||
|
||||
return _lodash2.default.flatten(mappedRows);
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
28
static/js/ketcher2/node_modules/table/dist/padTableData.js
generated
vendored
Normal file
28
static/js/ketcher2/node_modules/table/dist/padTableData.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @param {table~row[]} rows
|
||||
* @param {Object} config
|
||||
* @returns {table~row[]}
|
||||
*/
|
||||
exports.default = (rows, config) => {
|
||||
return _lodash2.default.map(rows, cells => {
|
||||
return _lodash2.default.map(cells, (value, index1) => {
|
||||
const column = config.columns[index1];
|
||||
|
||||
return _lodash2.default.repeat(' ', column.paddingLeft) + value + _lodash2.default.repeat(' ', column.paddingRight);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
114
static/js/ketcher2/node_modules/table/dist/schemas/config.json
generated
vendored
Normal file
114
static/js/ketcher2/node_modules/table/dist/schemas/config.json
generated
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
{
|
||||
"id": "config.json",
|
||||
"$schema": "http://json-schema.org/draft-04/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"
|
||||
}
|
||||
}
|
||||
}
|
||||
114
static/js/ketcher2/node_modules/table/dist/schemas/streamConfig.json
generated
vendored
Normal file
114
static/js/ketcher2/node_modules/table/dist/schemas/streamConfig.json
generated
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
{
|
||||
"id": "streamConfig.json",
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"border": {
|
||||
"$ref": "#/definitions/borders"
|
||||
},
|
||||
"columns": {
|
||||
"$ref": "#/definitions/columns"
|
||||
},
|
||||
"columnDefault": {
|
||||
"$ref": "#/definitions/column"
|
||||
},
|
||||
"columnCount": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
25
static/js/ketcher2/node_modules/table/dist/stringifyTableData.js
generated
vendored
Normal file
25
static/js/ketcher2/node_modules/table/dist/stringifyTableData.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Casts all cell values to a string.
|
||||
*
|
||||
* @param {table~row[]} rows
|
||||
* @returns {table~row[]}
|
||||
*/
|
||||
exports.default = rows => {
|
||||
return _lodash2.default.map(rows, cells => {
|
||||
return _lodash2.default.map(cells, String);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
135
static/js/ketcher2/node_modules/table/dist/table.js
generated
vendored
Normal file
135
static/js/ketcher2/node_modules/table/dist/table.js
generated
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _drawTable = require('./drawTable');
|
||||
|
||||
var _drawTable2 = _interopRequireDefault(_drawTable);
|
||||
|
||||
var _calculateCellWidthIndex = require('./calculateCellWidthIndex');
|
||||
|
||||
var _calculateCellWidthIndex2 = _interopRequireDefault(_calculateCellWidthIndex);
|
||||
|
||||
var _makeConfig = require('./makeConfig');
|
||||
|
||||
var _makeConfig2 = _interopRequireDefault(_makeConfig);
|
||||
|
||||
var _calculateRowHeightIndex = require('./calculateRowHeightIndex');
|
||||
|
||||
var _calculateRowHeightIndex2 = _interopRequireDefault(_calculateRowHeightIndex);
|
||||
|
||||
var _mapDataUsingRowHeightIndex = require('./mapDataUsingRowHeightIndex');
|
||||
|
||||
var _mapDataUsingRowHeightIndex2 = _interopRequireDefault(_mapDataUsingRowHeightIndex);
|
||||
|
||||
var _alignTableData = require('./alignTableData');
|
||||
|
||||
var _alignTableData2 = _interopRequireDefault(_alignTableData);
|
||||
|
||||
var _padTableData = require('./padTableData');
|
||||
|
||||
var _padTableData2 = _interopRequireDefault(_padTableData);
|
||||
|
||||
var _validateTableData = require('./validateTableData');
|
||||
|
||||
var _validateTableData2 = _interopRequireDefault(_validateTableData);
|
||||
|
||||
var _stringifyTableData = require('./stringifyTableData');
|
||||
|
||||
var _stringifyTableData2 = _interopRequireDefault(_stringifyTableData);
|
||||
|
||||
var _truncateTableData = require('./truncateTableData');
|
||||
|
||||
var _truncateTableData2 = _interopRequireDefault(_truncateTableData);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @typedef {string} table~cell
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {table~cell[]} table~row
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} table~columns
|
||||
* @property {string} alignment Cell content alignment (enum: left, center, right) (default: left).
|
||||
* @property {number} width Column width (default: auto).
|
||||
* @property {number} truncate Number of characters are which the content will be truncated (default: Infinity).
|
||||
* @property {number} paddingLeft Cell content padding width left (default: 1).
|
||||
* @property {number} paddingRight Cell content padding width right (default: 1).
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} table~border
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} bottomBody
|
||||
* @property {string} bottomJoin
|
||||
* @property {string} bottomLeft
|
||||
* @property {string} bottomRight
|
||||
* @property {string} bodyLeft
|
||||
* @property {string} bodyRight
|
||||
* @property {string} bodyJoin
|
||||
* @property {string} joinBody
|
||||
* @property {string} joinLeft
|
||||
* @property {string} joinRight
|
||||
* @property {string} joinJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Used to tell whether to draw a horizontal line.
|
||||
* This callback is called for each non-content line of the table.
|
||||
* The default behavior is to always return true.
|
||||
*
|
||||
* @typedef {Function} drawHorizontalLine
|
||||
* @param {number} index
|
||||
* @param {number} size
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} table~config
|
||||
* @property {table~border} border
|
||||
* @property {table~columns[]} columns Column specific configuration.
|
||||
* @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values.
|
||||
* @property {table~drawHorizontalLine} drawHorizontalLine
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generates a text table.
|
||||
*
|
||||
* @param {table~row[]} data
|
||||
* @param {table~config} userConfig
|
||||
* @returns {string}
|
||||
*/
|
||||
exports.default = function (data) {
|
||||
let userConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
let rows;
|
||||
|
||||
(0, _validateTableData2.default)(data);
|
||||
|
||||
rows = (0, _stringifyTableData2.default)(data);
|
||||
|
||||
const config = (0, _makeConfig2.default)(rows, userConfig);
|
||||
|
||||
rows = (0, _truncateTableData2.default)(data, config);
|
||||
|
||||
const rowHeightIndex = (0, _calculateRowHeightIndex2.default)(rows, config);
|
||||
|
||||
rows = (0, _mapDataUsingRowHeightIndex2.default)(rows, rowHeightIndex, config);
|
||||
rows = (0, _alignTableData2.default)(rows, config);
|
||||
rows = (0, _padTableData2.default)(rows, config);
|
||||
|
||||
const cellWidthIndex = (0, _calculateCellWidthIndex2.default)(rows[0]);
|
||||
|
||||
return (0, _drawTable2.default)(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawHorizontalLine);
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
29
static/js/ketcher2/node_modules/table/dist/truncateTableData.js
generated
vendored
Normal file
29
static/js/ketcher2/node_modules/table/dist/truncateTableData.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @todo Make it work with ASCII content.
|
||||
* @param {table~row[]} rows
|
||||
* @param {Object} config
|
||||
* @returns {table~row[]}
|
||||
*/
|
||||
exports.default = (rows, config) => {
|
||||
return _lodash2.default.map(rows, cells => {
|
||||
return _lodash2.default.map(cells, (content, index) => {
|
||||
return _lodash2.default.truncate(content, {
|
||||
length: config.columns[index].truncate
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
756
static/js/ketcher2/node_modules/table/dist/validateConfig.js
generated
vendored
Normal file
756
static/js/ketcher2/node_modules/table/dist/validateConfig.js
generated
vendored
Normal file
@ -0,0 +1,756 @@
|
||||
'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[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 (rootData === undefined) rootData = data;
|
||||
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 (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[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++;
|
||||
}
|
||||
}
|
||||
var data1 = data.alignment;
|
||||
if (data1 !== undefined) {
|
||||
var errs_1 = 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++;
|
||||
}
|
||||
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 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';
|
||||
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;
|
||||
if (!(typeof data.drawHorizontalLine == "function")) {
|
||||
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-04/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;
|
||||
742
static/js/ketcher2/node_modules/table/dist/validateStreamConfig.js
generated
vendored
Normal file
742
static/js/ketcher2/node_modules/table/dist/validateStreamConfig.js
generated
vendored
Normal file
@ -0,0 +1,742 @@
|
||||
'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[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 (rootData === undefined) rootData = data;
|
||||
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 (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[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++;
|
||||
}
|
||||
}
|
||||
var data1 = data.alignment;
|
||||
if (data1 !== undefined) {
|
||||
var errs_1 = 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++;
|
||||
}
|
||||
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 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';
|
||||
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 == 'columnCount');
|
||||
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.columnCount !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (typeof data.columnCount !== "number") {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + '.columnCount',
|
||||
schemaPath: '#/properties/columnCount/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;
|
||||
};
|
||||
})();
|
||||
validate.schema = {
|
||||
"id": "streamConfig.json",
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"border": {
|
||||
"$ref": "#/definitions/borders"
|
||||
},
|
||||
"columns": {
|
||||
"$ref": "#/definitions/columns"
|
||||
},
|
||||
"columnDefault": {
|
||||
"$ref": "#/definitions/column"
|
||||
},
|
||||
"columnCount": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"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;
|
||||
59
static/js/ketcher2/node_modules/table/dist/validateTableData.js
generated
vendored
Normal file
59
static/js/ketcher2/node_modules/table/dist/validateTableData.js
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @typedef {string} cell
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {cell[]} validateData~column
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {column[]} rows
|
||||
* @returns {undefined}
|
||||
*/
|
||||
exports.default = rows => {
|
||||
if (!_lodash2.default.isArray(rows)) {
|
||||
throw new Error('Table data must be an array.');
|
||||
}
|
||||
|
||||
if (rows.length === 0) {
|
||||
throw new Error('Table must define at least one row.');
|
||||
}
|
||||
|
||||
if (rows[0].length === 0) {
|
||||
throw new Error('Table must define at least one column.');
|
||||
}
|
||||
|
||||
const columnNumber = rows[0].length;
|
||||
|
||||
_lodash2.default.forEach(rows, cells => {
|
||||
if (!_lodash2.default.isArray(cells)) {
|
||||
throw new Error('Table row data must be an array.');
|
||||
}
|
||||
|
||||
if (cells.length !== columnNumber) {
|
||||
throw new Error('Table must have a consistent number of cells.');
|
||||
}
|
||||
|
||||
// @todo Make an exception for newline characters.
|
||||
// @see https://github.com/gajus/table/issues/9
|
||||
_lodash2.default.forEach(cells, cell => {
|
||||
if (/[\x01-\x1A]/.test(cell)) {
|
||||
throw new Error('Table data must not contain control characters.');
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
48
static/js/ketcher2/node_modules/table/dist/wrapString.js
generated
vendored
Normal file
48
static/js/ketcher2/node_modules/table/dist/wrapString.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
var _sliceAnsi = require('slice-ansi');
|
||||
|
||||
var _sliceAnsi2 = _interopRequireDefault(_sliceAnsi);
|
||||
|
||||
var _stringWidth = require('string-width');
|
||||
|
||||
var _stringWidth2 = _interopRequireDefault(_stringWidth);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Creates an array of strings split into groups the length of size.
|
||||
* This function works with strings that contain ASCII characters.
|
||||
*
|
||||
* wrapText is different from would-be "chunk" implementation
|
||||
* in that whitespace characters that occur on a chunk size limit are trimmed.
|
||||
*
|
||||
* @param {string} subject
|
||||
* @param {number} size
|
||||
* @returns {Array}
|
||||
*/
|
||||
exports.default = (subject, size) => {
|
||||
let subjectSlice;
|
||||
|
||||
subjectSlice = subject;
|
||||
|
||||
const chunks = [];
|
||||
|
||||
do {
|
||||
chunks.push((0, _sliceAnsi2.default)(subjectSlice, 0, size));
|
||||
|
||||
subjectSlice = _lodash2.default.trim((0, _sliceAnsi2.default)(subjectSlice, size));
|
||||
} while ((0, _stringWidth2.default)(subjectSlice));
|
||||
|
||||
return chunks;
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
58
static/js/ketcher2/node_modules/table/dist/wrapWord.js
generated
vendored
Normal file
58
static/js/ketcher2/node_modules/table/dist/wrapWord.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
var _sliceAnsi = require('slice-ansi');
|
||||
|
||||
var _sliceAnsi2 = _interopRequireDefault(_sliceAnsi);
|
||||
|
||||
var _stringWidth = require('string-width');
|
||||
|
||||
var _stringWidth2 = _interopRequireDefault(_stringWidth);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @param {string} input
|
||||
* @param {number} size
|
||||
* @returns {Array}
|
||||
*/
|
||||
exports.default = (input, size) => {
|
||||
let subject;
|
||||
|
||||
subject = input;
|
||||
|
||||
const chunks = [];
|
||||
|
||||
// https://regex101.com/r/gY5kZ1/1
|
||||
const re = new RegExp('(^.{1,' + size + '}(\\s+|$))|(^.{1,' + (size - 1) + '}(\\\\|/|_|\\.|,|;|-))');
|
||||
|
||||
do {
|
||||
let chunk;
|
||||
|
||||
chunk = subject.match(re);
|
||||
|
||||
if (chunk) {
|
||||
chunk = chunk[0];
|
||||
|
||||
subject = (0, _sliceAnsi2.default)(subject, (0, _stringWidth2.default)(chunk));
|
||||
|
||||
chunk = _lodash2.default.trim(chunk);
|
||||
} else {
|
||||
chunk = (0, _sliceAnsi2.default)(subject, 0, size);
|
||||
subject = (0, _sliceAnsi2.default)(subject, size);
|
||||
}
|
||||
|
||||
chunks.push(chunk);
|
||||
} while ((0, _stringWidth2.default)(subject));
|
||||
|
||||
return chunks;
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
22
static/js/ketcher2/node_modules/table/node_modules/ajv/LICENSE
generated
vendored
Normal file
22
static/js/ketcher2/node_modules/table/node_modules/ajv/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Evgeny Poberezkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
1213
static/js/ketcher2/node_modules/table/node_modules/ajv/README.md
generated
vendored
Normal file
1213
static/js/ketcher2/node_modules/table/node_modules/ajv/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8023
static/js/ketcher2/node_modules/table/node_modules/ajv/dist/ajv.bundle.js
generated
vendored
Normal file
8023
static/js/ketcher2/node_modules/table/node_modules/ajv/dist/ajv.bundle.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
static/js/ketcher2/node_modules/table/node_modules/ajv/dist/ajv.min.js
generated
vendored
Normal file
6
static/js/ketcher2/node_modules/table/node_modules/ajv/dist/ajv.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
static/js/ketcher2/node_modules/table/node_modules/ajv/dist/ajv.min.js.map
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/table/node_modules/ajv/dist/ajv.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
static/js/ketcher2/node_modules/table/node_modules/ajv/dist/nodent.min.js
generated
vendored
Normal file
8
static/js/ketcher2/node_modules/table/node_modules/ajv/dist/nodent.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
32
static/js/ketcher2/node_modules/table/node_modules/ajv/dist/regenerator.min.js
generated
vendored
Normal file
32
static/js/ketcher2/node_modules/table/node_modules/ajv/dist/regenerator.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
284
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/ajv.d.ts
generated
vendored
Normal file
284
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/ajv.d.ts
generated
vendored
Normal file
@ -0,0 +1,284 @@
|
||||
declare var ajv: {
|
||||
(options?: ajv.Options): ajv.Ajv;
|
||||
new (options?: ajv.Options): ajv.Ajv;
|
||||
}
|
||||
|
||||
declare namespace ajv {
|
||||
interface Ajv {
|
||||
/**
|
||||
* Validate data using schema
|
||||
* Schema will be compiled and cached (using serialized JSON as key. [json-stable-stringify](https://github.com/substack/json-stable-stringify) is used to serialize.
|
||||
* @param {String|Object} schemaKeyRef key, ref or schema object
|
||||
* @param {Any} data to be validated
|
||||
* @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
|
||||
*/
|
||||
validate(schemaKeyRef: Object | string, data: any): boolean;
|
||||
/**
|
||||
* Create validating function for passed schema.
|
||||
* @param {Object} schema schema object
|
||||
* @return {Function} validating function
|
||||
*/
|
||||
compile(schema: Object): ValidateFunction;
|
||||
/**
|
||||
* Creates validating function for passed schema with asynchronous loading of missing schemas.
|
||||
* `loadSchema` option should be a function that accepts schema uri and node-style callback.
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema object
|
||||
* @param {Function} callback node-style callback, it is always called with 2 parameters: error (or null) and validating function.
|
||||
*/
|
||||
compileAsync(schema: Object, callback: (err: Error, validate: ValidateFunction) => any): void;
|
||||
/**
|
||||
* Adds schema to the instance.
|
||||
* @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
|
||||
* @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
|
||||
*/
|
||||
addSchema(schema: Array<Object> | Object, key?: string): void;
|
||||
/**
|
||||
* Add schema that will be used to validate other schemas
|
||||
* options in META_IGNORE_OPTIONS are alway set to false
|
||||
* @param {Object} schema schema object
|
||||
* @param {String} key optional schema key
|
||||
*/
|
||||
addMetaSchema(schema: Object, key?: string): void;
|
||||
/**
|
||||
* Validate schema
|
||||
* @param {Object} schema schema to validate
|
||||
* @return {Boolean} true if schema is valid
|
||||
*/
|
||||
validateSchema(schema: Object): boolean;
|
||||
/**
|
||||
* Get compiled schema from the instance by `key` or `ref`.
|
||||
* @param {String} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id).
|
||||
* @return {Function} schema validating function (with property `schema`).
|
||||
*/
|
||||
getSchema(keyRef: string): ValidateFunction;
|
||||
/**
|
||||
* Remove cached schema(s).
|
||||
* If no parameter is passed all schemas but meta-schemas are removed.
|
||||
* If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
||||
* Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
||||
* @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object
|
||||
*/
|
||||
removeSchema(schemaKeyRef?: Object | string | RegExp): void;
|
||||
/**
|
||||
* Add custom format
|
||||
* @param {String} name format name
|
||||
* @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
|
||||
*/
|
||||
addFormat(name: string, format: FormatValidator | FormatDefinition): void;
|
||||
/**
|
||||
* Define custom keyword
|
||||
* @this Ajv
|
||||
* @param {String} keyword custom keyword, should be a valid identifier, should be different from all standard, custom and macro keywords.
|
||||
* @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`.
|
||||
*/
|
||||
addKeyword(keyword: string, definition: KeywordDefinition): void;
|
||||
/**
|
||||
* Get keyword definition
|
||||
* @this Ajv
|
||||
* @param {String} keyword pre-defined or custom keyword.
|
||||
* @return {Object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise.
|
||||
*/
|
||||
getKeyword(keyword: string): Object | boolean;
|
||||
/**
|
||||
* Remove keyword
|
||||
* @this Ajv
|
||||
* @param {String} keyword pre-defined or custom keyword.
|
||||
*/
|
||||
removeKeyword(keyword: string): void;
|
||||
/**
|
||||
* Convert array of error message objects to string
|
||||
* @param {Array<Object>} errors optional array of validation errors, if not passed errors from the instance are used.
|
||||
* @param {Object} options optional options with properties `separator` and `dataVar`.
|
||||
* @return {String} human readable string with all errors descriptions
|
||||
*/
|
||||
errorsText(errors?: Array<ErrorObject>, options?: ErrorsTextOptions): string;
|
||||
errors?: Array<ErrorObject>;
|
||||
}
|
||||
|
||||
interface Thenable <R> {
|
||||
then <U> (onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
|
||||
}
|
||||
|
||||
interface ValidateFunction {
|
||||
(
|
||||
data: any,
|
||||
dataPath?: string,
|
||||
parentData?: Object | Array<any>,
|
||||
parentDataProperty?: string | number,
|
||||
rootData?: Object | Array<any>
|
||||
): boolean | Thenable<boolean>;
|
||||
errors?: Array<ErrorObject>;
|
||||
schema?: Object;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
v5?: boolean;
|
||||
allErrors?: boolean;
|
||||
verbose?: boolean;
|
||||
jsonPointers?: boolean;
|
||||
uniqueItems?: boolean;
|
||||
unicode?: boolean;
|
||||
format?: string;
|
||||
formats?: Object;
|
||||
unknownFormats?: boolean | string | Array<string>;
|
||||
schemas?: Array<Object> | Object;
|
||||
ownProperties?: boolean;
|
||||
missingRefs?: boolean | string;
|
||||
extendRefs?: boolean | string;
|
||||
loadSchema?: (uri: string, cb: (err: Error, schema: Object) => any) => any;
|
||||
removeAdditional?: boolean | string;
|
||||
useDefaults?: boolean | string;
|
||||
coerceTypes?: boolean | string;
|
||||
async?: boolean | string;
|
||||
transpile?: string | ((code: string) => string);
|
||||
meta?: boolean | Object;
|
||||
validateSchema?: boolean | string;
|
||||
addUsedSchema?: boolean;
|
||||
inlineRefs?: boolean | number;
|
||||
passContext?: boolean;
|
||||
loopRequired?: number;
|
||||
multipleOfPrecision?: number;
|
||||
errorDataPath?: string;
|
||||
messages?: boolean;
|
||||
sourceCode?: boolean;
|
||||
beautify?: boolean | Object;
|
||||
cache?: Object;
|
||||
}
|
||||
|
||||
type FormatValidator = string | RegExp | ((data: string) => boolean);
|
||||
|
||||
interface FormatDefinition {
|
||||
validate: FormatValidator;
|
||||
compare: (data1: string, data2: string) => number;
|
||||
async?: boolean;
|
||||
}
|
||||
|
||||
interface KeywordDefinition {
|
||||
type?: string | Array<string>;
|
||||
async?: boolean;
|
||||
errors?: boolean | string;
|
||||
// schema: false makes validate not to expect schema (ValidateFunction)
|
||||
schema?: boolean;
|
||||
modifying?: boolean;
|
||||
valid?: boolean;
|
||||
// one and only one of the following properties should be present
|
||||
validate?: ValidateFunction | SchemaValidateFunction;
|
||||
compile?: (schema: Object, parentSchema: Object) => ValidateFunction;
|
||||
macro?: (schema: Object, parentSchema: Object) => Object;
|
||||
inline?: (it: Object, keyword: string, schema: Object, parentSchema: Object) => string;
|
||||
}
|
||||
|
||||
interface SchemaValidateFunction {
|
||||
(
|
||||
schema: Object,
|
||||
data: any,
|
||||
parentSchema?: Object,
|
||||
dataPath?: string,
|
||||
parentData?: Object | Array<any>,
|
||||
parentDataProperty?: string | number
|
||||
): boolean | Thenable<boolean>;
|
||||
errors?: Array<ErrorObject>;
|
||||
}
|
||||
|
||||
interface ErrorsTextOptions {
|
||||
separator?: string;
|
||||
dataVar?: string;
|
||||
}
|
||||
|
||||
interface ErrorObject {
|
||||
keyword: string;
|
||||
dataPath: string;
|
||||
schemaPath: string;
|
||||
params: ErrorParameters;
|
||||
// Excluded if messages set to false.
|
||||
message?: string;
|
||||
// These are added with the `verbose` option.
|
||||
schema?: Object;
|
||||
parentSchema?: Object;
|
||||
data?: any;
|
||||
}
|
||||
|
||||
type ErrorParameters = RefParams | LimitParams | AdditionalPropertiesParams |
|
||||
DependenciesParams | FormatParams | ComparisonParams |
|
||||
MultipleOfParams | PatternParams | RequiredParams |
|
||||
TypeParams | UniqueItemsParams | CustomParams |
|
||||
PatternGroupsParams | PatternRequiredParams |
|
||||
SwitchParams | NoParams | EnumParams;
|
||||
|
||||
interface RefParams {
|
||||
ref: string;
|
||||
}
|
||||
|
||||
interface LimitParams {
|
||||
limit: number;
|
||||
}
|
||||
|
||||
interface AdditionalPropertiesParams {
|
||||
additionalProperty: string;
|
||||
}
|
||||
|
||||
interface DependenciesParams {
|
||||
property: string;
|
||||
missingProperty: string;
|
||||
depsCount: number;
|
||||
deps: string;
|
||||
}
|
||||
|
||||
interface FormatParams {
|
||||
format: string
|
||||
}
|
||||
|
||||
interface ComparisonParams {
|
||||
comparison: string;
|
||||
limit: number | string;
|
||||
exclusive: boolean;
|
||||
}
|
||||
|
||||
interface MultipleOfParams {
|
||||
multipleOf: number;
|
||||
}
|
||||
|
||||
interface PatternParams {
|
||||
pattern: string;
|
||||
}
|
||||
|
||||
interface RequiredParams {
|
||||
missingProperty: string;
|
||||
}
|
||||
|
||||
interface TypeParams {
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface UniqueItemsParams {
|
||||
i: number;
|
||||
j: number;
|
||||
}
|
||||
|
||||
interface CustomParams {
|
||||
keyword: string;
|
||||
}
|
||||
|
||||
interface PatternGroupsParams {
|
||||
reason: string;
|
||||
limit: number;
|
||||
pattern: string;
|
||||
}
|
||||
|
||||
interface PatternRequiredParams {
|
||||
missingPattern: string;
|
||||
}
|
||||
|
||||
interface SwitchParams {
|
||||
caseIndex: number;
|
||||
}
|
||||
|
||||
interface NoParams {}
|
||||
|
||||
interface EnumParams {
|
||||
allowedValues: Array<any>;
|
||||
}
|
||||
}
|
||||
|
||||
export = ajv;
|
||||
420
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/ajv.js
generated
vendored
Normal file
420
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/ajv.js
generated
vendored
Normal file
@ -0,0 +1,420 @@
|
||||
'use strict';
|
||||
|
||||
var compileSchema = require('./compile')
|
||||
, resolve = require('./compile/resolve')
|
||||
, Cache = require('./cache')
|
||||
, SchemaObject = require('./compile/schema_obj')
|
||||
, stableStringify = require('json-stable-stringify')
|
||||
, formats = require('./compile/formats')
|
||||
, rules = require('./compile/rules')
|
||||
, v5 = require('./v5')
|
||||
, util = require('./compile/util')
|
||||
, async = require('./async')
|
||||
, co = require('co');
|
||||
|
||||
module.exports = Ajv;
|
||||
|
||||
Ajv.prototype.compileAsync = async.compile;
|
||||
|
||||
var customKeyword = require('./keyword');
|
||||
Ajv.prototype.addKeyword = customKeyword.add;
|
||||
Ajv.prototype.getKeyword = customKeyword.get;
|
||||
Ajv.prototype.removeKeyword = customKeyword.remove;
|
||||
Ajv.ValidationError = require('./compile/validation_error');
|
||||
|
||||
var META_SCHEMA_ID = 'http://json-schema.org/draft-04/schema';
|
||||
var SCHEMA_URI_FORMAT = /^(?:(?:[a-z][a-z0-9+-.]*:)?\/\/)?[^\s]*$/i;
|
||||
function SCHEMA_URI_FORMAT_FUNC(str) {
|
||||
return SCHEMA_URI_FORMAT.test(str);
|
||||
}
|
||||
|
||||
var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes' ];
|
||||
|
||||
/**
|
||||
* Creates validator instance.
|
||||
* Usage: `Ajv(opts)`
|
||||
* @param {Object} opts optional options
|
||||
* @return {Object} ajv instance
|
||||
*/
|
||||
function Ajv(opts) {
|
||||
if (!(this instanceof Ajv)) return new Ajv(opts);
|
||||
var self = this;
|
||||
|
||||
opts = this._opts = util.copy(opts) || {};
|
||||
this._schemas = {};
|
||||
this._refs = {};
|
||||
this._fragments = {};
|
||||
this._formats = formats(opts.format);
|
||||
this._cache = opts.cache || new Cache;
|
||||
this._loadingSchemas = {};
|
||||
this._compilations = [];
|
||||
this.RULES = rules();
|
||||
|
||||
// this is done on purpose, so that methods are bound to the instance
|
||||
// (without using bind) so that they can be used without the instance
|
||||
this.validate = validate;
|
||||
this.compile = compile;
|
||||
this.addSchema = addSchema;
|
||||
this.addMetaSchema = addMetaSchema;
|
||||
this.validateSchema = validateSchema;
|
||||
this.getSchema = getSchema;
|
||||
this.removeSchema = removeSchema;
|
||||
this.addFormat = addFormat;
|
||||
this.errorsText = errorsText;
|
||||
|
||||
this._addSchema = _addSchema;
|
||||
this._compile = _compile;
|
||||
|
||||
opts.loopRequired = opts.loopRequired || Infinity;
|
||||
if (opts.async || opts.transpile) async.setup(opts);
|
||||
if (opts.beautify === true) opts.beautify = { indent_size: 2 };
|
||||
if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true;
|
||||
this._metaOpts = getMetaSchemaOptions();
|
||||
|
||||
if (opts.formats) addInitialFormats();
|
||||
addDraft4MetaSchema();
|
||||
if (opts.v5) v5.enable(this);
|
||||
if (typeof opts.meta == 'object') addMetaSchema(opts.meta);
|
||||
addInitialSchemas();
|
||||
|
||||
|
||||
/**
|
||||
* Validate data using schema
|
||||
* Schema will be compiled and cached (using serialized JSON as key. [json-stable-stringify](https://github.com/substack/json-stable-stringify) is used to serialize.
|
||||
* @param {String|Object} schemaKeyRef key, ref or schema object
|
||||
* @param {Any} data to be validated
|
||||
* @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
|
||||
*/
|
||||
function validate(schemaKeyRef, data) {
|
||||
var v;
|
||||
if (typeof schemaKeyRef == 'string') {
|
||||
v = getSchema(schemaKeyRef);
|
||||
if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"');
|
||||
} else {
|
||||
var schemaObj = _addSchema(schemaKeyRef);
|
||||
v = schemaObj.validate || _compile(schemaObj);
|
||||
}
|
||||
|
||||
var valid = v(data);
|
||||
if (v.$async === true)
|
||||
return self._opts.async == '*' ? co(valid) : valid;
|
||||
self.errors = v.errors;
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create validating function for passed schema.
|
||||
* @param {Object} schema schema object
|
||||
* @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords.
|
||||
* @return {Function} validating function
|
||||
*/
|
||||
function compile(schema, _meta) {
|
||||
var schemaObj = _addSchema(schema, undefined, _meta);
|
||||
return schemaObj.validate || _compile(schemaObj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds schema to the instance.
|
||||
* @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
|
||||
* @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
|
||||
* @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead.
|
||||
* @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.
|
||||
*/
|
||||
function addSchema(schema, key, _skipValidation, _meta) {
|
||||
if (Array.isArray(schema)){
|
||||
for (var i=0; i<schema.length; i++) addSchema(schema[i], undefined, _skipValidation, _meta);
|
||||
return;
|
||||
}
|
||||
// can key/id have # inside?
|
||||
key = resolve.normalizeId(key || schema.id);
|
||||
checkUnique(key);
|
||||
self._schemas[key] = _addSchema(schema, _skipValidation, _meta, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add schema that will be used to validate other schemas
|
||||
* options in META_IGNORE_OPTIONS are alway set to false
|
||||
* @param {Object} schema schema object
|
||||
* @param {String} key optional schema key
|
||||
* @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema
|
||||
*/
|
||||
function addMetaSchema(schema, key, skipValidation) {
|
||||
addSchema(schema, key, skipValidation, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate schema
|
||||
* @param {Object} schema schema to validate
|
||||
* @param {Boolean} throwOrLogError pass true to throw (or log) an error if invalid
|
||||
* @return {Boolean} true if schema is valid
|
||||
*/
|
||||
function validateSchema(schema, throwOrLogError) {
|
||||
var $schema = schema.$schema || self._opts.defaultMeta || defaultMeta();
|
||||
var currentUriFormat = self._formats.uri;
|
||||
self._formats.uri = typeof currentUriFormat == 'function'
|
||||
? SCHEMA_URI_FORMAT_FUNC
|
||||
: SCHEMA_URI_FORMAT;
|
||||
var valid;
|
||||
try { valid = validate($schema, schema); }
|
||||
finally { self._formats.uri = currentUriFormat; }
|
||||
if (!valid && throwOrLogError) {
|
||||
var message = 'schema is invalid: ' + errorsText();
|
||||
if (self._opts.validateSchema == 'log') console.error(message);
|
||||
else throw new Error(message);
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
function defaultMeta() {
|
||||
var meta = self._opts.meta;
|
||||
self._opts.defaultMeta = typeof meta == 'object'
|
||||
? meta.id || meta
|
||||
: self._opts.v5
|
||||
? v5.META_SCHEMA_ID
|
||||
: META_SCHEMA_ID;
|
||||
return self._opts.defaultMeta;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get compiled schema from the instance by `key` or `ref`.
|
||||
* @param {String} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id).
|
||||
* @return {Function} schema validating function (with property `schema`).
|
||||
*/
|
||||
function getSchema(keyRef) {
|
||||
var schemaObj = _getSchemaObj(keyRef);
|
||||
switch (typeof schemaObj) {
|
||||
case 'object': return schemaObj.validate || _compile(schemaObj);
|
||||
case 'string': return getSchema(schemaObj);
|
||||
case 'undefined': return _getSchemaFragment(keyRef);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _getSchemaFragment(ref) {
|
||||
var res = resolve.schema.call(self, { schema: {} }, ref);
|
||||
if (res) {
|
||||
var schema = res.schema
|
||||
, root = res.root
|
||||
, baseId = res.baseId;
|
||||
var v = compileSchema.call(self, schema, root, undefined, baseId);
|
||||
self._fragments[ref] = new SchemaObject({
|
||||
ref: ref,
|
||||
fragment: true,
|
||||
schema: schema,
|
||||
root: root,
|
||||
baseId: baseId,
|
||||
validate: v
|
||||
});
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _getSchemaObj(keyRef) {
|
||||
keyRef = resolve.normalizeId(keyRef);
|
||||
return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove cached schema(s).
|
||||
* If no parameter is passed all schemas but meta-schemas are removed.
|
||||
* If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
||||
* Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
||||
* @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object
|
||||
*/
|
||||
function removeSchema(schemaKeyRef) {
|
||||
if (schemaKeyRef instanceof RegExp) {
|
||||
_removeAllSchemas(self._schemas, schemaKeyRef);
|
||||
_removeAllSchemas(self._refs, schemaKeyRef);
|
||||
return;
|
||||
}
|
||||
switch (typeof schemaKeyRef) {
|
||||
case 'undefined':
|
||||
_removeAllSchemas(self._schemas);
|
||||
_removeAllSchemas(self._refs);
|
||||
self._cache.clear();
|
||||
return;
|
||||
case 'string':
|
||||
var schemaObj = _getSchemaObj(schemaKeyRef);
|
||||
if (schemaObj) self._cache.del(schemaObj.jsonStr);
|
||||
delete self._schemas[schemaKeyRef];
|
||||
delete self._refs[schemaKeyRef];
|
||||
return;
|
||||
case 'object':
|
||||
var jsonStr = stableStringify(schemaKeyRef);
|
||||
self._cache.del(jsonStr);
|
||||
var id = schemaKeyRef.id;
|
||||
if (id) {
|
||||
id = resolve.normalizeId(id);
|
||||
delete self._schemas[id];
|
||||
delete self._refs[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _removeAllSchemas(schemas, regex) {
|
||||
for (var keyRef in schemas) {
|
||||
var schemaObj = schemas[keyRef];
|
||||
if (!schemaObj.meta && (!regex || regex.test(keyRef))) {
|
||||
self._cache.del(schemaObj.jsonStr);
|
||||
delete schemas[keyRef];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _addSchema(schema, skipValidation, meta, shouldAddSchema) {
|
||||
if (typeof schema != 'object') throw new Error('schema should be object');
|
||||
var jsonStr = stableStringify(schema);
|
||||
var cached = self._cache.get(jsonStr);
|
||||
if (cached) return cached;
|
||||
|
||||
shouldAddSchema = shouldAddSchema || self._opts.addUsedSchema !== false;
|
||||
|
||||
var id = resolve.normalizeId(schema.id);
|
||||
if (id && shouldAddSchema) checkUnique(id);
|
||||
|
||||
var willValidate = self._opts.validateSchema !== false && !skipValidation;
|
||||
var recursiveMeta;
|
||||
if (willValidate && !(recursiveMeta = schema.id && schema.id == schema.$schema))
|
||||
validateSchema(schema, true);
|
||||
|
||||
var localRefs = resolve.ids.call(self, schema);
|
||||
|
||||
var schemaObj = new SchemaObject({
|
||||
id: id,
|
||||
schema: schema,
|
||||
localRefs: localRefs,
|
||||
jsonStr: jsonStr,
|
||||
meta: meta
|
||||
});
|
||||
|
||||
if (id[0] != '#' && shouldAddSchema) self._refs[id] = schemaObj;
|
||||
self._cache.put(jsonStr, schemaObj);
|
||||
|
||||
if (willValidate && recursiveMeta) validateSchema(schema, true);
|
||||
|
||||
return schemaObj;
|
||||
}
|
||||
|
||||
|
||||
function _compile(schemaObj, root) {
|
||||
if (schemaObj.compiling) {
|
||||
schemaObj.validate = callValidate;
|
||||
callValidate.schema = schemaObj.schema;
|
||||
callValidate.errors = null;
|
||||
callValidate.root = root ? root : callValidate;
|
||||
if (schemaObj.schema.$async === true)
|
||||
callValidate.$async = true;
|
||||
return callValidate;
|
||||
}
|
||||
schemaObj.compiling = true;
|
||||
|
||||
var currentOpts;
|
||||
if (schemaObj.meta) {
|
||||
currentOpts = self._opts;
|
||||
self._opts = self._metaOpts;
|
||||
}
|
||||
|
||||
var v;
|
||||
try { v = compileSchema.call(self, schemaObj.schema, root, schemaObj.localRefs); }
|
||||
finally {
|
||||
schemaObj.compiling = false;
|
||||
if (schemaObj.meta) self._opts = currentOpts;
|
||||
}
|
||||
|
||||
schemaObj.validate = v;
|
||||
schemaObj.refs = v.refs;
|
||||
schemaObj.refVal = v.refVal;
|
||||
schemaObj.root = v.root;
|
||||
return v;
|
||||
|
||||
|
||||
function callValidate() {
|
||||
var _validate = schemaObj.validate;
|
||||
var result = _validate.apply(null, arguments);
|
||||
callValidate.errors = _validate.errors;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert array of error message objects to string
|
||||
* @param {Array<Object>} errors optional array of validation errors, if not passed errors from the instance are used.
|
||||
* @param {Object} options optional options with properties `separator` and `dataVar`.
|
||||
* @return {String} human readable string with all errors descriptions
|
||||
*/
|
||||
function errorsText(errors, options) {
|
||||
errors = errors || self.errors;
|
||||
if (!errors) return 'No errors';
|
||||
options = options || {};
|
||||
var separator = options.separator === undefined ? ', ' : options.separator;
|
||||
var dataVar = options.dataVar === undefined ? 'data' : options.dataVar;
|
||||
|
||||
var text = '';
|
||||
for (var i=0; i<errors.length; i++) {
|
||||
var e = errors[i];
|
||||
if (e) text += dataVar + e.dataPath + ' ' + e.message + separator;
|
||||
}
|
||||
return text.slice(0, -separator.length);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add custom format
|
||||
* @param {String} name format name
|
||||
* @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
|
||||
*/
|
||||
function addFormat(name, format) {
|
||||
if (typeof format == 'string') format = new RegExp(format);
|
||||
self._formats[name] = format;
|
||||
}
|
||||
|
||||
|
||||
function addDraft4MetaSchema() {
|
||||
if (self._opts.meta !== false) {
|
||||
var metaSchema = require('./refs/json-schema-draft-04.json');
|
||||
addMetaSchema(metaSchema, META_SCHEMA_ID, true);
|
||||
self._refs['http://json-schema.org/schema'] = META_SCHEMA_ID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function addInitialSchemas() {
|
||||
var optsSchemas = self._opts.schemas;
|
||||
if (!optsSchemas) return;
|
||||
if (Array.isArray(optsSchemas)) addSchema(optsSchemas);
|
||||
else for (var key in optsSchemas) addSchema(optsSchemas[key], key);
|
||||
}
|
||||
|
||||
|
||||
function addInitialFormats() {
|
||||
for (var name in self._opts.formats) {
|
||||
var format = self._opts.formats[name];
|
||||
addFormat(name, format);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkUnique(id) {
|
||||
if (self._schemas[id] || self._refs[id])
|
||||
throw new Error('schema with key or id "' + id + '" already exists');
|
||||
}
|
||||
|
||||
|
||||
function getMetaSchemaOptions() {
|
||||
var metaOpts = util.copy(self._opts);
|
||||
for (var i=0; i<META_IGNORE_OPTIONS.length; i++)
|
||||
delete metaOpts[META_IGNORE_OPTIONS[i]];
|
||||
return metaOpts;
|
||||
}
|
||||
}
|
||||
218
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/async.js
generated
vendored
Normal file
218
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/async.js
generated
vendored
Normal file
@ -0,0 +1,218 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
setup: setupAsync,
|
||||
compile: compileAsync
|
||||
};
|
||||
|
||||
|
||||
var util = require('./compile/util');
|
||||
|
||||
var ASYNC = {
|
||||
'*': checkGenerators,
|
||||
'co*': checkGenerators,
|
||||
'es7': checkAsyncFunction
|
||||
};
|
||||
|
||||
var TRANSPILE = {
|
||||
'nodent': getNodent,
|
||||
'regenerator': getRegenerator
|
||||
};
|
||||
|
||||
var MODES = [
|
||||
{ async: 'co*' },
|
||||
{ async: 'es7', transpile: 'nodent' },
|
||||
{ async: 'co*', transpile: 'regenerator' }
|
||||
];
|
||||
|
||||
|
||||
var regenerator, nodent;
|
||||
|
||||
|
||||
function setupAsync(opts, required) {
|
||||
if (required !== false) required = true;
|
||||
var async = opts.async
|
||||
, transpile = opts.transpile
|
||||
, check;
|
||||
|
||||
switch (typeof transpile) {
|
||||
case 'string':
|
||||
var get = TRANSPILE[transpile];
|
||||
if (!get) throw new Error('bad transpiler: ' + transpile);
|
||||
return (opts._transpileFunc = get(opts, required));
|
||||
case 'undefined':
|
||||
case 'boolean':
|
||||
if (typeof async == 'string') {
|
||||
check = ASYNC[async];
|
||||
if (!check) throw new Error('bad async mode: ' + async);
|
||||
return (opts.transpile = check(opts, required));
|
||||
}
|
||||
|
||||
for (var i=0; i<MODES.length; i++) {
|
||||
var _opts = MODES[i];
|
||||
if (setupAsync(_opts, false)) {
|
||||
util.copy(_opts, opts);
|
||||
return opts.transpile;
|
||||
}
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
throw new Error('generators, nodent and regenerator are not available');
|
||||
case 'function':
|
||||
return (opts._transpileFunc = opts.transpile);
|
||||
default:
|
||||
throw new Error('bad transpiler: ' + transpile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkGenerators(opts, required) {
|
||||
/* jshint evil: true */
|
||||
try {
|
||||
(new Function('(function*(){})()'))();
|
||||
return true;
|
||||
} catch(e) {
|
||||
/* istanbul ignore next */
|
||||
if (required) throw new Error('generators not supported');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkAsyncFunction(opts, required) {
|
||||
/* jshint evil: true */
|
||||
try {
|
||||
(new Function('(async function(){})()'))();
|
||||
/* istanbul ignore next */
|
||||
return true;
|
||||
} catch(e) {
|
||||
if (required) throw new Error('es7 async functions not supported');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getRegenerator(opts, required) {
|
||||
try {
|
||||
if (!regenerator) {
|
||||
var name = 'regenerator';
|
||||
regenerator = require(name);
|
||||
regenerator.runtime();
|
||||
}
|
||||
if (!opts.async || opts.async === true)
|
||||
opts.async = 'es7';
|
||||
return regeneratorTranspile;
|
||||
} catch(e) {
|
||||
/* istanbul ignore next */
|
||||
if (required) throw new Error('regenerator not available');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function regeneratorTranspile(code) {
|
||||
return regenerator.compile(code).code;
|
||||
}
|
||||
|
||||
|
||||
function getNodent(opts, required) {
|
||||
/* jshint evil: true */
|
||||
try {
|
||||
if (!nodent) {
|
||||
var name = 'nodent';
|
||||
nodent = require(name)({ log: false, dontInstallRequireHook: true });
|
||||
}
|
||||
if (opts.async != 'es7') {
|
||||
if (opts.async && opts.async !== true) console.warn('nodent transpiles only es7 async functions');
|
||||
opts.async = 'es7';
|
||||
}
|
||||
return nodentTranspile;
|
||||
} catch(e) {
|
||||
/* istanbul ignore next */
|
||||
if (required) throw new Error('nodent not available');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function nodentTranspile(code) {
|
||||
return nodent.compile(code, '', { promises: true, sourcemap: false }).code;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates validating function for passed schema with asynchronous loading of missing schemas.
|
||||
* `loadSchema` option should be a function that accepts schema uri and node-style callback.
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema object
|
||||
* @param {Function} callback node-style callback, it is always called with 2 parameters: error (or null) and validating function.
|
||||
*/
|
||||
function compileAsync(schema, callback) {
|
||||
/* eslint no-shadow: 0 */
|
||||
/* jshint validthis: true */
|
||||
var schemaObj;
|
||||
var self = this;
|
||||
try {
|
||||
schemaObj = this._addSchema(schema);
|
||||
} catch(e) {
|
||||
setTimeout(function() { callback(e); });
|
||||
return;
|
||||
}
|
||||
if (schemaObj.validate) {
|
||||
setTimeout(function() { callback(null, schemaObj.validate); });
|
||||
} else {
|
||||
if (typeof this._opts.loadSchema != 'function')
|
||||
throw new Error('options.loadSchema should be a function');
|
||||
_compileAsync(schema, callback, true);
|
||||
}
|
||||
|
||||
|
||||
function _compileAsync(schema, callback, firstCall) {
|
||||
var validate;
|
||||
try { validate = self.compile(schema); }
|
||||
catch(e) {
|
||||
if (e.missingSchema) loadMissingSchema(e);
|
||||
else deferCallback(e);
|
||||
return;
|
||||
}
|
||||
deferCallback(null, validate);
|
||||
|
||||
function loadMissingSchema(e) {
|
||||
var ref = e.missingSchema;
|
||||
if (self._refs[ref] || self._schemas[ref])
|
||||
return callback(new Error('Schema ' + ref + ' is loaded but ' + e.missingRef + ' cannot be resolved'));
|
||||
var _callbacks = self._loadingSchemas[ref];
|
||||
if (_callbacks) {
|
||||
if (typeof _callbacks == 'function')
|
||||
self._loadingSchemas[ref] = [_callbacks, schemaLoaded];
|
||||
else
|
||||
_callbacks[_callbacks.length] = schemaLoaded;
|
||||
} else {
|
||||
self._loadingSchemas[ref] = schemaLoaded;
|
||||
self._opts.loadSchema(ref, function (err, sch) {
|
||||
var _callbacks = self._loadingSchemas[ref];
|
||||
delete self._loadingSchemas[ref];
|
||||
if (typeof _callbacks == 'function') {
|
||||
_callbacks(err, sch);
|
||||
} else {
|
||||
for (var i=0; i<_callbacks.length; i++)
|
||||
_callbacks[i](err, sch);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function schemaLoaded(err, sch) {
|
||||
if (err) return callback(err);
|
||||
if (!(self._refs[ref] || self._schemas[ref])) {
|
||||
try {
|
||||
self.addSchema(sch, ref);
|
||||
} catch(e) {
|
||||
callback(e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
_compileAsync(schema, callback);
|
||||
}
|
||||
}
|
||||
|
||||
function deferCallback(err, validate) {
|
||||
if (firstCall) setTimeout(function() { callback(err, validate); });
|
||||
else return callback(err, validate);
|
||||
}
|
||||
}
|
||||
}
|
||||
26
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/cache.js
generated
vendored
Normal file
26
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/cache.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
var Cache = module.exports = function Cache() {
|
||||
this._cache = {};
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.put = function Cache_put(key, value) {
|
||||
this._cache[key] = value;
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.get = function Cache_get(key) {
|
||||
return this._cache[key];
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.del = function Cache_del(key) {
|
||||
delete this._cache[key];
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.clear = function Cache_clear() {
|
||||
this._cache = {};
|
||||
};
|
||||
28
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/_rules.js
generated
vendored
Normal file
28
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/_rules.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
//all requires must be explicit because browserify won't work with dynamic requires
|
||||
module.exports = {
|
||||
'$ref': require('../dotjs/ref'),
|
||||
allOf: require('../dotjs/allOf'),
|
||||
anyOf: require('../dotjs/anyOf'),
|
||||
dependencies: require('../dotjs/dependencies'),
|
||||
'enum': require('../dotjs/enum'),
|
||||
format: require('../dotjs/format'),
|
||||
items: require('../dotjs/items'),
|
||||
maximum: require('../dotjs/_limit'),
|
||||
minimum: require('../dotjs/_limit'),
|
||||
maxItems: require('../dotjs/_limitItems'),
|
||||
minItems: require('../dotjs/_limitItems'),
|
||||
maxLength: require('../dotjs/_limitLength'),
|
||||
minLength: require('../dotjs/_limitLength'),
|
||||
maxProperties: require('../dotjs/_limitProperties'),
|
||||
minProperties: require('../dotjs/_limitProperties'),
|
||||
multipleOf: require('../dotjs/multipleOf'),
|
||||
not: require('../dotjs/not'),
|
||||
oneOf: require('../dotjs/oneOf'),
|
||||
pattern: require('../dotjs/pattern'),
|
||||
properties: require('../dotjs/properties'),
|
||||
required: require('../dotjs/required'),
|
||||
uniqueItems: require('../dotjs/uniqueItems'),
|
||||
validate: require('../dotjs/validate')
|
||||
};
|
||||
45
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/equal.js
generated
vendored
Normal file
45
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/equal.js
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
/*eslint complexity: 0*/
|
||||
|
||||
module.exports = function equal(a, b) {
|
||||
if (a === b) return true;
|
||||
|
||||
var arrA = Array.isArray(a)
|
||||
, arrB = Array.isArray(b)
|
||||
, i;
|
||||
|
||||
if (arrA && arrB) {
|
||||
if (a.length != b.length) return false;
|
||||
for (i = 0; i < a.length; i++)
|
||||
if (!equal(a[i], b[i])) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (arrA != arrB) return false;
|
||||
|
||||
if (a && b && typeof a === 'object' && typeof b === 'object') {
|
||||
var keys = Object.keys(a);
|
||||
if (keys.length !== Object.keys(b).length) return false;
|
||||
|
||||
var dateA = a instanceof Date
|
||||
, dateB = b instanceof Date;
|
||||
if (dateA && dateB) return a.getTime() == b.getTime();
|
||||
if (dateA != dateB) return false;
|
||||
|
||||
var regexpA = a instanceof RegExp
|
||||
, regexpB = b instanceof RegExp;
|
||||
if (regexpA && regexpB) return a.toString() == b.toString();
|
||||
if (regexpA != regexpB) return false;
|
||||
|
||||
for (i = 0; i < keys.length; i++)
|
||||
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
||||
|
||||
for (i = 0; i < keys.length; i++)
|
||||
if(!equal(a[keys[i]], b[keys[i]])) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
164
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/formats.js
generated
vendored
Normal file
164
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/formats.js
generated
vendored
Normal file
@ -0,0 +1,164 @@
|
||||
'use strict';
|
||||
|
||||
var util = require('./util');
|
||||
|
||||
var DATE = /^\d\d\d\d-(\d\d)-(\d\d)$/;
|
||||
var DAYS = [0,31,29,31,30,31,30,31,31,30,31,30,31];
|
||||
var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d:\d\d)?$/i;
|
||||
var HOSTNAME = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*$/i;
|
||||
var URI = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@\/?]|%[0-9a-f]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'()*+,;=:@\/?]|%[0-9a-f]{2})*)?$/i;
|
||||
var UUID = /^(?:urn\:uuid\:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
|
||||
var JSON_POINTER = /^(?:\/(?:[^~\/]|~0|~1)*)*$|^\#(?:\/(?:[a-z0-9_\-\.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
|
||||
var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:\#|(?:\/(?:[^~\/]|~0|~1)*)*)$/;
|
||||
|
||||
|
||||
module.exports = formats;
|
||||
|
||||
function formats(mode) {
|
||||
mode = mode == 'full' ? 'full' : 'fast';
|
||||
var formatDefs = util.copy(formats[mode]);
|
||||
for (var fName in formats.compare) {
|
||||
formatDefs[fName] = {
|
||||
validate: formatDefs[fName],
|
||||
compare: formats.compare[fName]
|
||||
};
|
||||
}
|
||||
return formatDefs;
|
||||
}
|
||||
|
||||
|
||||
formats.fast = {
|
||||
// date: http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/,
|
||||
// date-time: http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
time: /^[0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:z|[+-]\d\d:\d\d)?$/i,
|
||||
'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s][0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:z|[+-]\d\d:\d\d)$/i,
|
||||
// uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
|
||||
uri: /^(?:[a-z][a-z0-9+-.]*)?(?:\:|\/)\/?[^\s]*$/i,
|
||||
// email (sources from jsen validator):
|
||||
// http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363
|
||||
// http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation')
|
||||
email: /^[a-z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,
|
||||
hostname: HOSTNAME,
|
||||
// optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
|
||||
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
|
||||
// optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses
|
||||
ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
|
||||
regex: regex,
|
||||
// uuid: http://tools.ietf.org/html/rfc4122
|
||||
uuid: UUID,
|
||||
// JSON-pointer: https://tools.ietf.org/html/rfc6901
|
||||
// uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A
|
||||
'json-pointer': JSON_POINTER,
|
||||
// relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00
|
||||
'relative-json-pointer': RELATIVE_JSON_POINTER
|
||||
};
|
||||
|
||||
|
||||
formats.full = {
|
||||
date: date,
|
||||
time: time,
|
||||
'date-time': date_time,
|
||||
uri: uri,
|
||||
email: /^[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&''*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
|
||||
hostname: hostname,
|
||||
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
|
||||
ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
|
||||
regex: regex,
|
||||
uuid: UUID,
|
||||
'json-pointer': JSON_POINTER,
|
||||
'relative-json-pointer': RELATIVE_JSON_POINTER
|
||||
};
|
||||
|
||||
|
||||
formats.compare = {
|
||||
date: compareDate,
|
||||
time: compareTime,
|
||||
'date-time': compareDateTime
|
||||
};
|
||||
|
||||
|
||||
function date(str) {
|
||||
// full-date from http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
var matches = str.match(DATE);
|
||||
if (!matches) return false;
|
||||
|
||||
var month = +matches[1];
|
||||
var day = +matches[2];
|
||||
return month >= 1 && month <= 12 && day >= 1 && day <= DAYS[month];
|
||||
}
|
||||
|
||||
|
||||
function time(str, full) {
|
||||
var matches = str.match(TIME);
|
||||
if (!matches) return false;
|
||||
|
||||
var hour = matches[1];
|
||||
var minute = matches[2];
|
||||
var second = matches[3];
|
||||
var timeZone = matches[5];
|
||||
return hour <= 23 && minute <= 59 && second <= 59 && (!full || timeZone);
|
||||
}
|
||||
|
||||
|
||||
var DATE_TIME_SEPARATOR = /t|\s/i;
|
||||
function date_time(str) {
|
||||
// http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
var dateTime = str.split(DATE_TIME_SEPARATOR);
|
||||
return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true);
|
||||
}
|
||||
|
||||
|
||||
function hostname(str) {
|
||||
// https://tools.ietf.org/html/rfc1034#section-3.5
|
||||
// https://tools.ietf.org/html/rfc1123#section-2
|
||||
return str.length <= 255 && HOSTNAME.test(str);
|
||||
}
|
||||
|
||||
|
||||
var NOT_URI_FRAGMENT = /\/|\:/;
|
||||
function uri(str) {
|
||||
// http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "."
|
||||
return NOT_URI_FRAGMENT.test(str) && URI.test(str);
|
||||
}
|
||||
|
||||
|
||||
function regex(str) {
|
||||
try {
|
||||
new RegExp(str);
|
||||
return true;
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function compareDate(d1, d2) {
|
||||
if (!(d1 && d2)) return;
|
||||
if (d1 > d2) return 1;
|
||||
if (d1 < d2) return -1;
|
||||
if (d1 === d2) return 0;
|
||||
}
|
||||
|
||||
|
||||
function compareTime(t1, t2) {
|
||||
if (!(t1 && t2)) return;
|
||||
t1 = t1.match(TIME);
|
||||
t2 = t2.match(TIME);
|
||||
if (!(t1 && t2)) return;
|
||||
t1 = t1[1] + t1[2] + t1[3] + (t1[4]||'');
|
||||
t2 = t2[1] + t2[2] + t2[3] + (t2[4]||'');
|
||||
if (t1 > t2) return 1;
|
||||
if (t1 < t2) return -1;
|
||||
if (t1 === t2) return 0;
|
||||
}
|
||||
|
||||
|
||||
function compareDateTime(dt1, dt2) {
|
||||
if (!(dt1 && dt2)) return;
|
||||
dt1 = dt1.split(DATE_TIME_SEPARATOR);
|
||||
dt2 = dt2.split(DATE_TIME_SEPARATOR);
|
||||
var res = compareDate(dt1[0], dt2[0]);
|
||||
if (res === undefined) return;
|
||||
return res || compareTime(dt1[1], dt2[1]);
|
||||
}
|
||||
390
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/index.js
generated
vendored
Normal file
390
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/index.js
generated
vendored
Normal file
@ -0,0 +1,390 @@
|
||||
'use strict';
|
||||
|
||||
var resolve = require('./resolve')
|
||||
, util = require('./util')
|
||||
, stableStringify = require('json-stable-stringify')
|
||||
, async = require('../async');
|
||||
|
||||
var beautify;
|
||||
|
||||
function loadBeautify(){
|
||||
if (beautify === undefined) {
|
||||
var name = 'js-beautify';
|
||||
try { beautify = require(name).js_beautify; }
|
||||
catch(e) { beautify = false; }
|
||||
}
|
||||
}
|
||||
|
||||
var validateGenerator = require('../dotjs/validate');
|
||||
|
||||
/**
|
||||
* Functions below are used inside compiled validations function
|
||||
*/
|
||||
|
||||
var co = require('co');
|
||||
var ucs2length = util.ucs2length;
|
||||
var equal = require('./equal');
|
||||
|
||||
// this error is thrown by async schemas to return validation errors via exception
|
||||
var ValidationError = require('./validation_error');
|
||||
|
||||
module.exports = compile;
|
||||
|
||||
|
||||
/**
|
||||
* Compiles schema to validation function
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema object
|
||||
* @param {Object} root object with information about the root schema for this schema
|
||||
* @param {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution
|
||||
* @param {String} baseId base ID for IDs in the schema
|
||||
* @return {Function} validation function
|
||||
*/
|
||||
function compile(schema, root, localRefs, baseId) {
|
||||
/* jshint validthis: true, evil: true */
|
||||
/* eslint no-shadow: 0 */
|
||||
var self = this
|
||||
, opts = this._opts
|
||||
, refVal = [ undefined ]
|
||||
, refs = {}
|
||||
, patterns = []
|
||||
, patternsHash = {}
|
||||
, defaults = []
|
||||
, defaultsHash = {}
|
||||
, customRules = []
|
||||
, keepSourceCode = opts.sourceCode !== false;
|
||||
|
||||
root = root || { schema: schema, refVal: refVal, refs: refs };
|
||||
|
||||
var c = checkCompiling.call(this, schema, root, baseId);
|
||||
var compilation = this._compilations[c.index];
|
||||
if (c.compiling) return (compilation.callValidate = callValidate);
|
||||
|
||||
var formats = this._formats;
|
||||
var RULES = this.RULES;
|
||||
|
||||
try {
|
||||
var v = localCompile(schema, root, localRefs, baseId);
|
||||
compilation.validate = v;
|
||||
var cv = compilation.callValidate;
|
||||
if (cv) {
|
||||
cv.schema = v.schema;
|
||||
cv.errors = null;
|
||||
cv.refs = v.refs;
|
||||
cv.refVal = v.refVal;
|
||||
cv.root = v.root;
|
||||
cv.$async = v.$async;
|
||||
if (keepSourceCode) cv.sourceCode = v.sourceCode;
|
||||
}
|
||||
return v;
|
||||
} finally {
|
||||
endCompiling.call(this, schema, root, baseId);
|
||||
}
|
||||
|
||||
function callValidate() {
|
||||
var validate = compilation.validate;
|
||||
var result = validate.apply(null, arguments);
|
||||
callValidate.errors = validate.errors;
|
||||
return result;
|
||||
}
|
||||
|
||||
function localCompile(_schema, _root, localRefs, baseId) {
|
||||
var isRoot = !_root || (_root && _root.schema == _schema);
|
||||
if (_root.schema != root.schema)
|
||||
return compile.call(self, _schema, _root, localRefs, baseId);
|
||||
|
||||
var $async = _schema.$async === true;
|
||||
if ($async && !opts.transpile) async.setup(opts);
|
||||
|
||||
var sourceCode = validateGenerator({
|
||||
isTop: true,
|
||||
schema: _schema,
|
||||
isRoot: isRoot,
|
||||
baseId: baseId,
|
||||
root: _root,
|
||||
schemaPath: '',
|
||||
errSchemaPath: '#',
|
||||
errorPath: '""',
|
||||
RULES: RULES,
|
||||
validate: validateGenerator,
|
||||
util: util,
|
||||
resolve: resolve,
|
||||
resolveRef: resolveRef,
|
||||
usePattern: usePattern,
|
||||
useDefault: useDefault,
|
||||
useCustomRule: useCustomRule,
|
||||
opts: opts,
|
||||
formats: formats,
|
||||
self: self
|
||||
});
|
||||
|
||||
sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode)
|
||||
+ vars(defaults, defaultCode) + vars(customRules, customRuleCode)
|
||||
+ sourceCode;
|
||||
|
||||
if (opts.beautify) {
|
||||
loadBeautify();
|
||||
/* istanbul ignore else */
|
||||
if (beautify) sourceCode = beautify(sourceCode, opts.beautify);
|
||||
else console.error('"npm install js-beautify" to use beautify option');
|
||||
}
|
||||
// console.log('\n\n\n *** \n', sourceCode);
|
||||
var validate, validateCode
|
||||
, transpile = opts._transpileFunc;
|
||||
try {
|
||||
validateCode = $async && transpile
|
||||
? transpile(sourceCode)
|
||||
: sourceCode;
|
||||
|
||||
var makeValidate = new Function(
|
||||
'self',
|
||||
'RULES',
|
||||
'formats',
|
||||
'root',
|
||||
'refVal',
|
||||
'defaults',
|
||||
'customRules',
|
||||
'co',
|
||||
'equal',
|
||||
'ucs2length',
|
||||
'ValidationError',
|
||||
validateCode
|
||||
);
|
||||
|
||||
validate = makeValidate(
|
||||
self,
|
||||
RULES,
|
||||
formats,
|
||||
root,
|
||||
refVal,
|
||||
defaults,
|
||||
customRules,
|
||||
co,
|
||||
equal,
|
||||
ucs2length,
|
||||
ValidationError
|
||||
);
|
||||
|
||||
refVal[0] = validate;
|
||||
} catch(e) {
|
||||
console.error('Error compiling schema, function code:', validateCode);
|
||||
throw e;
|
||||
}
|
||||
|
||||
validate.schema = _schema;
|
||||
validate.errors = null;
|
||||
validate.refs = refs;
|
||||
validate.refVal = refVal;
|
||||
validate.root = isRoot ? validate : _root;
|
||||
if ($async) validate.$async = true;
|
||||
if (keepSourceCode) validate.sourceCode = sourceCode;
|
||||
if (opts.sourceCode === true) {
|
||||
validate.source = {
|
||||
patterns: patterns,
|
||||
defaults: defaults
|
||||
};
|
||||
}
|
||||
|
||||
return validate;
|
||||
}
|
||||
|
||||
function resolveRef(baseId, ref, isRoot) {
|
||||
ref = resolve.url(baseId, ref);
|
||||
var refIndex = refs[ref];
|
||||
var _refVal, refCode;
|
||||
if (refIndex !== undefined) {
|
||||
_refVal = refVal[refIndex];
|
||||
refCode = 'refVal[' + refIndex + ']';
|
||||
return resolvedRef(_refVal, refCode);
|
||||
}
|
||||
if (!isRoot && root.refs) {
|
||||
var rootRefId = root.refs[ref];
|
||||
if (rootRefId !== undefined) {
|
||||
_refVal = root.refVal[rootRefId];
|
||||
refCode = addLocalRef(ref, _refVal);
|
||||
return resolvedRef(_refVal, refCode);
|
||||
}
|
||||
}
|
||||
|
||||
refCode = addLocalRef(ref);
|
||||
var v = resolve.call(self, localCompile, root, ref);
|
||||
if (!v) {
|
||||
var localSchema = localRefs && localRefs[ref];
|
||||
if (localSchema) {
|
||||
v = resolve.inlineRef(localSchema, opts.inlineRefs)
|
||||
? localSchema
|
||||
: compile.call(self, localSchema, root, localRefs, baseId);
|
||||
}
|
||||
}
|
||||
|
||||
if (v) {
|
||||
replaceLocalRef(ref, v);
|
||||
return resolvedRef(v, refCode);
|
||||
}
|
||||
}
|
||||
|
||||
function addLocalRef(ref, v) {
|
||||
var refId = refVal.length;
|
||||
refVal[refId] = v;
|
||||
refs[ref] = refId;
|
||||
return 'refVal' + refId;
|
||||
}
|
||||
|
||||
function replaceLocalRef(ref, v) {
|
||||
var refId = refs[ref];
|
||||
refVal[refId] = v;
|
||||
}
|
||||
|
||||
function resolvedRef(refVal, code) {
|
||||
return typeof refVal == 'object'
|
||||
? { code: code, schema: refVal, inline: true }
|
||||
: { code: code, $async: refVal && refVal.$async };
|
||||
}
|
||||
|
||||
function usePattern(regexStr) {
|
||||
var index = patternsHash[regexStr];
|
||||
if (index === undefined) {
|
||||
index = patternsHash[regexStr] = patterns.length;
|
||||
patterns[index] = regexStr;
|
||||
}
|
||||
return 'pattern' + index;
|
||||
}
|
||||
|
||||
function useDefault(value) {
|
||||
switch (typeof value) {
|
||||
case 'boolean':
|
||||
case 'number':
|
||||
return '' + value;
|
||||
case 'string':
|
||||
return util.toQuotedString(value);
|
||||
case 'object':
|
||||
if (value === null) return 'null';
|
||||
var valueStr = stableStringify(value);
|
||||
var index = defaultsHash[valueStr];
|
||||
if (index === undefined) {
|
||||
index = defaultsHash[valueStr] = defaults.length;
|
||||
defaults[index] = value;
|
||||
}
|
||||
return 'default' + index;
|
||||
}
|
||||
}
|
||||
|
||||
function useCustomRule(rule, schema, parentSchema, it) {
|
||||
var validateSchema = rule.definition.validateSchema;
|
||||
if (validateSchema && self._opts.validateSchema !== false) {
|
||||
var valid = validateSchema(schema);
|
||||
if (!valid) {
|
||||
var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors);
|
||||
if (self._opts.validateSchema == 'log') console.error(message);
|
||||
else throw new Error(message);
|
||||
}
|
||||
}
|
||||
|
||||
var compile = rule.definition.compile
|
||||
, inline = rule.definition.inline
|
||||
, macro = rule.definition.macro;
|
||||
|
||||
var validate;
|
||||
if (compile) {
|
||||
validate = compile.call(self, schema, parentSchema, it);
|
||||
} else if (macro) {
|
||||
validate = macro.call(self, schema, parentSchema, it);
|
||||
if (opts.validateSchema !== false) self.validateSchema(validate, true);
|
||||
} else if (inline) {
|
||||
validate = inline.call(self, it, rule.keyword, schema, parentSchema);
|
||||
} else {
|
||||
validate = rule.definition.validate;
|
||||
}
|
||||
|
||||
var index = customRules.length;
|
||||
customRules[index] = validate;
|
||||
|
||||
return {
|
||||
code: 'customRule' + index,
|
||||
validate: validate
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the schema is currently compiled
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema to compile
|
||||
* @param {Object} root root object
|
||||
* @param {String} baseId base schema ID
|
||||
* @return {Object} object with properties "index" (compilation index) and "compiling" (boolean)
|
||||
*/
|
||||
function checkCompiling(schema, root, baseId) {
|
||||
/* jshint validthis: true */
|
||||
var index = compIndex.call(this, schema, root, baseId);
|
||||
if (index >= 0) return { index: index, compiling: true };
|
||||
index = this._compilations.length;
|
||||
this._compilations[index] = {
|
||||
schema: schema,
|
||||
root: root,
|
||||
baseId: baseId
|
||||
};
|
||||
return { index: index, compiling: false };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes the schema from the currently compiled list
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema to compile
|
||||
* @param {Object} root root object
|
||||
* @param {String} baseId base schema ID
|
||||
*/
|
||||
function endCompiling(schema, root, baseId) {
|
||||
/* jshint validthis: true */
|
||||
var i = compIndex.call(this, schema, root, baseId);
|
||||
if (i >= 0) this._compilations.splice(i, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Index of schema compilation in the currently compiled list
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema to compile
|
||||
* @param {Object} root root object
|
||||
* @param {String} baseId base schema ID
|
||||
* @return {Integer} compilation index
|
||||
*/
|
||||
function compIndex(schema, root, baseId) {
|
||||
/* jshint validthis: true */
|
||||
for (var i=0; i<this._compilations.length; i++) {
|
||||
var c = this._compilations[i];
|
||||
if (c.schema == schema && c.root == root && c.baseId == baseId) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
function patternCode(i, patterns) {
|
||||
return 'var pattern' + i + ' = new RegExp(' + util.toQuotedString(patterns[i]) + ');';
|
||||
}
|
||||
|
||||
|
||||
function defaultCode(i) {
|
||||
return 'var default' + i + ' = defaults[' + i + '];';
|
||||
}
|
||||
|
||||
|
||||
function refValCode(i, refVal) {
|
||||
return refVal[i] ? 'var refVal' + i + ' = refVal[' + i + '];' : '';
|
||||
}
|
||||
|
||||
|
||||
function customRuleCode(i) {
|
||||
return 'var customRule' + i + ' = customRules[' + i + '];';
|
||||
}
|
||||
|
||||
|
||||
function vars(arr, statement) {
|
||||
if (!arr.length) return '';
|
||||
var code = '';
|
||||
for (var i=0; i<arr.length; i++)
|
||||
code += statement(i, arr);
|
||||
return code;
|
||||
}
|
||||
267
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/resolve.js
generated
vendored
Normal file
267
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/resolve.js
generated
vendored
Normal file
@ -0,0 +1,267 @@
|
||||
'use strict';
|
||||
|
||||
var url = require('url')
|
||||
, equal = require('./equal')
|
||||
, util = require('./util')
|
||||
, SchemaObject = require('./schema_obj');
|
||||
|
||||
module.exports = resolve;
|
||||
|
||||
resolve.normalizeId = normalizeId;
|
||||
resolve.fullPath = getFullPath;
|
||||
resolve.url = resolveUrl;
|
||||
resolve.ids = resolveIds;
|
||||
resolve.inlineRef = inlineRef;
|
||||
resolve.schema = resolveSchema;
|
||||
|
||||
/**
|
||||
* [resolve and compile the references ($ref)]
|
||||
* @this Ajv
|
||||
* @param {Function} compile reference to schema compilation funciton (localCompile)
|
||||
* @param {Object} root object with information about the root schema for the current schema
|
||||
* @param {String} ref reference to resolve
|
||||
* @return {Object|Function} schema object (if the schema can be inlined) or validation function
|
||||
*/
|
||||
function resolve(compile, root, ref) {
|
||||
/* jshint validthis: true */
|
||||
var refVal = this._refs[ref];
|
||||
if (typeof refVal == 'string') {
|
||||
if (this._refs[refVal]) refVal = this._refs[refVal];
|
||||
else return resolve.call(this, compile, root, refVal);
|
||||
}
|
||||
|
||||
refVal = refVal || this._schemas[ref];
|
||||
if (refVal instanceof SchemaObject) {
|
||||
return inlineRef(refVal.schema, this._opts.inlineRefs)
|
||||
? refVal.schema
|
||||
: refVal.validate || this._compile(refVal);
|
||||
}
|
||||
|
||||
var res = resolveSchema.call(this, root, ref);
|
||||
var schema, v, baseId;
|
||||
if (res) {
|
||||
schema = res.schema;
|
||||
root = res.root;
|
||||
baseId = res.baseId;
|
||||
}
|
||||
|
||||
if (schema instanceof SchemaObject) {
|
||||
v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId);
|
||||
} else if (schema) {
|
||||
v = inlineRef(schema, this._opts.inlineRefs)
|
||||
? schema
|
||||
: compile.call(this, schema, root, undefined, baseId);
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resolve schema, its root and baseId
|
||||
* @this Ajv
|
||||
* @param {Object} root root object with properties schema, refVal, refs
|
||||
* @param {String} ref reference to resolve
|
||||
* @return {Object} object with properties schema, root, baseId
|
||||
*/
|
||||
function resolveSchema(root, ref) {
|
||||
/* jshint validthis: true */
|
||||
var p = url.parse(ref, false, true)
|
||||
, refPath = _getFullPath(p)
|
||||
, baseId = getFullPath(root.schema.id);
|
||||
if (refPath !== baseId) {
|
||||
var id = normalizeId(refPath);
|
||||
var refVal = this._refs[id];
|
||||
if (typeof refVal == 'string') {
|
||||
return resolveRecursive.call(this, root, refVal, p);
|
||||
} else if (refVal instanceof SchemaObject) {
|
||||
if (!refVal.validate) this._compile(refVal);
|
||||
root = refVal;
|
||||
} else {
|
||||
refVal = this._schemas[id];
|
||||
if (refVal instanceof SchemaObject) {
|
||||
if (!refVal.validate) this._compile(refVal);
|
||||
if (id == normalizeId(ref))
|
||||
return { schema: refVal, root: root, baseId: baseId };
|
||||
root = refVal;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!root.schema) return;
|
||||
baseId = getFullPath(root.schema.id);
|
||||
}
|
||||
return getJsonPointer.call(this, p, baseId, root.schema, root);
|
||||
}
|
||||
|
||||
|
||||
/* @this Ajv */
|
||||
function resolveRecursive(root, ref, parsedRef) {
|
||||
/* jshint validthis: true */
|
||||
var res = resolveSchema.call(this, root, ref);
|
||||
if (res) {
|
||||
var schema = res.schema;
|
||||
var baseId = res.baseId;
|
||||
root = res.root;
|
||||
if (schema.id) baseId = resolveUrl(baseId, schema.id);
|
||||
return getJsonPointer.call(this, parsedRef, baseId, schema, root);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']);
|
||||
/* @this Ajv */
|
||||
function getJsonPointer(parsedRef, baseId, schema, root) {
|
||||
/* jshint validthis: true */
|
||||
parsedRef.hash = parsedRef.hash || '';
|
||||
if (parsedRef.hash.slice(0,2) != '#/') return;
|
||||
var parts = parsedRef.hash.split('/');
|
||||
|
||||
for (var i = 1; i < parts.length; i++) {
|
||||
var part = parts[i];
|
||||
if (part) {
|
||||
part = util.unescapeFragment(part);
|
||||
schema = schema[part];
|
||||
if (!schema) break;
|
||||
if (schema.id && !PREVENT_SCOPE_CHANGE[part]) baseId = resolveUrl(baseId, schema.id);
|
||||
if (schema.$ref) {
|
||||
var $ref = resolveUrl(baseId, schema.$ref);
|
||||
var res = resolveSchema.call(this, root, $ref);
|
||||
if (res) {
|
||||
schema = res.schema;
|
||||
root = res.root;
|
||||
baseId = res.baseId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (schema && schema != root.schema)
|
||||
return { schema: schema, root: root, baseId: baseId };
|
||||
}
|
||||
|
||||
|
||||
var SIMPLE_INLINED = util.toHash([
|
||||
'type', 'format', 'pattern',
|
||||
'maxLength', 'minLength',
|
||||
'maxProperties', 'minProperties',
|
||||
'maxItems', 'minItems',
|
||||
'maximum', 'minimum',
|
||||
'uniqueItems', 'multipleOf',
|
||||
'required', 'enum'
|
||||
]);
|
||||
function inlineRef(schema, limit) {
|
||||
if (limit === false) return false;
|
||||
if (limit === undefined || limit === true) return checkNoRef(schema);
|
||||
else if (limit) return countKeys(schema) <= limit;
|
||||
}
|
||||
|
||||
|
||||
function checkNoRef(schema) {
|
||||
var item;
|
||||
if (Array.isArray(schema)) {
|
||||
for (var i=0; i<schema.length; i++) {
|
||||
item = schema[i];
|
||||
if (typeof item == 'object' && !checkNoRef(item)) return false;
|
||||
}
|
||||
} else {
|
||||
for (var key in schema) {
|
||||
if (key == '$ref') return false;
|
||||
item = schema[key];
|
||||
if (typeof item == 'object' && !checkNoRef(item)) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function countKeys(schema) {
|
||||
var count = 0, item;
|
||||
if (Array.isArray(schema)) {
|
||||
for (var i=0; i<schema.length; i++) {
|
||||
item = schema[i];
|
||||
if (typeof item == 'object') count += countKeys(item);
|
||||
if (count == Infinity) return Infinity;
|
||||
}
|
||||
} else {
|
||||
for (var key in schema) {
|
||||
if (key == '$ref') return Infinity;
|
||||
if (SIMPLE_INLINED[key]) {
|
||||
count++;
|
||||
} else {
|
||||
item = schema[key];
|
||||
if (typeof item == 'object') count += countKeys(item) + 1;
|
||||
if (count == Infinity) return Infinity;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
function getFullPath(id, normalize) {
|
||||
if (normalize !== false) id = normalizeId(id);
|
||||
var p = url.parse(id, false, true);
|
||||
return _getFullPath(p);
|
||||
}
|
||||
|
||||
|
||||
function _getFullPath(p) {
|
||||
var protocolSeparator = p.protocol || p.href.slice(0,2) == '//' ? '//' : '';
|
||||
return (p.protocol||'') + protocolSeparator + (p.host||'') + (p.path||'') + '#';
|
||||
}
|
||||
|
||||
|
||||
var TRAILING_SLASH_HASH = /#\/?$/;
|
||||
function normalizeId(id) {
|
||||
return id ? id.replace(TRAILING_SLASH_HASH, '') : '';
|
||||
}
|
||||
|
||||
|
||||
function resolveUrl(baseId, id) {
|
||||
id = normalizeId(id);
|
||||
return url.resolve(baseId, id);
|
||||
}
|
||||
|
||||
|
||||
/* @this Ajv */
|
||||
function resolveIds(schema) {
|
||||
/* eslint no-shadow: 0 */
|
||||
/* jshint validthis: true */
|
||||
var id = normalizeId(schema.id);
|
||||
var localRefs = {};
|
||||
_resolveIds.call(this, schema, getFullPath(id, false), id);
|
||||
return localRefs;
|
||||
|
||||
/* @this Ajv */
|
||||
function _resolveIds(schema, fullPath, baseId) {
|
||||
/* jshint validthis: true */
|
||||
if (Array.isArray(schema)) {
|
||||
for (var i=0; i<schema.length; i++)
|
||||
_resolveIds.call(this, schema[i], fullPath+'/'+i, baseId);
|
||||
} else if (schema && typeof schema == 'object') {
|
||||
if (typeof schema.id == 'string') {
|
||||
var id = baseId = baseId
|
||||
? url.resolve(baseId, schema.id)
|
||||
: schema.id;
|
||||
id = normalizeId(id);
|
||||
|
||||
var refVal = this._refs[id];
|
||||
if (typeof refVal == 'string') refVal = this._refs[refVal];
|
||||
if (refVal && refVal.schema) {
|
||||
if (!equal(schema, refVal.schema))
|
||||
throw new Error('id "' + id + '" resolves to more than one schema');
|
||||
} else if (id != normalizeId(fullPath)) {
|
||||
if (id[0] == '#') {
|
||||
if (localRefs[id] && !equal(schema, localRefs[id]))
|
||||
throw new Error('id "' + id + '" resolves to more than one schema');
|
||||
localRefs[id] = schema;
|
||||
} else {
|
||||
this._refs[id] = fullPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var key in schema)
|
||||
_resolveIds.call(this, schema[key], fullPath+'/'+util.escapeFragment(key), baseId);
|
||||
}
|
||||
}
|
||||
}
|
||||
40
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/rules.js
generated
vendored
Normal file
40
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/rules.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
|
||||
var ruleModules = require('./_rules')
|
||||
, toHash = require('./util').toHash;
|
||||
|
||||
module.exports = function rules() {
|
||||
var RULES = [
|
||||
{ type: 'number',
|
||||
rules: [ 'maximum', 'minimum', 'multipleOf'] },
|
||||
{ type: 'string',
|
||||
rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] },
|
||||
{ type: 'array',
|
||||
rules: [ 'maxItems', 'minItems', 'uniqueItems', 'items' ] },
|
||||
{ type: 'object',
|
||||
rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'properties' ] },
|
||||
{ rules: [ '$ref', 'enum', 'not', 'anyOf', 'oneOf', 'allOf' ] }
|
||||
];
|
||||
|
||||
var ALL = [ 'type', 'additionalProperties', 'patternProperties' ];
|
||||
var KEYWORDS = [ 'additionalItems', '$schema', 'id', 'title', 'description', 'default' ];
|
||||
var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ];
|
||||
RULES.all = toHash(ALL);
|
||||
|
||||
RULES.forEach(function (group) {
|
||||
group.rules = group.rules.map(function (keyword) {
|
||||
ALL.push(keyword);
|
||||
var rule = RULES.all[keyword] = {
|
||||
keyword: keyword,
|
||||
code: ruleModules[keyword]
|
||||
};
|
||||
return rule;
|
||||
});
|
||||
});
|
||||
|
||||
RULES.keywords = toHash(ALL.concat(KEYWORDS));
|
||||
RULES.types = toHash(TYPES);
|
||||
RULES.custom = {};
|
||||
|
||||
return RULES;
|
||||
};
|
||||
9
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/schema_obj.js
generated
vendored
Normal file
9
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/schema_obj.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var util = require('./util');
|
||||
|
||||
module.exports = SchemaObject;
|
||||
|
||||
function SchemaObject(obj) {
|
||||
util.copy(obj, this);
|
||||
}
|
||||
20
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/ucs2length.js
generated
vendored
Normal file
20
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/ucs2length.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
// https://mathiasbynens.be/notes/javascript-encoding
|
||||
// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode
|
||||
module.exports = function ucs2length(str) {
|
||||
var length = 0
|
||||
, len = str.length
|
||||
, pos = 0
|
||||
, value;
|
||||
while (pos < len) {
|
||||
length++;
|
||||
value = str.charCodeAt(pos++);
|
||||
if (value >= 0xD800 && value <= 0xDBFF && pos < len) {
|
||||
// high surrogate, and there is a next character
|
||||
value = str.charCodeAt(pos);
|
||||
if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate
|
||||
}
|
||||
}
|
||||
return length;
|
||||
};
|
||||
257
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/util.js
generated
vendored
Normal file
257
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/util.js
generated
vendored
Normal file
@ -0,0 +1,257 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
module.exports = {
|
||||
copy: copy,
|
||||
checkDataType: checkDataType,
|
||||
checkDataTypes: checkDataTypes,
|
||||
coerceToTypes: coerceToTypes,
|
||||
toHash: toHash,
|
||||
getProperty: getProperty,
|
||||
escapeQuotes: escapeQuotes,
|
||||
ucs2length: require('./ucs2length'),
|
||||
varOccurences: varOccurences,
|
||||
varReplace: varReplace,
|
||||
cleanUpCode: cleanUpCode,
|
||||
cleanUpVarErrors: cleanUpVarErrors,
|
||||
schemaHasRules: schemaHasRules,
|
||||
schemaHasRulesExcept: schemaHasRulesExcept,
|
||||
stableStringify: require('json-stable-stringify'),
|
||||
toQuotedString: toQuotedString,
|
||||
getPathExpr: getPathExpr,
|
||||
getPath: getPath,
|
||||
getData: getData,
|
||||
unescapeFragment: unescapeFragment,
|
||||
escapeFragment: escapeFragment,
|
||||
escapeJsonPointer: escapeJsonPointer
|
||||
};
|
||||
|
||||
|
||||
function copy(o, to) {
|
||||
to = to || {};
|
||||
for (var key in o) to[key] = o[key];
|
||||
return to;
|
||||
}
|
||||
|
||||
|
||||
function checkDataType(dataType, data, negate) {
|
||||
var EQUAL = negate ? ' !== ' : ' === '
|
||||
, AND = negate ? ' || ' : ' && '
|
||||
, OK = negate ? '!' : ''
|
||||
, NOT = negate ? '' : '!';
|
||||
switch (dataType) {
|
||||
case 'null': return data + EQUAL + 'null';
|
||||
case 'array': return OK + 'Array.isArray(' + data + ')';
|
||||
case 'object': return '(' + OK + data + AND +
|
||||
'typeof ' + data + EQUAL + '"object"' + AND +
|
||||
NOT + 'Array.isArray(' + data + '))';
|
||||
case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +
|
||||
NOT + '(' + data + ' % 1)' +
|
||||
AND + data + EQUAL + data + ')';
|
||||
default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkDataTypes(dataTypes, data) {
|
||||
switch (dataTypes.length) {
|
||||
case 1: return checkDataType(dataTypes[0], data, true);
|
||||
default:
|
||||
var code = '';
|
||||
var types = toHash(dataTypes);
|
||||
if (types.array && types.object) {
|
||||
code = types.null ? '(': '(!' + data + ' || ';
|
||||
code += 'typeof ' + data + ' !== "object")';
|
||||
delete types.null;
|
||||
delete types.array;
|
||||
delete types.object;
|
||||
}
|
||||
if (types.number) delete types.integer;
|
||||
for (var t in types)
|
||||
code += (code ? ' && ' : '' ) + checkDataType(t, data, true);
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]);
|
||||
function coerceToTypes(optionCoerceTypes, dataTypes) {
|
||||
if (Array.isArray(dataTypes)) {
|
||||
var types = [];
|
||||
for (var i=0; i<dataTypes.length; i++) {
|
||||
var t = dataTypes[i];
|
||||
if (COERCE_TO_TYPES[t]) types[types.length] = t;
|
||||
else if (optionCoerceTypes === 'array' && t === 'array') types[types.length] = t;
|
||||
}
|
||||
if (types.length) return types;
|
||||
} else if (COERCE_TO_TYPES[dataTypes]) {
|
||||
return [dataTypes];
|
||||
} else if (optionCoerceTypes === 'array' && dataTypes === 'array') {
|
||||
return ['array'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toHash(arr) {
|
||||
var hash = {};
|
||||
for (var i=0; i<arr.length; i++) hash[arr[i]] = true;
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
||||
var SINGLE_QUOTE = /'|\\/g;
|
||||
function getProperty(key) {
|
||||
return typeof key == 'number'
|
||||
? '[' + key + ']'
|
||||
: IDENTIFIER.test(key)
|
||||
? '.' + key
|
||||
: "['" + escapeQuotes(key) + "']";
|
||||
}
|
||||
|
||||
|
||||
function escapeQuotes(str) {
|
||||
return str.replace(SINGLE_QUOTE, '\\$&')
|
||||
.replace(/\n/g, '\\n')
|
||||
.replace(/\r/g, '\\r')
|
||||
.replace(/\f/g, '\\f')
|
||||
.replace(/\t/g, '\\t');
|
||||
}
|
||||
|
||||
|
||||
function varOccurences(str, dataVar) {
|
||||
dataVar += '[^0-9]';
|
||||
var matches = str.match(new RegExp(dataVar, 'g'));
|
||||
return matches ? matches.length : 0;
|
||||
}
|
||||
|
||||
|
||||
function varReplace(str, dataVar, expr) {
|
||||
dataVar += '([^0-9])';
|
||||
expr = expr.replace(/\$/g, '$$$$');
|
||||
return str.replace(new RegExp(dataVar, 'g'), expr + '$1');
|
||||
}
|
||||
|
||||
|
||||
var EMPTY_ELSE = /else\s*{\s*}/g
|
||||
, EMPTY_IF_NO_ELSE = /if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g
|
||||
, EMPTY_IF_WITH_ELSE = /if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g;
|
||||
function cleanUpCode(out) {
|
||||
return out.replace(EMPTY_ELSE, '')
|
||||
.replace(EMPTY_IF_NO_ELSE, '')
|
||||
.replace(EMPTY_IF_WITH_ELSE, 'if (!($1))');
|
||||
}
|
||||
|
||||
|
||||
var ERRORS_REGEXP = /[^v\.]errors/g
|
||||
, REMOVE_ERRORS = /var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g
|
||||
, REMOVE_ERRORS_ASYNC = /var errors = 0;|var vErrors = null;/g
|
||||
, RETURN_VALID = 'return errors === 0;'
|
||||
, RETURN_TRUE = 'validate.errors = null; return true;'
|
||||
, RETURN_ASYNC = /if \(errors === 0\) return true;\s*else throw new ValidationError\(vErrors\);/
|
||||
, RETURN_TRUE_ASYNC = 'return true;';
|
||||
|
||||
function cleanUpVarErrors(out, async) {
|
||||
var matches = out.match(ERRORS_REGEXP);
|
||||
if (!matches || matches.length !== 2) return out;
|
||||
return async
|
||||
? out.replace(REMOVE_ERRORS_ASYNC, '')
|
||||
.replace(RETURN_ASYNC, RETURN_TRUE_ASYNC)
|
||||
: out.replace(REMOVE_ERRORS, '')
|
||||
.replace(RETURN_VALID, RETURN_TRUE);
|
||||
}
|
||||
|
||||
|
||||
function schemaHasRules(schema, rules) {
|
||||
for (var key in schema) if (rules[key]) return true;
|
||||
}
|
||||
|
||||
|
||||
function schemaHasRulesExcept(schema, rules, exceptKeyword) {
|
||||
for (var key in schema) if (key != exceptKeyword && rules[key]) return true;
|
||||
}
|
||||
|
||||
|
||||
function toQuotedString(str) {
|
||||
return '\'' + escapeQuotes(str) + '\'';
|
||||
}
|
||||
|
||||
|
||||
function getPathExpr(currentPath, expr, jsonPointers, isNumber) {
|
||||
var path = jsonPointers // false by default
|
||||
? '\'/\' + ' + expr + (isNumber ? '' : '.replace(/~/g, \'~0\').replace(/\\//g, \'~1\')')
|
||||
: (isNumber ? '\'[\' + ' + expr + ' + \']\'' : '\'[\\\'\' + ' + expr + ' + \'\\\']\'');
|
||||
return joinPaths(currentPath, path);
|
||||
}
|
||||
|
||||
|
||||
function getPath(currentPath, prop, jsonPointers) {
|
||||
var path = jsonPointers // false by default
|
||||
? toQuotedString('/' + escapeJsonPointer(prop))
|
||||
: toQuotedString(getProperty(prop));
|
||||
return joinPaths(currentPath, path);
|
||||
}
|
||||
|
||||
|
||||
var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
|
||||
var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
|
||||
function getData($data, lvl, paths) {
|
||||
var up, jsonPointer, data, matches;
|
||||
if ($data === '') return 'rootData';
|
||||
if ($data[0] == '/') {
|
||||
if (!JSON_POINTER.test($data)) throw new Error('Invalid JSON-pointer: ' + $data);
|
||||
jsonPointer = $data;
|
||||
data = 'rootData';
|
||||
} else {
|
||||
matches = $data.match(RELATIVE_JSON_POINTER);
|
||||
if (!matches) throw new Error('Invalid JSON-pointer: ' + $data);
|
||||
up = +matches[1];
|
||||
jsonPointer = matches[2];
|
||||
if (jsonPointer == '#') {
|
||||
if (up >= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl);
|
||||
return paths[lvl - up];
|
||||
}
|
||||
|
||||
if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl);
|
||||
data = 'data' + ((lvl - up) || '');
|
||||
if (!jsonPointer) return data;
|
||||
}
|
||||
|
||||
var expr = data;
|
||||
var segments = jsonPointer.split('/');
|
||||
for (var i=0; i<segments.length; i++) {
|
||||
var segment = segments[i];
|
||||
if (segment) {
|
||||
data += getProperty(unescapeJsonPointer(segment));
|
||||
expr += ' && ' + data;
|
||||
}
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
|
||||
|
||||
function joinPaths (a, b) {
|
||||
if (a == '""') return b;
|
||||
return (a + ' + ' + b).replace(/' \+ '/g, '');
|
||||
}
|
||||
|
||||
|
||||
function unescapeFragment(str) {
|
||||
return unescapeJsonPointer(decodeURIComponent(str));
|
||||
}
|
||||
|
||||
|
||||
function escapeFragment(str) {
|
||||
return encodeURIComponent(escapeJsonPointer(str));
|
||||
}
|
||||
|
||||
|
||||
function escapeJsonPointer(str) {
|
||||
return str.replace(/~/g, '~0').replace(/\//g, '~1');
|
||||
}
|
||||
|
||||
|
||||
function unescapeJsonPointer(str) {
|
||||
return str.replace(/~1/g, '/').replace(/~0/g, '~');
|
||||
}
|
||||
14
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/validation_error.js
generated
vendored
Normal file
14
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/compile/validation_error.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = ValidationError;
|
||||
|
||||
|
||||
function ValidationError(errors) {
|
||||
this.message = 'validation failed';
|
||||
this.errors = errors;
|
||||
this.ajv = this.validation = true;
|
||||
}
|
||||
|
||||
|
||||
ValidationError.prototype = Object.create(Error.prototype);
|
||||
ValidationError.prototype.constructor = ValidationError;
|
||||
49
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/_limit.jst
generated
vendored
Normal file
49
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/_limit.jst
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{
|
||||
var $isMax = $keyword == 'maximum'
|
||||
, $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum'
|
||||
, $schemaExcl = it.schema[$exclusiveKeyword]
|
||||
, $isDataExcl = it.opts.v5 && $schemaExcl && $schemaExcl.$data
|
||||
, $op = $isMax ? '<' : '>'
|
||||
, $notOp = $isMax ? '>' : '<';
|
||||
}}
|
||||
|
||||
{{? $isDataExcl }}
|
||||
{{
|
||||
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr)
|
||||
, $exclusive = 'exclusive' + $lvl
|
||||
, $opExpr = 'op' + $lvl
|
||||
, $opStr = '\' + ' + $opExpr + ' + \'';
|
||||
}}
|
||||
var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}};
|
||||
{{ $schemaValueExcl = 'schemaExcl' + $lvl; }}
|
||||
|
||||
var exclusive{{=$lvl}};
|
||||
if (typeof {{=$schemaValueExcl}} != 'boolean' && typeof {{=$schemaValueExcl}} != 'undefined') {
|
||||
{{ var $errorKeyword = $exclusiveKeyword; }}
|
||||
{{# def.error:'_exclusiveLimit' }}
|
||||
} else if({{# def.$dataNotType:'number' }}
|
||||
((exclusive{{=$lvl}} = {{=$schemaValueExcl}} === true)
|
||||
? {{=$data}} {{=$notOp}}= {{=$schemaValue}}
|
||||
: {{=$data}} {{=$notOp}} {{=$schemaValue}})
|
||||
|| {{=$data}} !== {{=$data}}) {
|
||||
var op{{=$lvl}} = exclusive{{=$lvl}} ? '{{=$op}}' : '{{=$op}}=';
|
||||
{{??}}
|
||||
{{
|
||||
var $exclusive = $schemaExcl === true
|
||||
, $opStr = $op; /*used in error*/
|
||||
if (!$exclusive) $opStr += '=';
|
||||
var $opExpr = '\'' + $opStr + '\''; /*used in error*/
|
||||
}}
|
||||
|
||||
if ({{# def.$dataNotType:'number' }}
|
||||
{{=$data}} {{=$notOp}}{{?$exclusive}}={{?}} {{=$schemaValue}}
|
||||
|| {{=$data}} !== {{=$data}}) {
|
||||
{{?}}
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
{{# def.error:'_limit' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
10
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/_limitItems.jst
generated
vendored
Normal file
10
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/_limitItems.jst
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{ var $op = $keyword == 'maxItems' ? '>' : '<'; }}
|
||||
if ({{# def.$dataNotType:'number' }} {{=$data}}.length {{=$op}} {{=$schemaValue}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
{{# def.error:'_limitItems' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
10
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/_limitLength.jst
generated
vendored
Normal file
10
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/_limitLength.jst
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{ var $op = $keyword == 'maxLength' ? '>' : '<'; }}
|
||||
if ({{# def.$dataNotType:'number' }} {{# def.strLength }} {{=$op}} {{=$schemaValue}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
{{# def.error:'_limitLength' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
10
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/_limitProperties.jst
generated
vendored
Normal file
10
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/_limitProperties.jst
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{ var $op = $keyword == 'maxProperties' ? '>' : '<'; }}
|
||||
if ({{# def.$dataNotType:'number' }} Object.keys({{=$data}}).length {{=$op}} {{=$schemaValue}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
{{# def.error:'_limitProperties' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
34
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/allOf.jst
generated
vendored
Normal file
34
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/allOf.jst
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
{{
|
||||
var $currentBaseId = $it.baseId
|
||||
, $allSchemasEmpty = true;
|
||||
}}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{
|
||||
$allSchemasEmpty = false;
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{? $allSchemasEmpty }}
|
||||
if (true) {
|
||||
{{??}}
|
||||
{{= $closingBraces.slice(0,-1) }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
48
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/anyOf.jst
generated
vendored
Normal file
48
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/anyOf.jst
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
{{
|
||||
var $noEmptySchema = $schema.every(function($sch) {
|
||||
return {{# def.nonEmptySchema:$sch }};
|
||||
});
|
||||
}}
|
||||
{{? $noEmptySchema }}
|
||||
{{ var $currentBaseId = $it.baseId; }}
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}} = false;
|
||||
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
|
||||
{{=$valid}} = {{=$valid}} || {{=$nextValid}};
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{~}}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.addError:'anyOf' }}
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
{{??}}
|
||||
{{? $breakOnError }}
|
||||
if (true) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
61
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/coerce.def
generated
vendored
Normal file
61
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/coerce.def
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
{{## def.coerceType:
|
||||
{{
|
||||
var $dataType = 'dataType' + $lvl
|
||||
, $coerced = 'coerced' + $lvl;
|
||||
}}
|
||||
var {{=$dataType}} = typeof {{=$data}};
|
||||
{{? it.opts.coerceTypes == 'array'}}
|
||||
if ({{=$dataType}} == 'object' && Array.isArray({{=$data}})) {{=$dataType}} = 'array';
|
||||
{{?}}
|
||||
|
||||
var {{=$coerced}} = undefined;
|
||||
|
||||
{{ var $bracesCoercion = ''; }}
|
||||
{{~ $coerceToTypes:$type:$i }}
|
||||
{{? $i }}
|
||||
if ({{=$coerced}} === undefined) {
|
||||
{{ $bracesCoercion += '}'; }}
|
||||
{{?}}
|
||||
|
||||
{{? it.opts.coerceTypes == 'array' && $type != 'array' }}
|
||||
if ({{=$dataType}} == 'array' && {{=$data}}.length == 1) {
|
||||
{{=$coerced}} = {{=$data}} = {{=$data}}[0];
|
||||
{{=$dataType}} = typeof {{=$data}};
|
||||
/*if ({{=$dataType}} == 'object' && Array.isArray({{=$data}})) {{=$dataType}} = 'array';*/
|
||||
}
|
||||
{{?}}
|
||||
|
||||
{{? $type == 'string' }}
|
||||
if ({{=$dataType}} == 'number' || {{=$dataType}} == 'boolean')
|
||||
{{=$coerced}} = '' + {{=$data}};
|
||||
else if ({{=$data}} === null) {{=$coerced}} = '';
|
||||
{{?? $type == 'number' || $type == 'integer' }}
|
||||
if ({{=$dataType}} == 'boolean' || {{=$data}} === null
|
||||
|| ({{=$dataType}} == 'string' && {{=$data}} && {{=$data}} == +{{=$data}}
|
||||
{{? $type == 'integer' }} && !({{=$data}} % 1){{?}}))
|
||||
{{=$coerced}} = +{{=$data}};
|
||||
{{?? $type == 'boolean' }}
|
||||
if ({{=$data}} === 'false' || {{=$data}} === 0 || {{=$data}} === null)
|
||||
{{=$coerced}} = false;
|
||||
else if ({{=$data}} === 'true' || {{=$data}} === 1)
|
||||
{{=$coerced}} = true;
|
||||
{{?? $type == 'null' }}
|
||||
if ({{=$data}} === '' || {{=$data}} === 0 || {{=$data}} === false)
|
||||
{{=$coerced}} = null;
|
||||
{{?? it.opts.coerceTypes == 'array' && $type == 'array' }}
|
||||
if ({{=$dataType}} == 'string' || {{=$dataType}} == 'number' || {{=$dataType}} == 'boolean' || {{=$data}} == null)
|
||||
{{=$coerced}} = [{{=$data}}];
|
||||
{{?}}
|
||||
{{~}}
|
||||
|
||||
{{= $bracesCoercion }}
|
||||
|
||||
if ({{=$coerced}} === undefined) {
|
||||
{{# def.error:'type' }}
|
||||
} else {
|
||||
{{# def.setParentData }}
|
||||
{{=$data}} = {{=$coerced}};
|
||||
{{? !$dataLvl }}if ({{=$parentData}} !== undefined){{?}}
|
||||
{{=$parentData}}[{{=$parentDataProperty}}] = {{=$coerced}};
|
||||
}
|
||||
#}}
|
||||
184
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/custom.jst
generated
vendored
Normal file
184
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/custom.jst
generated
vendored
Normal file
@ -0,0 +1,184 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{
|
||||
var $rule = this
|
||||
, $definition = 'definition' + $lvl
|
||||
, $rDef = $rule.definition;
|
||||
var $validate = $rDef.validate;
|
||||
var $compile, $inline, $macro, $ruleValidate, $validateCode;
|
||||
}}
|
||||
|
||||
{{? $isData && $rDef.$data }}
|
||||
{{
|
||||
$validateCode = 'keywordValidate' + $lvl;
|
||||
var $validateSchema = $rDef.validateSchema;
|
||||
}}
|
||||
var {{=$definition}} = RULES.custom['{{=$keyword}}'].definition;
|
||||
var {{=$validateCode}} = {{=$definition}}.validate;
|
||||
{{??}}
|
||||
{{
|
||||
$ruleValidate = it.useCustomRule($rule, $schema, it.schema, it);
|
||||
$schemaValue = 'validate.schema' + $schemaPath;
|
||||
$validateCode = $ruleValidate.code;
|
||||
$compile = $rDef.compile;
|
||||
$inline = $rDef.inline;
|
||||
$macro = $rDef.macro;
|
||||
}}
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
var $ruleErrs = $validateCode + '.errors'
|
||||
, $i = 'i' + $lvl
|
||||
, $ruleErr = 'ruleErr' + $lvl
|
||||
, $asyncKeyword = $rDef.async;
|
||||
|
||||
if ($asyncKeyword && !it.async)
|
||||
throw new Error('async keyword in sync schema');
|
||||
}}
|
||||
|
||||
|
||||
{{? !($inline || $macro) }}{{=$ruleErrs}} = null;{{?}}
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}};
|
||||
|
||||
{{## def.callRuleValidate:
|
||||
{{=$validateCode}}.call(
|
||||
{{? it.opts.passContext }}this{{??}}self{{?}}
|
||||
{{? $compile || $rDef.schema === false }}
|
||||
, {{=$data}}
|
||||
{{??}}
|
||||
, {{=$schemaValue}}
|
||||
, {{=$data}}
|
||||
, validate.schema{{=it.schemaPath}}
|
||||
{{?}}
|
||||
, {{# def.dataPath }}
|
||||
{{# def.passParentData }}
|
||||
, rootData
|
||||
)
|
||||
#}}
|
||||
|
||||
{{## def.extendErrors:_inline:
|
||||
for (var {{=$i}}={{=$errs}}; {{=$i}}<errors; {{=$i}}++) {
|
||||
var {{=$ruleErr}} = vErrors[{{=$i}}];
|
||||
if ({{=$ruleErr}}.dataPath === undefined)
|
||||
{{=$ruleErr}}.dataPath = (dataPath || '') + {{= it.errorPath }};
|
||||
{{# _inline ? 'if (\{\{=$ruleErr\}\}.schemaPath === undefined) {' : '' }}
|
||||
{{=$ruleErr}}.schemaPath = "{{=$errSchemaPath}}";
|
||||
{{# _inline ? '}' : '' }}
|
||||
{{? it.opts.verbose }}
|
||||
{{=$ruleErr}}.schema = {{=$schemaValue}};
|
||||
{{=$ruleErr}}.data = {{=$data}};
|
||||
{{?}}
|
||||
}
|
||||
#}}
|
||||
|
||||
|
||||
{{? $validateSchema }}
|
||||
{{=$valid}} = {{=$definition}}.validateSchema({{=$schemaValue}});
|
||||
if ({{=$valid}}) {
|
||||
{{?}}
|
||||
|
||||
{{? $inline }}
|
||||
{{? $rDef.statements }}
|
||||
{{= $ruleValidate.validate }}
|
||||
{{??}}
|
||||
{{=$valid}} = {{= $ruleValidate.validate }};
|
||||
{{?}}
|
||||
{{?? $macro }}
|
||||
{{# def.setupNextLevel }}
|
||||
{{
|
||||
$it.schema = $ruleValidate.validate;
|
||||
$it.schemaPath = '';
|
||||
}}
|
||||
{{# def.setCompositeRule }}
|
||||
{{ var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); }}
|
||||
{{# def.resetCompositeRule }}
|
||||
{{= $code }}
|
||||
{{??}}
|
||||
{{# def.beginDefOut}}
|
||||
{{# def.callRuleValidate }}
|
||||
{{# def.storeDefOut:def_callRuleValidate }}
|
||||
|
||||
{{? $rDef.errors === false }}
|
||||
{{=$valid}} = {{? $asyncKeyword }}{{=it.yieldAwait}}{{?}}{{= def_callRuleValidate }};
|
||||
{{??}}
|
||||
{{? $asyncKeyword }}
|
||||
{{ $ruleErrs = 'customErrors' + $lvl; }}
|
||||
var {{=$ruleErrs}} = null;
|
||||
try {
|
||||
{{=$valid}} = {{=it.yieldAwait}}{{= def_callRuleValidate }};
|
||||
} catch (e) {
|
||||
{{=$valid}} = false;
|
||||
if (e instanceof ValidationError) {{=$ruleErrs}} = e.errors;
|
||||
else throw e;
|
||||
}
|
||||
{{??}}
|
||||
{{=$ruleErrs}} = null;
|
||||
{{=$valid}} = {{= def_callRuleValidate }};
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? $rDef.modifying }}
|
||||
{{=$data}} = {{=$parentData}}[{{=$parentDataProperty}}];
|
||||
{{?}}
|
||||
|
||||
{{? $validateSchema }}
|
||||
}
|
||||
{{?}}
|
||||
|
||||
{{## def.notValidationResult:
|
||||
{{? $rDef.valid === undefined }}
|
||||
!{{? $macro }}{{=$nextValid}}{{??}}{{=$valid}}{{?}}
|
||||
{{??}}
|
||||
{{= !$rDef.valid }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
{{? $rDef.valid }}
|
||||
{{? $breakOnError }} if (true) { {{?}}
|
||||
{{??}}
|
||||
if ({{# def.notValidationResult }}) {
|
||||
{{ $errorKeyword = $rule.keyword; }}
|
||||
{{# def.beginDefOut}}
|
||||
{{# def.error:'custom' }}
|
||||
{{# def.storeDefOut:def_customError }}
|
||||
|
||||
{{? $inline }}
|
||||
{{? $rDef.errors }}
|
||||
{{? $rDef.errors != 'full' }}
|
||||
{{# def.extendErrors:true }}
|
||||
{{?}}
|
||||
{{??}}
|
||||
{{? $rDef.errors === false}}
|
||||
{{= def_customError }}
|
||||
{{??}}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{= def_customError }}
|
||||
} else {
|
||||
{{# def.extendErrors:true }}
|
||||
}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{?? $macro }}
|
||||
{{# def.extraError:'custom' }}
|
||||
{{??}}
|
||||
{{? $rDef.errors === false}}
|
||||
{{= def_customError }}
|
||||
{{??}}
|
||||
if (Array.isArray({{=$ruleErrs}})) {
|
||||
if (vErrors === null) vErrors = {{=$ruleErrs}};
|
||||
else vErrors = vErrors.concat({{=$ruleErrs}});
|
||||
errors = vErrors.length;
|
||||
{{# def.extendErrors:false }}
|
||||
} else {
|
||||
{{= def_customError }}
|
||||
}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
{{?}}
|
||||
32
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/defaults.def
generated
vendored
Normal file
32
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/defaults.def
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
{{## def.assignDefault:
|
||||
if ({{=$passData}} === undefined)
|
||||
{{=$passData}} = {{? it.opts.useDefaults == 'shared' }}
|
||||
{{= it.useDefault($sch.default) }}
|
||||
{{??}}
|
||||
{{= JSON.stringify($sch.default) }}
|
||||
{{?}};
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.defaultProperties:
|
||||
{{
|
||||
var $schema = it.schema.properties
|
||||
, $schemaKeys = Object.keys($schema); }}
|
||||
{{~ $schemaKeys:$propertyKey }}
|
||||
{{ var $sch = $schema[$propertyKey]; }}
|
||||
{{? $sch.default !== undefined }}
|
||||
{{ var $passData = $data + it.util.getProperty($propertyKey); }}
|
||||
{{# def.assignDefault }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.defaultItems:
|
||||
{{~ it.schema.items:$sch:$i }}
|
||||
{{? $sch.default !== undefined }}
|
||||
{{ var $passData = $data + '[' + $i + ']'; }}
|
||||
{{# def.assignDefault }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
#}}
|
||||
182
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/definitions.def
generated
vendored
Normal file
182
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/definitions.def
generated
vendored
Normal file
@ -0,0 +1,182 @@
|
||||
{{## def.setupKeyword:
|
||||
{{
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.setCompositeRule:
|
||||
{{
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.resetCompositeRule:
|
||||
{{ it.compositeRule = $it.compositeRule = $wasComposite; }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.setupNextLevel:
|
||||
{{
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.ifValid:
|
||||
{{? $breakOnError }}
|
||||
if ({{=$valid}}) {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.ifResultValid:
|
||||
{{? $breakOnError }}
|
||||
if ({{=$nextValid}}) {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.elseIfValid:
|
||||
{{? $breakOnError }}
|
||||
{{ $closingBraces += '}'; }}
|
||||
else {
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.nonEmptySchema:_schema:
|
||||
it.util.schemaHasRules(_schema, it.RULES.all)
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.strLength:
|
||||
{{? it.opts.unicode === false }}
|
||||
{{=$data}}.length
|
||||
{{??}}
|
||||
ucs2length({{=$data}})
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.willOptimize:
|
||||
it.util.varOccurences($code, $nextData) < 2
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.generateSubschemaCode:
|
||||
{{
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.insertSubschemaCode:
|
||||
{{= it.validate($it) }}
|
||||
{{ $it.baseId = $currentBaseId; }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def._optimizeValidate:
|
||||
it.util.varReplace($code, $nextData, $passData)
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.optimizeValidate:
|
||||
{{? {{# def.willOptimize}} }}
|
||||
{{= {{# def._optimizeValidate }} }}
|
||||
{{??}}
|
||||
var {{=$nextData}} = {{=$passData}};
|
||||
{{= $code }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.cleanUp: {{ out = it.util.cleanUpCode(out); }} #}}
|
||||
|
||||
|
||||
{{## def.cleanUpVarErrors: {{ out = it.util.cleanUpVarErrors(out, $async); }} #}}
|
||||
|
||||
|
||||
{{## def.$data:
|
||||
{{
|
||||
var $isData = it.opts.v5 && $schema && $schema.$data
|
||||
, $schemaValue;
|
||||
}}
|
||||
{{? $isData }}
|
||||
var schema{{=$lvl}} = {{= it.util.getData($schema.$data, $dataLvl, it.dataPathArr) }};
|
||||
{{ $schemaValue = 'schema' + $lvl; }}
|
||||
{{??}}
|
||||
{{ $schemaValue = $schema; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.$dataNotType:_type:
|
||||
{{?$isData}} ({{=$schemaValue}} !== undefined && typeof {{=$schemaValue}} != _type) || {{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.check$dataIsArray:
|
||||
if (schema{{=$lvl}} === undefined) {{=$valid}} = true;
|
||||
else if (!Array.isArray(schema{{=$lvl}})) {{=$valid}} = false;
|
||||
else {
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.beginDefOut:
|
||||
{{
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = '';
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.storeDefOut:_variable:
|
||||
{{
|
||||
var _variable = out;
|
||||
out = $$outStack.pop();
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.dataPath:(dataPath || ''){{? it.errorPath != '""'}} + {{= it.errorPath }}{{?}}#}}
|
||||
|
||||
{{## def.setParentData:
|
||||
{{
|
||||
var $parentData = $dataLvl ? 'data' + (($dataLvl-1)||'') : 'parentData'
|
||||
, $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
|
||||
}}
|
||||
#}}
|
||||
|
||||
{{## def.passParentData:
|
||||
{{# def.setParentData }}
|
||||
, {{= $parentData }}
|
||||
, {{= $parentDataProperty }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.checkOwnProperty:
|
||||
{{? $ownProperties }}
|
||||
if (!Object.prototype.hasOwnProperty.call({{=$data}}, {{=$key}})) continue;
|
||||
{{?}}
|
||||
#}}
|
||||
69
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/dependencies.jst
generated
vendored
Normal file
69
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/dependencies.jst
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.missing }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{
|
||||
var $schemaDeps = {}
|
||||
, $propertyDeps = {};
|
||||
|
||||
for ($property in $schema) {
|
||||
var $sch = $schema[$property];
|
||||
var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
|
||||
$deps[$property] = $sch;
|
||||
}
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
|
||||
{{ var $currentErrorPath = it.errorPath; }}
|
||||
|
||||
var missing{{=$lvl}};
|
||||
{{ for (var $property in $propertyDeps) { }}
|
||||
{{ $deps = $propertyDeps[$property]; }}
|
||||
if ({{=$data}}{{= it.util.getProperty($property) }} !== undefined
|
||||
{{? $breakOnError }}
|
||||
&& ({{# def.checkMissingProperty:$deps }})) {
|
||||
{{# def.errorMissingProperty:'dependencies' }}
|
||||
{{??}}
|
||||
) {
|
||||
{{~ $deps:$reqProperty }}
|
||||
{{# def.allErrorsMissingProperty:'dependencies' }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
} {{# def.elseIfValid }}
|
||||
{{ } }}
|
||||
|
||||
{{
|
||||
it.errorPath = $currentErrorPath;
|
||||
var $currentBaseId = $it.baseId;
|
||||
}}
|
||||
|
||||
|
||||
{{ for (var $property in $schemaDeps) { }}
|
||||
{{ var $sch = $schemaDeps[$property]; }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{=$nextValid}} = true;
|
||||
|
||||
if ({{=$data}}{{= it.util.getProperty($property) }} !== undefined) {
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + it.util.getProperty($property);
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
{{ } }}
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
30
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/enum.jst
generated
vendored
Normal file
30
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/enum.jst
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{
|
||||
var $i = 'i' + $lvl
|
||||
, $vSchema = 'schema' + $lvl;
|
||||
}}
|
||||
|
||||
{{? !$isData }}
|
||||
var {{=$vSchema}} = validate.schema{{=$schemaPath}};
|
||||
{{?}}
|
||||
var {{=$valid}};
|
||||
|
||||
{{?$isData}}{{# def.check$dataIsArray }}{{?}}
|
||||
|
||||
{{=$valid}} = false;
|
||||
|
||||
for (var {{=$i}}=0; {{=$i}}<{{=$vSchema}}.length; {{=$i}}++)
|
||||
if (equal({{=$data}}, {{=$vSchema}}[{{=$i}}])) {
|
||||
{{=$valid}} = true;
|
||||
break;
|
||||
}
|
||||
|
||||
{{? $isData }} } {{?}}
|
||||
|
||||
{{# def.checkError:'enum' }}
|
||||
|
||||
{{? $breakOnError }} else { {{?}}
|
||||
185
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/errors.def
generated
vendored
Normal file
185
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/errors.def
generated
vendored
Normal file
@ -0,0 +1,185 @@
|
||||
{{# def.definitions }}
|
||||
|
||||
{{## def._error:_rule:
|
||||
{{ 'istanbul ignore else'; }}
|
||||
{{? it.createErrors !== false }}
|
||||
{
|
||||
keyword: '{{= $errorKeyword || _rule }}'
|
||||
, dataPath: (dataPath || '') + {{= it.errorPath }}
|
||||
, schemaPath: {{=it.util.toQuotedString($errSchemaPath)}}
|
||||
, params: {{# def._errorParams[_rule] }}
|
||||
{{? it.opts.messages !== false }}
|
||||
, message: {{# def._errorMessages[_rule] }}
|
||||
{{?}}
|
||||
{{? it.opts.verbose }}
|
||||
, schema: {{# def._errorSchemas[_rule] }}
|
||||
, parentSchema: validate.schema{{=it.schemaPath}}
|
||||
, data: {{=$data}}
|
||||
{{?}}
|
||||
}
|
||||
{{??}}
|
||||
{}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def._addError:_rule:
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.addError:_rule:
|
||||
var err = {{# def._error:_rule }};
|
||||
{{# def._addError:_rule }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.error:_rule:
|
||||
{{# def.beginDefOut}}
|
||||
{{# def._error:_rule }}
|
||||
{{# def.storeDefOut:__err }}
|
||||
|
||||
{{? !it.compositeRule && $breakOnError }}
|
||||
{{ 'istanbul ignore if'; }}
|
||||
{{? it.async }}
|
||||
throw new ValidationError([{{=__err}}]);
|
||||
{{??}}
|
||||
validate.errors = [{{=__err}}];
|
||||
return false;
|
||||
{{?}}
|
||||
{{??}}
|
||||
var err = {{=__err}};
|
||||
{{# def._addError:_rule }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.extraError:_rule:
|
||||
{{# def.addError:_rule}}
|
||||
{{? !it.compositeRule && $breakOnError }}
|
||||
{{ 'istanbul ignore if'; }}
|
||||
{{? it.async }}
|
||||
throw new ValidationError(vErrors);
|
||||
{{??}}
|
||||
validate.errors = vErrors;
|
||||
return false;
|
||||
{{?}}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.checkError:_rule:
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.error:_rule }}
|
||||
}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.resetErrors:
|
||||
errors = {{=$errs}};
|
||||
if (vErrors !== null) {
|
||||
if ({{=$errs}}) vErrors.length = {{=$errs}};
|
||||
else vErrors = null;
|
||||
}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.concatSchema:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=$schema}}{{?}}#}}
|
||||
{{## def.appendSchema:{{?$isData}}' + {{=$schemaValue}}{{??}}{{=$schema}}'{{?}}#}}
|
||||
{{## def.concatSchemaEQ:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=it.util.escapeQuotes($schema)}}{{?}}#}}
|
||||
|
||||
{{## def._errorMessages = {
|
||||
$ref: "'can\\\'t resolve reference {{=it.util.escapeQuotes($schema)}}'",
|
||||
additionalItems: "'should NOT have more than {{=$schema.length}} items'",
|
||||
additionalProperties: "'should NOT have additional properties'",
|
||||
anyOf: "'should match some schema in anyOf'",
|
||||
dependencies: "'should have {{? $deps.length == 1 }}property {{= it.util.escapeQuotes($deps[0]) }}{{??}}properties {{= it.util.escapeQuotes($deps.join(\", \")) }}{{?}} when property {{= it.util.escapeQuotes($property) }} is present'",
|
||||
'enum': "'should be equal to one of the allowed values'",
|
||||
format: "'should match format \"{{#def.concatSchemaEQ}}\"'",
|
||||
_limit: "'should be {{=$opStr}} {{#def.appendSchema}}",
|
||||
_exclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'",
|
||||
_limitItems: "'should NOT have {{?$keyword=='maxItems'}}more{{??}}less{{?}} than {{#def.concatSchema}} items'",
|
||||
_limitLength: "'should NOT be {{?$keyword=='maxLength'}}longer{{??}}shorter{{?}} than {{#def.concatSchema}} characters'",
|
||||
_limitProperties:"'should NOT have {{?$keyword=='maxProperties'}}more{{??}}less{{?}} than {{#def.concatSchema}} properties'",
|
||||
multipleOf: "'should be multiple of {{#def.appendSchema}}",
|
||||
not: "'should NOT be valid'",
|
||||
oneOf: "'should match exactly one schema in oneOf'",
|
||||
pattern: "'should match pattern \"{{#def.concatSchemaEQ}}\"'",
|
||||
required: "'{{? it.opts._errorDataPathProperty }}is a required property{{??}}should have required property \\'{{=$missingProperty}}\\'{{?}}'",
|
||||
type: "'should be {{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}'",
|
||||
uniqueItems: "'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)'",
|
||||
custom: "'should pass \"{{=$rule.keyword}}\" keyword validation'",
|
||||
patternGroups: "'should NOT have {{=$moreOrLess}} than {{=$limit}} properties matching pattern \"{{=it.util.escapeQuotes($pgProperty)}}\"'",
|
||||
patternRequired: "'should have property matching pattern \\'{{=$missingPattern}}\\''",
|
||||
switch: "'should pass \"switch\" keyword validation'",
|
||||
constant: "'should be equal to constant'",
|
||||
_formatLimit: "'should be {{=$opStr}} \"{{#def.concatSchemaEQ}}\"'",
|
||||
_formatExclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'"
|
||||
} #}}
|
||||
|
||||
|
||||
{{## def.schemaRefOrVal: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=$schema}}{{?}} #}}
|
||||
{{## def.schemaRefOrQS: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}}
|
||||
|
||||
{{## def._errorSchemas = {
|
||||
$ref: "{{=it.util.toQuotedString($schema)}}",
|
||||
additionalItems: "false",
|
||||
additionalProperties: "false",
|
||||
anyOf: "validate.schema{{=$schemaPath}}",
|
||||
dependencies: "validate.schema{{=$schemaPath}}",
|
||||
'enum': "validate.schema{{=$schemaPath}}",
|
||||
format: "{{#def.schemaRefOrQS}}",
|
||||
_limit: "{{#def.schemaRefOrVal}}",
|
||||
_exclusiveLimit: "validate.schema{{=$schemaPath}}",
|
||||
_limitItems: "{{#def.schemaRefOrVal}}",
|
||||
_limitLength: "{{#def.schemaRefOrVal}}",
|
||||
_limitProperties:"{{#def.schemaRefOrVal}}",
|
||||
multipleOf: "{{#def.schemaRefOrVal}}",
|
||||
not: "validate.schema{{=$schemaPath}}",
|
||||
oneOf: "validate.schema{{=$schemaPath}}",
|
||||
pattern: "{{#def.schemaRefOrQS}}",
|
||||
required: "validate.schema{{=$schemaPath}}",
|
||||
type: "validate.schema{{=$schemaPath}}",
|
||||
uniqueItems: "{{#def.schemaRefOrVal}}",
|
||||
custom: "validate.schema{{=$schemaPath}}",
|
||||
patternGroups: "validate.schema{{=$schemaPath}}",
|
||||
patternRequired: "validate.schema{{=$schemaPath}}",
|
||||
switch: "validate.schema{{=$schemaPath}}",
|
||||
constant: "validate.schema{{=$schemaPath}}",
|
||||
_formatLimit: "{{#def.schemaRefOrQS}}",
|
||||
_formatExclusiveLimit: "validate.schema{{=$schemaPath}}"
|
||||
} #}}
|
||||
|
||||
|
||||
{{## def.schemaValueQS: {{?$isData}}{{=$schemaValue}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}}
|
||||
|
||||
{{## def._errorParams = {
|
||||
$ref: "{ ref: '{{=it.util.escapeQuotes($schema)}}' }",
|
||||
additionalItems: "{ limit: {{=$schema.length}} }",
|
||||
additionalProperties: "{ additionalProperty: '{{=$additionalProperty}}' }",
|
||||
anyOf: "{}",
|
||||
dependencies: "{ property: '{{= it.util.escapeQuotes($property) }}', missingProperty: '{{=$missingProperty}}', depsCount: {{=$deps.length}}, deps: '{{= it.util.escapeQuotes($deps.length==1 ? $deps[0] : $deps.join(\", \")) }}' }",
|
||||
'enum': "{ allowedValues: schema{{=$lvl}} }",
|
||||
format: "{ format: {{#def.schemaValueQS}} }",
|
||||
_limit: "{ comparison: {{=$opExpr}}, limit: {{=$schemaValue}}, exclusive: {{=$exclusive}} }",
|
||||
_exclusiveLimit: "{}",
|
||||
_limitItems: "{ limit: {{=$schemaValue}} }",
|
||||
_limitLength: "{ limit: {{=$schemaValue}} }",
|
||||
_limitProperties:"{ limit: {{=$schemaValue}} }",
|
||||
multipleOf: "{ multipleOf: {{=$schemaValue}} }",
|
||||
not: "{}",
|
||||
oneOf: "{}",
|
||||
pattern: "{ pattern: {{#def.schemaValueQS}} }",
|
||||
required: "{ missingProperty: '{{=$missingProperty}}' }",
|
||||
type: "{ type: '{{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}' }",
|
||||
uniqueItems: "{ i: i, j: j }",
|
||||
custom: "{ keyword: '{{=$rule.keyword}}' }",
|
||||
patternGroups: "{ reason: '{{=$reason}}', limit: {{=$limit}}, pattern: '{{=it.util.escapeQuotes($pgProperty)}}' }",
|
||||
patternRequired: "{ missingPattern: '{{=$missingPattern}}' }",
|
||||
switch: "{ caseIndex: {{=$caseIndex}} }",
|
||||
constant: "{}",
|
||||
_formatLimit: "{ comparison: {{=$opExpr}}, limit: {{#def.schemaValueQS}}, exclusive: {{=$exclusive}} }",
|
||||
_formatExclusiveLimit: "{}"
|
||||
} #}}
|
||||
100
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/format.jst
generated
vendored
Normal file
100
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/format.jst
generated
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
{{## def.skipFormat:
|
||||
{{? $breakOnError }} if (true) { {{?}}
|
||||
{{ return out; }}
|
||||
#}}
|
||||
|
||||
{{? it.opts.format === false }}{{# def.skipFormat }}{{?}}
|
||||
|
||||
|
||||
{{# def.$data }}
|
||||
|
||||
|
||||
{{## def.$dataCheckFormat:
|
||||
{{# def.$dataNotType:'string' }}
|
||||
({{? $unknownFormats === true || $allowUnknown }}
|
||||
({{=$schemaValue}} && !{{=$format}}
|
||||
{{? $allowUnknown }}
|
||||
&& self._opts.unknownFormats.indexOf({{=$schemaValue}}) == -1
|
||||
{{?}}) ||
|
||||
{{?}}
|
||||
({{=$format}} && !(typeof {{=$format}} == 'function'
|
||||
? {{? it.async}}
|
||||
(async{{=$lvl}} ? {{=it.yieldAwait}} {{=$format}}({{=$data}}) : {{=$format}}({{=$data}}))
|
||||
{{??}}
|
||||
{{=$format}}({{=$data}})
|
||||
{{?}}
|
||||
: {{=$format}}.test({{=$data}}))))
|
||||
#}}
|
||||
|
||||
{{## def.checkFormat:
|
||||
{{
|
||||
var $formatRef = 'formats' + it.util.getProperty($schema);
|
||||
if ($isObject) $formatRef += '.validate';
|
||||
}}
|
||||
{{? typeof $format == 'function' }}
|
||||
{{=$formatRef}}({{=$data}})
|
||||
{{??}}
|
||||
{{=$formatRef}}.test({{=$data}})
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{
|
||||
var $unknownFormats = it.opts.unknownFormats
|
||||
, $allowUnknown = Array.isArray($unknownFormats);
|
||||
}}
|
||||
|
||||
{{? $isData }}
|
||||
{{ var $format = 'format' + $lvl; }}
|
||||
var {{=$format}} = formats[{{=$schemaValue}}];
|
||||
var isObject{{=$lvl}} = typeof {{=$format}} == 'object'
|
||||
&& !({{=$format}} instanceof RegExp)
|
||||
&& {{=$format}}.validate;
|
||||
if (isObject{{=$lvl}}) {
|
||||
{{? it.async}}
|
||||
var async{{=$lvl}} = {{=$format}}.async;
|
||||
{{?}}
|
||||
{{=$format}} = {{=$format}}.validate;
|
||||
}
|
||||
if ({{# def.$dataCheckFormat }}) {
|
||||
{{??}}
|
||||
{{ var $format = it.formats[$schema]; }}
|
||||
{{? !$format }}
|
||||
{{? $unknownFormats === true || ($allowUnknown && $unknownFormats.indexOf($schema) == -1) }}
|
||||
{{ throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); }}
|
||||
{{??}}
|
||||
{{
|
||||
if (!$allowUnknown) {
|
||||
console.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"');
|
||||
if ($unknownFormats !== 'ignore')
|
||||
console.warn('In the next major version it will throw exception. See option unknownFormats for more information');
|
||||
}
|
||||
}}
|
||||
{{# def.skipFormat }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{
|
||||
var $isObject = typeof $format == 'object'
|
||||
&& !($format instanceof RegExp)
|
||||
&& $format.validate;
|
||||
if ($isObject) {
|
||||
var $async = $format.async === true;
|
||||
$format = $format.validate;
|
||||
}
|
||||
}}
|
||||
{{? $async }}
|
||||
{{
|
||||
if (!it.async) throw new Error('async format in sync schema');
|
||||
var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate';
|
||||
}}
|
||||
if (!({{=it.yieldAwait}} {{=$formatRef}}({{=$data}}))) {
|
||||
{{??}}
|
||||
if (!{{# def.checkFormat }}) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{# def.error:'format' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
101
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/items.jst
generated
vendored
Normal file
101
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/items.jst
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.validateItems:startFrom:
|
||||
for (var {{=$idx}} = {{=startFrom}}; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) {
|
||||
{{
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
|
||||
var $passData = $data + '[' + $idx + ']';
|
||||
$it.dataPathArr[$dataNxt] = $idx;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
|
||||
{{? $breakOnError }}
|
||||
if (!{{=$nextValid}}) break;
|
||||
{{?}}
|
||||
}
|
||||
#}}
|
||||
|
||||
{{
|
||||
var $idx = 'i' + $lvl
|
||||
, $dataNxt = $it.dataLevel = it.dataLevel + 1
|
||||
, $nextData = 'data' + $dataNxt
|
||||
, $currentBaseId = it.baseId;
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}};
|
||||
|
||||
{{? Array.isArray($schema) }}
|
||||
{{ /* 'items' is an array of schemas */}}
|
||||
{{ var $additionalItems = it.schema.additionalItems; }}
|
||||
{{? $additionalItems === false }}
|
||||
{{=$valid}} = {{=$data}}.length <= {{= $schema.length }};
|
||||
{{
|
||||
var $currErrSchemaPath = $errSchemaPath;
|
||||
$errSchemaPath = it.errSchemaPath + '/additionalItems';
|
||||
}}
|
||||
{{# def.checkError:'additionalItems' }}
|
||||
{{ $errSchemaPath = $currErrSchemaPath; }}
|
||||
{{# def.elseIfValid}}
|
||||
{{?}}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{=$nextValid}} = true;
|
||||
|
||||
if ({{=$data}}.length > {{=$i}}) {
|
||||
{{
|
||||
var $passData = $data + '[' + $i + ']';
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true);
|
||||
$it.dataPathArr[$dataNxt] = $i;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
|
||||
{{? typeof $additionalItems == 'object' && {{# def.nonEmptySchema:$additionalItems }} }}
|
||||
{{
|
||||
$it.schema = $additionalItems;
|
||||
$it.schemaPath = it.schemaPath + '.additionalItems';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/additionalItems';
|
||||
}}
|
||||
{{=$nextValid}} = true;
|
||||
|
||||
if ({{=$data}}.length > {{= $schema.length }}) {
|
||||
{{# def.validateItems: $schema.length }}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
|
||||
{{?? {{# def.nonEmptySchema:$schema }} }}
|
||||
{{ /* 'items' is a single schema */}}
|
||||
{{
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
{{# def.validateItems: 0 }}
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
34
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/missing.def
generated
vendored
Normal file
34
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/missing.def
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
{{## def.checkMissingProperty:_properties:
|
||||
{{~ _properties:_$property:$i }}
|
||||
{{?$i}} || {{?}}
|
||||
{{ var $prop = it.util.getProperty(_$property); }}
|
||||
( {{=$data}}{{=$prop}} === undefined && (missing{{=$lvl}} = {{= it.util.toQuotedString(it.opts.jsonPointers ? _$property : $prop) }}) )
|
||||
{{~}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.errorMissingProperty:_error:
|
||||
{{
|
||||
var $propertyPath = 'missing' + $lvl
|
||||
, $missingProperty = '\' + ' + $propertyPath + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.opts.jsonPointers
|
||||
? it.util.getPathExpr($currentErrorPath, $propertyPath, true)
|
||||
: $currentErrorPath + ' + ' + $propertyPath;
|
||||
}
|
||||
}}
|
||||
{{# def.error:_error }}
|
||||
#}}
|
||||
|
||||
{{## def.allErrorsMissingProperty:_error:
|
||||
{{
|
||||
var $prop = it.util.getProperty($reqProperty)
|
||||
, $missingProperty = it.util.escapeQuotes($reqProperty);
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPath($currentErrorPath, $reqProperty, it.opts.jsonPointers);
|
||||
}
|
||||
}}
|
||||
if ({{=$data}}{{=$prop}} === undefined) {
|
||||
{{# def.addError:_error }}
|
||||
}
|
||||
#}}
|
||||
20
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/multipleOf.jst
generated
vendored
Normal file
20
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/multipleOf.jst
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
var division{{=$lvl}};
|
||||
if ({{?$isData}}
|
||||
{{=$schemaValue}} !== undefined && (
|
||||
typeof {{=$schemaValue}} != 'number' ||
|
||||
{{?}}
|
||||
(division{{=$lvl}} = {{=$data}} / {{=$schemaValue}},
|
||||
{{? it.opts.multipleOfPrecision }}
|
||||
Math.abs(Math.round(division{{=$lvl}}) - division{{=$lvl}}) > 1e-{{=it.opts.multipleOfPrecision}}
|
||||
{{??}}
|
||||
division{{=$lvl}} !== parseInt(division{{=$lvl}})
|
||||
{{?}}
|
||||
)
|
||||
{{?$isData}} ) {{?}} ) {
|
||||
{{# def.error:'multipleOf' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
43
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/not.jst
generated
vendored
Normal file
43
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/not.jst
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
{{? {{# def.nonEmptySchema:$schema }} }}
|
||||
{{
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{
|
||||
$it.createErrors = false;
|
||||
var $allErrorsOption;
|
||||
if ($it.opts.allErrors) {
|
||||
$allErrorsOption = $it.opts.allErrors;
|
||||
$it.opts.allErrors = false;
|
||||
}
|
||||
}}
|
||||
{{= it.validate($it) }}
|
||||
{{
|
||||
$it.createErrors = true;
|
||||
if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption;
|
||||
}}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
if ({{=$nextValid}}) {
|
||||
{{# def.error:'not' }}
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
||||
{{??}}
|
||||
{{# def.addError:'not' }}
|
||||
{{? $breakOnError}}
|
||||
if (false) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
44
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/oneOf.jst
generated
vendored
Normal file
44
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/oneOf.jst
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
var prevValid{{=$lvl}} = false;
|
||||
var {{=$valid}} = false;
|
||||
|
||||
{{ var $currentBaseId = $it.baseId; }}
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
{{??}}
|
||||
var {{=$nextValid}} = true;
|
||||
{{?}}
|
||||
|
||||
{{? $i }}
|
||||
if ({{=$nextValid}} && prevValid{{=$lvl}})
|
||||
{{=$valid}} = false;
|
||||
else {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
|
||||
if ({{=$nextValid}}) {{=$valid}} = prevValid{{=$lvl}} = true;
|
||||
{{~}}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.error:'oneOf' }}
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
||||
14
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/pattern.jst
generated
vendored
Normal file
14
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/pattern.jst
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{
|
||||
var $regexp = $isData
|
||||
? '(new RegExp(' + $schemaValue + '))'
|
||||
: it.usePattern($schema);
|
||||
}}
|
||||
|
||||
if ({{# def.$dataNotType:'string' }} !{{=$regexp}}.test({{=$data}}) ) {
|
||||
{{# def.error:'pattern' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
319
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/properties.jst
generated
vendored
Normal file
319
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/properties.jst
generated
vendored
Normal file
@ -0,0 +1,319 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.validateAdditional:
|
||||
{{ /* additionalProperties is schema */
|
||||
$it.schema = $aProperties;
|
||||
$it.schemaPath = it.schemaPath + '.additionalProperties';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/additionalProperties';
|
||||
$it.errorPath = it.opts._errorDataPathProperty
|
||||
? it.errorPath
|
||||
: it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
var $passData = $data + '[' + $key + ']';
|
||||
$it.dataPathArr[$dataNxt] = $key;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
#}}
|
||||
|
||||
|
||||
{{
|
||||
var $key = 'key' + $lvl
|
||||
, $dataNxt = $it.dataLevel = it.dataLevel + 1
|
||||
, $nextData = 'data' + $dataNxt;
|
||||
|
||||
var $schemaKeys = Object.keys($schema || {})
|
||||
, $pProperties = it.schema.patternProperties || {}
|
||||
, $pPropertyKeys = Object.keys($pProperties)
|
||||
, $aProperties = it.schema.additionalProperties
|
||||
, $someProperties = $schemaKeys.length || $pPropertyKeys.length
|
||||
, $noAdditional = $aProperties === false
|
||||
, $additionalIsSchema = typeof $aProperties == 'object'
|
||||
&& Object.keys($aProperties).length
|
||||
, $removeAdditional = it.opts.removeAdditional
|
||||
, $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional
|
||||
, $ownProperties = it.opts.ownProperties
|
||||
, $currentBaseId = it.baseId;
|
||||
|
||||
var $required = it.schema.required;
|
||||
if ($required && !(it.opts.v5 && $required.$data) && $required.length < it.opts.loopRequired)
|
||||
var $requiredHash = it.util.toHash($required);
|
||||
|
||||
if (it.opts.v5) {
|
||||
var $pgProperties = it.schema.patternGroups || {}
|
||||
, $pgPropertyKeys = Object.keys($pgProperties);
|
||||
}
|
||||
}}
|
||||
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$nextValid}} = true;
|
||||
|
||||
{{? $checkAdditional }}
|
||||
for (var {{=$key}} in {{=$data}}) {
|
||||
{{# def.checkOwnProperty }}
|
||||
{{? $someProperties }}
|
||||
var isAdditional{{=$lvl}} = !(false
|
||||
{{? $schemaKeys.length }}
|
||||
{{? $schemaKeys.length > 5 }}
|
||||
|| validate.schema{{=$schemaPath}}[{{=$key}}]
|
||||
{{??}}
|
||||
{{~ $schemaKeys:$propertyKey }}
|
||||
|| {{=$key}} == {{= it.util.toQuotedString($propertyKey) }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{? $pPropertyKeys.length }}
|
||||
{{~ $pPropertyKeys:$pProperty:$i }}
|
||||
|| {{= it.usePattern($pProperty) }}.test({{=$key}})
|
||||
{{~}}
|
||||
{{?}}
|
||||
{{? it.opts.v5 && $pgPropertyKeys && $pgPropertyKeys.length }}
|
||||
{{~ $pgPropertyKeys:$pgProperty:$i }}
|
||||
|| {{= it.usePattern($pgProperty) }}.test({{=$key}})
|
||||
{{~}}
|
||||
{{?}}
|
||||
);
|
||||
|
||||
if (isAdditional{{=$lvl}}) {
|
||||
{{?}}
|
||||
{{? $removeAdditional == 'all' }}
|
||||
delete {{=$data}}[{{=$key}}];
|
||||
{{??}}
|
||||
{{
|
||||
var $currentErrorPath = it.errorPath;
|
||||
var $additionalProperty = '\' + ' + $key + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
}
|
||||
}}
|
||||
{{? $noAdditional }}
|
||||
{{? $removeAdditional }}
|
||||
delete {{=$data}}[{{=$key}}];
|
||||
{{??}}
|
||||
{{=$nextValid}} = false;
|
||||
{{
|
||||
var $currErrSchemaPath = $errSchemaPath;
|
||||
$errSchemaPath = it.errSchemaPath + '/additionalProperties';
|
||||
}}
|
||||
{{# def.error:'additionalProperties' }}
|
||||
{{ $errSchemaPath = $currErrSchemaPath; }}
|
||||
{{? $breakOnError }} break; {{?}}
|
||||
{{?}}
|
||||
{{?? $additionalIsSchema }}
|
||||
{{? $removeAdditional == 'failing' }}
|
||||
var {{=$errs}} = errors;
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{# def.validateAdditional }}
|
||||
|
||||
if (!{{=$nextValid}}) {
|
||||
errors = {{=$errs}};
|
||||
if (validate.errors !== null) {
|
||||
if (errors) validate.errors.length = errors;
|
||||
else validate.errors = null;
|
||||
}
|
||||
delete {{=$data}}[{{=$key}}];
|
||||
}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
{{??}}
|
||||
{{# def.validateAdditional }}
|
||||
{{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{ it.errorPath = $currentErrorPath; }}
|
||||
{{?}}
|
||||
{{? $someProperties }}
|
||||
}
|
||||
{{?}}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
|
||||
{{ var $useDefaults = it.opts.useDefaults && !it.compositeRule; }}
|
||||
|
||||
{{? $schemaKeys.length }}
|
||||
{{~ $schemaKeys:$propertyKey }}
|
||||
{{ var $sch = $schema[$propertyKey]; }}
|
||||
|
||||
{{? {{# def.nonEmptySchema:$sch}} }}
|
||||
{{
|
||||
var $prop = it.util.getProperty($propertyKey)
|
||||
, $passData = $data + $prop
|
||||
, $hasDefault = $useDefaults && $sch.default !== undefined;
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + $prop;
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey);
|
||||
$it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers);
|
||||
$it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey);
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
|
||||
{{? {{# def.willOptimize }} }}
|
||||
{{
|
||||
$code = {{# def._optimizeValidate }};
|
||||
var $useData = $passData;
|
||||
}}
|
||||
{{??}}
|
||||
{{ var $useData = $nextData; }}
|
||||
var {{=$nextData}} = {{=$passData}};
|
||||
{{?}}
|
||||
|
||||
{{? $hasDefault }}
|
||||
{{= $code }}
|
||||
{{??}}
|
||||
{{? $requiredHash && $requiredHash[$propertyKey] }}
|
||||
if ({{=$useData}} === undefined) {
|
||||
{{=$nextValid}} = false;
|
||||
{{
|
||||
var $currentErrorPath = it.errorPath
|
||||
, $currErrSchemaPath = $errSchemaPath
|
||||
, $missingProperty = it.util.escapeQuotes($propertyKey);
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
|
||||
}
|
||||
$errSchemaPath = it.errSchemaPath + '/required';
|
||||
}}
|
||||
{{# def.error:'required' }}
|
||||
{{ $errSchemaPath = $currErrSchemaPath; }}
|
||||
{{ it.errorPath = $currentErrorPath; }}
|
||||
} else {
|
||||
{{??}}
|
||||
{{? $breakOnError }}
|
||||
if ({{=$useData}} === undefined) {
|
||||
{{=$nextValid}} = true;
|
||||
} else {
|
||||
{{??}}
|
||||
if ({{=$useData}} !== undefined) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{= $code }}
|
||||
}
|
||||
{{?}} {{ /* $hasDefault */ }}
|
||||
{{?}} {{ /* def.nonEmptySchema */ }}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
|
||||
{{~ $pPropertyKeys:$pProperty }}
|
||||
{{ var $sch = $pProperties[$pProperty]; }}
|
||||
|
||||
{{? {{# def.nonEmptySchema:$sch}} }}
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
|
||||
$it.errSchemaPath = it.errSchemaPath + '/patternProperties/'
|
||||
+ it.util.escapeFragment($pProperty);
|
||||
}}
|
||||
|
||||
for (var {{=$key}} in {{=$data}}) {
|
||||
{{# def.checkOwnProperty }}
|
||||
if ({{= it.usePattern($pProperty) }}.test({{=$key}})) {
|
||||
{{
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
var $passData = $data + '[' + $key + ']';
|
||||
$it.dataPathArr[$dataNxt] = $key;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
|
||||
{{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}}
|
||||
}
|
||||
{{? $breakOnError }} else {{=$nextValid}} = true; {{?}}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}} {{ /* def.nonEmptySchema */ }}
|
||||
{{~}}
|
||||
|
||||
|
||||
{{? it.opts.v5 }}
|
||||
{{~ $pgPropertyKeys:$pgProperty }}
|
||||
{{
|
||||
var $pgSchema = $pgProperties[$pgProperty]
|
||||
, $sch = $pgSchema.schema;
|
||||
}}
|
||||
|
||||
{{? {{# def.nonEmptySchema:$sch}} }}
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = it.schemaPath + '.patternGroups' + it.util.getProperty($pgProperty) + '.schema';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/patternGroups/'
|
||||
+ it.util.escapeFragment($pgProperty)
|
||||
+ '/schema';
|
||||
}}
|
||||
|
||||
var pgPropCount{{=$lvl}} = 0;
|
||||
|
||||
for (var {{=$key}} in {{=$data}}) {
|
||||
{{# def.checkOwnProperty }}
|
||||
if ({{= it.usePattern($pgProperty) }}.test({{=$key}})) {
|
||||
pgPropCount{{=$lvl}}++;
|
||||
|
||||
{{
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
var $passData = $data + '[' + $key + ']';
|
||||
$it.dataPathArr[$dataNxt] = $key;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
|
||||
{{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}}
|
||||
}
|
||||
{{? $breakOnError }} else {{=$nextValid}} = true; {{?}}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
|
||||
{{
|
||||
var $pgMin = $pgSchema.minimum
|
||||
, $pgMax = $pgSchema.maximum;
|
||||
}}
|
||||
{{? $pgMin !== undefined || $pgMax !== undefined }}
|
||||
var {{=$valid}} = true;
|
||||
|
||||
{{ var $currErrSchemaPath = $errSchemaPath; }}
|
||||
|
||||
{{? $pgMin !== undefined }}
|
||||
{{ var $limit = $pgMin, $reason = 'minimum', $moreOrLess = 'less'; }}
|
||||
{{=$valid}} = pgPropCount{{=$lvl}} >= {{=$pgMin}};
|
||||
{{ $errSchemaPath = it.errSchemaPath + '/patternGroups/minimum'; }}
|
||||
{{# def.checkError:'patternGroups' }}
|
||||
{{? $pgMax !== undefined }}
|
||||
else
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? $pgMax !== undefined }}
|
||||
{{ var $limit = $pgMax, $reason = 'maximum', $moreOrLess = 'more'; }}
|
||||
{{=$valid}} = pgPropCount{{=$lvl}} <= {{=$pgMax}};
|
||||
{{ $errSchemaPath = it.errSchemaPath + '/patternGroups/maximum'; }}
|
||||
{{# def.checkError:'patternGroups' }}
|
||||
{{?}}
|
||||
|
||||
{{ $errSchemaPath = $currErrSchemaPath; }}
|
||||
|
||||
{{# def.ifValid }}
|
||||
{{?}}
|
||||
{{?}} {{ /* def.nonEmptySchema */ }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
86
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/ref.jst
generated
vendored
Normal file
86
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/ref.jst
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
{{## def._validateRef:_v:
|
||||
{{? it.opts.passContext }}
|
||||
{{=_v}}.call(this,
|
||||
{{??}}
|
||||
{{=_v}}(
|
||||
{{?}}
|
||||
{{=$data}}, {{# def.dataPath }}{{# def.passParentData }}, rootData)
|
||||
#}}
|
||||
|
||||
{{ var $async, $refCode; }}
|
||||
{{? $schema == '#' || $schema == '#/' }}
|
||||
{{
|
||||
if (it.isRoot) {
|
||||
$async = it.async;
|
||||
$refCode = 'validate';
|
||||
} else {
|
||||
$async = it.root.schema.$async === true;
|
||||
$refCode = 'root.refVal[0]';
|
||||
}
|
||||
}}
|
||||
{{??}}
|
||||
{{ var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot); }}
|
||||
{{? $refVal === undefined }}
|
||||
{{ var $message = 'can\'t resolve reference ' + $schema + ' from id ' + it.baseId; }}
|
||||
{{? it.opts.missingRefs == 'fail' }}
|
||||
{{ console.log($message); }}
|
||||
{{# def.error:'$ref' }}
|
||||
{{? $breakOnError }} if (false) { {{?}}
|
||||
{{?? it.opts.missingRefs == 'ignore' }}
|
||||
{{ console.log($message); }}
|
||||
{{? $breakOnError }} if (true) { {{?}}
|
||||
{{??}}
|
||||
{{
|
||||
var $error = new Error($message);
|
||||
$error.missingRef = it.resolve.url(it.baseId, $schema);
|
||||
$error.missingSchema = it.resolve.normalizeId(it.resolve.fullPath($error.missingRef));
|
||||
throw $error;
|
||||
}}
|
||||
{{?}}
|
||||
{{?? $refVal.inline }}
|
||||
{{# def.setupNextLevel }}
|
||||
{{
|
||||
$it.schema = $refVal.schema;
|
||||
$it.schemaPath = '';
|
||||
$it.errSchemaPath = $schema;
|
||||
}}
|
||||
{{ var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code); }}
|
||||
{{= $code }}
|
||||
{{? $breakOnError}}
|
||||
if ({{=$nextValid}}) {
|
||||
{{?}}
|
||||
{{??}}
|
||||
{{
|
||||
$async = $refVal.$async === true;
|
||||
$refCode = $refVal.code;
|
||||
}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? $refCode }}
|
||||
{{# def.beginDefOut}}
|
||||
{{# def._validateRef:$refCode }}
|
||||
{{# def.storeDefOut:__callValidate }}
|
||||
|
||||
{{? $async }}
|
||||
{{ if (!it.async) throw new Error('async schema referenced by sync schema'); }}
|
||||
try { {{? $breakOnError }}var {{=$valid}} ={{?}} {{=it.yieldAwait}} {{=__callValidate}}; }
|
||||
catch (e) {
|
||||
if (!(e instanceof ValidationError)) throw e;
|
||||
if (vErrors === null) vErrors = e.errors;
|
||||
else vErrors = vErrors.concat(e.errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
{{? $breakOnError }} if ({{=$valid}}) { {{?}}
|
||||
{{??}}
|
||||
if (!{{=__callValidate}}) {
|
||||
if (vErrors === null) vErrors = {{=$refCode}}.errors;
|
||||
else vErrors = vErrors.concat({{=$refCode}}.errors);
|
||||
errors = vErrors.length;
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
96
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/required.jst
generated
vendored
Normal file
96
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/required.jst
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.missing }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{ var $vSchema = 'schema' + $lvl; }}
|
||||
|
||||
{{## def.setupLoop:
|
||||
{{? !$isData }}
|
||||
var {{=$vSchema}} = validate.schema{{=$schemaPath}};
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
var $i = 'i' + $lvl
|
||||
, $propertyPath = 'schema' + $lvl + '[' + $i + ']'
|
||||
, $missingProperty = '\' + ' + $propertyPath + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
|
||||
}
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{? !$isData }}
|
||||
{{? $schema.length < it.opts.loopRequired &&
|
||||
it.schema.properties && Object.keys(it.schema.properties).length }}
|
||||
{{ var $required = []; }}
|
||||
{{~ $schema:$property }}
|
||||
{{ var $propertySch = it.schema.properties[$property]; }}
|
||||
{{? !($propertySch && {{# def.nonEmptySchema:$propertySch}}) }}
|
||||
{{ $required[$required.length] = $property; }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
{{??}}
|
||||
{{ var $required = $schema; }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
|
||||
{{? $isData || $required.length }}
|
||||
{{
|
||||
var $currentErrorPath = it.errorPath
|
||||
, $loopRequired = $isData || $required.length >= it.opts.loopRequired;
|
||||
}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
var missing{{=$lvl}};
|
||||
{{? $loopRequired }}
|
||||
{{# def.setupLoop }}
|
||||
var {{=$valid}} = true;
|
||||
|
||||
{{?$isData}}{{# def.check$dataIsArray }}{{?}}
|
||||
|
||||
for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) {
|
||||
{{=$valid}} = {{=$data}}[{{=$vSchema}}[{{=$i}}]] !== undefined;
|
||||
if (!{{=$valid}}) break;
|
||||
}
|
||||
|
||||
{{? $isData }} } {{?}}
|
||||
|
||||
{{# def.checkError:'required' }}
|
||||
else {
|
||||
{{??}}
|
||||
if ({{# def.checkMissingProperty:$required }}) {
|
||||
{{# def.errorMissingProperty:'required' }}
|
||||
} else {
|
||||
{{?}}
|
||||
{{??}}
|
||||
{{? $loopRequired }}
|
||||
{{# def.setupLoop }}
|
||||
{{? $isData }}
|
||||
if ({{=$vSchema}} && !Array.isArray({{=$vSchema}})) {
|
||||
{{# def.addError:'required' }}
|
||||
} else if ({{=$vSchema}} !== undefined) {
|
||||
{{?}}
|
||||
|
||||
for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) {
|
||||
if ({{=$data}}[{{=$vSchema}}[{{=$i}}]] === undefined) {
|
||||
{{# def.addError:'required' }}
|
||||
}
|
||||
}
|
||||
|
||||
{{? $isData }} } {{?}}
|
||||
{{??}}
|
||||
{{~ $required:$reqProperty }}
|
||||
{{# def.allErrorsMissingProperty:'required' }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{ it.errorPath = $currentErrorPath; }}
|
||||
|
||||
{{?? $breakOnError }}
|
||||
if (true) {
|
||||
{{?}}
|
||||
38
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/uniqueItems.jst
generated
vendored
Normal file
38
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/uniqueItems.jst
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
|
||||
{{? ($schema || $isData) && it.opts.uniqueItems !== false }}
|
||||
{{? $isData }}
|
||||
var {{=$valid}};
|
||||
if ({{=$schemaValue}} === false || {{=$schemaValue}} === undefined)
|
||||
{{=$valid}} = true;
|
||||
else if (typeof {{=$schemaValue}} != 'boolean')
|
||||
{{=$valid}} = false;
|
||||
else {
|
||||
{{?}}
|
||||
|
||||
var {{=$valid}} = true;
|
||||
if ({{=$data}}.length > 1) {
|
||||
var i = {{=$data}}.length, j;
|
||||
outer:
|
||||
for (;i--;) {
|
||||
for (j = i; j--;) {
|
||||
if (equal({{=$data}}[i], {{=$data}}[j])) {
|
||||
{{=$valid}} = false;
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{{? $isData }} } {{?}}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.error:'uniqueItems' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
{{??}}
|
||||
{{? $breakOnError }} if (true) { {{?}}
|
||||
{{?}}
|
||||
116
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/v5/_formatLimit.jst
generated
vendored
Normal file
116
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/v5/_formatLimit.jst
generated
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
var {{=$valid}} = undefined;
|
||||
|
||||
{{## def.skipFormatLimit:
|
||||
{{=$valid}} = true;
|
||||
{{ return out; }}
|
||||
#}}
|
||||
|
||||
{{## def.compareFormat:
|
||||
{{? $isData }}
|
||||
if ({{=$schemaValue}} === undefined) {{=$valid}} = true;
|
||||
else if (typeof {{=$schemaValue}} != 'string') {{=$valid}} = false;
|
||||
else {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
|
||||
{{? $isDataFormat }}
|
||||
if (!{{=$compare}}) {{=$valid}} = true;
|
||||
else {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
|
||||
var {{=$result}} = {{=$compare}}({{=$data}}, {{# def.schemaValueQS }});
|
||||
|
||||
if ({{=$result}} === undefined) {{=$valid}} = false;
|
||||
#}}
|
||||
|
||||
|
||||
{{? it.opts.format === false }}{{# def.skipFormatLimit }}{{?}}
|
||||
|
||||
{{
|
||||
var $schemaFormat = it.schema.format
|
||||
, $isDataFormat = it.opts.v5 && $schemaFormat.$data
|
||||
, $closingBraces = '';
|
||||
}}
|
||||
|
||||
{{? $isDataFormat }}
|
||||
{{
|
||||
var $schemaValueFormat = it.util.getData($schemaFormat.$data, $dataLvl, it.dataPathArr)
|
||||
, $format = 'format' + $lvl
|
||||
, $compare = 'compare' + $lvl;
|
||||
}}
|
||||
|
||||
var {{=$format}} = formats[{{=$schemaValueFormat}}]
|
||||
, {{=$compare}} = {{=$format}} && {{=$format}}.compare;
|
||||
{{??}}
|
||||
{{ var $format = it.formats[$schemaFormat]; }}
|
||||
{{? !($format && $format.compare) }}
|
||||
{{# def.skipFormatLimit }}
|
||||
{{?}}
|
||||
{{ var $compare = 'formats' + it.util.getProperty($schemaFormat) + '.compare'; }}
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
var $isMax = $keyword == 'formatMaximum'
|
||||
, $exclusiveKeyword = 'formatExclusive' + ($isMax ? 'Maximum' : 'Minimum')
|
||||
, $schemaExcl = it.schema[$exclusiveKeyword]
|
||||
, $isDataExcl = it.opts.v5 && $schemaExcl && $schemaExcl.$data
|
||||
, $op = $isMax ? '<' : '>'
|
||||
, $result = 'result' + $lvl;
|
||||
}}
|
||||
|
||||
{{# def.$data }}
|
||||
|
||||
|
||||
{{? $isDataExcl }}
|
||||
{{
|
||||
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr)
|
||||
, $exclusive = 'exclusive' + $lvl
|
||||
, $opExpr = 'op' + $lvl
|
||||
, $opStr = '\' + ' + $opExpr + ' + \'';
|
||||
}}
|
||||
var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}};
|
||||
{{ $schemaValueExcl = 'schemaExcl' + $lvl; }}
|
||||
|
||||
if (typeof {{=$schemaValueExcl}} != 'boolean' && {{=$schemaValueExcl}} !== undefined) {
|
||||
{{=$valid}} = false;
|
||||
{{ var $errorKeyword = $exclusiveKeyword; }}
|
||||
{{# def.error:'_formatExclusiveLimit' }}
|
||||
}
|
||||
|
||||
{{# def.elseIfValid }}
|
||||
|
||||
{{# def.compareFormat }}
|
||||
var {{=$exclusive}} = {{=$schemaValueExcl}} === true;
|
||||
|
||||
if ({{=$valid}} === undefined) {
|
||||
{{=$valid}} = {{=$exclusive}}
|
||||
? {{=$result}} {{=$op}} 0
|
||||
: {{=$result}} {{=$op}}= 0;
|
||||
}
|
||||
|
||||
if (!{{=$valid}}) var op{{=$lvl}} = {{=$exclusive}} ? '{{=$op}}' : '{{=$op}}=';
|
||||
{{??}}
|
||||
{{
|
||||
var $exclusive = $schemaExcl === true
|
||||
, $opStr = $op; /*used in error*/
|
||||
if (!$exclusive) $opStr += '=';
|
||||
var $opExpr = '\'' + $opStr + '\''; /*used in error*/
|
||||
}}
|
||||
|
||||
{{# def.compareFormat }}
|
||||
|
||||
if ({{=$valid}} === undefined)
|
||||
{{=$valid}} = {{=$result}} {{=$op}}{{?!$exclusive}}={{?}} 0;
|
||||
{{?}}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
{{# def.error:'_formatLimit' }}
|
||||
}
|
||||
10
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/v5/constant.jst
generated
vendored
Normal file
10
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/v5/constant.jst
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{? !$isData }}
|
||||
var schema{{=$lvl}} = validate.schema{{=$schemaPath}};
|
||||
{{?}}
|
||||
var {{=$valid}} = equal({{=$data}}, schema{{=$lvl}});
|
||||
{{# def.checkError:'constant' }}
|
||||
28
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/v5/patternRequired.jst
generated
vendored
Normal file
28
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/v5/patternRequired.jst
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
{{
|
||||
var $key = 'key' + $lvl
|
||||
, $matched = 'patternMatched' + $lvl
|
||||
, $closingBraces = ''
|
||||
, $ownProperties = it.opts.ownProperties;
|
||||
}}
|
||||
|
||||
var {{=$valid}} = true;
|
||||
{{~ $schema:$pProperty }}
|
||||
var {{=$matched}} = false;
|
||||
for (var {{=$key}} in {{=$data}}) {
|
||||
{{# def.checkOwnProperty }}
|
||||
{{=$matched}} = {{= it.usePattern($pProperty) }}.test({{=$key}});
|
||||
if ({{=$matched}}) break;
|
||||
}
|
||||
|
||||
{{ var $missingPattern = it.util.escapeQuotes($pProperty); }}
|
||||
if (!{{=$matched}}) {
|
||||
{{=$valid}} = false;
|
||||
{{# def.addError:'patternRequired' }}
|
||||
} {{# def.elseIfValid }}
|
||||
{{~}}
|
||||
|
||||
{{= $closingBraces }}
|
||||
73
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/v5/switch.jst
generated
vendored
Normal file
73
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/v5/switch.jst
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.validateIf:
|
||||
{{# def.setCompositeRule }}
|
||||
{{ $it.createErrors = false; }}
|
||||
{{# def._validateSwitchRule:if }}
|
||||
{{ $it.createErrors = true; }}
|
||||
{{# def.resetCompositeRule }}
|
||||
{{=$ifPassed}} = {{=$nextValid}};
|
||||
#}}
|
||||
|
||||
{{## def.validateThen:
|
||||
{{? typeof $sch.then == 'boolean' }}
|
||||
{{? $sch.then === false }}
|
||||
{{# def.error:'switch' }}
|
||||
{{?}}
|
||||
var {{=$nextValid}} = {{= $sch.then }};
|
||||
{{??}}
|
||||
{{# def._validateSwitchRule:then }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
{{## def._validateSwitchRule:_clause:
|
||||
{{
|
||||
$it.schema = $sch._clause;
|
||||
$it.schemaPath = $schemaPath + '[' + $caseIndex + ']._clause';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/_clause';
|
||||
}}
|
||||
{{# def.insertSubschemaCode }}
|
||||
#}}
|
||||
|
||||
{{## def.switchCase:
|
||||
{{? $sch.if && {{# def.nonEmptySchema:$sch.if }} }}
|
||||
var {{=$errs}} = errors;
|
||||
{{# def.validateIf }}
|
||||
if ({{=$ifPassed}}) {
|
||||
{{# def.validateThen }}
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
}
|
||||
{{??}}
|
||||
{{=$ifPassed}} = true;
|
||||
{{# def.validateThen }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{
|
||||
var $ifPassed = 'ifPassed' + it.level
|
||||
, $currentBaseId = $it.baseId
|
||||
, $shouldContinue;
|
||||
}}
|
||||
var {{=$ifPassed}};
|
||||
|
||||
{{~ $schema:$sch:$caseIndex }}
|
||||
{{? $caseIndex && !$shouldContinue }}
|
||||
if (!{{=$ifPassed}}) {
|
||||
{{ $closingBraces+= '}'; }}
|
||||
{{?}}
|
||||
|
||||
{{# def.switchCase }}
|
||||
{{ $shouldContinue = $sch.continue }}
|
||||
{{~}}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
var {{=$valid}} = {{=$nextValid}};
|
||||
|
||||
{{# def.cleanUp }}
|
||||
210
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/validate.jst
generated
vendored
Normal file
210
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dot/validate.jst
generated
vendored
Normal file
@ -0,0 +1,210 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.defaults }}
|
||||
{{# def.coerce }}
|
||||
|
||||
{{ /**
|
||||
* schema compilation (render) time:
|
||||
* it = { schema, RULES, _validate, opts }
|
||||
* it.validate - this template function,
|
||||
* it is used recursively to generate code for subschemas
|
||||
*
|
||||
* runtime:
|
||||
* "validate" is a variable name to which this function will be assigned
|
||||
* validateRef etc. are defined in the parent scope in index.js
|
||||
*/ }}
|
||||
|
||||
{{ var $async = it.schema.$async === true; }}
|
||||
|
||||
{{? it.isTop}}
|
||||
{{
|
||||
var $top = it.isTop
|
||||
, $lvl = it.level = 0
|
||||
, $dataLvl = it.dataLevel = 0
|
||||
, $data = 'data';
|
||||
it.rootId = it.resolve.fullPath(it.root.schema.id);
|
||||
it.baseId = it.baseId || it.rootId;
|
||||
if ($async) {
|
||||
it.async = true;
|
||||
var $es7 = it.opts.async == 'es7';
|
||||
it.yieldAwait = $es7 ? 'await' : 'yield';
|
||||
}
|
||||
delete it.isTop;
|
||||
|
||||
it.dataPathArr = [undefined];
|
||||
}}
|
||||
|
||||
var validate =
|
||||
{{? $async }}
|
||||
{{? $es7 }}
|
||||
(async function
|
||||
{{??}}
|
||||
{{? it.opts.async == 'co*'}}co.wrap{{?}}(function*
|
||||
{{?}}
|
||||
{{??}}
|
||||
(function
|
||||
{{?}}
|
||||
(data, dataPath, parentData, parentDataProperty, rootData) {
|
||||
'use strict';
|
||||
var vErrors = null; {{ /* don't edit, used in replace */ }}
|
||||
var errors = 0; {{ /* don't edit, used in replace */ }}
|
||||
if (rootData === undefined) rootData = data;
|
||||
{{??}}
|
||||
{{
|
||||
var $lvl = it.level
|
||||
, $dataLvl = it.dataLevel
|
||||
, $data = 'data' + ($dataLvl || '');
|
||||
|
||||
if (it.schema.id) it.baseId = it.resolve.url(it.baseId, it.schema.id);
|
||||
|
||||
if ($async && !it.async) throw new Error('async schema in sync schema');
|
||||
}}
|
||||
|
||||
var errs_{{=$lvl}} = errors;
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
var $valid = 'valid' + $lvl
|
||||
, $breakOnError = !it.opts.allErrors
|
||||
, $closingBraces1 = ''
|
||||
, $closingBraces2 = '';
|
||||
|
||||
var $errorKeyword;
|
||||
var $typeSchema = it.schema.type
|
||||
, $typeIsArray = Array.isArray($typeSchema);
|
||||
}}
|
||||
|
||||
{{## def.checkType:
|
||||
{{
|
||||
var $schemaPath = it.schemaPath + '.type'
|
||||
, $errSchemaPath = it.errSchemaPath + '/type'
|
||||
, $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
|
||||
}}
|
||||
|
||||
if ({{= it.util[$method]($typeSchema, $data, true) }}) {
|
||||
#}}
|
||||
|
||||
{{? $typeSchema && it.opts.coerceTypes }}
|
||||
{{ var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); }}
|
||||
{{? $coerceToTypes }}
|
||||
{{# def.checkType }}
|
||||
{{# def.coerceType }}
|
||||
}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{ var $refKeywords; }}
|
||||
{{? it.schema.$ref && ($refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref')) }}
|
||||
{{? it.opts.extendRefs == 'fail' }}
|
||||
{{ throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '"'); }}
|
||||
{{?? it.opts.extendRefs == 'ignore' }}
|
||||
{{
|
||||
$refKeywords = false;
|
||||
console.log('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');
|
||||
}}
|
||||
{{?? it.opts.extendRefs !== true }}
|
||||
{{ console.log('$ref: all keywords used in schema at path "' + it.errSchemaPath + '". It will change in the next major version, see issue #260. Use option { extendRefs: true } to keep current behaviour'); }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? it.schema.$ref && !$refKeywords }}
|
||||
{{= it.RULES.all.$ref.code(it, '$ref') }}
|
||||
{{? $breakOnError }}
|
||||
}
|
||||
if (errors === {{?$top}}0{{??}}errs_{{=$lvl}}{{?}}) {
|
||||
{{ $closingBraces2 += '}'; }}
|
||||
{{?}}
|
||||
{{??}}
|
||||
{{~ it.RULES:$rulesGroup }}
|
||||
{{? $shouldUseGroup($rulesGroup) }}
|
||||
{{? $rulesGroup.type }}
|
||||
if ({{= it.util.checkDataType($rulesGroup.type, $data) }}) {
|
||||
{{?}}
|
||||
{{? it.opts.useDefaults && !it.compositeRule }}
|
||||
{{? $rulesGroup.type == 'object' && it.schema.properties }}
|
||||
{{# def.defaultProperties }}
|
||||
{{?? $rulesGroup.type == 'array' && Array.isArray(it.schema.items) }}
|
||||
{{# def.defaultItems }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{~ $rulesGroup.rules:$rule }}
|
||||
{{? $shouldUseRule($rule) }}
|
||||
{{= $rule.code(it, $rule.keyword) }}
|
||||
{{? $breakOnError }}
|
||||
{{ $closingBraces1 += '}'; }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{~}}
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces1 }}
|
||||
{{ $closingBraces1 = ''; }}
|
||||
{{?}}
|
||||
{{? $rulesGroup.type }}
|
||||
}
|
||||
{{? $typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes }}
|
||||
{{ var $typeChecked = true; }}
|
||||
else {
|
||||
{{
|
||||
var $schemaPath = it.schemaPath + '.type'
|
||||
, $errSchemaPath = it.errSchemaPath + '/type';
|
||||
}}
|
||||
{{# def.error:'type' }}
|
||||
}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
if (errors === {{?$top}}0{{??}}errs_{{=$lvl}}{{?}}) {
|
||||
{{ $closingBraces2 += '}'; }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{~}}
|
||||
{{?}}
|
||||
|
||||
{{? $typeSchema && !$typeChecked && !$coerceToTypes }}
|
||||
{{# def.checkType }}
|
||||
{{# def.error:'type' }}
|
||||
}
|
||||
{{?}}
|
||||
|
||||
{{? $breakOnError }} {{= $closingBraces2 }} {{?}}
|
||||
|
||||
{{? $top }}
|
||||
{{? $async }}
|
||||
if (errors === 0) return true; {{ /* don't edit, used in replace */ }}
|
||||
else throw new ValidationError(vErrors); {{ /* don't edit, used in replace */ }}
|
||||
{{??}}
|
||||
validate.errors = vErrors; {{ /* don't edit, used in replace */ }}
|
||||
return errors === 0; {{ /* don't edit, used in replace */ }}
|
||||
{{?}}
|
||||
});
|
||||
|
||||
return validate;
|
||||
{{??}}
|
||||
var {{=$valid}} = errors === errs_{{=$lvl}};
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
|
||||
{{? $top && $breakOnError }}
|
||||
{{# def.cleanUpVarErrors }}
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
function $shouldUseGroup($rulesGroup) {
|
||||
for (var i=0; i < $rulesGroup.rules.length; i++)
|
||||
if ($shouldUseRule($rulesGroup.rules[i]))
|
||||
return true;
|
||||
}
|
||||
|
||||
function $shouldUseRule($rule) {
|
||||
return it.schema[$rule.keyword] !== undefined ||
|
||||
( $rule.keyword == 'properties' &&
|
||||
( it.schema.additionalProperties === false ||
|
||||
typeof it.schema.additionalProperties == 'object'
|
||||
|| ( it.schema.patternProperties &&
|
||||
Object.keys(it.schema.patternProperties).length )
|
||||
|| ( it.opts.v5 && it.schema.patternGroups &&
|
||||
Object.keys(it.schema.patternGroups).length )));
|
||||
}
|
||||
}}
|
||||
3
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/README.md
generated
vendored
Normal file
3
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
These files are compiled dot templates from dot folder.
|
||||
|
||||
Do NOT edit them directly, edit the templates and run `npm run build` from main ajv folder.
|
||||
176
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/_formatLimit.js
generated
vendored
Normal file
176
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/_formatLimit.js
generated
vendored
Normal file
@ -0,0 +1,176 @@
|
||||
'use strict';
|
||||
module.exports = function generate__formatLimit(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
out += 'var ' + ($valid) + ' = undefined;';
|
||||
if (it.opts.format === false) {
|
||||
out += ' ' + ($valid) + ' = true; ';
|
||||
return out;
|
||||
}
|
||||
var $schemaFormat = it.schema.format,
|
||||
$isDataFormat = it.opts.v5 && $schemaFormat.$data,
|
||||
$closingBraces = '';
|
||||
if ($isDataFormat) {
|
||||
var $schemaValueFormat = it.util.getData($schemaFormat.$data, $dataLvl, it.dataPathArr),
|
||||
$format = 'format' + $lvl,
|
||||
$compare = 'compare' + $lvl;
|
||||
out += ' var ' + ($format) + ' = formats[' + ($schemaValueFormat) + '] , ' + ($compare) + ' = ' + ($format) + ' && ' + ($format) + '.compare;';
|
||||
} else {
|
||||
var $format = it.formats[$schemaFormat];
|
||||
if (!($format && $format.compare)) {
|
||||
out += ' ' + ($valid) + ' = true; ';
|
||||
return out;
|
||||
}
|
||||
var $compare = 'formats' + it.util.getProperty($schemaFormat) + '.compare';
|
||||
}
|
||||
var $isMax = $keyword == 'formatMaximum',
|
||||
$exclusiveKeyword = 'formatExclusive' + ($isMax ? 'Maximum' : 'Minimum'),
|
||||
$schemaExcl = it.schema[$exclusiveKeyword],
|
||||
$isDataExcl = it.opts.v5 && $schemaExcl && $schemaExcl.$data,
|
||||
$op = $isMax ? '<' : '>',
|
||||
$result = 'result' + $lvl;
|
||||
var $isData = it.opts.v5 && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if ($isDataExcl) {
|
||||
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
|
||||
$exclusive = 'exclusive' + $lvl,
|
||||
$opExpr = 'op' + $lvl,
|
||||
$opStr = '\' + ' + $opExpr + ' + \'';
|
||||
out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; ';
|
||||
$schemaValueExcl = 'schemaExcl' + $lvl;
|
||||
out += ' if (typeof ' + ($schemaValueExcl) + ' != \'boolean\' && ' + ($schemaValueExcl) + ' !== undefined) { ' + ($valid) + ' = false; ';
|
||||
var $errorKeyword = $exclusiveKeyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_formatExclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
$closingBraces += '}';
|
||||
out += ' else { ';
|
||||
}
|
||||
if ($isData) {
|
||||
out += ' if (' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'string\') ' + ($valid) + ' = false; else { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
if ($isDataFormat) {
|
||||
out += ' if (!' + ($compare) + ') ' + ($valid) + ' = true; else { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
out += ' var ' + ($result) + ' = ' + ($compare) + '(' + ($data) + ', ';
|
||||
if ($isData) {
|
||||
out += '' + ($schemaValue);
|
||||
} else {
|
||||
out += '' + (it.util.toQuotedString($schema));
|
||||
}
|
||||
out += ' ); if (' + ($result) + ' === undefined) ' + ($valid) + ' = false; var ' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true; if (' + ($valid) + ' === undefined) { ' + ($valid) + ' = ' + ($exclusive) + ' ? ' + ($result) + ' ' + ($op) + ' 0 : ' + ($result) + ' ' + ($op) + '= 0; } if (!' + ($valid) + ') var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\';';
|
||||
} else {
|
||||
var $exclusive = $schemaExcl === true,
|
||||
$opStr = $op;
|
||||
if (!$exclusive) $opStr += '=';
|
||||
var $opExpr = '\'' + $opStr + '\'';
|
||||
if ($isData) {
|
||||
out += ' if (' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'string\') ' + ($valid) + ' = false; else { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
if ($isDataFormat) {
|
||||
out += ' if (!' + ($compare) + ') ' + ($valid) + ' = true; else { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
out += ' var ' + ($result) + ' = ' + ($compare) + '(' + ($data) + ', ';
|
||||
if ($isData) {
|
||||
out += '' + ($schemaValue);
|
||||
} else {
|
||||
out += '' + (it.util.toQuotedString($schema));
|
||||
}
|
||||
out += ' ); if (' + ($result) + ' === undefined) ' + ($valid) + ' = false; if (' + ($valid) + ' === undefined) ' + ($valid) + ' = ' + ($result) + ' ' + ($op);
|
||||
if (!$exclusive) {
|
||||
out += '=';
|
||||
}
|
||||
out += ' 0;';
|
||||
}
|
||||
out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { ';
|
||||
var $errorKeyword = $keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_formatLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ';
|
||||
if ($isData) {
|
||||
out += '' + ($schemaValue);
|
||||
} else {
|
||||
out += '' + (it.util.toQuotedString($schema));
|
||||
}
|
||||
out += ' , exclusive: ' + ($exclusive) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should be ' + ($opStr) + ' "';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue) + ' + \'';
|
||||
} else {
|
||||
out += '' + (it.util.escapeQuotes($schema));
|
||||
}
|
||||
out += '"\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + (it.util.toQuotedString($schema));
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += '}';
|
||||
return out;
|
||||
}
|
||||
124
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/_limit.js
generated
vendored
Normal file
124
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/_limit.js
generated
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
'use strict';
|
||||
module.exports = function generate__limit(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $isData = it.opts.v5 && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $isMax = $keyword == 'maximum',
|
||||
$exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum',
|
||||
$schemaExcl = it.schema[$exclusiveKeyword],
|
||||
$isDataExcl = it.opts.v5 && $schemaExcl && $schemaExcl.$data,
|
||||
$op = $isMax ? '<' : '>',
|
||||
$notOp = $isMax ? '>' : '<';
|
||||
if ($isDataExcl) {
|
||||
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
|
||||
$exclusive = 'exclusive' + $lvl,
|
||||
$opExpr = 'op' + $lvl,
|
||||
$opStr = '\' + ' + $opExpr + ' + \'';
|
||||
out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; ';
|
||||
$schemaValueExcl = 'schemaExcl' + $lvl;
|
||||
out += ' var exclusive' + ($lvl) + '; if (typeof ' + ($schemaValueExcl) + ' != \'boolean\' && typeof ' + ($schemaValueExcl) + ' != \'undefined\') { ';
|
||||
var $errorKeyword = $exclusiveKeyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } else if( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
out += ' ((exclusive' + ($lvl) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ') || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = exclusive' + ($lvl) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\';';
|
||||
} else {
|
||||
var $exclusive = $schemaExcl === true,
|
||||
$opStr = $op;
|
||||
if (!$exclusive) $opStr += '=';
|
||||
var $opExpr = '\'' + $opStr + '\'';
|
||||
out += ' if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
out += ' ' + ($data) + ' ' + ($notOp);
|
||||
if ($exclusive) {
|
||||
out += '=';
|
||||
}
|
||||
out += ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') {';
|
||||
}
|
||||
var $errorKeyword = $keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should be ' + ($opStr) + ' ';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue);
|
||||
} else {
|
||||
out += '' + ($schema) + '\'';
|
||||
}
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
76
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/_limitItems.js
generated
vendored
Normal file
76
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/_limitItems.js
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
'use strict';
|
||||
module.exports = function generate__limitItems(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $isData = it.opts.v5 && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $op = $keyword == 'maxItems' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { ';
|
||||
var $errorKeyword = $keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT have ';
|
||||
if ($keyword == 'maxItems') {
|
||||
out += 'more';
|
||||
} else {
|
||||
out += 'less';
|
||||
}
|
||||
out += ' than ';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue) + ' + \'';
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' items\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += '} ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
81
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/_limitLength.js
generated
vendored
Normal file
81
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/_limitLength.js
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
'use strict';
|
||||
module.exports = function generate__limitLength(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $isData = it.opts.v5 && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $op = $keyword == 'maxLength' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
if (it.opts.unicode === false) {
|
||||
out += ' ' + ($data) + '.length ';
|
||||
} else {
|
||||
out += ' ucs2length(' + ($data) + ') ';
|
||||
}
|
||||
out += ' ' + ($op) + ' ' + ($schemaValue) + ') { ';
|
||||
var $errorKeyword = $keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT be ';
|
||||
if ($keyword == 'maxLength') {
|
||||
out += 'longer';
|
||||
} else {
|
||||
out += 'shorter';
|
||||
}
|
||||
out += ' than ';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue) + ' + \'';
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' characters\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += '} ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
76
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/_limitProperties.js
generated
vendored
Normal file
76
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/_limitProperties.js
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
'use strict';
|
||||
module.exports = function generate__limitProperties(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $isData = it.opts.v5 && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $op = $keyword == 'maxProperties' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { ';
|
||||
var $errorKeyword = $keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT have ';
|
||||
if ($keyword == 'maxProperties') {
|
||||
out += 'more';
|
||||
} else {
|
||||
out += 'less';
|
||||
}
|
||||
out += ' than ';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue) + ' + \'';
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' properties\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += '} ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
43
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/allOf.js
generated
vendored
Normal file
43
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/allOf.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
module.exports = function generate_allOf(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $currentBaseId = $it.baseId,
|
||||
$allSchemasEmpty = true;
|
||||
var arr1 = $schema;
|
||||
if (arr1) {
|
||||
var $sch, $i = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$sch = arr1[$i += 1];
|
||||
if (it.util.schemaHasRules($sch, it.RULES.all)) {
|
||||
$allSchemasEmpty = false;
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($breakOnError) {
|
||||
if ($allSchemasEmpty) {
|
||||
out += ' if (true) { ';
|
||||
} else {
|
||||
out += ' ' + ($closingBraces.slice(0, -1)) + ' ';
|
||||
}
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
65
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/anyOf.js
generated
vendored
Normal file
65
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/anyOf.js
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
'use strict';
|
||||
module.exports = function generate_anyOf(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $noEmptySchema = $schema.every(function($sch) {
|
||||
return it.util.schemaHasRules($sch, it.RULES.all);
|
||||
});
|
||||
if ($noEmptySchema) {
|
||||
var $currentBaseId = $it.baseId;
|
||||
out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; ';
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
var arr1 = $schema;
|
||||
if (arr1) {
|
||||
var $sch, $i = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$sch = arr1[$i += 1];
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should match some schema in anyOf\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
|
||||
if (it.opts.allErrors) {
|
||||
out += ' } ';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
} else {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
52
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/constant.js
generated
vendored
Normal file
52
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/constant.js
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
module.exports = function generate_constant(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $isData = it.opts.v5 && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!$isData) {
|
||||
out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';';
|
||||
}
|
||||
out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('constant') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should be equal to constant\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' }';
|
||||
return out;
|
||||
}
|
||||
220
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/custom.js
generated
vendored
Normal file
220
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/custom.js
generated
vendored
Normal file
@ -0,0 +1,220 @@
|
||||
'use strict';
|
||||
module.exports = function generate_custom(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $isData = it.opts.v5 && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $rule = this,
|
||||
$definition = 'definition' + $lvl,
|
||||
$rDef = $rule.definition;
|
||||
var $compile, $inline, $macro, $ruleValidate, $validateCode;
|
||||
if ($isData && $rDef.$data) {
|
||||
$validateCode = 'keywordValidate' + $lvl;
|
||||
var $validateSchema = $rDef.validateSchema;
|
||||
out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;';
|
||||
} else {
|
||||
$ruleValidate = it.useCustomRule($rule, $schema, it.schema, it);
|
||||
$schemaValue = 'validate.schema' + $schemaPath;
|
||||
$validateCode = $ruleValidate.code;
|
||||
$compile = $rDef.compile;
|
||||
$inline = $rDef.inline;
|
||||
$macro = $rDef.macro;
|
||||
}
|
||||
var $ruleErrs = $validateCode + '.errors',
|
||||
$i = 'i' + $lvl,
|
||||
$ruleErr = 'ruleErr' + $lvl,
|
||||
$asyncKeyword = $rDef.async;
|
||||
if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema');
|
||||
if (!($inline || $macro)) {
|
||||
out += '' + ($ruleErrs) + ' = null;';
|
||||
}
|
||||
out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
|
||||
if ($validateSchema) {
|
||||
out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') {';
|
||||
}
|
||||
if ($inline) {
|
||||
if ($rDef.statements) {
|
||||
out += ' ' + ($ruleValidate.validate) + ' ';
|
||||
} else {
|
||||
out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; ';
|
||||
}
|
||||
} else if ($macro) {
|
||||
var $it = it.util.copy(it);
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
$it.schema = $ruleValidate.validate;
|
||||
$it.schemaPath = '';
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
var $code = it.validate($it).replace(/validate\.schema/g, $validateCode);
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
out += ' ' + ($code);
|
||||
} else {
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = '';
|
||||
out += ' ' + ($validateCode) + '.call( ';
|
||||
if (it.opts.passContext) {
|
||||
out += 'this';
|
||||
} else {
|
||||
out += 'self';
|
||||
}
|
||||
if ($compile || $rDef.schema === false) {
|
||||
out += ' , ' + ($data) + ' ';
|
||||
} else {
|
||||
out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' ';
|
||||
}
|
||||
out += ' , (dataPath || \'\')';
|
||||
if (it.errorPath != '""') {
|
||||
out += ' + ' + (it.errorPath);
|
||||
}
|
||||
var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
|
||||
$parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
|
||||
out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) ';
|
||||
var def_callRuleValidate = out;
|
||||
out = $$outStack.pop();
|
||||
if ($rDef.errors === false) {
|
||||
out += ' ' + ($valid) + ' = ';
|
||||
if ($asyncKeyword) {
|
||||
out += '' + (it.yieldAwait);
|
||||
}
|
||||
out += '' + (def_callRuleValidate) + '; ';
|
||||
} else {
|
||||
if ($asyncKeyword) {
|
||||
$ruleErrs = 'customErrors' + $lvl;
|
||||
out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = ' + (it.yieldAwait) + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } ';
|
||||
} else {
|
||||
out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; ';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($rDef.modifying) {
|
||||
out += ' ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];';
|
||||
}
|
||||
if ($validateSchema) {
|
||||
out += ' }';
|
||||
}
|
||||
if ($rDef.valid) {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
}
|
||||
} else {
|
||||
out += ' if ( ';
|
||||
if ($rDef.valid === undefined) {
|
||||
out += ' !';
|
||||
if ($macro) {
|
||||
out += '' + ($nextValid);
|
||||
} else {
|
||||
out += '' + ($valid);
|
||||
}
|
||||
} else {
|
||||
out += ' ' + (!$rDef.valid) + ' ';
|
||||
}
|
||||
out += ') { ';
|
||||
$errorKeyword = $rule.keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = '';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
var def_customError = out;
|
||||
out = $$outStack.pop();
|
||||
if ($inline) {
|
||||
if ($rDef.errors) {
|
||||
if ($rDef.errors != 'full') {
|
||||
out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; if (' + ($ruleErr) + '.schemaPath === undefined) { ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; } ';
|
||||
if (it.opts.verbose) {
|
||||
out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; ';
|
||||
}
|
||||
out += ' } ';
|
||||
}
|
||||
} else {
|
||||
if ($rDef.errors === false) {
|
||||
out += ' ' + (def_customError) + ' ';
|
||||
} else {
|
||||
out += ' if (' + ($errs) + ' == errors) { ' + (def_customError) + ' } else { for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; if (' + ($ruleErr) + '.schemaPath === undefined) { ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; } ';
|
||||
if (it.opts.verbose) {
|
||||
out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; ';
|
||||
}
|
||||
out += ' } } ';
|
||||
}
|
||||
}
|
||||
} else if ($macro) {
|
||||
out += ' var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError(vErrors); ';
|
||||
} else {
|
||||
out += ' validate.errors = vErrors; return false; ';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($rDef.errors === false) {
|
||||
out += ' ' + (def_customError) + ' ';
|
||||
} else {
|
||||
out += ' if (Array.isArray(' + ($ruleErrs) + ')) { if (vErrors === null) vErrors = ' + ($ruleErrs) + '; else vErrors = vErrors.concat(' + ($ruleErrs) + '); errors = vErrors.length; for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; ';
|
||||
if (it.opts.verbose) {
|
||||
out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; ';
|
||||
}
|
||||
out += ' } } else { ' + (def_customError) + ' } ';
|
||||
}
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
147
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/dependencies.js
generated
vendored
Normal file
147
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/dependencies.js
generated
vendored
Normal file
@ -0,0 +1,147 @@
|
||||
'use strict';
|
||||
module.exports = function generate_dependencies(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $schemaDeps = {},
|
||||
$propertyDeps = {};
|
||||
for ($property in $schema) {
|
||||
var $sch = $schema[$property];
|
||||
var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
|
||||
$deps[$property] = $sch;
|
||||
}
|
||||
out += 'var ' + ($errs) + ' = errors;';
|
||||
var $currentErrorPath = it.errorPath;
|
||||
out += 'var missing' + ($lvl) + ';';
|
||||
for (var $property in $propertyDeps) {
|
||||
$deps = $propertyDeps[$property];
|
||||
out += ' if (' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';
|
||||
if ($breakOnError) {
|
||||
out += ' && ( ';
|
||||
var arr1 = $deps;
|
||||
if (arr1) {
|
||||
var _$property, $i = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
_$property = arr1[$i += 1];
|
||||
if ($i) {
|
||||
out += ' || ';
|
||||
}
|
||||
var $prop = it.util.getProperty(_$property);
|
||||
out += ' ( ' + ($data) + ($prop) + ' === undefined && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? _$property : $prop)) + ') ) ';
|
||||
}
|
||||
}
|
||||
out += ')) { ';
|
||||
var $propertyPath = 'missing' + $lvl,
|
||||
$missingProperty = '\' + ' + $propertyPath + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;
|
||||
}
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should have ';
|
||||
if ($deps.length == 1) {
|
||||
out += 'property ' + (it.util.escapeQuotes($deps[0]));
|
||||
} else {
|
||||
out += 'properties ' + (it.util.escapeQuotes($deps.join(", ")));
|
||||
}
|
||||
out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
} else {
|
||||
out += ' ) { ';
|
||||
var arr2 = $deps;
|
||||
if (arr2) {
|
||||
var $reqProperty, i2 = -1,
|
||||
l2 = arr2.length - 1;
|
||||
while (i2 < l2) {
|
||||
$reqProperty = arr2[i2 += 1];
|
||||
var $prop = it.util.getProperty($reqProperty),
|
||||
$missingProperty = it.util.escapeQuotes($reqProperty);
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPath($currentErrorPath, $reqProperty, it.opts.jsonPointers);
|
||||
}
|
||||
out += ' if (' + ($data) + ($prop) + ' === undefined) { var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should have ';
|
||||
if ($deps.length == 1) {
|
||||
out += 'property ' + (it.util.escapeQuotes($deps[0]));
|
||||
} else {
|
||||
out += 'properties ' + (it.util.escapeQuotes($deps.join(", ")));
|
||||
}
|
||||
out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';
|
||||
}
|
||||
}
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
$closingBraces += '}';
|
||||
out += ' else { ';
|
||||
}
|
||||
}
|
||||
it.errorPath = $currentErrorPath;
|
||||
var $currentBaseId = $it.baseId;
|
||||
for (var $property in $schemaDeps) {
|
||||
var $sch = $schemaDeps[$property];
|
||||
if (it.util.schemaHasRules($sch, it.RULES.all)) {
|
||||
out += ' ' + ($nextValid) + ' = true; if (' + ($data) + (it.util.getProperty($property)) + ' !== undefined) { ';
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + it.util.getProperty($property);
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
65
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/enum.js
generated
vendored
Normal file
65
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/enum.js
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
'use strict';
|
||||
module.exports = function generate_enum(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $isData = it.opts.v5 && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $i = 'i' + $lvl,
|
||||
$vSchema = 'schema' + $lvl;
|
||||
if (!$isData) {
|
||||
out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + ';';
|
||||
}
|
||||
out += 'var ' + ($valid) + ';';
|
||||
if ($isData) {
|
||||
out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {';
|
||||
}
|
||||
out += '' + ($valid) + ' = false;for (var ' + ($i) + '=0; ' + ($i) + '<' + ($vSchema) + '.length; ' + ($i) + '++) if (equal(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + '])) { ' + ($valid) + ' = true; break; }';
|
||||
if ($isData) {
|
||||
out += ' } ';
|
||||
}
|
||||
out += ' if (!' + ($valid) + ') { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('enum') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should be equal to one of the allowed values\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' }';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
138
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/format.js
generated
vendored
Normal file
138
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/format.js
generated
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
'use strict';
|
||||
module.exports = function generate_format(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
if (it.opts.format === false) {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
var $isData = it.opts.v5 && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $unknownFormats = it.opts.unknownFormats,
|
||||
$allowUnknown = Array.isArray($unknownFormats);
|
||||
if ($isData) {
|
||||
var $format = 'format' + $lvl;
|
||||
out += ' var ' + ($format) + ' = formats[' + ($schemaValue) + ']; var isObject' + ($lvl) + ' = typeof ' + ($format) + ' == \'object\' && !(' + ($format) + ' instanceof RegExp) && ' + ($format) + '.validate; if (isObject' + ($lvl) + ') { ';
|
||||
if (it.async) {
|
||||
out += ' var async' + ($lvl) + ' = ' + ($format) + '.async; ';
|
||||
}
|
||||
out += ' ' + ($format) + ' = ' + ($format) + '.validate; } if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';
|
||||
}
|
||||
out += ' (';
|
||||
if ($unknownFormats === true || $allowUnknown) {
|
||||
out += ' (' + ($schemaValue) + ' && !' + ($format) + ' ';
|
||||
if ($allowUnknown) {
|
||||
out += ' && self._opts.unknownFormats.indexOf(' + ($schemaValue) + ') == -1 ';
|
||||
}
|
||||
out += ') || ';
|
||||
}
|
||||
out += ' (' + ($format) + ' && !(typeof ' + ($format) + ' == \'function\' ? ';
|
||||
if (it.async) {
|
||||
out += ' (async' + ($lvl) + ' ? ' + (it.yieldAwait) + ' ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) ';
|
||||
} else {
|
||||
out += ' ' + ($format) + '(' + ($data) + ') ';
|
||||
}
|
||||
out += ' : ' + ($format) + '.test(' + ($data) + '))))) {';
|
||||
} else {
|
||||
var $format = it.formats[$schema];
|
||||
if (!$format) {
|
||||
if ($unknownFormats === true || ($allowUnknown && $unknownFormats.indexOf($schema) == -1)) {
|
||||
throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"');
|
||||
} else {
|
||||
if (!$allowUnknown) {
|
||||
console.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"');
|
||||
if ($unknownFormats !== 'ignore') console.warn('In the next major version it will throw exception. See option unknownFormats for more information');
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
var $isObject = typeof $format == 'object' && !($format instanceof RegExp) && $format.validate;
|
||||
if ($isObject) {
|
||||
var $async = $format.async === true;
|
||||
$format = $format.validate;
|
||||
}
|
||||
if ($async) {
|
||||
if (!it.async) throw new Error('async format in sync schema');
|
||||
var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate';
|
||||
out += ' if (!(' + (it.yieldAwait) + ' ' + ($formatRef) + '(' + ($data) + '))) { ';
|
||||
} else {
|
||||
out += ' if (! ';
|
||||
var $formatRef = 'formats' + it.util.getProperty($schema);
|
||||
if ($isObject) $formatRef += '.validate';
|
||||
if (typeof $format == 'function') {
|
||||
out += ' ' + ($formatRef) + '(' + ($data) + ') ';
|
||||
} else {
|
||||
out += ' ' + ($formatRef) + '.test(' + ($data) + ') ';
|
||||
}
|
||||
out += ') { ';
|
||||
}
|
||||
}
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('format') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: ';
|
||||
if ($isData) {
|
||||
out += '' + ($schemaValue);
|
||||
} else {
|
||||
out += '' + (it.util.toQuotedString($schema));
|
||||
}
|
||||
out += ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should match format "';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue) + ' + \'';
|
||||
} else {
|
||||
out += '' + (it.util.escapeQuotes($schema));
|
||||
}
|
||||
out += '"\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + (it.util.toQuotedString($schema));
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
144
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/items.js
generated
vendored
Normal file
144
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/items.js
generated
vendored
Normal file
@ -0,0 +1,144 @@
|
||||
'use strict';
|
||||
module.exports = function generate_items(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $idx = 'i' + $lvl,
|
||||
$dataNxt = $it.dataLevel = it.dataLevel + 1,
|
||||
$nextData = 'data' + $dataNxt,
|
||||
$currentBaseId = it.baseId;
|
||||
out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
|
||||
if (Array.isArray($schema)) {
|
||||
var $additionalItems = it.schema.additionalItems;
|
||||
if ($additionalItems === false) {
|
||||
out += ' ' + ($valid) + ' = ' + ($data) + '.length <= ' + ($schema.length) + '; ';
|
||||
var $currErrSchemaPath = $errSchemaPath;
|
||||
$errSchemaPath = it.errSchemaPath + '/additionalItems';
|
||||
out += ' if (!' + ($valid) + ') { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('additionalItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schema.length) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT have more than ' + ($schema.length) + ' items\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } ';
|
||||
$errSchemaPath = $currErrSchemaPath;
|
||||
if ($breakOnError) {
|
||||
$closingBraces += '}';
|
||||
out += ' else { ';
|
||||
}
|
||||
}
|
||||
var arr1 = $schema;
|
||||
if (arr1) {
|
||||
var $sch, $i = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$sch = arr1[$i += 1];
|
||||
if (it.util.schemaHasRules($sch, it.RULES.all)) {
|
||||
out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { ';
|
||||
var $passData = $data + '[' + $i + ']';
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true);
|
||||
$it.dataPathArr[$dataNxt] = $i;
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
if (it.util.varOccurences($code, $nextData) < 2) {
|
||||
out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
|
||||
} else {
|
||||
out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typeof $additionalItems == 'object' && it.util.schemaHasRules($additionalItems, it.RULES.all)) {
|
||||
$it.schema = $additionalItems;
|
||||
$it.schemaPath = it.schemaPath + '.additionalItems';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/additionalItems';
|
||||
out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') { for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
|
||||
var $passData = $data + '[' + $idx + ']';
|
||||
$it.dataPathArr[$dataNxt] = $idx;
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
if (it.util.varOccurences($code, $nextData) < 2) {
|
||||
out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
|
||||
} else {
|
||||
out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' if (!' + ($nextValid) + ') break; ';
|
||||
}
|
||||
out += ' } } ';
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
} else if (it.util.schemaHasRules($schema, it.RULES.all)) {
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
out += ' for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
|
||||
var $passData = $data + '[' + $idx + ']';
|
||||
$it.dataPathArr[$dataNxt] = $idx;
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
if (it.util.varOccurences($code, $nextData) < 2) {
|
||||
out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
|
||||
} else {
|
||||
out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' if (!' + ($nextValid) + ') break; ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
76
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/multipleOf.js
generated
vendored
Normal file
76
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/multipleOf.js
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
'use strict';
|
||||
module.exports = function generate_multipleOf(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $isData = it.opts.v5 && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
out += 'var division' + ($lvl) + ';if (';
|
||||
if ($isData) {
|
||||
out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || ';
|
||||
}
|
||||
out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', ';
|
||||
if (it.opts.multipleOfPrecision) {
|
||||
out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' ';
|
||||
} else {
|
||||
out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') ';
|
||||
}
|
||||
out += ' ) ';
|
||||
if ($isData) {
|
||||
out += ' ) ';
|
||||
}
|
||||
out += ' ) { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should be multiple of ';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue);
|
||||
} else {
|
||||
out += '' + ($schema) + '\'';
|
||||
}
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += '} ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
83
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/not.js
generated
vendored
Normal file
83
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/not.js
generated
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
'use strict';
|
||||
module.exports = function generate_not(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
if (it.util.schemaHasRules($schema, it.RULES.all)) {
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
out += ' var ' + ($errs) + ' = errors; ';
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
$it.createErrors = false;
|
||||
var $allErrorsOption;
|
||||
if ($it.opts.allErrors) {
|
||||
$allErrorsOption = $it.opts.allErrors;
|
||||
$it.opts.allErrors = false;
|
||||
}
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.createErrors = true;
|
||||
if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption;
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT be valid\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
|
||||
if (it.opts.allErrors) {
|
||||
out += ' } ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT be valid\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
if ($breakOnError) {
|
||||
out += ' if (false) { ';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
76
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/oneOf.js
generated
vendored
Normal file
76
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/oneOf.js
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
'use strict';
|
||||
module.exports = function generate_oneOf(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
out += 'var ' + ($errs) + ' = errors;var prevValid' + ($lvl) + ' = false;var ' + ($valid) + ' = false;';
|
||||
var $currentBaseId = $it.baseId;
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
var arr1 = $schema;
|
||||
if (arr1) {
|
||||
var $sch, $i = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$sch = arr1[$i += 1];
|
||||
if (it.util.schemaHasRules($sch, it.RULES.all)) {
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
} else {
|
||||
out += ' var ' + ($nextValid) + ' = true; ';
|
||||
}
|
||||
if ($i) {
|
||||
out += ' if (' + ($nextValid) + ' && prevValid' + ($lvl) + ') ' + ($valid) + ' = false; else { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
out += ' if (' + ($nextValid) + ') ' + ($valid) + ' = prevValid' + ($lvl) + ' = true;';
|
||||
}
|
||||
}
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should match exactly one schema in oneOf\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += '} else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }';
|
||||
if (it.opts.allErrors) {
|
||||
out += ' } ';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
74
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/pattern.js
generated
vendored
Normal file
74
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/pattern.js
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
'use strict';
|
||||
module.exports = function generate_pattern(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $isData = it.opts.v5 && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema);
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';
|
||||
}
|
||||
out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('pattern') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: ';
|
||||
if ($isData) {
|
||||
out += '' + ($schemaValue);
|
||||
} else {
|
||||
out += '' + (it.util.toQuotedString($schema));
|
||||
}
|
||||
out += ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should match pattern "';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue) + ' + \'';
|
||||
} else {
|
||||
out += '' + (it.util.escapeQuotes($schema));
|
||||
}
|
||||
out += '"\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + (it.util.toQuotedString($schema));
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += '} ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
51
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/patternRequired.js
generated
vendored
Normal file
51
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/patternRequired.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
module.exports = function generate_patternRequired(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $key = 'key' + $lvl,
|
||||
$matched = 'patternMatched' + $lvl,
|
||||
$closingBraces = '',
|
||||
$ownProperties = it.opts.ownProperties;
|
||||
out += 'var ' + ($valid) + ' = true;';
|
||||
var arr1 = $schema;
|
||||
if (arr1) {
|
||||
var $pProperty, i1 = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while (i1 < l1) {
|
||||
$pProperty = arr1[i1 += 1];
|
||||
out += ' var ' + ($matched) + ' = false; for (var ' + ($key) + ' in ' + ($data) + ') { ';
|
||||
if ($ownProperties) {
|
||||
out += ' if (!Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($key) + ')) continue; ';
|
||||
}
|
||||
out += ' ' + ($matched) + ' = ' + (it.usePattern($pProperty)) + '.test(' + ($key) + '); if (' + ($matched) + ') break; } ';
|
||||
var $missingPattern = it.util.escapeQuotes($pProperty);
|
||||
out += ' if (!' + ($matched) + ') { ' + ($valid) + ' = false; var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('patternRequired') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingPattern: \'' + ($missingPattern) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should have property matching pattern \\\'' + ($missingPattern) + '\\\'\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';
|
||||
if ($breakOnError) {
|
||||
$closingBraces += '}';
|
||||
out += ' else { ';
|
||||
}
|
||||
}
|
||||
}
|
||||
out += '' + ($closingBraces);
|
||||
return out;
|
||||
}
|
||||
445
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/properties.js
generated
vendored
Normal file
445
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/properties.js
generated
vendored
Normal file
@ -0,0 +1,445 @@
|
||||
'use strict';
|
||||
module.exports = function generate_properties(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $key = 'key' + $lvl,
|
||||
$dataNxt = $it.dataLevel = it.dataLevel + 1,
|
||||
$nextData = 'data' + $dataNxt;
|
||||
var $schemaKeys = Object.keys($schema || {}),
|
||||
$pProperties = it.schema.patternProperties || {},
|
||||
$pPropertyKeys = Object.keys($pProperties),
|
||||
$aProperties = it.schema.additionalProperties,
|
||||
$someProperties = $schemaKeys.length || $pPropertyKeys.length,
|
||||
$noAdditional = $aProperties === false,
|
||||
$additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length,
|
||||
$removeAdditional = it.opts.removeAdditional,
|
||||
$checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional,
|
||||
$ownProperties = it.opts.ownProperties,
|
||||
$currentBaseId = it.baseId;
|
||||
var $required = it.schema.required;
|
||||
if ($required && !(it.opts.v5 && $required.$data) && $required.length < it.opts.loopRequired) var $requiredHash = it.util.toHash($required);
|
||||
if (it.opts.v5) {
|
||||
var $pgProperties = it.schema.patternGroups || {},
|
||||
$pgPropertyKeys = Object.keys($pgProperties);
|
||||
}
|
||||
out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;';
|
||||
if ($checkAdditional) {
|
||||
out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';
|
||||
if ($ownProperties) {
|
||||
out += ' if (!Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($key) + ')) continue; ';
|
||||
}
|
||||
if ($someProperties) {
|
||||
out += ' var isAdditional' + ($lvl) + ' = !(false ';
|
||||
if ($schemaKeys.length) {
|
||||
if ($schemaKeys.length > 5) {
|
||||
out += ' || validate.schema' + ($schemaPath) + '[' + ($key) + '] ';
|
||||
} else {
|
||||
var arr1 = $schemaKeys;
|
||||
if (arr1) {
|
||||
var $propertyKey, i1 = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while (i1 < l1) {
|
||||
$propertyKey = arr1[i1 += 1];
|
||||
out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($pPropertyKeys.length) {
|
||||
var arr2 = $pPropertyKeys;
|
||||
if (arr2) {
|
||||
var $pProperty, $i = -1,
|
||||
l2 = arr2.length - 1;
|
||||
while ($i < l2) {
|
||||
$pProperty = arr2[$i += 1];
|
||||
out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') ';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (it.opts.v5 && $pgPropertyKeys && $pgPropertyKeys.length) {
|
||||
var arr3 = $pgPropertyKeys;
|
||||
if (arr3) {
|
||||
var $pgProperty, $i = -1,
|
||||
l3 = arr3.length - 1;
|
||||
while ($i < l3) {
|
||||
$pgProperty = arr3[$i += 1];
|
||||
out += ' || ' + (it.usePattern($pgProperty)) + '.test(' + ($key) + ') ';
|
||||
}
|
||||
}
|
||||
}
|
||||
out += ' ); if (isAdditional' + ($lvl) + ') { ';
|
||||
}
|
||||
if ($removeAdditional == 'all') {
|
||||
out += ' delete ' + ($data) + '[' + ($key) + ']; ';
|
||||
} else {
|
||||
var $currentErrorPath = it.errorPath;
|
||||
var $additionalProperty = '\' + ' + $key + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
}
|
||||
if ($noAdditional) {
|
||||
if ($removeAdditional) {
|
||||
out += ' delete ' + ($data) + '[' + ($key) + ']; ';
|
||||
} else {
|
||||
out += ' ' + ($nextValid) + ' = false; ';
|
||||
var $currErrSchemaPath = $errSchemaPath;
|
||||
$errSchemaPath = it.errSchemaPath + '/additionalProperties';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT have additional properties\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
$errSchemaPath = $currErrSchemaPath;
|
||||
if ($breakOnError) {
|
||||
out += ' break; ';
|
||||
}
|
||||
}
|
||||
} else if ($additionalIsSchema) {
|
||||
if ($removeAdditional == 'failing') {
|
||||
out += ' var ' + ($errs) + ' = errors; ';
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
$it.schema = $aProperties;
|
||||
$it.schemaPath = it.schemaPath + '.additionalProperties';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/additionalProperties';
|
||||
$it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
var $passData = $data + '[' + $key + ']';
|
||||
$it.dataPathArr[$dataNxt] = $key;
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
if (it.util.varOccurences($code, $nextData) < 2) {
|
||||
out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
|
||||
} else {
|
||||
out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
|
||||
}
|
||||
out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; } ';
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
} else {
|
||||
$it.schema = $aProperties;
|
||||
$it.schemaPath = it.schemaPath + '.additionalProperties';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/additionalProperties';
|
||||
$it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
var $passData = $data + '[' + $key + ']';
|
||||
$it.dataPathArr[$dataNxt] = $key;
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
if (it.util.varOccurences($code, $nextData) < 2) {
|
||||
out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
|
||||
} else {
|
||||
out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' if (!' + ($nextValid) + ') break; ';
|
||||
}
|
||||
}
|
||||
}
|
||||
it.errorPath = $currentErrorPath;
|
||||
}
|
||||
if ($someProperties) {
|
||||
out += ' } ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
var $useDefaults = it.opts.useDefaults && !it.compositeRule;
|
||||
if ($schemaKeys.length) {
|
||||
var arr4 = $schemaKeys;
|
||||
if (arr4) {
|
||||
var $propertyKey, i4 = -1,
|
||||
l4 = arr4.length - 1;
|
||||
while (i4 < l4) {
|
||||
$propertyKey = arr4[i4 += 1];
|
||||
var $sch = $schema[$propertyKey];
|
||||
if (it.util.schemaHasRules($sch, it.RULES.all)) {
|
||||
var $prop = it.util.getProperty($propertyKey),
|
||||
$passData = $data + $prop,
|
||||
$hasDefault = $useDefaults && $sch.default !== undefined;
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + $prop;
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey);
|
||||
$it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers);
|
||||
$it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey);
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
if (it.util.varOccurences($code, $nextData) < 2) {
|
||||
$code = it.util.varReplace($code, $nextData, $passData);
|
||||
var $useData = $passData;
|
||||
} else {
|
||||
var $useData = $nextData;
|
||||
out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ';
|
||||
}
|
||||
if ($hasDefault) {
|
||||
out += ' ' + ($code) + ' ';
|
||||
} else {
|
||||
if ($requiredHash && $requiredHash[$propertyKey]) {
|
||||
out += ' if (' + ($useData) + ' === undefined) { ' + ($nextValid) + ' = false; ';
|
||||
var $currentErrorPath = it.errorPath,
|
||||
$currErrSchemaPath = $errSchemaPath,
|
||||
$missingProperty = it.util.escapeQuotes($propertyKey);
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
|
||||
}
|
||||
$errSchemaPath = it.errSchemaPath + '/required';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
out += 'is a required property';
|
||||
} else {
|
||||
out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
|
||||
}
|
||||
out += '\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
$errSchemaPath = $currErrSchemaPath;
|
||||
it.errorPath = $currentErrorPath;
|
||||
out += ' } else { ';
|
||||
} else {
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($useData) + ' === undefined) { ' + ($nextValid) + ' = true; } else { ';
|
||||
} else {
|
||||
out += ' if (' + ($useData) + ' !== undefined) { ';
|
||||
}
|
||||
}
|
||||
out += ' ' + ($code) + ' } ';
|
||||
}
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var arr5 = $pPropertyKeys;
|
||||
if (arr5) {
|
||||
var $pProperty, i5 = -1,
|
||||
l5 = arr5.length - 1;
|
||||
while (i5 < l5) {
|
||||
$pProperty = arr5[i5 += 1];
|
||||
var $sch = $pProperties[$pProperty];
|
||||
if (it.util.schemaHasRules($sch, it.RULES.all)) {
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
|
||||
$it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty);
|
||||
out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';
|
||||
if ($ownProperties) {
|
||||
out += ' if (!Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($key) + ')) continue; ';
|
||||
}
|
||||
out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { ';
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
var $passData = $data + '[' + $key + ']';
|
||||
$it.dataPathArr[$dataNxt] = $key;
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
if (it.util.varOccurences($code, $nextData) < 2) {
|
||||
out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
|
||||
} else {
|
||||
out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' if (!' + ($nextValid) + ') break; ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' else ' + ($nextValid) + ' = true; ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (it.opts.v5) {
|
||||
var arr6 = $pgPropertyKeys;
|
||||
if (arr6) {
|
||||
var $pgProperty, i6 = -1,
|
||||
l6 = arr6.length - 1;
|
||||
while (i6 < l6) {
|
||||
$pgProperty = arr6[i6 += 1];
|
||||
var $pgSchema = $pgProperties[$pgProperty],
|
||||
$sch = $pgSchema.schema;
|
||||
if (it.util.schemaHasRules($sch, it.RULES.all)) {
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = it.schemaPath + '.patternGroups' + it.util.getProperty($pgProperty) + '.schema';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/patternGroups/' + it.util.escapeFragment($pgProperty) + '/schema';
|
||||
out += ' var pgPropCount' + ($lvl) + ' = 0; for (var ' + ($key) + ' in ' + ($data) + ') { ';
|
||||
if ($ownProperties) {
|
||||
out += ' if (!Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($key) + ')) continue; ';
|
||||
}
|
||||
out += ' if (' + (it.usePattern($pgProperty)) + '.test(' + ($key) + ')) { pgPropCount' + ($lvl) + '++; ';
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
var $passData = $data + '[' + $key + ']';
|
||||
$it.dataPathArr[$dataNxt] = $key;
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
if (it.util.varOccurences($code, $nextData) < 2) {
|
||||
out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
|
||||
} else {
|
||||
out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' if (!' + ($nextValid) + ') break; ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' else ' + ($nextValid) + ' = true; ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
var $pgMin = $pgSchema.minimum,
|
||||
$pgMax = $pgSchema.maximum;
|
||||
if ($pgMin !== undefined || $pgMax !== undefined) {
|
||||
out += ' var ' + ($valid) + ' = true; ';
|
||||
var $currErrSchemaPath = $errSchemaPath;
|
||||
if ($pgMin !== undefined) {
|
||||
var $limit = $pgMin,
|
||||
$reason = 'minimum',
|
||||
$moreOrLess = 'less';
|
||||
out += ' ' + ($valid) + ' = pgPropCount' + ($lvl) + ' >= ' + ($pgMin) + '; ';
|
||||
$errSchemaPath = it.errSchemaPath + '/patternGroups/minimum';
|
||||
out += ' if (!' + ($valid) + ') { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('patternGroups') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { reason: \'' + ($reason) + '\', limit: ' + ($limit) + ', pattern: \'' + (it.util.escapeQuotes($pgProperty)) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT have ' + ($moreOrLess) + ' than ' + ($limit) + ' properties matching pattern "' + (it.util.escapeQuotes($pgProperty)) + '"\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($pgMax !== undefined) {
|
||||
out += ' else ';
|
||||
}
|
||||
}
|
||||
if ($pgMax !== undefined) {
|
||||
var $limit = $pgMax,
|
||||
$reason = 'maximum',
|
||||
$moreOrLess = 'more';
|
||||
out += ' ' + ($valid) + ' = pgPropCount' + ($lvl) + ' <= ' + ($pgMax) + '; ';
|
||||
$errSchemaPath = it.errSchemaPath + '/patternGroups/maximum';
|
||||
out += ' if (!' + ($valid) + ') { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('patternGroups') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { reason: \'' + ($reason) + '\', limit: ' + ($limit) + ', pattern: \'' + (it.util.escapeQuotes($pgProperty)) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT have ' + ($moreOrLess) + ' than ' + ($limit) + ' properties matching pattern "' + (it.util.escapeQuotes($pgProperty)) + '"\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } ';
|
||||
}
|
||||
$errSchemaPath = $currErrSchemaPath;
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($valid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
119
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/ref.js
generated
vendored
Normal file
119
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/ref.js
generated
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
'use strict';
|
||||
module.exports = function generate_ref(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $async, $refCode;
|
||||
if ($schema == '#' || $schema == '#/') {
|
||||
if (it.isRoot) {
|
||||
$async = it.async;
|
||||
$refCode = 'validate';
|
||||
} else {
|
||||
$async = it.root.schema.$async === true;
|
||||
$refCode = 'root.refVal[0]';
|
||||
}
|
||||
} else {
|
||||
var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot);
|
||||
if ($refVal === undefined) {
|
||||
var $message = 'can\'t resolve reference ' + $schema + ' from id ' + it.baseId;
|
||||
if (it.opts.missingRefs == 'fail') {
|
||||
console.log($message);
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('$ref') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { ref: \'' + (it.util.escapeQuotes($schema)) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'can\\\'t resolve reference ' + (it.util.escapeQuotes($schema)) + '\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ' + (it.util.toQuotedString($schema)) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' if (false) { ';
|
||||
}
|
||||
} else if (it.opts.missingRefs == 'ignore') {
|
||||
console.log($message);
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
}
|
||||
} else {
|
||||
var $error = new Error($message);
|
||||
$error.missingRef = it.resolve.url(it.baseId, $schema);
|
||||
$error.missingSchema = it.resolve.normalizeId(it.resolve.fullPath($error.missingRef));
|
||||
throw $error;
|
||||
}
|
||||
} else if ($refVal.inline) {
|
||||
var $it = it.util.copy(it);
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
$it.schema = $refVal.schema;
|
||||
$it.schemaPath = '';
|
||||
$it.errSchemaPath = $schema;
|
||||
var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code);
|
||||
out += ' ' + ($code) + ' ';
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
}
|
||||
} else {
|
||||
$async = $refVal.$async === true;
|
||||
$refCode = $refVal.code;
|
||||
}
|
||||
}
|
||||
if ($refCode) {
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = '';
|
||||
if (it.opts.passContext) {
|
||||
out += ' ' + ($refCode) + '.call(this, ';
|
||||
} else {
|
||||
out += ' ' + ($refCode) + '( ';
|
||||
}
|
||||
out += ' ' + ($data) + ', (dataPath || \'\')';
|
||||
if (it.errorPath != '""') {
|
||||
out += ' + ' + (it.errorPath);
|
||||
}
|
||||
var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
|
||||
$parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
|
||||
out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ', rootData) ';
|
||||
var __callValidate = out;
|
||||
out = $$outStack.pop();
|
||||
if ($async) {
|
||||
if (!it.async) throw new Error('async schema referenced by sync schema');
|
||||
out += ' try { ';
|
||||
if ($breakOnError) {
|
||||
out += 'var ' + ($valid) + ' =';
|
||||
}
|
||||
out += ' ' + (it.yieldAwait) + ' ' + (__callValidate) + '; } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; } ';
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($valid) + ') { ';
|
||||
}
|
||||
} else {
|
||||
out += ' if (!' + (__callValidate) + ') { if (vErrors === null) vErrors = ' + ($refCode) + '.errors; else vErrors = vErrors.concat(' + ($refCode) + '.errors); errors = vErrors.length; } ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
249
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/required.js
generated
vendored
Normal file
249
static/js/ketcher2/node_modules/table/node_modules/ajv/lib/dotjs/required.js
generated
vendored
Normal file
@ -0,0 +1,249 @@
|
||||
'use strict';
|
||||
module.exports = function generate_required(it, $keyword) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $isData = it.opts.v5 && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $vSchema = 'schema' + $lvl;
|
||||
if (!$isData) {
|
||||
if ($schema.length < it.opts.loopRequired && it.schema.properties && Object.keys(it.schema.properties).length) {
|
||||
var $required = [];
|
||||
var arr1 = $schema;
|
||||
if (arr1) {
|
||||
var $property, i1 = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while (i1 < l1) {
|
||||
$property = arr1[i1 += 1];
|
||||
var $propertySch = it.schema.properties[$property];
|
||||
if (!($propertySch && it.util.schemaHasRules($propertySch, it.RULES.all))) {
|
||||
$required[$required.length] = $property;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var $required = $schema;
|
||||
}
|
||||
}
|
||||
if ($isData || $required.length) {
|
||||
var $currentErrorPath = it.errorPath,
|
||||
$loopRequired = $isData || $required.length >= it.opts.loopRequired;
|
||||
if ($breakOnError) {
|
||||
out += ' var missing' + ($lvl) + '; ';
|
||||
if ($loopRequired) {
|
||||
if (!$isData) {
|
||||
out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';
|
||||
}
|
||||
var $i = 'i' + $lvl,
|
||||
$propertyPath = 'schema' + $lvl + '[' + $i + ']',
|
||||
$missingProperty = '\' + ' + $propertyPath + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
|
||||
}
|
||||
out += ' var ' + ($valid) + ' = true; ';
|
||||
if ($isData) {
|
||||
out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {';
|
||||
}
|
||||
out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined; if (!' + ($valid) + ') break; } ';
|
||||
if ($isData) {
|
||||
out += ' } ';
|
||||
}
|
||||
out += ' if (!' + ($valid) + ') { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
out += 'is a required property';
|
||||
} else {
|
||||
out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
|
||||
}
|
||||
out += '\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } else { ';
|
||||
} else {
|
||||
out += ' if ( ';
|
||||
var arr2 = $required;
|
||||
if (arr2) {
|
||||
var _$property, $i = -1,
|
||||
l2 = arr2.length - 1;
|
||||
while ($i < l2) {
|
||||
_$property = arr2[$i += 1];
|
||||
if ($i) {
|
||||
out += ' || ';
|
||||
}
|
||||
var $prop = it.util.getProperty(_$property);
|
||||
out += ' ( ' + ($data) + ($prop) + ' === undefined && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? _$property : $prop)) + ') ) ';
|
||||
}
|
||||
}
|
||||
out += ') { ';
|
||||
var $propertyPath = 'missing' + $lvl,
|
||||
$missingProperty = '\' + ' + $propertyPath + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;
|
||||
}
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
out += 'is a required property';
|
||||
} else {
|
||||
out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
|
||||
}
|
||||
out += '\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } else { ';
|
||||
}
|
||||
} else {
|
||||
if ($loopRequired) {
|
||||
if (!$isData) {
|
||||
out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';
|
||||
}
|
||||
var $i = 'i' + $lvl,
|
||||
$propertyPath = 'schema' + $lvl + '[' + $i + ']',
|
||||
$missingProperty = '\' + ' + $propertyPath + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
|
||||
}
|
||||
if ($isData) {
|
||||
out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
out += 'is a required property';
|
||||
} else {
|
||||
out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
|
||||
}
|
||||
out += '\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { ';
|
||||
}
|
||||
out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined) { var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
out += 'is a required property';
|
||||
} else {
|
||||
out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
|
||||
}
|
||||
out += '\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ';
|
||||
if ($isData) {
|
||||
out += ' } ';
|
||||
}
|
||||
} else {
|
||||
var arr3 = $required;
|
||||
if (arr3) {
|
||||
var $reqProperty, i3 = -1,
|
||||
l3 = arr3.length - 1;
|
||||
while (i3 < l3) {
|
||||
$reqProperty = arr3[i3 += 1];
|
||||
var $prop = it.util.getProperty($reqProperty),
|
||||
$missingProperty = it.util.escapeQuotes($reqProperty);
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPath($currentErrorPath, $reqProperty, it.opts.jsonPointers);
|
||||
}
|
||||
out += ' if (' + ($data) + ($prop) + ' === undefined) { var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
out += 'is a required property';
|
||||
} else {
|
||||
out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
|
||||
}
|
||||
out += '\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
it.errorPath = $currentErrorPath;
|
||||
} else if ($breakOnError) {
|
||||
out += ' if (true) {';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user