initial commit of actions
This commit is contained in:
commit
949ece5785
44660 changed files with 12034344 additions and 0 deletions
24
github/codeql-action-v1/node_modules/table/LICENSE
generated
vendored
Normal file
24
github/codeql-action-v1/node_modules/table/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
Copyright (c) 2018, 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.
|
||||
759
github/codeql-action-v1/node_modules/table/README.md
generated
vendored
Normal file
759
github/codeql-action-v1/node_modules/table/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,759 @@
|
|||
<a name="table"></a>
|
||||
# Table
|
||||
|
||||
> Produces a string that represents array data in a text table.
|
||||
|
||||
[](https://travis-ci.org/gajus/table)
|
||||
[](https://coveralls.io/github/gajus/table)
|
||||
[](https://www.npmjs.org/package/table)
|
||||
[](https://github.com/gajus/canonical)
|
||||
[](https://twitter.com/kuizinas)
|
||||
|
||||
* [Table](#table)
|
||||
* [Features](#table-features)
|
||||
* [Install](#table-install)
|
||||
* [Usage](#table-usage)
|
||||
* [API](#table-api)
|
||||
* [table](#table-api-table-1)
|
||||
* [createStream](#table-api-createstream)
|
||||
* [getBorderCharacters](#table-api-getbordercharacters)
|
||||
|
||||
|
||||

|
||||
|
||||
<a name="table-features"></a>
|
||||
## Features
|
||||
|
||||
* 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.
|
||||
|
||||
<a name="table-install"></a>
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install table
|
||||
```
|
||||
|
||||
[](https://www.buymeacoffee.com/gajus)
|
||||
[](https://www.patreon.com/gajus)
|
||||
|
||||
|
||||
<a name="table-usage"></a>
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import { table } from 'table';
|
||||
|
||||
// Using commonjs?
|
||||
// const { table } = require('table');
|
||||
|
||||
const data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
console.log(table(data));
|
||||
```
|
||||
|
||||
```
|
||||
╔════╤════╤════╗
|
||||
║ 0A │ 0B │ 0C ║
|
||||
╟────┼────┼────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
╟────┼────┼────╢
|
||||
║ 2A │ 2B │ 2C ║
|
||||
╚════╧════╧════╝
|
||||
|
||||
```
|
||||
|
||||
|
||||
<a name="table-api"></a>
|
||||
## API
|
||||
|
||||
<a name="table-api-table-1"></a>
|
||||
### table
|
||||
|
||||
Returns the string in the table format
|
||||
|
||||
**Parameters:**
|
||||
- **_data_:** The data to display
|
||||
- Type: `any[][]`
|
||||
- Required: `true`
|
||||
|
||||
- **_config_:** Table configuration
|
||||
- Type: `object`
|
||||
- Required: `false`
|
||||
|
||||
<a name="table-api-table-1-config-border"></a>
|
||||
##### config.border
|
||||
|
||||
Type: `{ [type: string]: string }`\
|
||||
Default: `honeywell` [template](#getbordercharacters)
|
||||
|
||||
Custom borders. The keys are any of:
|
||||
- `topLeft`, `topRight`, `topBody`,`topJoin`
|
||||
- `bottomLeft`, `bottomRight`, `bottomBody`, `bottomJoin`
|
||||
- `joinLeft`, `joinRight`, `joinBody`, `joinJoin`
|
||||
- `bodyLeft`, `bodyRight`, `bodyJoin`
|
||||
- `headerJoin`
|
||||
|
||||
```js
|
||||
const data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
const config = {
|
||||
border: {
|
||||
topBody: `─`,
|
||||
topJoin: `┬`,
|
||||
topLeft: `┌`,
|
||||
topRight: `┐`,
|
||||
|
||||
bottomBody: `─`,
|
||||
bottomJoin: `┴`,
|
||||
bottomLeft: `└`,
|
||||
bottomRight: `┘`,
|
||||
|
||||
bodyLeft: `│`,
|
||||
bodyRight: `│`,
|
||||
bodyJoin: `│`,
|
||||
|
||||
joinBody: `─`,
|
||||
joinLeft: `├`,
|
||||
joinRight: `┤`,
|
||||
joinJoin: `┼`
|
||||
}
|
||||
};
|
||||
|
||||
console.log(table(data, config));
|
||||
```
|
||||
|
||||
```
|
||||
┌────┬────┬────┐
|
||||
│ 0A │ 0B │ 0C │
|
||||
├────┼────┼────┤
|
||||
│ 1A │ 1B │ 1C │
|
||||
├────┼────┼────┤
|
||||
│ 2A │ 2B │ 2C │
|
||||
└────┴────┴────┘
|
||||
```
|
||||
|
||||
<a name="table-api-table-1-config-drawverticalline"></a>
|
||||
##### config.drawVerticalLine
|
||||
|
||||
Type: `(lineIndex: number, columnCount: number) => boolean`\
|
||||
Default: `() => true`
|
||||
|
||||
It is used to tell whether to draw a vertical line. This callback is called for each vertical border of the table.
|
||||
If the table has `n` columns, then the `index` parameter is alternatively received all numbers in range `[0, n]` inclusively.
|
||||
|
||||
```js
|
||||
const data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C'],
|
||||
['3A', '3B', '3C'],
|
||||
['4A', '4B', '4C']
|
||||
];
|
||||
|
||||
const config = {
|
||||
drawVerticalLine: (lineIndex, columnCount) => {
|
||||
return lineIndex === 0 || lineIndex === columnCount;
|
||||
}
|
||||
};
|
||||
|
||||
console.log(table(data, config));
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
╔════════════╗
|
||||
║ 0A 0B 0C ║
|
||||
╟────────────╢
|
||||
║ 1A 1B 1C ║
|
||||
╟────────────╢
|
||||
║ 2A 2B 2C ║
|
||||
╟────────────╢
|
||||
║ 3A 3B 3C ║
|
||||
╟────────────╢
|
||||
║ 4A 4B 4C ║
|
||||
╚════════════╝
|
||||
|
||||
```
|
||||
|
||||
<a name="table-api-table-1-config-drawhorizontalline"></a>
|
||||
##### config.drawHorizontalLine
|
||||
|
||||
Type: `(lineIndex: number, rowCount: number) => boolean`\
|
||||
Default: `() => true`
|
||||
|
||||
It is used to tell whether to draw a horizontal line. This callback is called for each horizontal border of the table.
|
||||
If the table has `n` rows, then the `index` parameter is alternatively received all numbers in range `[0, n]` inclusively.
|
||||
If the table has `n` rows and contains the header, then the range will be `[0, n+1]` inclusively.
|
||||
|
||||
```js
|
||||
const data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C'],
|
||||
['3A', '3B', '3C'],
|
||||
['4A', '4B', '4C']
|
||||
];
|
||||
|
||||
const config = {
|
||||
drawHorizontalLine: (lineIndex, rowCount) => {
|
||||
return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount - 1 || lineIndex === rowCount;
|
||||
}
|
||||
};
|
||||
|
||||
console.log(table(data, config));
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
╔════╤════╤════╗
|
||||
║ 0A │ 0B │ 0C ║
|
||||
╟────┼────┼────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
║ 2A │ 2B │ 2C ║
|
||||
║ 3A │ 3B │ 3C ║
|
||||
╟────┼────┼────╢
|
||||
║ 4A │ 4B │ 4C ║
|
||||
╚════╧════╧════╝
|
||||
|
||||
```
|
||||
|
||||
<a name="table-api-table-1-config-singleline"></a>
|
||||
##### config.singleLine
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
If `true`, horizontal lines inside the table are not drawn. This option also overrides the `config.drawHorizontalLine` if specified.
|
||||
|
||||
```js
|
||||
const data = [
|
||||
['-rw-r--r--', '1', 'pandorym', 'staff', '1529', 'May 23 11:25', 'LICENSE'],
|
||||
['-rw-r--r--', '1', 'pandorym', 'staff', '16327', 'May 23 11:58', 'README.md'],
|
||||
['drwxr-xr-x', '76', 'pandorym', 'staff', '2432', 'May 23 12:02', 'dist'],
|
||||
['drwxr-xr-x', '634', 'pandorym', 'staff', '20288', 'May 23 11:54', 'node_modules'],
|
||||
['-rw-r--r--', '1,', 'pandorym', 'staff', '525688', 'May 23 11:52', 'package-lock.json'],
|
||||
['-rw-r--r--@', '1', 'pandorym', 'staff', '2440', 'May 23 11:25', 'package.json'],
|
||||
['drwxr-xr-x', '27', 'pandorym', 'staff', '864', 'May 23 11:25', 'src'],
|
||||
['drwxr-xr-x', '20', 'pandorym', 'staff', '640', 'May 23 11:25', 'test'],
|
||||
];
|
||||
|
||||
const config = {
|
||||
singleLine: true
|
||||
};
|
||||
|
||||
console.log(table(data, config));
|
||||
```
|
||||
|
||||
```
|
||||
╔═════════════╤═════╤══════════╤═══════╤════════╤══════════════╤═══════════════════╗
|
||||
║ -rw-r--r-- │ 1 │ pandorym │ staff │ 1529 │ May 23 11:25 │ LICENSE ║
|
||||
║ -rw-r--r-- │ 1 │ pandorym │ staff │ 16327 │ May 23 11:58 │ README.md ║
|
||||
║ drwxr-xr-x │ 76 │ pandorym │ staff │ 2432 │ May 23 12:02 │ dist ║
|
||||
║ drwxr-xr-x │ 634 │ pandorym │ staff │ 20288 │ May 23 11:54 │ node_modules ║
|
||||
║ -rw-r--r-- │ 1, │ pandorym │ staff │ 525688 │ May 23 11:52 │ package-lock.json ║
|
||||
║ -rw-r--r--@ │ 1 │ pandorym │ staff │ 2440 │ May 23 11:25 │ package.json ║
|
||||
║ drwxr-xr-x │ 27 │ pandorym │ staff │ 864 │ May 23 11:25 │ src ║
|
||||
║ drwxr-xr-x │ 20 │ pandorym │ staff │ 640 │ May 23 11:25 │ test ║
|
||||
╚═════════════╧═════╧══════════╧═══════╧════════╧══════════════╧═══════════════════╝
|
||||
```
|
||||
|
||||
|
||||
<a name="table-api-table-1-config-columns"></a>
|
||||
##### config.columns
|
||||
|
||||
Type: `Column[] | { [columnIndex: number]: Column }`
|
||||
|
||||
Column specific configurations.
|
||||
|
||||
<a name="table-api-table-1-config-columns-config-columns-width"></a>
|
||||
###### config.columns[*].width
|
||||
|
||||
Type: `number`\
|
||||
Default: the maximum cell widths of the column
|
||||
|
||||
Column width (excluding the paddings).
|
||||
|
||||
```js
|
||||
|
||||
const data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
const config = {
|
||||
columns: {
|
||||
1: { width: 10 }
|
||||
}
|
||||
};
|
||||
|
||||
console.log(table(data, config));
|
||||
```
|
||||
|
||||
```
|
||||
╔════╤════════════╤════╗
|
||||
║ 0A │ 0B │ 0C ║
|
||||
╟────┼────────────┼────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
╟────┼────────────┼────╢
|
||||
║ 2A │ 2B │ 2C ║
|
||||
╚════╧════════════╧════╝
|
||||
```
|
||||
|
||||
<a name="table-api-table-1-config-columns-config-columns-alignment"></a>
|
||||
###### config.columns[*].alignment
|
||||
|
||||
Type: `'center' | 'justify' | 'left' | 'right'`\
|
||||
Default: `'left'`
|
||||
|
||||
Cell content horizontal alignment
|
||||
|
||||
```js
|
||||
const data = [
|
||||
['0A', '0B', '0C', '0D 0E 0F'],
|
||||
['1A', '1B', '1C', '1D 1E 1F'],
|
||||
['2A', '2B', '2C', '2D 2E 2F'],
|
||||
];
|
||||
|
||||
const config = {
|
||||
columnDefault: {
|
||||
width: 10,
|
||||
},
|
||||
columns: [
|
||||
{ alignment: 'left' },
|
||||
{ alignment: 'center' },
|
||||
{ alignment: 'right' },
|
||||
{ alignment: 'justify' }
|
||||
],
|
||||
};
|
||||
|
||||
console.log(table(data, config));
|
||||
```
|
||||
|
||||
```
|
||||
╔════════════╤════════════╤════════════╤════════════╗
|
||||
║ 0A │ 0B │ 0C │ 0D 0E 0F ║
|
||||
╟────────────┼────────────┼────────────┼────────────╢
|
||||
║ 1A │ 1B │ 1C │ 1D 1E 1F ║
|
||||
╟────────────┼────────────┼────────────┼────────────╢
|
||||
║ 2A │ 2B │ 2C │ 2D 2E 2F ║
|
||||
╚════════════╧════════════╧════════════╧════════════╝
|
||||
```
|
||||
|
||||
<a name="table-api-table-1-config-columns-config-columns-verticalalignment"></a>
|
||||
###### config.columns[*].verticalAlignment
|
||||
|
||||
Type: `'top' | 'middle' | 'bottom'`\
|
||||
Default: `'top'`
|
||||
|
||||
Cell content vertical alignment
|
||||
|
||||
```js
|
||||
const data = [
|
||||
['A', 'B', 'C', 'DEF'],
|
||||
];
|
||||
|
||||
const config = {
|
||||
columnDefault: {
|
||||
width: 1,
|
||||
},
|
||||
columns: [
|
||||
{ verticalAlignment: 'top' },
|
||||
{ verticalAlignment: 'middle' },
|
||||
{ verticalAlignment: 'bottom' },
|
||||
],
|
||||
};
|
||||
|
||||
console.log(table(data, config));
|
||||
```
|
||||
|
||||
```
|
||||
╔═══╤═══╤═══╤═══╗
|
||||
║ A │ │ │ D ║
|
||||
║ │ B │ │ E ║
|
||||
║ │ │ C │ F ║
|
||||
╚═══╧═══╧═══╧═══╝
|
||||
```
|
||||
|
||||
<a name="table-api-table-1-config-columns-config-columns-paddingleft"></a>
|
||||
###### config.columns[*].paddingLeft
|
||||
|
||||
Type: `number`\
|
||||
Default: `1`
|
||||
|
||||
The number of whitespaces used to pad the content on the left.
|
||||
|
||||
<a name="table-api-table-1-config-columns-config-columns-paddingright"></a>
|
||||
###### config.columns[*].paddingRight
|
||||
|
||||
Type: `number`\
|
||||
Default: `1`
|
||||
|
||||
The number of whitespaces used to pad the content on the right.
|
||||
|
||||
The `paddingLeft` and `paddingRight` options do not count on the column width. So the column has `width = 5`, `paddingLeft = 2` and `paddingRight = 2` will have the total width is `9`.
|
||||
|
||||
|
||||
```js
|
||||
const data = [
|
||||
['0A', 'AABBCC', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
const config = {
|
||||
columns: [
|
||||
{
|
||||
paddingLeft: 3
|
||||
},
|
||||
{
|
||||
width: 2,
|
||||
paddingRight: 3
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
console.log(table(data, config));
|
||||
```
|
||||
|
||||
```
|
||||
╔══════╤══════╤════╗
|
||||
║ 0A │ AA │ 0C ║
|
||||
║ │ BB │ ║
|
||||
║ │ CC │ ║
|
||||
╟──────┼──────┼────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
╟──────┼──────┼────╢
|
||||
║ 2A │ 2B │ 2C ║
|
||||
╚══════╧══════╧════╝
|
||||
```
|
||||
|
||||
<a name="table-api-table-1-config-columns-config-columns-truncate"></a>
|
||||
###### config.columns[*].truncate
|
||||
|
||||
Type: `number`\
|
||||
Default: `Infinity`
|
||||
|
||||
The number of characters is which the content will be truncated.
|
||||
To handle a content that overflows the container width, `table` package implements [text wrapping](#config.columns[*].wrapWord). However, sometimes you may want to truncate content that is too long to be displayed in the table.
|
||||
|
||||
```js
|
||||
const data = [
|
||||
['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.']
|
||||
];
|
||||
|
||||
const config = {
|
||||
columns: [
|
||||
{
|
||||
width: 20,
|
||||
truncate: 100
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
console.log(table(data, config));
|
||||
```
|
||||
|
||||
```
|
||||
╔══════════════════════╗
|
||||
║ Lorem ipsum dolor si ║
|
||||
║ t amet, consectetur ║
|
||||
║ adipiscing elit. Pha ║
|
||||
║ sellus pulvinar nibh ║
|
||||
║ sed mauris convall… ║
|
||||
╚══════════════════════╝
|
||||
```
|
||||
|
||||
<a name="table-api-table-1-config-columns-config-columns-wrapword"></a>
|
||||
###### config.columns[*].wrapWord
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
The `table` package implements auto text wrapping, i.e., text that has the width greater than the container width will be separated into multiple lines at the nearest space or one of the special characters: `\|/_.,;-`.
|
||||
|
||||
When `wrapWord` is `false`:
|
||||
|
||||
```js
|
||||
const data = [
|
||||
['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.']
|
||||
];
|
||||
|
||||
const config = {
|
||||
columns: [ { width: 20 } ]
|
||||
};
|
||||
|
||||
console.log(table(data, config));
|
||||
```
|
||||
|
||||
```
|
||||
╔══════════════════════╗
|
||||
║ 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`:
|
||||
|
||||
```
|
||||
╔══════════════════════╗
|
||||
║ Lorem ipsum dolor ║
|
||||
║ sit amet, ║
|
||||
║ consectetur ║
|
||||
║ adipiscing elit. ║
|
||||
║ Phasellus pulvinar ║
|
||||
║ nibh sed mauris ║
|
||||
║ convallis dapibus. ║
|
||||
║ Nunc venenatis ║
|
||||
║ tempus nulla sit ║
|
||||
║ amet viverra. ║
|
||||
╚══════════════════════╝
|
||||
|
||||
```
|
||||
|
||||
|
||||
<a name="table-api-table-1-config-columndefault"></a>
|
||||
##### config.columnDefault
|
||||
|
||||
Type: `Column`\
|
||||
Default: `{}`
|
||||
|
||||
The default configuration for all columns. Column-specific settings will overwrite the default values.
|
||||
|
||||
|
||||
<a name="table-api-table-1-config-header"></a>
|
||||
##### config.header
|
||||
|
||||
Type: `object`
|
||||
|
||||
Header configuration.
|
||||
|
||||
The header configuration inherits the most of the column's, except:
|
||||
- `content` **{string}**: the header content.
|
||||
- `width:` calculate based on the content width automatically.
|
||||
- `alignment:` `center` be default.
|
||||
- `verticalAlignment:` is not supported.
|
||||
- `config.border.topJoin` will be `config.border.topBody` for prettier.
|
||||
|
||||
```js
|
||||
const data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C'],
|
||||
];
|
||||
|
||||
const config = {
|
||||
columnDefault: {
|
||||
width: 10,
|
||||
},
|
||||
header: {
|
||||
alignment: 'center',
|
||||
content: 'THE HEADER\nThis is the table about something',
|
||||
},
|
||||
}
|
||||
|
||||
console.log(table(data, config));
|
||||
```
|
||||
|
||||
```
|
||||
╔══════════════════════════════════════╗
|
||||
║ THE HEADER ║
|
||||
║ This is the table about something ║
|
||||
╟────────────┬────────────┬────────────╢
|
||||
║ 0A │ 0B │ 0C ║
|
||||
╟────────────┼────────────┼────────────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
╟────────────┼────────────┼────────────╢
|
||||
║ 2A │ 2B │ 2C ║
|
||||
╚════════════╧════════════╧════════════╝
|
||||
```
|
||||
|
||||
|
||||
<a name="table-api-createstream"></a>
|
||||
### createStream
|
||||
|
||||
`table` package exports `createStream` function used to draw a table and append rows.
|
||||
|
||||
**Parameter:**
|
||||
- _**config:**_ the same as `table`'s, except `config.columnDefault.width` and `config.columnCount` must be provided.
|
||||
|
||||
|
||||
```js
|
||||
import { createStream } from 'table';
|
||||
|
||||
const config = {
|
||||
columnDefault: {
|
||||
width: 50
|
||||
},
|
||||
columnCount: 1
|
||||
};
|
||||
|
||||
const 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';
|
||||
|
||||
const config = {
|
||||
columnDefault: {
|
||||
width: 50
|
||||
},
|
||||
columnCount: 3,
|
||||
columns: [
|
||||
{
|
||||
width: 10,
|
||||
alignment: 'right'
|
||||
},
|
||||
{ alignment: 'center' },
|
||||
{ width: 10 }
|
||||
|
||||
]
|
||||
};
|
||||
|
||||
const stream = createStream(config);
|
||||
|
||||
let i = 0;
|
||||
|
||||
setInterval(() => {
|
||||
let random;
|
||||
|
||||
random = _.sample('abcdefghijklmnopqrstuvwxyz', _.random(1, 30)).join('');
|
||||
|
||||
stream.write([i++, new Date(), random]);
|
||||
}, 500);
|
||||
```
|
||||
|
||||

|
||||
|
||||
|
||||
<a name="table-api-getbordercharacters"></a>
|
||||
### getBorderCharacters
|
||||
|
||||
**Parameter:**
|
||||
- **_template_**
|
||||
- Type: `'honeywell' | 'norc' | 'ramac' | 'void'`
|
||||
- Required: `true`
|
||||
|
||||
You can load one of the predefined border templates using `getBorderCharacters` function.
|
||||
|
||||
```js
|
||||
import { table, getBorderCharacters } from 'table';
|
||||
|
||||
const data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
const config = {
|
||||
border: getBorderCharacters(`name of the template`)
|
||||
};
|
||||
|
||||
console.log(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 "borderless 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.
|
||||
|
||||
<a name="table-api-getbordercharacters-borderless-table"></a>
|
||||
#### Borderless Table
|
||||
|
||||
Simply using `void` border character template creates a table with a lot of unnecessary spacing.
|
||||
|
||||
To create a more pleasant to the eye table, reset the padding and remove the joining rows, e.g.
|
||||
|
||||
```js
|
||||
|
||||
const output = table(data, {
|
||||
border: getBorderCharacters('void'),
|
||||
columnDefault: {
|
||||
paddingLeft: 0,
|
||||
paddingRight: 1
|
||||
},
|
||||
drawHorizontalLine: () => false
|
||||
}
|
||||
);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
0A 0B 0C
|
||||
1A 1B 1C
|
||||
2A 2B 2C
|
||||
```
|
||||
|
||||
6
github/codeql-action-v1/node_modules/table/dist/alignString.d.ts
generated
vendored
Normal file
6
github/codeql-action-v1/node_modules/table/dist/alignString.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import type { Alignment } from './types/api';
|
||||
/**
|
||||
* Pads a string to the left and/or right to position the subject
|
||||
* text in a desired alignment within a container.
|
||||
*/
|
||||
export declare const alignString: (subject: string, containerWidth: number, alignment: Alignment) => string;
|
||||
59
github/codeql-action-v1/node_modules/table/dist/alignString.js
generated
vendored
Normal file
59
github/codeql-action-v1/node_modules/table/dist/alignString.js
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.alignString = void 0;
|
||||
const string_width_1 = __importDefault(require("string-width"));
|
||||
const utils_1 = require("./utils");
|
||||
const alignLeft = (subject, width) => {
|
||||
return subject + ' '.repeat(width);
|
||||
};
|
||||
const alignRight = (subject, width) => {
|
||||
return ' '.repeat(width) + subject;
|
||||
};
|
||||
const alignCenter = (subject, width) => {
|
||||
return ' '.repeat(Math.floor(width / 2)) + subject + ' '.repeat(Math.ceil(width / 2));
|
||||
};
|
||||
const alignJustify = (subject, width) => {
|
||||
const spaceSequenceCount = utils_1.countSpaceSequence(subject);
|
||||
if (spaceSequenceCount === 0) {
|
||||
return alignLeft(subject, width);
|
||||
}
|
||||
const addingSpaces = utils_1.distributeUnevenly(width, spaceSequenceCount);
|
||||
if (Math.max(...addingSpaces) > 3) {
|
||||
return alignLeft(subject, width);
|
||||
}
|
||||
let spaceSequenceIndex = 0;
|
||||
return subject.replace(/\s+/g, (groupSpace) => {
|
||||
return groupSpace + ' '.repeat(addingSpaces[spaceSequenceIndex++]);
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Pads a string to the left and/or right to position the subject
|
||||
* text in a desired alignment within a container.
|
||||
*/
|
||||
const alignString = (subject, containerWidth, alignment) => {
|
||||
const subjectWidth = string_width_1.default(subject);
|
||||
if (subjectWidth === containerWidth) {
|
||||
return subject;
|
||||
}
|
||||
if (subjectWidth > containerWidth) {
|
||||
throw new Error('Subject parameter value width cannot be greater than the container width.');
|
||||
}
|
||||
if (subjectWidth === 0) {
|
||||
return ' '.repeat(containerWidth);
|
||||
}
|
||||
const availableWidth = containerWidth - subjectWidth;
|
||||
if (alignment === 'left') {
|
||||
return alignLeft(subject, availableWidth);
|
||||
}
|
||||
if (alignment === 'right') {
|
||||
return alignRight(subject, availableWidth);
|
||||
}
|
||||
if (alignment === 'justify') {
|
||||
return alignJustify(subject, availableWidth);
|
||||
}
|
||||
return alignCenter(subject, availableWidth);
|
||||
};
|
||||
exports.alignString = alignString;
|
||||
2
github/codeql-action-v1/node_modules/table/dist/alignTableData.d.ts
generated
vendored
Normal file
2
github/codeql-action-v1/node_modules/table/dist/alignTableData.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import type { BaseConfig, Row } from './types/internal';
|
||||
export declare const alignTableData: (rows: Row[], config: BaseConfig) => Row[];
|
||||
13
github/codeql-action-v1/node_modules/table/dist/alignTableData.js
generated
vendored
Normal file
13
github/codeql-action-v1/node_modules/table/dist/alignTableData.js
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.alignTableData = void 0;
|
||||
const alignString_1 = require("./alignString");
|
||||
const alignTableData = (rows, config) => {
|
||||
return rows.map((row) => {
|
||||
return row.map((cell, cellIndex) => {
|
||||
const { width, alignment } = config.columns[cellIndex];
|
||||
return alignString_1.alignString(cell, width, alignment);
|
||||
});
|
||||
});
|
||||
};
|
||||
exports.alignTableData = alignTableData;
|
||||
4
github/codeql-action-v1/node_modules/table/dist/calculateCellHeight.d.ts
generated
vendored
Normal file
4
github/codeql-action-v1/node_modules/table/dist/calculateCellHeight.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* Calculates height of cell content in regard to its width and word wrapping.
|
||||
*/
|
||||
export declare const calculateCellHeight: (value: string, columnWidth: number, useWrapWord?: boolean) => number;
|
||||
11
github/codeql-action-v1/node_modules/table/dist/calculateCellHeight.js
generated
vendored
Normal file
11
github/codeql-action-v1/node_modules/table/dist/calculateCellHeight.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.calculateCellHeight = void 0;
|
||||
const wrapCell_1 = require("./wrapCell");
|
||||
/**
|
||||
* Calculates height of cell content in regard to its width and word wrapping.
|
||||
*/
|
||||
const calculateCellHeight = (value, columnWidth, useWrapWord = false) => {
|
||||
return wrapCell_1.wrapCell(value, columnWidth, useWrapWord).length;
|
||||
};
|
||||
exports.calculateCellHeight = calculateCellHeight;
|
||||
5
github/codeql-action-v1/node_modules/table/dist/calculateCellWidths.d.ts
generated
vendored
Normal file
5
github/codeql-action-v1/node_modules/table/dist/calculateCellWidths.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import type { Cell } from './types/internal';
|
||||
/**
|
||||
* Calculates width of each cell contents in a row.
|
||||
*/
|
||||
export declare const calculateCellWidths: (cells: Cell[]) => number[];
|
||||
16
github/codeql-action-v1/node_modules/table/dist/calculateCellWidths.js
generated
vendored
Normal file
16
github/codeql-action-v1/node_modules/table/dist/calculateCellWidths.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.calculateCellWidths = void 0;
|
||||
const string_width_1 = __importDefault(require("string-width"));
|
||||
/**
|
||||
* Calculates width of each cell contents in a row.
|
||||
*/
|
||||
const calculateCellWidths = (cells) => {
|
||||
return cells.map((cell) => {
|
||||
return Math.max(...cell.split('\n').map(string_width_1.default));
|
||||
});
|
||||
};
|
||||
exports.calculateCellWidths = calculateCellWidths;
|
||||
6
github/codeql-action-v1/node_modules/table/dist/calculateColumnWidths.d.ts
generated
vendored
Normal file
6
github/codeql-action-v1/node_modules/table/dist/calculateColumnWidths.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import type { Row } from './types/internal';
|
||||
declare const _default: (rows: Row[]) => number[];
|
||||
/**
|
||||
* Produces an array of values that describe the largest value length (width) in every column.
|
||||
*/
|
||||
export default _default;
|
||||
16
github/codeql-action-v1/node_modules/table/dist/calculateColumnWidths.js
generated
vendored
Normal file
16
github/codeql-action-v1/node_modules/table/dist/calculateColumnWidths.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const calculateCellWidths_1 = require("./calculateCellWidths");
|
||||
/**
|
||||
* Produces an array of values that describe the largest value length (width) in every column.
|
||||
*/
|
||||
exports.default = (rows) => {
|
||||
const columnWidths = new Array(rows[0].length).fill(0);
|
||||
rows.forEach((row) => {
|
||||
const cellWidths = calculateCellWidths_1.calculateCellWidths(row);
|
||||
cellWidths.forEach((cellWidth, cellIndex) => {
|
||||
columnWidths[cellIndex] = Math.max(columnWidths[cellIndex], cellWidth);
|
||||
});
|
||||
});
|
||||
return columnWidths;
|
||||
};
|
||||
5
github/codeql-action-v1/node_modules/table/dist/calculateRowHeights.d.ts
generated
vendored
Normal file
5
github/codeql-action-v1/node_modules/table/dist/calculateRowHeights.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import type { BaseConfig, Row } from './types/internal';
|
||||
/**
|
||||
* Produces an array of values that describe the largest value length (height) in every row.
|
||||
*/
|
||||
export declare const calculateRowHeights: (rows: Row[], config: BaseConfig) => number[];
|
||||
18
github/codeql-action-v1/node_modules/table/dist/calculateRowHeights.js
generated
vendored
Normal file
18
github/codeql-action-v1/node_modules/table/dist/calculateRowHeights.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.calculateRowHeights = void 0;
|
||||
const calculateCellHeight_1 = require("./calculateCellHeight");
|
||||
/**
|
||||
* Produces an array of values that describe the largest value length (height) in every row.
|
||||
*/
|
||||
const calculateRowHeights = (rows, config) => {
|
||||
return rows.map((row) => {
|
||||
let rowHeight = 1;
|
||||
row.forEach((cell, cellIndex) => {
|
||||
const cellHeight = calculateCellHeight_1.calculateCellHeight(cell, config.columns[cellIndex].width, config.columns[cellIndex].wrapWord);
|
||||
rowHeight = Math.max(rowHeight, cellHeight);
|
||||
});
|
||||
return rowHeight;
|
||||
});
|
||||
};
|
||||
exports.calculateRowHeights = calculateRowHeights;
|
||||
2
github/codeql-action-v1/node_modules/table/dist/createStream.d.ts
generated
vendored
Normal file
2
github/codeql-action-v1/node_modules/table/dist/createStream.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import type { StreamUserConfig, WritableStream } from './types/api';
|
||||
export declare const createStream: (userConfig: StreamUserConfig) => WritableStream;
|
||||
72
github/codeql-action-v1/node_modules/table/dist/createStream.js
generated
vendored
Normal file
72
github/codeql-action-v1/node_modules/table/dist/createStream.js
generated
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createStream = void 0;
|
||||
const alignTableData_1 = require("./alignTableData");
|
||||
const calculateRowHeights_1 = require("./calculateRowHeights");
|
||||
const drawBorder_1 = require("./drawBorder");
|
||||
const drawRow_1 = require("./drawRow");
|
||||
const makeStreamConfig_1 = require("./makeStreamConfig");
|
||||
const mapDataUsingRowHeights_1 = require("./mapDataUsingRowHeights");
|
||||
const padTableData_1 = require("./padTableData");
|
||||
const stringifyTableData_1 = require("./stringifyTableData");
|
||||
const truncateTableData_1 = require("./truncateTableData");
|
||||
const prepareData = (data, config) => {
|
||||
let rows = stringifyTableData_1.stringifyTableData(data);
|
||||
rows = truncateTableData_1.truncateTableData(rows, config);
|
||||
const rowHeights = calculateRowHeights_1.calculateRowHeights(rows, config);
|
||||
rows = mapDataUsingRowHeights_1.mapDataUsingRowHeights(rows, rowHeights, config);
|
||||
rows = alignTableData_1.alignTableData(rows, config);
|
||||
rows = padTableData_1.padTableData(rows, config);
|
||||
return rows;
|
||||
};
|
||||
const create = (row, columnWidths, config) => {
|
||||
const rows = prepareData([row], config);
|
||||
const body = rows.map((literalRow) => {
|
||||
return drawRow_1.drawRow(literalRow, config);
|
||||
}).join('');
|
||||
let output;
|
||||
output = '';
|
||||
output += drawBorder_1.drawBorderTop(columnWidths, config);
|
||||
output += body;
|
||||
output += drawBorder_1.drawBorderBottom(columnWidths, config);
|
||||
output = output.trimEnd();
|
||||
process.stdout.write(output);
|
||||
};
|
||||
const append = (row, columnWidths, config) => {
|
||||
const rows = prepareData([row], config);
|
||||
const body = rows.map((literalRow) => {
|
||||
return drawRow_1.drawRow(literalRow, config);
|
||||
}).join('');
|
||||
let output = '';
|
||||
const bottom = drawBorder_1.drawBorderBottom(columnWidths, config);
|
||||
if (bottom !== '\n') {
|
||||
output = '\r\u001B[K';
|
||||
}
|
||||
output += drawBorder_1.drawBorderJoin(columnWidths, config);
|
||||
output += body;
|
||||
output += bottom;
|
||||
output = output.trimEnd();
|
||||
process.stdout.write(output);
|
||||
};
|
||||
const createStream = (userConfig) => {
|
||||
const config = makeStreamConfig_1.makeStreamConfig(userConfig);
|
||||
const columnWidths = Object.values(config.columns).map((column) => {
|
||||
return column.width + column.paddingLeft + column.paddingRight;
|
||||
});
|
||||
let empty = true;
|
||||
return {
|
||||
write: (row) => {
|
||||
if (row.length !== config.columnCount) {
|
||||
throw new Error('Row cell count does not match the config.columnCount.');
|
||||
}
|
||||
if (empty) {
|
||||
empty = false;
|
||||
create(row, columnWidths, config);
|
||||
}
|
||||
else {
|
||||
append(row, columnWidths, config);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
exports.createStream = createStream;
|
||||
26
github/codeql-action-v1/node_modules/table/dist/drawBorder.d.ts
generated
vendored
Normal file
26
github/codeql-action-v1/node_modules/table/dist/drawBorder.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import type { DrawVerticalLine } from './types/api';
|
||||
import type { TableConfig, SeparatorGetter, TopBorderConfig, JoinBorderConfig, BottomBorderConfig } from './types/internal';
|
||||
declare type Separator = {
|
||||
readonly left: string;
|
||||
readonly right: string;
|
||||
readonly body: string;
|
||||
readonly join: string;
|
||||
};
|
||||
declare const drawBorder: (columnWidths: number[], config: {
|
||||
separator: Separator;
|
||||
drawVerticalLine: DrawVerticalLine;
|
||||
}) => string;
|
||||
declare const drawBorderTop: (columnWidths: number[], config: {
|
||||
border: TopBorderConfig;
|
||||
drawVerticalLine: DrawVerticalLine;
|
||||
}) => string;
|
||||
declare const drawBorderJoin: (columnWidths: number[], config: {
|
||||
border: JoinBorderConfig;
|
||||
drawVerticalLine: DrawVerticalLine;
|
||||
}) => string;
|
||||
declare const drawBorderBottom: (columnWidths: number[], config: {
|
||||
border: BottomBorderConfig;
|
||||
drawVerticalLine: DrawVerticalLine;
|
||||
}) => string;
|
||||
export declare const createTableBorderGetter: (columnWidths: number[], config: TableConfig) => SeparatorGetter;
|
||||
export { drawBorder, drawBorderBottom, drawBorderJoin, drawBorderTop, };
|
||||
100
github/codeql-action-v1/node_modules/table/dist/drawBorder.js
generated
vendored
Normal file
100
github/codeql-action-v1/node_modules/table/dist/drawBorder.js
generated
vendored
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.drawBorderTop = exports.drawBorderJoin = exports.drawBorderBottom = exports.drawBorder = exports.createTableBorderGetter = void 0;
|
||||
const drawContent_1 = require("./drawContent");
|
||||
const drawBorder = (columnWidths, config) => {
|
||||
const { separator, drawVerticalLine } = config;
|
||||
const columns = columnWidths.map((size) => {
|
||||
return config.separator.body.repeat(size);
|
||||
});
|
||||
return drawContent_1.drawContent(columns, {
|
||||
drawSeparator: drawVerticalLine,
|
||||
separatorGetter: (index, columnCount) => {
|
||||
if (index === 0) {
|
||||
return separator.left;
|
||||
}
|
||||
if (index === columnCount) {
|
||||
return separator.right;
|
||||
}
|
||||
return separator.join;
|
||||
},
|
||||
}) + '\n';
|
||||
};
|
||||
exports.drawBorder = drawBorder;
|
||||
const drawBorderTop = (columnWidths, config) => {
|
||||
const result = drawBorder(columnWidths, {
|
||||
...config,
|
||||
separator: {
|
||||
body: config.border.topBody,
|
||||
join: config.border.topJoin,
|
||||
left: config.border.topLeft,
|
||||
right: config.border.topRight,
|
||||
},
|
||||
});
|
||||
if (result === '\n') {
|
||||
return '';
|
||||
}
|
||||
return result;
|
||||
};
|
||||
exports.drawBorderTop = drawBorderTop;
|
||||
const drawBorderJoin = (columnWidths, config) => {
|
||||
return drawBorder(columnWidths, {
|
||||
...config,
|
||||
separator: {
|
||||
body: config.border.joinBody,
|
||||
join: config.border.joinJoin,
|
||||
left: config.border.joinLeft,
|
||||
right: config.border.joinRight,
|
||||
},
|
||||
});
|
||||
};
|
||||
exports.drawBorderJoin = drawBorderJoin;
|
||||
const drawBorderBottom = (columnWidths, config) => {
|
||||
return drawBorder(columnWidths, {
|
||||
...config,
|
||||
separator: {
|
||||
body: config.border.bottomBody,
|
||||
join: config.border.bottomJoin,
|
||||
left: config.border.bottomLeft,
|
||||
right: config.border.bottomRight,
|
||||
},
|
||||
});
|
||||
};
|
||||
exports.drawBorderBottom = drawBorderBottom;
|
||||
const createTableBorderGetter = (columnWidths, config) => {
|
||||
return (index, size) => {
|
||||
if (!config.header) {
|
||||
if (index === 0) {
|
||||
return drawBorderTop(columnWidths, config);
|
||||
}
|
||||
if (index === size) {
|
||||
return drawBorderBottom(columnWidths, config);
|
||||
}
|
||||
return drawBorderJoin(columnWidths, config);
|
||||
}
|
||||
// Deal with the header
|
||||
if (index === 0) {
|
||||
return drawBorderTop(columnWidths, {
|
||||
...config,
|
||||
border: {
|
||||
...config.border,
|
||||
topJoin: config.border.topBody,
|
||||
},
|
||||
});
|
||||
}
|
||||
if (index === 1) {
|
||||
return drawBorderJoin(columnWidths, {
|
||||
...config,
|
||||
border: {
|
||||
...config.border,
|
||||
joinJoin: config.border.headerJoin,
|
||||
},
|
||||
});
|
||||
}
|
||||
if (index === size) {
|
||||
return drawBorderBottom(columnWidths, config);
|
||||
}
|
||||
return drawBorderJoin(columnWidths, config);
|
||||
};
|
||||
};
|
||||
exports.createTableBorderGetter = createTableBorderGetter;
|
||||
9
github/codeql-action-v1/node_modules/table/dist/drawContent.d.ts
generated
vendored
Normal file
9
github/codeql-action-v1/node_modules/table/dist/drawContent.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
declare type SeparatorConfig = {
|
||||
drawSeparator: (index: number, size: number) => boolean;
|
||||
separatorGetter: (index: number, size: number) => string;
|
||||
};
|
||||
/**
|
||||
* Shared function to draw horizontal borders, rows or the entire table
|
||||
*/
|
||||
export declare const drawContent: (contents: string[], separatorConfig: SeparatorConfig) => string;
|
||||
export {};
|
||||
26
github/codeql-action-v1/node_modules/table/dist/drawContent.js
generated
vendored
Normal file
26
github/codeql-action-v1/node_modules/table/dist/drawContent.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.drawContent = void 0;
|
||||
/**
|
||||
* Shared function to draw horizontal borders, rows or the entire table
|
||||
*/
|
||||
const drawContent = (contents, separatorConfig) => {
|
||||
const { separatorGetter, drawSeparator } = separatorConfig;
|
||||
const contentSize = contents.length;
|
||||
const result = [];
|
||||
if (drawSeparator(0, contentSize)) {
|
||||
result.push(separatorGetter(0, contentSize));
|
||||
}
|
||||
contents.forEach((content, contentIndex) => {
|
||||
result.push(content);
|
||||
// Only append the middle separator if the content is not the last
|
||||
if (contentIndex + 1 < contentSize && drawSeparator(contentIndex + 1, contentSize)) {
|
||||
result.push(separatorGetter(contentIndex + 1, contentSize));
|
||||
}
|
||||
});
|
||||
if (drawSeparator(contentSize, contentSize)) {
|
||||
result.push(separatorGetter(contentSize, contentSize));
|
||||
}
|
||||
return result.join('');
|
||||
};
|
||||
exports.drawContent = drawContent;
|
||||
2
github/codeql-action-v1/node_modules/table/dist/drawHeader.d.ts
generated
vendored
Normal file
2
github/codeql-action-v1/node_modules/table/dist/drawHeader.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import type { TableConfig } from './types/internal';
|
||||
export declare const drawHeader: (width: number, config: TableConfig) => string;
|
||||
29
github/codeql-action-v1/node_modules/table/dist/drawHeader.js
generated
vendored
Normal file
29
github/codeql-action-v1/node_modules/table/dist/drawHeader.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.drawHeader = void 0;
|
||||
const alignString_1 = require("./alignString");
|
||||
const drawRow_1 = require("./drawRow");
|
||||
const padTableData_1 = require("./padTableData");
|
||||
const truncateTableData_1 = require("./truncateTableData");
|
||||
const wrapCell_1 = require("./wrapCell");
|
||||
const drawHeader = (width, config) => {
|
||||
if (!config.header) {
|
||||
throw new Error('Can not draw header without header configuration');
|
||||
}
|
||||
const { alignment, paddingRight, paddingLeft, wrapWord } = config.header;
|
||||
let content = config.header.content;
|
||||
content = truncateTableData_1.truncateString(content, config.header.truncate);
|
||||
const headerLines = wrapCell_1.wrapCell(content, width, wrapWord);
|
||||
return headerLines.map((headerLine) => {
|
||||
let line = alignString_1.alignString(headerLine, width, alignment);
|
||||
line = padTableData_1.padString(line, paddingLeft, paddingRight);
|
||||
return drawRow_1.drawRow([line], {
|
||||
...config,
|
||||
drawVerticalLine: (index) => {
|
||||
const columnCount = config.columns.length;
|
||||
return config.drawVerticalLine(index === 0 ? 0 : columnCount, columnCount);
|
||||
},
|
||||
});
|
||||
}).join('');
|
||||
};
|
||||
exports.drawHeader = drawHeader;
|
||||
6
github/codeql-action-v1/node_modules/table/dist/drawRow.d.ts
generated
vendored
Normal file
6
github/codeql-action-v1/node_modules/table/dist/drawRow.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import type { DrawVerticalLine } from './types/api';
|
||||
import type { BodyBorderConfig, Row } from './types/internal';
|
||||
export declare const drawRow: (row: Row, config: {
|
||||
border: BodyBorderConfig;
|
||||
drawVerticalLine: DrawVerticalLine;
|
||||
}) => string;
|
||||
20
github/codeql-action-v1/node_modules/table/dist/drawRow.js
generated
vendored
Normal file
20
github/codeql-action-v1/node_modules/table/dist/drawRow.js
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.drawRow = void 0;
|
||||
const drawContent_1 = require("./drawContent");
|
||||
const drawRow = (row, config) => {
|
||||
const { border, drawVerticalLine } = config;
|
||||
return drawContent_1.drawContent(row, {
|
||||
drawSeparator: drawVerticalLine,
|
||||
separatorGetter: (index, columnCount) => {
|
||||
if (index === 0) {
|
||||
return border.bodyLeft;
|
||||
}
|
||||
if (index === columnCount) {
|
||||
return border.bodyRight;
|
||||
}
|
||||
return border.bodyJoin;
|
||||
},
|
||||
}) + '\n';
|
||||
};
|
||||
exports.drawRow = drawRow;
|
||||
2
github/codeql-action-v1/node_modules/table/dist/drawTable.d.ts
generated
vendored
Normal file
2
github/codeql-action-v1/node_modules/table/dist/drawTable.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import type { TableConfig, Row } from './types/internal';
|
||||
export declare const drawTable: (rows: Row[], columnWidths: number[], rowHeights: number[], config: TableConfig) => string;
|
||||
38
github/codeql-action-v1/node_modules/table/dist/drawTable.js
generated
vendored
Normal file
38
github/codeql-action-v1/node_modules/table/dist/drawTable.js
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.drawTable = void 0;
|
||||
const string_width_1 = __importDefault(require("string-width"));
|
||||
const drawBorder_1 = require("./drawBorder");
|
||||
const drawContent_1 = require("./drawContent");
|
||||
const drawHeader_1 = require("./drawHeader");
|
||||
const drawRow_1 = require("./drawRow");
|
||||
const utils_1 = require("./utils");
|
||||
const drawTable = (rows, columnWidths, rowHeights, config) => {
|
||||
const { drawHorizontalLine, singleLine, } = config;
|
||||
const contents = utils_1.groupBySizes(rows, rowHeights).map((group) => {
|
||||
return group.map((row) => {
|
||||
return drawRow_1.drawRow(row, config);
|
||||
}).join('');
|
||||
});
|
||||
if (config.header) {
|
||||
// assume that topLeft/right border have width = 1
|
||||
const headerWidth = string_width_1.default(drawRow_1.drawRow(rows[0], config)) - 2 -
|
||||
config.header.paddingLeft - config.header.paddingRight;
|
||||
const header = drawHeader_1.drawHeader(headerWidth, config);
|
||||
contents.unshift(header);
|
||||
}
|
||||
return drawContent_1.drawContent(contents, {
|
||||
drawSeparator: (index, size) => {
|
||||
// Top/bottom border
|
||||
if (index === 0 || index === size) {
|
||||
return drawHorizontalLine(index, size);
|
||||
}
|
||||
return !singleLine && drawHorizontalLine(index, size);
|
||||
},
|
||||
separatorGetter: drawBorder_1.createTableBorderGetter(columnWidths, config),
|
||||
});
|
||||
};
|
||||
exports.drawTable = drawTable;
|
||||
13
github/codeql-action-v1/node_modules/table/dist/generated/validators.d.ts
generated
vendored
Normal file
13
github/codeql-action-v1/node_modules/table/dist/generated/validators.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
declare function validate43(data: any, { instancePath, parentData, parentDataProperty, rootData }?: {
|
||||
instancePath?: string | undefined;
|
||||
parentData: any;
|
||||
parentDataProperty: any;
|
||||
rootData?: any;
|
||||
}): boolean;
|
||||
declare function validate76(data: any, { instancePath, parentData, parentDataProperty, rootData }?: {
|
||||
instancePath?: string | undefined;
|
||||
parentData: any;
|
||||
parentDataProperty: any;
|
||||
rootData?: any;
|
||||
}): boolean;
|
||||
export { validate43 as _config_json, validate76 as _streamConfig_json };
|
||||
2170
github/codeql-action-v1/node_modules/table/dist/generated/validators.js
generated
vendored
Normal file
2170
github/codeql-action-v1/node_modules/table/dist/generated/validators.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
2
github/codeql-action-v1/node_modules/table/dist/getBorderCharacters.d.ts
generated
vendored
Normal file
2
github/codeql-action-v1/node_modules/table/dist/getBorderCharacters.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import type { BorderConfig } from './types/api';
|
||||
export declare const getBorderCharacters: (name: string) => BorderConfig;
|
||||
88
github/codeql-action-v1/node_modules/table/dist/getBorderCharacters.js
generated
vendored
Normal file
88
github/codeql-action-v1/node_modules/table/dist/getBorderCharacters.js
generated
vendored
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
"use strict";
|
||||
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getBorderCharacters = void 0;
|
||||
const getBorderCharacters = (name) => {
|
||||
if (name === 'honeywell') {
|
||||
return {
|
||||
topBody: '═',
|
||||
topJoin: '╤',
|
||||
topLeft: '╔',
|
||||
topRight: '╗',
|
||||
bottomBody: '═',
|
||||
bottomJoin: '╧',
|
||||
bottomLeft: '╚',
|
||||
bottomRight: '╝',
|
||||
bodyLeft: '║',
|
||||
bodyRight: '║',
|
||||
bodyJoin: '│',
|
||||
headerJoin: '┬',
|
||||
joinBody: '─',
|
||||
joinLeft: '╟',
|
||||
joinRight: '╢',
|
||||
joinJoin: '┼',
|
||||
};
|
||||
}
|
||||
if (name === 'norc') {
|
||||
return {
|
||||
topBody: '─',
|
||||
topJoin: '┬',
|
||||
topLeft: '┌',
|
||||
topRight: '┐',
|
||||
bottomBody: '─',
|
||||
bottomJoin: '┴',
|
||||
bottomLeft: '└',
|
||||
bottomRight: '┘',
|
||||
bodyLeft: '│',
|
||||
bodyRight: '│',
|
||||
bodyJoin: '│',
|
||||
headerJoin: '┬',
|
||||
joinBody: '─',
|
||||
joinLeft: '├',
|
||||
joinRight: '┤',
|
||||
joinJoin: '┼',
|
||||
};
|
||||
}
|
||||
if (name === 'ramac') {
|
||||
return {
|
||||
topBody: '-',
|
||||
topJoin: '+',
|
||||
topLeft: '+',
|
||||
topRight: '+',
|
||||
bottomBody: '-',
|
||||
bottomJoin: '+',
|
||||
bottomLeft: '+',
|
||||
bottomRight: '+',
|
||||
bodyLeft: '|',
|
||||
bodyRight: '|',
|
||||
bodyJoin: '|',
|
||||
headerJoin: '+',
|
||||
joinBody: '-',
|
||||
joinLeft: '|',
|
||||
joinRight: '|',
|
||||
joinJoin: '|',
|
||||
};
|
||||
}
|
||||
if (name === 'void') {
|
||||
return {
|
||||
topBody: '',
|
||||
topJoin: '',
|
||||
topLeft: '',
|
||||
topRight: '',
|
||||
bottomBody: '',
|
||||
bottomJoin: '',
|
||||
bottomLeft: '',
|
||||
bottomRight: '',
|
||||
bodyLeft: '',
|
||||
bodyRight: '',
|
||||
bodyJoin: '',
|
||||
headerJoin: '',
|
||||
joinBody: '',
|
||||
joinLeft: '',
|
||||
joinRight: '',
|
||||
joinJoin: '',
|
||||
};
|
||||
}
|
||||
throw new Error('Unknown border template "' + name + '".');
|
||||
};
|
||||
exports.getBorderCharacters = getBorderCharacters;
|
||||
5
github/codeql-action-v1/node_modules/table/dist/index.d.ts
generated
vendored
Normal file
5
github/codeql-action-v1/node_modules/table/dist/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { createStream } from './createStream';
|
||||
import { getBorderCharacters } from './getBorderCharacters';
|
||||
import { table } from './table';
|
||||
export { table, createStream, getBorderCharacters, };
|
||||
export * from './types/api';
|
||||
20
github/codeql-action-v1/node_modules/table/dist/index.js
generated
vendored
Normal file
20
github/codeql-action-v1/node_modules/table/dist/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getBorderCharacters = exports.createStream = exports.table = void 0;
|
||||
const createStream_1 = require("./createStream");
|
||||
Object.defineProperty(exports, "createStream", { enumerable: true, get: function () { return createStream_1.createStream; } });
|
||||
const getBorderCharacters_1 = require("./getBorderCharacters");
|
||||
Object.defineProperty(exports, "getBorderCharacters", { enumerable: true, get: function () { return getBorderCharacters_1.getBorderCharacters; } });
|
||||
const table_1 = require("./table");
|
||||
Object.defineProperty(exports, "table", { enumerable: true, get: function () { return table_1.table; } });
|
||||
__exportStar(require("./types/api"), exports);
|
||||
7
github/codeql-action-v1/node_modules/table/dist/makeStreamConfig.d.ts
generated
vendored
Normal file
7
github/codeql-action-v1/node_modules/table/dist/makeStreamConfig.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import type { StreamUserConfig } from './types/api';
|
||||
import type { StreamConfig } from './types/internal';
|
||||
/**
|
||||
* Makes a new configuration object out of the userConfig object
|
||||
* using default values for the missing configuration properties.
|
||||
*/
|
||||
export declare const makeStreamConfig: (userConfig: StreamUserConfig) => StreamConfig;
|
||||
47
github/codeql-action-v1/node_modules/table/dist/makeStreamConfig.js
generated
vendored
Normal file
47
github/codeql-action-v1/node_modules/table/dist/makeStreamConfig.js
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.makeStreamConfig = void 0;
|
||||
const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep"));
|
||||
const utils_1 = require("./utils");
|
||||
const validateConfig_1 = require("./validateConfig");
|
||||
/**
|
||||
* Creates a configuration for every column using default
|
||||
* values for the missing configuration properties.
|
||||
*/
|
||||
const makeColumnsConfig = (columnCount, columns = {}, columnDefault) => {
|
||||
return Array.from({ length: columnCount }).map((_, index) => {
|
||||
return {
|
||||
alignment: 'left',
|
||||
paddingLeft: 1,
|
||||
paddingRight: 1,
|
||||
truncate: Number.POSITIVE_INFINITY,
|
||||
verticalAlignment: 'top',
|
||||
wrapWord: false,
|
||||
...columnDefault,
|
||||
...columns[index],
|
||||
};
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Makes a new configuration object out of the userConfig object
|
||||
* using default values for the missing configuration properties.
|
||||
*/
|
||||
const makeStreamConfig = (userConfig) => {
|
||||
validateConfig_1.validateConfig('streamConfig.json', userConfig);
|
||||
const config = lodash_clonedeep_1.default(userConfig);
|
||||
if (config.columnDefault.width === undefined) {
|
||||
throw new Error('Must provide config.columnDefault.width when creating a stream.');
|
||||
}
|
||||
return {
|
||||
drawVerticalLine: () => {
|
||||
return true;
|
||||
},
|
||||
...config,
|
||||
border: utils_1.makeBorderConfig(config.border),
|
||||
columns: makeColumnsConfig(config.columnCount, config.columns, config.columnDefault),
|
||||
};
|
||||
};
|
||||
exports.makeStreamConfig = makeStreamConfig;
|
||||
7
github/codeql-action-v1/node_modules/table/dist/makeTableConfig.d.ts
generated
vendored
Normal file
7
github/codeql-action-v1/node_modules/table/dist/makeTableConfig.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import type { TableUserConfig } from './types/api';
|
||||
import type { Row, TableConfig } from './types/internal';
|
||||
/**
|
||||
* Makes a new configuration object out of the userConfig object
|
||||
* using default values for the missing configuration properties.
|
||||
*/
|
||||
export declare const makeTableConfig: (rows: Row[], userConfig?: TableUserConfig) => TableConfig;
|
||||
66
github/codeql-action-v1/node_modules/table/dist/makeTableConfig.js
generated
vendored
Normal file
66
github/codeql-action-v1/node_modules/table/dist/makeTableConfig.js
generated
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.makeTableConfig = void 0;
|
||||
const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep"));
|
||||
const calculateColumnWidths_1 = __importDefault(require("./calculateColumnWidths"));
|
||||
const utils_1 = require("./utils");
|
||||
const validateConfig_1 = require("./validateConfig");
|
||||
/**
|
||||
* Creates a configuration for every column using default
|
||||
* values for the missing configuration properties.
|
||||
*/
|
||||
const makeColumnsConfig = (rows, columns, columnDefault) => {
|
||||
const columnWidths = calculateColumnWidths_1.default(rows);
|
||||
return rows[0].map((_, columnIndex) => {
|
||||
return {
|
||||
alignment: 'left',
|
||||
paddingLeft: 1,
|
||||
paddingRight: 1,
|
||||
truncate: Number.POSITIVE_INFINITY,
|
||||
verticalAlignment: 'top',
|
||||
width: columnWidths[columnIndex],
|
||||
wrapWord: false,
|
||||
...columnDefault,
|
||||
...columns === null || columns === void 0 ? void 0 : columns[columnIndex],
|
||||
};
|
||||
});
|
||||
};
|
||||
const makeHeaderConfig = (config) => {
|
||||
if (!config.header) {
|
||||
return undefined;
|
||||
}
|
||||
return {
|
||||
alignment: 'center',
|
||||
paddingLeft: 1,
|
||||
paddingRight: 1,
|
||||
truncate: Number.POSITIVE_INFINITY,
|
||||
wrapWord: false,
|
||||
...config.header,
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Makes a new configuration object out of the userConfig object
|
||||
* using default values for the missing configuration properties.
|
||||
*/
|
||||
const makeTableConfig = (rows, userConfig = {}) => {
|
||||
var _a, _b, _c;
|
||||
validateConfig_1.validateConfig('config.json', userConfig);
|
||||
const config = lodash_clonedeep_1.default(userConfig);
|
||||
return {
|
||||
...config,
|
||||
border: utils_1.makeBorderConfig(config.border),
|
||||
columns: makeColumnsConfig(rows, config.columns, config.columnDefault),
|
||||
drawHorizontalLine: (_a = config.drawHorizontalLine) !== null && _a !== void 0 ? _a : (() => {
|
||||
return true;
|
||||
}),
|
||||
drawVerticalLine: (_b = config.drawVerticalLine) !== null && _b !== void 0 ? _b : (() => {
|
||||
return true;
|
||||
}),
|
||||
header: makeHeaderConfig(config),
|
||||
singleLine: (_c = config.singleLine) !== null && _c !== void 0 ? _c : false,
|
||||
};
|
||||
};
|
||||
exports.makeTableConfig = makeTableConfig;
|
||||
2
github/codeql-action-v1/node_modules/table/dist/mapDataUsingRowHeights.d.ts
generated
vendored
Normal file
2
github/codeql-action-v1/node_modules/table/dist/mapDataUsingRowHeights.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import type { BaseConfig, Row } from './types/internal';
|
||||
export declare const mapDataUsingRowHeights: (unmappedRows: Row[], rowHeights: number[], config: BaseConfig) => Row[];
|
||||
44
github/codeql-action-v1/node_modules/table/dist/mapDataUsingRowHeights.js
generated
vendored
Normal file
44
github/codeql-action-v1/node_modules/table/dist/mapDataUsingRowHeights.js
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.mapDataUsingRowHeights = void 0;
|
||||
const wrapCell_1 = require("./wrapCell");
|
||||
const createEmptyStrings = (length) => {
|
||||
return new Array(length).fill('');
|
||||
};
|
||||
const padCellVertically = (lines, rowHeight, columnConfig) => {
|
||||
const { verticalAlignment } = columnConfig;
|
||||
const availableLines = rowHeight - lines.length;
|
||||
if (verticalAlignment === 'top') {
|
||||
return [...lines, ...createEmptyStrings(availableLines)];
|
||||
}
|
||||
if (verticalAlignment === 'bottom') {
|
||||
return [...createEmptyStrings(availableLines), ...lines];
|
||||
}
|
||||
return [
|
||||
...createEmptyStrings(Math.floor(availableLines / 2)),
|
||||
...lines,
|
||||
...createEmptyStrings(Math.ceil(availableLines / 2)),
|
||||
];
|
||||
};
|
||||
const flatten = (array) => {
|
||||
return [].concat(...array);
|
||||
};
|
||||
const mapDataUsingRowHeights = (unmappedRows, rowHeights, config) => {
|
||||
const tableWidth = unmappedRows[0].length;
|
||||
const mappedRows = unmappedRows.map((unmappedRow, unmappedRowIndex) => {
|
||||
const outputRowHeight = rowHeights[unmappedRowIndex];
|
||||
const outputRow = Array.from({ length: outputRowHeight }, () => {
|
||||
return new Array(tableWidth).fill('');
|
||||
});
|
||||
unmappedRow.forEach((cell, cellIndex) => {
|
||||
const cellLines = wrapCell_1.wrapCell(cell, config.columns[cellIndex].width, config.columns[cellIndex].wrapWord);
|
||||
const paddedCellLines = padCellVertically(cellLines, outputRowHeight, config.columns[cellIndex]);
|
||||
paddedCellLines.forEach((cellLine, cellLineIndex) => {
|
||||
outputRow[cellLineIndex][cellIndex] = cellLine;
|
||||
});
|
||||
});
|
||||
return outputRow;
|
||||
});
|
||||
return flatten(mappedRows);
|
||||
};
|
||||
exports.mapDataUsingRowHeights = mapDataUsingRowHeights;
|
||||
3
github/codeql-action-v1/node_modules/table/dist/padTableData.d.ts
generated
vendored
Normal file
3
github/codeql-action-v1/node_modules/table/dist/padTableData.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { BaseConfig, Row } from './types/internal';
|
||||
export declare const padString: (input: string, paddingLeft: number, paddingRight: number) => string;
|
||||
export declare const padTableData: (rows: Row[], config: BaseConfig) => Row[];
|
||||
16
github/codeql-action-v1/node_modules/table/dist/padTableData.js
generated
vendored
Normal file
16
github/codeql-action-v1/node_modules/table/dist/padTableData.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.padTableData = exports.padString = void 0;
|
||||
const padString = (input, paddingLeft, paddingRight) => {
|
||||
return ' '.repeat(paddingLeft) + input + ' '.repeat(paddingRight);
|
||||
};
|
||||
exports.padString = padString;
|
||||
const padTableData = (rows, config) => {
|
||||
return rows.map((cells) => {
|
||||
return cells.map((cell, cellIndex) => {
|
||||
const { paddingLeft, paddingRight } = config.columns[cellIndex];
|
||||
return exports.padString(cell, paddingLeft, paddingRight);
|
||||
});
|
||||
});
|
||||
};
|
||||
exports.padTableData = padTableData;
|
||||
2
github/codeql-action-v1/node_modules/table/dist/stringifyTableData.d.ts
generated
vendored
Normal file
2
github/codeql-action-v1/node_modules/table/dist/stringifyTableData.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import type { Row } from './types/internal';
|
||||
export declare const stringifyTableData: (rows: unknown[][]) => Row[];
|
||||
12
github/codeql-action-v1/node_modules/table/dist/stringifyTableData.js
generated
vendored
Normal file
12
github/codeql-action-v1/node_modules/table/dist/stringifyTableData.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stringifyTableData = void 0;
|
||||
const utils_1 = require("./utils");
|
||||
const stringifyTableData = (rows) => {
|
||||
return rows.map((cells) => {
|
||||
return cells.map((cell) => {
|
||||
return utils_1.normalizeString(String(cell));
|
||||
});
|
||||
});
|
||||
};
|
||||
exports.stringifyTableData = stringifyTableData;
|
||||
2
github/codeql-action-v1/node_modules/table/dist/table.d.ts
generated
vendored
Normal file
2
github/codeql-action-v1/node_modules/table/dist/table.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import type { TableUserConfig } from './types/api';
|
||||
export declare const table: (data: unknown[][], userConfig?: TableUserConfig) => string;
|
||||
26
github/codeql-action-v1/node_modules/table/dist/table.js
generated
vendored
Normal file
26
github/codeql-action-v1/node_modules/table/dist/table.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.table = void 0;
|
||||
const alignTableData_1 = require("./alignTableData");
|
||||
const calculateCellWidths_1 = require("./calculateCellWidths");
|
||||
const calculateRowHeights_1 = require("./calculateRowHeights");
|
||||
const drawTable_1 = require("./drawTable");
|
||||
const makeTableConfig_1 = require("./makeTableConfig");
|
||||
const mapDataUsingRowHeights_1 = require("./mapDataUsingRowHeights");
|
||||
const padTableData_1 = require("./padTableData");
|
||||
const stringifyTableData_1 = require("./stringifyTableData");
|
||||
const truncateTableData_1 = require("./truncateTableData");
|
||||
const validateTableData_1 = require("./validateTableData");
|
||||
const table = (data, userConfig = {}) => {
|
||||
validateTableData_1.validateTableData(data);
|
||||
let rows = stringifyTableData_1.stringifyTableData(data);
|
||||
const config = makeTableConfig_1.makeTableConfig(rows, userConfig);
|
||||
rows = truncateTableData_1.truncateTableData(rows, config);
|
||||
const rowHeights = calculateRowHeights_1.calculateRowHeights(rows, config);
|
||||
rows = mapDataUsingRowHeights_1.mapDataUsingRowHeights(rows, rowHeights, config);
|
||||
rows = alignTableData_1.alignTableData(rows, config);
|
||||
rows = padTableData_1.padTableData(rows, config);
|
||||
const cellWidths = calculateCellWidths_1.calculateCellWidths(rows[0]);
|
||||
return drawTable_1.drawTable(rows, cellWidths, rowHeights, config);
|
||||
};
|
||||
exports.table = table;
|
||||
6
github/codeql-action-v1/node_modules/table/dist/truncateTableData.d.ts
generated
vendored
Normal file
6
github/codeql-action-v1/node_modules/table/dist/truncateTableData.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import type { BaseConfig, Row } from './types/internal';
|
||||
export declare const truncateString: (input: string, length: number) => string;
|
||||
/**
|
||||
* @todo Make it work with ASCII content.
|
||||
*/
|
||||
export declare const truncateTableData: (rows: Row[], config: BaseConfig) => Row[];
|
||||
23
github/codeql-action-v1/node_modules/table/dist/truncateTableData.js
generated
vendored
Normal file
23
github/codeql-action-v1/node_modules/table/dist/truncateTableData.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.truncateTableData = exports.truncateString = void 0;
|
||||
const lodash_truncate_1 = __importDefault(require("lodash.truncate"));
|
||||
const truncateString = (input, length) => {
|
||||
return lodash_truncate_1.default(input, { length,
|
||||
omission: '…' });
|
||||
};
|
||||
exports.truncateString = truncateString;
|
||||
/**
|
||||
* @todo Make it work with ASCII content.
|
||||
*/
|
||||
const truncateTableData = (rows, config) => {
|
||||
return rows.map((cells) => {
|
||||
return cells.map((cell, cellIndex) => {
|
||||
return exports.truncateString(cell, config.columns[cellIndex].truncate);
|
||||
});
|
||||
});
|
||||
};
|
||||
exports.truncateTableData = truncateTableData;
|
||||
114
github/codeql-action-v1/node_modules/table/dist/types/api.d.ts
generated
vendored
Normal file
114
github/codeql-action-v1/node_modules/table/dist/types/api.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
export declare type DrawLinePredicate = (index: number, size: number) => boolean;
|
||||
export declare type DrawVerticalLine = DrawLinePredicate;
|
||||
export declare type DrawHorizontalLine = DrawLinePredicate;
|
||||
export declare type BorderUserConfig = {
|
||||
readonly topLeft?: string;
|
||||
readonly topRight?: string;
|
||||
readonly topBody?: string;
|
||||
readonly topJoin?: string;
|
||||
readonly bottomLeft?: string;
|
||||
readonly bottomRight?: string;
|
||||
readonly bottomBody?: string;
|
||||
readonly bottomJoin?: string;
|
||||
readonly joinLeft?: string;
|
||||
readonly joinRight?: string;
|
||||
readonly joinBody?: string;
|
||||
readonly joinJoin?: string;
|
||||
readonly headerJoin?: string;
|
||||
readonly bodyRight?: string;
|
||||
readonly bodyLeft?: string;
|
||||
readonly bodyJoin?: string;
|
||||
};
|
||||
export declare type BorderConfig = Required<BorderUserConfig>;
|
||||
export declare type Alignment = 'center' | 'justify' | 'left' | 'right';
|
||||
export declare type VerticalAlignment = 'bottom' | 'middle' | 'top';
|
||||
export declare type ColumnUserConfig = {
|
||||
/**
|
||||
* Cell content horizontal alignment (default: left)
|
||||
*/
|
||||
readonly alignment?: Alignment;
|
||||
/**
|
||||
* Cell content vertical alignment (default: top)
|
||||
*/
|
||||
readonly verticalAlignment?: VerticalAlignment;
|
||||
/**
|
||||
* Column width (default: auto calculation based on the cell content)
|
||||
*/
|
||||
readonly width?: number;
|
||||
/**
|
||||
* Number of characters are which the content will be truncated (default: Infinity)
|
||||
*/
|
||||
readonly truncate?: number;
|
||||
/**
|
||||
* Cell content padding width left (default: 1)
|
||||
*/
|
||||
readonly paddingLeft?: number;
|
||||
/**
|
||||
* Cell content padding width right (default: 1)
|
||||
*/
|
||||
readonly paddingRight?: number;
|
||||
/**
|
||||
* If true, the text is broken at the nearest space or one of the special characters: "\|/_.,;-"
|
||||
*/
|
||||
readonly wrapWord?: boolean;
|
||||
};
|
||||
export declare type HeaderUserConfig = Omit<ColumnUserConfig, 'verticalAlignment' | 'width'> & {
|
||||
readonly content: string;
|
||||
};
|
||||
export declare type BaseUserConfig = {
|
||||
/**
|
||||
* Custom border
|
||||
*/
|
||||
readonly border?: BorderUserConfig;
|
||||
/**
|
||||
* Default values for all columns. Column specific settings overwrite the default values.
|
||||
*/
|
||||
readonly columnDefault?: ColumnUserConfig;
|
||||
/**
|
||||
* Column specific configuration.
|
||||
*/
|
||||
readonly columns?: Indexable<ColumnUserConfig>;
|
||||
/**
|
||||
* Used to tell whether to draw a vertical line.
|
||||
* This callback is called for each non-content line of the table.
|
||||
* The default behavior is to always return true.
|
||||
*/
|
||||
readonly drawVerticalLine?: DrawVerticalLine;
|
||||
};
|
||||
export declare type TableUserConfig = BaseUserConfig & {
|
||||
/**
|
||||
* The header configuration
|
||||
*/
|
||||
readonly header?: HeaderUserConfig;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
readonly drawHorizontalLine?: DrawHorizontalLine;
|
||||
/**
|
||||
* Horizontal lines inside the table are not drawn.
|
||||
*/
|
||||
readonly singleLine?: boolean;
|
||||
};
|
||||
export declare type StreamUserConfig = BaseUserConfig & {
|
||||
/**
|
||||
* The number of columns
|
||||
*/
|
||||
readonly columnCount: number;
|
||||
/**
|
||||
* Default values for all columns. Column specific settings overwrite the default values.
|
||||
*/
|
||||
readonly columnDefault: ColumnUserConfig & {
|
||||
/**
|
||||
* The default width for each column
|
||||
*/
|
||||
readonly width: number;
|
||||
};
|
||||
};
|
||||
export declare type WritableStream = {
|
||||
readonly write: (rows: string[]) => void;
|
||||
};
|
||||
export declare type Indexable<T> = {
|
||||
readonly [index: number]: T;
|
||||
};
|
||||
2
github/codeql-action-v1/node_modules/table/dist/types/api.js
generated
vendored
Normal file
2
github/codeql-action-v1/node_modules/table/dist/types/api.js
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
1
github/codeql-action-v1/node_modules/table/dist/types/internal.d.ts
generated
vendored
Normal file
1
github/codeql-action-v1/node_modules/table/dist/types/internal.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
2
github/codeql-action-v1/node_modules/table/dist/types/internal.js
generated
vendored
Normal file
2
github/codeql-action-v1/node_modules/table/dist/types/internal.js
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
1
github/codeql-action-v1/node_modules/table/dist/utils.d.ts
generated
vendored
Normal file
1
github/codeql-action-v1/node_modules/table/dist/utils.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
92
github/codeql-action-v1/node_modules/table/dist/utils.js
generated
vendored
Normal file
92
github/codeql-action-v1/node_modules/table/dist/utils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.distributeUnevenly = exports.countSpaceSequence = exports.groupBySizes = exports.makeBorderConfig = exports.splitAnsi = exports.normalizeString = void 0;
|
||||
const slice_ansi_1 = __importDefault(require("slice-ansi"));
|
||||
const string_width_1 = __importDefault(require("string-width"));
|
||||
const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
||||
const getBorderCharacters_1 = require("./getBorderCharacters");
|
||||
/**
|
||||
* Converts Windows-style newline to Unix-style
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
const normalizeString = (input) => {
|
||||
return input.replace(/\r\n/g, '\n');
|
||||
};
|
||||
exports.normalizeString = normalizeString;
|
||||
/**
|
||||
* Splits ansi string by newlines
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
const splitAnsi = (input) => {
|
||||
const lengths = strip_ansi_1.default(input).split('\n').map(string_width_1.default);
|
||||
const result = [];
|
||||
let startIndex = 0;
|
||||
lengths.forEach((length) => {
|
||||
result.push(length === 0 ? '' : slice_ansi_1.default(input, startIndex, startIndex + length));
|
||||
// Plus 1 for the newline character itself
|
||||
startIndex += length + 1;
|
||||
});
|
||||
return result;
|
||||
};
|
||||
exports.splitAnsi = splitAnsi;
|
||||
/**
|
||||
* Merges user provided border characters with the default border ("honeywell") characters.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
const makeBorderConfig = (border) => {
|
||||
return {
|
||||
...getBorderCharacters_1.getBorderCharacters('honeywell'),
|
||||
...border,
|
||||
};
|
||||
};
|
||||
exports.makeBorderConfig = makeBorderConfig;
|
||||
/**
|
||||
* Groups the array into sub-arrays by sizes.
|
||||
*
|
||||
* @internal
|
||||
* @example
|
||||
* groupBySizes(['a', 'b', 'c', 'd', 'e'], [2, 1, 2]) = [ ['a', 'b'], ['c'], ['d', 'e'] ]
|
||||
*/
|
||||
const groupBySizes = (array, sizes) => {
|
||||
let startIndex = 0;
|
||||
return sizes.map((size) => {
|
||||
const group = array.slice(startIndex, startIndex + size);
|
||||
startIndex += size;
|
||||
return group;
|
||||
});
|
||||
};
|
||||
exports.groupBySizes = groupBySizes;
|
||||
/**
|
||||
* Counts the number of continuous spaces in a string
|
||||
*
|
||||
* @internal
|
||||
* @example
|
||||
* countGroupSpaces('a bc de f') = 3
|
||||
*/
|
||||
const countSpaceSequence = (input) => {
|
||||
var _a, _b;
|
||||
return (_b = (_a = input.match(/\s+/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
||||
};
|
||||
exports.countSpaceSequence = countSpaceSequence;
|
||||
/**
|
||||
* Creates the non-increasing number array given sum and length
|
||||
* whose the difference between maximum and minimum is not greater than 1
|
||||
*
|
||||
* @internal
|
||||
* @example
|
||||
* distributeUnevenly(6, 3) = [2, 2, 2]
|
||||
* distributeUnevenly(8, 3) = [3, 3, 2]
|
||||
*/
|
||||
const distributeUnevenly = (sum, length) => {
|
||||
const result = Array.from({ length }).fill(Math.floor(sum / length));
|
||||
return result.map((element, index) => {
|
||||
return element + (index < sum % length ? 1 : 0);
|
||||
});
|
||||
};
|
||||
exports.distributeUnevenly = distributeUnevenly;
|
||||
2
github/codeql-action-v1/node_modules/table/dist/validateConfig.d.ts
generated
vendored
Normal file
2
github/codeql-action-v1/node_modules/table/dist/validateConfig.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import type { TableUserConfig } from './types/api';
|
||||
export declare const validateConfig: (schemaId: 'config.json' | 'streamConfig.json', config: TableUserConfig) => void;
|
||||
25
github/codeql-action-v1/node_modules/table/dist/validateConfig.js
generated
vendored
Normal file
25
github/codeql-action-v1/node_modules/table/dist/validateConfig.js
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.validateConfig = void 0;
|
||||
const validators_1 = __importDefault(require("./generated/validators"));
|
||||
const validateConfig = (schemaId, config) => {
|
||||
const validate = validators_1.default[schemaId];
|
||||
if (!validate(config) && validate.errors) {
|
||||
const errors = validate.errors.map((error) => {
|
||||
return {
|
||||
message: error.message,
|
||||
params: error.params,
|
||||
schemaPath: error.schemaPath,
|
||||
};
|
||||
});
|
||||
/* eslint-disable no-console */
|
||||
console.log('config', config);
|
||||
console.log('errors', errors);
|
||||
/* eslint-enable no-console */
|
||||
throw new Error('Invalid config.');
|
||||
}
|
||||
};
|
||||
exports.validateConfig = validateConfig;
|
||||
1
github/codeql-action-v1/node_modules/table/dist/validateTableData.d.ts
generated
vendored
Normal file
1
github/codeql-action-v1/node_modules/table/dist/validateTableData.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const validateTableData: (rows: unknown[][]) => void;
|
||||
31
github/codeql-action-v1/node_modules/table/dist/validateTableData.js
generated
vendored
Normal file
31
github/codeql-action-v1/node_modules/table/dist/validateTableData.js
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.validateTableData = void 0;
|
||||
const utils_1 = require("./utils");
|
||||
const validateTableData = (rows) => {
|
||||
if (!Array.isArray(rows)) {
|
||||
throw new TypeError('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;
|
||||
for (const row of rows) {
|
||||
if (!Array.isArray(row)) {
|
||||
throw new TypeError('Table row data must be an array.');
|
||||
}
|
||||
if (row.length !== columnNumber) {
|
||||
throw new Error('Table must have a consistent number of cells.');
|
||||
}
|
||||
for (const cell of row) {
|
||||
// eslint-disable-next-line no-control-regex
|
||||
if (/[\u0001-\u0006\u0008\u0009\u000B-\u001A]/.test(utils_1.normalizeString(String(cell)))) {
|
||||
throw new Error('Table data must not contain control characters.');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.validateTableData = validateTableData;
|
||||
8
github/codeql-action-v1/node_modules/table/dist/wrapCell.d.ts
generated
vendored
Normal file
8
github/codeql-action-v1/node_modules/table/dist/wrapCell.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* Wrap a single cell value into a list of lines
|
||||
*
|
||||
* Always wraps on newlines, for the remainder uses either word or string wrapping
|
||||
* depending on user configuration.
|
||||
*
|
||||
*/
|
||||
export declare const wrapCell: (cellValue: string, cellWidth: number, useWrapWord: boolean) => string[];
|
||||
32
github/codeql-action-v1/node_modules/table/dist/wrapCell.js
generated
vendored
Normal file
32
github/codeql-action-v1/node_modules/table/dist/wrapCell.js
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.wrapCell = void 0;
|
||||
const utils_1 = require("./utils");
|
||||
const wrapString_1 = require("./wrapString");
|
||||
const wrapWord_1 = require("./wrapWord");
|
||||
/**
|
||||
* Wrap a single cell value into a list of lines
|
||||
*
|
||||
* Always wraps on newlines, for the remainder uses either word or string wrapping
|
||||
* depending on user configuration.
|
||||
*
|
||||
*/
|
||||
const wrapCell = (cellValue, cellWidth, useWrapWord) => {
|
||||
// First split on literal newlines
|
||||
const cellLines = utils_1.splitAnsi(cellValue);
|
||||
// Then iterate over the list and word-wrap every remaining line if necessary.
|
||||
for (let lineNr = 0; lineNr < cellLines.length;) {
|
||||
let lineChunks;
|
||||
if (useWrapWord) {
|
||||
lineChunks = wrapWord_1.wrapWord(cellLines[lineNr], cellWidth);
|
||||
}
|
||||
else {
|
||||
lineChunks = wrapString_1.wrapString(cellLines[lineNr], cellWidth);
|
||||
}
|
||||
// Replace our original array element with whatever the wrapping returned
|
||||
cellLines.splice(lineNr, 1, ...lineChunks);
|
||||
lineNr += lineChunks.length;
|
||||
}
|
||||
return cellLines;
|
||||
};
|
||||
exports.wrapCell = wrapCell;
|
||||
9
github/codeql-action-v1/node_modules/table/dist/wrapString.d.ts
generated
vendored
Normal file
9
github/codeql-action-v1/node_modules/table/dist/wrapString.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
export declare const wrapString: (subject: string, size: number) => string[];
|
||||
26
github/codeql-action-v1/node_modules/table/dist/wrapString.js
generated
vendored
Normal file
26
github/codeql-action-v1/node_modules/table/dist/wrapString.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.wrapString = void 0;
|
||||
const slice_ansi_1 = __importDefault(require("slice-ansi"));
|
||||
const string_width_1 = __importDefault(require("string-width"));
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
const wrapString = (subject, size) => {
|
||||
let subjectSlice = subject;
|
||||
const chunks = [];
|
||||
do {
|
||||
chunks.push(slice_ansi_1.default(subjectSlice, 0, size));
|
||||
subjectSlice = slice_ansi_1.default(subjectSlice, size).trim();
|
||||
} while (string_width_1.default(subjectSlice));
|
||||
return chunks;
|
||||
};
|
||||
exports.wrapString = wrapString;
|
||||
1
github/codeql-action-v1/node_modules/table/dist/wrapWord.d.ts
generated
vendored
Normal file
1
github/codeql-action-v1/node_modules/table/dist/wrapWord.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const wrapWord: (input: string, size: number) => string[];
|
||||
41
github/codeql-action-v1/node_modules/table/dist/wrapWord.js
generated
vendored
Normal file
41
github/codeql-action-v1/node_modules/table/dist/wrapWord.js
generated
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.wrapWord = void 0;
|
||||
const slice_ansi_1 = __importDefault(require("slice-ansi"));
|
||||
const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
||||
const calculateStringLengths = (input, size) => {
|
||||
let subject = strip_ansi_1.default(input);
|
||||
const chunks = [];
|
||||
// https://regex101.com/r/gY5kZ1/1
|
||||
const re = new RegExp('(^.{1,' + String(size) + '}(\\s+|$))|(^.{1,' + String(size - 1) + '}(\\\\|/|_|\\.|,|;|-))');
|
||||
do {
|
||||
let chunk;
|
||||
const match = re.exec(subject);
|
||||
if (match) {
|
||||
chunk = match[0];
|
||||
subject = subject.slice(chunk.length);
|
||||
const trimmedLength = chunk.trim().length;
|
||||
const offset = chunk.length - trimmedLength;
|
||||
chunks.push([trimmedLength, offset]);
|
||||
}
|
||||
else {
|
||||
chunk = subject.slice(0, size);
|
||||
subject = subject.slice(size);
|
||||
chunks.push([chunk.length, 0]);
|
||||
}
|
||||
} while (subject.length);
|
||||
return chunks;
|
||||
};
|
||||
const wrapWord = (input, size) => {
|
||||
const result = [];
|
||||
let startIndex = 0;
|
||||
calculateStringLengths(input, size).forEach(([length, offset]) => {
|
||||
result.push(slice_ansi_1.default(input, startIndex, startIndex + length));
|
||||
startIndex += length + offset;
|
||||
});
|
||||
return result;
|
||||
};
|
||||
exports.wrapWord = wrapWord;
|
||||
23
github/codeql-action-v1/node_modules/table/node_modules/ajv/.runkit_example.js
generated
vendored
Normal file
23
github/codeql-action-v1/node_modules/table/node_modules/ajv/.runkit_example.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
const Ajv = require("ajv")
|
||||
const ajv = new Ajv({allErrors: true})
|
||||
|
||||
const schema = {
|
||||
type: "object",
|
||||
properties: {
|
||||
foo: {type: "string"},
|
||||
bar: {type: "number", maximum: 3},
|
||||
},
|
||||
required: ["foo", "bar"],
|
||||
additionalProperties: false,
|
||||
}
|
||||
|
||||
const validate = ajv.compile(schema)
|
||||
|
||||
test({foo: "abc", bar: 2})
|
||||
test({foo: 2, bar: 4})
|
||||
|
||||
function test(data) {
|
||||
const valid = validate(data)
|
||||
if (valid) console.log("Valid!")
|
||||
else console.log("Invalid: " + ajv.errorsText(validate.errors))
|
||||
}
|
||||
22
github/codeql-action-v1/node_modules/table/node_modules/ajv/LICENSE
generated
vendored
Normal file
22
github/codeql-action-v1/node_modules/table/node_modules/ajv/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2021 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.
|
||||
|
||||
204
github/codeql-action-v1/node_modules/table/node_modules/ajv/README.md
generated
vendored
Normal file
204
github/codeql-action-v1/node_modules/table/node_modules/ajv/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
<img align="right" alt="Ajv logo" width="160" src="https://ajv.js.org/img/ajv.svg">
|
||||
|
||||
|
||||
|
||||
# Ajv JSON schema validator
|
||||
|
||||
The fastest JSON validator for Node.js and browser.
|
||||
|
||||
Supports JSON Schema draft-04/06/07/2019-09/2020-12 ([draft-04 support](https://ajv.js.org/json-schema.html#draft-04) requires ajv-draft-04 package) and JSON Type Definition [RFC8927](https://datatracker.ietf.org/doc/rfc8927/).
|
||||
|
||||
[](https://github.com/ajv-validator/ajv/actions?query=workflow%3Abuild)
|
||||
[](https://www.npmjs.com/package/ajv)
|
||||
[](https://www.npmjs.com/package/ajv)
|
||||
[](https://coveralls.io/github/ajv-validator/ajv?branch=master)
|
||||
[](https://gitter.im/ajv-validator/ajv)
|
||||
[](https://github.com/sponsors/epoberezkin)
|
||||
|
||||
## Platinum sponsors
|
||||
|
||||
[<img src="https://ajv.js.org/img/mozilla.svg" width="45%">](https://www.mozilla.org)<img src="https://ajv.js.org/img/gap.svg" width="8%">[<img src="https://ajv.js.org/img/reserved.svg" width="45%">](https://opencollective.com/ajv)
|
||||
|
||||
## Ajv online event - May 20, 10am PT / 6pm UK
|
||||
|
||||
We will talk about:
|
||||
- new features of Ajv version 8.
|
||||
- the improvements sponsored by Mozilla's MOSS grant.
|
||||
- how Ajv is used in JavaScript applications.
|
||||
|
||||
Speakers:
|
||||
- [Evgeny Poberezkin](https://github.com/epoberezkin), the creator of Ajv.
|
||||
- [Mehan Jayasuriya](https://github.com/mehan), Program Officer at Mozilla Foundation, leading the [MOSS](https://www.mozilla.org/en-US/moss/) and other programs investing in the open source and community ecosystems.
|
||||
- [Matteo Collina](https://github.com/mcollina), Technical Director at NearForm and Node.js Technical Steering Committee member, creator of Fastify web framework.
|
||||
- [Kin Lane](https://github.com/kinlane), Chief Evangelist at Postman. Studying the tech, business & politics of APIs since 2010. Presidential Innovation Fellow during the Obama administration.
|
||||
- [Ulysse Carion](https://github.com/ucarion), the creator of JSON Type Definition specification.
|
||||
|
||||
[Gajus Kuizinas](https://github.com/gajus) will host the event.
|
||||
|
||||
Please [register here](https://us02web.zoom.us/webinar/register/2716192553618/WN_erJ_t4ICTHOnGC1SOybNnw).
|
||||
|
||||
## Contributing
|
||||
|
||||
More than 100 people contributed to Ajv, and we would love to have you join the development. We welcome implementing new features that will benefit many users and ideas to improve our documentation.
|
||||
|
||||
Please review [Contributing guidelines](./CONTRIBUTING.md) and [Code components](https://ajv.js.org/components.html).
|
||||
|
||||
## Documentation
|
||||
|
||||
All documentation is available on the [Ajv website](https://ajv.js.org).
|
||||
|
||||
Some useful site links:
|
||||
- [Getting started](https://ajv.js.org/guide/getting-started.html)
|
||||
- [JSON Schema vs JSON Type Definition](https://ajv.js.org/guide/schema-language.html)
|
||||
- [API reference](https://ajv.js.org/api.html)
|
||||
- [Strict mode](https://ajv.js.org/strict-mode.html)
|
||||
- [Standalone validation code](https://ajv.js.org/standalone.html)
|
||||
- [Security considerations](https://ajv.js.org/security.html)
|
||||
- [Command line interface](https://ajv.js.org/packages/ajv-cli.html)
|
||||
- [Frequently Asked Questions](https://ajv.js.org/faq.html)
|
||||
|
||||
## <a name="sponsors"></a>Please [sponsor Ajv development](https://github.com/sponsors/epoberezkin)
|
||||
|
||||
Since I asked to support Ajv development 40 people and 6 organizations contributed via GitHub and OpenCollective - this support helped receiving the MOSS grant!
|
||||
|
||||
Your continuing support is very important - the funds will be used to develop and maintain Ajv once the next major version is released.
|
||||
|
||||
Please sponsor Ajv via:
|
||||
|
||||
- [GitHub sponsors page](https://github.com/sponsors/epoberezkin) (GitHub will match it)
|
||||
- [Ajv Open Collective️](https://opencollective.com/ajv)
|
||||
|
||||
Thank you.
|
||||
|
||||
#### Open Collective sponsors
|
||||
|
||||
<a href="https://opencollective.com/ajv"><img src="https://opencollective.com/ajv/individuals.svg?width=890"></a>
|
||||
|
||||
<a href="https://opencollective.com/ajv/organization/0/website"><img src="https://opencollective.com/ajv/organization/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/1/website"><img src="https://opencollective.com/ajv/organization/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/2/website"><img src="https://opencollective.com/ajv/organization/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/3/website"><img src="https://opencollective.com/ajv/organization/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/4/website"><img src="https://opencollective.com/ajv/organization/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/5/website"><img src="https://opencollective.com/ajv/organization/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/6/website"><img src="https://opencollective.com/ajv/organization/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/7/website"><img src="https://opencollective.com/ajv/organization/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/8/website"><img src="https://opencollective.com/ajv/organization/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/9/website"><img src="https://opencollective.com/ajv/organization/9/avatar.svg"></a>
|
||||
|
||||
## Performance
|
||||
|
||||
Ajv generates code to turn JSON Schemas into super-fast validation functions that are efficient for v8 optimization.
|
||||
|
||||
Currently Ajv is the fastest and the most standard compliant validator according to these benchmarks:
|
||||
|
||||
- [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark) - 50% faster than the second place
|
||||
- [jsck benchmark](https://github.com/pandastrike/jsck#benchmarks) - 20-190% faster
|
||||
- [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html)
|
||||
- [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html)
|
||||
|
||||
Performance of different validators by [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark):
|
||||
|
||||
[](https://github.com/ebdrup/json-schema-benchmark/blob/master/README.md#performance)
|
||||
|
||||
## Features
|
||||
|
||||
- Ajv implements JSON Schema [draft-06/07/2019-09/2020-12](http://json-schema.org/) standards (draft-04 is supported in v6):
|
||||
- all validation keywords (see [JSON Schema validation keywords](https://ajv.js.org/json-schema.html))
|
||||
- [OpenAPI](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md) extensions:
|
||||
- NEW: keyword [discriminator](https://ajv.js.org/json-schema.html#discriminator).
|
||||
- keyword [nullable](https://ajv.js.org/json-schema.html#nullable).
|
||||
- full support of remote references (remote schemas have to be added with `addSchema` or compiled to be available)
|
||||
- support of recursive references between schemas
|
||||
- correct string lengths for strings with unicode pairs
|
||||
- JSON Schema [formats](https://ajv.js.org/guide/formats.html) (with [ajv-formats](https://github.com/ajv-validator/ajv-formats) plugin).
|
||||
- [validates schemas against meta-schema](https://ajv.js.org/api.html#api-validateschema)
|
||||
- NEW: supports [JSON Type Definition](https://datatracker.ietf.org/doc/rfc8927/):
|
||||
- all keywords (see [JSON Type Definition schema forms](https://ajv.js.org/json-type-definition.html))
|
||||
- meta-schema for JTD schemas
|
||||
- "union" keyword and user-defined keywords (can be used inside "metadata" member of the schema)
|
||||
- supports [browsers](https://ajv.js.org/guide/environments.html#browsers) and Node.js 10.x - current
|
||||
- [asynchronous loading](https://ajv.js.org/guide/managing-schemas.html#asynchronous-schema-loading) of referenced schemas during compilation
|
||||
- "All errors" validation mode with [option allErrors](https://ajv.js.org/options.html#allerrors)
|
||||
- [error messages with parameters](https://ajv.js.org/api.html#validation-errors) describing error reasons to allow error message generation
|
||||
- i18n error messages support with [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) package
|
||||
- [removing-additional-properties](https://ajv.js.org/guide/modifying-data.html#removing-additional-properties)
|
||||
- [assigning defaults](https://ajv.js.org/guide/modifying-data.html#assigning-defaults) to missing properties and items
|
||||
- [coercing data](https://ajv.js.org/guide/modifying-data.html#coercing-data-types) to the types specified in `type` keywords
|
||||
- [user-defined keywords](https://ajv.js.org/guide/user-keywords.html)
|
||||
- additional extension keywords with [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package
|
||||
- [\$data reference](https://ajv.js.org/guide/combining-schemas.html#data-reference) to use values from the validated data as values for the schema keywords
|
||||
- [asynchronous validation](https://ajv.js.org/guide/async-validation.html) of user-defined formats and keywords
|
||||
|
||||
## Install
|
||||
|
||||
To install version 8:
|
||||
|
||||
```
|
||||
npm install ajv
|
||||
```
|
||||
|
||||
## <a name="usage"></a>Getting started
|
||||
|
||||
Try it in the Node.js REPL: https://runkit.com/npm/ajv
|
||||
|
||||
In JavaScript:
|
||||
|
||||
```javascript
|
||||
// or ESM/TypeScript import
|
||||
import Ajv from "ajv"
|
||||
// Node.js require:
|
||||
const Ajv = require("ajv")
|
||||
|
||||
const ajv = new Ajv() // options can be passed, e.g. {allErrors: true}
|
||||
|
||||
const schema = {
|
||||
type: "object",
|
||||
properties: {
|
||||
foo: {type: "integer"},
|
||||
bar: {type: "string"}
|
||||
},
|
||||
required: ["foo"],
|
||||
additionalProperties: false,
|
||||
}
|
||||
|
||||
const data = {
|
||||
foo: 1,
|
||||
bar: "abc"
|
||||
}
|
||||
|
||||
const validate = ajv.compile(schema)
|
||||
const valid = validate(data)
|
||||
if (!valid) console.log(validate.errors)
|
||||
```
|
||||
|
||||
Learn how to use Ajv and see more examples in the [Guide: getting started](https://ajv.js.org/guide/getting-started.html)
|
||||
|
||||
## Changes history
|
||||
|
||||
See [https://github.com/ajv-validator/ajv/releases](https://github.com/ajv-validator/ajv/releases)
|
||||
|
||||
**Please note**: [Changes in version 8.0.0](https://github.com/ajv-validator/ajv/releases/tag/v8.0.0)
|
||||
|
||||
[Version 7.0.0](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0)
|
||||
|
||||
[Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0).
|
||||
|
||||
## Code of conduct
|
||||
|
||||
Please review and follow the [Code of conduct](./CODE_OF_CONDUCT.md).
|
||||
|
||||
Please report any unacceptable behaviour to ajv.validator@gmail.com - it will be reviewed by the project team.
|
||||
|
||||
## Security contact
|
||||
|
||||
To report a security vulnerability, please use the
|
||||
[Tidelift security contact](https://tidelift.com/security).
|
||||
Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerabilities via GitHub issues.
|
||||
|
||||
## Open-source software support
|
||||
|
||||
Ajv is a part of [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-ajv?utm_source=npm-ajv&utm_medium=referral&utm_campaign=readme) - it provides a centralised support to open-source software users, in addition to the support provided by software maintainers.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](./LICENSE)
|
||||
17
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/2019.d.ts
generated
vendored
Normal file
17
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/2019.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import type { AnySchemaObject } from "./types";
|
||||
import AjvCore, { Options } from "./core";
|
||||
declare class Ajv2019 extends AjvCore {
|
||||
constructor(opts?: Options);
|
||||
_addVocabularies(): void;
|
||||
_addDefaultMetaSchema(): void;
|
||||
defaultMeta(): string | AnySchemaObject | undefined;
|
||||
}
|
||||
export default Ajv2019;
|
||||
export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, } from "./types";
|
||||
export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core";
|
||||
export { SchemaCxt, SchemaObjCxt } from "./compile";
|
||||
export { KeywordCxt } from "./compile/validate";
|
||||
export { DefinedError } from "./vocabularies/errors";
|
||||
export { JSONType } from "./compile/rules";
|
||||
export { JSONSchemaType } from "./types/json-schema";
|
||||
export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen";
|
||||
55
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/2019.js
generated
vendored
Normal file
55
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/2019.js
generated
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
||||
const core_1 = require("./core");
|
||||
const draft7_1 = require("./vocabularies/draft7");
|
||||
const dynamic_1 = require("./vocabularies/dynamic");
|
||||
const next_1 = require("./vocabularies/next");
|
||||
const unevaluated_1 = require("./vocabularies/unevaluated");
|
||||
const discriminator_1 = require("./vocabularies/discriminator");
|
||||
const json_schema_2019_09_1 = require("./refs/json-schema-2019-09");
|
||||
const META_SCHEMA_ID = "https://json-schema.org/draft/2019-09/schema";
|
||||
class Ajv2019 extends core_1.default {
|
||||
constructor(opts = {}) {
|
||||
super({
|
||||
...opts,
|
||||
dynamicRef: true,
|
||||
next: true,
|
||||
unevaluated: true,
|
||||
});
|
||||
}
|
||||
_addVocabularies() {
|
||||
super._addVocabularies();
|
||||
this.addVocabulary(dynamic_1.default);
|
||||
draft7_1.default.forEach((v) => this.addVocabulary(v));
|
||||
this.addVocabulary(next_1.default);
|
||||
this.addVocabulary(unevaluated_1.default);
|
||||
if (this.opts.discriminator)
|
||||
this.addKeyword(discriminator_1.default);
|
||||
}
|
||||
_addDefaultMetaSchema() {
|
||||
super._addDefaultMetaSchema();
|
||||
const { $data, meta } = this.opts;
|
||||
if (!meta)
|
||||
return;
|
||||
json_schema_2019_09_1.default.call(this, $data);
|
||||
this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
|
||||
}
|
||||
defaultMeta() {
|
||||
return (this.opts.defaultMeta =
|
||||
super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
|
||||
}
|
||||
}
|
||||
module.exports = exports = Ajv2019;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Ajv2019;
|
||||
var validate_1 = require("./compile/validate");
|
||||
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
|
||||
var codegen_1 = require("./compile/codegen");
|
||||
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
|
||||
Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
|
||||
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
|
||||
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
|
||||
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
|
||||
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
|
||||
//# sourceMappingURL=2019.js.map
|
||||
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/2019.js.map
generated
vendored
Normal file
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/2019.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"2019.js","sourceRoot":"","sources":["../lib/2019.ts"],"names":[],"mappings":";;;AACA,iCAAuC;AAEvC,kDAAsD;AACtD,oDAAsD;AACtD,8CAAgD;AAChD,4DAA8D;AAC9D,gEAAwD;AACxD,oEAA0D;AAE1D,MAAM,cAAc,GAAG,8CAA8C,CAAA;AAErE,MAAM,OAAQ,SAAQ,cAAO;IAC3B,YAAY,OAAgB,EAAE;QAC5B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,IAAI;SAClB,CAAC,CAAA;IACJ,CAAC;IAED,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAA;QACrC,gBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QACxD,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;QAClC,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAA;QACzC,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,UAAU,CAAC,uBAAa,CAAC,CAAA;IAC7D,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,MAAM,EAAC,KAAK,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;QAC/B,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,6BAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACnC,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,GAAG,cAAc,CAAA;IAC7D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAC3B,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACzF,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAA;AAClC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,OAAO,CAAA;AAyBtB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAIlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA"}
|
||||
17
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/2020.d.ts
generated
vendored
Normal file
17
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/2020.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import type { AnySchemaObject } from "./types";
|
||||
import AjvCore, { Options } from "./core";
|
||||
declare class Ajv2020 extends AjvCore {
|
||||
constructor(opts?: Options);
|
||||
_addVocabularies(): void;
|
||||
_addDefaultMetaSchema(): void;
|
||||
defaultMeta(): string | AnySchemaObject | undefined;
|
||||
}
|
||||
export default Ajv2020;
|
||||
export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, } from "./types";
|
||||
export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core";
|
||||
export { SchemaCxt, SchemaObjCxt } from "./compile";
|
||||
export { KeywordCxt } from "./compile/validate";
|
||||
export { DefinedError } from "./vocabularies/errors";
|
||||
export { JSONType } from "./compile/rules";
|
||||
export { JSONSchemaType } from "./types/json-schema";
|
||||
export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen";
|
||||
49
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/2020.js
generated
vendored
Normal file
49
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/2020.js
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
||||
const core_1 = require("./core");
|
||||
const draft2020_1 = require("./vocabularies/draft2020");
|
||||
const discriminator_1 = require("./vocabularies/discriminator");
|
||||
const json_schema_2020_12_1 = require("./refs/json-schema-2020-12");
|
||||
const META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema";
|
||||
class Ajv2020 extends core_1.default {
|
||||
constructor(opts = {}) {
|
||||
super({
|
||||
...opts,
|
||||
dynamicRef: true,
|
||||
next: true,
|
||||
unevaluated: true,
|
||||
});
|
||||
}
|
||||
_addVocabularies() {
|
||||
super._addVocabularies();
|
||||
draft2020_1.default.forEach((v) => this.addVocabulary(v));
|
||||
if (this.opts.discriminator)
|
||||
this.addKeyword(discriminator_1.default);
|
||||
}
|
||||
_addDefaultMetaSchema() {
|
||||
super._addDefaultMetaSchema();
|
||||
const { $data, meta } = this.opts;
|
||||
if (!meta)
|
||||
return;
|
||||
json_schema_2020_12_1.default.call(this, $data);
|
||||
this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
|
||||
}
|
||||
defaultMeta() {
|
||||
return (this.opts.defaultMeta =
|
||||
super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
|
||||
}
|
||||
}
|
||||
module.exports = exports = Ajv2020;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Ajv2020;
|
||||
var validate_1 = require("./compile/validate");
|
||||
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
|
||||
var codegen_1 = require("./compile/codegen");
|
||||
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
|
||||
Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
|
||||
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
|
||||
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
|
||||
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
|
||||
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
|
||||
//# sourceMappingURL=2020.js.map
|
||||
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/2020.js.map
generated
vendored
Normal file
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/2020.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"2020.js","sourceRoot":"","sources":["../lib/2020.ts"],"names":[],"mappings":";;;AACA,iCAAuC;AAEvC,wDAA4D;AAC5D,gEAAwD;AACxD,oEAA0D;AAE1D,MAAM,cAAc,GAAG,8CAA8C,CAAA;AAErE,MAAM,OAAQ,SAAQ,cAAO;IAC3B,YAAY,OAAgB,EAAE;QAC5B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,IAAI;SAClB,CAAC,CAAA;IACJ,CAAC;IAED,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,mBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QAC3D,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,UAAU,CAAC,uBAAa,CAAC,CAAA;IAC7D,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,MAAM,EAAC,KAAK,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;QAC/B,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,6BAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACnC,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,GAAG,cAAc,CAAA;IAC7D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAC3B,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACzF,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAA;AAClC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,OAAO,CAAA;AAyBtB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAIlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA"}
|
||||
16
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/ajv.d.ts
generated
vendored
Normal file
16
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/ajv.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import type { AnySchemaObject } from "./types";
|
||||
import AjvCore from "./core";
|
||||
declare class Ajv extends AjvCore {
|
||||
_addVocabularies(): void;
|
||||
_addDefaultMetaSchema(): void;
|
||||
defaultMeta(): string | AnySchemaObject | undefined;
|
||||
}
|
||||
export default Ajv;
|
||||
export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, SchemaValidateFunction, ErrorObject, ErrorNoParams, } from "./types";
|
||||
export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core";
|
||||
export { SchemaCxt, SchemaObjCxt } from "./compile";
|
||||
export { KeywordCxt } from "./compile/validate";
|
||||
export { DefinedError } from "./vocabularies/errors";
|
||||
export { JSONType } from "./compile/rules";
|
||||
export { JSONSchemaType } from "./types/json-schema";
|
||||
export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen";
|
||||
44
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/ajv.js
generated
vendored
Normal file
44
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/ajv.js
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
||||
const core_1 = require("./core");
|
||||
const draft7_1 = require("./vocabularies/draft7");
|
||||
const discriminator_1 = require("./vocabularies/discriminator");
|
||||
const draft7MetaSchema = require("./refs/json-schema-draft-07.json");
|
||||
const META_SUPPORT_DATA = ["/properties"];
|
||||
const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema";
|
||||
class Ajv extends core_1.default {
|
||||
_addVocabularies() {
|
||||
super._addVocabularies();
|
||||
draft7_1.default.forEach((v) => this.addVocabulary(v));
|
||||
if (this.opts.discriminator)
|
||||
this.addKeyword(discriminator_1.default);
|
||||
}
|
||||
_addDefaultMetaSchema() {
|
||||
super._addDefaultMetaSchema();
|
||||
if (!this.opts.meta)
|
||||
return;
|
||||
const metaSchema = this.opts.$data
|
||||
? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA)
|
||||
: draft7MetaSchema;
|
||||
this.addMetaSchema(metaSchema, META_SCHEMA_ID, false);
|
||||
this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
|
||||
}
|
||||
defaultMeta() {
|
||||
return (this.opts.defaultMeta =
|
||||
super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
|
||||
}
|
||||
}
|
||||
module.exports = exports = Ajv;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Ajv;
|
||||
var validate_1 = require("./compile/validate");
|
||||
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
|
||||
var codegen_1 = require("./compile/codegen");
|
||||
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
|
||||
Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
|
||||
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
|
||||
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
|
||||
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
|
||||
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
|
||||
//# sourceMappingURL=ajv.js.map
|
||||
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/ajv.js.map
generated
vendored
Normal file
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/ajv.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"ajv.js","sourceRoot":"","sources":["../lib/ajv.ts"],"names":[],"mappings":";;;AACA,iCAA4B;AAC5B,kDAAsD;AACtD,gEAAwD;AACxD,qEAAoE;AAEpE,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AAEzC,MAAM,cAAc,GAAG,wCAAwC,CAAA;AAE/D,MAAM,GAAI,SAAQ,cAAO;IACvB,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,gBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QACxD,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,UAAU,CAAC,uBAAa,CAAC,CAAA;IAC7D,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAM;QAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK;YAChC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;YAC3D,CAAC,CAAC,gBAAgB,CAAA;QACpB,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,KAAK,CAAC,CAAA;QACrD,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,GAAG,cAAc,CAAA;IAC7D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAC3B,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACzF,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,GAAG,CAAA;AAC9B,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,GAAG,CAAA;AA0BlB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAIlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA"}
|
||||
39
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/code.d.ts
generated
vendored
Normal file
39
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/code.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
export declare abstract class _CodeOrName {
|
||||
abstract readonly str: string;
|
||||
abstract readonly names: UsedNames;
|
||||
abstract toString(): string;
|
||||
abstract emptyStr(): boolean;
|
||||
}
|
||||
export declare const IDENTIFIER: RegExp;
|
||||
export declare class Name extends _CodeOrName {
|
||||
readonly str: string;
|
||||
constructor(s: string);
|
||||
toString(): string;
|
||||
emptyStr(): boolean;
|
||||
get names(): UsedNames;
|
||||
}
|
||||
export declare class _Code extends _CodeOrName {
|
||||
readonly _items: readonly CodeItem[];
|
||||
private _str?;
|
||||
private _names?;
|
||||
constructor(code: string | readonly CodeItem[]);
|
||||
toString(): string;
|
||||
emptyStr(): boolean;
|
||||
get str(): string;
|
||||
get names(): UsedNames;
|
||||
}
|
||||
export declare type CodeItem = Name | string | number | boolean | null;
|
||||
export declare type UsedNames = Record<string, number | undefined>;
|
||||
export declare type Code = _Code | Name;
|
||||
export declare type SafeExpr = Code | number | boolean | null;
|
||||
export declare const nil: _Code;
|
||||
declare type CodeArg = SafeExpr | string | undefined;
|
||||
export declare function _(strs: TemplateStringsArray, ...args: CodeArg[]): _Code;
|
||||
export declare function str(strs: TemplateStringsArray, ...args: (CodeArg | string[])[]): _Code;
|
||||
export declare function addCodeArg(code: CodeItem[], arg: CodeArg | string[]): void;
|
||||
export declare function strConcat(c1: Code, c2: Code): Code;
|
||||
export declare function stringify(x: unknown): Code;
|
||||
export declare function safeStringify(x: unknown): string;
|
||||
export declare function getProperty(key: Code | string | number): Code;
|
||||
export declare function regexpCode(rx: RegExp): Code;
|
||||
export {};
|
||||
147
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/code.js
generated
vendored
Normal file
147
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/code.js
generated
vendored
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.regexpCode = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
|
||||
class _CodeOrName {
|
||||
}
|
||||
exports._CodeOrName = _CodeOrName;
|
||||
exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
||||
class Name extends _CodeOrName {
|
||||
constructor(s) {
|
||||
super();
|
||||
if (!exports.IDENTIFIER.test(s))
|
||||
throw new Error("CodeGen: name must be a valid identifier");
|
||||
this.str = s;
|
||||
}
|
||||
toString() {
|
||||
return this.str;
|
||||
}
|
||||
emptyStr() {
|
||||
return false;
|
||||
}
|
||||
get names() {
|
||||
return { [this.str]: 1 };
|
||||
}
|
||||
}
|
||||
exports.Name = Name;
|
||||
class _Code extends _CodeOrName {
|
||||
constructor(code) {
|
||||
super();
|
||||
this._items = typeof code === "string" ? [code] : code;
|
||||
}
|
||||
toString() {
|
||||
return this.str;
|
||||
}
|
||||
emptyStr() {
|
||||
if (this._items.length > 1)
|
||||
return false;
|
||||
const item = this._items[0];
|
||||
return item === "" || item === '""';
|
||||
}
|
||||
get str() {
|
||||
var _a;
|
||||
return ((_a = this._str) !== null && _a !== void 0 ? _a : (this._str = this._items.reduce((s, c) => `${s}${c}`, "")));
|
||||
}
|
||||
get names() {
|
||||
var _a;
|
||||
return ((_a = this._names) !== null && _a !== void 0 ? _a : (this._names = this._items.reduce((names, c) => {
|
||||
if (c instanceof Name)
|
||||
names[c.str] = (names[c.str] || 0) + 1;
|
||||
return names;
|
||||
}, {})));
|
||||
}
|
||||
}
|
||||
exports._Code = _Code;
|
||||
exports.nil = new _Code("");
|
||||
function _(strs, ...args) {
|
||||
const code = [strs[0]];
|
||||
let i = 0;
|
||||
while (i < args.length) {
|
||||
addCodeArg(code, args[i]);
|
||||
code.push(strs[++i]);
|
||||
}
|
||||
return new _Code(code);
|
||||
}
|
||||
exports._ = _;
|
||||
const plus = new _Code("+");
|
||||
function str(strs, ...args) {
|
||||
const expr = [safeStringify(strs[0])];
|
||||
let i = 0;
|
||||
while (i < args.length) {
|
||||
expr.push(plus);
|
||||
addCodeArg(expr, args[i]);
|
||||
expr.push(plus, safeStringify(strs[++i]));
|
||||
}
|
||||
optimize(expr);
|
||||
return new _Code(expr);
|
||||
}
|
||||
exports.str = str;
|
||||
function addCodeArg(code, arg) {
|
||||
if (arg instanceof _Code)
|
||||
code.push(...arg._items);
|
||||
else if (arg instanceof Name)
|
||||
code.push(arg);
|
||||
else
|
||||
code.push(interpolate(arg));
|
||||
}
|
||||
exports.addCodeArg = addCodeArg;
|
||||
function optimize(expr) {
|
||||
let i = 1;
|
||||
while (i < expr.length - 1) {
|
||||
if (expr[i] === plus) {
|
||||
const res = mergeExprItems(expr[i - 1], expr[i + 1]);
|
||||
if (res !== undefined) {
|
||||
expr.splice(i - 1, 3, res);
|
||||
continue;
|
||||
}
|
||||
expr[i++] = "+";
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
function mergeExprItems(a, b) {
|
||||
if (b === '""')
|
||||
return a;
|
||||
if (a === '""')
|
||||
return b;
|
||||
if (typeof a == "string") {
|
||||
if (b instanceof Name || a[a.length - 1] !== '"')
|
||||
return;
|
||||
if (typeof b != "string")
|
||||
return `${a.slice(0, -1)}${b}"`;
|
||||
if (b[0] === '"')
|
||||
return a.slice(0, -1) + b.slice(1);
|
||||
return;
|
||||
}
|
||||
if (typeof b == "string" && b[0] === '"' && !(a instanceof Name))
|
||||
return `"${a}${b.slice(1)}`;
|
||||
return;
|
||||
}
|
||||
function strConcat(c1, c2) {
|
||||
return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str `${c1}${c2}`;
|
||||
}
|
||||
exports.strConcat = strConcat;
|
||||
// TODO do not allow arrays here
|
||||
function interpolate(x) {
|
||||
return typeof x == "number" || typeof x == "boolean" || x === null
|
||||
? x
|
||||
: safeStringify(Array.isArray(x) ? x.join(",") : x);
|
||||
}
|
||||
function stringify(x) {
|
||||
return new _Code(safeStringify(x));
|
||||
}
|
||||
exports.stringify = stringify;
|
||||
function safeStringify(x) {
|
||||
return JSON.stringify(x)
|
||||
.replace(/\u2028/g, "\\u2028")
|
||||
.replace(/\u2029/g, "\\u2029");
|
||||
}
|
||||
exports.safeStringify = safeStringify;
|
||||
function getProperty(key) {
|
||||
return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`;
|
||||
}
|
||||
exports.getProperty = getProperty;
|
||||
function regexpCode(rx) {
|
||||
return new _Code(rx.toString());
|
||||
}
|
||||
exports.regexpCode = regexpCode;
|
||||
//# sourceMappingURL=code.js.map
|
||||
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/code.js.map
generated
vendored
Normal file
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/code.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"code.js","sourceRoot":"","sources":["../../../lib/compile/codegen/code.ts"],"names":[],"mappings":";;;AAAA,MAAsB,WAAW;CAKhC;AALD,kCAKC;AAEY,QAAA,UAAU,GAAG,uBAAuB,CAAA;AAEjD,MAAa,IAAK,SAAQ,WAAW;IAEnC,YAAY,CAAS;QACnB,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,kBAAU,CAAC,IAAI,CAAC,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;QACpF,IAAI,CAAC,GAAG,GAAG,CAAC,CAAA;IACd,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,GAAG,CAAA;IACjB,CAAC;IAED,QAAQ;QACN,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,KAAK;QACP,OAAO,EAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAC,CAAA;IACxB,CAAC;CACF;AAnBD,oBAmBC;AAED,MAAa,KAAM,SAAQ,WAAW;IAKpC,YAAY,IAAkC;QAC5C,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,MAAM,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACxD,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,GAAG,CAAA;IACjB,CAAC;IAED,QAAQ;QACN,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,KAAK,CAAA;QACxC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAC3B,OAAO,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,IAAI,CAAA;IACrC,CAAC;IAED,IAAI,GAAG;;QACL,OAAO,OAAC,IAAI,CAAC,IAAI,oCAAT,IAAI,CAAC,IAAI,GAAK,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAS,EAAE,CAAW,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,EAAC,CAAA;IACvF,CAAC;IAED,IAAI,KAAK;;QACP,OAAO,OAAC,IAAI,CAAC,MAAM,oCAAX,IAAI,CAAC,MAAM,GAAK,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAgB,EAAE,CAAC,EAAE,EAAE;YACjE,IAAI,CAAC,YAAY,IAAI;gBAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA;YAC7D,OAAO,KAAK,CAAA;QACd,CAAC,EAAE,EAAE,CAAC,EAAC,CAAA;IACT,CAAC;CACF;AA9BD,sBA8BC;AAUY,QAAA,GAAG,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAA;AAIhC,SAAgB,CAAC,CAAC,IAA0B,EAAE,GAAG,IAAe;IAC9D,MAAM,IAAI,GAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;IAClC,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE;QACtB,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;QACzB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;KACrB;IACD,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,CAAA;AACxB,CAAC;AARD,cAQC;AAED,MAAM,IAAI,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;AAE3B,SAAgB,GAAG,CAAC,IAA0B,EAAE,GAAG,IAA4B;IAC7E,MAAM,IAAI,GAAe,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACjD,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE;QACtB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACf,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;QACzB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KAC1C;IACD,QAAQ,CAAC,IAAI,CAAC,CAAA;IACd,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,CAAA;AACxB,CAAC;AAVD,kBAUC;AAED,SAAgB,UAAU,CAAC,IAAgB,EAAE,GAAuB;IAClE,IAAI,GAAG,YAAY,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;SAC7C,IAAI,GAAG,YAAY,IAAI;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;;QACvC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;AAClC,CAAC;AAJD,gCAIC;AAED,SAAS,QAAQ,CAAC,IAAgB;IAChC,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QAC1B,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;YACpB,MAAM,GAAG,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;YACpD,IAAI,GAAG,KAAK,SAAS,EAAE;gBACrB,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAA;gBAC1B,SAAQ;aACT;YACD,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,CAAA;SAChB;QACD,CAAC,EAAE,CAAA;KACJ;AACH,CAAC;AAED,SAAS,cAAc,CAAC,CAAW,EAAE,CAAW;IAC9C,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,CAAC,CAAA;IACxB,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,CAAC,CAAA;IACxB,IAAI,OAAO,CAAC,IAAI,QAAQ,EAAE;QACxB,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG;YAAE,OAAM;QACxD,IAAI,OAAO,CAAC,IAAI,QAAQ;YAAE,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA;QACzD,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG;YAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACpD,OAAM;KACP;IACD,IAAI,OAAO,CAAC,IAAI,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAC7F,OAAM;AACR,CAAC;AAED,SAAgB,SAAS,CAAC,EAAQ,EAAE,EAAQ;IAC1C,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA,GAAG,EAAE,GAAG,EAAE,EAAE,CAAA;AAClE,CAAC;AAFD,8BAEC;AAED,gCAAgC;AAChC,SAAS,WAAW,CAAC,CAA+C;IAClE,OAAO,OAAO,CAAC,IAAI,QAAQ,IAAI,OAAO,CAAC,IAAI,SAAS,IAAI,CAAC,KAAK,IAAI;QAChE,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACvD,CAAC;AAED,SAAgB,SAAS,CAAC,CAAU;IAClC,OAAO,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;AACpC,CAAC;AAFD,8BAEC;AAED,SAAgB,aAAa,CAAC,CAAU;IACtC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC;SAC7B,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;AAClC,CAAC;AAJD,sCAIC;AAED,SAAgB,WAAW,CAAC,GAA2B;IACrD,OAAO,OAAO,GAAG,IAAI,QAAQ,IAAI,kBAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,IAAI,GAAG,GAAG,CAAA;AAC5F,CAAC;AAFD,kCAEC;AAED,SAAgB,UAAU,CAAC,EAAU;IACnC,OAAO,IAAI,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAA;AACjC,CAAC;AAFD,gCAEC"}
|
||||
79
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/index.d.ts
generated
vendored
Normal file
79
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
import type { ScopeValueSets, NameValue, ValueScope, ValueScopeName } from "./scope";
|
||||
import { _Code, Code, Name } from "./code";
|
||||
import { Scope } from "./scope";
|
||||
export { _, str, strConcat, nil, getProperty, stringify, regexpCode, Name, Code } from "./code";
|
||||
export { Scope, ScopeStore, ValueScope, ValueScopeName, ScopeValueSets, varKinds } from "./scope";
|
||||
export declare type SafeExpr = Code | number | boolean | null;
|
||||
export declare type Block = Code | (() => void);
|
||||
export declare const operators: {
|
||||
GT: _Code;
|
||||
GTE: _Code;
|
||||
LT: _Code;
|
||||
LTE: _Code;
|
||||
EQ: _Code;
|
||||
NEQ: _Code;
|
||||
NOT: _Code;
|
||||
OR: _Code;
|
||||
AND: _Code;
|
||||
ADD: _Code;
|
||||
};
|
||||
export interface CodeGenOptions {
|
||||
es5?: boolean;
|
||||
lines?: boolean;
|
||||
ownProperties?: boolean;
|
||||
}
|
||||
export declare class CodeGen {
|
||||
readonly _scope: Scope;
|
||||
readonly _extScope: ValueScope;
|
||||
readonly _values: ScopeValueSets;
|
||||
private readonly _nodes;
|
||||
private readonly _blockStarts;
|
||||
private readonly _constants;
|
||||
private readonly opts;
|
||||
constructor(extScope: ValueScope, opts?: CodeGenOptions);
|
||||
toString(): string;
|
||||
name(prefix: string): Name;
|
||||
scopeName(prefix: string): ValueScopeName;
|
||||
scopeValue(prefixOrName: ValueScopeName | string, value: NameValue): Name;
|
||||
getScopeValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined;
|
||||
scopeRefs(scopeName: Name): Code;
|
||||
scopeCode(): Code;
|
||||
private _def;
|
||||
const(nameOrPrefix: Name | string, rhs: SafeExpr, _constant?: boolean): Name;
|
||||
let(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name;
|
||||
var(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name;
|
||||
assign(lhs: Code, rhs: SafeExpr, sideEffects?: boolean): CodeGen;
|
||||
add(lhs: Code, rhs: SafeExpr): CodeGen;
|
||||
code(c: Block | SafeExpr): CodeGen;
|
||||
object(...keyValues: [Name | string, SafeExpr | string][]): _Code;
|
||||
if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen;
|
||||
elseIf(condition: Code | boolean): CodeGen;
|
||||
else(): CodeGen;
|
||||
endIf(): CodeGen;
|
||||
private _for;
|
||||
for(iteration: Code, forBody?: Block): CodeGen;
|
||||
forRange(nameOrPrefix: Name | string, from: SafeExpr, to: SafeExpr, forBody: (index: Name) => void, varKind?: Code): CodeGen;
|
||||
forOf(nameOrPrefix: Name | string, iterable: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen;
|
||||
forIn(nameOrPrefix: Name | string, obj: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen;
|
||||
endFor(): CodeGen;
|
||||
label(label: Name): CodeGen;
|
||||
break(label?: Code): CodeGen;
|
||||
return(value: Block | SafeExpr): CodeGen;
|
||||
try(tryBody: Block, catchCode?: (e: Name) => void, finallyCode?: Block): CodeGen;
|
||||
throw(error: Code): CodeGen;
|
||||
block(body?: Block, nodeCount?: number): CodeGen;
|
||||
endBlock(nodeCount?: number): CodeGen;
|
||||
func(name: Name, args?: Code, async?: boolean, funcBody?: Block): CodeGen;
|
||||
endFunc(): CodeGen;
|
||||
optimize(n?: number): void;
|
||||
private _leafNode;
|
||||
private _blockNode;
|
||||
private _endBlockNode;
|
||||
private _elseNode;
|
||||
private get _root();
|
||||
private get _currNode();
|
||||
private set _currNode(value);
|
||||
}
|
||||
export declare function not<T extends Code | SafeExpr>(x: T): T;
|
||||
export declare function and(...args: Code[]): Code;
|
||||
export declare function or(...args: Code[]): Code;
|
||||
697
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/index.js
generated
vendored
Normal file
697
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,697 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0;
|
||||
const code_1 = require("./code");
|
||||
const scope_1 = require("./scope");
|
||||
var code_2 = require("./code");
|
||||
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return code_2._; } });
|
||||
Object.defineProperty(exports, "str", { enumerable: true, get: function () { return code_2.str; } });
|
||||
Object.defineProperty(exports, "strConcat", { enumerable: true, get: function () { return code_2.strConcat; } });
|
||||
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return code_2.nil; } });
|
||||
Object.defineProperty(exports, "getProperty", { enumerable: true, get: function () { return code_2.getProperty; } });
|
||||
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return code_2.stringify; } });
|
||||
Object.defineProperty(exports, "regexpCode", { enumerable: true, get: function () { return code_2.regexpCode; } });
|
||||
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return code_2.Name; } });
|
||||
var scope_2 = require("./scope");
|
||||
Object.defineProperty(exports, "Scope", { enumerable: true, get: function () { return scope_2.Scope; } });
|
||||
Object.defineProperty(exports, "ValueScope", { enumerable: true, get: function () { return scope_2.ValueScope; } });
|
||||
Object.defineProperty(exports, "ValueScopeName", { enumerable: true, get: function () { return scope_2.ValueScopeName; } });
|
||||
Object.defineProperty(exports, "varKinds", { enumerable: true, get: function () { return scope_2.varKinds; } });
|
||||
exports.operators = {
|
||||
GT: new code_1._Code(">"),
|
||||
GTE: new code_1._Code(">="),
|
||||
LT: new code_1._Code("<"),
|
||||
LTE: new code_1._Code("<="),
|
||||
EQ: new code_1._Code("==="),
|
||||
NEQ: new code_1._Code("!=="),
|
||||
NOT: new code_1._Code("!"),
|
||||
OR: new code_1._Code("||"),
|
||||
AND: new code_1._Code("&&"),
|
||||
ADD: new code_1._Code("+"),
|
||||
};
|
||||
class Node {
|
||||
optimizeNodes() {
|
||||
return this;
|
||||
}
|
||||
optimizeNames(_names, _constants) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class Def extends Node {
|
||||
constructor(varKind, name, rhs) {
|
||||
super();
|
||||
this.varKind = varKind;
|
||||
this.name = name;
|
||||
this.rhs = rhs;
|
||||
}
|
||||
render({ es5, _n }) {
|
||||
const varKind = es5 ? scope_1.varKinds.var : this.varKind;
|
||||
const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}`;
|
||||
return `${varKind} ${this.name}${rhs};` + _n;
|
||||
}
|
||||
optimizeNames(names, constants) {
|
||||
if (!names[this.name.str])
|
||||
return;
|
||||
if (this.rhs)
|
||||
this.rhs = optimizeExpr(this.rhs, names, constants);
|
||||
return this;
|
||||
}
|
||||
get names() {
|
||||
return this.rhs instanceof code_1._CodeOrName ? this.rhs.names : {};
|
||||
}
|
||||
}
|
||||
class Assign extends Node {
|
||||
constructor(lhs, rhs, sideEffects) {
|
||||
super();
|
||||
this.lhs = lhs;
|
||||
this.rhs = rhs;
|
||||
this.sideEffects = sideEffects;
|
||||
}
|
||||
render({ _n }) {
|
||||
return `${this.lhs} = ${this.rhs};` + _n;
|
||||
}
|
||||
optimizeNames(names, constants) {
|
||||
if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
|
||||
return;
|
||||
this.rhs = optimizeExpr(this.rhs, names, constants);
|
||||
return this;
|
||||
}
|
||||
get names() {
|
||||
const names = this.lhs instanceof code_1.Name ? {} : { ...this.lhs.names };
|
||||
return addExprNames(names, this.rhs);
|
||||
}
|
||||
}
|
||||
class AssignOp extends Assign {
|
||||
constructor(lhs, op, rhs, sideEffects) {
|
||||
super(lhs, rhs, sideEffects);
|
||||
this.op = op;
|
||||
}
|
||||
render({ _n }) {
|
||||
return `${this.lhs} ${this.op}= ${this.rhs};` + _n;
|
||||
}
|
||||
}
|
||||
class Label extends Node {
|
||||
constructor(label) {
|
||||
super();
|
||||
this.label = label;
|
||||
this.names = {};
|
||||
}
|
||||
render({ _n }) {
|
||||
return `${this.label}:` + _n;
|
||||
}
|
||||
}
|
||||
class Break extends Node {
|
||||
constructor(label) {
|
||||
super();
|
||||
this.label = label;
|
||||
this.names = {};
|
||||
}
|
||||
render({ _n }) {
|
||||
const label = this.label ? ` ${this.label}` : "";
|
||||
return `break${label};` + _n;
|
||||
}
|
||||
}
|
||||
class Throw extends Node {
|
||||
constructor(error) {
|
||||
super();
|
||||
this.error = error;
|
||||
}
|
||||
render({ _n }) {
|
||||
return `throw ${this.error};` + _n;
|
||||
}
|
||||
get names() {
|
||||
return this.error.names;
|
||||
}
|
||||
}
|
||||
class AnyCode extends Node {
|
||||
constructor(code) {
|
||||
super();
|
||||
this.code = code;
|
||||
}
|
||||
render({ _n }) {
|
||||
return `${this.code};` + _n;
|
||||
}
|
||||
optimizeNodes() {
|
||||
return `${this.code}` ? this : undefined;
|
||||
}
|
||||
optimizeNames(names, constants) {
|
||||
this.code = optimizeExpr(this.code, names, constants);
|
||||
return this;
|
||||
}
|
||||
get names() {
|
||||
return this.code instanceof code_1._CodeOrName ? this.code.names : {};
|
||||
}
|
||||
}
|
||||
class ParentNode extends Node {
|
||||
constructor(nodes = []) {
|
||||
super();
|
||||
this.nodes = nodes;
|
||||
}
|
||||
render(opts) {
|
||||
return this.nodes.reduce((code, n) => code + n.render(opts), "");
|
||||
}
|
||||
optimizeNodes() {
|
||||
const { nodes } = this;
|
||||
let i = nodes.length;
|
||||
while (i--) {
|
||||
const n = nodes[i].optimizeNodes();
|
||||
if (Array.isArray(n))
|
||||
nodes.splice(i, 1, ...n);
|
||||
else if (n)
|
||||
nodes[i] = n;
|
||||
else
|
||||
nodes.splice(i, 1);
|
||||
}
|
||||
return nodes.length > 0 ? this : undefined;
|
||||
}
|
||||
optimizeNames(names, constants) {
|
||||
const { nodes } = this;
|
||||
let i = nodes.length;
|
||||
while (i--) {
|
||||
// iterating backwards improves 1-pass optimization
|
||||
const n = nodes[i];
|
||||
if (n.optimizeNames(names, constants))
|
||||
continue;
|
||||
subtractNames(names, n.names);
|
||||
nodes.splice(i, 1);
|
||||
}
|
||||
return nodes.length > 0 ? this : undefined;
|
||||
}
|
||||
get names() {
|
||||
return this.nodes.reduce((names, n) => addNames(names, n.names), {});
|
||||
}
|
||||
}
|
||||
class BlockNode extends ParentNode {
|
||||
render(opts) {
|
||||
return "{" + opts._n + super.render(opts) + "}" + opts._n;
|
||||
}
|
||||
}
|
||||
class Root extends ParentNode {
|
||||
}
|
||||
class Else extends BlockNode {
|
||||
}
|
||||
Else.kind = "else";
|
||||
class If extends BlockNode {
|
||||
constructor(condition, nodes) {
|
||||
super(nodes);
|
||||
this.condition = condition;
|
||||
}
|
||||
render(opts) {
|
||||
let code = `if(${this.condition})` + super.render(opts);
|
||||
if (this.else)
|
||||
code += "else " + this.else.render(opts);
|
||||
return code;
|
||||
}
|
||||
optimizeNodes() {
|
||||
super.optimizeNodes();
|
||||
const cond = this.condition;
|
||||
if (cond === true)
|
||||
return this.nodes; // else is ignored here
|
||||
let e = this.else;
|
||||
if (e) {
|
||||
const ns = e.optimizeNodes();
|
||||
e = this.else = Array.isArray(ns) ? new Else(ns) : ns;
|
||||
}
|
||||
if (e) {
|
||||
if (cond === false)
|
||||
return e instanceof If ? e : e.nodes;
|
||||
if (this.nodes.length)
|
||||
return this;
|
||||
return new If(not(cond), e instanceof If ? [e] : e.nodes);
|
||||
}
|
||||
if (cond === false || !this.nodes.length)
|
||||
return undefined;
|
||||
return this;
|
||||
}
|
||||
optimizeNames(names, constants) {
|
||||
var _a;
|
||||
this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
|
||||
if (!(super.optimizeNames(names, constants) || this.else))
|
||||
return;
|
||||
this.condition = optimizeExpr(this.condition, names, constants);
|
||||
return this;
|
||||
}
|
||||
get names() {
|
||||
const names = super.names;
|
||||
addExprNames(names, this.condition);
|
||||
if (this.else)
|
||||
addNames(names, this.else.names);
|
||||
return names;
|
||||
}
|
||||
}
|
||||
If.kind = "if";
|
||||
class For extends BlockNode {
|
||||
}
|
||||
For.kind = "for";
|
||||
class ForLoop extends For {
|
||||
constructor(iteration) {
|
||||
super();
|
||||
this.iteration = iteration;
|
||||
}
|
||||
render(opts) {
|
||||
return `for(${this.iteration})` + super.render(opts);
|
||||
}
|
||||
optimizeNames(names, constants) {
|
||||
if (!super.optimizeNames(names, constants))
|
||||
return;
|
||||
this.iteration = optimizeExpr(this.iteration, names, constants);
|
||||
return this;
|
||||
}
|
||||
get names() {
|
||||
return addNames(super.names, this.iteration.names);
|
||||
}
|
||||
}
|
||||
class ForRange extends For {
|
||||
constructor(varKind, name, from, to) {
|
||||
super();
|
||||
this.varKind = varKind;
|
||||
this.name = name;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
}
|
||||
render(opts) {
|
||||
const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind;
|
||||
const { name, from, to } = this;
|
||||
return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts);
|
||||
}
|
||||
get names() {
|
||||
const names = addExprNames(super.names, this.from);
|
||||
return addExprNames(names, this.to);
|
||||
}
|
||||
}
|
||||
class ForIter extends For {
|
||||
constructor(loop, varKind, name, iterable) {
|
||||
super();
|
||||
this.loop = loop;
|
||||
this.varKind = varKind;
|
||||
this.name = name;
|
||||
this.iterable = iterable;
|
||||
}
|
||||
render(opts) {
|
||||
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
||||
}
|
||||
optimizeNames(names, constants) {
|
||||
if (!super.optimizeNames(names, constants))
|
||||
return;
|
||||
this.iterable = optimizeExpr(this.iterable, names, constants);
|
||||
return this;
|
||||
}
|
||||
get names() {
|
||||
return addNames(super.names, this.iterable.names);
|
||||
}
|
||||
}
|
||||
class Func extends BlockNode {
|
||||
constructor(name, args, async) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.args = args;
|
||||
this.async = async;
|
||||
}
|
||||
render(opts) {
|
||||
const _async = this.async ? "async " : "";
|
||||
return `${_async}function ${this.name}(${this.args})` + super.render(opts);
|
||||
}
|
||||
}
|
||||
Func.kind = "func";
|
||||
class Return extends ParentNode {
|
||||
render(opts) {
|
||||
return "return " + super.render(opts);
|
||||
}
|
||||
}
|
||||
Return.kind = "return";
|
||||
class Try extends BlockNode {
|
||||
render(opts) {
|
||||
let code = "try" + super.render(opts);
|
||||
if (this.catch)
|
||||
code += this.catch.render(opts);
|
||||
if (this.finally)
|
||||
code += this.finally.render(opts);
|
||||
return code;
|
||||
}
|
||||
optimizeNodes() {
|
||||
var _a, _b;
|
||||
super.optimizeNodes();
|
||||
(_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNodes();
|
||||
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
||||
return this;
|
||||
}
|
||||
optimizeNames(names, constants) {
|
||||
var _a, _b;
|
||||
super.optimizeNames(names, constants);
|
||||
(_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
|
||||
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants);
|
||||
return this;
|
||||
}
|
||||
get names() {
|
||||
const names = super.names;
|
||||
if (this.catch)
|
||||
addNames(names, this.catch.names);
|
||||
if (this.finally)
|
||||
addNames(names, this.finally.names);
|
||||
return names;
|
||||
}
|
||||
}
|
||||
class Catch extends BlockNode {
|
||||
constructor(error) {
|
||||
super();
|
||||
this.error = error;
|
||||
}
|
||||
render(opts) {
|
||||
return `catch(${this.error})` + super.render(opts);
|
||||
}
|
||||
}
|
||||
Catch.kind = "catch";
|
||||
class Finally extends BlockNode {
|
||||
render(opts) {
|
||||
return "finally" + super.render(opts);
|
||||
}
|
||||
}
|
||||
Finally.kind = "finally";
|
||||
class CodeGen {
|
||||
constructor(extScope, opts = {}) {
|
||||
this._values = {};
|
||||
this._blockStarts = [];
|
||||
this._constants = {};
|
||||
this.opts = { ...opts, _n: opts.lines ? "\n" : "" };
|
||||
this._extScope = extScope;
|
||||
this._scope = new scope_1.Scope({ parent: extScope });
|
||||
this._nodes = [new Root()];
|
||||
}
|
||||
toString() {
|
||||
return this._root.render(this.opts);
|
||||
}
|
||||
// returns unique name in the internal scope
|
||||
name(prefix) {
|
||||
return this._scope.name(prefix);
|
||||
}
|
||||
// reserves unique name in the external scope
|
||||
scopeName(prefix) {
|
||||
return this._extScope.name(prefix);
|
||||
}
|
||||
// reserves unique name in the external scope and assigns value to it
|
||||
scopeValue(prefixOrName, value) {
|
||||
const name = this._extScope.value(prefixOrName, value);
|
||||
const vs = this._values[name.prefix] || (this._values[name.prefix] = new Set());
|
||||
vs.add(name);
|
||||
return name;
|
||||
}
|
||||
getScopeValue(prefix, keyOrRef) {
|
||||
return this._extScope.getValue(prefix, keyOrRef);
|
||||
}
|
||||
// return code that assigns values in the external scope to the names that are used internally
|
||||
// (same names that were returned by gen.scopeName or gen.scopeValue)
|
||||
scopeRefs(scopeName) {
|
||||
return this._extScope.scopeRefs(scopeName, this._values);
|
||||
}
|
||||
scopeCode() {
|
||||
return this._extScope.scopeCode(this._values);
|
||||
}
|
||||
_def(varKind, nameOrPrefix, rhs, constant) {
|
||||
const name = this._scope.toName(nameOrPrefix);
|
||||
if (rhs !== undefined && constant)
|
||||
this._constants[name.str] = rhs;
|
||||
this._leafNode(new Def(varKind, name, rhs));
|
||||
return name;
|
||||
}
|
||||
// `const` declaration (`var` in es5 mode)
|
||||
const(nameOrPrefix, rhs, _constant) {
|
||||
return this._def(scope_1.varKinds.const, nameOrPrefix, rhs, _constant);
|
||||
}
|
||||
// `let` declaration with optional assignment (`var` in es5 mode)
|
||||
let(nameOrPrefix, rhs, _constant) {
|
||||
return this._def(scope_1.varKinds.let, nameOrPrefix, rhs, _constant);
|
||||
}
|
||||
// `var` declaration with optional assignment
|
||||
var(nameOrPrefix, rhs, _constant) {
|
||||
return this._def(scope_1.varKinds.var, nameOrPrefix, rhs, _constant);
|
||||
}
|
||||
// assignment code
|
||||
assign(lhs, rhs, sideEffects) {
|
||||
return this._leafNode(new Assign(lhs, rhs, sideEffects));
|
||||
}
|
||||
// `+=` code
|
||||
add(lhs, rhs) {
|
||||
return this._leafNode(new AssignOp(lhs, exports.operators.ADD, rhs));
|
||||
}
|
||||
// appends passed SafeExpr to code or executes Block
|
||||
code(c) {
|
||||
if (typeof c == "function")
|
||||
c();
|
||||
else if (c !== code_1.nil)
|
||||
this._leafNode(new AnyCode(c));
|
||||
return this;
|
||||
}
|
||||
// returns code for object literal for the passed argument list of key-value pairs
|
||||
object(...keyValues) {
|
||||
const code = ["{"];
|
||||
for (const [key, value] of keyValues) {
|
||||
if (code.length > 1)
|
||||
code.push(",");
|
||||
code.push(key);
|
||||
if (key !== value || this.opts.es5) {
|
||||
code.push(":");
|
||||
code_1.addCodeArg(code, value);
|
||||
}
|
||||
}
|
||||
code.push("}");
|
||||
return new code_1._Code(code);
|
||||
}
|
||||
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
|
||||
if(condition, thenBody, elseBody) {
|
||||
this._blockNode(new If(condition));
|
||||
if (thenBody && elseBody) {
|
||||
this.code(thenBody).else().code(elseBody).endIf();
|
||||
}
|
||||
else if (thenBody) {
|
||||
this.code(thenBody).endIf();
|
||||
}
|
||||
else if (elseBody) {
|
||||
throw new Error('CodeGen: "else" body without "then" body');
|
||||
}
|
||||
return this;
|
||||
}
|
||||
// `else if` clause - invalid without `if` or after `else` clauses
|
||||
elseIf(condition) {
|
||||
return this._elseNode(new If(condition));
|
||||
}
|
||||
// `else` clause - only valid after `if` or `else if` clauses
|
||||
else() {
|
||||
return this._elseNode(new Else());
|
||||
}
|
||||
// end `if` statement (needed if gen.if was used only with condition)
|
||||
endIf() {
|
||||
return this._endBlockNode(If, Else);
|
||||
}
|
||||
_for(node, forBody) {
|
||||
this._blockNode(node);
|
||||
if (forBody)
|
||||
this.code(forBody).endFor();
|
||||
return this;
|
||||
}
|
||||
// a generic `for` clause (or statement if `forBody` is passed)
|
||||
for(iteration, forBody) {
|
||||
return this._for(new ForLoop(iteration), forBody);
|
||||
}
|
||||
// `for` statement for a range of values
|
||||
forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) {
|
||||
const name = this._scope.toName(nameOrPrefix);
|
||||
return this._for(new ForRange(varKind, name, from, to), () => forBody(name));
|
||||
}
|
||||
// `for-of` statement (in es5 mode replace with a normal for loop)
|
||||
forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) {
|
||||
const name = this._scope.toName(nameOrPrefix);
|
||||
if (this.opts.es5) {
|
||||
const arr = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable);
|
||||
return this.forRange("_i", 0, code_1._ `${arr}.length`, (i) => {
|
||||
this.var(name, code_1._ `${arr}[${i}]`);
|
||||
forBody(name);
|
||||
});
|
||||
}
|
||||
return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name));
|
||||
}
|
||||
// `for-in` statement.
|
||||
// With option `ownProperties` replaced with a `for-of` loop for object keys
|
||||
forIn(nameOrPrefix, obj, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) {
|
||||
if (this.opts.ownProperties) {
|
||||
return this.forOf(nameOrPrefix, code_1._ `Object.keys(${obj})`, forBody);
|
||||
}
|
||||
const name = this._scope.toName(nameOrPrefix);
|
||||
return this._for(new ForIter("in", varKind, name, obj), () => forBody(name));
|
||||
}
|
||||
// end `for` loop
|
||||
endFor() {
|
||||
return this._endBlockNode(For);
|
||||
}
|
||||
// `label` statement
|
||||
label(label) {
|
||||
return this._leafNode(new Label(label));
|
||||
}
|
||||
// `break` statement
|
||||
break(label) {
|
||||
return this._leafNode(new Break(label));
|
||||
}
|
||||
// `return` statement
|
||||
return(value) {
|
||||
const node = new Return();
|
||||
this._blockNode(node);
|
||||
this.code(value);
|
||||
if (node.nodes.length !== 1)
|
||||
throw new Error('CodeGen: "return" should have one node');
|
||||
return this._endBlockNode(Return);
|
||||
}
|
||||
// `try` statement
|
||||
try(tryBody, catchCode, finallyCode) {
|
||||
if (!catchCode && !finallyCode)
|
||||
throw new Error('CodeGen: "try" without "catch" and "finally"');
|
||||
const node = new Try();
|
||||
this._blockNode(node);
|
||||
this.code(tryBody);
|
||||
if (catchCode) {
|
||||
const error = this.name("e");
|
||||
this._currNode = node.catch = new Catch(error);
|
||||
catchCode(error);
|
||||
}
|
||||
if (finallyCode) {
|
||||
this._currNode = node.finally = new Finally();
|
||||
this.code(finallyCode);
|
||||
}
|
||||
return this._endBlockNode(Catch, Finally);
|
||||
}
|
||||
// `throw` statement
|
||||
throw(error) {
|
||||
return this._leafNode(new Throw(error));
|
||||
}
|
||||
// start self-balancing block
|
||||
block(body, nodeCount) {
|
||||
this._blockStarts.push(this._nodes.length);
|
||||
if (body)
|
||||
this.code(body).endBlock(nodeCount);
|
||||
return this;
|
||||
}
|
||||
// end the current self-balancing block
|
||||
endBlock(nodeCount) {
|
||||
const len = this._blockStarts.pop();
|
||||
if (len === undefined)
|
||||
throw new Error("CodeGen: not in self-balancing block");
|
||||
const toClose = this._nodes.length - len;
|
||||
if (toClose < 0 || (nodeCount !== undefined && toClose !== nodeCount)) {
|
||||
throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`);
|
||||
}
|
||||
this._nodes.length = len;
|
||||
return this;
|
||||
}
|
||||
// `function` heading (or definition if funcBody is passed)
|
||||
func(name, args = code_1.nil, async, funcBody) {
|
||||
this._blockNode(new Func(name, args, async));
|
||||
if (funcBody)
|
||||
this.code(funcBody).endFunc();
|
||||
return this;
|
||||
}
|
||||
// end function definition
|
||||
endFunc() {
|
||||
return this._endBlockNode(Func);
|
||||
}
|
||||
optimize(n = 1) {
|
||||
while (n-- > 0) {
|
||||
this._root.optimizeNodes();
|
||||
this._root.optimizeNames(this._root.names, this._constants);
|
||||
}
|
||||
}
|
||||
_leafNode(node) {
|
||||
this._currNode.nodes.push(node);
|
||||
return this;
|
||||
}
|
||||
_blockNode(node) {
|
||||
this._currNode.nodes.push(node);
|
||||
this._nodes.push(node);
|
||||
}
|
||||
_endBlockNode(N1, N2) {
|
||||
const n = this._currNode;
|
||||
if (n instanceof N1 || (N2 && n instanceof N2)) {
|
||||
this._nodes.pop();
|
||||
return this;
|
||||
}
|
||||
throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`);
|
||||
}
|
||||
_elseNode(node) {
|
||||
const n = this._currNode;
|
||||
if (!(n instanceof If)) {
|
||||
throw new Error('CodeGen: "else" without "if"');
|
||||
}
|
||||
this._currNode = n.else = node;
|
||||
return this;
|
||||
}
|
||||
get _root() {
|
||||
return this._nodes[0];
|
||||
}
|
||||
get _currNode() {
|
||||
const ns = this._nodes;
|
||||
return ns[ns.length - 1];
|
||||
}
|
||||
set _currNode(node) {
|
||||
const ns = this._nodes;
|
||||
ns[ns.length - 1] = node;
|
||||
}
|
||||
}
|
||||
exports.CodeGen = CodeGen;
|
||||
function addNames(names, from) {
|
||||
for (const n in from)
|
||||
names[n] = (names[n] || 0) + (from[n] || 0);
|
||||
return names;
|
||||
}
|
||||
function addExprNames(names, from) {
|
||||
return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
|
||||
}
|
||||
function optimizeExpr(expr, names, constants) {
|
||||
if (expr instanceof code_1.Name)
|
||||
return replaceName(expr);
|
||||
if (!canOptimize(expr))
|
||||
return expr;
|
||||
return new code_1._Code(expr._items.reduce((items, c) => {
|
||||
if (c instanceof code_1.Name)
|
||||
c = replaceName(c);
|
||||
if (c instanceof code_1._Code)
|
||||
items.push(...c._items);
|
||||
else
|
||||
items.push(c);
|
||||
return items;
|
||||
}, []));
|
||||
function replaceName(n) {
|
||||
const c = constants[n.str];
|
||||
if (c === undefined || names[n.str] !== 1)
|
||||
return n;
|
||||
delete names[n.str];
|
||||
return c;
|
||||
}
|
||||
function canOptimize(e) {
|
||||
return (e instanceof code_1._Code &&
|
||||
e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants[c.str] !== undefined));
|
||||
}
|
||||
}
|
||||
function subtractNames(names, from) {
|
||||
for (const n in from)
|
||||
names[n] = (names[n] || 0) - (from[n] || 0);
|
||||
}
|
||||
function not(x) {
|
||||
return typeof x == "boolean" || typeof x == "number" || x === null ? !x : code_1._ `!${par(x)}`;
|
||||
}
|
||||
exports.not = not;
|
||||
const andCode = mappend(exports.operators.AND);
|
||||
// boolean AND (&&) expression with the passed arguments
|
||||
function and(...args) {
|
||||
return args.reduce(andCode);
|
||||
}
|
||||
exports.and = and;
|
||||
const orCode = mappend(exports.operators.OR);
|
||||
// boolean OR (||) expression with the passed arguments
|
||||
function or(...args) {
|
||||
return args.reduce(orCode);
|
||||
}
|
||||
exports.or = or;
|
||||
function mappend(op) {
|
||||
return (x, y) => (x === code_1.nil ? y : y === code_1.nil ? x : code_1._ `${par(x)} ${op} ${par(y)}`);
|
||||
}
|
||||
function par(x) {
|
||||
return x instanceof code_1.Name ? x : code_1._ `(${x})`;
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/index.js.map
generated
vendored
Normal file
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
79
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/scope.d.ts
generated
vendored
Normal file
79
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/scope.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
import { Code, Name } from "./code";
|
||||
interface NameGroup {
|
||||
prefix: string;
|
||||
index: number;
|
||||
}
|
||||
export interface NameValue {
|
||||
ref: ValueReference;
|
||||
key?: unknown;
|
||||
code?: Code;
|
||||
}
|
||||
export declare type ValueReference = unknown;
|
||||
interface ScopeOptions {
|
||||
prefixes?: Set<string>;
|
||||
parent?: Scope;
|
||||
}
|
||||
interface ValueScopeOptions extends ScopeOptions {
|
||||
scope: ScopeStore;
|
||||
es5?: boolean;
|
||||
lines?: boolean;
|
||||
}
|
||||
export declare type ScopeStore = Record<string, ValueReference[] | undefined>;
|
||||
declare type ScopeValues = {
|
||||
[Prefix in string]?: Map<unknown, ValueScopeName>;
|
||||
};
|
||||
export declare type ScopeValueSets = {
|
||||
[Prefix in string]?: Set<ValueScopeName>;
|
||||
};
|
||||
export declare enum UsedValueState {
|
||||
Started = 0,
|
||||
Completed = 1
|
||||
}
|
||||
export declare type UsedScopeValues = {
|
||||
[Prefix in string]?: Map<ValueScopeName, UsedValueState | undefined>;
|
||||
};
|
||||
export declare const varKinds: {
|
||||
const: Name;
|
||||
let: Name;
|
||||
var: Name;
|
||||
};
|
||||
export declare class Scope {
|
||||
protected readonly _names: {
|
||||
[Prefix in string]?: NameGroup;
|
||||
};
|
||||
protected readonly _prefixes?: Set<string>;
|
||||
protected readonly _parent?: Scope;
|
||||
constructor({ prefixes, parent }?: ScopeOptions);
|
||||
toName(nameOrPrefix: Name | string): Name;
|
||||
name(prefix: string): Name;
|
||||
protected _newName(prefix: string): string;
|
||||
private _nameGroup;
|
||||
}
|
||||
interface ScopePath {
|
||||
property: string;
|
||||
itemIndex: number;
|
||||
}
|
||||
export declare class ValueScopeName extends Name {
|
||||
readonly prefix: string;
|
||||
value?: NameValue;
|
||||
scopePath?: Code;
|
||||
constructor(prefix: string, nameStr: string);
|
||||
setValue(value: NameValue, { property, itemIndex }: ScopePath): void;
|
||||
}
|
||||
interface VSOptions extends ValueScopeOptions {
|
||||
_n: Code;
|
||||
}
|
||||
export declare class ValueScope extends Scope {
|
||||
protected readonly _values: ScopeValues;
|
||||
protected readonly _scope: ScopeStore;
|
||||
readonly opts: VSOptions;
|
||||
constructor(opts: ValueScopeOptions);
|
||||
get(): ScopeStore;
|
||||
name(prefix: string): ValueScopeName;
|
||||
value(nameOrPrefix: ValueScopeName | string, value: NameValue): ValueScopeName;
|
||||
getValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined;
|
||||
scopeRefs(scopeName: Name, values?: ScopeValues | ScopeValueSets): Code;
|
||||
scopeCode(values?: ScopeValues | ScopeValueSets, usedValues?: UsedScopeValues, getCode?: (n: ValueScopeName) => Code | undefined): Code;
|
||||
private _reduceValues;
|
||||
}
|
||||
export {};
|
||||
143
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/scope.js
generated
vendored
Normal file
143
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/scope.js
generated
vendored
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;
|
||||
const code_1 = require("./code");
|
||||
class ValueError extends Error {
|
||||
constructor(name) {
|
||||
super(`CodeGen: "code" for ${name} not defined`);
|
||||
this.value = name.value;
|
||||
}
|
||||
}
|
||||
var UsedValueState;
|
||||
(function (UsedValueState) {
|
||||
UsedValueState[UsedValueState["Started"] = 0] = "Started";
|
||||
UsedValueState[UsedValueState["Completed"] = 1] = "Completed";
|
||||
})(UsedValueState = exports.UsedValueState || (exports.UsedValueState = {}));
|
||||
exports.varKinds = {
|
||||
const: new code_1.Name("const"),
|
||||
let: new code_1.Name("let"),
|
||||
var: new code_1.Name("var"),
|
||||
};
|
||||
class Scope {
|
||||
constructor({ prefixes, parent } = {}) {
|
||||
this._names = {};
|
||||
this._prefixes = prefixes;
|
||||
this._parent = parent;
|
||||
}
|
||||
toName(nameOrPrefix) {
|
||||
return nameOrPrefix instanceof code_1.Name ? nameOrPrefix : this.name(nameOrPrefix);
|
||||
}
|
||||
name(prefix) {
|
||||
return new code_1.Name(this._newName(prefix));
|
||||
}
|
||||
_newName(prefix) {
|
||||
const ng = this._names[prefix] || this._nameGroup(prefix);
|
||||
return `${prefix}${ng.index++}`;
|
||||
}
|
||||
_nameGroup(prefix) {
|
||||
var _a, _b;
|
||||
if (((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || (this._prefixes && !this._prefixes.has(prefix))) {
|
||||
throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
|
||||
}
|
||||
return (this._names[prefix] = { prefix, index: 0 });
|
||||
}
|
||||
}
|
||||
exports.Scope = Scope;
|
||||
class ValueScopeName extends code_1.Name {
|
||||
constructor(prefix, nameStr) {
|
||||
super(nameStr);
|
||||
this.prefix = prefix;
|
||||
}
|
||||
setValue(value, { property, itemIndex }) {
|
||||
this.value = value;
|
||||
this.scopePath = code_1._ `.${new code_1.Name(property)}[${itemIndex}]`;
|
||||
}
|
||||
}
|
||||
exports.ValueScopeName = ValueScopeName;
|
||||
const line = code_1._ `\n`;
|
||||
class ValueScope extends Scope {
|
||||
constructor(opts) {
|
||||
super(opts);
|
||||
this._values = {};
|
||||
this._scope = opts.scope;
|
||||
this.opts = { ...opts, _n: opts.lines ? line : code_1.nil };
|
||||
}
|
||||
get() {
|
||||
return this._scope;
|
||||
}
|
||||
name(prefix) {
|
||||
return new ValueScopeName(prefix, this._newName(prefix));
|
||||
}
|
||||
value(nameOrPrefix, value) {
|
||||
var _a;
|
||||
if (value.ref === undefined)
|
||||
throw new Error("CodeGen: ref must be passed in value");
|
||||
const name = this.toName(nameOrPrefix);
|
||||
const { prefix } = name;
|
||||
const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref;
|
||||
let vs = this._values[prefix];
|
||||
if (vs) {
|
||||
const _name = vs.get(valueKey);
|
||||
if (_name)
|
||||
return _name;
|
||||
}
|
||||
else {
|
||||
vs = this._values[prefix] = new Map();
|
||||
}
|
||||
vs.set(valueKey, name);
|
||||
const s = this._scope[prefix] || (this._scope[prefix] = []);
|
||||
const itemIndex = s.length;
|
||||
s[itemIndex] = value.ref;
|
||||
name.setValue(value, { property: prefix, itemIndex });
|
||||
return name;
|
||||
}
|
||||
getValue(prefix, keyOrRef) {
|
||||
const vs = this._values[prefix];
|
||||
if (!vs)
|
||||
return;
|
||||
return vs.get(keyOrRef);
|
||||
}
|
||||
scopeRefs(scopeName, values = this._values) {
|
||||
return this._reduceValues(values, (name) => {
|
||||
if (name.scopePath === undefined)
|
||||
throw new Error(`CodeGen: name "${name}" has no value`);
|
||||
return code_1._ `${scopeName}${name.scopePath}`;
|
||||
});
|
||||
}
|
||||
scopeCode(values = this._values, usedValues, getCode) {
|
||||
return this._reduceValues(values, (name) => {
|
||||
if (name.value === undefined)
|
||||
throw new Error(`CodeGen: name "${name}" has no value`);
|
||||
return name.value.code;
|
||||
}, usedValues, getCode);
|
||||
}
|
||||
_reduceValues(values, valueCode, usedValues = {}, getCode) {
|
||||
let code = code_1.nil;
|
||||
for (const prefix in values) {
|
||||
const vs = values[prefix];
|
||||
if (!vs)
|
||||
continue;
|
||||
const nameSet = (usedValues[prefix] = usedValues[prefix] || new Map());
|
||||
vs.forEach((name) => {
|
||||
if (nameSet.has(name))
|
||||
return;
|
||||
nameSet.set(name, UsedValueState.Started);
|
||||
let c = valueCode(name);
|
||||
if (c) {
|
||||
const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const;
|
||||
code = code_1._ `${code}${def} ${name} = ${c};${this.opts._n}`;
|
||||
}
|
||||
else if ((c = getCode === null || getCode === void 0 ? void 0 : getCode(name))) {
|
||||
code = code_1._ `${code}${c}${this.opts._n}`;
|
||||
}
|
||||
else {
|
||||
throw new ValueError(name);
|
||||
}
|
||||
nameSet.set(name, UsedValueState.Completed);
|
||||
});
|
||||
}
|
||||
return code;
|
||||
}
|
||||
}
|
||||
exports.ValueScope = ValueScope;
|
||||
//# sourceMappingURL=scope.js.map
|
||||
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/scope.js.map
generated
vendored
Normal file
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/codegen/scope.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
13
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/errors.d.ts
generated
vendored
Normal file
13
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/errors.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import type { KeywordErrorCxt, KeywordErrorDefinition } from "../types";
|
||||
import { CodeGen, Code, Name } from "./codegen";
|
||||
export declare const keywordError: KeywordErrorDefinition;
|
||||
export declare const keyword$DataError: KeywordErrorDefinition;
|
||||
export interface ErrorPaths {
|
||||
instancePath?: Code;
|
||||
schemaPath?: string;
|
||||
parentSchema?: boolean;
|
||||
}
|
||||
export declare function reportError(cxt: KeywordErrorCxt, error?: KeywordErrorDefinition, errorPaths?: ErrorPaths, overrideAllErrors?: boolean): void;
|
||||
export declare function reportExtraError(cxt: KeywordErrorCxt, error?: KeywordErrorDefinition, errorPaths?: ErrorPaths): void;
|
||||
export declare function resetErrorsCount(gen: CodeGen, errsCount: Name): void;
|
||||
export declare function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }: KeywordErrorCxt): void;
|
||||
123
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/errors.js
generated
vendored
Normal file
123
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/errors.js
generated
vendored
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0;
|
||||
const codegen_1 = require("./codegen");
|
||||
const util_1 = require("./util");
|
||||
const names_1 = require("./names");
|
||||
exports.keywordError = {
|
||||
message: ({ keyword }) => codegen_1.str `must pass "${keyword}" keyword validation`,
|
||||
};
|
||||
exports.keyword$DataError = {
|
||||
message: ({ keyword, schemaType }) => schemaType
|
||||
? codegen_1.str `"${keyword}" keyword must be ${schemaType} ($data)`
|
||||
: codegen_1.str `"${keyword}" keyword is invalid ($data)`,
|
||||
};
|
||||
function reportError(cxt, error = exports.keywordError, errorPaths, overrideAllErrors) {
|
||||
const { it } = cxt;
|
||||
const { gen, compositeRule, allErrors } = it;
|
||||
const errObj = errorObjectCode(cxt, error, errorPaths);
|
||||
if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : (compositeRule || allErrors)) {
|
||||
addError(gen, errObj);
|
||||
}
|
||||
else {
|
||||
returnErrors(it, codegen_1._ `[${errObj}]`);
|
||||
}
|
||||
}
|
||||
exports.reportError = reportError;
|
||||
function reportExtraError(cxt, error = exports.keywordError, errorPaths) {
|
||||
const { it } = cxt;
|
||||
const { gen, compositeRule, allErrors } = it;
|
||||
const errObj = errorObjectCode(cxt, error, errorPaths);
|
||||
addError(gen, errObj);
|
||||
if (!(compositeRule || allErrors)) {
|
||||
returnErrors(it, names_1.default.vErrors);
|
||||
}
|
||||
}
|
||||
exports.reportExtraError = reportExtraError;
|
||||
function resetErrorsCount(gen, errsCount) {
|
||||
gen.assign(names_1.default.errors, errsCount);
|
||||
gen.if(codegen_1._ `${names_1.default.vErrors} !== null`, () => gen.if(errsCount, () => gen.assign(codegen_1._ `${names_1.default.vErrors}.length`, errsCount), () => gen.assign(names_1.default.vErrors, null)));
|
||||
}
|
||||
exports.resetErrorsCount = resetErrorsCount;
|
||||
function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }) {
|
||||
/* istanbul ignore if */
|
||||
if (errsCount === undefined)
|
||||
throw new Error("ajv implementation error");
|
||||
const err = gen.name("err");
|
||||
gen.forRange("i", errsCount, names_1.default.errors, (i) => {
|
||||
gen.const(err, codegen_1._ `${names_1.default.vErrors}[${i}]`);
|
||||
gen.if(codegen_1._ `${err}.instancePath === undefined`, () => gen.assign(codegen_1._ `${err}.instancePath`, codegen_1.strConcat(names_1.default.instancePath, it.errorPath)));
|
||||
gen.assign(codegen_1._ `${err}.schemaPath`, codegen_1.str `${it.errSchemaPath}/${keyword}`);
|
||||
if (it.opts.verbose) {
|
||||
gen.assign(codegen_1._ `${err}.schema`, schemaValue);
|
||||
gen.assign(codegen_1._ `${err}.data`, data);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.extendErrors = extendErrors;
|
||||
function addError(gen, errObj) {
|
||||
const err = gen.const("err", errObj);
|
||||
gen.if(codegen_1._ `${names_1.default.vErrors} === null`, () => gen.assign(names_1.default.vErrors, codegen_1._ `[${err}]`), codegen_1._ `${names_1.default.vErrors}.push(${err})`);
|
||||
gen.code(codegen_1._ `${names_1.default.errors}++`);
|
||||
}
|
||||
function returnErrors(it, errs) {
|
||||
const { gen, validateName, schemaEnv } = it;
|
||||
if (schemaEnv.$async) {
|
||||
gen.throw(codegen_1._ `new ${it.ValidationError}(${errs})`);
|
||||
}
|
||||
else {
|
||||
gen.assign(codegen_1._ `${validateName}.errors`, errs);
|
||||
gen.return(false);
|
||||
}
|
||||
}
|
||||
const E = {
|
||||
keyword: new codegen_1.Name("keyword"),
|
||||
schemaPath: new codegen_1.Name("schemaPath"),
|
||||
params: new codegen_1.Name("params"),
|
||||
propertyName: new codegen_1.Name("propertyName"),
|
||||
message: new codegen_1.Name("message"),
|
||||
schema: new codegen_1.Name("schema"),
|
||||
parentSchema: new codegen_1.Name("parentSchema"),
|
||||
};
|
||||
function errorObjectCode(cxt, error, errorPaths) {
|
||||
const { createErrors } = cxt.it;
|
||||
if (createErrors === false)
|
||||
return codegen_1._ `{}`;
|
||||
return errorObject(cxt, error, errorPaths);
|
||||
}
|
||||
function errorObject(cxt, error, errorPaths = {}) {
|
||||
const { gen, it } = cxt;
|
||||
const keyValues = [
|
||||
errorInstancePath(it, errorPaths),
|
||||
errorSchemaPath(cxt, errorPaths),
|
||||
];
|
||||
extraErrorProps(cxt, error, keyValues);
|
||||
return gen.object(...keyValues);
|
||||
}
|
||||
function errorInstancePath({ errorPath }, { instancePath }) {
|
||||
const instPath = instancePath
|
||||
? codegen_1.str `${errorPath}${util_1.getErrorPath(instancePath, util_1.Type.Str)}`
|
||||
: errorPath;
|
||||
return [names_1.default.instancePath, codegen_1.strConcat(names_1.default.instancePath, instPath)];
|
||||
}
|
||||
function errorSchemaPath({ keyword, it: { errSchemaPath } }, { schemaPath, parentSchema }) {
|
||||
let schPath = parentSchema ? errSchemaPath : codegen_1.str `${errSchemaPath}/${keyword}`;
|
||||
if (schemaPath) {
|
||||
schPath = codegen_1.str `${schPath}${util_1.getErrorPath(schemaPath, util_1.Type.Str)}`;
|
||||
}
|
||||
return [E.schemaPath, schPath];
|
||||
}
|
||||
function extraErrorProps(cxt, { params, message }, keyValues) {
|
||||
const { keyword, data, schemaValue, it } = cxt;
|
||||
const { opts, propertyName, topSchemaRef, schemaPath } = it;
|
||||
keyValues.push([E.keyword, keyword], [E.params, typeof params == "function" ? params(cxt) : params || codegen_1._ `{}`]);
|
||||
if (opts.messages) {
|
||||
keyValues.push([E.message, typeof message == "function" ? message(cxt) : message]);
|
||||
}
|
||||
if (opts.verbose) {
|
||||
keyValues.push([E.schema, schemaValue], [E.parentSchema, codegen_1._ `${topSchemaRef}${schemaPath}`], [names_1.default.data, data]);
|
||||
}
|
||||
if (propertyName)
|
||||
keyValues.push([E.propertyName, propertyName]);
|
||||
}
|
||||
//# sourceMappingURL=errors.js.map
|
||||
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/errors.js.map
generated
vendored
Normal file
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/errors.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
80
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/index.d.ts
generated
vendored
Normal file
80
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
import type { AnySchema, AnySchemaObject, AnyValidateFunction, EvaluatedProperties, EvaluatedItems } from "../types";
|
||||
import type Ajv from "../core";
|
||||
import type { InstanceOptions } from "../core";
|
||||
import { CodeGen, Name, Code, ValueScopeName } from "./codegen";
|
||||
import { LocalRefs } from "./resolve";
|
||||
import { JSONType } from "./rules";
|
||||
export declare type SchemaRefs = {
|
||||
[Ref in string]?: SchemaEnv | AnySchema;
|
||||
};
|
||||
export interface SchemaCxt {
|
||||
readonly gen: CodeGen;
|
||||
readonly allErrors?: boolean;
|
||||
readonly data: Name;
|
||||
readonly parentData: Name;
|
||||
readonly parentDataProperty: Code | number;
|
||||
readonly dataNames: Name[];
|
||||
readonly dataPathArr: (Code | number)[];
|
||||
readonly dataLevel: number;
|
||||
dataTypes: JSONType[];
|
||||
definedProperties: Set<string>;
|
||||
readonly topSchemaRef: Code;
|
||||
readonly validateName: Name;
|
||||
evaluated?: Name;
|
||||
readonly ValidationError?: Name;
|
||||
readonly schema: AnySchema;
|
||||
readonly schemaEnv: SchemaEnv;
|
||||
readonly rootId: string;
|
||||
baseId: string;
|
||||
readonly schemaPath: Code;
|
||||
readonly errSchemaPath: string;
|
||||
readonly errorPath: Code;
|
||||
readonly propertyName?: Name;
|
||||
readonly compositeRule?: boolean;
|
||||
props?: EvaluatedProperties | Name;
|
||||
items?: EvaluatedItems | Name;
|
||||
jtdDiscriminator?: string;
|
||||
jtdMetadata?: boolean;
|
||||
readonly createErrors?: boolean;
|
||||
readonly opts: InstanceOptions;
|
||||
readonly self: Ajv;
|
||||
}
|
||||
export interface SchemaObjCxt extends SchemaCxt {
|
||||
readonly schema: AnySchemaObject;
|
||||
}
|
||||
interface SchemaEnvArgs {
|
||||
readonly schema: AnySchema;
|
||||
readonly schemaId?: "$id" | "id";
|
||||
readonly root?: SchemaEnv;
|
||||
readonly baseId?: string;
|
||||
readonly schemaPath?: string;
|
||||
readonly localRefs?: LocalRefs;
|
||||
readonly meta?: boolean;
|
||||
}
|
||||
export declare class SchemaEnv implements SchemaEnvArgs {
|
||||
readonly schema: AnySchema;
|
||||
readonly schemaId?: "$id" | "id";
|
||||
readonly root: SchemaEnv;
|
||||
baseId: string;
|
||||
schemaPath?: string;
|
||||
localRefs?: LocalRefs;
|
||||
readonly meta?: boolean;
|
||||
readonly $async?: boolean;
|
||||
readonly refs: SchemaRefs;
|
||||
readonly dynamicAnchors: {
|
||||
[Ref in string]?: true;
|
||||
};
|
||||
validate?: AnyValidateFunction;
|
||||
validateName?: ValueScopeName;
|
||||
serialize?: (data: unknown) => string;
|
||||
serializeName?: ValueScopeName;
|
||||
parse?: (data: string) => unknown;
|
||||
parseName?: ValueScopeName;
|
||||
constructor(env: SchemaEnvArgs);
|
||||
}
|
||||
export declare function compileSchema(this: Ajv, sch: SchemaEnv): SchemaEnv;
|
||||
export declare function resolveRef(this: Ajv, root: SchemaEnv, baseId: string, ref: string): AnySchema | SchemaEnv | undefined;
|
||||
export declare function getCompilingSchema(this: Ajv, schEnv: SchemaEnv): SchemaEnv | void;
|
||||
export declare function resolveSchema(this: Ajv, root: SchemaEnv, // root object with properties schema, refs TODO below SchemaEnv is assigned to it
|
||||
ref: string): SchemaEnv | undefined;
|
||||
export {};
|
||||
242
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/index.js
generated
vendored
Normal file
242
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,242 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveSchema = exports.getCompilingSchema = exports.resolveRef = exports.compileSchema = exports.SchemaEnv = void 0;
|
||||
const codegen_1 = require("./codegen");
|
||||
const validation_error_1 = require("../runtime/validation_error");
|
||||
const names_1 = require("./names");
|
||||
const resolve_1 = require("./resolve");
|
||||
const util_1 = require("./util");
|
||||
const validate_1 = require("./validate");
|
||||
const URI = require("uri-js");
|
||||
class SchemaEnv {
|
||||
constructor(env) {
|
||||
var _a;
|
||||
this.refs = {};
|
||||
this.dynamicAnchors = {};
|
||||
let schema;
|
||||
if (typeof env.schema == "object")
|
||||
schema = env.schema;
|
||||
this.schema = env.schema;
|
||||
this.schemaId = env.schemaId;
|
||||
this.root = env.root || this;
|
||||
this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : resolve_1.normalizeId(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]);
|
||||
this.schemaPath = env.schemaPath;
|
||||
this.localRefs = env.localRefs;
|
||||
this.meta = env.meta;
|
||||
this.$async = schema === null || schema === void 0 ? void 0 : schema.$async;
|
||||
this.refs = {};
|
||||
}
|
||||
}
|
||||
exports.SchemaEnv = SchemaEnv;
|
||||
// let codeSize = 0
|
||||
// let nodeCount = 0
|
||||
// Compiles schema in SchemaEnv
|
||||
function compileSchema(sch) {
|
||||
// TODO refactor - remove compilations
|
||||
const _sch = getCompilingSchema.call(this, sch);
|
||||
if (_sch)
|
||||
return _sch;
|
||||
const rootId = resolve_1.getFullPath(sch.root.baseId); // TODO if getFullPath removed 1 tests fails
|
||||
const { es5, lines } = this.opts.code;
|
||||
const { ownProperties } = this.opts;
|
||||
const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties });
|
||||
let _ValidationError;
|
||||
if (sch.$async) {
|
||||
_ValidationError = gen.scopeValue("Error", {
|
||||
ref: validation_error_1.default,
|
||||
code: codegen_1._ `require("ajv/dist/runtime/validation_error").default`,
|
||||
});
|
||||
}
|
||||
const validateName = gen.scopeName("validate");
|
||||
sch.validateName = validateName;
|
||||
const schemaCxt = {
|
||||
gen,
|
||||
allErrors: this.opts.allErrors,
|
||||
data: names_1.default.data,
|
||||
parentData: names_1.default.parentData,
|
||||
parentDataProperty: names_1.default.parentDataProperty,
|
||||
dataNames: [names_1.default.data],
|
||||
dataPathArr: [codegen_1.nil],
|
||||
dataLevel: 0,
|
||||
dataTypes: [],
|
||||
definedProperties: new Set(),
|
||||
topSchemaRef: gen.scopeValue("schema", this.opts.code.source === true
|
||||
? { ref: sch.schema, code: codegen_1.stringify(sch.schema) }
|
||||
: { ref: sch.schema }),
|
||||
validateName,
|
||||
ValidationError: _ValidationError,
|
||||
schema: sch.schema,
|
||||
schemaEnv: sch,
|
||||
rootId,
|
||||
baseId: sch.baseId || rootId,
|
||||
schemaPath: codegen_1.nil,
|
||||
errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"),
|
||||
errorPath: codegen_1._ `""`,
|
||||
opts: this.opts,
|
||||
self: this,
|
||||
};
|
||||
let sourceCode;
|
||||
try {
|
||||
this._compilations.add(sch);
|
||||
validate_1.validateFunctionCode(schemaCxt);
|
||||
gen.optimize(this.opts.code.optimize);
|
||||
// gen.optimize(1)
|
||||
const validateCode = gen.toString();
|
||||
sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${validateCode}`;
|
||||
// console.log((codeSize += sourceCode.length), (nodeCount += gen.nodeCount))
|
||||
if (this.opts.code.process)
|
||||
sourceCode = this.opts.code.process(sourceCode, sch);
|
||||
// console.log("\n\n\n *** \n", sourceCode)
|
||||
const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode);
|
||||
const validate = makeValidate(this, this.scope.get());
|
||||
this.scope.value(validateName, { ref: validate });
|
||||
validate.errors = null;
|
||||
validate.schema = sch.schema;
|
||||
validate.schemaEnv = sch;
|
||||
if (sch.$async)
|
||||
validate.$async = true;
|
||||
if (this.opts.code.source === true) {
|
||||
validate.source = { validateName, validateCode, scopeValues: gen._values };
|
||||
}
|
||||
if (this.opts.unevaluated) {
|
||||
const { props, items } = schemaCxt;
|
||||
validate.evaluated = {
|
||||
props: props instanceof codegen_1.Name ? undefined : props,
|
||||
items: items instanceof codegen_1.Name ? undefined : items,
|
||||
dynamicProps: props instanceof codegen_1.Name,
|
||||
dynamicItems: items instanceof codegen_1.Name,
|
||||
};
|
||||
if (validate.source)
|
||||
validate.source.evaluated = codegen_1.stringify(validate.evaluated);
|
||||
}
|
||||
sch.validate = validate;
|
||||
return sch;
|
||||
}
|
||||
catch (e) {
|
||||
delete sch.validate;
|
||||
delete sch.validateName;
|
||||
if (sourceCode)
|
||||
this.logger.error("Error compiling schema, function code:", sourceCode);
|
||||
// console.log("\n\n\n *** \n", sourceCode, this.opts)
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
this._compilations.delete(sch);
|
||||
}
|
||||
}
|
||||
exports.compileSchema = compileSchema;
|
||||
function resolveRef(root, baseId, ref) {
|
||||
var _a;
|
||||
ref = resolve_1.resolveUrl(baseId, ref);
|
||||
const schOrFunc = root.refs[ref];
|
||||
if (schOrFunc)
|
||||
return schOrFunc;
|
||||
let _sch = resolve.call(this, root, ref);
|
||||
if (_sch === undefined) {
|
||||
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv
|
||||
const { schemaId } = this.opts;
|
||||
if (schema)
|
||||
_sch = new SchemaEnv({ schema, schemaId, root, baseId });
|
||||
}
|
||||
if (_sch === undefined)
|
||||
return;
|
||||
return (root.refs[ref] = inlineOrCompile.call(this, _sch));
|
||||
}
|
||||
exports.resolveRef = resolveRef;
|
||||
function inlineOrCompile(sch) {
|
||||
if (resolve_1.inlineRef(sch.schema, this.opts.inlineRefs))
|
||||
return sch.schema;
|
||||
return sch.validate ? sch : compileSchema.call(this, sch);
|
||||
}
|
||||
// Index of schema compilation in the currently compiled list
|
||||
function getCompilingSchema(schEnv) {
|
||||
for (const sch of this._compilations) {
|
||||
if (sameSchemaEnv(sch, schEnv))
|
||||
return sch;
|
||||
}
|
||||
}
|
||||
exports.getCompilingSchema = getCompilingSchema;
|
||||
function sameSchemaEnv(s1, s2) {
|
||||
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
||||
}
|
||||
// resolve and compile the references ($ref)
|
||||
// TODO returns AnySchemaObject (if the schema can be inlined) or validation function
|
||||
function resolve(root, // information about the root schema for the current schema
|
||||
ref // reference to resolve
|
||||
) {
|
||||
let sch;
|
||||
while (typeof (sch = this.refs[ref]) == "string")
|
||||
ref = sch;
|
||||
return sch || this.schemas[ref] || resolveSchema.call(this, root, ref);
|
||||
}
|
||||
// Resolve schema, its root and baseId
|
||||
function resolveSchema(root, // root object with properties schema, refs TODO below SchemaEnv is assigned to it
|
||||
ref // reference to resolve
|
||||
) {
|
||||
const p = URI.parse(ref);
|
||||
const refPath = resolve_1._getFullPath(p);
|
||||
let baseId = resolve_1.getFullPath(root.baseId);
|
||||
// TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests
|
||||
if (Object.keys(root.schema).length > 0 && refPath === baseId) {
|
||||
return getJsonPointer.call(this, p, root);
|
||||
}
|
||||
const id = resolve_1.normalizeId(refPath);
|
||||
const schOrRef = this.refs[id] || this.schemas[id];
|
||||
if (typeof schOrRef == "string") {
|
||||
const sch = resolveSchema.call(this, root, schOrRef);
|
||||
if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object")
|
||||
return;
|
||||
return getJsonPointer.call(this, p, sch);
|
||||
}
|
||||
if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== "object")
|
||||
return;
|
||||
if (!schOrRef.validate)
|
||||
compileSchema.call(this, schOrRef);
|
||||
if (id === resolve_1.normalizeId(ref)) {
|
||||
const { schema } = schOrRef;
|
||||
const { schemaId } = this.opts;
|
||||
const schId = schema[schemaId];
|
||||
if (schId)
|
||||
baseId = resolve_1.resolveUrl(baseId, schId);
|
||||
return new SchemaEnv({ schema, schemaId, root, baseId });
|
||||
}
|
||||
return getJsonPointer.call(this, p, schOrRef);
|
||||
}
|
||||
exports.resolveSchema = resolveSchema;
|
||||
const PREVENT_SCOPE_CHANGE = new Set([
|
||||
"properties",
|
||||
"patternProperties",
|
||||
"enum",
|
||||
"dependencies",
|
||||
"definitions",
|
||||
]);
|
||||
function getJsonPointer(parsedRef, { baseId, schema, root }) {
|
||||
var _a;
|
||||
if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== "/")
|
||||
return;
|
||||
for (const part of parsedRef.fragment.slice(1).split("/")) {
|
||||
if (typeof schema == "boolean")
|
||||
return;
|
||||
schema = schema[util_1.unescapeFragment(part)];
|
||||
if (schema === undefined)
|
||||
return;
|
||||
// TODO PREVENT_SCOPE_CHANGE could be defined in keyword def?
|
||||
const schId = typeof schema == "object" && schema[this.opts.schemaId];
|
||||
if (!PREVENT_SCOPE_CHANGE.has(part) && schId) {
|
||||
baseId = resolve_1.resolveUrl(baseId, schId);
|
||||
}
|
||||
}
|
||||
let env;
|
||||
if (typeof schema != "boolean" && schema.$ref && !util_1.schemaHasRulesButRef(schema, this.RULES)) {
|
||||
const $ref = resolve_1.resolveUrl(baseId, schema.$ref);
|
||||
env = resolveSchema.call(this, root, $ref);
|
||||
}
|
||||
// even though resolution failed we need to return SchemaEnv to throw exception
|
||||
// so that compileAsync loads missing schema.
|
||||
const { schemaId } = this.opts;
|
||||
env = env || new SchemaEnv({ schema, schemaId, root, baseId });
|
||||
if (env.schema !== env.root.schema)
|
||||
return env;
|
||||
return undefined;
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/index.js.map
generated
vendored
Normal file
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/parse.d.ts
generated
vendored
Normal file
4
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/parse.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import type Ajv from "../../core";
|
||||
import { SchemaObjectMap } from "./types";
|
||||
import { SchemaEnv } from "..";
|
||||
export default function compileParser(this: Ajv, sch: SchemaEnv, definitions: SchemaObjectMap): SchemaEnv;
|
||||
350
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/parse.js
generated
vendored
Normal file
350
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/parse.js
generated
vendored
Normal file
|
|
@ -0,0 +1,350 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const types_1 = require("./types");
|
||||
const __1 = require("..");
|
||||
const codegen_1 = require("../codegen");
|
||||
const ref_error_1 = require("../ref_error");
|
||||
const names_1 = require("../names");
|
||||
const code_1 = require("../../vocabularies/code");
|
||||
const ref_1 = require("../../vocabularies/jtd/ref");
|
||||
const type_1 = require("../../vocabularies/jtd/type");
|
||||
const parseJson_1 = require("../../runtime/parseJson");
|
||||
const util_1 = require("../util");
|
||||
const timestamp_1 = require("../../runtime/timestamp");
|
||||
const genParse = {
|
||||
elements: parseElements,
|
||||
values: parseValues,
|
||||
discriminator: parseDiscriminator,
|
||||
properties: parseProperties,
|
||||
optionalProperties: parseProperties,
|
||||
enum: parseEnum,
|
||||
type: parseType,
|
||||
ref: parseRef,
|
||||
};
|
||||
function compileParser(sch, definitions) {
|
||||
const _sch = __1.getCompilingSchema.call(this, sch);
|
||||
if (_sch)
|
||||
return _sch;
|
||||
const { es5, lines } = this.opts.code;
|
||||
const { ownProperties } = this.opts;
|
||||
const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties });
|
||||
const parseName = gen.scopeName("parse");
|
||||
const cxt = {
|
||||
self: this,
|
||||
gen,
|
||||
schema: sch.schema,
|
||||
schemaEnv: sch,
|
||||
definitions,
|
||||
data: names_1.default.data,
|
||||
parseName,
|
||||
char: gen.name("c"),
|
||||
};
|
||||
let sourceCode;
|
||||
try {
|
||||
this._compilations.add(sch);
|
||||
sch.parseName = parseName;
|
||||
parserFunction(cxt);
|
||||
gen.optimize(this.opts.code.optimize);
|
||||
const parseFuncCode = gen.toString();
|
||||
sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${parseFuncCode}`;
|
||||
const makeParse = new Function(`${names_1.default.scope}`, sourceCode);
|
||||
const parse = makeParse(this.scope.get());
|
||||
this.scope.value(parseName, { ref: parse });
|
||||
sch.parse = parse;
|
||||
}
|
||||
catch (e) {
|
||||
if (sourceCode)
|
||||
this.logger.error("Error compiling parser, function code:", sourceCode);
|
||||
delete sch.parse;
|
||||
delete sch.parseName;
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
this._compilations.delete(sch);
|
||||
}
|
||||
return sch;
|
||||
}
|
||||
exports.default = compileParser;
|
||||
const undef = codegen_1._ `undefined`;
|
||||
function parserFunction(cxt) {
|
||||
const { gen, parseName, char } = cxt;
|
||||
gen.func(parseName, codegen_1._ `${names_1.default.json}, ${names_1.default.jsonPos}, ${names_1.default.jsonPart}`, false, () => {
|
||||
gen.let(names_1.default.data);
|
||||
gen.let(char);
|
||||
gen.assign(codegen_1._ `${parseName}.message`, undef);
|
||||
gen.assign(codegen_1._ `${parseName}.position`, undef);
|
||||
gen.assign(names_1.default.jsonPos, codegen_1._ `${names_1.default.jsonPos} || 0`);
|
||||
gen.const(names_1.default.jsonLen, codegen_1._ `${names_1.default.json}.length`);
|
||||
parseCode(cxt);
|
||||
skipWhitespace(cxt);
|
||||
gen.if(names_1.default.jsonPart, () => {
|
||||
gen.assign(codegen_1._ `${parseName}.position`, names_1.default.jsonPos);
|
||||
gen.return(names_1.default.data);
|
||||
});
|
||||
gen.if(codegen_1._ `${names_1.default.jsonPos} === ${names_1.default.jsonLen}`, () => gen.return(names_1.default.data));
|
||||
jsonSyntaxError(cxt);
|
||||
});
|
||||
}
|
||||
function parseCode(cxt) {
|
||||
let form;
|
||||
for (const key of types_1.jtdForms) {
|
||||
if (key in cxt.schema) {
|
||||
form = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (form)
|
||||
parseNullable(cxt, genParse[form]);
|
||||
else
|
||||
parseEmpty(cxt);
|
||||
}
|
||||
const parseBoolean = parseBooleanToken(true, parseBooleanToken(false, jsonSyntaxError));
|
||||
function parseNullable(cxt, parseForm) {
|
||||
const { gen, schema, data } = cxt;
|
||||
if (!schema.nullable)
|
||||
return parseForm(cxt);
|
||||
tryParseToken(cxt, "null", parseForm, () => gen.assign(data, null));
|
||||
}
|
||||
function parseElements(cxt) {
|
||||
const { gen, schema, data } = cxt;
|
||||
parseToken(cxt, "[");
|
||||
const ix = gen.let("i", 0);
|
||||
gen.assign(data, codegen_1._ `[]`);
|
||||
parseItems(cxt, "]", () => {
|
||||
const el = gen.let("el");
|
||||
parseCode({ ...cxt, schema: schema.elements, data: el });
|
||||
gen.assign(codegen_1._ `${data}[${ix}++]`, el);
|
||||
});
|
||||
}
|
||||
function parseValues(cxt) {
|
||||
const { gen, schema, data } = cxt;
|
||||
parseToken(cxt, "{");
|
||||
gen.assign(data, codegen_1._ `{}`);
|
||||
parseItems(cxt, "}", () => parseKeyValue(cxt, schema.values));
|
||||
}
|
||||
function parseItems(cxt, endToken, block) {
|
||||
tryParseItems(cxt, endToken, block);
|
||||
parseToken(cxt, endToken);
|
||||
}
|
||||
function tryParseItems(cxt, endToken, block) {
|
||||
const { gen } = cxt;
|
||||
gen.for(codegen_1._ `;${names_1.default.jsonPos}<${names_1.default.jsonLen} && ${jsonSlice(1)}!==${endToken};`, () => {
|
||||
block();
|
||||
tryParseToken(cxt, ",", () => gen.break(), hasItem);
|
||||
});
|
||||
function hasItem() {
|
||||
tryParseToken(cxt, endToken, () => { }, jsonSyntaxError);
|
||||
}
|
||||
}
|
||||
function parseKeyValue(cxt, schema) {
|
||||
const { gen } = cxt;
|
||||
const key = gen.let("key");
|
||||
parseString({ ...cxt, data: key });
|
||||
parseToken(cxt, ":");
|
||||
parsePropertyValue(cxt, key, schema);
|
||||
}
|
||||
function parseDiscriminator(cxt) {
|
||||
const { gen, data, schema } = cxt;
|
||||
const { discriminator, mapping } = schema;
|
||||
parseToken(cxt, "{");
|
||||
gen.assign(data, codegen_1._ `{}`);
|
||||
const startPos = gen.const("pos", names_1.default.jsonPos);
|
||||
const value = gen.let("value");
|
||||
const tag = gen.let("tag");
|
||||
tryParseItems(cxt, "}", () => {
|
||||
const key = gen.let("key");
|
||||
parseString({ ...cxt, data: key });
|
||||
parseToken(cxt, ":");
|
||||
gen.if(codegen_1._ `${key} === ${discriminator}`, () => {
|
||||
parseString({ ...cxt, data: tag });
|
||||
gen.assign(codegen_1._ `${data}[${key}]`, tag);
|
||||
gen.break();
|
||||
}, () => parseEmpty({ ...cxt, data: value }) // can be discarded/skipped
|
||||
);
|
||||
});
|
||||
gen.assign(names_1.default.jsonPos, startPos);
|
||||
gen.if(codegen_1._ `${tag} === undefined`);
|
||||
parsingError(cxt, codegen_1.str `discriminator tag not found`);
|
||||
for (const tagValue in mapping) {
|
||||
gen.elseIf(codegen_1._ `${tag} === ${tagValue}`);
|
||||
parseSchemaProperties({ ...cxt, schema: mapping[tagValue] }, discriminator);
|
||||
}
|
||||
gen.else();
|
||||
parsingError(cxt, codegen_1.str `discriminator value not in schema`);
|
||||
gen.endIf();
|
||||
}
|
||||
function parseProperties(cxt) {
|
||||
const { gen, data } = cxt;
|
||||
parseToken(cxt, "{");
|
||||
gen.assign(data, codegen_1._ `{}`);
|
||||
parseSchemaProperties(cxt);
|
||||
}
|
||||
function parseSchemaProperties(cxt, discriminator) {
|
||||
const { gen, schema, data } = cxt;
|
||||
const { properties, optionalProperties, additionalProperties } = schema;
|
||||
parseItems(cxt, "}", () => {
|
||||
const key = gen.let("key");
|
||||
parseString({ ...cxt, data: key });
|
||||
parseToken(cxt, ":");
|
||||
gen.if(false);
|
||||
parseDefinedProperty(cxt, key, properties);
|
||||
parseDefinedProperty(cxt, key, optionalProperties);
|
||||
if (discriminator) {
|
||||
gen.elseIf(codegen_1._ `${key} === ${discriminator}`);
|
||||
const tag = gen.let("tag");
|
||||
parseString({ ...cxt, data: tag }); // can be discarded, it is already assigned
|
||||
}
|
||||
gen.else();
|
||||
if (additionalProperties) {
|
||||
parseEmpty({ ...cxt, data: codegen_1._ `${data}[${key}]` });
|
||||
}
|
||||
else {
|
||||
parsingError(cxt, codegen_1.str `property ${key} not allowed`);
|
||||
}
|
||||
gen.endIf();
|
||||
});
|
||||
if (properties) {
|
||||
const hasProp = code_1.hasPropFunc(gen);
|
||||
const allProps = codegen_1.and(...Object.keys(properties).map((p) => codegen_1._ `${hasProp}.call(${data}, ${p})`));
|
||||
gen.if(codegen_1.not(allProps), () => parsingError(cxt, codegen_1.str `missing required properties`));
|
||||
}
|
||||
}
|
||||
function parseDefinedProperty(cxt, key, schemas = {}) {
|
||||
const { gen } = cxt;
|
||||
for (const prop in schemas) {
|
||||
gen.elseIf(codegen_1._ `${key} === ${prop}`);
|
||||
parsePropertyValue(cxt, key, schemas[prop]);
|
||||
}
|
||||
}
|
||||
function parsePropertyValue(cxt, key, schema) {
|
||||
parseCode({ ...cxt, schema, data: codegen_1._ `${cxt.data}[${key}]` });
|
||||
}
|
||||
function parseType(cxt) {
|
||||
const { gen, schema, data, self } = cxt;
|
||||
switch (schema.type) {
|
||||
case "boolean":
|
||||
parseBoolean(cxt);
|
||||
break;
|
||||
case "string":
|
||||
parseString(cxt);
|
||||
break;
|
||||
case "timestamp": {
|
||||
parseString(cxt);
|
||||
const vts = util_1.useFunc(gen, timestamp_1.default);
|
||||
const { allowDate, parseDate } = self.opts;
|
||||
const notValid = allowDate ? codegen_1._ `!${vts}(${data}, true)` : codegen_1._ `!${vts}(${data})`;
|
||||
const fail = parseDate
|
||||
? codegen_1.or(notValid, codegen_1._ `(${data} = new Date(${data}), false)`, codegen_1._ `isNaN(${data}.valueOf())`)
|
||||
: notValid;
|
||||
gen.if(fail, () => parsingError(cxt, codegen_1.str `invalid timestamp`));
|
||||
break;
|
||||
}
|
||||
case "float32":
|
||||
case "float64":
|
||||
parseNumber(cxt);
|
||||
break;
|
||||
default: {
|
||||
const t = schema.type;
|
||||
if (!self.opts.int32range && (t === "int32" || t === "uint32")) {
|
||||
parseNumber(cxt, 16); // 2 ** 53 - max safe integer
|
||||
if (t === "uint32") {
|
||||
gen.if(codegen_1._ `${data} < 0`, () => parsingError(cxt, codegen_1.str `integer out of range`));
|
||||
}
|
||||
}
|
||||
else {
|
||||
const [min, max, maxDigits] = type_1.intRange[t];
|
||||
parseNumber(cxt, maxDigits);
|
||||
gen.if(codegen_1._ `${data} < ${min} || ${data} > ${max}`, () => parsingError(cxt, codegen_1.str `integer out of range`));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function parseString(cxt) {
|
||||
parseToken(cxt, '"');
|
||||
parseWith(cxt, parseJson_1.parseJsonString);
|
||||
}
|
||||
function parseEnum(cxt) {
|
||||
const { gen, data, schema } = cxt;
|
||||
const enumSch = schema.enum;
|
||||
parseToken(cxt, '"');
|
||||
// TODO loopEnum
|
||||
gen.if(false);
|
||||
for (const value of enumSch) {
|
||||
const valueStr = JSON.stringify(value).slice(1); // remove starting quote
|
||||
gen.elseIf(codegen_1._ `${jsonSlice(valueStr.length)} === ${valueStr}`);
|
||||
gen.assign(data, codegen_1.str `${value}`);
|
||||
gen.add(names_1.default.jsonPos, valueStr.length);
|
||||
}
|
||||
gen.else();
|
||||
jsonSyntaxError(cxt);
|
||||
gen.endIf();
|
||||
}
|
||||
function parseNumber(cxt, maxDigits) {
|
||||
const { gen } = cxt;
|
||||
skipWhitespace(cxt);
|
||||
gen.if(codegen_1._ `"-0123456789".indexOf(${jsonSlice(1)}) < 0`, () => jsonSyntaxError(cxt), () => parseWith(cxt, parseJson_1.parseJsonNumber, maxDigits));
|
||||
}
|
||||
function parseBooleanToken(bool, fail) {
|
||||
return (cxt) => {
|
||||
const { gen, data } = cxt;
|
||||
tryParseToken(cxt, `${bool}`, () => fail(cxt), () => gen.assign(data, bool));
|
||||
};
|
||||
}
|
||||
function parseRef(cxt) {
|
||||
const { gen, self, definitions, schema, schemaEnv } = cxt;
|
||||
const { ref } = schema;
|
||||
const refSchema = definitions[ref];
|
||||
if (!refSchema)
|
||||
throw new ref_error_1.default("", ref, `No definition ${ref}`);
|
||||
if (!ref_1.hasRef(refSchema))
|
||||
return parseCode({ ...cxt, schema: refSchema });
|
||||
const { root } = schemaEnv;
|
||||
const sch = compileParser.call(self, new __1.SchemaEnv({ schema: refSchema, root }), definitions);
|
||||
partialParse(cxt, getParser(gen, sch), true);
|
||||
}
|
||||
function getParser(gen, sch) {
|
||||
return sch.parse
|
||||
? gen.scopeValue("parse", { ref: sch.parse })
|
||||
: codegen_1._ `${gen.scopeValue("wrapper", { ref: sch })}.parse`;
|
||||
}
|
||||
function parseEmpty(cxt) {
|
||||
parseWith(cxt, parseJson_1.parseJson);
|
||||
}
|
||||
function parseWith(cxt, parseFunc, args) {
|
||||
partialParse(cxt, util_1.useFunc(cxt.gen, parseFunc), args);
|
||||
}
|
||||
function partialParse(cxt, parseFunc, args) {
|
||||
const { gen, data } = cxt;
|
||||
gen.assign(data, codegen_1._ `${parseFunc}(${names_1.default.json}, ${names_1.default.jsonPos}${args ? codegen_1._ `, ${args}` : codegen_1.nil})`);
|
||||
gen.assign(names_1.default.jsonPos, codegen_1._ `${parseFunc}.position`);
|
||||
gen.if(codegen_1._ `${data} === undefined`, () => parsingError(cxt, codegen_1._ `${parseFunc}.message`));
|
||||
}
|
||||
function parseToken(cxt, tok) {
|
||||
tryParseToken(cxt, tok, jsonSyntaxError);
|
||||
}
|
||||
function tryParseToken(cxt, tok, fail, success) {
|
||||
const { gen } = cxt;
|
||||
const n = tok.length;
|
||||
skipWhitespace(cxt);
|
||||
gen.if(codegen_1._ `${jsonSlice(n)} === ${tok}`, () => {
|
||||
gen.add(names_1.default.jsonPos, n);
|
||||
success === null || success === void 0 ? void 0 : success(cxt);
|
||||
}, () => fail(cxt));
|
||||
}
|
||||
function skipWhitespace({ gen, char: c }) {
|
||||
gen.code(codegen_1._ `while((${c}=${names_1.default.json}[${names_1.default.jsonPos}],${c}===" "||${c}==="\\n"||${c}==="\\r"||${c}==="\\t"))${names_1.default.jsonPos}++;`);
|
||||
}
|
||||
function jsonSlice(len) {
|
||||
return len === 1
|
||||
? codegen_1._ `${names_1.default.json}[${names_1.default.jsonPos}]`
|
||||
: codegen_1._ `${names_1.default.json}.slice(${names_1.default.jsonPos}, ${names_1.default.jsonPos}+${len})`;
|
||||
}
|
||||
function jsonSyntaxError(cxt) {
|
||||
parsingError(cxt, codegen_1._ `"unexpected token " + ${names_1.default.json}[${names_1.default.jsonPos}]`);
|
||||
}
|
||||
function parsingError({ gen, parseName }, msg) {
|
||||
gen.assign(codegen_1._ `${parseName}.message`, msg);
|
||||
gen.assign(codegen_1._ `${parseName}.position`, names_1.default.jsonPos);
|
||||
gen.return(undef);
|
||||
}
|
||||
//# sourceMappingURL=parse.js.map
|
||||
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/parse.js.map
generated
vendored
Normal file
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/parse.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/serialize.d.ts
generated
vendored
Normal file
4
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/serialize.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import type Ajv from "../../core";
|
||||
import { SchemaObjectMap } from "./types";
|
||||
import { SchemaEnv } from "..";
|
||||
export default function compileSerializer(this: Ajv, sch: SchemaEnv, definitions: SchemaObjectMap): SchemaEnv;
|
||||
218
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/serialize.js
generated
vendored
Normal file
218
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/serialize.js
generated
vendored
Normal file
|
|
@ -0,0 +1,218 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const types_1 = require("./types");
|
||||
const __1 = require("..");
|
||||
const codegen_1 = require("../codegen");
|
||||
const ref_error_1 = require("../ref_error");
|
||||
const names_1 = require("../names");
|
||||
const code_1 = require("../../vocabularies/code");
|
||||
const ref_1 = require("../../vocabularies/jtd/ref");
|
||||
const util_1 = require("../util");
|
||||
const quote_1 = require("../../runtime/quote");
|
||||
const genSerialize = {
|
||||
elements: serializeElements,
|
||||
values: serializeValues,
|
||||
discriminator: serializeDiscriminator,
|
||||
properties: serializeProperties,
|
||||
optionalProperties: serializeProperties,
|
||||
enum: serializeString,
|
||||
type: serializeType,
|
||||
ref: serializeRef,
|
||||
};
|
||||
function compileSerializer(sch, definitions) {
|
||||
const _sch = __1.getCompilingSchema.call(this, sch);
|
||||
if (_sch)
|
||||
return _sch;
|
||||
const { es5, lines } = this.opts.code;
|
||||
const { ownProperties } = this.opts;
|
||||
const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties });
|
||||
const serializeName = gen.scopeName("serialize");
|
||||
const cxt = {
|
||||
self: this,
|
||||
gen,
|
||||
schema: sch.schema,
|
||||
schemaEnv: sch,
|
||||
definitions,
|
||||
data: names_1.default.data,
|
||||
};
|
||||
let sourceCode;
|
||||
try {
|
||||
this._compilations.add(sch);
|
||||
sch.serializeName = serializeName;
|
||||
gen.func(serializeName, names_1.default.data, false, () => {
|
||||
gen.let(names_1.default.json, codegen_1.str ``);
|
||||
serializeCode(cxt);
|
||||
gen.return(names_1.default.json);
|
||||
});
|
||||
gen.optimize(this.opts.code.optimize);
|
||||
const serializeFuncCode = gen.toString();
|
||||
sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${serializeFuncCode}`;
|
||||
const makeSerialize = new Function(`${names_1.default.scope}`, sourceCode);
|
||||
const serialize = makeSerialize(this.scope.get());
|
||||
this.scope.value(serializeName, { ref: serialize });
|
||||
sch.serialize = serialize;
|
||||
}
|
||||
catch (e) {
|
||||
if (sourceCode)
|
||||
this.logger.error("Error compiling serializer, function code:", sourceCode);
|
||||
delete sch.serialize;
|
||||
delete sch.serializeName;
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
this._compilations.delete(sch);
|
||||
}
|
||||
return sch;
|
||||
}
|
||||
exports.default = compileSerializer;
|
||||
function serializeCode(cxt) {
|
||||
let form;
|
||||
for (const key of types_1.jtdForms) {
|
||||
if (key in cxt.schema) {
|
||||
form = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
serializeNullable(cxt, form ? genSerialize[form] : serializeEmpty);
|
||||
}
|
||||
function serializeNullable(cxt, serializeForm) {
|
||||
const { gen, schema, data } = cxt;
|
||||
if (!schema.nullable)
|
||||
return serializeForm(cxt);
|
||||
gen.if(codegen_1._ `${data} === undefined || ${data} === null`, () => gen.add(names_1.default.json, codegen_1._ `"null"`), () => serializeForm(cxt));
|
||||
}
|
||||
function serializeElements(cxt) {
|
||||
const { gen, schema, data } = cxt;
|
||||
gen.add(names_1.default.json, codegen_1.str `[`);
|
||||
const first = gen.let("first", true);
|
||||
gen.forOf("el", data, (el) => {
|
||||
addComma(cxt, first);
|
||||
serializeCode({ ...cxt, schema: schema.elements, data: el });
|
||||
});
|
||||
gen.add(names_1.default.json, codegen_1.str `]`);
|
||||
}
|
||||
function serializeValues(cxt) {
|
||||
const { gen, schema, data } = cxt;
|
||||
gen.add(names_1.default.json, codegen_1.str `{`);
|
||||
const first = gen.let("first", true);
|
||||
gen.forIn("key", data, (key) => serializeKeyValue(cxt, key, schema.values, first));
|
||||
gen.add(names_1.default.json, codegen_1.str `}`);
|
||||
}
|
||||
function serializeKeyValue(cxt, key, schema, first) {
|
||||
const { gen, data } = cxt;
|
||||
addComma(cxt, first);
|
||||
serializeString({ ...cxt, data: key });
|
||||
gen.add(names_1.default.json, codegen_1.str `:`);
|
||||
const value = gen.const("value", codegen_1._ `${data}${codegen_1.getProperty(key)}`);
|
||||
serializeCode({ ...cxt, schema, data: value });
|
||||
}
|
||||
function serializeDiscriminator(cxt) {
|
||||
const { gen, schema, data } = cxt;
|
||||
const { discriminator } = schema;
|
||||
gen.add(names_1.default.json, codegen_1.str `{${JSON.stringify(discriminator)}:`);
|
||||
const tag = gen.const("tag", codegen_1._ `${data}${codegen_1.getProperty(discriminator)}`);
|
||||
serializeString({ ...cxt, data: tag });
|
||||
gen.if(false);
|
||||
for (const tagValue in schema.mapping) {
|
||||
gen.elseIf(codegen_1._ `${tag} === ${tagValue}`);
|
||||
const sch = schema.mapping[tagValue];
|
||||
serializeSchemaProperties({ ...cxt, schema: sch }, discriminator);
|
||||
}
|
||||
gen.endIf();
|
||||
gen.add(names_1.default.json, codegen_1.str `}`);
|
||||
}
|
||||
function serializeProperties(cxt) {
|
||||
const { gen } = cxt;
|
||||
gen.add(names_1.default.json, codegen_1.str `{`);
|
||||
serializeSchemaProperties(cxt);
|
||||
gen.add(names_1.default.json, codegen_1.str `}`);
|
||||
}
|
||||
function serializeSchemaProperties(cxt, discriminator) {
|
||||
const { gen, schema, data } = cxt;
|
||||
const { properties, optionalProperties } = schema;
|
||||
const props = keys(properties);
|
||||
const optProps = keys(optionalProperties);
|
||||
const allProps = allProperties(props.concat(optProps));
|
||||
let first = !discriminator;
|
||||
for (const key of props) {
|
||||
serializeProperty(key, properties[key], keyValue(key));
|
||||
}
|
||||
for (const key of optProps) {
|
||||
const value = keyValue(key);
|
||||
gen.if(codegen_1.and(codegen_1._ `${value} !== undefined`, code_1.isOwnProperty(gen, data, key)), () => serializeProperty(key, optionalProperties[key], value));
|
||||
}
|
||||
if (schema.additionalProperties) {
|
||||
gen.forIn("key", data, (key) => gen.if(isAdditional(key, allProps), () => serializeKeyValue(cxt, key, {}, gen.let("first", first))));
|
||||
}
|
||||
function keys(ps) {
|
||||
return ps ? Object.keys(ps) : [];
|
||||
}
|
||||
function allProperties(ps) {
|
||||
if (discriminator)
|
||||
ps.push(discriminator);
|
||||
if (new Set(ps).size !== ps.length) {
|
||||
throw new Error("JTD: properties/optionalProperties/disciminator overlap");
|
||||
}
|
||||
return ps;
|
||||
}
|
||||
function keyValue(key) {
|
||||
return gen.const("value", codegen_1._ `${data}${codegen_1.getProperty(key)}`);
|
||||
}
|
||||
function serializeProperty(key, propSchema, value) {
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
gen.add(names_1.default.json, codegen_1.str `,`);
|
||||
gen.add(names_1.default.json, codegen_1.str `${JSON.stringify(key)}:`);
|
||||
serializeCode({ ...cxt, schema: propSchema, data: value });
|
||||
}
|
||||
function isAdditional(key, ps) {
|
||||
return ps.length ? codegen_1.and(...ps.map((p) => codegen_1._ `${key} !== ${p}`)) : true;
|
||||
}
|
||||
}
|
||||
function serializeType(cxt) {
|
||||
const { gen, schema, data } = cxt;
|
||||
switch (schema.type) {
|
||||
case "boolean":
|
||||
gen.add(names_1.default.json, codegen_1._ `${data} ? "true" : "false"`);
|
||||
break;
|
||||
case "string":
|
||||
serializeString(cxt);
|
||||
break;
|
||||
case "timestamp":
|
||||
gen.if(codegen_1._ `${data} instanceof Date`, () => gen.add(names_1.default.json, codegen_1._ `'"' + ${data}.toISOString() + '"'`), () => serializeString(cxt));
|
||||
break;
|
||||
default:
|
||||
serializeNumber(cxt);
|
||||
}
|
||||
}
|
||||
function serializeString({ gen, data }) {
|
||||
gen.add(names_1.default.json, codegen_1._ `${util_1.useFunc(gen, quote_1.default)}(${data})`);
|
||||
}
|
||||
function serializeNumber({ gen, data }) {
|
||||
gen.add(names_1.default.json, codegen_1._ `"" + ${data}`);
|
||||
}
|
||||
function serializeRef(cxt) {
|
||||
const { gen, self, data, definitions, schema, schemaEnv } = cxt;
|
||||
const { ref } = schema;
|
||||
const refSchema = definitions[ref];
|
||||
if (!refSchema)
|
||||
throw new ref_error_1.default("", ref, `No definition ${ref}`);
|
||||
if (!ref_1.hasRef(refSchema))
|
||||
return serializeCode({ ...cxt, schema: refSchema });
|
||||
const { root } = schemaEnv;
|
||||
const sch = compileSerializer.call(self, new __1.SchemaEnv({ schema: refSchema, root }), definitions);
|
||||
gen.add(names_1.default.json, codegen_1._ `${getSerialize(gen, sch)}(${data})`);
|
||||
}
|
||||
function getSerialize(gen, sch) {
|
||||
return sch.serialize
|
||||
? gen.scopeValue("serialize", { ref: sch.serialize })
|
||||
: codegen_1._ `${gen.scopeValue("wrapper", { ref: sch })}.serialize`;
|
||||
}
|
||||
function serializeEmpty({ gen, data }) {
|
||||
gen.add(names_1.default.json, codegen_1._ `JSON.stringify(${data})`);
|
||||
}
|
||||
function addComma({ gen }, first) {
|
||||
gen.if(first, () => gen.assign(first, false), () => gen.add(names_1.default.json, codegen_1.str `,`));
|
||||
}
|
||||
//# sourceMappingURL=serialize.js.map
|
||||
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/serialize.js.map
generated
vendored
Normal file
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/serialize.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/types.d.ts
generated
vendored
Normal file
6
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import type { SchemaObject } from "../../types";
|
||||
export declare type SchemaObjectMap = {
|
||||
[Ref in string]?: SchemaObject;
|
||||
};
|
||||
export declare const jtdForms: readonly ["elements", "values", "discriminator", "properties", "optionalProperties", "enum", "type", "ref"];
|
||||
export declare type JTDForm = typeof jtdForms[number];
|
||||
14
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/types.js
generated
vendored
Normal file
14
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/types.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.jtdForms = void 0;
|
||||
exports.jtdForms = [
|
||||
"elements",
|
||||
"values",
|
||||
"discriminator",
|
||||
"properties",
|
||||
"optionalProperties",
|
||||
"enum",
|
||||
"type",
|
||||
"ref",
|
||||
];
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/types.js.map
generated
vendored
Normal file
1
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/jtd/types.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/compile/jtd/types.ts"],"names":[],"mappings":";;;AAIa,QAAA,QAAQ,GAAG;IACtB,UAAU;IACV,QAAQ;IACR,eAAe;IACf,YAAY;IACZ,oBAAoB;IACpB,MAAM;IACN,MAAM;IACN,KAAK;CACG,CAAA"}
|
||||
20
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/names.d.ts
generated
vendored
Normal file
20
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/names.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { Name } from "./codegen";
|
||||
declare const names: {
|
||||
data: Name;
|
||||
valCxt: Name;
|
||||
instancePath: Name;
|
||||
parentData: Name;
|
||||
parentDataProperty: Name;
|
||||
rootData: Name;
|
||||
dynamicAnchors: Name;
|
||||
vErrors: Name;
|
||||
errors: Name;
|
||||
this: Name;
|
||||
self: Name;
|
||||
scope: Name;
|
||||
json: Name;
|
||||
jsonPos: Name;
|
||||
jsonLen: Name;
|
||||
jsonPart: Name;
|
||||
};
|
||||
export default names;
|
||||
28
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/names.js
generated
vendored
Normal file
28
github/codeql-action-v1/node_modules/table/node_modules/ajv/dist/compile/names.js
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const codegen_1 = require("./codegen");
|
||||
const names = {
|
||||
// validation function arguments
|
||||
data: new codegen_1.Name("data"),
|
||||
// args passed from referencing schema
|
||||
valCxt: new codegen_1.Name("valCxt"),
|
||||
instancePath: new codegen_1.Name("instancePath"),
|
||||
parentData: new codegen_1.Name("parentData"),
|
||||
parentDataProperty: new codegen_1.Name("parentDataProperty"),
|
||||
rootData: new codegen_1.Name("rootData"),
|
||||
dynamicAnchors: new codegen_1.Name("dynamicAnchors"),
|
||||
// function scoped variables
|
||||
vErrors: new codegen_1.Name("vErrors"),
|
||||
errors: new codegen_1.Name("errors"),
|
||||
this: new codegen_1.Name("this"),
|
||||
// "globals"
|
||||
self: new codegen_1.Name("self"),
|
||||
scope: new codegen_1.Name("scope"),
|
||||
// JTD serialize/parse name for JSON string and position
|
||||
json: new codegen_1.Name("json"),
|
||||
jsonPos: new codegen_1.Name("jsonPos"),
|
||||
jsonLen: new codegen_1.Name("jsonLen"),
|
||||
jsonPart: new codegen_1.Name("jsonPart"),
|
||||
};
|
||||
exports.default = names;
|
||||
//# sourceMappingURL=names.js.map
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue