Apply Gitignore
This commit is contained in:
430
.gitignore
vendored
430
.gitignore
vendored
@@ -1,215 +1,215 @@
|
||||
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/node,windows,linux,macos
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=node,windows,linux,macos
|
||||
|
||||
### Linux ###
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
### macOS ###
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
### Node ###
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
.temp
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# yarn v2
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
### Node Patch ###
|
||||
# Serverless Webpack directories
|
||||
.webpack/
|
||||
|
||||
# Optional stylelint cache
|
||||
|
||||
# SvelteKit build / generate output
|
||||
.svelte-kit
|
||||
|
||||
### Windows ###
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/node,windows,linux,macos
|
||||
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/node,windows,linux,macos
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=node,windows,linux,macos
|
||||
|
||||
### Linux ###
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
### macOS ###
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
### Node ###
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
.temp
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# yarn v2
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
### Node Patch ###
|
||||
# Serverless Webpack directories
|
||||
.webpack/
|
||||
|
||||
# Optional stylelint cache
|
||||
|
||||
# SvelteKit build / generate output
|
||||
.svelte-kit
|
||||
|
||||
### Windows ###
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/node,windows,linux,macos
|
||||
|
||||
32
.vscode/launch.json
vendored
32
.vscode/launch.json
vendored
@@ -1,17 +1,17 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"program": "${workspaceFolder}\\app.js",
|
||||
}
|
||||
]
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"program": "${workspaceFolder}\\app.js",
|
||||
}
|
||||
]
|
||||
}
|
||||
332
app.js
332
app.js
@@ -1,166 +1,166 @@
|
||||
|
||||
const assert = require('assert');
|
||||
const moment = require('moment');
|
||||
const cbor = require('cbor');
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
|
||||
const certificate = fs.readFileSync(process.env.CLIENT_CRT || 'cert/client.crt', 'utf8');
|
||||
const privateKey = fs.readFileSync(process.env.CLIENT_KEY || 'cert/client.key', 'utf8');
|
||||
|
||||
const opt = {
|
||||
key: privateKey,
|
||||
cert: certificate,
|
||||
minVersion: process.env.MIN_TLS_VERSION || "TLSv1.1",
|
||||
sessionTimeout: 2
|
||||
};
|
||||
|
||||
const dbcontroller = require('./db');
|
||||
const routes = require('./routes')
|
||||
|
||||
const app = express();
|
||||
const http_port = parseInt(process.env.HTTP_PORT, 10) || 80;
|
||||
const https_port = parseInt(process.env.HTTPS_PORT, 10) || 443;
|
||||
const environment = process.env.CONFIGURATION || 'develop';
|
||||
|
||||
const httpServer = http.createServer(app);
|
||||
const httpsServer = https.createServer(credentials, app);
|
||||
|
||||
///// Splashscreen
|
||||
console.log(' _ __ __ _ ');
|
||||
console.log(' / | / /___ / /(_)_____ _____ ___ ____ ');
|
||||
console.log(' / |/ // _ \\ / // // ___// ___// _ \\ / __ \\');
|
||||
console.log(' / /| // __// // /(__ )(__ )/ __// / / /');
|
||||
console.log('/_/ |_/ \\___//_//_//____//____/ \\___//_/ /_/ ');
|
||||
console.log(' ');
|
||||
console.log(' T E C H N O L O G I E S');
|
||||
console.log('');
|
||||
console.log('');
|
||||
|
||||
///// Startup MongoDB Client
|
||||
dbcontroller.init()
|
||||
.then((err) => {
|
||||
if (err) { console.log('Unable to connect to database'); }
|
||||
else {
|
||||
console.log('-------------------------------------------------------');
|
||||
console.log(Date().toString());
|
||||
console.log('MongoDB Client initialized');
|
||||
console.log('-------------------------------------------------------');
|
||||
|
||||
///// Startup HTTP Server
|
||||
httpServer.listen(http_port, () => {
|
||||
console.log('-------------------------------------------------------');
|
||||
console.log(`Server listening at http://localhost:${http_port}`);
|
||||
console.log('Environment: ' + environment);
|
||||
console.log('HTTP Port: ' + http_port);
|
||||
console.log('-------------------------------------------------------');
|
||||
});
|
||||
|
||||
///// Startup HTTPS Server
|
||||
httpsServer.listen(https_port, () => {
|
||||
console.log('-------------------------------------------------------');
|
||||
console.log(`Server listening at https://localhost:${https_port}`);
|
||||
console.log('Environment: ' + environment);
|
||||
console.log('HTTPS Port: ' + https_port);
|
||||
console.log('-------------------------------------------------------');
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
app.use(express.json());
|
||||
app.use(express.raw({ type: 'application/cbor' }));
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
// Log request
|
||||
console.log('-------------------------------------------------------');
|
||||
console.log(req.method + ' ' + req.url + ' from ' + req.ip);
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
if (!req.body.length) {
|
||||
// No body
|
||||
//////////
|
||||
console.log('Got empty frame');
|
||||
|
||||
///// Next handler
|
||||
next();
|
||||
|
||||
} else if (req.is('application/cbor')) {
|
||||
// CBOR frame
|
||||
/////////////
|
||||
console.log('Got CBOR frame');
|
||||
console.log('Encoded:');
|
||||
console.log(req.body.toString('hex'))
|
||||
///// Decode CBOR body
|
||||
cbor.decodeFirst(req.body, (err, decoded) => {
|
||||
///// Assign decoded data
|
||||
req.body = decoded;
|
||||
|
||||
///// Next handler
|
||||
console.log('Decoded:');
|
||||
console.log(req.body)
|
||||
next();
|
||||
});
|
||||
|
||||
} else {
|
||||
// JSON frame
|
||||
/////////////
|
||||
console.log('Got JSON frame');
|
||||
console.log(req.body)
|
||||
|
||||
///// Next handler
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
var length = 0;
|
||||
var send = res.send;
|
||||
|
||||
/////////////////////////
|
||||
// Redefine send function
|
||||
res.send = function (body) {
|
||||
if (req.is('application/cbor') || req.acceptsEncodings("application/cbor") || req.acceptsEncodings("cbor")) {
|
||||
// CBOR Frame
|
||||
/////////////
|
||||
console.log('Send CBOR frame');
|
||||
console.log('Decoded:');
|
||||
console.log(body)
|
||||
|
||||
///// Set header
|
||||
res.set('Content-Type', 'application/cbor');
|
||||
length = JSON.stringify(body).length;
|
||||
|
||||
///// Convert ' to "
|
||||
if (body.data) { body.data = cbor.encode(JSON.parse(body.data.replace(/'/g, '"'))); }
|
||||
|
||||
///// Encode JSON to CBOR
|
||||
body = cbor.encode(body);
|
||||
|
||||
// Log statistics
|
||||
console.log('Encoded:');
|
||||
console.log(body.toString('hex'))
|
||||
console.log(length + ' Bytes (JSON) -> ' + body.length + ' Bytes (CBOR) -> ' + Math.round((1 - length / body.length) * 100) + '% reduction');
|
||||
}
|
||||
|
||||
///// Send frame
|
||||
send.call(this, body);
|
||||
};
|
||||
|
||||
///// Next handler
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
// Add formatted-date header
|
||||
res.setHeader("Formatted-Date", moment().format());
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(routes)
|
||||
|
||||
|
||||
|
||||
const assert = require('assert');
|
||||
const moment = require('moment');
|
||||
const cbor = require('cbor');
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
|
||||
const certificate = fs.readFileSync(process.env.CLIENT_CRT || 'cert/client.crt', 'utf8');
|
||||
const privateKey = fs.readFileSync(process.env.CLIENT_KEY || 'cert/client.key', 'utf8');
|
||||
|
||||
const credentials = {
|
||||
key: privateKey,
|
||||
cert: certificate,
|
||||
minVersion: process.env.MIN_TLS_VERSION || "TLSv1.1",
|
||||
sessionTimeout: 2
|
||||
};
|
||||
|
||||
const dbcontroller = require('./db');
|
||||
const routes = require('./routes')
|
||||
|
||||
const app = express();
|
||||
const http_port = parseInt(process.env.HTTP_PORT, 10) || 80;
|
||||
const https_port = parseInt(process.env.HTTPS_PORT, 10) || 443;
|
||||
const environment = process.env.CONFIGURATION || 'develop';
|
||||
|
||||
const httpServer = http.createServer(app);
|
||||
const httpsServer = https.createServer(credentials, app);
|
||||
|
||||
///// Splashscreen
|
||||
console.log(' _ __ __ _ ');
|
||||
console.log(' / | / /___ / /(_)_____ _____ ___ ____ ');
|
||||
console.log(' / |/ // _ \\ / // // ___// ___// _ \\ / __ \\');
|
||||
console.log(' / /| // __// // /(__ )(__ )/ __// / / /');
|
||||
console.log('/_/ |_/ \\___//_//_//____//____/ \\___//_/ /_/ ');
|
||||
console.log(' ');
|
||||
console.log(' T E C H N O L O G I E S');
|
||||
console.log('');
|
||||
console.log('');
|
||||
|
||||
///// Startup MongoDB Client
|
||||
dbcontroller.init()
|
||||
.then((err) => {
|
||||
if (err) { console.log('Unable to connect to database'); }
|
||||
else {
|
||||
console.log('-------------------------------------------------------');
|
||||
console.log(Date().toString());
|
||||
console.log('MongoDB Client initialized');
|
||||
console.log('-------------------------------------------------------');
|
||||
|
||||
///// Startup HTTP Server
|
||||
httpServer.listen(http_port, () => {
|
||||
console.log('-------------------------------------------------------');
|
||||
console.log(`Server listening at http://localhost:${http_port}`);
|
||||
console.log('Environment: ' + environment);
|
||||
console.log('HTTP Port: ' + http_port);
|
||||
console.log('-------------------------------------------------------');
|
||||
});
|
||||
|
||||
///// Startup HTTPS Server
|
||||
httpsServer.listen(https_port, () => {
|
||||
console.log('-------------------------------------------------------');
|
||||
console.log(`Server listening at https://localhost:${https_port}`);
|
||||
console.log('Environment: ' + environment);
|
||||
console.log('HTTPS Port: ' + https_port);
|
||||
console.log('-------------------------------------------------------');
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
app.use(express.json());
|
||||
app.use(express.raw({ type: 'application/cbor' }));
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
// Log request
|
||||
console.log('-------------------------------------------------------');
|
||||
console.log(req.method + ' ' + req.url + ' from ' + req.ip);
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
if (!req.body.length) {
|
||||
// No body
|
||||
//////////
|
||||
console.log('Got empty frame');
|
||||
|
||||
///// Next handler
|
||||
next();
|
||||
|
||||
} else if (req.is('application/cbor')) {
|
||||
// CBOR frame
|
||||
/////////////
|
||||
console.log('Got CBOR frame');
|
||||
console.log('Encoded:');
|
||||
console.log(req.body.toString('hex'))
|
||||
///// Decode CBOR body
|
||||
cbor.decodeFirst(req.body, (err, decoded) => {
|
||||
///// Assign decoded data
|
||||
req.body = decoded;
|
||||
|
||||
///// Next handler
|
||||
console.log('Decoded:');
|
||||
console.log(req.body)
|
||||
next();
|
||||
});
|
||||
|
||||
} else {
|
||||
// JSON frame
|
||||
/////////////
|
||||
console.log('Got JSON frame');
|
||||
console.log(req.body)
|
||||
|
||||
///// Next handler
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
var length = 0;
|
||||
var send = res.send;
|
||||
|
||||
/////////////////////////
|
||||
// Redefine send function
|
||||
res.send = function (body) {
|
||||
if (req.is('application/cbor') || req.acceptsEncodings("application/cbor") || req.acceptsEncodings("cbor")) {
|
||||
// CBOR Frame
|
||||
/////////////
|
||||
console.log('Send CBOR frame');
|
||||
console.log('Decoded:');
|
||||
console.log(body)
|
||||
|
||||
///// Set header
|
||||
res.set('Content-Type', 'application/cbor');
|
||||
length = JSON.stringify(body).length;
|
||||
|
||||
///// Convert ' to "
|
||||
if (body.data) { body.data = cbor.encode(JSON.parse(body.data.replace(/'/g, '"'))); }
|
||||
|
||||
///// Encode JSON to CBOR
|
||||
body = cbor.encode(body);
|
||||
|
||||
// Log statistics
|
||||
console.log('Encoded:');
|
||||
console.log(body.toString('hex'))
|
||||
console.log(length + ' Bytes (JSON) -> ' + body.length + ' Bytes (CBOR) -> ' + Math.round((1 - length / body.length) * 100) + '% reduction');
|
||||
}
|
||||
|
||||
///// Send frame
|
||||
send.call(this, body);
|
||||
};
|
||||
|
||||
///// Next handler
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
// Add formatted-date header
|
||||
res.setHeader("Formatted-Date", moment().format());
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(routes)
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
[ req ]
|
||||
distinguished_name = dn
|
||||
req_extensions = v3_req
|
||||
prompt = no
|
||||
|
||||
[ dn ]
|
||||
CN = arnaudne.synology.me
|
||||
emailAddress = email@me.com
|
||||
O = ANELISSEN
|
||||
OU = Herault
|
||||
L = Montpellier
|
||||
ST = Occitanie
|
||||
C = FR
|
||||
|
||||
[v3_req]
|
||||
extendedKeyUsage = serverAuth
|
||||
subjectAltName = @alt_names
|
||||
|
||||
[alt_names]
|
||||
DNS.1 = arnaudne.synology.me
|
||||
DNS.2 = anelissen.ddns.net
|
||||
[ req ]
|
||||
distinguished_name = dn
|
||||
req_extensions = v3_req
|
||||
prompt = no
|
||||
|
||||
[ dn ]
|
||||
CN = arnaudne.synology.me
|
||||
emailAddress = email@me.com
|
||||
O = ANELISSEN
|
||||
OU = Herault
|
||||
L = Montpellier
|
||||
ST = Occitanie
|
||||
C = FR
|
||||
|
||||
[v3_req]
|
||||
extendedKeyUsage = serverAuth
|
||||
subjectAltName = @alt_names
|
||||
|
||||
[alt_names]
|
||||
DNS.1 = arnaudne.synology.me
|
||||
DNS.2 = anelissen.ddns.net
|
||||
DNS.3 = localhost
|
||||
@@ -1,18 +1,18 @@
|
||||
const services = require('../services')
|
||||
|
||||
const { data } = services
|
||||
|
||||
const postSetData = async (req, res, next) => {
|
||||
try {
|
||||
var values = { data: req.body.data, msn: req.body.msn, id: req.params.id }
|
||||
const code = await data.createData(values)
|
||||
res.send(code)
|
||||
} catch (e) {
|
||||
console.log(e.message)
|
||||
res.sendStatus(500)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
postSetData,
|
||||
const services = require('../services')
|
||||
|
||||
const { data } = services
|
||||
|
||||
const postSetData = async (req, res, next) => {
|
||||
try {
|
||||
var values = { data: req.body.data, msn: req.body.msn, id: req.params.id }
|
||||
const code = await data.createData(values)
|
||||
res.send(code)
|
||||
} catch (e) {
|
||||
console.log(e.message)
|
||||
res.sendStatus(500)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
postSetData,
|
||||
}
|
||||
@@ -1,30 +1,30 @@
|
||||
const services = require('../services')
|
||||
|
||||
const { firmware } = services
|
||||
|
||||
const postLookFirmware = async (req, res, next) => {
|
||||
const { serialNumber, hash, version, type, hardwareIndex, hardwareVersion } = req.body
|
||||
try {
|
||||
const obj = await firmware.lookFirmware(serialNumber, hash, version, type, hardwareIndex, hardwareVersion)
|
||||
res.send(obj)
|
||||
} catch (e) {
|
||||
console.log(e.message)
|
||||
res.sendStatus(500)
|
||||
}
|
||||
}
|
||||
|
||||
const postSyncFirmware = async (req, res, next) => {
|
||||
const { serialNumber, hash, version, type, hardwareIndex, hardwareVersion } = req.body
|
||||
try {
|
||||
const obj = await firmware.syncFirmware(serialNumber, hash, version, type, hardwareIndex, hardwareVersion)
|
||||
res.send(obj)
|
||||
} catch (e) {
|
||||
console.log(e.message)
|
||||
res.sendStatus(500)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
postLookFirmware,
|
||||
postSyncFirmware
|
||||
const services = require('../services')
|
||||
|
||||
const { firmware } = services
|
||||
|
||||
const postLookFirmware = async (req, res, next) => {
|
||||
const { serialNumber, hash, version, type, hardwareIndex, hardwareVersion } = req.body
|
||||
try {
|
||||
const obj = await firmware.lookFirmware(serialNumber, hash, version, type, hardwareIndex, hardwareVersion)
|
||||
res.send(obj)
|
||||
} catch (e) {
|
||||
console.log(e.message)
|
||||
res.sendStatus(500)
|
||||
}
|
||||
}
|
||||
|
||||
const postSyncFirmware = async (req, res, next) => {
|
||||
const { serialNumber, hash, version, type, hardwareIndex, hardwareVersion } = req.body
|
||||
try {
|
||||
const obj = await firmware.syncFirmware(serialNumber, hash, version, type, hardwareIndex, hardwareVersion)
|
||||
res.send(obj)
|
||||
} catch (e) {
|
||||
console.log(e.message)
|
||||
res.sendStatus(500)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
postLookFirmware,
|
||||
postSyncFirmware
|
||||
}
|
||||
@@ -1,67 +1,67 @@
|
||||
const services = require('../services')
|
||||
|
||||
const { device } = services
|
||||
|
||||
const postGetRequestToDo = async (req, res, next) => {
|
||||
///// Emit event to server
|
||||
try {
|
||||
await device.postRequestToDo(req.body.relayMsn, req.body);
|
||||
await device.getRequestToDo(req.body.relayMsn);
|
||||
var response = { todo: [{ serialNumber: req.body.relayMsn, configuration: 1 }] };
|
||||
console.log(req.body);
|
||||
res.send(response);
|
||||
} catch (error) {
|
||||
res.send(500);
|
||||
}
|
||||
}
|
||||
|
||||
const getModuleConfiguration = async (req, res, next) => {
|
||||
///// Emit event to server
|
||||
var response = {
|
||||
"name": "LRBST-R-TARACE",
|
||||
"inventory": [
|
||||
"7400040670330001"
|
||||
],
|
||||
"wakeUpTimes": [
|
||||
60,
|
||||
480,
|
||||
540,
|
||||
600,
|
||||
660,
|
||||
720,
|
||||
780,
|
||||
840,
|
||||
900,
|
||||
960,
|
||||
1020,
|
||||
1080
|
||||
]
|
||||
};
|
||||
|
||||
res.send(response);
|
||||
}
|
||||
|
||||
const setModuleConfiguration = async (req, res, next) => {
|
||||
|
||||
}
|
||||
|
||||
const getModulePrograms = async (req, res, next) => {
|
||||
|
||||
}
|
||||
|
||||
const setModulePrograms = async (req, res, next) => {
|
||||
|
||||
}
|
||||
|
||||
const reportModuleDataSent = async (req, res, next) => {
|
||||
res.send(200);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
postGetRequestToDo,
|
||||
getModuleConfiguration,
|
||||
setModuleConfiguration,
|
||||
getModulePrograms,
|
||||
setModulePrograms,
|
||||
reportModuleDataSent,
|
||||
const services = require('../services')
|
||||
|
||||
const { device } = services
|
||||
|
||||
const postGetRequestToDo = async (req, res, next) => {
|
||||
///// Emit event to server
|
||||
try {
|
||||
await device.postRequestToDo(req.body.relayMsn, req.body);
|
||||
await device.getRequestToDo(req.body.relayMsn);
|
||||
var response = { todo: [{ serialNumber: req.body.relayMsn, configuration: 1 }] };
|
||||
console.log(req.body);
|
||||
res.send(response);
|
||||
} catch (error) {
|
||||
res.send(500);
|
||||
}
|
||||
}
|
||||
|
||||
const getModuleConfiguration = async (req, res, next) => {
|
||||
///// Emit event to server
|
||||
var response = {
|
||||
"name": "LRBST-R-TARACE",
|
||||
"inventory": [
|
||||
"7400040670330001"
|
||||
],
|
||||
"wakeUpTimes": [
|
||||
60,
|
||||
480,
|
||||
540,
|
||||
600,
|
||||
660,
|
||||
720,
|
||||
780,
|
||||
840,
|
||||
900,
|
||||
960,
|
||||
1020,
|
||||
1080
|
||||
]
|
||||
};
|
||||
|
||||
res.send(response);
|
||||
}
|
||||
|
||||
const setModuleConfiguration = async (req, res, next) => {
|
||||
|
||||
}
|
||||
|
||||
const getModulePrograms = async (req, res, next) => {
|
||||
|
||||
}
|
||||
|
||||
const setModulePrograms = async (req, res, next) => {
|
||||
|
||||
}
|
||||
|
||||
const reportModuleDataSent = async (req, res, next) => {
|
||||
res.send(200);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
postGetRequestToDo,
|
||||
getModuleConfiguration,
|
||||
setModuleConfiguration,
|
||||
getModulePrograms,
|
||||
setModulePrograms,
|
||||
reportModuleDataSent,
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
const status = require('./status.controller')
|
||||
const data = require('./data.controller')
|
||||
const firmware = require('./firmware.controller')
|
||||
const ipx = require('./ipx.controller')
|
||||
const journal = require('./journal.controller')
|
||||
const longpolling = require('./longpolling.controller')
|
||||
const grtd = require('./grtd.controller')
|
||||
|
||||
module.exports = {
|
||||
status,
|
||||
data,
|
||||
firmware,
|
||||
ipx,
|
||||
journal,
|
||||
longpolling,
|
||||
grtd,
|
||||
const status = require('./status.controller')
|
||||
const data = require('./data.controller')
|
||||
const firmware = require('./firmware.controller')
|
||||
const ipx = require('./ipx.controller')
|
||||
const journal = require('./journal.controller')
|
||||
const longpolling = require('./longpolling.controller')
|
||||
const grtd = require('./grtd.controller')
|
||||
|
||||
module.exports = {
|
||||
status,
|
||||
data,
|
||||
firmware,
|
||||
ipx,
|
||||
journal,
|
||||
longpolling,
|
||||
grtd,
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
const services = require('../services')
|
||||
|
||||
const { ipx } = services
|
||||
|
||||
const postIpxData = async (req, res, next) => {
|
||||
try {
|
||||
var values = { ipxModules: req.body.ipxModules, id: req.params.id }
|
||||
const code = await ipx.createIpxData(values)
|
||||
res.send(code)
|
||||
} catch (e) {
|
||||
console.log(e.message)
|
||||
res.sendStatus(500)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
postIpxData,
|
||||
const services = require('../services')
|
||||
|
||||
const { ipx } = services
|
||||
|
||||
const postIpxData = async (req, res, next) => {
|
||||
try {
|
||||
var values = { ipxModules: req.body.ipxModules, id: req.params.id }
|
||||
const code = await ipx.createIpxData(values)
|
||||
res.send(code)
|
||||
} catch (e) {
|
||||
console.log(e.message)
|
||||
res.sendStatus(500)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
postIpxData,
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
const services = require('../services')
|
||||
|
||||
const { journal } = services
|
||||
|
||||
const postSetJournal = async (req, res, next) => {
|
||||
try {
|
||||
var values = { events: req.body.events, msn: req.body.msn, id: req.params.id }
|
||||
const code = await journal.createEvents(values)
|
||||
res.send(code)
|
||||
} catch (e) {
|
||||
console.log(e.message)
|
||||
res.sendStatus(500)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
postSetJournal,
|
||||
const services = require('../services')
|
||||
|
||||
const { journal } = services
|
||||
|
||||
const postSetJournal = async (req, res, next) => {
|
||||
try {
|
||||
var values = { events: req.body.events, msn: req.body.msn, id: req.params.id }
|
||||
const code = await journal.createEvents(values)
|
||||
res.send(code)
|
||||
} catch (e) {
|
||||
console.log(e.message)
|
||||
res.sendStatus(500)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
postSetJournal,
|
||||
}
|
||||
@@ -1,109 +1,109 @@
|
||||
const services = require('../services')
|
||||
const events = require('events');
|
||||
const random_bytes = require('random-bytes');
|
||||
|
||||
const emitter = new events.EventEmitter();
|
||||
|
||||
const { longpolling } = services
|
||||
|
||||
const poll_server_timeout = 20000;
|
||||
const poll_client_timeout = 60000;
|
||||
|
||||
poll_request_event_identifier = function (id) { return ('poll-request-' + id).toLowerCase(); }
|
||||
poll_response_event_identifier = function (qid) { return ('poll-response-' + qid).toLowerCase(); }
|
||||
|
||||
poll_request = function (method, action, id, device, data, callback) {
|
||||
function request_listener(message) {
|
||||
///// Stop timeout
|
||||
clearTimeout(timeout);
|
||||
callback(null, message);
|
||||
};
|
||||
|
||||
///// Create object
|
||||
object = {
|
||||
method: method,
|
||||
nsip: device || '',
|
||||
action: action || '/',
|
||||
data: JSON.stringify(data).replace(/"/g, "'") || '{}',
|
||||
qid: random_bytes.sync(16).toString('hex')
|
||||
};
|
||||
|
||||
///// Wait long polling to open
|
||||
emitter.emit(poll_request_event_identifier(id), object);
|
||||
|
||||
///// Start timeout
|
||||
var timeout = setTimeout(() => {
|
||||
///// Remove listener
|
||||
emitter.removeListener(poll_response_event_identifier(object.qid), request_listener);
|
||||
|
||||
///// Send timeout
|
||||
console.log(id + ' did not long poll (' + object.qid + ')');
|
||||
callback('timeout', null);
|
||||
}, poll_client_timeout);
|
||||
|
||||
///// Listen for event
|
||||
emitter.once(poll_response_event_identifier(object.qid), request_listener);
|
||||
}
|
||||
|
||||
const postPeriodic = async (req, res, next) => {
|
||||
function listener(message) {
|
||||
///// Stop timeout
|
||||
clearTimeout(timeout);
|
||||
|
||||
///// Send response
|
||||
res.send(message);
|
||||
};
|
||||
|
||||
///// Start timeout
|
||||
var timeout = setTimeout(() => {
|
||||
///// Remove listener
|
||||
emitter.removeListener(poll_request_event_identifier(req.params.id), listener);
|
||||
|
||||
///// Send timeout
|
||||
res.sendStatus(408);
|
||||
console.log('Sending timeout to client ' + req.ip + ' (' + req.params.id + ')');
|
||||
}, poll_server_timeout);
|
||||
|
||||
///// Listen for event
|
||||
emitter.once(poll_request_event_identifier(req.params.id), listener);
|
||||
}
|
||||
|
||||
const postResponse = async (req, res, next) => {
|
||||
///// Emit event to client
|
||||
emitter.emit(poll_response_event_identifier(req.params.qid), req.body);
|
||||
|
||||
///// Response OK
|
||||
res.sendStatus(200);
|
||||
}
|
||||
|
||||
const getModuleRequest = async (req, res, next) => {
|
||||
///// Emit event to server
|
||||
url_encoded = req.query;
|
||||
poll_request(req.method, req.params.route, req.params.id, req.params.module, url_encoded, (error, body) => {
|
||||
if (error) { res.send(error); }
|
||||
else { res.send(body); }
|
||||
});
|
||||
|
||||
req.on("close", function () {
|
||||
console.log("Request cancelled by client");
|
||||
});
|
||||
}
|
||||
|
||||
const postModuleRequest = async (req, res, next) => {
|
||||
///// Emit event to server
|
||||
poll_request(req.method, req.params.route, req.params.id, req.params.module, req.body, (error, body) => {
|
||||
if (error) { res.send(error); }
|
||||
else { res.send(body); }
|
||||
});
|
||||
|
||||
req.on("close", function () {
|
||||
console.log("Request cancelled by client");
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
postPeriodic,
|
||||
postResponse,
|
||||
getModuleRequest,
|
||||
postModuleRequest
|
||||
const services = require('../services')
|
||||
const events = require('events');
|
||||
const random_bytes = require('random-bytes');
|
||||
|
||||
const emitter = new events.EventEmitter();
|
||||
|
||||
const { longpolling } = services
|
||||
|
||||
const poll_server_timeout = 20000;
|
||||
const poll_client_timeout = 60000;
|
||||
|
||||
poll_request_event_identifier = function (id) { return ('poll-request-' + id).toLowerCase(); }
|
||||
poll_response_event_identifier = function (qid) { return ('poll-response-' + qid).toLowerCase(); }
|
||||
|
||||
poll_request = function (method, action, id, device, data, callback) {
|
||||
function request_listener(message) {
|
||||
///// Stop timeout
|
||||
clearTimeout(timeout);
|
||||
callback(null, message);
|
||||
};
|
||||
|
||||
///// Create object
|
||||
object = {
|
||||
method: method,
|
||||
nsip: device || '',
|
||||
action: action || '/',
|
||||
data: JSON.stringify(data).replace(/"/g, "'") || '{}',
|
||||
qid: random_bytes.sync(16).toString('hex')
|
||||
};
|
||||
|
||||
///// Wait long polling to open
|
||||
emitter.emit(poll_request_event_identifier(id), object);
|
||||
|
||||
///// Start timeout
|
||||
var timeout = setTimeout(() => {
|
||||
///// Remove listener
|
||||
emitter.removeListener(poll_response_event_identifier(object.qid), request_listener);
|
||||
|
||||
///// Send timeout
|
||||
console.log(id + ' did not long poll (' + object.qid + ')');
|
||||
callback('timeout', null);
|
||||
}, poll_client_timeout);
|
||||
|
||||
///// Listen for event
|
||||
emitter.once(poll_response_event_identifier(object.qid), request_listener);
|
||||
}
|
||||
|
||||
const postPeriodic = async (req, res, next) => {
|
||||
function listener(message) {
|
||||
///// Stop timeout
|
||||
clearTimeout(timeout);
|
||||
|
||||
///// Send response
|
||||
res.send(message);
|
||||
};
|
||||
|
||||
///// Start timeout
|
||||
var timeout = setTimeout(() => {
|
||||
///// Remove listener
|
||||
emitter.removeListener(poll_request_event_identifier(req.params.id), listener);
|
||||
|
||||
///// Send timeout
|
||||
res.sendStatus(408);
|
||||
console.log('Sending timeout to client ' + req.ip + ' (' + req.params.id + ')');
|
||||
}, poll_server_timeout);
|
||||
|
||||
///// Listen for event
|
||||
emitter.once(poll_request_event_identifier(req.params.id), listener);
|
||||
}
|
||||
|
||||
const postResponse = async (req, res, next) => {
|
||||
///// Emit event to client
|
||||
emitter.emit(poll_response_event_identifier(req.params.qid), req.body);
|
||||
|
||||
///// Response OK
|
||||
res.sendStatus(200);
|
||||
}
|
||||
|
||||
const getModuleRequest = async (req, res, next) => {
|
||||
///// Emit event to server
|
||||
url_encoded = req.query;
|
||||
poll_request(req.method, req.params.route, req.params.id, req.params.module, url_encoded, (error, body) => {
|
||||
if (error) { res.send(error); }
|
||||
else { res.send(body); }
|
||||
});
|
||||
|
||||
req.on("close", function () {
|
||||
console.log("Request cancelled by client");
|
||||
});
|
||||
}
|
||||
|
||||
const postModuleRequest = async (req, res, next) => {
|
||||
///// Emit event to server
|
||||
poll_request(req.method, req.params.route, req.params.id, req.params.module, req.body, (error, body) => {
|
||||
if (error) { res.send(error); }
|
||||
else { res.send(body); }
|
||||
});
|
||||
|
||||
req.on("close", function () {
|
||||
console.log("Request cancelled by client");
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
postPeriodic,
|
||||
postResponse,
|
||||
getModuleRequest,
|
||||
postModuleRequest
|
||||
}
|
||||
@@ -1,27 +1,27 @@
|
||||
const services = require('../services')
|
||||
|
||||
const { status } = services
|
||||
|
||||
const postSetStatus = async (req, res, next) => {
|
||||
try {
|
||||
var code = 500;
|
||||
|
||||
if (req.body.status) {
|
||||
const values = { inputsAlerts: req.body.status.inputsAlerts || [], msn: req.body.msn, id: req.params.id }
|
||||
code = await status.createAlerts(values)
|
||||
|
||||
} else if (req.body.radioProducts) {
|
||||
for (const product of req.body.radioProducts) {
|
||||
const values = { inputsAlerts: product.inputsAlerts || [], msn: product.msn, id: req.params.id }
|
||||
code = await status.createAlerts(values)
|
||||
}
|
||||
}
|
||||
res.send(code)
|
||||
} catch (e) {
|
||||
res.sendStatus(500)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
postSetStatus,
|
||||
const services = require('../services')
|
||||
|
||||
const { status } = services
|
||||
|
||||
const postSetStatus = async (req, res, next) => {
|
||||
try {
|
||||
var code = 500;
|
||||
|
||||
if (req.body.status) {
|
||||
const values = { inputsAlerts: req.body.status.inputsAlerts || [], msn: req.body.msn, id: req.params.id }
|
||||
code = await status.createAlerts(values)
|
||||
|
||||
} else if (req.body.radioProducts) {
|
||||
for (const product of req.body.radioProducts) {
|
||||
const values = { inputsAlerts: product.inputsAlerts || [], msn: product.msn, id: req.params.id }
|
||||
code = await status.createAlerts(values)
|
||||
}
|
||||
}
|
||||
res.send(code)
|
||||
} catch (e) {
|
||||
res.sendStatus(500)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
postSetStatus,
|
||||
}
|
||||
@@ -1,173 +1,173 @@
|
||||
const MongoClient = require('mongodb').MongoClient;
|
||||
const models = require('../models')
|
||||
|
||||
const mongodb_hostname = process.env.MONGODB_HOST || 'localhost';
|
||||
const mongodb_port = process.env.MONGODB_PORT || 27017;
|
||||
const mongodb_database = process.env.MONGODB_DATABASE || 'lsp';
|
||||
const mongodb_url = 'mongodb://' + mongodb_hostname + ':' + mongodb_port;
|
||||
|
||||
const client = new MongoClient(mongodb_url, { useNewUrlParser: true, useUnifiedTopology: true });
|
||||
|
||||
const bucketMaxSize = 4096;
|
||||
|
||||
var _db;
|
||||
var _devices = MongoClient();
|
||||
var _data;
|
||||
var _ipx_data;
|
||||
var _events;
|
||||
var _alerts;
|
||||
|
||||
var days = function(date) {
|
||||
return new Date((date - date%86400) * 1000);
|
||||
}
|
||||
|
||||
var init = async function () {
|
||||
client.connect(function (err) {
|
||||
if (err) {
|
||||
return { error: "Error connecting to DB: " + err }
|
||||
|
||||
} else {
|
||||
_db = client.db(mongodb_database);
|
||||
_devices = _db.collection('devices');
|
||||
_data = _db.collection('data');
|
||||
_ipx_data = _db.collection('ipx-data');
|
||||
_events = _db.collection('events');
|
||||
_alerts = _db.collection('alerts');
|
||||
|
||||
////////////////////////////
|
||||
// FLUSH DB BY UNCOMMENTING
|
||||
// _devices.remove(function(err, objects){});
|
||||
// _data.remove(function(err, objects){});
|
||||
// _ipx_data.remove(function(err, objects){});
|
||||
// _events.remove(function(err, objects){});
|
||||
// _alerts.remove(function(err, objects){});
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var addData = async function (relay, device, element) {
|
||||
try {
|
||||
const model = await models.data.validateAsync(element);
|
||||
|
||||
await _data.updateOne(
|
||||
{
|
||||
device: device,
|
||||
date: days(element.date),
|
||||
bucketSize: { $lt: bucketMaxSize },
|
||||
},
|
||||
{
|
||||
$addToSet: {
|
||||
data: model
|
||||
},
|
||||
$min: { min: model.value },
|
||||
$max: { max: model.value },
|
||||
$inc: { bucketSize: 1 },
|
||||
},
|
||||
{
|
||||
upsert: true
|
||||
})
|
||||
.then(err => {
|
||||
return err;
|
||||
})
|
||||
} catch (err) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
var addEvent = async function (relay, device, element) {
|
||||
try {
|
||||
const model = await models.event.validateAsync(element);
|
||||
|
||||
await _events.updateOne(
|
||||
{
|
||||
device: device,
|
||||
date: days(element.date),
|
||||
bucketSize: { $lt: bucketMaxSize },
|
||||
},
|
||||
{
|
||||
$addToSet: {
|
||||
events: model
|
||||
},
|
||||
$min: { first: model.date },
|
||||
$max: { last: model.date },
|
||||
$inc: { bucketSize: 1 },
|
||||
},
|
||||
{
|
||||
upsert: true
|
||||
})
|
||||
.then(err => {
|
||||
return err;
|
||||
})
|
||||
} catch (err) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
var addAlert = async function (relay, device, element) {
|
||||
try {
|
||||
const model = await models.alert.validateAsync(element);
|
||||
|
||||
await _alerts.updateOne(
|
||||
{
|
||||
device: device,
|
||||
relay: relay,
|
||||
bucketSize: { $lt: bucketMaxSize },
|
||||
},
|
||||
{
|
||||
$addToSet: {
|
||||
alerts: model
|
||||
},
|
||||
$min: { first: model.date },
|
||||
$max: { last: model.date },
|
||||
$inc: { bucketSize: 1 },
|
||||
},
|
||||
{
|
||||
upsert: true
|
||||
})
|
||||
.then(err => {
|
||||
return err;
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
var addIPXData = async function (relay, device, child, element) {
|
||||
try {
|
||||
const model = await models.ipxdata.validateAsync(element);
|
||||
|
||||
await _ipx_data.updateOne(
|
||||
{
|
||||
device: device,
|
||||
child: child,
|
||||
date: days(element.date),
|
||||
bucketSize: { $lt: bucketMaxSize },
|
||||
},
|
||||
{
|
||||
$addToSet: {
|
||||
data: model
|
||||
},
|
||||
$min: { first: model.date },
|
||||
$max: { last: model.date },
|
||||
$inc: { bucketSize: 1 },
|
||||
},
|
||||
{
|
||||
upsert: true
|
||||
})
|
||||
.then(err => {
|
||||
return err;
|
||||
})
|
||||
} catch (err) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
exports.init = init
|
||||
|
||||
exports.addData = addData
|
||||
exports.addEvent = addEvent
|
||||
exports.addAlert = addAlert
|
||||
const MongoClient = require('mongodb').MongoClient;
|
||||
const models = require('../models')
|
||||
|
||||
const mongodb_hostname = process.env.MONGODB_HOST || 'localhost';
|
||||
const mongodb_port = process.env.MONGODB_PORT || 27017;
|
||||
const mongodb_database = process.env.MONGODB_DATABASE || 'lsp';
|
||||
const mongodb_url = 'mongodb://' + mongodb_hostname + ':' + mongodb_port;
|
||||
|
||||
const client = new MongoClient(mongodb_url, { useNewUrlParser: true, useUnifiedTopology: true });
|
||||
|
||||
const bucketMaxSize = 4096;
|
||||
|
||||
var _db;
|
||||
var _devices = MongoClient();
|
||||
var _data;
|
||||
var _ipx_data;
|
||||
var _events;
|
||||
var _alerts;
|
||||
|
||||
var days = function(date) {
|
||||
return new Date((date - date%86400) * 1000);
|
||||
}
|
||||
|
||||
var init = async function () {
|
||||
client.connect(function (err) {
|
||||
if (err) {
|
||||
return { error: "Error connecting to DB: " + err }
|
||||
|
||||
} else {
|
||||
_db = client.db(mongodb_database);
|
||||
_devices = _db.collection('devices');
|
||||
_data = _db.collection('data');
|
||||
_ipx_data = _db.collection('ipx-data');
|
||||
_events = _db.collection('events');
|
||||
_alerts = _db.collection('alerts');
|
||||
|
||||
////////////////////////////
|
||||
// FLUSH DB BY UNCOMMENTING
|
||||
// _devices.remove(function(err, objects){});
|
||||
// _data.remove(function(err, objects){});
|
||||
// _ipx_data.remove(function(err, objects){});
|
||||
// _events.remove(function(err, objects){});
|
||||
// _alerts.remove(function(err, objects){});
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var addData = async function (relay, device, element) {
|
||||
try {
|
||||
const model = await models.data.validateAsync(element);
|
||||
|
||||
await _data.updateOne(
|
||||
{
|
||||
device: device,
|
||||
date: days(element.date),
|
||||
bucketSize: { $lt: bucketMaxSize },
|
||||
},
|
||||
{
|
||||
$addToSet: {
|
||||
data: model
|
||||
},
|
||||
$min: { min: model.value },
|
||||
$max: { max: model.value },
|
||||
$inc: { bucketSize: 1 },
|
||||
},
|
||||
{
|
||||
upsert: true
|
||||
})
|
||||
.then(err => {
|
||||
return err;
|
||||
})
|
||||
} catch (err) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
var addEvent = async function (relay, device, element) {
|
||||
try {
|
||||
const model = await models.event.validateAsync(element);
|
||||
|
||||
await _events.updateOne(
|
||||
{
|
||||
device: device,
|
||||
date: days(element.date),
|
||||
bucketSize: { $lt: bucketMaxSize },
|
||||
},
|
||||
{
|
||||
$addToSet: {
|
||||
events: model
|
||||
},
|
||||
$min: { first: model.date },
|
||||
$max: { last: model.date },
|
||||
$inc: { bucketSize: 1 },
|
||||
},
|
||||
{
|
||||
upsert: true
|
||||
})
|
||||
.then(err => {
|
||||
return err;
|
||||
})
|
||||
} catch (err) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
var addAlert = async function (relay, device, element) {
|
||||
try {
|
||||
const model = await models.alert.validateAsync(element);
|
||||
|
||||
await _alerts.updateOne(
|
||||
{
|
||||
device: device,
|
||||
relay: relay,
|
||||
bucketSize: { $lt: bucketMaxSize },
|
||||
},
|
||||
{
|
||||
$addToSet: {
|
||||
alerts: model
|
||||
},
|
||||
$min: { first: model.date },
|
||||
$max: { last: model.date },
|
||||
$inc: { bucketSize: 1 },
|
||||
},
|
||||
{
|
||||
upsert: true
|
||||
})
|
||||
.then(err => {
|
||||
return err;
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
var addIPXData = async function (relay, device, child, element) {
|
||||
try {
|
||||
const model = await models.ipxdata.validateAsync(element);
|
||||
|
||||
await _ipx_data.updateOne(
|
||||
{
|
||||
device: device,
|
||||
child: child,
|
||||
date: days(element.date),
|
||||
bucketSize: { $lt: bucketMaxSize },
|
||||
},
|
||||
{
|
||||
$addToSet: {
|
||||
data: model
|
||||
},
|
||||
$min: { first: model.date },
|
||||
$max: { last: model.date },
|
||||
$inc: { bucketSize: 1 },
|
||||
},
|
||||
{
|
||||
upsert: true
|
||||
})
|
||||
.then(err => {
|
||||
return err;
|
||||
})
|
||||
} catch (err) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
exports.init = init
|
||||
|
||||
exports.addData = addData
|
||||
exports.addEvent = addEvent
|
||||
exports.addAlert = addAlert
|
||||
exports.addIPXData = addIPXData
|
||||
@@ -1,3 +1,3 @@
|
||||
const db = require('./dbcontroller.js');
|
||||
|
||||
const db = require('./dbcontroller.js');
|
||||
|
||||
module.exports = db;
|
||||
@@ -1,167 +1,167 @@
|
||||
const Collection = require('mongodb').MongoClient;
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
const mongodb_hostname = process.env.MONGODB_HOST || 'localhost';
|
||||
const mongodb_port = process.env.MONGODB_PORT || 27017;
|
||||
const mongodb_database = process.env.MONGODB_DATABASE || 'lsp';
|
||||
const mongodb_url = 'mongodb://' + mongodb_hostname + ':' + mongodb_port;
|
||||
|
||||
const db = mongoose.connection;
|
||||
|
||||
|
||||
const bucketMaxSize = 1000;
|
||||
|
||||
var _db;
|
||||
var _data = Collection();
|
||||
var _ipx_data;
|
||||
var _events;
|
||||
var _alerts;
|
||||
|
||||
var days = function(date) {
|
||||
const complete = new Date(1000 * date);
|
||||
const days = new Date(complete.toDateString())
|
||||
return days;
|
||||
}
|
||||
|
||||
var init = function (callback) {
|
||||
mongoose.connect(mongodb_url, { useNewUrlParser: true, useUnifiedTopology: true });
|
||||
db.on('error', console.error.bind(console, 'connection error:'));
|
||||
db.once('open', function () {
|
||||
// we're connected!
|
||||
if (callback) callback(null);
|
||||
});
|
||||
// client.connect(function (err) {
|
||||
// if (err) {
|
||||
// if (callback) callback({ error: "Error connecting to DB: " + err })
|
||||
// }
|
||||
// else {
|
||||
// _db = client.db(mongodb_database);
|
||||
// _data = _db.collection('data');
|
||||
// _ipx_data = _db.collection('ipx-data');
|
||||
// _events = _db.collection('events');
|
||||
// _alerts = _db.collection('alerts');
|
||||
|
||||
// ////////////////////////////
|
||||
// // FLUSH DB BY UNCOMMENTING
|
||||
// // _data.remove(function(err, objects){});
|
||||
// // _ipx_data.remove(function(err, objects){});
|
||||
// // _events.remove(function(err, objects){});
|
||||
// // _alerts.remove(function(err, objects){});
|
||||
|
||||
// if (callback) callback(null);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
var addData = function (relay, device, element, callback) {
|
||||
// const query = {
|
||||
// device: device,
|
||||
// date: days(element.date),
|
||||
// bucketSize: { $lt: bucketMaxSize },
|
||||
// };
|
||||
|
||||
// const data = {
|
||||
// index: element.index,
|
||||
// value: element.value,
|
||||
// date: new Date(1000 * element.date)
|
||||
// };
|
||||
|
||||
// const update = {
|
||||
// $push: {
|
||||
// data: data
|
||||
// },
|
||||
// $min: { min: data.value },
|
||||
// $max: { max: data.value },
|
||||
// $inc: { bucketSize: 1 },
|
||||
// };
|
||||
|
||||
// const options = {
|
||||
// upsert: true
|
||||
// };
|
||||
|
||||
// _data.updateOne(query, update, options, function (err, result) {
|
||||
// if (callback) { callback(err, result); }
|
||||
// });
|
||||
}
|
||||
|
||||
var addEvent = function (relay, device, element, callback) {
|
||||
// const query = {
|
||||
// device: device,
|
||||
// day: days(element.date),
|
||||
// bucketSize: { $lt: bucketMaxSize },
|
||||
// };
|
||||
|
||||
// const event = {
|
||||
// index: element.index,
|
||||
// value: element.value,
|
||||
// type: element.type,
|
||||
// date: new Date(1000 * element.date)
|
||||
// };
|
||||
|
||||
// const update = {
|
||||
// $push: {
|
||||
// events: event
|
||||
// },
|
||||
// $min: { first: event.date },
|
||||
// $max: { last: event.date },
|
||||
// $inc: { bucketSize: 1 },
|
||||
// };
|
||||
|
||||
// const options = {
|
||||
// upsert: true
|
||||
// };
|
||||
|
||||
// _events.updateOne(query, update, options, function (err, result) {
|
||||
// if (callback) { callback(err, result); }
|
||||
// });
|
||||
}
|
||||
|
||||
var addAlert = function (relay, device, element, callback) {
|
||||
// const object = {
|
||||
// relay: relay,
|
||||
// device: device,
|
||||
// date: new Date(1000 * element.date),
|
||||
// alert: element.alerts
|
||||
// };
|
||||
|
||||
// _alerts.insertOne(object, function (err, result) {
|
||||
// if (callback) { callback(err, result); }
|
||||
// });
|
||||
}
|
||||
|
||||
var addIPXData = function (relay, device, child, element, callback) {
|
||||
// const query = {
|
||||
// child: child,
|
||||
// date: days(element.timestamp),
|
||||
// bucketSize: { $lt: bucketMaxSize },
|
||||
// };
|
||||
|
||||
// const data = {
|
||||
// date: new Date(1000 * element.timestamp),
|
||||
// tags: element.tags
|
||||
// };
|
||||
|
||||
// const update = {
|
||||
// $push: {
|
||||
// data: data
|
||||
// },
|
||||
// $min: { first: data.date },
|
||||
// $max: { last: data.date },
|
||||
// $inc: { bucketSize: 1 },
|
||||
// };
|
||||
|
||||
// const options = {
|
||||
// upsert: true
|
||||
// };
|
||||
|
||||
// _ipx_data.updateOne(query, update, options, function (err, result) {
|
||||
// if (callback) { callback(err, result); }
|
||||
// });
|
||||
}
|
||||
|
||||
exports.init = init
|
||||
|
||||
exports.addData = addData
|
||||
exports.addEvent = addEvent
|
||||
exports.addAlert = addAlert
|
||||
const Collection = require('mongodb').MongoClient;
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
const mongodb_hostname = process.env.MONGODB_HOST || 'localhost';
|
||||
const mongodb_port = process.env.MONGODB_PORT || 27017;
|
||||
const mongodb_database = process.env.MONGODB_DATABASE || 'lsp';
|
||||
const mongodb_url = 'mongodb://' + mongodb_hostname + ':' + mongodb_port;
|
||||
|
||||
const db = mongoose.connection;
|
||||
|
||||
|
||||
const bucketMaxSize = 1000;
|
||||
|
||||
var _db;
|
||||
var _data = Collection();
|
||||
var _ipx_data;
|
||||
var _events;
|
||||
var _alerts;
|
||||
|
||||
var days = function(date) {
|
||||
const complete = new Date(1000 * date);
|
||||
const days = new Date(complete.toDateString())
|
||||
return days;
|
||||
}
|
||||
|
||||
var init = function (callback) {
|
||||
mongoose.connect(mongodb_url, { useNewUrlParser: true, useUnifiedTopology: true });
|
||||
db.on('error', console.error.bind(console, 'connection error:'));
|
||||
db.once('open', function () {
|
||||
// we're connected!
|
||||
if (callback) callback(null);
|
||||
});
|
||||
// client.connect(function (err) {
|
||||
// if (err) {
|
||||
// if (callback) callback({ error: "Error connecting to DB: " + err })
|
||||
// }
|
||||
// else {
|
||||
// _db = client.db(mongodb_database);
|
||||
// _data = _db.collection('data');
|
||||
// _ipx_data = _db.collection('ipx-data');
|
||||
// _events = _db.collection('events');
|
||||
// _alerts = _db.collection('alerts');
|
||||
|
||||
// ////////////////////////////
|
||||
// // FLUSH DB BY UNCOMMENTING
|
||||
// // _data.remove(function(err, objects){});
|
||||
// // _ipx_data.remove(function(err, objects){});
|
||||
// // _events.remove(function(err, objects){});
|
||||
// // _alerts.remove(function(err, objects){});
|
||||
|
||||
// if (callback) callback(null);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
var addData = function (relay, device, element, callback) {
|
||||
// const query = {
|
||||
// device: device,
|
||||
// date: days(element.date),
|
||||
// bucketSize: { $lt: bucketMaxSize },
|
||||
// };
|
||||
|
||||
// const data = {
|
||||
// index: element.index,
|
||||
// value: element.value,
|
||||
// date: new Date(1000 * element.date)
|
||||
// };
|
||||
|
||||
// const update = {
|
||||
// $push: {
|
||||
// data: data
|
||||
// },
|
||||
// $min: { min: data.value },
|
||||
// $max: { max: data.value },
|
||||
// $inc: { bucketSize: 1 },
|
||||
// };
|
||||
|
||||
// const options = {
|
||||
// upsert: true
|
||||
// };
|
||||
|
||||
// _data.updateOne(query, update, options, function (err, result) {
|
||||
// if (callback) { callback(err, result); }
|
||||
// });
|
||||
}
|
||||
|
||||
var addEvent = function (relay, device, element, callback) {
|
||||
// const query = {
|
||||
// device: device,
|
||||
// day: days(element.date),
|
||||
// bucketSize: { $lt: bucketMaxSize },
|
||||
// };
|
||||
|
||||
// const event = {
|
||||
// index: element.index,
|
||||
// value: element.value,
|
||||
// type: element.type,
|
||||
// date: new Date(1000 * element.date)
|
||||
// };
|
||||
|
||||
// const update = {
|
||||
// $push: {
|
||||
// events: event
|
||||
// },
|
||||
// $min: { first: event.date },
|
||||
// $max: { last: event.date },
|
||||
// $inc: { bucketSize: 1 },
|
||||
// };
|
||||
|
||||
// const options = {
|
||||
// upsert: true
|
||||
// };
|
||||
|
||||
// _events.updateOne(query, update, options, function (err, result) {
|
||||
// if (callback) { callback(err, result); }
|
||||
// });
|
||||
}
|
||||
|
||||
var addAlert = function (relay, device, element, callback) {
|
||||
// const object = {
|
||||
// relay: relay,
|
||||
// device: device,
|
||||
// date: new Date(1000 * element.date),
|
||||
// alert: element.alerts
|
||||
// };
|
||||
|
||||
// _alerts.insertOne(object, function (err, result) {
|
||||
// if (callback) { callback(err, result); }
|
||||
// });
|
||||
}
|
||||
|
||||
var addIPXData = function (relay, device, child, element, callback) {
|
||||
// const query = {
|
||||
// child: child,
|
||||
// date: days(element.timestamp),
|
||||
// bucketSize: { $lt: bucketMaxSize },
|
||||
// };
|
||||
|
||||
// const data = {
|
||||
// date: new Date(1000 * element.timestamp),
|
||||
// tags: element.tags
|
||||
// };
|
||||
|
||||
// const update = {
|
||||
// $push: {
|
||||
// data: data
|
||||
// },
|
||||
// $min: { first: data.date },
|
||||
// $max: { last: data.date },
|
||||
// $inc: { bucketSize: 1 },
|
||||
// };
|
||||
|
||||
// const options = {
|
||||
// upsert: true
|
||||
// };
|
||||
|
||||
// _ipx_data.updateOne(query, update, options, function (err, result) {
|
||||
// if (callback) { callback(err, result); }
|
||||
// });
|
||||
}
|
||||
|
||||
exports.init = init
|
||||
|
||||
exports.addData = addData
|
||||
exports.addEvent = addEvent
|
||||
exports.addAlert = addAlert
|
||||
exports.addIPXData = addIPXData
|
||||
@@ -1,9 +1,9 @@
|
||||
const joi = require("joi")
|
||||
|
||||
const AlertSchema = joi.object({
|
||||
type: joi.number().required(),
|
||||
inputs: joi.object().keys().pattern(/^[0-9]?/, joi.array().items(joi.number().optional())).optional(),
|
||||
date: joi.date().timestamp("unix").optional().default(new Date())
|
||||
})
|
||||
|
||||
const joi = require("joi")
|
||||
|
||||
const AlertSchema = joi.object({
|
||||
type: joi.number().required(),
|
||||
inputs: joi.object().keys().pattern(/^[0-9]?/, joi.array().items(joi.number().optional())).optional(),
|
||||
date: joi.date().timestamp("unix").optional().default(new Date())
|
||||
})
|
||||
|
||||
module.exports = AlertSchema
|
||||
@@ -1,10 +1,10 @@
|
||||
const joi = require("joi")
|
||||
|
||||
const DataSchema = joi.object({
|
||||
input: joi.number().required(),
|
||||
index: joi.number().required(),
|
||||
value: joi.number().required(),
|
||||
date: joi.date().timestamp("unix").required()
|
||||
})
|
||||
|
||||
const joi = require("joi")
|
||||
|
||||
const DataSchema = joi.object({
|
||||
input: joi.number().required(),
|
||||
index: joi.number().required(),
|
||||
value: joi.number().required(),
|
||||
date: joi.date().timestamp("unix").required()
|
||||
})
|
||||
|
||||
module.exports = DataSchema
|
||||
@@ -1,10 +1,10 @@
|
||||
const joi = require("joi")
|
||||
|
||||
const EventSchema = joi.object({
|
||||
index: joi.number().required(),
|
||||
type: joi.number().required(),
|
||||
value: joi.string().required(),
|
||||
date: joi.date().timestamp("unix").required()
|
||||
});
|
||||
|
||||
const joi = require("joi")
|
||||
|
||||
const EventSchema = joi.object({
|
||||
index: joi.number().required(),
|
||||
type: joi.number().required(),
|
||||
value: joi.string().required(),
|
||||
date: joi.date().timestamp("unix").required()
|
||||
});
|
||||
|
||||
module.exports = EventSchema
|
||||
@@ -1,11 +1,11 @@
|
||||
const data = require('./data.model.js');
|
||||
const event = require('./event.model.js');
|
||||
const alert = require('./alert.model.js');
|
||||
const ipxdata = require('./ipxdata.model.js');
|
||||
|
||||
module.exports = {
|
||||
data,
|
||||
event,
|
||||
alert,
|
||||
ipxdata
|
||||
const data = require('./data.model.js');
|
||||
const event = require('./event.model.js');
|
||||
const alert = require('./alert.model.js');
|
||||
const ipxdata = require('./ipxdata.model.js');
|
||||
|
||||
module.exports = {
|
||||
data,
|
||||
event,
|
||||
alert,
|
||||
ipxdata
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
const joi = require("joi")
|
||||
|
||||
const IPXDataSchema = joi.object({
|
||||
date: joi.date().timestamp("unix").required(),
|
||||
tags: joi.array().items( joi.object({
|
||||
tag: joi.number().required(),
|
||||
type: joi.number().required(),
|
||||
data: joi.alternatives().try(joi.string(), joi.number())
|
||||
}).optional()
|
||||
).required()
|
||||
})
|
||||
|
||||
const joi = require("joi")
|
||||
|
||||
const IPXDataSchema = joi.object({
|
||||
date: joi.date().timestamp("unix").required(),
|
||||
tags: joi.array().items( joi.object({
|
||||
tag: joi.number().required(),
|
||||
type: joi.number().required(),
|
||||
data: joi.alternatives().try(joi.string(), joi.number())
|
||||
}).optional()
|
||||
).required()
|
||||
})
|
||||
|
||||
module.exports = IPXDataSchema
|
||||
15
node_modules/.bin/mime
generated
vendored
15
node_modules/.bin/mime
generated
vendored
@@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../mime/cli.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../mime/cli.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
7
node_modules/.bin/mime.cmd
generated
vendored
7
node_modules/.bin/mime.cmd
generated
vendored
@@ -1,7 +0,0 @@
|
||||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\mime\cli.js" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\mime\cli.js" %*
|
||||
)
|
||||
15
node_modules/.bin/semver
generated
vendored
15
node_modules/.bin/semver
generated
vendored
@@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../semver/bin/semver" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../semver/bin/semver" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
17
node_modules/.bin/semver.cmd
generated
vendored
17
node_modules/.bin/semver.cmd
generated
vendored
@@ -1,17 +0,0 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\semver\bin\semver" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
18
node_modules/.bin/semver.ps1
generated
vendored
18
node_modules/.bin/semver.ps1
generated
vendored
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../semver/bin/semver" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../semver/bin/semver" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
12
node_modules/@hapi/hoek/LICENSE.md
generated
vendored
12
node_modules/@hapi/hoek/LICENSE.md
generated
vendored
@@ -1,12 +0,0 @@
|
||||
Copyright (c) 2011-2020, Sideway Inc, and project contributors
|
||||
Copyright (c) 2011-2014, Walmart
|
||||
Copyright (c) 2011, Yahoo Inc.
|
||||
|
||||
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.
|
||||
* The names of any contributors may not 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS 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 OFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
19
node_modules/@hapi/hoek/README.md
generated
vendored
19
node_modules/@hapi/hoek/README.md
generated
vendored
@@ -1,19 +0,0 @@
|
||||
<a href="https://hapi.dev"><img src="https://raw.githubusercontent.com/hapijs/assets/master/images/family.png" width="180px" align="right" /></a>
|
||||
|
||||
# @hapi/hoek
|
||||
|
||||
#### Utility methods for the hapi ecosystem.
|
||||
|
||||
**hoek** is part of the **hapi** ecosystem and was designed to work seamlessly with the [hapi web framework](https://hapi.dev) and its other components (but works great on its own or with other frameworks). If you are using a different web framework and find this module useful, check out [hapi](https://hapi.dev) – they work even better together.
|
||||
|
||||
This module is not intended to solve every problem for everyone, but rather as a central place to store hapi-specific methods. If you're looking for a general purpose utility module, check out [lodash](https://github.com/lodash/lodash).
|
||||
|
||||
### Visit the [hapi.dev](https://hapi.dev) Developer Portal for tutorials, documentation, and support
|
||||
|
||||
## Useful resources
|
||||
|
||||
- [Documentation and API](https://hapi.dev/family/hoek/)
|
||||
- [Version status](https://hapi.dev/resources/status/#hoek) (builds, dependencies, node versions, licenses, eol)
|
||||
- [Changelog](https://hapi.dev/family/hoek/changelog/)
|
||||
- [Project policies](https://hapi.dev/policies/)
|
||||
- [Free and commercial support options](https://hapi.dev/support/)
|
||||
102
node_modules/@hapi/hoek/lib/applyToDefaults.js
generated
vendored
102
node_modules/@hapi/hoek/lib/applyToDefaults.js
generated
vendored
@@ -1,102 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const Assert = require('./assert');
|
||||
const Clone = require('./clone');
|
||||
const Merge = require('./merge');
|
||||
const Reach = require('./reach');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (defaults, source, options = {}) {
|
||||
|
||||
Assert(defaults && typeof defaults === 'object', 'Invalid defaults value: must be an object');
|
||||
Assert(!source || source === true || typeof source === 'object', 'Invalid source value: must be true, falsy or an object');
|
||||
Assert(typeof options === 'object', 'Invalid options: must be an object');
|
||||
|
||||
if (!source) { // If no source, return null
|
||||
return null;
|
||||
}
|
||||
|
||||
if (options.shallow) {
|
||||
return internals.applyToDefaultsWithShallow(defaults, source, options);
|
||||
}
|
||||
|
||||
const copy = Clone(defaults);
|
||||
|
||||
if (source === true) { // If source is set to true, use defaults
|
||||
return copy;
|
||||
}
|
||||
|
||||
const nullOverride = options.nullOverride !== undefined ? options.nullOverride : false;
|
||||
return Merge(copy, source, { nullOverride, mergeArrays: false });
|
||||
};
|
||||
|
||||
|
||||
internals.applyToDefaultsWithShallow = function (defaults, source, options) {
|
||||
|
||||
const keys = options.shallow;
|
||||
Assert(Array.isArray(keys), 'Invalid keys');
|
||||
|
||||
const seen = new Map();
|
||||
const merge = source === true ? null : new Set();
|
||||
|
||||
for (let key of keys) {
|
||||
key = Array.isArray(key) ? key : key.split('.'); // Pre-split optimization
|
||||
|
||||
const ref = Reach(defaults, key);
|
||||
if (ref &&
|
||||
typeof ref === 'object') {
|
||||
|
||||
seen.set(ref, merge && Reach(source, key) || ref);
|
||||
}
|
||||
else if (merge) {
|
||||
merge.add(key);
|
||||
}
|
||||
}
|
||||
|
||||
const copy = Clone(defaults, {}, seen);
|
||||
|
||||
if (!merge) {
|
||||
return copy;
|
||||
}
|
||||
|
||||
for (const key of merge) {
|
||||
internals.reachCopy(copy, source, key);
|
||||
}
|
||||
|
||||
const nullOverride = options.nullOverride !== undefined ? options.nullOverride : false;
|
||||
return Merge(copy, source, { nullOverride, mergeArrays: false });
|
||||
};
|
||||
|
||||
|
||||
internals.reachCopy = function (dst, src, path) {
|
||||
|
||||
for (const segment of path) {
|
||||
if (!(segment in src)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const val = src[segment];
|
||||
|
||||
if (typeof val !== 'object' || val === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
src = val;
|
||||
}
|
||||
|
||||
const value = src;
|
||||
let ref = dst;
|
||||
for (let i = 0; i < path.length - 1; ++i) {
|
||||
const segment = path[i];
|
||||
if (typeof ref[segment] !== 'object') {
|
||||
ref[segment] = {};
|
||||
}
|
||||
|
||||
ref = ref[segment];
|
||||
}
|
||||
|
||||
ref[path[path.length - 1]] = value;
|
||||
};
|
||||
21
node_modules/@hapi/hoek/lib/assert.js
generated
vendored
21
node_modules/@hapi/hoek/lib/assert.js
generated
vendored
@@ -1,21 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const AssertError = require('./error');
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (condition, ...args) {
|
||||
|
||||
if (condition) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length === 1 &&
|
||||
args[0] instanceof Error) {
|
||||
|
||||
throw args[0];
|
||||
}
|
||||
|
||||
throw new AssertError(args);
|
||||
};
|
||||
29
node_modules/@hapi/hoek/lib/bench.js
generated
vendored
29
node_modules/@hapi/hoek/lib/bench.js
generated
vendored
@@ -1,29 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = internals.Bench = class {
|
||||
|
||||
constructor() {
|
||||
|
||||
this.ts = 0;
|
||||
this.reset();
|
||||
}
|
||||
|
||||
reset() {
|
||||
|
||||
this.ts = internals.Bench.now();
|
||||
}
|
||||
|
||||
elapsed() {
|
||||
|
||||
return internals.Bench.now() - this.ts;
|
||||
}
|
||||
|
||||
static now() {
|
||||
|
||||
const ts = process.hrtime();
|
||||
return (ts[0] * 1e3) + (ts[1] / 1e6);
|
||||
}
|
||||
};
|
||||
12
node_modules/@hapi/hoek/lib/block.js
generated
vendored
12
node_modules/@hapi/hoek/lib/block.js
generated
vendored
@@ -1,12 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const Ignore = require('./ignore');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function () {
|
||||
|
||||
return new Promise(Ignore);
|
||||
};
|
||||
176
node_modules/@hapi/hoek/lib/clone.js
generated
vendored
176
node_modules/@hapi/hoek/lib/clone.js
generated
vendored
@@ -1,176 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const Reach = require('./reach');
|
||||
const Types = require('./types');
|
||||
const Utils = require('./utils');
|
||||
|
||||
|
||||
const internals = {
|
||||
needsProtoHack: new Set([Types.set, Types.map, Types.weakSet, Types.weakMap])
|
||||
};
|
||||
|
||||
|
||||
module.exports = internals.clone = function (obj, options = {}, _seen = null) {
|
||||
|
||||
if (typeof obj !== 'object' ||
|
||||
obj === null) {
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
let clone = internals.clone;
|
||||
let seen = _seen;
|
||||
|
||||
if (options.shallow) {
|
||||
if (options.shallow !== true) {
|
||||
return internals.cloneWithShallow(obj, options);
|
||||
}
|
||||
|
||||
clone = (value) => value;
|
||||
}
|
||||
else if (seen) {
|
||||
const lookup = seen.get(obj);
|
||||
if (lookup) {
|
||||
return lookup;
|
||||
}
|
||||
}
|
||||
else {
|
||||
seen = new Map();
|
||||
}
|
||||
|
||||
// Built-in object types
|
||||
|
||||
const baseProto = Types.getInternalProto(obj);
|
||||
if (baseProto === Types.buffer) {
|
||||
return Buffer && Buffer.from(obj); // $lab:coverage:ignore$
|
||||
}
|
||||
|
||||
if (baseProto === Types.date) {
|
||||
return new Date(obj.getTime());
|
||||
}
|
||||
|
||||
if (baseProto === Types.regex) {
|
||||
return new RegExp(obj);
|
||||
}
|
||||
|
||||
// Generic objects
|
||||
|
||||
const newObj = internals.base(obj, baseProto, options);
|
||||
if (newObj === obj) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
if (seen) {
|
||||
seen.set(obj, newObj); // Set seen, since obj could recurse
|
||||
}
|
||||
|
||||
if (baseProto === Types.set) {
|
||||
for (const value of obj) {
|
||||
newObj.add(clone(value, options, seen));
|
||||
}
|
||||
}
|
||||
else if (baseProto === Types.map) {
|
||||
for (const [key, value] of obj) {
|
||||
newObj.set(key, clone(value, options, seen));
|
||||
}
|
||||
}
|
||||
|
||||
const keys = Utils.keys(obj, options);
|
||||
for (const key of keys) {
|
||||
if (key === '__proto__') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (baseProto === Types.array &&
|
||||
key === 'length') {
|
||||
|
||||
newObj.length = obj.length;
|
||||
continue;
|
||||
}
|
||||
|
||||
const descriptor = Object.getOwnPropertyDescriptor(obj, key);
|
||||
if (descriptor) {
|
||||
if (descriptor.get ||
|
||||
descriptor.set) {
|
||||
|
||||
Object.defineProperty(newObj, key, descriptor);
|
||||
}
|
||||
else if (descriptor.enumerable) {
|
||||
newObj[key] = clone(obj[key], options, seen);
|
||||
}
|
||||
else {
|
||||
Object.defineProperty(newObj, key, { enumerable: false, writable: true, configurable: true, value: clone(obj[key], options, seen) });
|
||||
}
|
||||
}
|
||||
else {
|
||||
Object.defineProperty(newObj, key, {
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
value: clone(obj[key], options, seen)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return newObj;
|
||||
};
|
||||
|
||||
|
||||
internals.cloneWithShallow = function (source, options) {
|
||||
|
||||
const keys = options.shallow;
|
||||
options = Object.assign({}, options);
|
||||
options.shallow = false;
|
||||
|
||||
const seen = new Map();
|
||||
|
||||
for (const key of keys) {
|
||||
const ref = Reach(source, key);
|
||||
if (typeof ref === 'object' ||
|
||||
typeof ref === 'function') {
|
||||
|
||||
seen.set(ref, ref);
|
||||
}
|
||||
}
|
||||
|
||||
return internals.clone(source, options, seen);
|
||||
};
|
||||
|
||||
|
||||
internals.base = function (obj, baseProto, options) {
|
||||
|
||||
if (options.prototype === false) { // Defaults to true
|
||||
if (internals.needsProtoHack.has(baseProto)) {
|
||||
return new baseProto.constructor();
|
||||
}
|
||||
|
||||
return baseProto === Types.array ? [] : {};
|
||||
}
|
||||
|
||||
const proto = Object.getPrototypeOf(obj);
|
||||
if (proto &&
|
||||
proto.isImmutable) {
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
if (baseProto === Types.array) {
|
||||
const newObj = [];
|
||||
if (proto !== baseProto) {
|
||||
Object.setPrototypeOf(newObj, proto);
|
||||
}
|
||||
|
||||
return newObj;
|
||||
}
|
||||
|
||||
if (internals.needsProtoHack.has(baseProto)) {
|
||||
const newObj = new proto.constructor();
|
||||
if (proto !== baseProto) {
|
||||
Object.setPrototypeOf(newObj, proto);
|
||||
}
|
||||
|
||||
return newObj;
|
||||
}
|
||||
|
||||
return Object.create(proto);
|
||||
};
|
||||
307
node_modules/@hapi/hoek/lib/contain.js
generated
vendored
307
node_modules/@hapi/hoek/lib/contain.js
generated
vendored
@@ -1,307 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const Assert = require('./assert');
|
||||
const DeepEqual = require('./deepEqual');
|
||||
const EscapeRegex = require('./escapeRegex');
|
||||
const Utils = require('./utils');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (ref, values, options = {}) { // options: { deep, once, only, part, symbols }
|
||||
|
||||
/*
|
||||
string -> string(s)
|
||||
array -> item(s)
|
||||
object -> key(s)
|
||||
object -> object (key:value)
|
||||
*/
|
||||
|
||||
if (typeof values !== 'object') {
|
||||
values = [values];
|
||||
}
|
||||
|
||||
Assert(!Array.isArray(values) || values.length, 'Values array cannot be empty');
|
||||
|
||||
// String
|
||||
|
||||
if (typeof ref === 'string') {
|
||||
return internals.string(ref, values, options);
|
||||
}
|
||||
|
||||
// Array
|
||||
|
||||
if (Array.isArray(ref)) {
|
||||
return internals.array(ref, values, options);
|
||||
}
|
||||
|
||||
// Object
|
||||
|
||||
Assert(typeof ref === 'object', 'Reference must be string or an object');
|
||||
return internals.object(ref, values, options);
|
||||
};
|
||||
|
||||
|
||||
internals.array = function (ref, values, options) {
|
||||
|
||||
if (!Array.isArray(values)) {
|
||||
values = [values];
|
||||
}
|
||||
|
||||
if (!ref.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (options.only &&
|
||||
options.once &&
|
||||
ref.length !== values.length) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
let compare;
|
||||
|
||||
// Map values
|
||||
|
||||
const map = new Map();
|
||||
for (const value of values) {
|
||||
if (!options.deep ||
|
||||
!value ||
|
||||
typeof value !== 'object') {
|
||||
|
||||
const existing = map.get(value);
|
||||
if (existing) {
|
||||
++existing.allowed;
|
||||
}
|
||||
else {
|
||||
map.set(value, { allowed: 1, hits: 0 });
|
||||
}
|
||||
}
|
||||
else {
|
||||
compare = compare || internals.compare(options);
|
||||
|
||||
let found = false;
|
||||
for (const [key, existing] of map.entries()) {
|
||||
if (compare(key, value)) {
|
||||
++existing.allowed;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
map.set(value, { allowed: 1, hits: 0 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Lookup values
|
||||
|
||||
let hits = 0;
|
||||
for (const item of ref) {
|
||||
let match;
|
||||
if (!options.deep ||
|
||||
!item ||
|
||||
typeof item !== 'object') {
|
||||
|
||||
match = map.get(item);
|
||||
}
|
||||
else {
|
||||
compare = compare || internals.compare(options);
|
||||
|
||||
for (const [key, existing] of map.entries()) {
|
||||
if (compare(key, item)) {
|
||||
match = existing;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (match) {
|
||||
++match.hits;
|
||||
++hits;
|
||||
|
||||
if (options.once &&
|
||||
match.hits > match.allowed) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Validate results
|
||||
|
||||
if (options.only &&
|
||||
hits !== ref.length) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const match of map.values()) {
|
||||
if (match.hits === match.allowed) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (match.hits < match.allowed &&
|
||||
!options.part) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return !!hits;
|
||||
};
|
||||
|
||||
|
||||
internals.object = function (ref, values, options) {
|
||||
|
||||
Assert(options.once === undefined, 'Cannot use option once with object');
|
||||
|
||||
const keys = Utils.keys(ref, options);
|
||||
if (!keys.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Keys list
|
||||
|
||||
if (Array.isArray(values)) {
|
||||
return internals.array(keys, values, options);
|
||||
}
|
||||
|
||||
// Key value pairs
|
||||
|
||||
const symbols = Object.getOwnPropertySymbols(values).filter((sym) => values.propertyIsEnumerable(sym));
|
||||
const targets = [...Object.keys(values), ...symbols];
|
||||
|
||||
const compare = internals.compare(options);
|
||||
const set = new Set(targets);
|
||||
|
||||
for (const key of keys) {
|
||||
if (!set.has(key)) {
|
||||
if (options.only) {
|
||||
return false;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!compare(values[key], ref[key])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
set.delete(key);
|
||||
}
|
||||
|
||||
if (set.size) {
|
||||
return options.part ? set.size < targets.length : false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
internals.string = function (ref, values, options) {
|
||||
|
||||
// Empty string
|
||||
|
||||
if (ref === '') {
|
||||
return values.length === 1 && values[0] === '' || // '' contains ''
|
||||
!options.once && !values.some((v) => v !== ''); // '' contains multiple '' if !once
|
||||
}
|
||||
|
||||
// Map values
|
||||
|
||||
const map = new Map();
|
||||
const patterns = [];
|
||||
|
||||
for (const value of values) {
|
||||
Assert(typeof value === 'string', 'Cannot compare string reference to non-string value');
|
||||
|
||||
if (value) {
|
||||
const existing = map.get(value);
|
||||
if (existing) {
|
||||
++existing.allowed;
|
||||
}
|
||||
else {
|
||||
map.set(value, { allowed: 1, hits: 0 });
|
||||
patterns.push(EscapeRegex(value));
|
||||
}
|
||||
}
|
||||
else if (options.once ||
|
||||
options.only) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!patterns.length) { // Non-empty string contains unlimited empty string
|
||||
return true;
|
||||
}
|
||||
|
||||
// Match patterns
|
||||
|
||||
const regex = new RegExp(`(${patterns.join('|')})`, 'g');
|
||||
const leftovers = ref.replace(regex, ($0, $1) => {
|
||||
|
||||
++map.get($1).hits;
|
||||
return ''; // Remove from string
|
||||
});
|
||||
|
||||
// Validate results
|
||||
|
||||
if (options.only &&
|
||||
leftovers) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
let any = false;
|
||||
for (const match of map.values()) {
|
||||
if (match.hits) {
|
||||
any = true;
|
||||
}
|
||||
|
||||
if (match.hits === match.allowed) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (match.hits < match.allowed &&
|
||||
!options.part) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// match.hits > match.allowed
|
||||
|
||||
if (options.once) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return !!any;
|
||||
};
|
||||
|
||||
|
||||
internals.compare = function (options) {
|
||||
|
||||
if (!options.deep) {
|
||||
return internals.shallow;
|
||||
}
|
||||
|
||||
const hasOnly = options.only !== undefined;
|
||||
const hasPart = options.part !== undefined;
|
||||
|
||||
const flags = {
|
||||
prototype: hasOnly ? options.only : hasPart ? !options.part : false,
|
||||
part: hasOnly ? !options.only : hasPart ? options.part : false
|
||||
};
|
||||
|
||||
return (a, b) => DeepEqual(a, b, flags);
|
||||
};
|
||||
|
||||
|
||||
internals.shallow = function (a, b) {
|
||||
|
||||
return a === b;
|
||||
};
|
||||
317
node_modules/@hapi/hoek/lib/deepEqual.js
generated
vendored
317
node_modules/@hapi/hoek/lib/deepEqual.js
generated
vendored
@@ -1,317 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const Types = require('./types');
|
||||
|
||||
|
||||
const internals = {
|
||||
mismatched: null
|
||||
};
|
||||
|
||||
|
||||
module.exports = function (obj, ref, options) {
|
||||
|
||||
options = Object.assign({ prototype: true }, options);
|
||||
|
||||
return !!internals.isDeepEqual(obj, ref, options, []);
|
||||
};
|
||||
|
||||
|
||||
internals.isDeepEqual = function (obj, ref, options, seen) {
|
||||
|
||||
if (obj === ref) { // Copied from Deep-eql, copyright(c) 2013 Jake Luer, jake@alogicalparadox.com, MIT Licensed, https://github.com/chaijs/deep-eql
|
||||
return obj !== 0 || 1 / obj === 1 / ref;
|
||||
}
|
||||
|
||||
const type = typeof obj;
|
||||
|
||||
if (type !== typeof ref) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (obj === null ||
|
||||
ref === null) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type === 'function') {
|
||||
if (!options.deepFunction ||
|
||||
obj.toString() !== ref.toString()) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Continue as object
|
||||
}
|
||||
else if (type !== 'object') {
|
||||
return obj !== obj && ref !== ref; // NaN
|
||||
}
|
||||
|
||||
const instanceType = internals.getSharedType(obj, ref, !!options.prototype);
|
||||
switch (instanceType) {
|
||||
case Types.buffer:
|
||||
return Buffer && Buffer.prototype.equals.call(obj, ref); // $lab:coverage:ignore$
|
||||
case Types.promise:
|
||||
return obj === ref;
|
||||
case Types.regex:
|
||||
return obj.toString() === ref.toString();
|
||||
case internals.mismatched:
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i = seen.length - 1; i >= 0; --i) {
|
||||
if (seen[i].isSame(obj, ref)) {
|
||||
return true; // If previous comparison failed, it would have stopped execution
|
||||
}
|
||||
}
|
||||
|
||||
seen.push(new internals.SeenEntry(obj, ref));
|
||||
|
||||
try {
|
||||
return !!internals.isDeepEqualObj(instanceType, obj, ref, options, seen);
|
||||
}
|
||||
finally {
|
||||
seen.pop();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
internals.getSharedType = function (obj, ref, checkPrototype) {
|
||||
|
||||
if (checkPrototype) {
|
||||
if (Object.getPrototypeOf(obj) !== Object.getPrototypeOf(ref)) {
|
||||
return internals.mismatched;
|
||||
}
|
||||
|
||||
return Types.getInternalProto(obj);
|
||||
}
|
||||
|
||||
const type = Types.getInternalProto(obj);
|
||||
if (type !== Types.getInternalProto(ref)) {
|
||||
return internals.mismatched;
|
||||
}
|
||||
|
||||
return type;
|
||||
};
|
||||
|
||||
|
||||
internals.valueOf = function (obj) {
|
||||
|
||||
const objValueOf = obj.valueOf;
|
||||
if (objValueOf === undefined) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
try {
|
||||
return objValueOf.call(obj);
|
||||
}
|
||||
catch (err) {
|
||||
return err;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
internals.hasOwnEnumerableProperty = function (obj, key) {
|
||||
|
||||
return Object.prototype.propertyIsEnumerable.call(obj, key);
|
||||
};
|
||||
|
||||
|
||||
internals.isSetSimpleEqual = function (obj, ref) {
|
||||
|
||||
for (const entry of Set.prototype.values.call(obj)) {
|
||||
if (!Set.prototype.has.call(ref, entry)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
internals.isDeepEqualObj = function (instanceType, obj, ref, options, seen) {
|
||||
|
||||
const { isDeepEqual, valueOf, hasOwnEnumerableProperty } = internals;
|
||||
const { keys, getOwnPropertySymbols } = Object;
|
||||
|
||||
if (instanceType === Types.array) {
|
||||
if (options.part) {
|
||||
|
||||
// Check if any index match any other index
|
||||
|
||||
for (const objValue of obj) {
|
||||
for (const refValue of ref) {
|
||||
if (isDeepEqual(objValue, refValue, options, seen)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (obj.length !== ref.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i = 0; i < obj.length; ++i) {
|
||||
if (!isDeepEqual(obj[i], ref[i], options, seen)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (instanceType === Types.set) {
|
||||
if (obj.size !== ref.size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!internals.isSetSimpleEqual(obj, ref)) {
|
||||
|
||||
// Check for deep equality
|
||||
|
||||
const ref2 = new Set(Set.prototype.values.call(ref));
|
||||
for (const objEntry of Set.prototype.values.call(obj)) {
|
||||
if (ref2.delete(objEntry)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let found = false;
|
||||
for (const refEntry of ref2) {
|
||||
if (isDeepEqual(objEntry, refEntry, options, seen)) {
|
||||
ref2.delete(refEntry);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (instanceType === Types.map) {
|
||||
if (obj.size !== ref.size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const [key, value] of Map.prototype.entries.call(obj)) {
|
||||
if (value === undefined && !Map.prototype.has.call(ref, key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isDeepEqual(value, Map.prototype.get.call(ref, key), options, seen)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (instanceType === Types.error) {
|
||||
|
||||
// Always check name and message
|
||||
|
||||
if (obj.name !== ref.name ||
|
||||
obj.message !== ref.message) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check .valueOf()
|
||||
|
||||
const valueOfObj = valueOf(obj);
|
||||
const valueOfRef = valueOf(ref);
|
||||
if ((obj !== valueOfObj || ref !== valueOfRef) &&
|
||||
!isDeepEqual(valueOfObj, valueOfRef, options, seen)) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check properties
|
||||
|
||||
const objKeys = keys(obj);
|
||||
if (!options.part &&
|
||||
objKeys.length !== keys(ref).length &&
|
||||
!options.skip) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
let skipped = 0;
|
||||
for (const key of objKeys) {
|
||||
if (options.skip &&
|
||||
options.skip.includes(key)) {
|
||||
|
||||
if (ref[key] === undefined) {
|
||||
++skipped;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!hasOwnEnumerableProperty(ref, key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isDeepEqual(obj[key], ref[key], options, seen)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!options.part &&
|
||||
objKeys.length - skipped !== keys(ref).length) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check symbols
|
||||
|
||||
if (options.symbols !== false) { // Defaults to true
|
||||
const objSymbols = getOwnPropertySymbols(obj);
|
||||
const refSymbols = new Set(getOwnPropertySymbols(ref));
|
||||
|
||||
for (const key of objSymbols) {
|
||||
if (!options.skip ||
|
||||
!options.skip.includes(key)) {
|
||||
|
||||
if (hasOwnEnumerableProperty(obj, key)) {
|
||||
if (!hasOwnEnumerableProperty(ref, key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isDeepEqual(obj[key], ref[key], options, seen)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (hasOwnEnumerableProperty(ref, key)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
refSymbols.delete(key);
|
||||
}
|
||||
|
||||
for (const key of refSymbols) {
|
||||
if (hasOwnEnumerableProperty(ref, key)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
internals.SeenEntry = class {
|
||||
|
||||
constructor(obj, ref) {
|
||||
|
||||
this.obj = obj;
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
isSame(obj, ref) {
|
||||
|
||||
return this.obj === obj && this.ref === ref;
|
||||
}
|
||||
};
|
||||
26
node_modules/@hapi/hoek/lib/error.js
generated
vendored
26
node_modules/@hapi/hoek/lib/error.js
generated
vendored
@@ -1,26 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const Stringify = require('./stringify');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = class extends Error {
|
||||
|
||||
constructor(args) {
|
||||
|
||||
const msgs = args
|
||||
.filter((arg) => arg !== '')
|
||||
.map((arg) => {
|
||||
|
||||
return typeof arg === 'string' ? arg : arg instanceof Error ? arg.message : Stringify(arg);
|
||||
});
|
||||
|
||||
super(msgs.join(' ') || 'Unknown error');
|
||||
|
||||
if (typeof Error.captureStackTrace === 'function') { // $lab:coverage:ignore$
|
||||
Error.captureStackTrace(this, exports.assert);
|
||||
}
|
||||
}
|
||||
};
|
||||
16
node_modules/@hapi/hoek/lib/escapeHeaderAttribute.js
generated
vendored
16
node_modules/@hapi/hoek/lib/escapeHeaderAttribute.js
generated
vendored
@@ -1,16 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const Assert = require('./assert');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (attribute) {
|
||||
|
||||
// Allowed value characters: !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9, \, "
|
||||
|
||||
Assert(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(attribute), 'Bad attribute value (' + attribute + ')');
|
||||
|
||||
return attribute.replace(/\\/g, '\\\\').replace(/\"/g, '\\"'); // Escape quotes and slash
|
||||
};
|
||||
87
node_modules/@hapi/hoek/lib/escapeHtml.js
generated
vendored
87
node_modules/@hapi/hoek/lib/escapeHtml.js
generated
vendored
@@ -1,87 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (input) {
|
||||
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
let escaped = '';
|
||||
|
||||
for (let i = 0; i < input.length; ++i) {
|
||||
|
||||
const charCode = input.charCodeAt(i);
|
||||
|
||||
if (internals.isSafe(charCode)) {
|
||||
escaped += input[i];
|
||||
}
|
||||
else {
|
||||
escaped += internals.escapeHtmlChar(charCode);
|
||||
}
|
||||
}
|
||||
|
||||
return escaped;
|
||||
};
|
||||
|
||||
|
||||
internals.escapeHtmlChar = function (charCode) {
|
||||
|
||||
const namedEscape = internals.namedHtml[charCode];
|
||||
if (typeof namedEscape !== 'undefined') {
|
||||
return namedEscape;
|
||||
}
|
||||
|
||||
if (charCode >= 256) {
|
||||
return '&#' + charCode + ';';
|
||||
}
|
||||
|
||||
const hexValue = charCode.toString(16).padStart(2, '0');
|
||||
return `&#x${hexValue};`;
|
||||
};
|
||||
|
||||
|
||||
internals.isSafe = function (charCode) {
|
||||
|
||||
return (typeof internals.safeCharCodes[charCode] !== 'undefined');
|
||||
};
|
||||
|
||||
|
||||
internals.namedHtml = {
|
||||
'38': '&',
|
||||
'60': '<',
|
||||
'62': '>',
|
||||
'34': '"',
|
||||
'160': ' ',
|
||||
'162': '¢',
|
||||
'163': '£',
|
||||
'164': '¤',
|
||||
'169': '©',
|
||||
'174': '®'
|
||||
};
|
||||
|
||||
|
||||
internals.safeCharCodes = (function () {
|
||||
|
||||
const safe = {};
|
||||
|
||||
for (let i = 32; i < 123; ++i) {
|
||||
|
||||
if ((i >= 97) || // a-z
|
||||
(i >= 65 && i <= 90) || // A-Z
|
||||
(i >= 48 && i <= 57) || // 0-9
|
||||
i === 32 || // space
|
||||
i === 46 || // .
|
||||
i === 44 || // ,
|
||||
i === 45 || // -
|
||||
i === 58 || // :
|
||||
i === 95) { // _
|
||||
|
||||
safe[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
return safe;
|
||||
}());
|
||||
41
node_modules/@hapi/hoek/lib/escapeJson.js
generated
vendored
41
node_modules/@hapi/hoek/lib/escapeJson.js
generated
vendored
@@ -1,41 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (input) {
|
||||
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const lessThan = 0x3C;
|
||||
const greaterThan = 0x3E;
|
||||
const andSymbol = 0x26;
|
||||
const lineSeperator = 0x2028;
|
||||
|
||||
// replace method
|
||||
let charCode;
|
||||
return input.replace(/[<>&\u2028\u2029]/g, (match) => {
|
||||
|
||||
charCode = match.charCodeAt(0);
|
||||
|
||||
if (charCode === lessThan) {
|
||||
return '\\u003c';
|
||||
}
|
||||
|
||||
if (charCode === greaterThan) {
|
||||
return '\\u003e';
|
||||
}
|
||||
|
||||
if (charCode === andSymbol) {
|
||||
return '\\u0026';
|
||||
}
|
||||
|
||||
if (charCode === lineSeperator) {
|
||||
return '\\u2028';
|
||||
}
|
||||
|
||||
return '\\u2029';
|
||||
});
|
||||
};
|
||||
11
node_modules/@hapi/hoek/lib/escapeRegex.js
generated
vendored
11
node_modules/@hapi/hoek/lib/escapeRegex.js
generated
vendored
@@ -1,11 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (string) {
|
||||
|
||||
// Escape ^$.*+-?=!:|\/()[]{},
|
||||
|
||||
return string.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g, '\\$&');
|
||||
};
|
||||
20
node_modules/@hapi/hoek/lib/flatten.js
generated
vendored
20
node_modules/@hapi/hoek/lib/flatten.js
generated
vendored
@@ -1,20 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = internals.flatten = function (array, target) {
|
||||
|
||||
const result = target || [];
|
||||
|
||||
for (let i = 0; i < array.length; ++i) {
|
||||
if (Array.isArray(array[i])) {
|
||||
internals.flatten(array[i], result);
|
||||
}
|
||||
else {
|
||||
result.push(array[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
6
node_modules/@hapi/hoek/lib/ignore.js
generated
vendored
6
node_modules/@hapi/hoek/lib/ignore.js
generated
vendored
@@ -1,6 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function () { };
|
||||
471
node_modules/@hapi/hoek/lib/index.d.ts
generated
vendored
471
node_modules/@hapi/hoek/lib/index.d.ts
generated
vendored
@@ -1,471 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
|
||||
/**
|
||||
* Performs a deep comparison of the two values including support for circular dependencies, prototype, and enumerable properties.
|
||||
*
|
||||
* @param obj - The value being compared.
|
||||
* @param ref - The reference value used for comparison.
|
||||
*
|
||||
* @return true when the two values are equal, otherwise false.
|
||||
*/
|
||||
export function deepEqual(obj: any, ref: any, options?: deepEqual.Options): boolean;
|
||||
|
||||
export namespace deepEqual {
|
||||
|
||||
interface Options {
|
||||
|
||||
/**
|
||||
* Compare functions with difference references by comparing their internal code and properties.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly deepFunction?: boolean;
|
||||
|
||||
/**
|
||||
* Allow partial match.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly part?: boolean;
|
||||
|
||||
/**
|
||||
* Compare the objects' prototypes.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
readonly prototype?: boolean;
|
||||
|
||||
/**
|
||||
* List of object keys to ignore different values of.
|
||||
*
|
||||
* @default null
|
||||
*/
|
||||
readonly skip?: (string | symbol)[];
|
||||
|
||||
/**
|
||||
* Compare symbol properties.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
readonly symbols?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clone any value, object, or array.
|
||||
*
|
||||
* @param obj - The value being cloned.
|
||||
* @param options - Optional settings.
|
||||
*
|
||||
* @returns A deep clone of `obj`.
|
||||
*/
|
||||
export function clone<T>(obj: T, options?: clone.Options): T;
|
||||
|
||||
export namespace clone {
|
||||
|
||||
interface Options {
|
||||
|
||||
/**
|
||||
* Clone the object's prototype.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
readonly prototype?: boolean;
|
||||
|
||||
/**
|
||||
* Include symbol properties.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
readonly symbols?: boolean;
|
||||
|
||||
/**
|
||||
* Shallow clone the specified keys.
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
readonly shallow?: string[] | string[][] | boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Merge all the properties of source into target.
|
||||
*
|
||||
* @param target - The object being modified.
|
||||
* @param source - The object used to copy properties from.
|
||||
* @param options - Optional settings.
|
||||
*
|
||||
* @returns The `target` object.
|
||||
*/
|
||||
export function merge<T1 extends object, T2 extends object>(target: T1, source: T2, options?: merge.Options): T1 & T2;
|
||||
|
||||
export namespace merge {
|
||||
|
||||
interface Options {
|
||||
|
||||
/**
|
||||
* When true, null value from `source` overrides existing value in `target`.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
readonly nullOverride?: boolean;
|
||||
|
||||
/**
|
||||
* When true, array value from `source` is merged with the existing value in `target`.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly mergeArrays?: boolean;
|
||||
|
||||
/**
|
||||
* Compare symbol properties.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
readonly symbols?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Apply source to a copy of the defaults.
|
||||
*
|
||||
* @param defaults - An object with the default values to use of `options` does not contain the same keys.
|
||||
* @param source - The source used to override the `defaults`.
|
||||
* @param options - Optional settings.
|
||||
*
|
||||
* @returns A copy of `defaults` with `source` keys overriding any conflicts.
|
||||
*/
|
||||
export function applyToDefaults<T extends object>(defaults: Partial<T>, source: Partial<T> | boolean | null, options?: applyToDefaults.Options): Partial<T>;
|
||||
|
||||
export namespace applyToDefaults {
|
||||
|
||||
interface Options {
|
||||
|
||||
/**
|
||||
* When true, null value from `source` overrides existing value in `target`.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
readonly nullOverride?: boolean;
|
||||
|
||||
/**
|
||||
* Shallow clone the specified keys.
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
readonly shallow?: string[] | string[][];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find the common unique items in two arrays.
|
||||
*
|
||||
* @param array1 - The first array to compare.
|
||||
* @param array2 - The second array to compare.
|
||||
* @param options - Optional settings.
|
||||
*
|
||||
* @return - An array of the common items. If `justFirst` is true, returns the first common item.
|
||||
*/
|
||||
export function intersect<T1, T2>(array1: intersect.Array<T1>, array2: intersect.Array<T2>, options?: intersect.Options): Array<T1 | T2>;
|
||||
export function intersect<T1, T2>(array1: intersect.Array<T1>, array2: intersect.Array<T2>, options?: intersect.Options): T1 | T2;
|
||||
|
||||
export namespace intersect {
|
||||
|
||||
type Array<T> = ArrayLike<T> | Set<T> | null;
|
||||
|
||||
interface Options {
|
||||
|
||||
/**
|
||||
* When true, return the first overlapping value.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly first?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the reference value contains the provided values.
|
||||
*
|
||||
* @param ref - The reference string, array, or object.
|
||||
* @param values - A single or array of values to find within `ref`. If `ref` is an object, `values` can be a key name, an array of key names, or an object with key-value pairs to compare.
|
||||
*
|
||||
* @return true if the value contains the provided values, otherwise false.
|
||||
*/
|
||||
export function contain(ref: string, values: string | string[], options?: contain.Options): boolean;
|
||||
export function contain(ref: any[], values: any, options?: contain.Options): boolean;
|
||||
export function contain(ref: object, values: string | string[] | object, options?: Omit<contain.Options, 'once'>): boolean;
|
||||
|
||||
export namespace contain {
|
||||
|
||||
interface Options {
|
||||
|
||||
/**
|
||||
* Perform a deep comparison.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly deep?: boolean;
|
||||
|
||||
/**
|
||||
* Allow only one occurrence of each value.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly once?: boolean;
|
||||
|
||||
/**
|
||||
* Allow only values explicitly listed.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly only?: boolean;
|
||||
|
||||
/**
|
||||
* Allow partial match.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly part?: boolean;
|
||||
|
||||
/**
|
||||
* Include symbol properties.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
readonly symbols?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Flatten an array with sub arrays
|
||||
*
|
||||
* @param array - an array of items or other arrays to flatten.
|
||||
* @param target - if provided, an array to shallow copy the flattened `array` items to
|
||||
*
|
||||
* @return a flat array of the provided values (appended to `target` is provided).
|
||||
*/
|
||||
export function flatten<T>(array: ArrayLike<T | ReadonlyArray<T>>, target?: ArrayLike<T | ReadonlyArray<T>>): T[];
|
||||
|
||||
|
||||
/**
|
||||
* Convert an object key chain string to reference.
|
||||
*
|
||||
* @param obj - the object from which to look up the value.
|
||||
* @param chain - the string path of the requested value. The chain string is split into key names using `options.separator`, or an array containing each individual key name. A chain including negative numbers will work like a negative index on an array.
|
||||
*
|
||||
* @return The value referenced by the chain if found, otherwise undefined. If chain is null, undefined, or false, the object itself will be returned.
|
||||
*/
|
||||
export function reach(obj: object | null, chain: string | (string | number)[] | false | null | undefined, options?: reach.Options): any;
|
||||
|
||||
export namespace reach {
|
||||
|
||||
interface Options {
|
||||
|
||||
/**
|
||||
* String to split chain path on. Defaults to '.'.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly separator?: string;
|
||||
|
||||
/**
|
||||
* Value to return if the path or value is not present. No default value.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly default?: any;
|
||||
|
||||
/**
|
||||
* If true, will throw an error on missing member in the chain. Default to false.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly strict?: boolean;
|
||||
|
||||
/**
|
||||
* If true, allows traversing functions for properties. false will throw an error if a function is part of the chain.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
readonly functions?: boolean;
|
||||
|
||||
/**
|
||||
* If true, allows traversing Set and Map objects for properties. false will return undefined regardless of the Set or Map passed.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly iterables?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Replace string parameters (using format "{path.to.key}") with their corresponding object key values using `Hoek.reach()`.
|
||||
*
|
||||
* @param obj - the object from which to look up the value.
|
||||
* @param template - the string containing {} enclosed key paths to be replaced.
|
||||
*
|
||||
* @return The template string with the {} enclosed keys replaced with looked-up values.
|
||||
*/
|
||||
export function reachTemplate(obj: object | null, template: string, options?: reach.Options): string;
|
||||
|
||||
|
||||
/**
|
||||
* Throw an error if condition is falsy.
|
||||
*
|
||||
* @param condition - If `condition` is not truthy, an exception is thrown.
|
||||
* @param error - The error thrown if the condition fails.
|
||||
*
|
||||
* @return Does not return a value but throws if the `condition` is falsy.
|
||||
*/
|
||||
export function assert(condition: any, error: Error): void;
|
||||
|
||||
|
||||
/**
|
||||
* Throw an error if condition is falsy.
|
||||
*
|
||||
* @param condition - If `condition` is not truthy, an exception is thrown.
|
||||
* @param args - Any number of values, concatenated together (space separated) to create the error message.
|
||||
*
|
||||
* @return Does not return a value but throws if the `condition` is falsy.
|
||||
*/
|
||||
export function assert(condition: any, ...args: any): void;
|
||||
|
||||
|
||||
/**
|
||||
* A benchmarking timer, using the internal node clock for maximum accuracy.
|
||||
*/
|
||||
export class Bench {
|
||||
|
||||
constructor();
|
||||
|
||||
/** The starting timestamp expressed in the number of milliseconds since the epoch. */
|
||||
ts: number;
|
||||
|
||||
/** The time in milliseconds since the object was created. */
|
||||
elapsed(): number;
|
||||
|
||||
/** Reset the `ts` value to now. */
|
||||
reset(): void;
|
||||
|
||||
/** The current time in milliseconds since the epoch. */
|
||||
static now(): number;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Escape string for Regex construction by prefixing all reserved characters with a backslash.
|
||||
*
|
||||
* @param string - The string to be escaped.
|
||||
*
|
||||
* @return The escaped string.
|
||||
*/
|
||||
export function escapeRegex(string: string): string;
|
||||
|
||||
|
||||
/**
|
||||
* Escape string for usage as an attribute value in HTTP headers.
|
||||
*
|
||||
* @param attribute - The string to be escaped.
|
||||
*
|
||||
* @return The escaped string. Will throw on invalid characters that are not supported to be escaped.
|
||||
*/
|
||||
export function escapeHeaderAttribute(attribute: string): string;
|
||||
|
||||
|
||||
/**
|
||||
* Escape string for usage in HTML.
|
||||
*
|
||||
* @param string - The string to be escaped.
|
||||
*
|
||||
* @return The escaped string.
|
||||
*/
|
||||
export function escapeHtml(string: string): string;
|
||||
|
||||
|
||||
/**
|
||||
* Escape string for usage in JSON.
|
||||
*
|
||||
* @param string - The string to be escaped.
|
||||
*
|
||||
* @return The escaped string.
|
||||
*/
|
||||
export function escapeJson(string: string): string;
|
||||
|
||||
|
||||
/**
|
||||
* Wraps a function to ensure it can only execute once.
|
||||
*
|
||||
* @param method - The function to be wrapped.
|
||||
*
|
||||
* @return The wrapped function.
|
||||
*/
|
||||
export function once<T extends Function>(method: T): T;
|
||||
|
||||
|
||||
/**
|
||||
* A reusable no-op function.
|
||||
*/
|
||||
export function ignore(...ignore: any): void;
|
||||
|
||||
|
||||
/**
|
||||
* Converts a JavaScript value to a JavaScript Object Notation (JSON) string with protection against thrown errors.
|
||||
*
|
||||
* @param value A JavaScript value, usually an object or array, to be converted.
|
||||
* @param replacer The JSON.stringify() `replacer` argument.
|
||||
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
|
||||
*
|
||||
* @return The JSON string. If the operation fails, an error string value is returned (no exception thrown).
|
||||
*/
|
||||
export function stringify(value: any, replacer?: any, space?: string | number): string;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a Promise that resolves after the requested timeout.
|
||||
*
|
||||
* @param timeout - The number of milliseconds to wait before resolving the Promise.
|
||||
* @param returnValue - The value that the Promise will resolve to.
|
||||
*
|
||||
* @return A Promise that resolves with `returnValue`.
|
||||
*/
|
||||
export function wait<T>(timeout?: number, returnValue?: T): Promise<T>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a Promise that never resolves.
|
||||
*/
|
||||
export function block(): Promise<void>;
|
||||
|
||||
|
||||
/**
|
||||
* Determines if an object is a promise.
|
||||
*
|
||||
* @param promise - the object tested.
|
||||
*
|
||||
* @returns true if the object is a promise, otherwise false.
|
||||
*/
|
||||
export function isPromise(promise: any): boolean;
|
||||
|
||||
|
||||
export namespace ts {
|
||||
|
||||
/**
|
||||
* Defines a type that can must be one of T or U but not both.
|
||||
*/
|
||||
type XOR<T, U> = (T | U) extends object ? (internals.Without<T, U> & U) | (internals.Without<U, T> & T) : T | U;
|
||||
}
|
||||
|
||||
|
||||
declare namespace internals {
|
||||
|
||||
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
|
||||
}
|
||||
45
node_modules/@hapi/hoek/lib/index.js
generated
vendored
45
node_modules/@hapi/hoek/lib/index.js
generated
vendored
@@ -1,45 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
exports.applyToDefaults = require('./applyToDefaults');
|
||||
|
||||
exports.assert = require('./assert');
|
||||
|
||||
exports.Bench = require('./bench');
|
||||
|
||||
exports.block = require('./block');
|
||||
|
||||
exports.clone = require('./clone');
|
||||
|
||||
exports.contain = require('./contain');
|
||||
|
||||
exports.deepEqual = require('./deepEqual');
|
||||
|
||||
exports.Error = require('./error');
|
||||
|
||||
exports.escapeHeaderAttribute = require('./escapeHeaderAttribute');
|
||||
|
||||
exports.escapeHtml = require('./escapeHtml');
|
||||
|
||||
exports.escapeJson = require('./escapeJson');
|
||||
|
||||
exports.escapeRegex = require('./escapeRegex');
|
||||
|
||||
exports.flatten = require('./flatten');
|
||||
|
||||
exports.ignore = require('./ignore');
|
||||
|
||||
exports.intersect = require('./intersect');
|
||||
|
||||
exports.isPromise = require('./isPromise');
|
||||
|
||||
exports.merge = require('./merge');
|
||||
|
||||
exports.once = require('./once');
|
||||
|
||||
exports.reach = require('./reach');
|
||||
|
||||
exports.reachTemplate = require('./reachTemplate');
|
||||
|
||||
exports.stringify = require('./stringify');
|
||||
|
||||
exports.wait = require('./wait');
|
||||
41
node_modules/@hapi/hoek/lib/intersect.js
generated
vendored
41
node_modules/@hapi/hoek/lib/intersect.js
generated
vendored
@@ -1,41 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (array1, array2, options = {}) {
|
||||
|
||||
if (!array1 ||
|
||||
!array2) {
|
||||
|
||||
return (options.first ? null : []);
|
||||
}
|
||||
|
||||
const common = [];
|
||||
const hash = (Array.isArray(array1) ? new Set(array1) : array1);
|
||||
const found = new Set();
|
||||
for (const value of array2) {
|
||||
if (internals.has(hash, value) &&
|
||||
!found.has(value)) {
|
||||
|
||||
if (options.first) {
|
||||
return value;
|
||||
}
|
||||
|
||||
common.push(value);
|
||||
found.add(value);
|
||||
}
|
||||
}
|
||||
|
||||
return (options.first ? null : common);
|
||||
};
|
||||
|
||||
|
||||
internals.has = function (ref, key) {
|
||||
|
||||
if (typeof ref.has === 'function') {
|
||||
return ref.has(key);
|
||||
}
|
||||
|
||||
return ref[key] !== undefined;
|
||||
};
|
||||
9
node_modules/@hapi/hoek/lib/isPromise.js
generated
vendored
9
node_modules/@hapi/hoek/lib/isPromise.js
generated
vendored
@@ -1,9 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (promise) {
|
||||
|
||||
return !!promise && typeof promise.then === 'function';
|
||||
};
|
||||
78
node_modules/@hapi/hoek/lib/merge.js
generated
vendored
78
node_modules/@hapi/hoek/lib/merge.js
generated
vendored
@@ -1,78 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const Assert = require('./assert');
|
||||
const Clone = require('./clone');
|
||||
const Utils = require('./utils');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = internals.merge = function (target, source, options) {
|
||||
|
||||
Assert(target && typeof target === 'object', 'Invalid target value: must be an object');
|
||||
Assert(source === null || source === undefined || typeof source === 'object', 'Invalid source value: must be null, undefined, or an object');
|
||||
|
||||
if (!source) {
|
||||
return target;
|
||||
}
|
||||
|
||||
options = Object.assign({ nullOverride: true, mergeArrays: true }, options);
|
||||
|
||||
if (Array.isArray(source)) {
|
||||
Assert(Array.isArray(target), 'Cannot merge array onto an object');
|
||||
if (!options.mergeArrays) {
|
||||
target.length = 0; // Must not change target assignment
|
||||
}
|
||||
|
||||
for (let i = 0; i < source.length; ++i) {
|
||||
target.push(Clone(source[i], { symbols: options.symbols }));
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
const keys = Utils.keys(source, options);
|
||||
for (let i = 0; i < keys.length; ++i) {
|
||||
const key = keys[i];
|
||||
if (key === '__proto__' ||
|
||||
!Object.prototype.propertyIsEnumerable.call(source, key)) {
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
const value = source[key];
|
||||
if (value &&
|
||||
typeof value === 'object') {
|
||||
|
||||
if (target[key] === value) {
|
||||
continue; // Can occur for shallow merges
|
||||
}
|
||||
|
||||
if (!target[key] ||
|
||||
typeof target[key] !== 'object' ||
|
||||
(Array.isArray(target[key]) !== Array.isArray(value)) ||
|
||||
value instanceof Date ||
|
||||
(Buffer && Buffer.isBuffer(value)) || // $lab:coverage:ignore$
|
||||
value instanceof RegExp) {
|
||||
|
||||
target[key] = Clone(value, { symbols: options.symbols });
|
||||
}
|
||||
else {
|
||||
internals.merge(target[key], value, options);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (value !== null &&
|
||||
value !== undefined) { // Explicit to preserve empty strings
|
||||
|
||||
target[key] = value;
|
||||
}
|
||||
else if (options.nullOverride) {
|
||||
target[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
};
|
||||
23
node_modules/@hapi/hoek/lib/once.js
generated
vendored
23
node_modules/@hapi/hoek/lib/once.js
generated
vendored
@@ -1,23 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (method) {
|
||||
|
||||
if (method._hoekOnce) {
|
||||
return method;
|
||||
}
|
||||
|
||||
let once = false;
|
||||
const wrapped = function (...args) {
|
||||
|
||||
if (!once) {
|
||||
once = true;
|
||||
method(...args);
|
||||
}
|
||||
};
|
||||
|
||||
wrapped._hoekOnce = true;
|
||||
return wrapped;
|
||||
};
|
||||
76
node_modules/@hapi/hoek/lib/reach.js
generated
vendored
76
node_modules/@hapi/hoek/lib/reach.js
generated
vendored
@@ -1,76 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const Assert = require('./assert');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (obj, chain, options) {
|
||||
|
||||
if (chain === false ||
|
||||
chain === null ||
|
||||
chain === undefined) {
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
if (typeof options === 'string') {
|
||||
options = { separator: options };
|
||||
}
|
||||
|
||||
const isChainArray = Array.isArray(chain);
|
||||
|
||||
Assert(!isChainArray || !options.separator, 'Separator option no valid for array-based chain');
|
||||
|
||||
const path = isChainArray ? chain : chain.split(options.separator || '.');
|
||||
let ref = obj;
|
||||
for (let i = 0; i < path.length; ++i) {
|
||||
let key = path[i];
|
||||
const type = options.iterables && internals.iterables(ref);
|
||||
|
||||
if (Array.isArray(ref) ||
|
||||
type === 'set') {
|
||||
|
||||
const number = Number(key);
|
||||
if (Number.isInteger(number)) {
|
||||
key = number < 0 ? ref.length + number : number;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ref ||
|
||||
typeof ref === 'function' && options.functions === false || // Defaults to true
|
||||
!type && ref[key] === undefined) {
|
||||
|
||||
Assert(!options.strict || i + 1 === path.length, 'Missing segment', key, 'in reach path ', chain);
|
||||
Assert(typeof ref === 'object' || options.functions === true || typeof ref !== 'function', 'Invalid segment', key, 'in reach path ', chain);
|
||||
ref = options.default;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!type) {
|
||||
ref = ref[key];
|
||||
}
|
||||
else if (type === 'set') {
|
||||
ref = [...ref][key];
|
||||
}
|
||||
else { // type === 'map'
|
||||
ref = ref.get(key);
|
||||
}
|
||||
}
|
||||
|
||||
return ref;
|
||||
};
|
||||
|
||||
|
||||
internals.iterables = function (ref) {
|
||||
|
||||
if (ref instanceof Set) {
|
||||
return 'set';
|
||||
}
|
||||
|
||||
if (ref instanceof Map) {
|
||||
return 'map';
|
||||
}
|
||||
};
|
||||
16
node_modules/@hapi/hoek/lib/reachTemplate.js
generated
vendored
16
node_modules/@hapi/hoek/lib/reachTemplate.js
generated
vendored
@@ -1,16 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const Reach = require('./reach');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (obj, template, options) {
|
||||
|
||||
return template.replace(/{([^}]+)}/g, ($0, chain) => {
|
||||
|
||||
const value = Reach(obj, chain, options);
|
||||
return (value === undefined || value === null ? '' : value);
|
||||
});
|
||||
};
|
||||
14
node_modules/@hapi/hoek/lib/stringify.js
generated
vendored
14
node_modules/@hapi/hoek/lib/stringify.js
generated
vendored
@@ -1,14 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (...args) {
|
||||
|
||||
try {
|
||||
return JSON.stringify.apply(null, args);
|
||||
}
|
||||
catch (err) {
|
||||
return '[Cannot display object: ' + err.message + ']';
|
||||
}
|
||||
};
|
||||
55
node_modules/@hapi/hoek/lib/types.js
generated
vendored
55
node_modules/@hapi/hoek/lib/types.js
generated
vendored
@@ -1,55 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
exports = module.exports = {
|
||||
array: Array.prototype,
|
||||
buffer: Buffer && Buffer.prototype, // $lab:coverage:ignore$
|
||||
date: Date.prototype,
|
||||
error: Error.prototype,
|
||||
generic: Object.prototype,
|
||||
map: Map.prototype,
|
||||
promise: Promise.prototype,
|
||||
regex: RegExp.prototype,
|
||||
set: Set.prototype,
|
||||
weakMap: WeakMap.prototype,
|
||||
weakSet: WeakSet.prototype
|
||||
};
|
||||
|
||||
|
||||
internals.typeMap = new Map([
|
||||
['[object Error]', exports.error],
|
||||
['[object Map]', exports.map],
|
||||
['[object Promise]', exports.promise],
|
||||
['[object Set]', exports.set],
|
||||
['[object WeakMap]', exports.weakMap],
|
||||
['[object WeakSet]', exports.weakSet]
|
||||
]);
|
||||
|
||||
|
||||
exports.getInternalProto = function (obj) {
|
||||
|
||||
if (Array.isArray(obj)) {
|
||||
return exports.array;
|
||||
}
|
||||
|
||||
if (Buffer && obj instanceof Buffer) { // $lab:coverage:ignore$
|
||||
return exports.buffer;
|
||||
}
|
||||
|
||||
if (obj instanceof Date) {
|
||||
return exports.date;
|
||||
}
|
||||
|
||||
if (obj instanceof RegExp) {
|
||||
return exports.regex;
|
||||
}
|
||||
|
||||
if (obj instanceof Error) {
|
||||
return exports.error;
|
||||
}
|
||||
|
||||
const objName = Object.prototype.toString.call(obj);
|
||||
return internals.typeMap.get(objName) || exports.generic;
|
||||
};
|
||||
9
node_modules/@hapi/hoek/lib/utils.js
generated
vendored
9
node_modules/@hapi/hoek/lib/utils.js
generated
vendored
@@ -1,9 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
exports.keys = function (obj, options = {}) {
|
||||
|
||||
return options.symbols !== false ? Reflect.ownKeys(obj) : Object.getOwnPropertyNames(obj); // Defaults to true
|
||||
};
|
||||
13
node_modules/@hapi/hoek/lib/wait.js
generated
vendored
13
node_modules/@hapi/hoek/lib/wait.js
generated
vendored
@@ -1,13 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (timeout, returnValue) {
|
||||
|
||||
if (typeof timeout !== 'number' && timeout !== undefined) {
|
||||
throw new TypeError('Timeout must be a number');
|
||||
}
|
||||
|
||||
return new Promise((resolve) => setTimeout(resolve, timeout, returnValue));
|
||||
};
|
||||
60
node_modules/@hapi/hoek/package.json
generated
vendored
60
node_modules/@hapi/hoek/package.json
generated
vendored
@@ -1,60 +0,0 @@
|
||||
{
|
||||
"_from": "@hapi/hoek@^9.0.0",
|
||||
"_id": "@hapi/hoek@9.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-sqKVVVOe5ivCaXDWivIJYVSaEgdQK9ul7a4Kity5Iw7u9+wBAPbX1RMSnLLmp7O4Vzj0WOWwMAJsTL00xwaNug==",
|
||||
"_location": "/@hapi/hoek",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@hapi/hoek@^9.0.0",
|
||||
"name": "@hapi/hoek",
|
||||
"escapedName": "@hapi%2fhoek",
|
||||
"scope": "@hapi",
|
||||
"rawSpec": "^9.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^9.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@hapi/topo",
|
||||
"/@sideway/address",
|
||||
"/joi"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.0.tgz",
|
||||
"_shasum": "f3933a44e365864f4dad5db94158106d511e8131",
|
||||
"_spec": "@hapi/hoek@^9.0.0",
|
||||
"_where": "C:\\Users\\anelissen\\Development\\tools\\node\\cbor\\node_modules\\joi",
|
||||
"bugs": {
|
||||
"url": "https://github.com/hapijs/hoek/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "General purpose node utilities",
|
||||
"devDependencies": {
|
||||
"@hapi/code": "8.x.x",
|
||||
"@hapi/lab": "^24.0.0",
|
||||
"typescript": "~4.0.2"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/hapijs/hoek#readme",
|
||||
"keywords": [
|
||||
"utilities"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "lib/index.js",
|
||||
"name": "@hapi/hoek",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/hapijs/hoek.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "lab -a @hapi/code -t 100 -L -Y",
|
||||
"test-cov-html": "lab -a @hapi/code -t 100 -L -r html -o coverage.html"
|
||||
},
|
||||
"types": "lib/index.d.ts",
|
||||
"version": "9.2.0"
|
||||
}
|
||||
10
node_modules/@hapi/topo/LICENSE.md
generated
vendored
10
node_modules/@hapi/topo/LICENSE.md
generated
vendored
@@ -1,10 +0,0 @@
|
||||
Copyright (c) 2012-2020, Sideway Inc, and project contributors
|
||||
Copyright (c) 2012-2014, Walmart.
|
||||
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.
|
||||
* The names of any contributors may not 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS 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 OFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
17
node_modules/@hapi/topo/README.md
generated
vendored
17
node_modules/@hapi/topo/README.md
generated
vendored
@@ -1,17 +0,0 @@
|
||||
<a href="https://hapi.dev"><img src="https://raw.githubusercontent.com/hapijs/assets/master/images/family.png" width="180px" align="right" /></a>
|
||||
|
||||
# @hapi/topo
|
||||
|
||||
#### Topological sorting with grouping support.
|
||||
|
||||
**topo** is part of the **hapi** ecosystem and was designed to work seamlessly with the [hapi web framework](https://hapi.dev) and its other components (but works great on its own or with other frameworks). If you are using a different web framework and find this module useful, check out [hapi](https://hapi.dev) – they work even better together.
|
||||
|
||||
### Visit the [hapi.dev](https://hapi.dev) Developer Portal for tutorials, documentation, and support
|
||||
|
||||
## Useful resources
|
||||
|
||||
- [Documentation and API](https://hapi.dev/family/topo/)
|
||||
- [Version status](https://hapi.dev/resources/status/#topo) (builds, dependencies, node versions, licenses, eol)
|
||||
- [Changelog](https://hapi.dev/family/topo/changelog/)
|
||||
- [Project policies](https://hapi.dev/policies/)
|
||||
- [Free and commercial support options](https://hapi.dev/support/)
|
||||
60
node_modules/@hapi/topo/lib/index.d.ts
generated
vendored
60
node_modules/@hapi/topo/lib/index.d.ts
generated
vendored
@@ -1,60 +0,0 @@
|
||||
export class Sorter<T> {
|
||||
|
||||
/**
|
||||
* An array of the topologically sorted nodes. This list is renewed upon each call to topo.add().
|
||||
*/
|
||||
nodes: T[];
|
||||
|
||||
/**
|
||||
* Adds a node or list of nodes to be added and topologically sorted
|
||||
*
|
||||
* @param nodes - A mixed value or array of mixed values to be added as nodes to the topologically sorted list.
|
||||
* @param options - Optional sorting information about the nodes.
|
||||
*
|
||||
* @returns Returns an array of the topologically sorted nodes.
|
||||
*/
|
||||
add(nodes: T | T[], options?: Options): T[];
|
||||
|
||||
/**
|
||||
* Merges another Sorter object into the current object.
|
||||
*
|
||||
* @param others - The other object or array of objects to be merged into the current one.
|
||||
*
|
||||
* @returns Returns an array of the topologically sorted nodes.
|
||||
*/
|
||||
merge(others: Sorter<T> | Sorter<T>[]): T[];
|
||||
|
||||
/**
|
||||
* Sorts the nodes array (only required if the manual option is used when adding items)
|
||||
*/
|
||||
sort(): T[];
|
||||
}
|
||||
|
||||
|
||||
export interface Options {
|
||||
|
||||
/**
|
||||
* The sorting group the added items belong to
|
||||
*/
|
||||
readonly group?: string;
|
||||
|
||||
/**
|
||||
* The group or groups the added items must come before
|
||||
*/
|
||||
readonly before?: string | string[];
|
||||
|
||||
/**
|
||||
* The group or groups the added items must come after
|
||||
*/
|
||||
readonly after?: string | string[];
|
||||
|
||||
/**
|
||||
* A number used to sort items with equal before/after requirements
|
||||
*/
|
||||
readonly sort?: number;
|
||||
|
||||
/**
|
||||
* If true, the array is not sorted automatically until sort() is called
|
||||
*/
|
||||
readonly manual?: boolean;
|
||||
}
|
||||
225
node_modules/@hapi/topo/lib/index.js
generated
vendored
225
node_modules/@hapi/topo/lib/index.js
generated
vendored
@@ -1,225 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const Assert = require('@hapi/hoek/lib/assert');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
exports.Sorter = class {
|
||||
|
||||
constructor() {
|
||||
|
||||
this._items = [];
|
||||
this.nodes = [];
|
||||
}
|
||||
|
||||
add(nodes, options) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
// Validate rules
|
||||
|
||||
const before = [].concat(options.before || []);
|
||||
const after = [].concat(options.after || []);
|
||||
const group = options.group || '?';
|
||||
const sort = options.sort || 0; // Used for merging only
|
||||
|
||||
Assert(!before.includes(group), `Item cannot come before itself: ${group}`);
|
||||
Assert(!before.includes('?'), 'Item cannot come before unassociated items');
|
||||
Assert(!after.includes(group), `Item cannot come after itself: ${group}`);
|
||||
Assert(!after.includes('?'), 'Item cannot come after unassociated items');
|
||||
|
||||
if (!Array.isArray(nodes)) {
|
||||
nodes = [nodes];
|
||||
}
|
||||
|
||||
for (const node of nodes) {
|
||||
const item = {
|
||||
seq: this._items.length,
|
||||
sort,
|
||||
before,
|
||||
after,
|
||||
group,
|
||||
node
|
||||
};
|
||||
|
||||
this._items.push(item);
|
||||
}
|
||||
|
||||
// Insert event
|
||||
|
||||
if (!options.manual) {
|
||||
const valid = this._sort();
|
||||
Assert(valid, 'item', group !== '?' ? `added into group ${group}` : '', 'created a dependencies error');
|
||||
}
|
||||
|
||||
return this.nodes;
|
||||
}
|
||||
|
||||
merge(others) {
|
||||
|
||||
if (!Array.isArray(others)) {
|
||||
others = [others];
|
||||
}
|
||||
|
||||
for (const other of others) {
|
||||
if (other) {
|
||||
for (const item of other._items) {
|
||||
this._items.push(Object.assign({}, item)); // Shallow cloned
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sort items
|
||||
|
||||
this._items.sort(internals.mergeSort);
|
||||
for (let i = 0; i < this._items.length; ++i) {
|
||||
this._items[i].seq = i;
|
||||
}
|
||||
|
||||
const valid = this._sort();
|
||||
Assert(valid, 'merge created a dependencies error');
|
||||
|
||||
return this.nodes;
|
||||
}
|
||||
|
||||
sort() {
|
||||
|
||||
const valid = this._sort();
|
||||
Assert(valid, 'sort created a dependencies error');
|
||||
|
||||
return this.nodes;
|
||||
}
|
||||
|
||||
_sort() {
|
||||
|
||||
// Construct graph
|
||||
|
||||
const graph = {};
|
||||
const graphAfters = Object.create(null); // A prototype can bungle lookups w/ false positives
|
||||
const groups = Object.create(null);
|
||||
|
||||
for (const item of this._items) {
|
||||
const seq = item.seq; // Unique across all items
|
||||
const group = item.group;
|
||||
|
||||
// Determine Groups
|
||||
|
||||
groups[group] = groups[group] || [];
|
||||
groups[group].push(seq);
|
||||
|
||||
// Build intermediary graph using 'before'
|
||||
|
||||
graph[seq] = item.before;
|
||||
|
||||
// Build second intermediary graph with 'after'
|
||||
|
||||
for (const after of item.after) {
|
||||
graphAfters[after] = graphAfters[after] || [];
|
||||
graphAfters[after].push(seq);
|
||||
}
|
||||
}
|
||||
|
||||
// Expand intermediary graph
|
||||
|
||||
for (const node in graph) {
|
||||
const expandedGroups = [];
|
||||
|
||||
for (const graphNodeItem in graph[node]) {
|
||||
const group = graph[node][graphNodeItem];
|
||||
groups[group] = groups[group] || [];
|
||||
expandedGroups.push(...groups[group]);
|
||||
}
|
||||
|
||||
graph[node] = expandedGroups;
|
||||
}
|
||||
|
||||
// Merge intermediary graph using graphAfters into final graph
|
||||
|
||||
for (const group in graphAfters) {
|
||||
if (groups[group]) {
|
||||
for (const node of groups[group]) {
|
||||
graph[node].push(...graphAfters[group]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Compile ancestors
|
||||
|
||||
const ancestors = {};
|
||||
for (const node in graph) {
|
||||
const children = graph[node];
|
||||
for (const child of children) {
|
||||
ancestors[child] = ancestors[child] || [];
|
||||
ancestors[child].push(node);
|
||||
}
|
||||
}
|
||||
|
||||
// Topo sort
|
||||
|
||||
const visited = {};
|
||||
const sorted = [];
|
||||
|
||||
for (let i = 0; i < this._items.length; ++i) { // Looping through item.seq values out of order
|
||||
let next = i;
|
||||
|
||||
if (ancestors[i]) {
|
||||
next = null;
|
||||
for (let j = 0; j < this._items.length; ++j) { // As above, these are item.seq values
|
||||
if (visited[j] === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ancestors[j]) {
|
||||
ancestors[j] = [];
|
||||
}
|
||||
|
||||
const shouldSeeCount = ancestors[j].length;
|
||||
let seenCount = 0;
|
||||
for (let k = 0; k < shouldSeeCount; ++k) {
|
||||
if (visited[ancestors[j][k]]) {
|
||||
++seenCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (seenCount === shouldSeeCount) {
|
||||
next = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (next !== null) {
|
||||
visited[next] = true;
|
||||
sorted.push(next);
|
||||
}
|
||||
}
|
||||
|
||||
if (sorted.length !== this._items.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const seqIndex = {};
|
||||
for (const item of this._items) {
|
||||
seqIndex[item.seq] = item;
|
||||
}
|
||||
|
||||
this._items = [];
|
||||
this.nodes = [];
|
||||
|
||||
for (const value of sorted) {
|
||||
const sortedItem = seqIndex[value];
|
||||
this.nodes.push(sortedItem.node);
|
||||
this._items.push(sortedItem);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
internals.mergeSort = (a, b) => {
|
||||
|
||||
return a.sort === b.sort ? 0 : (a.sort < b.sort ? -1 : 1);
|
||||
};
|
||||
63
node_modules/@hapi/topo/package.json
generated
vendored
63
node_modules/@hapi/topo/package.json
generated
vendored
@@ -1,63 +0,0 @@
|
||||
{
|
||||
"_from": "@hapi/topo@^5.0.0",
|
||||
"_id": "@hapi/topo@5.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==",
|
||||
"_location": "/@hapi/topo",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@hapi/topo@^5.0.0",
|
||||
"name": "@hapi/topo",
|
||||
"escapedName": "@hapi%2ftopo",
|
||||
"scope": "@hapi",
|
||||
"rawSpec": "^5.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/joi"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz",
|
||||
"_shasum": "dc448e332c6c6e37a4dc02fd84ba8d44b9afb012",
|
||||
"_spec": "@hapi/topo@^5.0.0",
|
||||
"_where": "C:\\Users\\anelissen\\Development\\tools\\node\\cbor\\node_modules\\joi",
|
||||
"bugs": {
|
||||
"url": "https://github.com/hapijs/topo/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@hapi/hoek": "^9.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Topological sorting with grouping support",
|
||||
"devDependencies": {
|
||||
"@hapi/code": "8.x.x",
|
||||
"@hapi/lab": "24.x.x",
|
||||
"typescript": "~4.0.2"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/hapijs/topo#readme",
|
||||
"keywords": [
|
||||
"topological",
|
||||
"sort",
|
||||
"toposort",
|
||||
"topsort"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "lib/index.js",
|
||||
"name": "@hapi/topo",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/hapijs/topo.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "lab -a @hapi/code -t 100 -L -Y",
|
||||
"test-cov-html": "lab -a @hapi/code -t 100 -L -r html -o coverage.html"
|
||||
},
|
||||
"types": "lib/index.d.ts",
|
||||
"version": "5.1.0"
|
||||
}
|
||||
9
node_modules/@sideway/address/LICENSE.md
generated
vendored
9
node_modules/@sideway/address/LICENSE.md
generated
vendored
@@ -1,9 +0,0 @@
|
||||
Copyright (c) 2019-2020, Sideway, Inc. and Project contributors
|
||||
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.
|
||||
* The names of any contributors may not 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS 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.
|
||||
14
node_modules/@sideway/address/README.md
generated
vendored
14
node_modules/@sideway/address/README.md
generated
vendored
@@ -1,14 +0,0 @@
|
||||
# @sideway/address
|
||||
|
||||
#### Validate email address and domain.
|
||||
|
||||
**address** is part of the **joi** ecosystem.
|
||||
|
||||
### Visit the [joi.dev](https://joi.dev) Developer Portal for tutorials, documentation, and support
|
||||
|
||||
## Useful resources
|
||||
|
||||
- [Documentation and API](https://joi.dev/module/address/)
|
||||
- [Versions status](https://joi.dev/resources/status/#address)
|
||||
- [Changelog](https://joi.dev/module/address/changelog/)
|
||||
- [Project policies](https://joi.dev/policies/)
|
||||
120
node_modules/@sideway/address/lib/decode.js
generated
vendored
120
node_modules/@sideway/address/lib/decode.js
generated
vendored
@@ -1,120 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
// Adapted from:
|
||||
// Copyright (c) 2017-2019 Justin Ridgewell, MIT Licensed, https://github.com/jridgewell/safe-decode-string-component
|
||||
// Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>, MIT Licensed, http://bjoern.hoehrmann.de/utf-8/decoder/dfa/
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
exports.decode = function (string) {
|
||||
|
||||
let percentPos = string.indexOf('%');
|
||||
if (percentPos === -1) {
|
||||
return string;
|
||||
}
|
||||
|
||||
let decoded = '';
|
||||
let last = 0;
|
||||
let codepoint = 0;
|
||||
let startOfOctets = percentPos;
|
||||
let state = internals.utf8.accept;
|
||||
|
||||
while (percentPos > -1 &&
|
||||
percentPos < string.length) {
|
||||
|
||||
const high = internals.resolveHex(string[percentPos + 1], 4);
|
||||
const low = internals.resolveHex(string[percentPos + 2], 0);
|
||||
const byte = high | low;
|
||||
const type = internals.utf8.data[byte];
|
||||
state = internals.utf8.data[256 + state + type];
|
||||
codepoint = (codepoint << 6) | (byte & internals.utf8.data[364 + type]);
|
||||
|
||||
if (state === internals.utf8.accept) {
|
||||
decoded += string.slice(last, startOfOctets);
|
||||
decoded += codepoint <= 0xFFFF
|
||||
? String.fromCharCode(codepoint)
|
||||
: String.fromCharCode(0xD7C0 + (codepoint >> 10), 0xDC00 + (codepoint & 0x3FF));
|
||||
|
||||
codepoint = 0;
|
||||
last = percentPos + 3;
|
||||
percentPos = string.indexOf('%', last);
|
||||
startOfOctets = percentPos;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (state === internals.utf8.reject) {
|
||||
return null;
|
||||
}
|
||||
|
||||
percentPos += 3;
|
||||
|
||||
if (percentPos >= string.length ||
|
||||
string[percentPos] !== '%') {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return decoded + string.slice(last);
|
||||
};
|
||||
|
||||
|
||||
internals.resolveHex = function (char, shift) {
|
||||
|
||||
const i = internals.hex[char];
|
||||
return i === undefined ? 255 : i << shift;
|
||||
};
|
||||
|
||||
|
||||
internals.hex = {
|
||||
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4,
|
||||
'5': 5, '6': 6, '7': 7, '8': 8, '9': 9,
|
||||
'a': 10, 'A': 10, 'b': 11, 'B': 11, 'c': 12,
|
||||
'C': 12, 'd': 13, 'D': 13, 'e': 14, 'E': 14,
|
||||
'f': 15, 'F': 15
|
||||
};
|
||||
|
||||
|
||||
internals.utf8 = {
|
||||
accept: 12,
|
||||
reject: 0,
|
||||
data: [
|
||||
|
||||
// Maps bytes to character to a transition
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 7,
|
||||
10, 9, 9, 9, 11, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
|
||||
// Maps a state to a new state when adding a transition
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
12, 0, 0, 0, 0, 24, 36, 48, 60, 72, 84, 96,
|
||||
0, 12, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 24, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
// Maps the current transition to a mask that needs to apply to the byte
|
||||
|
||||
0x7F, 0x3F, 0x3F, 0x3F, 0x00, 0x1F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x07
|
||||
]
|
||||
};
|
||||
113
node_modules/@sideway/address/lib/domain.js
generated
vendored
113
node_modules/@sideway/address/lib/domain.js
generated
vendored
@@ -1,113 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const Url = require('url');
|
||||
|
||||
const Errors = require('./errors');
|
||||
|
||||
|
||||
const internals = {
|
||||
minDomainSegments: 2,
|
||||
nonAsciiRx: /[^\x00-\x7f]/,
|
||||
domainControlRx: /[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/, // Control + space + separators
|
||||
tldSegmentRx: /^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,
|
||||
domainSegmentRx: /^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,
|
||||
URL: Url.URL || URL // $lab:coverage:ignore$
|
||||
};
|
||||
|
||||
|
||||
exports.analyze = function (domain, options = {}) {
|
||||
|
||||
if (typeof domain !== 'string') {
|
||||
throw new Error('Invalid input: domain must be a string');
|
||||
}
|
||||
|
||||
if (!domain) {
|
||||
return Errors.code('DOMAIN_NON_EMPTY_STRING');
|
||||
}
|
||||
|
||||
if (domain.length > 256) {
|
||||
return Errors.code('DOMAIN_TOO_LONG');
|
||||
}
|
||||
|
||||
const ascii = !internals.nonAsciiRx.test(domain);
|
||||
if (!ascii) {
|
||||
if (options.allowUnicode === false) { // Defaults to true
|
||||
return Errors.code('DOMAIN_INVALID_UNICODE_CHARS');
|
||||
}
|
||||
|
||||
domain = domain.normalize('NFC');
|
||||
}
|
||||
|
||||
if (internals.domainControlRx.test(domain)) {
|
||||
return Errors.code('DOMAIN_INVALID_CHARS');
|
||||
}
|
||||
|
||||
domain = internals.punycode(domain);
|
||||
|
||||
// https://tools.ietf.org/html/rfc1035 section 2.3.1
|
||||
|
||||
const minDomainSegments = options.minDomainSegments || internals.minDomainSegments;
|
||||
|
||||
const segments = domain.split('.');
|
||||
if (segments.length < minDomainSegments) {
|
||||
return Errors.code('DOMAIN_SEGMENTS_COUNT');
|
||||
}
|
||||
|
||||
if (options.maxDomainSegments) {
|
||||
if (segments.length > options.maxDomainSegments) {
|
||||
return Errors.code('DOMAIN_SEGMENTS_COUNT_MAX');
|
||||
}
|
||||
}
|
||||
|
||||
const tlds = options.tlds;
|
||||
if (tlds) {
|
||||
const tld = segments[segments.length - 1].toLowerCase();
|
||||
if (tlds.deny && tlds.deny.has(tld) ||
|
||||
tlds.allow && !tlds.allow.has(tld)) {
|
||||
|
||||
return Errors.code('DOMAIN_FORBIDDEN_TLDS');
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < segments.length; ++i) {
|
||||
const segment = segments[i];
|
||||
|
||||
if (!segment.length) {
|
||||
return Errors.code('DOMAIN_EMPTY_SEGMENT');
|
||||
}
|
||||
|
||||
if (segment.length > 63) {
|
||||
return Errors.code('DOMAIN_LONG_SEGMENT');
|
||||
}
|
||||
|
||||
if (i < segments.length - 1) {
|
||||
if (!internals.domainSegmentRx.test(segment)) {
|
||||
return Errors.code('DOMAIN_INVALID_CHARS');
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!internals.tldSegmentRx.test(segment)) {
|
||||
return Errors.code('DOMAIN_INVALID_TLDS_CHARS');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
exports.isValid = function (domain, options) {
|
||||
|
||||
return !exports.analyze(domain, options);
|
||||
};
|
||||
|
||||
|
||||
internals.punycode = function (domain) {
|
||||
|
||||
try {
|
||||
return new internals.URL(`http://${domain}`).host;
|
||||
}
|
||||
catch (err) {
|
||||
return domain;
|
||||
}
|
||||
};
|
||||
170
node_modules/@sideway/address/lib/email.js
generated
vendored
170
node_modules/@sideway/address/lib/email.js
generated
vendored
@@ -1,170 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const Util = require('util');
|
||||
|
||||
const Domain = require('./domain');
|
||||
const Errors = require('./errors');
|
||||
|
||||
|
||||
const internals = {
|
||||
nonAsciiRx: /[^\x00-\x7f]/,
|
||||
encoder: new (Util.TextEncoder || TextEncoder)() // $lab:coverage:ignore$
|
||||
};
|
||||
|
||||
|
||||
exports.analyze = function (email, options) {
|
||||
|
||||
return internals.email(email, options);
|
||||
};
|
||||
|
||||
|
||||
exports.isValid = function (email, options) {
|
||||
|
||||
return !internals.email(email, options);
|
||||
};
|
||||
|
||||
|
||||
internals.email = function (email, options = {}) {
|
||||
|
||||
if (typeof email !== 'string') {
|
||||
throw new Error('Invalid input: email must be a string');
|
||||
}
|
||||
|
||||
if (!email) {
|
||||
return Errors.code('EMPTY_STRING');
|
||||
}
|
||||
|
||||
// Unicode
|
||||
|
||||
const ascii = !internals.nonAsciiRx.test(email);
|
||||
if (!ascii) {
|
||||
if (options.allowUnicode === false) { // Defaults to true
|
||||
return Errors.code('FORBIDDEN_UNICODE');
|
||||
}
|
||||
|
||||
email = email.normalize('NFC');
|
||||
}
|
||||
|
||||
// Basic structure
|
||||
|
||||
const parts = email.split('@');
|
||||
if (parts.length !== 2) {
|
||||
return parts.length > 2 ? Errors.code('MULTIPLE_AT_CHAR') : Errors.code('MISSING_AT_CHAR');
|
||||
}
|
||||
|
||||
const [local, domain] = parts;
|
||||
|
||||
if (!local) {
|
||||
return Errors.code('EMPTY_LOCAL');
|
||||
}
|
||||
|
||||
if (!options.ignoreLength) {
|
||||
if (email.length > 254) { // http://tools.ietf.org/html/rfc5321#section-4.5.3.1.3
|
||||
return Errors.code('ADDRESS_TOO_LONG');
|
||||
}
|
||||
|
||||
if (internals.encoder.encode(local).length > 64) { // http://tools.ietf.org/html/rfc5321#section-4.5.3.1.1
|
||||
return Errors.code('LOCAL_TOO_LONG');
|
||||
}
|
||||
}
|
||||
|
||||
// Validate parts
|
||||
|
||||
return internals.local(local, ascii) || Domain.analyze(domain, options);
|
||||
};
|
||||
|
||||
|
||||
internals.local = function (local, ascii) {
|
||||
|
||||
const segments = local.split('.');
|
||||
for (const segment of segments) {
|
||||
if (!segment.length) {
|
||||
return Errors.code('EMPTY_LOCAL_SEGMENT');
|
||||
}
|
||||
|
||||
if (ascii) {
|
||||
if (!internals.atextRx.test(segment)) {
|
||||
return Errors.code('INVALID_LOCAL_CHARS');
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const char of segment) {
|
||||
if (internals.atextRx.test(char)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const binary = internals.binary(char);
|
||||
if (!internals.atomRx.test(binary)) {
|
||||
return Errors.code('INVALID_LOCAL_CHARS');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
internals.binary = function (char) {
|
||||
|
||||
return Array.from(internals.encoder.encode(char)).map((v) => String.fromCharCode(v)).join('');
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
From RFC 5321:
|
||||
|
||||
Mailbox = Local-part "@" ( Domain / address-literal )
|
||||
|
||||
Local-part = Dot-string / Quoted-string
|
||||
Dot-string = Atom *("." Atom)
|
||||
Atom = 1*atext
|
||||
atext = ALPHA / DIGIT / "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "/" / "=" / "?" / "^" / "_" / "`" / "{" / "|" / "}" / "~"
|
||||
|
||||
Domain = sub-domain *("." sub-domain)
|
||||
sub-domain = Let-dig [Ldh-str]
|
||||
Let-dig = ALPHA / DIGIT
|
||||
Ldh-str = *( ALPHA / DIGIT / "-" ) Let-dig
|
||||
|
||||
ALPHA = %x41-5A / %x61-7A ; a-z, A-Z
|
||||
DIGIT = %x30-39 ; 0-9
|
||||
|
||||
From RFC 6531:
|
||||
|
||||
sub-domain =/ U-label
|
||||
atext =/ UTF8-non-ascii
|
||||
|
||||
UTF8-non-ascii = UTF8-2 / UTF8-3 / UTF8-4
|
||||
|
||||
UTF8-2 = %xC2-DF UTF8-tail
|
||||
UTF8-3 = %xE0 %xA0-BF UTF8-tail /
|
||||
%xE1-EC 2( UTF8-tail ) /
|
||||
%xED %x80-9F UTF8-tail /
|
||||
%xEE-EF 2( UTF8-tail )
|
||||
UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) /
|
||||
%xF1-F3 3( UTF8-tail ) /
|
||||
%xF4 %x80-8F 2( UTF8-tail )
|
||||
|
||||
UTF8-tail = %x80-BF
|
||||
|
||||
Note: The following are not supported:
|
||||
|
||||
RFC 5321: address-literal, Quoted-string
|
||||
RFC 5322: obs-*, CFWS
|
||||
*/
|
||||
|
||||
|
||||
internals.atextRx = /^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/; // _ included in \w
|
||||
|
||||
|
||||
internals.atomRx = new RegExp([
|
||||
|
||||
// %xC2-DF UTF8-tail
|
||||
'(?:[\\xc2-\\xdf][\\x80-\\xbf])',
|
||||
|
||||
// %xE0 %xA0-BF UTF8-tail %xE1-EC 2( UTF8-tail ) %xED %x80-9F UTF8-tail %xEE-EF 2( UTF8-tail )
|
||||
'(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})',
|
||||
|
||||
// %xF0 %x90-BF 2( UTF8-tail ) %xF1-F3 3( UTF8-tail ) %xF4 %x80-8F 2( UTF8-tail )
|
||||
'(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})'
|
||||
|
||||
].join('|'));
|
||||
29
node_modules/@sideway/address/lib/errors.js
generated
vendored
29
node_modules/@sideway/address/lib/errors.js
generated
vendored
@@ -1,29 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
exports.codes = {
|
||||
EMPTY_STRING: 'Address must be a non-empty string',
|
||||
FORBIDDEN_UNICODE: 'Address contains forbidden Unicode characters',
|
||||
MULTIPLE_AT_CHAR: 'Address cannot contain more than one @ character',
|
||||
MISSING_AT_CHAR: 'Address must contain one @ character',
|
||||
EMPTY_LOCAL: 'Address local part cannot be empty',
|
||||
ADDRESS_TOO_LONG: 'Address too long',
|
||||
LOCAL_TOO_LONG: 'Address local part too long',
|
||||
EMPTY_LOCAL_SEGMENT: 'Address local part contains empty dot-separated segment',
|
||||
INVALID_LOCAL_CHARS: 'Address local part contains invalid character',
|
||||
DOMAIN_NON_EMPTY_STRING: 'Domain must be a non-empty string',
|
||||
DOMAIN_TOO_LONG: 'Domain too long',
|
||||
DOMAIN_INVALID_UNICODE_CHARS: 'Domain contains forbidden Unicode characters',
|
||||
DOMAIN_INVALID_CHARS: 'Domain contains invalid character',
|
||||
DOMAIN_INVALID_TLDS_CHARS: 'Domain contains invalid tld character',
|
||||
DOMAIN_SEGMENTS_COUNT: 'Domain lacks the minimum required number of segments',
|
||||
DOMAIN_SEGMENTS_COUNT_MAX: 'Domain contains too many segments',
|
||||
DOMAIN_FORBIDDEN_TLDS: 'Domain uses forbidden TLD',
|
||||
DOMAIN_EMPTY_SEGMENT: 'Domain contains empty dot-separated segment',
|
||||
DOMAIN_LONG_SEGMENT: 'Domain contains dot-separated segment that is too long'
|
||||
};
|
||||
|
||||
|
||||
exports.code = function (code) {
|
||||
|
||||
return { code, error: exports.codes[code] };
|
||||
};
|
||||
255
node_modules/@sideway/address/lib/index.d.ts
generated
vendored
255
node_modules/@sideway/address/lib/index.d.ts
generated
vendored
@@ -1,255 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as Hoek from '@hapi/hoek';
|
||||
|
||||
|
||||
export namespace domain {
|
||||
|
||||
/**
|
||||
* Analyzes a string to verify it is a valid domain name.
|
||||
*
|
||||
* @param domain - the domain name to validate.
|
||||
* @param options - optional settings.
|
||||
*
|
||||
* @return - undefined when valid, otherwise an object with single error key with a string message value.
|
||||
*/
|
||||
function analyze(domain: string, options?: Options): Analysis | null;
|
||||
|
||||
/**
|
||||
* Analyzes a string to verify it is a valid domain name.
|
||||
*
|
||||
* @param domain - the domain name to validate.
|
||||
* @param options - optional settings.
|
||||
*
|
||||
* @return - true when valid, otherwise false.
|
||||
*/
|
||||
function isValid(domain: string, options?: Options): boolean;
|
||||
|
||||
interface Options {
|
||||
|
||||
/**
|
||||
* Determines whether Unicode characters are allowed.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
readonly allowUnicode?: boolean;
|
||||
|
||||
/**
|
||||
* The minimum number of domain segments (e.g. `x.y.z` has 3 segments) required.
|
||||
*
|
||||
* @default 2
|
||||
*/
|
||||
readonly minDomainSegments?: number;
|
||||
|
||||
/**
|
||||
* Top-level-domain options
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
readonly tlds?: Tlds.Allow | Tlds.Deny | boolean;
|
||||
}
|
||||
|
||||
namespace Tlds {
|
||||
|
||||
interface Allow {
|
||||
|
||||
readonly allow: Set<string> | true;
|
||||
}
|
||||
|
||||
interface Deny {
|
||||
|
||||
readonly deny: Set<string>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export namespace email {
|
||||
|
||||
/**
|
||||
* Analyzes a string to verify it is a valid email address.
|
||||
*
|
||||
* @param email - the email address to validate.
|
||||
* @param options - optional settings.
|
||||
*
|
||||
* @return - undefined when valid, otherwise an object with single error key with a string message value.
|
||||
*/
|
||||
function analyze(email: string, options?: Options): Analysis | null;
|
||||
|
||||
/**
|
||||
* Analyzes a string to verify it is a valid email address.
|
||||
*
|
||||
* @param email - the email address to validate.
|
||||
* @param options - optional settings.
|
||||
*
|
||||
* @return - true when valid, otherwise false.
|
||||
*/
|
||||
function isValid(email: string, options?: Options): boolean;
|
||||
|
||||
interface Options extends domain.Options {
|
||||
|
||||
/**
|
||||
* Determines whether to ignore the standards maximum email length limit.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly ignoreLength?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export interface Analysis {
|
||||
|
||||
/**
|
||||
* The reason validation failed.
|
||||
*/
|
||||
error: string;
|
||||
|
||||
/**
|
||||
* The error code.
|
||||
*/
|
||||
code: string;
|
||||
}
|
||||
|
||||
|
||||
export const errors: Record<string, string>;
|
||||
|
||||
|
||||
export namespace ip {
|
||||
|
||||
/**
|
||||
* Generates a regular expression used to validate IP addresses.
|
||||
*
|
||||
* @param options - optional settings.
|
||||
*
|
||||
* @returns an object with the regular expression and meta data.
|
||||
*/
|
||||
function regex(options?: Options): Expression;
|
||||
|
||||
interface Options {
|
||||
|
||||
/**
|
||||
* The required CIDR mode.
|
||||
*
|
||||
* @default 'optional'
|
||||
*/
|
||||
readonly cidr?: Cidr;
|
||||
|
||||
/**
|
||||
* The allowed versions.
|
||||
*
|
||||
* @default ['ipv4', 'ipv6', 'ipvfuture']
|
||||
*/
|
||||
readonly version?: Version | Version[];
|
||||
}
|
||||
|
||||
type Cidr = 'optional' | 'required' | 'forbidden';
|
||||
type Version = 'ipv4' | 'ipv6' | 'ipvfuture';
|
||||
|
||||
interface Expression {
|
||||
|
||||
/**
|
||||
* The CIDR mode.
|
||||
*/
|
||||
cidr: Cidr;
|
||||
|
||||
/**
|
||||
* The raw regular expression string.
|
||||
*/
|
||||
raw: string;
|
||||
|
||||
/**
|
||||
* The regular expression.
|
||||
*/
|
||||
regex: RegExp;
|
||||
|
||||
/**
|
||||
* The array of versions allowed.
|
||||
*/
|
||||
versions: Version[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export namespace uri {
|
||||
|
||||
/**
|
||||
* Faster version of decodeURIComponent() that does not throw.
|
||||
*
|
||||
* @param string - the URL string to decode.
|
||||
*
|
||||
* @returns the decoded string or null if invalid.
|
||||
*/
|
||||
function decode(string: string): string | null;
|
||||
|
||||
/**
|
||||
* Generates a regular expression used to validate URI addresses.
|
||||
*
|
||||
* @param options - optional settings.
|
||||
*
|
||||
* @returns an object with the regular expression and meta data.
|
||||
*/
|
||||
function regex(options?: Options): Expression;
|
||||
|
||||
type Options = Hoek.ts.XOR<Options.Options, Options.Relative>;
|
||||
|
||||
namespace Options {
|
||||
|
||||
interface Query {
|
||||
|
||||
/**
|
||||
* Allow the use of [] in query parameters.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly allowQuerySquareBrackets?: boolean;
|
||||
}
|
||||
|
||||
interface Relative extends Query {
|
||||
|
||||
/**
|
||||
* Requires the URI to be relative.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly relativeOnly?: boolean;
|
||||
}
|
||||
|
||||
interface Options extends Query {
|
||||
|
||||
/**
|
||||
* Allow relative URIs.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly allowRelative?: boolean;
|
||||
|
||||
/**
|
||||
* Capture domain segment ($1).
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly domain?: boolean;
|
||||
|
||||
/**
|
||||
* The allowed URI schemes.
|
||||
*/
|
||||
readonly scheme?: Scheme | Scheme[];
|
||||
}
|
||||
|
||||
type Scheme = string | RegExp;
|
||||
}
|
||||
|
||||
interface Expression {
|
||||
|
||||
/**
|
||||
* The raw regular expression string.
|
||||
*/
|
||||
raw: string;
|
||||
|
||||
/**
|
||||
* The regular expression.
|
||||
*/
|
||||
regex: RegExp;
|
||||
}
|
||||
}
|
||||
97
node_modules/@sideway/address/lib/index.js
generated
vendored
97
node_modules/@sideway/address/lib/index.js
generated
vendored
@@ -1,97 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const Decode = require('./decode');
|
||||
const Domain = require('./domain');
|
||||
const Email = require('./email');
|
||||
const Errors = require('./errors');
|
||||
const Ip = require('./ip');
|
||||
const Tlds = require('./tlds');
|
||||
const Uri = require('./uri');
|
||||
|
||||
|
||||
const internals = {
|
||||
defaultTlds: { allow: Tlds, deny: null }
|
||||
};
|
||||
|
||||
|
||||
module.exports = {
|
||||
errors: Errors.codes,
|
||||
|
||||
domain: {
|
||||
analyze(domain, options) {
|
||||
|
||||
options = internals.options(options);
|
||||
return Domain.analyze(domain, options);
|
||||
},
|
||||
|
||||
isValid(domain, options) {
|
||||
|
||||
options = internals.options(options);
|
||||
return Domain.isValid(domain, options);
|
||||
}
|
||||
},
|
||||
email: {
|
||||
analyze(email, options) {
|
||||
|
||||
options = internals.options(options);
|
||||
return Email.analyze(email, options);
|
||||
},
|
||||
|
||||
isValid(email, options) {
|
||||
|
||||
options = internals.options(options);
|
||||
return Email.isValid(email, options);
|
||||
}
|
||||
},
|
||||
ip: {
|
||||
regex: Ip.regex
|
||||
},
|
||||
uri: {
|
||||
decode: Decode.decode,
|
||||
regex: Uri.regex
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
internals.options = function (options) {
|
||||
|
||||
if (!options) {
|
||||
return { tlds: internals.defaultTlds };
|
||||
}
|
||||
|
||||
if (options.tlds === false) { // Defaults to true
|
||||
return options;
|
||||
}
|
||||
|
||||
if (!options.tlds ||
|
||||
options.tlds === true) {
|
||||
|
||||
return Object.assign({}, options, { tlds: internals.defaultTlds });
|
||||
}
|
||||
|
||||
if (typeof options.tlds !== 'object') {
|
||||
throw new Error('Invalid options: tlds must be a boolean or an object');
|
||||
}
|
||||
|
||||
if (options.tlds.deny) {
|
||||
if (options.tlds.deny instanceof Set === false) {
|
||||
throw new Error('Invalid options: tlds.deny must be a Set object');
|
||||
}
|
||||
|
||||
if (options.tlds.allow) {
|
||||
throw new Error('Invalid options: cannot specify both tlds.allow and tlds.deny lists');
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
if (options.tlds.allow === true) {
|
||||
return Object.assign({}, options, { tlds: internals.defaultTlds });
|
||||
}
|
||||
|
||||
if (options.tlds.allow instanceof Set === false) {
|
||||
throw new Error('Invalid options: tlds.allow must be a Set object or true');
|
||||
}
|
||||
|
||||
return options;
|
||||
};
|
||||
63
node_modules/@sideway/address/lib/ip.js
generated
vendored
63
node_modules/@sideway/address/lib/ip.js
generated
vendored
@@ -1,63 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const Assert = require('@hapi/hoek/lib/assert');
|
||||
|
||||
const Uri = require('./uri');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
exports.regex = function (options = {}) {
|
||||
|
||||
// CIDR
|
||||
|
||||
Assert(options.cidr === undefined || typeof options.cidr === 'string', 'options.cidr must be a string');
|
||||
const cidr = options.cidr ? options.cidr.toLowerCase() : 'optional';
|
||||
Assert(['required', 'optional', 'forbidden'].includes(cidr), 'options.cidr must be one of required, optional, forbidden');
|
||||
|
||||
// Versions
|
||||
|
||||
Assert(options.version === undefined || typeof options.version === 'string' || Array.isArray(options.version), 'options.version must be a string or an array of string');
|
||||
let versions = options.version || ['ipv4', 'ipv6', 'ipvfuture'];
|
||||
if (!Array.isArray(versions)) {
|
||||
versions = [versions];
|
||||
}
|
||||
|
||||
Assert(versions.length >= 1, 'options.version must have at least 1 version specified');
|
||||
|
||||
for (let i = 0; i < versions.length; ++i) {
|
||||
Assert(typeof versions[i] === 'string', 'options.version must only contain strings');
|
||||
versions[i] = versions[i].toLowerCase();
|
||||
Assert(['ipv4', 'ipv6', 'ipvfuture'].includes(versions[i]), 'options.version contains unknown version ' + versions[i] + ' - must be one of ipv4, ipv6, ipvfuture');
|
||||
}
|
||||
|
||||
versions = Array.from(new Set(versions));
|
||||
|
||||
// Regex
|
||||
|
||||
const parts = versions.map((version) => {
|
||||
|
||||
// Forbidden
|
||||
|
||||
if (cidr === 'forbidden') {
|
||||
return Uri.ip[version];
|
||||
}
|
||||
|
||||
// Required
|
||||
|
||||
const cidrpart = `\\/${version === 'ipv4' ? Uri.ip.v4Cidr : Uri.ip.v6Cidr}`;
|
||||
|
||||
if (cidr === 'required') {
|
||||
return `${Uri.ip[version]}${cidrpart}`;
|
||||
}
|
||||
|
||||
// Optional
|
||||
|
||||
return `${Uri.ip[version]}(?:${cidrpart})?`;
|
||||
});
|
||||
|
||||
const raw = `(?:${parts.join('|')})`;
|
||||
const regex = new RegExp(`^${raw}$`);
|
||||
return { cidr, versions, regex, raw };
|
||||
};
|
||||
1520
node_modules/@sideway/address/lib/tlds.js
generated
vendored
1520
node_modules/@sideway/address/lib/tlds.js
generated
vendored
File diff suppressed because it is too large
Load Diff
207
node_modules/@sideway/address/lib/uri.js
generated
vendored
207
node_modules/@sideway/address/lib/uri.js
generated
vendored
@@ -1,207 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const Assert = require('@hapi/hoek/lib/assert');
|
||||
const EscapeRegex = require('@hapi/hoek/lib/escapeRegex');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
internals.generate = function () {
|
||||
|
||||
const rfc3986 = {};
|
||||
|
||||
const hexDigit = '\\dA-Fa-f'; // HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
|
||||
const hexDigitOnly = '[' + hexDigit + ']';
|
||||
|
||||
const unreserved = '\\w-\\.~'; // unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
||||
const subDelims = '!\\$&\'\\(\\)\\*\\+,;='; // sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
|
||||
const pctEncoded = '%' + hexDigit; // pct-encoded = "%" HEXDIG HEXDIG
|
||||
const pchar = unreserved + pctEncoded + subDelims + ':@'; // pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
||||
const pcharOnly = '[' + pchar + ']';
|
||||
const decOctect = '(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])'; // dec-octet = DIGIT / %x31-39 DIGIT / "1" 2DIGIT / "2" %x30-34 DIGIT / "25" %x30-35 ; 0-9 / 10-99 / 100-199 / 200-249 / 250-255
|
||||
|
||||
rfc3986.ipv4address = '(?:' + decOctect + '\\.){3}' + decOctect; // IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
|
||||
|
||||
/*
|
||||
h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal
|
||||
ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address
|
||||
IPv6address = 6( h16 ":" ) ls32
|
||||
/ "::" 5( h16 ":" ) ls32
|
||||
/ [ h16 ] "::" 4( h16 ":" ) ls32
|
||||
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
|
||||
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
|
||||
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
|
||||
/ [ *4( h16 ":" ) h16 ] "::" ls32
|
||||
/ [ *5( h16 ":" ) h16 ] "::" h16
|
||||
/ [ *6( h16 ":" ) h16 ] "::"
|
||||
*/
|
||||
|
||||
const h16 = hexDigitOnly + '{1,4}';
|
||||
const ls32 = '(?:' + h16 + ':' + h16 + '|' + rfc3986.ipv4address + ')';
|
||||
const IPv6SixHex = '(?:' + h16 + ':){6}' + ls32;
|
||||
const IPv6FiveHex = '::(?:' + h16 + ':){5}' + ls32;
|
||||
const IPv6FourHex = '(?:' + h16 + ')?::(?:' + h16 + ':){4}' + ls32;
|
||||
const IPv6ThreeHex = '(?:(?:' + h16 + ':){0,1}' + h16 + ')?::(?:' + h16 + ':){3}' + ls32;
|
||||
const IPv6TwoHex = '(?:(?:' + h16 + ':){0,2}' + h16 + ')?::(?:' + h16 + ':){2}' + ls32;
|
||||
const IPv6OneHex = '(?:(?:' + h16 + ':){0,3}' + h16 + ')?::' + h16 + ':' + ls32;
|
||||
const IPv6NoneHex = '(?:(?:' + h16 + ':){0,4}' + h16 + ')?::' + ls32;
|
||||
const IPv6NoneHex2 = '(?:(?:' + h16 + ':){0,5}' + h16 + ')?::' + h16;
|
||||
const IPv6NoneHex3 = '(?:(?:' + h16 + ':){0,6}' + h16 + ')?::';
|
||||
|
||||
rfc3986.ipv4Cidr = '(?:\\d|[1-2]\\d|3[0-2])'; // IPv4 cidr = DIGIT / %x31-32 DIGIT / "3" %x30-32 ; 0-9 / 10-29 / 30-32
|
||||
rfc3986.ipv6Cidr = '(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])'; // IPv6 cidr = DIGIT / %x31-39 DIGIT / "1" %x0-1 DIGIT / "12" %x0-8; 0-9 / 10-99 / 100-119 / 120-128
|
||||
rfc3986.ipv6address = '(?:' + IPv6SixHex + '|' + IPv6FiveHex + '|' + IPv6FourHex + '|' + IPv6ThreeHex + '|' + IPv6TwoHex + '|' + IPv6OneHex + '|' + IPv6NoneHex + '|' + IPv6NoneHex2 + '|' + IPv6NoneHex3 + ')';
|
||||
rfc3986.ipvFuture = 'v' + hexDigitOnly + '+\\.[' + unreserved + subDelims + ':]+'; // IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
|
||||
|
||||
rfc3986.scheme = '[a-zA-Z][a-zA-Z\\d+-\\.]*'; // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
|
||||
rfc3986.schemeRegex = new RegExp(rfc3986.scheme);
|
||||
|
||||
const userinfo = '[' + unreserved + pctEncoded + subDelims + ':]*'; // userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
|
||||
const IPLiteral = '\\[(?:' + rfc3986.ipv6address + '|' + rfc3986.ipvFuture + ')\\]'; // IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
||||
const regName = '[' + unreserved + pctEncoded + subDelims + ']{1,255}'; // reg-name = *( unreserved / pct-encoded / sub-delims )
|
||||
const host = '(?:' + IPLiteral + '|' + rfc3986.ipv4address + '|' + regName + ')'; // host = IP-literal / IPv4address / reg-name
|
||||
const port = '\\d*'; // port = *DIGIT
|
||||
const authority = '(?:' + userinfo + '@)?' + host + '(?::' + port + ')?'; // authority = [ userinfo "@" ] host [ ":" port ]
|
||||
const authorityCapture = '(?:' + userinfo + '@)?(' + host + ')(?::' + port + ')?';
|
||||
|
||||
/*
|
||||
segment = *pchar
|
||||
segment-nz = 1*pchar
|
||||
path = path-abempty ; begins with "/" '|' is empty
|
||||
/ path-absolute ; begins with "/" but not "//"
|
||||
/ path-noscheme ; begins with a non-colon segment
|
||||
/ path-rootless ; begins with a segment
|
||||
/ path-empty ; zero characters
|
||||
path-abempty = *( "/" segment )
|
||||
path-absolute = "/" [ segment-nz *( "/" segment ) ]
|
||||
path-rootless = segment-nz *( "/" segment )
|
||||
*/
|
||||
|
||||
const segment = pcharOnly + '*';
|
||||
const segmentNz = pcharOnly + '+';
|
||||
const segmentNzNc = '[' + unreserved + pctEncoded + subDelims + '@' + ']+';
|
||||
const pathEmpty = '';
|
||||
const pathAbEmpty = '(?:\\/' + segment + ')*';
|
||||
const pathAbsolute = '\\/(?:' + segmentNz + pathAbEmpty + ')?';
|
||||
const pathRootless = segmentNz + pathAbEmpty;
|
||||
const pathNoScheme = segmentNzNc + pathAbEmpty;
|
||||
const pathAbNoAuthority = '(?:\\/\\/\\/' + segment + pathAbEmpty + ')'; // Used by file:///
|
||||
|
||||
// hier-part = "//" authority path
|
||||
|
||||
rfc3986.hierPart = '(?:' + '(?:\\/\\/' + authority + pathAbEmpty + ')' + '|' + pathAbsolute + '|' + pathRootless + '|' + pathAbNoAuthority + ')';
|
||||
rfc3986.hierPartCapture = '(?:' + '(?:\\/\\/' + authorityCapture + pathAbEmpty + ')' + '|' + pathAbsolute + '|' + pathRootless + ')';
|
||||
|
||||
// relative-part = "//" authority path-abempty / path-absolute / path-noscheme / path-empty
|
||||
|
||||
rfc3986.relativeRef = '(?:' + '(?:\\/\\/' + authority + pathAbEmpty + ')' + '|' + pathAbsolute + '|' + pathNoScheme + '|' + pathEmpty + ')';
|
||||
rfc3986.relativeRefCapture = '(?:' + '(?:\\/\\/' + authorityCapture + pathAbEmpty + ')' + '|' + pathAbsolute + '|' + pathNoScheme + '|' + pathEmpty + ')';
|
||||
|
||||
// query = *( pchar / "/" / "?" )
|
||||
// query = *( pchar / "[" / "]" / "/" / "?" )
|
||||
|
||||
rfc3986.query = '[' + pchar + '\\/\\?]*(?=#|$)'; //Finish matching either at the fragment part '|' end of the line.
|
||||
rfc3986.queryWithSquareBrackets = '[' + pchar + '\\[\\]\\/\\?]*(?=#|$)';
|
||||
|
||||
// fragment = *( pchar / "/" / "?" )
|
||||
|
||||
rfc3986.fragment = '[' + pchar + '\\/\\?]*';
|
||||
|
||||
return rfc3986;
|
||||
};
|
||||
|
||||
internals.rfc3986 = internals.generate();
|
||||
|
||||
|
||||
exports.ip = {
|
||||
v4Cidr: internals.rfc3986.ipv4Cidr,
|
||||
v6Cidr: internals.rfc3986.ipv6Cidr,
|
||||
ipv4: internals.rfc3986.ipv4address,
|
||||
ipv6: internals.rfc3986.ipv6address,
|
||||
ipvfuture: internals.rfc3986.ipvFuture
|
||||
};
|
||||
|
||||
|
||||
internals.createRegex = function (options) {
|
||||
|
||||
const rfc = internals.rfc3986;
|
||||
|
||||
// Construct expression
|
||||
|
||||
const query = options.allowQuerySquareBrackets ? rfc.queryWithSquareBrackets : rfc.query;
|
||||
const suffix = '(?:\\?' + query + ')?' + '(?:#' + rfc.fragment + ')?';
|
||||
|
||||
// relative-ref = relative-part [ "?" query ] [ "#" fragment ]
|
||||
|
||||
const relative = options.domain ? rfc.relativeRefCapture : rfc.relativeRef;
|
||||
|
||||
if (options.relativeOnly) {
|
||||
return internals.wrap(relative + suffix);
|
||||
}
|
||||
|
||||
// Custom schemes
|
||||
|
||||
let customScheme = '';
|
||||
if (options.scheme) {
|
||||
Assert(options.scheme instanceof RegExp || typeof options.scheme === 'string' || Array.isArray(options.scheme), 'scheme must be a RegExp, String, or Array');
|
||||
|
||||
const schemes = [].concat(options.scheme);
|
||||
Assert(schemes.length >= 1, 'scheme must have at least 1 scheme specified');
|
||||
|
||||
// Flatten the array into a string to be used to match the schemes
|
||||
|
||||
const selections = [];
|
||||
for (let i = 0; i < schemes.length; ++i) {
|
||||
const scheme = schemes[i];
|
||||
Assert(scheme instanceof RegExp || typeof scheme === 'string', 'scheme at position ' + i + ' must be a RegExp or String');
|
||||
|
||||
if (scheme instanceof RegExp) {
|
||||
selections.push(scheme.source.toString());
|
||||
}
|
||||
else {
|
||||
Assert(rfc.schemeRegex.test(scheme), 'scheme at position ' + i + ' must be a valid scheme');
|
||||
selections.push(EscapeRegex(scheme));
|
||||
}
|
||||
}
|
||||
|
||||
customScheme = selections.join('|');
|
||||
}
|
||||
|
||||
// URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
||||
|
||||
const scheme = customScheme ? '(?:' + customScheme + ')' : rfc.scheme;
|
||||
const absolute = '(?:' + scheme + ':' + (options.domain ? rfc.hierPartCapture : rfc.hierPart) + ')';
|
||||
const prefix = options.allowRelative ? '(?:' + absolute + '|' + relative + ')' : absolute;
|
||||
return internals.wrap(prefix + suffix, customScheme);
|
||||
};
|
||||
|
||||
|
||||
internals.wrap = function (raw, scheme) {
|
||||
|
||||
raw = `(?=.)(?!https?\:/$)${raw}`; // Require at least one character and explicitly forbid 'http:/'
|
||||
|
||||
return {
|
||||
raw,
|
||||
regex: new RegExp(`^${raw}$`),
|
||||
scheme
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
internals.uriRegex = internals.createRegex({});
|
||||
|
||||
|
||||
exports.regex = function (options = {}) {
|
||||
|
||||
if (options.scheme ||
|
||||
options.allowRelative ||
|
||||
options.relativeOnly ||
|
||||
options.allowQuerySquareBrackets ||
|
||||
options.domain) {
|
||||
|
||||
return internals.createRegex(options);
|
||||
}
|
||||
|
||||
return internals.uriRegex;
|
||||
};
|
||||
63
node_modules/@sideway/address/package.json
generated
vendored
63
node_modules/@sideway/address/package.json
generated
vendored
@@ -1,63 +0,0 @@
|
||||
{
|
||||
"_from": "@sideway/address@^4.1.0",
|
||||
"_id": "@sideway/address@4.1.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-idTz8ibqWFrPU8kMirL0CoPH/A29XOzzAzpyN3zQ4kAWnzmNfFmRaoMNN6VI8ske5M73HZyhIaW4OuSFIdM4oA==",
|
||||
"_location": "/@sideway/address",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@sideway/address@^4.1.0",
|
||||
"name": "@sideway/address",
|
||||
"escapedName": "@sideway%2faddress",
|
||||
"scope": "@sideway",
|
||||
"rawSpec": "^4.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/joi"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.2.tgz",
|
||||
"_shasum": "811b84333a335739d3969cfc434736268170cad1",
|
||||
"_spec": "@sideway/address@^4.1.0",
|
||||
"_where": "C:\\Users\\anelissen\\Development\\tools\\node\\cbor\\node_modules\\joi",
|
||||
"bugs": {
|
||||
"url": "https://github.com/sideway/address/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@hapi/hoek": "^9.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Email address and domain validation",
|
||||
"devDependencies": {
|
||||
"@hapi/code": "8.x.x",
|
||||
"@hapi/lab": "24.x.x",
|
||||
"typescript": "4.0.x"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/sideway/address#readme",
|
||||
"keywords": [
|
||||
"email",
|
||||
"domain",
|
||||
"address",
|
||||
"validation"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "lib/index.js",
|
||||
"name": "@sideway/address",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/sideway/address.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "lab -a @hapi/code -t 100 -L -Y",
|
||||
"test-cov-html": "lab -a @hapi/code -t 100 -L -r html -o coverage.html"
|
||||
},
|
||||
"types": "lib/index.d.ts",
|
||||
"version": "4.1.2"
|
||||
}
|
||||
9
node_modules/@sideway/formula/LICENSE.md
generated
vendored
9
node_modules/@sideway/formula/LICENSE.md
generated
vendored
@@ -1,9 +0,0 @@
|
||||
Copyright (c) 2019-2020, Sideway. Inc, and project contributors
|
||||
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.
|
||||
* The names of any contributors may not 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS 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.
|
||||
18
node_modules/@sideway/formula/README.md
generated
vendored
18
node_modules/@sideway/formula/README.md
generated
vendored
@@ -1,18 +0,0 @@
|
||||
# @sideway/formula
|
||||
|
||||
#### Math and string formula parser.
|
||||
|
||||
**formula** is part of the **joi** ecosystem.
|
||||
|
||||
### Visit the [joi.dev](https://joi.dev) Developer Portal for tutorials, documentation, and support
|
||||
|
||||
## Useful resources
|
||||
|
||||
- [Documentation and API](https://joi.dev/module/formula/)
|
||||
- [Version status](https://joi.dev/resources/status/#formula) (builds, dependencies, node versions, licenses, eol)
|
||||
- [Changelog](https://joi.dev/module/formula/changelog/)
|
||||
- [Project policies](https://joi.dev/policies/)
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
Inspired by [**fparse**](https://github.com/bylexus/fparse), copyright 2012-2018 Alexander Schenkel <alex@alexi.ch>
|
||||
52
node_modules/@sideway/formula/lib/index.d.ts
generated
vendored
52
node_modules/@sideway/formula/lib/index.d.ts
generated
vendored
@@ -1,52 +0,0 @@
|
||||
/**
|
||||
* Formula parser
|
||||
*/
|
||||
export class Parser<T extends (string | number)> {
|
||||
|
||||
/**
|
||||
* Create a new formula parser.
|
||||
*
|
||||
* @param formula - the formula string to parse.
|
||||
* @param options - optional settings.
|
||||
*/
|
||||
constructor(formula: string, options?: Options);
|
||||
|
||||
/**
|
||||
* Evaluate the formula.
|
||||
*
|
||||
* @param context - optional object with runtime formula context used to resolve variables.
|
||||
*
|
||||
* @returns the string or number outcome of the resolved formula.
|
||||
*/
|
||||
evaluate(context?: any): T;
|
||||
}
|
||||
|
||||
|
||||
export interface Options {
|
||||
|
||||
/**
|
||||
* A hash of key - value pairs used to convert constants to values.
|
||||
*/
|
||||
readonly constants?: Record<string, any>;
|
||||
|
||||
/**
|
||||
* A regular expression used to validate token variables.
|
||||
*/
|
||||
readonly tokenRx?: RegExp;
|
||||
|
||||
/**
|
||||
* A variable resolver factory function.
|
||||
*/
|
||||
readonly reference?: Options.Reference;
|
||||
|
||||
/**
|
||||
* A hash of key-value pairs used to resolve formula functions.
|
||||
*/
|
||||
readonly functions?: Record<string, Function>;
|
||||
}
|
||||
|
||||
|
||||
export namespace Options {
|
||||
|
||||
type Reference = (name: string) => (context: any) => any;
|
||||
}
|
||||
456
node_modules/@sideway/formula/lib/index.js
generated
vendored
456
node_modules/@sideway/formula/lib/index.js
generated
vendored
@@ -1,456 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {
|
||||
operators: ['!', '^', '*', '/', '%', '+', '-', '<', '<=', '>', '>=', '==', '!=', '&&', '||', '??'],
|
||||
operatorCharacters: ['!', '^', '*', '/', '%', '+', '-', '<', '=', '>', '&', '|', '?'],
|
||||
operatorsOrder: [['^'], ['*', '/', '%'], ['+', '-'], ['<', '<=', '>', '>='], ['==', '!='], ['&&'], ['||', '??']],
|
||||
operatorsPrefix: ['!', 'n'],
|
||||
|
||||
literals: {
|
||||
'"': '"',
|
||||
'`': '`',
|
||||
'\'': '\'',
|
||||
'[': ']'
|
||||
},
|
||||
|
||||
numberRx: /^(?:[0-9]*\.?[0-9]*){1}$/,
|
||||
tokenRx: /^[\w\$\#\.\@\:\{\}]+$/,
|
||||
|
||||
symbol: Symbol('formula'),
|
||||
settings: Symbol('settings')
|
||||
};
|
||||
|
||||
|
||||
exports.Parser = class {
|
||||
|
||||
constructor(string, options = {}) {
|
||||
|
||||
if (!options[internals.settings] &&
|
||||
options.constants) {
|
||||
|
||||
for (const constant in options.constants) {
|
||||
const value = options.constants[constant];
|
||||
if (value !== null &&
|
||||
!['boolean', 'number', 'string'].includes(typeof value)) {
|
||||
|
||||
throw new Error(`Formula constant ${constant} contains invalid ${typeof value} value type`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.settings = options[internals.settings] ? options : Object.assign({ [internals.settings]: true, constants: {}, functions: {} }, options);
|
||||
this.single = null;
|
||||
|
||||
this._parts = null;
|
||||
this._parse(string);
|
||||
}
|
||||
|
||||
_parse(string) {
|
||||
|
||||
let parts = [];
|
||||
let current = '';
|
||||
let parenthesis = 0;
|
||||
let literal = false;
|
||||
|
||||
const flush = (inner) => {
|
||||
|
||||
if (parenthesis) {
|
||||
throw new Error('Formula missing closing parenthesis');
|
||||
}
|
||||
|
||||
const last = parts.length ? parts[parts.length - 1] : null;
|
||||
|
||||
if (!literal &&
|
||||
!current &&
|
||||
!inner) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (last &&
|
||||
last.type === 'reference' &&
|
||||
inner === ')') { // Function
|
||||
|
||||
last.type = 'function';
|
||||
last.value = this._subFormula(current, last.value);
|
||||
current = '';
|
||||
return;
|
||||
}
|
||||
|
||||
if (inner === ')') { // Segment
|
||||
const sub = new exports.Parser(current, this.settings);
|
||||
parts.push({ type: 'segment', value: sub });
|
||||
}
|
||||
else if (literal) {
|
||||
if (literal === ']') { // Reference
|
||||
parts.push({ type: 'reference', value: current });
|
||||
current = '';
|
||||
return;
|
||||
}
|
||||
|
||||
parts.push({ type: 'literal', value: current }); // Literal
|
||||
}
|
||||
else if (internals.operatorCharacters.includes(current)) { // Operator
|
||||
if (last &&
|
||||
last.type === 'operator' &&
|
||||
internals.operators.includes(last.value + current)) { // 2 characters operator
|
||||
|
||||
last.value += current;
|
||||
}
|
||||
else {
|
||||
parts.push({ type: 'operator', value: current });
|
||||
}
|
||||
}
|
||||
else if (current.match(internals.numberRx)) { // Number
|
||||
parts.push({ type: 'constant', value: parseFloat(current) });
|
||||
}
|
||||
else if (this.settings.constants[current] !== undefined) { // Constant
|
||||
parts.push({ type: 'constant', value: this.settings.constants[current] });
|
||||
}
|
||||
else { // Reference
|
||||
if (!current.match(internals.tokenRx)) {
|
||||
throw new Error(`Formula contains invalid token: ${current}`);
|
||||
}
|
||||
|
||||
parts.push({ type: 'reference', value: current });
|
||||
}
|
||||
|
||||
current = '';
|
||||
};
|
||||
|
||||
for (const c of string) {
|
||||
if (literal) {
|
||||
if (c === literal) {
|
||||
flush();
|
||||
literal = false;
|
||||
}
|
||||
else {
|
||||
current += c;
|
||||
}
|
||||
}
|
||||
else if (parenthesis) {
|
||||
if (c === '(') {
|
||||
current += c;
|
||||
++parenthesis;
|
||||
}
|
||||
else if (c === ')') {
|
||||
--parenthesis;
|
||||
if (!parenthesis) {
|
||||
flush(c);
|
||||
}
|
||||
else {
|
||||
current += c;
|
||||
}
|
||||
}
|
||||
else {
|
||||
current += c;
|
||||
}
|
||||
}
|
||||
else if (c in internals.literals) {
|
||||
literal = internals.literals[c];
|
||||
}
|
||||
else if (c === '(') {
|
||||
flush();
|
||||
++parenthesis;
|
||||
}
|
||||
else if (internals.operatorCharacters.includes(c)) {
|
||||
flush();
|
||||
current = c;
|
||||
flush();
|
||||
}
|
||||
else if (c !== ' ') {
|
||||
current += c;
|
||||
}
|
||||
else {
|
||||
flush();
|
||||
}
|
||||
}
|
||||
|
||||
flush();
|
||||
|
||||
// Replace prefix - to internal negative operator
|
||||
|
||||
parts = parts.map((part, i) => {
|
||||
|
||||
if (part.type !== 'operator' ||
|
||||
part.value !== '-' ||
|
||||
i && parts[i - 1].type !== 'operator') {
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
return { type: 'operator', value: 'n' };
|
||||
});
|
||||
|
||||
// Validate tokens order
|
||||
|
||||
let operator = false;
|
||||
for (const part of parts) {
|
||||
if (part.type === 'operator') {
|
||||
if (internals.operatorsPrefix.includes(part.value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!operator) {
|
||||
throw new Error('Formula contains an operator in invalid position');
|
||||
}
|
||||
|
||||
if (!internals.operators.includes(part.value)) {
|
||||
throw new Error(`Formula contains an unknown operator ${part.value}`);
|
||||
}
|
||||
}
|
||||
else if (operator) {
|
||||
throw new Error('Formula missing expected operator');
|
||||
}
|
||||
|
||||
operator = !operator;
|
||||
}
|
||||
|
||||
if (!operator) {
|
||||
throw new Error('Formula contains invalid trailing operator');
|
||||
}
|
||||
|
||||
// Identify single part
|
||||
|
||||
if (parts.length === 1 &&
|
||||
['reference', 'literal', 'constant'].includes(parts[0].type)) {
|
||||
|
||||
this.single = { type: parts[0].type === 'reference' ? 'reference' : 'value', value: parts[0].value };
|
||||
}
|
||||
|
||||
// Process parts
|
||||
|
||||
this._parts = parts.map((part) => {
|
||||
|
||||
// Operators
|
||||
|
||||
if (part.type === 'operator') {
|
||||
return internals.operatorsPrefix.includes(part.value) ? part : part.value;
|
||||
}
|
||||
|
||||
// Literals, constants, segments
|
||||
|
||||
if (part.type !== 'reference') {
|
||||
return part.value;
|
||||
}
|
||||
|
||||
// References
|
||||
|
||||
if (this.settings.tokenRx &&
|
||||
!this.settings.tokenRx.test(part.value)) {
|
||||
|
||||
throw new Error(`Formula contains invalid reference ${part.value}`);
|
||||
}
|
||||
|
||||
if (this.settings.reference) {
|
||||
return this.settings.reference(part.value);
|
||||
}
|
||||
|
||||
return internals.reference(part.value);
|
||||
});
|
||||
}
|
||||
|
||||
_subFormula(string, name) {
|
||||
|
||||
const method = this.settings.functions[name];
|
||||
if (typeof method !== 'function') {
|
||||
throw new Error(`Formula contains unknown function ${name}`);
|
||||
}
|
||||
|
||||
let args = [];
|
||||
if (string) {
|
||||
let current = '';
|
||||
let parenthesis = 0;
|
||||
let literal = false;
|
||||
|
||||
const flush = () => {
|
||||
|
||||
if (!current) {
|
||||
throw new Error(`Formula contains function ${name} with invalid arguments ${string}`);
|
||||
}
|
||||
|
||||
args.push(current);
|
||||
current = '';
|
||||
};
|
||||
|
||||
for (let i = 0; i < string.length; ++i) {
|
||||
const c = string[i];
|
||||
if (literal) {
|
||||
current += c;
|
||||
if (c === literal) {
|
||||
literal = false;
|
||||
}
|
||||
}
|
||||
else if (c in internals.literals &&
|
||||
!parenthesis) {
|
||||
|
||||
current += c;
|
||||
literal = internals.literals[c];
|
||||
}
|
||||
else if (c === ',' &&
|
||||
!parenthesis) {
|
||||
|
||||
flush();
|
||||
}
|
||||
else {
|
||||
current += c;
|
||||
if (c === '(') {
|
||||
++parenthesis;
|
||||
}
|
||||
else if (c === ')') {
|
||||
--parenthesis;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flush();
|
||||
}
|
||||
|
||||
args = args.map((arg) => new exports.Parser(arg, this.settings));
|
||||
|
||||
return function (context) {
|
||||
|
||||
const innerValues = [];
|
||||
for (const arg of args) {
|
||||
innerValues.push(arg.evaluate(context));
|
||||
}
|
||||
|
||||
return method.call(context, ...innerValues);
|
||||
};
|
||||
}
|
||||
|
||||
evaluate(context) {
|
||||
|
||||
const parts = this._parts.slice();
|
||||
|
||||
// Prefix operators
|
||||
|
||||
for (let i = parts.length - 2; i >= 0; --i) {
|
||||
const part = parts[i];
|
||||
if (part &&
|
||||
part.type === 'operator') {
|
||||
|
||||
const current = parts[i + 1];
|
||||
parts.splice(i + 1, 1);
|
||||
const value = internals.evaluate(current, context);
|
||||
parts[i] = internals.single(part.value, value);
|
||||
}
|
||||
}
|
||||
|
||||
// Left-right operators
|
||||
|
||||
internals.operatorsOrder.forEach((set) => {
|
||||
|
||||
for (let i = 1; i < parts.length - 1;) {
|
||||
if (set.includes(parts[i])) {
|
||||
const operator = parts[i];
|
||||
const left = internals.evaluate(parts[i - 1], context);
|
||||
const right = internals.evaluate(parts[i + 1], context);
|
||||
|
||||
parts.splice(i, 2);
|
||||
const result = internals.calculate(operator, left, right);
|
||||
parts[i - 1] = result === 0 ? 0 : result; // Convert -0
|
||||
}
|
||||
else {
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return internals.evaluate(parts[0], context);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
exports.Parser.prototype[internals.symbol] = true;
|
||||
|
||||
|
||||
internals.reference = function (name) {
|
||||
|
||||
return function (context) {
|
||||
|
||||
return context && context[name] !== undefined ? context[name] : null;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
internals.evaluate = function (part, context) {
|
||||
|
||||
if (part === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (typeof part === 'function') {
|
||||
return part(context);
|
||||
}
|
||||
|
||||
if (part[internals.symbol]) {
|
||||
return part.evaluate(context);
|
||||
}
|
||||
|
||||
return part;
|
||||
};
|
||||
|
||||
|
||||
internals.single = function (operator, value) {
|
||||
|
||||
if (operator === '!') {
|
||||
return value ? false : true;
|
||||
}
|
||||
|
||||
// operator === 'n'
|
||||
|
||||
const negative = -value;
|
||||
if (negative === 0) { // Override -0
|
||||
return 0;
|
||||
}
|
||||
|
||||
return negative;
|
||||
};
|
||||
|
||||
|
||||
internals.calculate = function (operator, left, right) {
|
||||
|
||||
if (operator === '??') {
|
||||
return internals.exists(left) ? left : right;
|
||||
}
|
||||
|
||||
if (typeof left === 'string' ||
|
||||
typeof right === 'string') {
|
||||
|
||||
if (operator === '+') {
|
||||
left = internals.exists(left) ? left : '';
|
||||
right = internals.exists(right) ? right : '';
|
||||
return left + right;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (operator) {
|
||||
case '^': return Math.pow(left, right);
|
||||
case '*': return left * right;
|
||||
case '/': return left / right;
|
||||
case '%': return left % right;
|
||||
case '+': return left + right;
|
||||
case '-': return left - right;
|
||||
}
|
||||
}
|
||||
|
||||
switch (operator) {
|
||||
case '<': return left < right;
|
||||
case '<=': return left <= right;
|
||||
case '>': return left > right;
|
||||
case '>=': return left >= right;
|
||||
case '==': return left === right;
|
||||
case '!=': return left !== right;
|
||||
case '&&': return left && right;
|
||||
case '||': return left || right;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
internals.exists = function (value) {
|
||||
|
||||
return value !== null && value !== undefined;
|
||||
};
|
||||
61
node_modules/@sideway/formula/package.json
generated
vendored
61
node_modules/@sideway/formula/package.json
generated
vendored
@@ -1,61 +0,0 @@
|
||||
{
|
||||
"_from": "@sideway/formula@^3.0.0",
|
||||
"_id": "@sideway/formula@3.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==",
|
||||
"_location": "/@sideway/formula",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@sideway/formula@^3.0.0",
|
||||
"name": "@sideway/formula",
|
||||
"escapedName": "@sideway%2fformula",
|
||||
"scope": "@sideway",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/joi"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz",
|
||||
"_shasum": "fe158aee32e6bd5de85044be615bc08478a0a13c",
|
||||
"_spec": "@sideway/formula@^3.0.0",
|
||||
"_where": "C:\\Users\\anelissen\\Development\\tools\\node\\cbor\\node_modules\\joi",
|
||||
"bugs": {
|
||||
"url": "https://github.com/sideway/formula/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Math and string formula parser.",
|
||||
"devDependencies": {
|
||||
"@hapi/code": "8.x.x",
|
||||
"@hapi/lab": "24.x.x",
|
||||
"typescript": "4.0.x"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/sideway/formula#readme",
|
||||
"keywords": [
|
||||
"formula",
|
||||
"parser",
|
||||
"math",
|
||||
"string"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "lib/index.js",
|
||||
"name": "@sideway/formula",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/sideway/formula.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "lab -a @hapi/code -t 100 -L -Y",
|
||||
"test-cov-html": "lab -a @hapi/code -t 100 -L -r html -o coverage.html"
|
||||
},
|
||||
"types": "lib/index.d.ts",
|
||||
"version": "3.0.0"
|
||||
}
|
||||
10
node_modules/@sideway/pinpoint/LICENSE.md
generated
vendored
10
node_modules/@sideway/pinpoint/LICENSE.md
generated
vendored
@@ -1,10 +0,0 @@
|
||||
Copyright (c) 2019-2020, Sideway. Inc, and project contributors
|
||||
|
||||
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.
|
||||
* The names of any contributors may not 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS 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 OFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
14
node_modules/@sideway/pinpoint/README.md
generated
vendored
14
node_modules/@sideway/pinpoint/README.md
generated
vendored
@@ -1,14 +0,0 @@
|
||||
# @sideway/pinpoint
|
||||
|
||||
#### Return the filename and line number of the calling function.
|
||||
|
||||
**pinpoint** is part of the **joi** ecosystem.
|
||||
|
||||
### Visit the [joi.dev](https://joi.dev) Developer Portal for tutorials, documentation, and support
|
||||
|
||||
## Useful resources
|
||||
|
||||
- [Documentation and API](https://joi.dev/module/pinpoint/)
|
||||
- [Version status](https://joi.dev/resources/status/#pinpoint) (builds, dependencies, node versions, licenses, eol)
|
||||
- [Changelog](https://joi.dev/module/pinpoint/changelog/)
|
||||
- [Project policies](https://joi.dev/policies/)
|
||||
24
node_modules/@sideway/pinpoint/lib/index.d.ts
generated
vendored
24
node_modules/@sideway/pinpoint/lib/index.d.ts
generated
vendored
@@ -1,24 +0,0 @@
|
||||
/**
|
||||
Returns the filename and line number of the caller in the call stack
|
||||
|
||||
@param depth - The distance from the location function in the call stack. Defaults to 1 (caller).
|
||||
|
||||
@return an object with the filename and line number.
|
||||
*/
|
||||
export function location(depth?: number): location.Location;
|
||||
|
||||
declare namespace location {
|
||||
|
||||
interface Location {
|
||||
|
||||
/**
|
||||
The fully qualified filename.
|
||||
*/
|
||||
readonly filename: string;
|
||||
|
||||
/**
|
||||
The file line number.
|
||||
*/
|
||||
readonly line: number;
|
||||
}
|
||||
}
|
||||
21
node_modules/@sideway/pinpoint/lib/index.js
generated
vendored
21
node_modules/@sideway/pinpoint/lib/index.js
generated
vendored
@@ -1,21 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
exports.location = function (depth = 0) {
|
||||
|
||||
const orig = Error.prepareStackTrace;
|
||||
Error.prepareStackTrace = (ignore, stack) => stack;
|
||||
|
||||
const capture = {};
|
||||
Error.captureStackTrace(capture, this);
|
||||
const line = capture.stack[depth + 1];
|
||||
|
||||
Error.prepareStackTrace = orig;
|
||||
|
||||
return {
|
||||
filename: line.getFileName(),
|
||||
line: line.getLineNumber()
|
||||
};
|
||||
};
|
||||
58
node_modules/@sideway/pinpoint/package.json
generated
vendored
58
node_modules/@sideway/pinpoint/package.json
generated
vendored
@@ -1,58 +0,0 @@
|
||||
{
|
||||
"_from": "@sideway/pinpoint@^2.0.0",
|
||||
"_id": "@sideway/pinpoint@2.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==",
|
||||
"_location": "/@sideway/pinpoint",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@sideway/pinpoint@^2.0.0",
|
||||
"name": "@sideway/pinpoint",
|
||||
"escapedName": "@sideway%2fpinpoint",
|
||||
"scope": "@sideway",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/joi"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz",
|
||||
"_shasum": "cff8ffadc372ad29fd3f78277aeb29e632cc70df",
|
||||
"_spec": "@sideway/pinpoint@^2.0.0",
|
||||
"_where": "C:\\Users\\anelissen\\Development\\tools\\node\\cbor\\node_modules\\joi",
|
||||
"bugs": {
|
||||
"url": "https://github.com/sideway/pinpoint/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Return the filename and line number of the calling function",
|
||||
"devDependencies": {
|
||||
"@hapi/code": "8.x.x",
|
||||
"@hapi/lab": "24.x.x",
|
||||
"typescript": "4.0.x"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/sideway/pinpoint#readme",
|
||||
"keywords": [
|
||||
"utilities"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "lib/index.js",
|
||||
"name": "@sideway/pinpoint",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/sideway/pinpoint.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "lab -a @hapi/code -t 100 -L -Y",
|
||||
"test-cov-html": "lab -a @hapi/code -t 100 -L -r html -o coverage.html"
|
||||
},
|
||||
"types": "lib/index.d.ts",
|
||||
"version": "2.0.0"
|
||||
}
|
||||
21
node_modules/@types/bson/LICENSE
generated
vendored
21
node_modules/@types/bson/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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
|
||||
16
node_modules/@types/bson/README.md
generated
vendored
16
node_modules/@types/bson/README.md
generated
vendored
@@ -1,16 +0,0 @@
|
||||
# Installation
|
||||
> `npm install --save @types/bson`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for bson (https://github.com/mongodb/js-bson).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bson.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Tue, 06 Jul 2021 18:05:46 GMT
|
||||
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Hiroki Horiuchi](https://github.com/horiuchi), [Federico Caselli](https://github.com/CaselIT), [Justin Grant](https://github.com/justingrant), and [Mikael Lirbank](https://github.com/lirbank).
|
||||
600
node_modules/@types/bson/index.d.ts
generated
vendored
600
node_modules/@types/bson/index.d.ts
generated
vendored
@@ -1,600 +0,0 @@
|
||||
// Type definitions for bson 4.0
|
||||
// Project: https://github.com/mongodb/js-bson
|
||||
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
|
||||
// Federico Caselli <https://github.com/CaselIT>
|
||||
// Justin Grant <https://github.com/justingrant>
|
||||
// Mikael Lirbank <https://github.com/lirbank>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
interface CommonSerializeOptions {
|
||||
/** {default:false}, the serializer will check if keys are valid. */
|
||||
checkKeys?: boolean | undefined;
|
||||
/** {default:false}, serialize the javascript functions. */
|
||||
serializeFunctions?: boolean | undefined;
|
||||
/** {default:true}, ignore undefined fields. */
|
||||
ignoreUndefined?: boolean | undefined;
|
||||
}
|
||||
|
||||
export interface SerializeOptions extends CommonSerializeOptions {
|
||||
/** {default:1024*1024*17}, minimum size of the internal temporary serialization buffer. */
|
||||
minInternalBufferSize?: number | undefined;
|
||||
}
|
||||
|
||||
export interface SerializeWithBufferAndIndexOptions extends CommonSerializeOptions {
|
||||
/** {default:0}, the index in the buffer where we wish to start serializing into. */
|
||||
index?: number | undefined;
|
||||
}
|
||||
|
||||
export interface DeserializeOptions {
|
||||
/** {default:false}, evaluate functions in the BSON document scoped to the object deserialized. */
|
||||
evalFunctions?: boolean | undefined;
|
||||
/** {default:false}, cache evaluated functions for reuse. */
|
||||
cacheFunctions?: boolean | undefined;
|
||||
/** {default:false}, use a crc32 code for caching, otherwise use the string of the function. */
|
||||
cacheFunctionsCrc32?: boolean | undefined;
|
||||
/** {default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits. */
|
||||
promoteLongs?: boolean | undefined;
|
||||
/** {default:false}, deserialize Binary data directly into node.js Buffer object. */
|
||||
promoteBuffers?: boolean | undefined;
|
||||
/** {default:false}, when deserializing will promote BSON values to their Node.js closest equivalent types. */
|
||||
promoteValues?: boolean | undefined;
|
||||
/** {default:null}, allow to specify if there what fields we wish to return as unserialized raw buffer. */
|
||||
fieldsAsRaw?: { readonly [fieldName: string]: boolean } | undefined;
|
||||
/** {default:false}, return BSON regular expressions as BSONRegExp instances. */
|
||||
bsonRegExp?: boolean | undefined;
|
||||
/** {default:false}, allows the buffer to be larger than the parsed BSON object. */
|
||||
allowObjectSmallerThanBufferSize?: boolean | undefined;
|
||||
}
|
||||
|
||||
export interface CalculateObjectSizeOptions {
|
||||
/** {default:false}, serialize the javascript functions */
|
||||
serializeFunctions?: boolean | undefined;
|
||||
/** {default:true}, ignore undefined fields. */
|
||||
ignoreUndefined?: boolean | undefined;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Serialize a Javascript object.
|
||||
*
|
||||
* @param object The Javascript object to serialize.
|
||||
* @param options Serialize options.
|
||||
* @return The Buffer object containing the serialized object.
|
||||
*/
|
||||
export function serialize(object: any, options?: SerializeOptions): Buffer;
|
||||
|
||||
/**
|
||||
* Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization.
|
||||
*
|
||||
* @param object The Javascript object to serialize.
|
||||
* @param buffer The Buffer you pre-allocated to store the serialized BSON object.
|
||||
* @param options Serialize options.
|
||||
* @returns The index pointing to the last written byte in the buffer
|
||||
*/
|
||||
export function serializeWithBufferAndIndex(object: any, buffer: Buffer, options?: SerializeWithBufferAndIndexOptions): number;
|
||||
|
||||
/**
|
||||
* Deserialize data as BSON.
|
||||
*
|
||||
* @param buffer The buffer containing the serialized set of BSON documents.
|
||||
* @param options Deserialize options.
|
||||
* @returns The deserialized Javascript Object.
|
||||
*/
|
||||
export function deserialize(buffer: Buffer, options?: DeserializeOptions): any;
|
||||
|
||||
/**
|
||||
* Calculate the bson size for a passed in Javascript object.
|
||||
*
|
||||
* @param {Object} object the Javascript object to calculate the BSON byte size for.
|
||||
* @param {CalculateObjectSizeOptions} Options
|
||||
* @return {Number} returns the number of bytes the BSON object will take up.
|
||||
*/
|
||||
export function calculateObjectSize(object: any, options?: CalculateObjectSizeOptions): number;
|
||||
|
||||
/**
|
||||
* Deserialize stream data as BSON documents.
|
||||
*
|
||||
* @param data The buffer containing the serialized set of BSON documents.
|
||||
* @param startIndex The start index in the data Buffer where the deserialization is to start.
|
||||
* @param numberOfDocuments Number of documents to deserialize
|
||||
* @param documents An array where to store the deserialized documents
|
||||
* @param docStartIndex The index in the documents array from where to start inserting documents
|
||||
* @param options Additional options used for the deserialization
|
||||
* @returns The next index in the buffer after deserialization of the `numberOfDocuments`
|
||||
*/
|
||||
export function deserializeStream(
|
||||
data: Buffer,
|
||||
startIndex: number,
|
||||
numberOfDocuments: number,
|
||||
documents: Array<any>,
|
||||
docStartIndex: number,
|
||||
options?: DeserializeOptions
|
||||
): number;
|
||||
|
||||
/** A class representation of the BSON Binary type. */
|
||||
export class Binary {
|
||||
|
||||
static readonly SUBTYPE_DEFAULT: number;
|
||||
static readonly SUBTYPE_FUNCTION: number;
|
||||
static readonly SUBTYPE_BYTE_ARRAY: number;
|
||||
static readonly SUBTYPE_UUID_OLD: number;
|
||||
static readonly SUBTYPE_UUID: number;
|
||||
static readonly SUBTYPE_MD5: number;
|
||||
static readonly SUBTYPE_USER_DEFINED: number;
|
||||
|
||||
/**
|
||||
* @param buffer A buffer object containing the binary data
|
||||
* @param subType Binary data subtype
|
||||
*/
|
||||
constructor(buffer: Buffer, subType?: number);
|
||||
|
||||
/** The underlying Buffer which stores the binary data. */
|
||||
readonly buffer: Buffer;
|
||||
/** Binary data subtype */
|
||||
readonly sub_type?: number | undefined;
|
||||
|
||||
/** The length of the binary. */
|
||||
length(): number;
|
||||
/** Updates this binary with byte_value */
|
||||
put(byte_value: number | string): void;
|
||||
/** Reads length bytes starting at position. */
|
||||
read(position: number, length: number): Buffer;
|
||||
/** Returns the value of this binary as a string. */
|
||||
value(): string;
|
||||
/** Writes a buffer or string to the binary */
|
||||
write(buffer: Buffer | string, offset: number): void;
|
||||
}
|
||||
|
||||
/** A class representation of the BSON Code type. */
|
||||
export class Code {
|
||||
|
||||
/**
|
||||
* @param code A string or function.
|
||||
* @param scope An optional scope for the function.
|
||||
*/
|
||||
constructor(code: string | Function, scope?: any);
|
||||
|
||||
readonly code: string | Function;
|
||||
readonly scope?: any;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A class representation of the BSON DBRef type.
|
||||
*/
|
||||
export class DBRef {
|
||||
/**
|
||||
* @param namespace The collection name.
|
||||
* @param oid The reference ObjectId.
|
||||
* @param db Optional db name, if omitted the reference is local to the current db
|
||||
*/
|
||||
constructor(namespace: string, oid: ObjectId, db?: string);
|
||||
namespace: string;
|
||||
oid: ObjectId;
|
||||
db?: string | undefined;
|
||||
}
|
||||
|
||||
/** A class representation of the BSON Double type. */
|
||||
export class Double {
|
||||
/**
|
||||
* @param value The number we want to represent as a double.
|
||||
*/
|
||||
constructor(value: number);
|
||||
|
||||
/**
|
||||
* https://github.com/mongodb/js-bson/blob/master/lib/double.js#L17
|
||||
*/
|
||||
value: number;
|
||||
|
||||
|
||||
valueOf(): number;
|
||||
}
|
||||
|
||||
/** A class representation of the BSON Int32 type. */
|
||||
export class Int32 {
|
||||
/**
|
||||
* @param value The number we want to represent as an int32.
|
||||
*/
|
||||
constructor(value: number);
|
||||
|
||||
valueOf(): number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for Long and Timestamp.
|
||||
* In original js-node@1.0.x code 'Timestamp' is a 100% copy-paste of 'Long'
|
||||
* with 'Long' replaced by 'Timestamp' (changed to inheritance in js-node@2.0.0)
|
||||
*/
|
||||
declare class LongLike<T> {
|
||||
|
||||
/**
|
||||
* @param low The low (signed) 32 bits.
|
||||
* @param high The high (signed) 32 bits.
|
||||
*/
|
||||
constructor(low: number, high: number);
|
||||
|
||||
/** Returns the sum of `this` and the `other`. */
|
||||
add(other: T): T;
|
||||
/** Returns the bitwise-AND of `this` and the `other`. */
|
||||
and(other: T): T;
|
||||
/**
|
||||
* Compares `this` with the given `other`.
|
||||
* @returns 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.
|
||||
*/
|
||||
compare(other: T): number;
|
||||
/** Returns `this` divided by the given `other`. */
|
||||
div(other: T): T;
|
||||
/** Return whether `this` equals the `other` */
|
||||
equals(other: T): boolean;
|
||||
/** Return the high 32-bits value. */
|
||||
getHighBits(): number;
|
||||
/** Return the low 32-bits value. */
|
||||
getLowBits(): number;
|
||||
/** Return the low unsigned 32-bits value. */
|
||||
getLowBitsUnsigned(): number;
|
||||
/** Returns the number of bits needed to represent the absolute value of `this`. */
|
||||
getNumBitsAbs(): number;
|
||||
/** Return whether `this` is greater than the `other`. */
|
||||
greaterThan(other: T): boolean;
|
||||
/** Return whether `this` is greater than or equal to the `other`. */
|
||||
greaterThanOrEqual(other: T): boolean;
|
||||
/** Return whether `this` value is negative. */
|
||||
isNegative(): boolean;
|
||||
/** Return whether `this` value is odd. */
|
||||
isOdd(): boolean;
|
||||
/** Return whether `this` value is zero. */
|
||||
isZero(): boolean;
|
||||
/** Return whether `this` is less than the `other`. */
|
||||
lessThan(other: T): boolean;
|
||||
/** Return whether `this` is less than or equal to the `other`. */
|
||||
lessThanOrEqual(other: T): boolean;
|
||||
/** Returns `this` modulo the given `other`. */
|
||||
modulo(other: T): T;
|
||||
/** Returns the product of `this` and the given `other`. */
|
||||
multiply(other: T): T;
|
||||
/** The negation of this value. */
|
||||
negate(): T;
|
||||
/** The bitwise-NOT of this value. */
|
||||
not(): T;
|
||||
/** Return whether `this` does not equal to the `other`. */
|
||||
notEquals(other: T): boolean;
|
||||
/** Returns the bitwise-OR of `this` and the given `other`. */
|
||||
or(other: T): T;
|
||||
/**
|
||||
* Returns `this` with bits shifted to the left by the given amount.
|
||||
* @param numBits The number of bits by which to shift.
|
||||
*/
|
||||
shiftLeft(numBits: number): T;
|
||||
/**
|
||||
* Returns `this` with bits shifted to the right by the given amount.
|
||||
* @param numBits The number of bits by which to shift.
|
||||
*/
|
||||
shiftRight(numBits: number): T;
|
||||
/**
|
||||
* Returns `this` with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.
|
||||
* @param numBits The number of bits by which to shift.
|
||||
*/
|
||||
shiftRightUnsigned(numBits: number): T;
|
||||
/** Returns the difference of `this` and the given `other`. */
|
||||
subtract(other: T): T;
|
||||
/** Return the int value (low 32 bits). */
|
||||
toInt(): number;
|
||||
/** Return the JSON value. */
|
||||
toJSON(): string;
|
||||
/** Returns closest floating-point representation to `this` value */
|
||||
toNumber(): number;
|
||||
/**
|
||||
* Return as a string
|
||||
* @param radix the radix in which the text should be written. {default:10}
|
||||
*/
|
||||
toString(radix?: number): string;
|
||||
/** Returns the bitwise-XOR of `this` and the given `other`. */
|
||||
xor(other: T): T;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A class representation of the BSON Long type, a 64-bit two's-complement
|
||||
* integer value, which faithfully simulates the behavior of a Java "Long". This
|
||||
* implementation is derived from LongLib in GWT.
|
||||
*/
|
||||
export class Long extends LongLike<Long> {
|
||||
|
||||
static readonly MAX_VALUE: Long;
|
||||
static readonly MIN_VALUE: Long;
|
||||
static readonly NEG_ONE: Long;
|
||||
static readonly ONE: Long;
|
||||
static readonly ZERO: Long;
|
||||
|
||||
/** Returns a Long representing the given (32-bit) integer value. */
|
||||
static fromInt(i: number): Long;
|
||||
/** Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. */
|
||||
static fromNumber(n: number): Long;
|
||||
/**
|
||||
* Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.
|
||||
* @param lowBits The low 32-bits.
|
||||
* @param highBits The high 32-bits.
|
||||
*/
|
||||
static fromBits(lowBits: number, highBits: number): Long;
|
||||
/**
|
||||
* Returns a Long representation of the given string
|
||||
* @param opt_radix The radix in which the text is written. {default:10}
|
||||
*/
|
||||
static fromString(s: string, opt_radix?: number): Long;
|
||||
|
||||
}
|
||||
|
||||
/** A class representation of the BSON Decimal128 type. */
|
||||
export class Decimal128 {
|
||||
|
||||
/** Create a Decimal128 instance from a string representation. */
|
||||
static fromString(s: string): Decimal128;
|
||||
|
||||
/**
|
||||
* @param bytes A buffer containing the raw Decimal128 bytes.
|
||||
*/
|
||||
constructor(bytes: Buffer);
|
||||
|
||||
/** A buffer containing the raw Decimal128 bytes. */
|
||||
readonly bytes: Buffer;
|
||||
|
||||
toJSON(): string;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
/** A class representation of the BSON MaxKey type. */
|
||||
export class MaxKey {
|
||||
constructor();
|
||||
}
|
||||
|
||||
/** A class representation of the BSON MinKey type. */
|
||||
export class MinKey {
|
||||
constructor();
|
||||
}
|
||||
|
||||
/** A class representation of the BSON ObjectId type. */
|
||||
export class ObjectId {
|
||||
/**
|
||||
* Create a new ObjectId instance
|
||||
* @param {(string|number|ObjectId)} id Can be a 24 byte hex string, 12 byte binary string or a Number.
|
||||
*/
|
||||
constructor(id?: string | number | ObjectId);
|
||||
/** The generation time of this ObjectId instance */
|
||||
generationTime: number;
|
||||
/** If true cache the hex string representation of ObjectId */
|
||||
static cacheHexString?: boolean | undefined;
|
||||
/**
|
||||
* Creates an ObjectId from a hex string representation of an ObjectId.
|
||||
* @param {string} hexString create a ObjectId from a passed in 24 byte hexstring.
|
||||
* @return {ObjectId} return the created ObjectId
|
||||
*/
|
||||
static createFromHexString(hexString: string): ObjectId;
|
||||
/**
|
||||
* Creates an ObjectId from a second based number, with the rest of the ObjectId zeroed out. Used for comparisons or sorting the ObjectId.
|
||||
* @param {number} time an integer number representing a number of seconds.
|
||||
* @return {ObjectId} return the created ObjectId
|
||||
*/
|
||||
static createFromTime(time: number): ObjectId;
|
||||
/**
|
||||
* Checks if a value is a valid bson ObjectId
|
||||
*
|
||||
* @return {boolean} return true if the value is a valid bson ObjectId, return false otherwise.
|
||||
*/
|
||||
static isValid(id: string | number | ObjectId): boolean;
|
||||
/**
|
||||
* Compares the equality of this ObjectId with `otherID`.
|
||||
* @param {ObjectId|string} otherID ObjectId instance to compare against.
|
||||
* @return {boolean} the result of comparing two ObjectId's
|
||||
*/
|
||||
equals(otherID: ObjectId | string): boolean;
|
||||
/**
|
||||
* Generate a 12 byte id string used in ObjectId's
|
||||
* @param {number} time optional parameter allowing to pass in a second based timestamp.
|
||||
* @return {string} return the 12 byte id binary string.
|
||||
*/
|
||||
static generate(time?: number): Buffer;
|
||||
/**
|
||||
* Returns the generation date (accurate up to the second) that this ID was generated.
|
||||
* @return {Date} the generation date
|
||||
*/
|
||||
getTimestamp(): Date;
|
||||
/**
|
||||
* Return the ObjectId id as a 24 byte hex string representation
|
||||
* @return {string} return the 24 byte hex string representation.
|
||||
*/
|
||||
toHexString(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* ObjectID (with capital "D") is deprecated. Use ObjectId (lowercase "d") instead.
|
||||
* @deprecated
|
||||
*/
|
||||
export { ObjectId as ObjectID };
|
||||
|
||||
/** A class representation of the BSON RegExp type. */
|
||||
export class BSONRegExp {
|
||||
|
||||
constructor(pattern: string, options: string);
|
||||
|
||||
readonly pattern: string;
|
||||
readonly options: string;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A class representation of the BSON Symbol type.
|
||||
* @deprecated
|
||||
*/
|
||||
export class Symbol {
|
||||
|
||||
constructor(value: string);
|
||||
|
||||
/** Access the wrapped string value. */
|
||||
valueOf(): string;
|
||||
|
||||
}
|
||||
|
||||
/** A class representation of the BSON Timestamp type. */
|
||||
export class Timestamp extends LongLike<Timestamp> {
|
||||
|
||||
static readonly MAX_VALUE: Timestamp;
|
||||
static readonly MIN_VALUE: Timestamp;
|
||||
static readonly NEG_ONE: Timestamp;
|
||||
static readonly ONE: Timestamp;
|
||||
static readonly ZERO: Timestamp;
|
||||
|
||||
/** Returns a Timestamp represented by the given (32-bit) integer value */
|
||||
static fromInt(value: number): Timestamp;
|
||||
/** Returns a Timestamp representing the given number value, provided that it is a finite number. */
|
||||
static fromNumber(value: number): Timestamp;
|
||||
/**
|
||||
* Returns a Timestamp for the given high and low bits. Each is assumed to use 32 bits.
|
||||
* @param lowBits The low 32-bits.
|
||||
* @param highBits The high 32-bits.
|
||||
*/
|
||||
static fromBits(lowBits: number, highBits: number): Timestamp;
|
||||
/**
|
||||
* Returns a Timestamp from the given string.
|
||||
* @param opt_radix The radix in which the text is written. {default:10}
|
||||
*/
|
||||
static fromString(str: string, opt_radix?: number): Timestamp;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Functions for serializing JavaScript objects into Mongodb Extended JSON (EJSON).
|
||||
* @namespace EJSON
|
||||
*/
|
||||
export namespace EJSON {
|
||||
|
||||
/**
|
||||
* Parse an Extended JSON string, constructing the JavaScript value or object described by that
|
||||
* string.
|
||||
*
|
||||
* @memberof EJSON
|
||||
* @param {string} text
|
||||
* @param {object} [options] Optional settings
|
||||
* @param {boolean} [options.relaxed=true] Attempt to return native JS types where possible, rather than BSON types (if true)
|
||||
* @return {object}
|
||||
*
|
||||
* @example
|
||||
* const { EJSON } = require('bson');
|
||||
* const text = '{ "int32": { "$numberInt": "10" } }';
|
||||
*
|
||||
* // prints { int32: { [String: '10'] _bsontype: 'Int32', value: '10' } }
|
||||
* console.log(EJSON.parse(text, { relaxed: false }));
|
||||
*
|
||||
* // prints { int32: 10 }
|
||||
* console.log(EJSON.parse(text));
|
||||
*/
|
||||
export function parse(text: string, options?: {relaxed?: boolean | undefined;}): {};
|
||||
|
||||
/**
|
||||
* Deserializes an Extended JSON object into a plain JavaScript object with native/BSON types
|
||||
*
|
||||
* @memberof EJSON
|
||||
* @param {object} ejson The Extended JSON object to deserialize
|
||||
* @param {object} [options] Optional settings passed to the parse method
|
||||
* @return {object}
|
||||
*/
|
||||
export function deserialize(ejson: {}, options?: {relaxed?: boolean | undefined;}): {};
|
||||
|
||||
/**
|
||||
* Serializes an object to an Extended JSON string, and reparse it as a JavaScript object.
|
||||
*
|
||||
* @memberof EJSON
|
||||
* @param {object} bson The object to serialize
|
||||
* @param {object} [options] Optional settings passed to the `stringify` function
|
||||
* @return {object}
|
||||
*/
|
||||
export function serialize(bson: {}, options?: {relaxed?: boolean | undefined;}): {};
|
||||
|
||||
/**
|
||||
* Converts a BSON document to an Extended JSON string, optionally replacing values if a replacer
|
||||
* function is specified or optionally including only the specified properties if a replacer array
|
||||
* is specified.
|
||||
*
|
||||
* @memberof EJSON
|
||||
* @param {object} value The value to convert to extended JSON
|
||||
* @param {function|array} [replacer] A function that alters the behavior of the stringification process, or an array of String and Number objects that serve as a whitelist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string
|
||||
* @param {string|number} [space] A String or Number object that's used to insert white space into the output JSON string for readability purposes.
|
||||
* @param {object} [options] Optional settings.
|
||||
* @param {boolean} [options.relaxed=true] Enabled Extended JSON's `relaxed` mode
|
||||
* @returns {string}
|
||||
*
|
||||
* @example
|
||||
* const { EJSON, Int32 } = require('bson');
|
||||
* const doc = { int32: new Int32(10) };
|
||||
*
|
||||
* // prints '{"int32":{"$numberInt":"10"}}'
|
||||
* console.log(EJSON.stringify(doc, { relaxed: false }));
|
||||
*
|
||||
* // prints '{"int32":10}'
|
||||
* console.log(EJSON.stringify(doc));
|
||||
*/
|
||||
export function stringify(
|
||||
value: {},
|
||||
options?: {relaxed?: boolean | undefined;}
|
||||
): string;
|
||||
|
||||
/**
|
||||
* Converts a BSON document to an Extended JSON string, optionally replacing values if a replacer
|
||||
* function is specified or optionally including only the specified properties if a replacer array
|
||||
* is specified.
|
||||
*
|
||||
* @memberof EJSON
|
||||
* @param {object} value The value to convert to extended JSON
|
||||
* @param {function|array} [replacer] A function that alters the behavior of the stringification process, or an array of String and Number objects that serve as a whitelist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string
|
||||
* @param {string|number} [space] A String or Number object that's used to insert white space into the output JSON string for readability purposes.
|
||||
* @param {object} [options] Optional settings.
|
||||
* @param {boolean} [options.relaxed=true] Enabled Extended JSON's `relaxed` mode
|
||||
* @returns {string}
|
||||
*
|
||||
* @example
|
||||
* const { EJSON, Int32 } = require('bson');
|
||||
* const doc = { int32: new Int32(10) };
|
||||
*
|
||||
* // prints '{"int32":{"$numberInt":"10"}}'
|
||||
* console.log(EJSON.stringify(doc, { relaxed: false }));
|
||||
*
|
||||
* // prints '{"int32":10}'
|
||||
* console.log(EJSON.stringify(doc));
|
||||
*/
|
||||
|
||||
export function stringify(
|
||||
value: {},
|
||||
replacer: ((key: string, value: any) => any) | Array<string|number> | null | undefined,
|
||||
options?: {relaxed?: boolean | undefined;}
|
||||
): string;
|
||||
/**
|
||||
* Converts a BSON document to an Extended JSON string, optionally replacing values if a replacer
|
||||
* function is specified or optionally including only the specified properties if a replacer array
|
||||
* is specified.
|
||||
*
|
||||
* @memberof EJSON
|
||||
* @param {object} value The value to convert to extended JSON
|
||||
* @param {function|array} [replacer] A function that alters the behavior of the stringification process, or an array of String and Number objects that serve as a whitelist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string
|
||||
* @param {string|number} [space] A String or Number object that's used to insert white space into the output JSON string for readability purposes.
|
||||
* @param {object} [options] Optional settings.
|
||||
* @param {boolean} [options.relaxed=true] Enabled Extended JSON's `relaxed` mode
|
||||
* @returns {string}
|
||||
*
|
||||
* @example
|
||||
* const { EJSON, Int32 } = require('bson');
|
||||
* const doc = { int32: new Int32(10) };
|
||||
*
|
||||
* // prints '{"int32":{"$numberInt":"10"}}'
|
||||
* console.log(EJSON.stringify(doc, { relaxed: false }));
|
||||
*
|
||||
* // prints '{"int32":10}'
|
||||
* console.log(EJSON.stringify(doc));
|
||||
*/
|
||||
export function stringify(
|
||||
value: {},
|
||||
replacer: ((key: string, value: any) => any) | Array<string | number> | null | undefined,
|
||||
indents?: string | number,
|
||||
options?: {relaxed?: boolean | undefined;}
|
||||
): string;
|
||||
}
|
||||
67
node_modules/@types/bson/package.json
generated
vendored
67
node_modules/@types/bson/package.json
generated
vendored
@@ -1,67 +0,0 @@
|
||||
{
|
||||
"_from": "@types/bson@*",
|
||||
"_id": "@types/bson@4.0.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-awqorHvQS0DqxkHQ/FxcPX9E+H7Du51Qw/2F+5TBMSaE3G0hm+8D3eXJ6MAzFw75nE8V7xF0QvzUSdxIjJb/GA==",
|
||||
"_location": "/@types/bson",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@types/bson@*",
|
||||
"name": "@types/bson",
|
||||
"escapedName": "@types%2fbson",
|
||||
"scope": "@types",
|
||||
"rawSpec": "*",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "*"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@types/mongodb"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/bson/-/bson-4.0.4.tgz",
|
||||
"_shasum": "79d2d26e81070044db2a1a8b2cc2f673c840e1e5",
|
||||
"_spec": "@types/bson@*",
|
||||
"_where": "C:\\Users\\anelissen\\Development\\tools\\node\\cbor\\node_modules\\@types\\mongodb",
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Hiroki Horiuchi",
|
||||
"url": "https://github.com/horiuchi"
|
||||
},
|
||||
{
|
||||
"name": "Federico Caselli",
|
||||
"url": "https://github.com/CaselIT"
|
||||
},
|
||||
{
|
||||
"name": "Justin Grant",
|
||||
"url": "https://github.com/justingrant"
|
||||
},
|
||||
{
|
||||
"name": "Mikael Lirbank",
|
||||
"url": "https://github.com/lirbank"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "TypeScript definitions for bson",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bson",
|
||||
"license": "MIT",
|
||||
"main": "",
|
||||
"name": "@types/bson",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/bson"
|
||||
},
|
||||
"scripts": {},
|
||||
"typeScriptVersion": "3.6",
|
||||
"types": "index.d.ts",
|
||||
"typesPublisherContentHash": "7828d55bc8d6ef153b4825e28fe498539c3482d3053144974fd0e343540e4331",
|
||||
"version": "4.0.4"
|
||||
}
|
||||
21
node_modules/@types/mongodb/LICENSE
generated
vendored
21
node_modules/@types/mongodb/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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
|
||||
16
node_modules/@types/mongodb/README.md
generated
vendored
16
node_modules/@types/mongodb/README.md
generated
vendored
@@ -1,16 +0,0 @@
|
||||
# Installation
|
||||
> `npm install --save @types/mongodb`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for MongoDB (https://github.com/mongodb/node-mongodb-native).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mongodb.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Wed, 07 Jul 2021 00:01:43 GMT
|
||||
* Dependencies: [@types/bson](https://npmjs.com/package/@types/bson), [@types/node](https://npmjs.com/package/@types/node)
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Federico Caselli](https://github.com/CaselIT), [Alan Marcell](https://github.com/alanmarcell), [Gaurav Lahoti](https://github.com/dante-101), [Mariano Cortesi](https://github.com/mcortesi), [Enrico Picci](https://github.com/EnricoPicci), [Alexander Christie](https://github.com/AJCStriker), [Julien Chaumond](https://github.com/julien-c), [Dan Aprahamian](https://github.com/daprahamian), [Denys Bushulyak](https://github.com/denys-bushulyak), [Bastien Arata](https://github.com/b4nst), [Wan Bachtiar](https://github.com/sindbach), [Geraldine Lemeur](https://github.com/geraldinelemeur), [Dominik Heigl](https://github.com/various89), [Angela-1](https://github.com/angela-1), [Hector Ribes](https://github.com/hector7), [Florian Richter](https://github.com/floric), [Erik Christensen](https://github.com/erikc5000), [Nick Zahn](https://github.com/Manc), [Jarom Loveridge](https://github.com/jloveridge), [Luis Pais](https://github.com/ranguna), [Hossein Saniei](https://github.com/HosseinAgha), [Alberto Silva](https://github.com/albertossilva), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Linus Unnebäck](https://github.com/LinusU), [Richard Bateman](https://github.com/taxilian), [Igor Strebezhev](https://github.com/xamgore), [Valentin Agachi](https://github.com/avaly), [HitkoDev](https://github.com/HitkoDev), [TJT](https://github.com/Celend), [Julien TASSIN](https://github.com/jtassin), [Anna Henningsen](https://github.com/addaleax), [Emmanuel Gautier](https://github.com/emmanuelgautier), [Wyatt Johnson](https://github.com/wyattjoh), and [Boris Figovsky](https://github.com/borfig).
|
||||
5230
node_modules/@types/mongodb/index.d.ts
generated
vendored
5230
node_modules/@types/mongodb/index.d.ts
generated
vendored
File diff suppressed because it is too large
Load Diff
188
node_modules/@types/mongodb/package.json
generated
vendored
188
node_modules/@types/mongodb/package.json
generated
vendored
@@ -1,188 +0,0 @@
|
||||
{
|
||||
"_from": "@types/mongodb@^3.5.27",
|
||||
"_id": "@types/mongodb@3.6.20",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-WcdpPJCakFzcWWD9juKoZbRtQxKIMYF/JIAM4JrNHrMcnJL6/a2NWjXxW7fo9hxboxxkg+icff8d7+WIEvKgYQ==",
|
||||
"_location": "/@types/mongodb",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@types/mongodb@^3.5.27",
|
||||
"name": "@types/mongodb",
|
||||
"escapedName": "@types%2fmongodb",
|
||||
"scope": "@types",
|
||||
"rawSpec": "^3.5.27",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.5.27"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mongoose"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.6.20.tgz",
|
||||
"_shasum": "b7c5c580644f6364002b649af1c06c3c0454e1d2",
|
||||
"_spec": "@types/mongodb@^3.5.27",
|
||||
"_where": "C:\\Users\\anelissen\\Development\\tools\\node\\cbor\\node_modules\\mongoose",
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Federico Caselli",
|
||||
"url": "https://github.com/CaselIT"
|
||||
},
|
||||
{
|
||||
"name": "Alan Marcell",
|
||||
"url": "https://github.com/alanmarcell"
|
||||
},
|
||||
{
|
||||
"name": "Gaurav Lahoti",
|
||||
"url": "https://github.com/dante-101"
|
||||
},
|
||||
{
|
||||
"name": "Mariano Cortesi",
|
||||
"url": "https://github.com/mcortesi"
|
||||
},
|
||||
{
|
||||
"name": "Enrico Picci",
|
||||
"url": "https://github.com/EnricoPicci"
|
||||
},
|
||||
{
|
||||
"name": "Alexander Christie",
|
||||
"url": "https://github.com/AJCStriker"
|
||||
},
|
||||
{
|
||||
"name": "Julien Chaumond",
|
||||
"url": "https://github.com/julien-c"
|
||||
},
|
||||
{
|
||||
"name": "Dan Aprahamian",
|
||||
"url": "https://github.com/daprahamian"
|
||||
},
|
||||
{
|
||||
"name": "Denys Bushulyak",
|
||||
"url": "https://github.com/denys-bushulyak"
|
||||
},
|
||||
{
|
||||
"name": "Bastien Arata",
|
||||
"url": "https://github.com/b4nst"
|
||||
},
|
||||
{
|
||||
"name": "Wan Bachtiar",
|
||||
"url": "https://github.com/sindbach"
|
||||
},
|
||||
{
|
||||
"name": "Geraldine Lemeur",
|
||||
"url": "https://github.com/geraldinelemeur"
|
||||
},
|
||||
{
|
||||
"name": "Dominik Heigl",
|
||||
"url": "https://github.com/various89"
|
||||
},
|
||||
{
|
||||
"name": "Angela-1",
|
||||
"url": "https://github.com/angela-1"
|
||||
},
|
||||
{
|
||||
"name": "Hector Ribes",
|
||||
"url": "https://github.com/hector7"
|
||||
},
|
||||
{
|
||||
"name": "Florian Richter",
|
||||
"url": "https://github.com/floric"
|
||||
},
|
||||
{
|
||||
"name": "Erik Christensen",
|
||||
"url": "https://github.com/erikc5000"
|
||||
},
|
||||
{
|
||||
"name": "Nick Zahn",
|
||||
"url": "https://github.com/Manc"
|
||||
},
|
||||
{
|
||||
"name": "Jarom Loveridge",
|
||||
"url": "https://github.com/jloveridge"
|
||||
},
|
||||
{
|
||||
"name": "Luis Pais",
|
||||
"url": "https://github.com/ranguna"
|
||||
},
|
||||
{
|
||||
"name": "Hossein Saniei",
|
||||
"url": "https://github.com/HosseinAgha"
|
||||
},
|
||||
{
|
||||
"name": "Alberto Silva",
|
||||
"url": "https://github.com/albertossilva"
|
||||
},
|
||||
{
|
||||
"name": "Piotr Błażejewicz",
|
||||
"url": "https://github.com/peterblazejewicz"
|
||||
},
|
||||
{
|
||||
"name": "Linus Unnebäck",
|
||||
"url": "https://github.com/LinusU"
|
||||
},
|
||||
{
|
||||
"name": "Richard Bateman",
|
||||
"url": "https://github.com/taxilian"
|
||||
},
|
||||
{
|
||||
"name": "Igor Strebezhev",
|
||||
"url": "https://github.com/xamgore"
|
||||
},
|
||||
{
|
||||
"name": "Valentin Agachi",
|
||||
"url": "https://github.com/avaly"
|
||||
},
|
||||
{
|
||||
"name": "HitkoDev",
|
||||
"url": "https://github.com/HitkoDev"
|
||||
},
|
||||
{
|
||||
"name": "TJT",
|
||||
"url": "https://github.com/Celend"
|
||||
},
|
||||
{
|
||||
"name": "Julien TASSIN",
|
||||
"url": "https://github.com/jtassin"
|
||||
},
|
||||
{
|
||||
"name": "Anna Henningsen",
|
||||
"url": "https://github.com/addaleax"
|
||||
},
|
||||
{
|
||||
"name": "Emmanuel Gautier",
|
||||
"url": "https://github.com/emmanuelgautier"
|
||||
},
|
||||
{
|
||||
"name": "Wyatt Johnson",
|
||||
"url": "https://github.com/wyattjoh"
|
||||
},
|
||||
{
|
||||
"name": "Boris Figovsky",
|
||||
"url": "https://github.com/borfig"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/bson": "*",
|
||||
"@types/node": "*"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "TypeScript definitions for MongoDB",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mongodb",
|
||||
"license": "MIT",
|
||||
"main": "",
|
||||
"name": "@types/mongodb",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/mongodb"
|
||||
},
|
||||
"scripts": {},
|
||||
"typeScriptVersion": "3.6",
|
||||
"types": "index.d.ts",
|
||||
"typesPublisherContentHash": "4424cca7a452613f996286310bde1bc954ab161915fd1ab3c77f71592d73bb34",
|
||||
"version": "3.6.20"
|
||||
}
|
||||
21
node_modules/@types/node/LICENSE
generated
vendored
21
node_modules/@types/node/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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
|
||||
16
node_modules/@types/node/README.md
generated
vendored
16
node_modules/@types/node/README.md
generated
vendored
@@ -1,16 +0,0 @@
|
||||
# Installation
|
||||
> `npm install --save @types/node`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for Node.js (http://nodejs.org/).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v15.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Sat, 03 Jul 2021 00:31:28 GMT
|
||||
* Dependencies: none
|
||||
* Global values: `AbortController`, `AbortSignal`, `Buffer`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Hoàng Văn Khải](https://github.com/KSXGitHub), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Jason Kwok](https://github.com/JasonHK), [Victor Perin](https://github.com/victorperin), and [Yongsheng Zhang](https://github.com/ZYSzys).
|
||||
124
node_modules/@types/node/assert.d.ts
generated
vendored
124
node_modules/@types/node/assert.d.ts
generated
vendored
@@ -1,124 +0,0 @@
|
||||
declare module 'assert' {
|
||||
/** An alias of `assert.ok()`. */
|
||||
function assert(value: any, message?: string | Error): asserts value;
|
||||
namespace assert {
|
||||
class AssertionError extends Error {
|
||||
actual: any;
|
||||
expected: any;
|
||||
operator: string;
|
||||
generatedMessage: boolean;
|
||||
code: 'ERR_ASSERTION';
|
||||
|
||||
constructor(options?: {
|
||||
/** If provided, the error message is set to this value. */
|
||||
message?: string;
|
||||
/** The `actual` property on the error instance. */
|
||||
actual?: any;
|
||||
/** The `expected` property on the error instance. */
|
||||
expected?: any;
|
||||
/** The `operator` property on the error instance. */
|
||||
operator?: string;
|
||||
/** If provided, the generated stack trace omits frames before this function. */
|
||||
// tslint:disable-next-line:ban-types
|
||||
stackStartFn?: Function;
|
||||
});
|
||||
}
|
||||
|
||||
class CallTracker {
|
||||
calls(exact?: number): () => void;
|
||||
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
|
||||
report(): CallTrackerReportInformation[];
|
||||
verify(): void;
|
||||
}
|
||||
interface CallTrackerReportInformation {
|
||||
message: string;
|
||||
/** The actual number of times the function was called. */
|
||||
actual: number;
|
||||
/** The number of times the function was expected to be called. */
|
||||
expected: number;
|
||||
/** The name of the function that is wrapped. */
|
||||
operator: string;
|
||||
/** A stack trace of the function. */
|
||||
stack: object;
|
||||
}
|
||||
|
||||
type AssertPredicate = RegExp | (new () => object) | ((thrown: any) => boolean) | object | Error;
|
||||
|
||||
function fail(message?: string | Error): never;
|
||||
/** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
|
||||
function fail(
|
||||
actual: any,
|
||||
expected: any,
|
||||
message?: string | Error,
|
||||
operator?: string,
|
||||
// tslint:disable-next-line:ban-types
|
||||
stackStartFn?: Function,
|
||||
): never;
|
||||
function ok(value: any, message?: string | Error): asserts value;
|
||||
/** @deprecated since v9.9.0 - use strictEqual() instead. */
|
||||
function equal(actual: any, expected: any, message?: string | Error): void;
|
||||
/** @deprecated since v9.9.0 - use notStrictEqual() instead. */
|
||||
function notEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
/** @deprecated since v9.9.0 - use deepStrictEqual() instead. */
|
||||
function deepEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
/** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */
|
||||
function notDeepEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
function strictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
|
||||
function notStrictEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
function deepStrictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
|
||||
function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
|
||||
function throws(block: () => any, message?: string | Error): void;
|
||||
function throws(block: () => any, error: AssertPredicate, message?: string | Error): void;
|
||||
function doesNotThrow(block: () => any, message?: string | Error): void;
|
||||
function doesNotThrow(block: () => any, error: AssertPredicate, message?: string | Error): void;
|
||||
|
||||
function ifError(value: any): asserts value is null | undefined;
|
||||
|
||||
function rejects(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
|
||||
function rejects(
|
||||
block: (() => Promise<any>) | Promise<any>,
|
||||
error: AssertPredicate,
|
||||
message?: string | Error,
|
||||
): Promise<void>;
|
||||
function doesNotReject(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
|
||||
function doesNotReject(
|
||||
block: (() => Promise<any>) | Promise<any>,
|
||||
error: AssertPredicate,
|
||||
message?: string | Error,
|
||||
): Promise<void>;
|
||||
|
||||
function match(value: string, regExp: RegExp, message?: string | Error): void;
|
||||
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
|
||||
|
||||
const strict: Omit<
|
||||
typeof assert,
|
||||
| 'equal'
|
||||
| 'notEqual'
|
||||
| 'deepEqual'
|
||||
| 'notDeepEqual'
|
||||
| 'ok'
|
||||
| 'strictEqual'
|
||||
| 'deepStrictEqual'
|
||||
| 'ifError'
|
||||
| 'strict'
|
||||
> & {
|
||||
(value: any, message?: string | Error): asserts value;
|
||||
equal: typeof strictEqual;
|
||||
notEqual: typeof notStrictEqual;
|
||||
deepEqual: typeof deepStrictEqual;
|
||||
notDeepEqual: typeof notDeepStrictEqual;
|
||||
|
||||
// Mapped types and assertion functions are incompatible?
|
||||
// TS2775: Assertions require every name in the call target
|
||||
// to be declared with an explicit type annotation.
|
||||
ok: typeof ok;
|
||||
strictEqual: typeof strictEqual;
|
||||
deepStrictEqual: typeof deepStrictEqual;
|
||||
ifError: typeof ifError;
|
||||
strict: typeof strict;
|
||||
};
|
||||
}
|
||||
|
||||
export = assert;
|
||||
}
|
||||
4
node_modules/@types/node/assert/strict.d.ts
generated
vendored
4
node_modules/@types/node/assert/strict.d.ts
generated
vendored
@@ -1,4 +0,0 @@
|
||||
declare module 'assert/strict' {
|
||||
import { strict } from 'assert';
|
||||
export = strict;
|
||||
}
|
||||
226
node_modules/@types/node/async_hooks.d.ts
generated
vendored
226
node_modules/@types/node/async_hooks.d.ts
generated
vendored
@@ -1,226 +0,0 @@
|
||||
/**
|
||||
* Async Hooks module: https://nodejs.org/api/async_hooks.html
|
||||
*/
|
||||
declare module 'async_hooks' {
|
||||
/**
|
||||
* Returns the asyncId of the current execution context.
|
||||
*/
|
||||
function executionAsyncId(): number;
|
||||
|
||||
/**
|
||||
* The resource representing the current execution.
|
||||
* Useful to store data within the resource.
|
||||
*
|
||||
* Resource objects returned by `executionAsyncResource()` are most often internal
|
||||
* Node.js handle objects with undocumented APIs. Using any functions or properties
|
||||
* on the object is likely to crash your application and should be avoided.
|
||||
*
|
||||
* Using `executionAsyncResource()` in the top-level execution context will
|
||||
* return an empty object as there is no handle or request object to use,
|
||||
* but having an object representing the top-level can be helpful.
|
||||
*/
|
||||
function executionAsyncResource(): object;
|
||||
|
||||
/**
|
||||
* Returns the ID of the resource responsible for calling the callback that is currently being executed.
|
||||
*/
|
||||
function triggerAsyncId(): number;
|
||||
|
||||
interface HookCallbacks {
|
||||
/**
|
||||
* Called when a class is constructed that has the possibility to emit an asynchronous event.
|
||||
* @param asyncId a unique ID for the async resource
|
||||
* @param type the type of the async resource
|
||||
* @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
|
||||
* @param resource reference to the resource representing the async operation, needs to be released during destroy
|
||||
*/
|
||||
init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
|
||||
|
||||
/**
|
||||
* When an asynchronous operation is initiated or completes a callback is called to notify the user.
|
||||
* The before callback is called just before said callback is executed.
|
||||
* @param asyncId the unique identifier assigned to the resource about to execute the callback.
|
||||
*/
|
||||
before?(asyncId: number): void;
|
||||
|
||||
/**
|
||||
* Called immediately after the callback specified in before is completed.
|
||||
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
|
||||
*/
|
||||
after?(asyncId: number): void;
|
||||
|
||||
/**
|
||||
* Called when a promise has resolve() called. This may not be in the same execution id
|
||||
* as the promise itself.
|
||||
* @param asyncId the unique id for the promise that was resolve()d.
|
||||
*/
|
||||
promiseResolve?(asyncId: number): void;
|
||||
|
||||
/**
|
||||
* Called after the resource corresponding to asyncId is destroyed
|
||||
* @param asyncId a unique ID for the async resource
|
||||
*/
|
||||
destroy?(asyncId: number): void;
|
||||
}
|
||||
|
||||
interface AsyncHook {
|
||||
/**
|
||||
* Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
|
||||
*/
|
||||
enable(): this;
|
||||
|
||||
/**
|
||||
* Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
|
||||
*/
|
||||
disable(): this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers functions to be called for different lifetime events of each async operation.
|
||||
* @param options the callbacks to register
|
||||
* @return an AsyncHooks instance used for disabling and enabling hooks
|
||||
*/
|
||||
function createHook(options: HookCallbacks): AsyncHook;
|
||||
|
||||
interface AsyncResourceOptions {
|
||||
/**
|
||||
* The ID of the execution context that created this async event.
|
||||
* @default executionAsyncId()
|
||||
*/
|
||||
triggerAsyncId?: number;
|
||||
|
||||
/**
|
||||
* Disables automatic `emitDestroy` when the object is garbage collected.
|
||||
* This usually does not need to be set (even if `emitDestroy` is called
|
||||
* manually), unless the resource's `asyncId` is retrieved and the
|
||||
* sensitive API's `emitDestroy` is called with it.
|
||||
* @default false
|
||||
*/
|
||||
requireManualDestroy?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The class AsyncResource was designed to be extended by the embedder's async resources.
|
||||
* Using this users can easily trigger the lifetime events of their own resources.
|
||||
*/
|
||||
class AsyncResource {
|
||||
/**
|
||||
* AsyncResource() is meant to be extended. Instantiating a
|
||||
* new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
||||
* async_hook.executionAsyncId() is used.
|
||||
* @param type The type of async event.
|
||||
* @param triggerAsyncId The ID of the execution context that created
|
||||
* this async event (default: `executionAsyncId()`), or an
|
||||
* AsyncResourceOptions object (since 9.3)
|
||||
*/
|
||||
constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions);
|
||||
|
||||
/**
|
||||
* Binds the given function to the current execution context.
|
||||
* @param fn The function to bind to the current execution context.
|
||||
* @param type An optional name to associate with the underlying `AsyncResource`.
|
||||
*/
|
||||
static bind<Func extends (...args: any[]) => any>(fn: Func, type?: string): Func & { asyncResource: AsyncResource };
|
||||
|
||||
/**
|
||||
* Binds the given function to execute to this `AsyncResource`'s scope.
|
||||
* @param fn The function to bind to the current `AsyncResource`.
|
||||
*/
|
||||
bind<Func extends (...args: any[]) => any>(fn: Func): Func & { asyncResource: AsyncResource };
|
||||
|
||||
/**
|
||||
* Call the provided function with the provided arguments in the
|
||||
* execution context of the async resource. This will establish the
|
||||
* context, trigger the AsyncHooks before callbacks, call the function,
|
||||
* trigger the AsyncHooks after callbacks, and then restore the original
|
||||
* execution context.
|
||||
* @param fn The function to call in the execution context of this
|
||||
* async resource.
|
||||
* @param thisArg The receiver to be used for the function call.
|
||||
* @param args Optional arguments to pass to the function.
|
||||
*/
|
||||
runInAsyncScope<This, Result>(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result;
|
||||
|
||||
/**
|
||||
* Call AsyncHooks destroy callbacks.
|
||||
*/
|
||||
emitDestroy(): this;
|
||||
|
||||
/**
|
||||
* @return the unique ID assigned to this AsyncResource instance.
|
||||
*/
|
||||
asyncId(): number;
|
||||
|
||||
/**
|
||||
* @return the trigger ID for this AsyncResource instance.
|
||||
*/
|
||||
triggerAsyncId(): number;
|
||||
}
|
||||
|
||||
/**
|
||||
* When having multiple instances of `AsyncLocalStorage`, they are independent
|
||||
* from each other. It is safe to instantiate this class multiple times.
|
||||
*/
|
||||
class AsyncLocalStorage<T> {
|
||||
/**
|
||||
* This method disables the instance of `AsyncLocalStorage`. All subsequent calls
|
||||
* to `asyncLocalStorage.getStore()` will return `undefined` until
|
||||
* `asyncLocalStorage.run()` is called again.
|
||||
*
|
||||
* When calling `asyncLocalStorage.disable()`, all current contexts linked to the
|
||||
* instance will be exited.
|
||||
*
|
||||
* Calling `asyncLocalStorage.disable()` is required before the
|
||||
* `asyncLocalStorage` can be garbage collected. This does not apply to stores
|
||||
* provided by the `asyncLocalStorage`, as those objects are garbage collected
|
||||
* along with the corresponding async resources.
|
||||
*
|
||||
* This method is to be used when the `asyncLocalStorage` is not in use anymore
|
||||
* in the current process.
|
||||
*/
|
||||
disable(): void;
|
||||
|
||||
/**
|
||||
* This method returns the current store. If this method is called outside of an
|
||||
* asynchronous context initialized by calling `asyncLocalStorage.run`, it will
|
||||
* return `undefined`.
|
||||
*/
|
||||
getStore(): T | undefined;
|
||||
|
||||
/**
|
||||
* This methods runs a function synchronously within a context and return its
|
||||
* return value. The store is not accessible outside of the callback function or
|
||||
* the asynchronous operations created within the callback.
|
||||
*
|
||||
* Optionally, arguments can be passed to the function. They will be passed to the
|
||||
* callback function.
|
||||
*
|
||||
* I the callback function throws an error, it will be thrown by `run` too. The
|
||||
* stacktrace will not be impacted by this call and the context will be exited.
|
||||
*/
|
||||
// TODO: Apply generic vararg once available
|
||||
run<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R;
|
||||
|
||||
/**
|
||||
* This methods runs a function synchronously outside of a context and return its
|
||||
* return value. The store is not accessible within the callback function or the
|
||||
* asynchronous operations created within the callback.
|
||||
*
|
||||
* Optionally, arguments can be passed to the function. They will be passed to the
|
||||
* callback function.
|
||||
*
|
||||
* If the callback function throws an error, it will be thrown by `exit` too. The
|
||||
* stacktrace will not be impacted by this call and the context will be
|
||||
* re-entered.
|
||||
*/
|
||||
// TODO: Apply generic vararg once available
|
||||
exit<R>(callback: (...args: any[]) => R, ...args: any[]): R;
|
||||
|
||||
/**
|
||||
* Calling `asyncLocalStorage.enterWith(store)` will transition into the context
|
||||
* for the remainder of the current synchronous execution and will persist
|
||||
* through any following asynchronous calls.
|
||||
*/
|
||||
enterWith(store: T): void;
|
||||
}
|
||||
}
|
||||
19
node_modules/@types/node/base.d.ts
generated
vendored
19
node_modules/@types/node/base.d.ts
generated
vendored
@@ -1,19 +0,0 @@
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.7.
|
||||
|
||||
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
|
||||
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
|
||||
// - ~/index.d.ts - Definitions specific to TypeScript 2.1
|
||||
// - ~/ts3.7/base.d.ts - Definitions specific to TypeScript 3.7
|
||||
// - ~/ts3.7/index.d.ts - Definitions specific to TypeScript 3.7 with assert pulled in
|
||||
|
||||
// Reference required types from the default lib:
|
||||
/// <reference lib="es2018" />
|
||||
/// <reference lib="esnext.asynciterable" />
|
||||
/// <reference lib="esnext.intl" />
|
||||
/// <reference lib="esnext.bigint" />
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
/// <reference path="ts3.6/base.d.ts" />
|
||||
|
||||
// TypeScript 3.7-specific augmentations:
|
||||
/// <reference path="assert.d.ts" />
|
||||
112
node_modules/@types/node/buffer.d.ts
generated
vendored
112
node_modules/@types/node/buffer.d.ts
generated
vendored
@@ -1,112 +0,0 @@
|
||||
declare module 'buffer' {
|
||||
import { BinaryLike } from 'crypto';
|
||||
|
||||
export const INSPECT_MAX_BYTES: number;
|
||||
export const kMaxLength: number;
|
||||
export const kStringMaxLength: number;
|
||||
export const constants: {
|
||||
MAX_LENGTH: number;
|
||||
MAX_STRING_LENGTH: number;
|
||||
};
|
||||
const BuffType: typeof Buffer;
|
||||
|
||||
export type TranscodeEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "latin1" | "binary";
|
||||
|
||||
export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer;
|
||||
|
||||
export const SlowBuffer: {
|
||||
/** @deprecated since v6.0.0, use `Buffer.allocUnsafeSlow()` */
|
||||
new(size: number): Buffer;
|
||||
prototype: Buffer;
|
||||
};
|
||||
|
||||
export { BuffType as Buffer };
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface BlobOptions {
|
||||
/**
|
||||
* @default 'utf8'
|
||||
*/
|
||||
encoding?: BufferEncoding;
|
||||
|
||||
/**
|
||||
* The Blob content-type. The intent is for `type` to convey
|
||||
* the MIME media type of the data, however no validation of the type format
|
||||
* is performed.
|
||||
*/
|
||||
type?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export class Blob {
|
||||
/**
|
||||
* Returns a promise that fulfills with an {ArrayBuffer} containing a copy of the `Blob` data.
|
||||
*/
|
||||
readonly size: number;
|
||||
|
||||
/**
|
||||
* The content-type of the `Blob`.
|
||||
*/
|
||||
readonly type: string;
|
||||
|
||||
/**
|
||||
* Creates a new `Blob` object containing a concatenation of the given sources.
|
||||
*
|
||||
* {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into
|
||||
* the 'Blob' and can therefore be safely modified after the 'Blob' is created.
|
||||
*
|
||||
* String sources are also copied into the `Blob`.
|
||||
*/
|
||||
constructor(sources: Array<(BinaryLike | Blob)>, options?: BlobOptions);
|
||||
|
||||
arrayBuffer(): Promise<ArrayBuffer>;
|
||||
|
||||
/**
|
||||
* @param start The starting index.
|
||||
* @param end The ending index.
|
||||
* @param type The content-type for the new `Blob`
|
||||
*/
|
||||
slice(start?: number, end?: number, type?: string): Blob;
|
||||
|
||||
/**
|
||||
* Returns a promise that resolves the contents of the `Blob` decoded as a UTF-8 string.
|
||||
*/
|
||||
text(): Promise<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a string of Base64-encoded data into bytes, and encodes those bytes into a string using Latin-1 (ISO-8859-1).
|
||||
*
|
||||
* This function is only provided for compatibility with legacy web platform APIs
|
||||
* and should never be used in new code, because they use strings to represent
|
||||
* binary data and predate the introduction of typed arrays in JavaScript.
|
||||
* For code running using Node.js APIs, converting between base64-encoded strings
|
||||
* and binary data should be performed using `Buffer.from(str, 'base64')` and
|
||||
* `buf.toString('base64')`.
|
||||
*
|
||||
* @deprecated dom compatibility
|
||||
*/
|
||||
export function atob(input: string): string;
|
||||
|
||||
/**
|
||||
* Decodes a string into bytes using Latin-1 (ISO-8859), and encodes those bytes into a string using Base64.
|
||||
*
|
||||
* This function is only provided for compatibility with legacy web platform APIs
|
||||
* and should never be used in new code, because they use strings to represent
|
||||
* binary data and predate the introduction of typed arrays in JavaScript.
|
||||
* For code running using Node.js APIs, converting between base64-encoded strings
|
||||
* and binary data should be performed using `Buffer.from(str, 'base64')` and
|
||||
* `buf.toString('base64')`.
|
||||
*
|
||||
* @deprecated dom compatibility
|
||||
*/
|
||||
export function btoa(input: string): string;
|
||||
}
|
||||
|
||||
declare module 'node:buffer' {
|
||||
export * from 'buffer';
|
||||
}
|
||||
529
node_modules/@types/node/child_process.d.ts
generated
vendored
529
node_modules/@types/node/child_process.d.ts
generated
vendored
@@ -1,529 +0,0 @@
|
||||
declare module 'child_process' {
|
||||
import { BaseEncodingOptions } from 'fs';
|
||||
import { EventEmitter, Abortable } from 'events';
|
||||
import * as net from 'net';
|
||||
import { Writable, Readable, Stream, Pipe } from 'stream';
|
||||
|
||||
type Serializable = string | object | number | boolean | bigint;
|
||||
type SendHandle = net.Socket | net.Server;
|
||||
|
||||
interface ChildProcess extends EventEmitter {
|
||||
stdin: Writable | null;
|
||||
stdout: Readable | null;
|
||||
stderr: Readable | null;
|
||||
readonly channel?: Pipe | null;
|
||||
readonly stdio: [
|
||||
Writable | null, // stdin
|
||||
Readable | null, // stdout
|
||||
Readable | null, // stderr
|
||||
Readable | Writable | null | undefined, // extra
|
||||
Readable | Writable | null | undefined // extra
|
||||
];
|
||||
readonly killed: boolean;
|
||||
readonly pid?: number;
|
||||
readonly connected: boolean;
|
||||
readonly exitCode: number | null;
|
||||
readonly signalCode: NodeJS.Signals | null;
|
||||
readonly spawnargs: string[];
|
||||
readonly spawnfile: string;
|
||||
kill(signal?: NodeJS.Signals | number): boolean;
|
||||
send(message: Serializable, callback?: (error: Error | null) => void): boolean;
|
||||
send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean;
|
||||
send(message: Serializable, sendHandle?: SendHandle, options?: MessageOptions, callback?: (error: Error | null) => void): boolean;
|
||||
disconnect(): void;
|
||||
unref(): void;
|
||||
ref(): void;
|
||||
|
||||
/**
|
||||
* events.EventEmitter
|
||||
* 1. close
|
||||
* 2. disconnect
|
||||
* 3. error
|
||||
* 4. exit
|
||||
* 5. message
|
||||
* 6. spawn
|
||||
*/
|
||||
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
addListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
||||
addListener(event: "disconnect", listener: () => void): this;
|
||||
addListener(event: "error", listener: (err: Error) => void): this;
|
||||
addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
||||
addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
||||
addListener(event: "spawn", listener: () => void): this;
|
||||
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean;
|
||||
emit(event: "disconnect"): boolean;
|
||||
emit(event: "error", err: Error): boolean;
|
||||
emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean;
|
||||
emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean;
|
||||
emit(event: "spawn", listener: () => void): boolean;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
||||
on(event: "disconnect", listener: () => void): this;
|
||||
on(event: "error", listener: (err: Error) => void): this;
|
||||
on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
||||
on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
||||
on(event: "spawn", listener: () => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
||||
once(event: "disconnect", listener: () => void): this;
|
||||
once(event: "error", listener: (err: Error) => void): this;
|
||||
once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
||||
once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
||||
once(event: "spawn", listener: () => void): this;
|
||||
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
||||
prependListener(event: "disconnect", listener: () => void): this;
|
||||
prependListener(event: "error", listener: (err: Error) => void): this;
|
||||
prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
||||
prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
||||
prependListener(event: "spawn", listener: () => void): this;
|
||||
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
||||
prependOnceListener(event: "disconnect", listener: () => void): this;
|
||||
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
||||
prependOnceListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
||||
prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
||||
prependOnceListener(event: "spawn", listener: () => void): this;
|
||||
}
|
||||
|
||||
// return this object when stdio option is undefined or not specified
|
||||
interface ChildProcessWithoutNullStreams extends ChildProcess {
|
||||
stdin: Writable;
|
||||
stdout: Readable;
|
||||
stderr: Readable;
|
||||
readonly stdio: [
|
||||
Writable, // stdin
|
||||
Readable, // stdout
|
||||
Readable, // stderr
|
||||
Readable | Writable | null | undefined, // extra, no modification
|
||||
Readable | Writable | null | undefined // extra, no modification
|
||||
];
|
||||
}
|
||||
|
||||
// return this object when stdio option is a tuple of 3
|
||||
interface ChildProcessByStdio<
|
||||
I extends null | Writable,
|
||||
O extends null | Readable,
|
||||
E extends null | Readable,
|
||||
> extends ChildProcess {
|
||||
stdin: I;
|
||||
stdout: O;
|
||||
stderr: E;
|
||||
readonly stdio: [
|
||||
I,
|
||||
O,
|
||||
E,
|
||||
Readable | Writable | null | undefined, // extra, no modification
|
||||
Readable | Writable | null | undefined // extra, no modification
|
||||
];
|
||||
}
|
||||
|
||||
interface MessageOptions {
|
||||
keepOpen?: boolean;
|
||||
}
|
||||
|
||||
type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
|
||||
|
||||
type StdioOptions = IOType | Array<(IOType | "ipc" | Stream | number | null | undefined)>;
|
||||
|
||||
type SerializationType = 'json' | 'advanced';
|
||||
|
||||
interface MessagingOptions extends Abortable {
|
||||
/**
|
||||
* Specify the kind of serialization used for sending messages between processes.
|
||||
* @default 'json'
|
||||
*/
|
||||
serialization?: SerializationType;
|
||||
|
||||
/**
|
||||
* The signal value to be used when the spawned process will be killed by the abort signal.
|
||||
* @default 'SIGTERM'
|
||||
*/
|
||||
killSignal?: NodeJS.Signals | number;
|
||||
|
||||
/**
|
||||
* In milliseconds the maximum amount of time the process is allowed to run.
|
||||
*/
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
interface ProcessEnvOptions {
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
cwd?: string;
|
||||
env?: NodeJS.ProcessEnv;
|
||||
}
|
||||
|
||||
interface CommonOptions extends ProcessEnvOptions {
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
windowsHide?: boolean;
|
||||
/**
|
||||
* @default 0
|
||||
*/
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable {
|
||||
argv0?: string;
|
||||
stdio?: StdioOptions;
|
||||
shell?: boolean | string;
|
||||
windowsVerbatimArguments?: boolean;
|
||||
}
|
||||
|
||||
interface SpawnOptions extends CommonSpawnOptions {
|
||||
detached?: boolean;
|
||||
}
|
||||
|
||||
interface SpawnOptionsWithoutStdio extends SpawnOptions {
|
||||
stdio?: StdioPipeNamed | StdioPipe[];
|
||||
}
|
||||
|
||||
type StdioNull = 'inherit' | 'ignore' | Stream;
|
||||
type StdioPipeNamed = 'pipe' | 'overlapped';
|
||||
type StdioPipe = undefined | null | StdioPipeNamed;
|
||||
|
||||
interface SpawnOptionsWithStdioTuple<
|
||||
Stdin extends StdioNull | StdioPipe,
|
||||
Stdout extends StdioNull | StdioPipe,
|
||||
Stderr extends StdioNull | StdioPipe,
|
||||
> extends SpawnOptions {
|
||||
stdio: [Stdin, Stdout, Stderr];
|
||||
}
|
||||
|
||||
// overloads of spawn without 'args'
|
||||
function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
|
||||
|
||||
function spawn(
|
||||
command: string,
|
||||
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
|
||||
): ChildProcessByStdio<Writable, Readable, Readable>;
|
||||
function spawn(
|
||||
command: string,
|
||||
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
|
||||
): ChildProcessByStdio<Writable, Readable, null>;
|
||||
function spawn(
|
||||
command: string,
|
||||
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
|
||||
): ChildProcessByStdio<Writable, null, Readable>;
|
||||
function spawn(
|
||||
command: string,
|
||||
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
|
||||
): ChildProcessByStdio<null, Readable, Readable>;
|
||||
function spawn(
|
||||
command: string,
|
||||
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
|
||||
): ChildProcessByStdio<Writable, null, null>;
|
||||
function spawn(
|
||||
command: string,
|
||||
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
|
||||
): ChildProcessByStdio<null, Readable, null>;
|
||||
function spawn(
|
||||
command: string,
|
||||
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
|
||||
): ChildProcessByStdio<null, null, Readable>;
|
||||
function spawn(
|
||||
command: string,
|
||||
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
|
||||
): ChildProcessByStdio<null, null, null>;
|
||||
|
||||
function spawn(command: string, options: SpawnOptions): ChildProcess;
|
||||
|
||||
// overloads of spawn with 'args'
|
||||
function spawn(command: string, args?: ReadonlyArray<string>, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
|
||||
|
||||
function spawn(
|
||||
command: string,
|
||||
args: ReadonlyArray<string>,
|
||||
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
|
||||
): ChildProcessByStdio<Writable, Readable, Readable>;
|
||||
function spawn(
|
||||
command: string,
|
||||
args: ReadonlyArray<string>,
|
||||
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
|
||||
): ChildProcessByStdio<Writable, Readable, null>;
|
||||
function spawn(
|
||||
command: string,
|
||||
args: ReadonlyArray<string>,
|
||||
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
|
||||
): ChildProcessByStdio<Writable, null, Readable>;
|
||||
function spawn(
|
||||
command: string,
|
||||
args: ReadonlyArray<string>,
|
||||
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
|
||||
): ChildProcessByStdio<null, Readable, Readable>;
|
||||
function spawn(
|
||||
command: string,
|
||||
args: ReadonlyArray<string>,
|
||||
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
|
||||
): ChildProcessByStdio<Writable, null, null>;
|
||||
function spawn(
|
||||
command: string,
|
||||
args: ReadonlyArray<string>,
|
||||
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
|
||||
): ChildProcessByStdio<null, Readable, null>;
|
||||
function spawn(
|
||||
command: string,
|
||||
args: ReadonlyArray<string>,
|
||||
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
|
||||
): ChildProcessByStdio<null, null, Readable>;
|
||||
function spawn(
|
||||
command: string,
|
||||
args: ReadonlyArray<string>,
|
||||
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
|
||||
): ChildProcessByStdio<null, null, null>;
|
||||
|
||||
function spawn(command: string, args: ReadonlyArray<string>, options: SpawnOptions): ChildProcess;
|
||||
|
||||
interface ExecOptions extends CommonOptions {
|
||||
shell?: string;
|
||||
maxBuffer?: number;
|
||||
killSignal?: NodeJS.Signals | number;
|
||||
}
|
||||
|
||||
interface ExecOptionsWithStringEncoding extends ExecOptions {
|
||||
encoding: BufferEncoding;
|
||||
}
|
||||
|
||||
interface ExecOptionsWithBufferEncoding extends ExecOptions {
|
||||
encoding: BufferEncoding | null; // specify `null`.
|
||||
}
|
||||
|
||||
interface ExecException extends Error {
|
||||
cmd?: string;
|
||||
killed?: boolean;
|
||||
code?: number;
|
||||
signal?: NodeJS.Signals;
|
||||
}
|
||||
|
||||
// no `options` definitely means stdout/stderr are `string`.
|
||||
function exec(command: string, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
|
||||
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
||||
function exec(command: string, options: { encoding: "buffer" | null } & ExecOptions, callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
||||
|
||||
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
|
||||
function exec(command: string, options: { encoding: BufferEncoding } & ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
|
||||
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
||||
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
||||
function exec(
|
||||
command: string,
|
||||
options: { encoding: BufferEncoding } & ExecOptions,
|
||||
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
||||
): ChildProcess;
|
||||
|
||||
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
||||
function exec(command: string, options: ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
|
||||
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
||||
function exec(
|
||||
command: string,
|
||||
options: (BaseEncodingOptions & ExecOptions) | undefined | null,
|
||||
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
||||
): ChildProcess;
|
||||
|
||||
interface PromiseWithChild<T> extends Promise<T> {
|
||||
child: ChildProcess;
|
||||
}
|
||||
|
||||
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
||||
namespace exec {
|
||||
function __promisify__(command: string): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
|
||||
function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(command: string, options: ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(command: string, options?: (BaseEncodingOptions & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
||||
}
|
||||
|
||||
interface ExecFileOptions extends CommonOptions, Abortable {
|
||||
maxBuffer?: number;
|
||||
killSignal?: NodeJS.Signals | number;
|
||||
windowsVerbatimArguments?: boolean;
|
||||
shell?: boolean | string;
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
|
||||
encoding: BufferEncoding;
|
||||
}
|
||||
interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
|
||||
encoding: 'buffer' | null;
|
||||
}
|
||||
interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {
|
||||
encoding: BufferEncoding;
|
||||
}
|
||||
type ExecFileException = ExecException & NodeJS.ErrnoException;
|
||||
|
||||
function execFile(file: string): ChildProcess;
|
||||
function execFile(file: string, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
|
||||
function execFile(file: string, args?: ReadonlyArray<string> | null): ChildProcess;
|
||||
function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
|
||||
|
||||
// no `options` definitely means stdout/stderr are `string`.
|
||||
function execFile(file: string, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
function execFile(file: string, args: ReadonlyArray<string> | undefined | null, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
|
||||
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
||||
function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
||||
function execFile(
|
||||
file: string,
|
||||
args: ReadonlyArray<string> | undefined | null,
|
||||
options: ExecFileOptionsWithBufferEncoding,
|
||||
callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
|
||||
): ChildProcess;
|
||||
|
||||
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
|
||||
function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
function execFile(
|
||||
file: string,
|
||||
args: ReadonlyArray<string> | undefined | null,
|
||||
options: ExecFileOptionsWithStringEncoding,
|
||||
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
||||
): ChildProcess;
|
||||
|
||||
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
||||
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
||||
function execFile(
|
||||
file: string,
|
||||
options: ExecFileOptionsWithOtherEncoding,
|
||||
callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
||||
): ChildProcess;
|
||||
function execFile(
|
||||
file: string,
|
||||
args: ReadonlyArray<string> | undefined | null,
|
||||
options: ExecFileOptionsWithOtherEncoding,
|
||||
callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
||||
): ChildProcess;
|
||||
|
||||
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
||||
function execFile(file: string, options: ExecFileOptions, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
function execFile(
|
||||
file: string,
|
||||
args: ReadonlyArray<string> | undefined | null,
|
||||
options: ExecFileOptions,
|
||||
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void
|
||||
): ChildProcess;
|
||||
|
||||
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
||||
function execFile(
|
||||
file: string,
|
||||
options: (BaseEncodingOptions & ExecFileOptions) | undefined | null,
|
||||
callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
|
||||
): ChildProcess;
|
||||
function execFile(
|
||||
file: string,
|
||||
args: ReadonlyArray<string> | undefined | null,
|
||||
options: (BaseEncodingOptions & ExecFileOptions) | undefined | null,
|
||||
callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
|
||||
): ChildProcess;
|
||||
|
||||
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
||||
namespace execFile {
|
||||
function __promisify__(file: string): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
|
||||
function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
|
||||
function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
||||
function __promisify__(
|
||||
file: string,
|
||||
args: ReadonlyArray<string> | undefined | null,
|
||||
options: ExecFileOptionsWithOtherEncoding,
|
||||
): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
||||
function __promisify__(file: string, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(file: string, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
||||
function __promisify__(
|
||||
file: string,
|
||||
args: ReadonlyArray<string> | undefined | null,
|
||||
options: (BaseEncodingOptions & ExecFileOptions) | undefined | null,
|
||||
): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
||||
}
|
||||
|
||||
interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable {
|
||||
execPath?: string;
|
||||
execArgv?: string[];
|
||||
silent?: boolean;
|
||||
stdio?: StdioOptions;
|
||||
detached?: boolean;
|
||||
windowsVerbatimArguments?: boolean;
|
||||
}
|
||||
function fork(modulePath: string, options?: ForkOptions): ChildProcess;
|
||||
function fork(modulePath: string, args?: ReadonlyArray<string>, options?: ForkOptions): ChildProcess;
|
||||
|
||||
interface SpawnSyncOptions extends CommonSpawnOptions {
|
||||
input?: string | NodeJS.ArrayBufferView;
|
||||
maxBuffer?: number;
|
||||
encoding?: BufferEncoding | 'buffer' | null;
|
||||
}
|
||||
interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
|
||||
encoding: BufferEncoding;
|
||||
}
|
||||
interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions {
|
||||
encoding?: 'buffer' | null;
|
||||
}
|
||||
interface SpawnSyncReturns<T> {
|
||||
pid: number;
|
||||
output: string[];
|
||||
stdout: T;
|
||||
stderr: T;
|
||||
status: number | null;
|
||||
signal: NodeJS.Signals | null;
|
||||
error?: Error;
|
||||
}
|
||||
function spawnSync(command: string): SpawnSyncReturns<Buffer>;
|
||||
function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
||||
function spawnSync(command: string, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
||||
function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
|
||||
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
||||
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
||||
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
|
||||
|
||||
interface CommonExecOptions extends ProcessEnvOptions {
|
||||
input?: string | NodeJS.ArrayBufferView;
|
||||
stdio?: StdioOptions;
|
||||
killSignal?: NodeJS.Signals | number;
|
||||
maxBuffer?: number;
|
||||
encoding?: BufferEncoding | 'buffer' | null;
|
||||
}
|
||||
|
||||
interface ExecSyncOptions extends CommonExecOptions {
|
||||
shell?: string;
|
||||
}
|
||||
interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
|
||||
encoding: BufferEncoding;
|
||||
}
|
||||
interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
|
||||
encoding?: 'buffer' | null;
|
||||
}
|
||||
function execSync(command: string): Buffer;
|
||||
function execSync(command: string, options?: ExecSyncOptionsWithStringEncoding): string;
|
||||
function execSync(command: string, options?: ExecSyncOptionsWithBufferEncoding): Buffer;
|
||||
function execSync(command: string, options?: ExecSyncOptions): Buffer;
|
||||
|
||||
interface ExecFileSyncOptions extends CommonExecOptions {
|
||||
shell?: boolean | string;
|
||||
}
|
||||
interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions {
|
||||
encoding: BufferEncoding;
|
||||
}
|
||||
interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
|
||||
encoding: BufferEncoding; // specify `null`.
|
||||
}
|
||||
function execFileSync(command: string): Buffer;
|
||||
function execFileSync(command: string, options?: ExecFileSyncOptionsWithStringEncoding): string;
|
||||
function execFileSync(command: string, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
||||
function execFileSync(command: string, options?: ExecFileSyncOptions): Buffer;
|
||||
function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithStringEncoding): string;
|
||||
function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
||||
function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptions): Buffer;
|
||||
}
|
||||
262
node_modules/@types/node/cluster.d.ts
generated
vendored
262
node_modules/@types/node/cluster.d.ts
generated
vendored
@@ -1,262 +0,0 @@
|
||||
declare module 'cluster' {
|
||||
import * as child from 'child_process';
|
||||
import EventEmitter = require('events');
|
||||
import * as net from 'net';
|
||||
|
||||
// interfaces
|
||||
interface ClusterSettings {
|
||||
execArgv?: string[]; // default: process.execArgv
|
||||
exec?: string;
|
||||
args?: string[];
|
||||
silent?: boolean;
|
||||
stdio?: any[];
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
inspectPort?: number | (() => number);
|
||||
}
|
||||
|
||||
interface Address {
|
||||
address: string;
|
||||
port: number;
|
||||
addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6"
|
||||
}
|
||||
|
||||
class Worker extends EventEmitter {
|
||||
id: number;
|
||||
process: child.ChildProcess;
|
||||
send(message: child.Serializable, sendHandle?: child.SendHandle, callback?: (error: Error | null) => void): boolean;
|
||||
kill(signal?: string): void;
|
||||
destroy(signal?: string): void;
|
||||
disconnect(): void;
|
||||
isConnected(): boolean;
|
||||
isDead(): boolean;
|
||||
exitedAfterDisconnect: boolean;
|
||||
|
||||
/**
|
||||
* events.EventEmitter
|
||||
* 1. disconnect
|
||||
* 2. error
|
||||
* 3. exit
|
||||
* 4. listening
|
||||
* 5. message
|
||||
* 6. online
|
||||
*/
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
addListener(event: "disconnect", listener: () => void): this;
|
||||
addListener(event: "error", listener: (error: Error) => void): this;
|
||||
addListener(event: "exit", listener: (code: number, signal: string) => void): this;
|
||||
addListener(event: "listening", listener: (address: Address) => void): this;
|
||||
addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
addListener(event: "online", listener: () => void): this;
|
||||
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "disconnect"): boolean;
|
||||
emit(event: "error", error: Error): boolean;
|
||||
emit(event: "exit", code: number, signal: string): boolean;
|
||||
emit(event: "listening", address: Address): boolean;
|
||||
emit(event: "message", message: any, handle: net.Socket | net.Server): boolean;
|
||||
emit(event: "online"): boolean;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "disconnect", listener: () => void): this;
|
||||
on(event: "error", listener: (error: Error) => void): this;
|
||||
on(event: "exit", listener: (code: number, signal: string) => void): this;
|
||||
on(event: "listening", listener: (address: Address) => void): this;
|
||||
on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
on(event: "online", listener: () => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "disconnect", listener: () => void): this;
|
||||
once(event: "error", listener: (error: Error) => void): this;
|
||||
once(event: "exit", listener: (code: number, signal: string) => void): this;
|
||||
once(event: "listening", listener: (address: Address) => void): this;
|
||||
once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
once(event: "online", listener: () => void): this;
|
||||
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "disconnect", listener: () => void): this;
|
||||
prependListener(event: "error", listener: (error: Error) => void): this;
|
||||
prependListener(event: "exit", listener: (code: number, signal: string) => void): this;
|
||||
prependListener(event: "listening", listener: (address: Address) => void): this;
|
||||
prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
prependListener(event: "online", listener: () => void): this;
|
||||
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "disconnect", listener: () => void): this;
|
||||
prependOnceListener(event: "error", listener: (error: Error) => void): this;
|
||||
prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this;
|
||||
prependOnceListener(event: "listening", listener: (address: Address) => void): this;
|
||||
prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
prependOnceListener(event: "online", listener: () => void): this;
|
||||
}
|
||||
|
||||
interface Cluster extends EventEmitter {
|
||||
Worker: Worker;
|
||||
disconnect(callback?: () => void): void;
|
||||
fork(env?: any): Worker;
|
||||
isMaster: boolean;
|
||||
isWorker: boolean;
|
||||
schedulingPolicy: number;
|
||||
settings: ClusterSettings;
|
||||
setupMaster(settings?: ClusterSettings): void;
|
||||
worker?: Worker;
|
||||
workers?: NodeJS.Dict<Worker>;
|
||||
|
||||
readonly SCHED_NONE: number;
|
||||
readonly SCHED_RR: number;
|
||||
|
||||
/**
|
||||
* events.EventEmitter
|
||||
* 1. disconnect
|
||||
* 2. exit
|
||||
* 3. fork
|
||||
* 4. listening
|
||||
* 5. message
|
||||
* 6. online
|
||||
* 7. setup
|
||||
*/
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
addListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
||||
addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||
addListener(event: "fork", listener: (worker: Worker) => void): this;
|
||||
addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
||||
addListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
addListener(event: "online", listener: (worker: Worker) => void): this;
|
||||
addListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
||||
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "disconnect", worker: Worker): boolean;
|
||||
emit(event: "exit", worker: Worker, code: number, signal: string): boolean;
|
||||
emit(event: "fork", worker: Worker): boolean;
|
||||
emit(event: "listening", worker: Worker, address: Address): boolean;
|
||||
emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
|
||||
emit(event: "online", worker: Worker): boolean;
|
||||
emit(event: "setup", settings: ClusterSettings): boolean;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "disconnect", listener: (worker: Worker) => void): this;
|
||||
on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||
on(event: "fork", listener: (worker: Worker) => void): this;
|
||||
on(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
||||
on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
on(event: "online", listener: (worker: Worker) => void): this;
|
||||
on(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "disconnect", listener: (worker: Worker) => void): this;
|
||||
once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||
once(event: "fork", listener: (worker: Worker) => void): this;
|
||||
once(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
||||
once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
once(event: "online", listener: (worker: Worker) => void): this;
|
||||
once(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
||||
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
||||
prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||
prependListener(event: "fork", listener: (worker: Worker) => void): this;
|
||||
prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
||||
prependListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
prependListener(event: "online", listener: (worker: Worker) => void): this;
|
||||
prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
||||
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
||||
prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||
prependOnceListener(event: "fork", listener: (worker: Worker) => void): this;
|
||||
prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
||||
// the handle is a net.Socket or net.Server object, or undefined.
|
||||
prependOnceListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this;
|
||||
prependOnceListener(event: "online", listener: (worker: Worker) => void): this;
|
||||
prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
||||
}
|
||||
|
||||
const SCHED_NONE: number;
|
||||
const SCHED_RR: number;
|
||||
|
||||
function disconnect(callback?: () => void): void;
|
||||
function fork(env?: any): Worker;
|
||||
const isMaster: boolean;
|
||||
const isWorker: boolean;
|
||||
let schedulingPolicy: number;
|
||||
const settings: ClusterSettings;
|
||||
function setupMaster(settings?: ClusterSettings): void;
|
||||
const worker: Worker;
|
||||
const workers: NodeJS.Dict<Worker>;
|
||||
|
||||
/**
|
||||
* events.EventEmitter
|
||||
* 1. disconnect
|
||||
* 2. exit
|
||||
* 3. fork
|
||||
* 4. listening
|
||||
* 5. message
|
||||
* 6. online
|
||||
* 7. setup
|
||||
*/
|
||||
function addListener(event: string, listener: (...args: any[]) => void): Cluster;
|
||||
function addListener(event: "disconnect", listener: (worker: Worker) => void): Cluster;
|
||||
function addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster;
|
||||
function addListener(event: "fork", listener: (worker: Worker) => void): Cluster;
|
||||
function addListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
|
||||
// the handle is a net.Socket or net.Server object, or undefined.
|
||||
function addListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster;
|
||||
function addListener(event: "online", listener: (worker: Worker) => void): Cluster;
|
||||
function addListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster;
|
||||
|
||||
function emit(event: string | symbol, ...args: any[]): boolean;
|
||||
function emit(event: "disconnect", worker: Worker): boolean;
|
||||
function emit(event: "exit", worker: Worker, code: number, signal: string): boolean;
|
||||
function emit(event: "fork", worker: Worker): boolean;
|
||||
function emit(event: "listening", worker: Worker, address: Address): boolean;
|
||||
function emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
|
||||
function emit(event: "online", worker: Worker): boolean;
|
||||
function emit(event: "setup", settings: ClusterSettings): boolean;
|
||||
|
||||
function on(event: string, listener: (...args: any[]) => void): Cluster;
|
||||
function on(event: "disconnect", listener: (worker: Worker) => void): Cluster;
|
||||
function on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster;
|
||||
function on(event: "fork", listener: (worker: Worker) => void): Cluster;
|
||||
function on(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
|
||||
function on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
function on(event: "online", listener: (worker: Worker) => void): Cluster;
|
||||
function on(event: "setup", listener: (settings: ClusterSettings) => void): Cluster;
|
||||
|
||||
function once(event: string, listener: (...args: any[]) => void): Cluster;
|
||||
function once(event: "disconnect", listener: (worker: Worker) => void): Cluster;
|
||||
function once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster;
|
||||
function once(event: "fork", listener: (worker: Worker) => void): Cluster;
|
||||
function once(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
|
||||
function once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
function once(event: "online", listener: (worker: Worker) => void): Cluster;
|
||||
function once(event: "setup", listener: (settings: ClusterSettings) => void): Cluster;
|
||||
|
||||
function removeListener(event: string, listener: (...args: any[]) => void): Cluster;
|
||||
function removeAllListeners(event?: string): Cluster;
|
||||
function setMaxListeners(n: number): Cluster;
|
||||
function getMaxListeners(): number;
|
||||
function listeners(event: string): Function[];
|
||||
function listenerCount(type: string): number;
|
||||
|
||||
function prependListener(event: string, listener: (...args: any[]) => void): Cluster;
|
||||
function prependListener(event: "disconnect", listener: (worker: Worker) => void): Cluster;
|
||||
function prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster;
|
||||
function prependListener(event: "fork", listener: (worker: Worker) => void): Cluster;
|
||||
function prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
|
||||
// the handle is a net.Socket or net.Server object, or undefined.
|
||||
function prependListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster;
|
||||
function prependListener(event: "online", listener: (worker: Worker) => void): Cluster;
|
||||
function prependListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster;
|
||||
|
||||
function prependOnceListener(event: string, listener: (...args: any[]) => void): Cluster;
|
||||
function prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): Cluster;
|
||||
function prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster;
|
||||
function prependOnceListener(event: "fork", listener: (worker: Worker) => void): Cluster;
|
||||
function prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
|
||||
// the handle is a net.Socket or net.Server object, or undefined.
|
||||
function prependOnceListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster;
|
||||
function prependOnceListener(event: "online", listener: (worker: Worker) => void): Cluster;
|
||||
function prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster;
|
||||
|
||||
function eventNames(): string[];
|
||||
}
|
||||
133
node_modules/@types/node/console.d.ts
generated
vendored
133
node_modules/@types/node/console.d.ts
generated
vendored
@@ -1,133 +0,0 @@
|
||||
declare module 'console' {
|
||||
import { InspectOptions } from 'util';
|
||||
|
||||
global {
|
||||
// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
|
||||
interface Console {
|
||||
Console: NodeJS.ConsoleConstructor;
|
||||
/**
|
||||
* A simple assertion test that verifies whether `value` is truthy.
|
||||
* If it is not, an `AssertionError` is thrown.
|
||||
* If provided, the error `message` is formatted using `util.format()` and used as the error message.
|
||||
*/
|
||||
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
||||
/**
|
||||
* When `stdout` is a TTY, calling `console.clear()` will attempt to clear the TTY.
|
||||
* When `stdout` is not a TTY, this method does nothing.
|
||||
*/
|
||||
clear(): void;
|
||||
/**
|
||||
* Maintains an internal counter specific to `label` and outputs to `stdout` the number of times `console.count()` has been called with the given `label`.
|
||||
*/
|
||||
count(label?: string): void;
|
||||
/**
|
||||
* Resets the internal counter specific to `label`.
|
||||
*/
|
||||
countReset(label?: string): void;
|
||||
/**
|
||||
* The `console.debug()` function is an alias for {@link console.log()}.
|
||||
*/
|
||||
debug(message?: any, ...optionalParams: any[]): void;
|
||||
/**
|
||||
* Uses {@link util.inspect()} on `obj` and prints the resulting string to `stdout`.
|
||||
* This function bypasses any custom `inspect()` function defined on `obj`.
|
||||
*/
|
||||
dir(obj: any, options?: InspectOptions): void;
|
||||
/**
|
||||
* This method calls {@link console.log()} passing it the arguments received. Please note that this method does not produce any XML formatting
|
||||
*/
|
||||
dirxml(...data: any[]): void;
|
||||
/**
|
||||
* Prints to `stderr` with newline.
|
||||
*/
|
||||
error(message?: any, ...optionalParams: any[]): void;
|
||||
/**
|
||||
* Increases indentation of subsequent lines by two spaces.
|
||||
* If one or more `label`s are provided, those are printed first without the additional indentation.
|
||||
*/
|
||||
group(...label: any[]): void;
|
||||
/**
|
||||
* The `console.groupCollapsed()` function is an alias for {@link console.group()}.
|
||||
*/
|
||||
groupCollapsed(...label: any[]): void;
|
||||
/**
|
||||
* Decreases indentation of subsequent lines by two spaces.
|
||||
*/
|
||||
groupEnd(): void;
|
||||
/**
|
||||
* The {@link console.info()} function is an alias for {@link console.log()}.
|
||||
*/
|
||||
info(message?: any, ...optionalParams: any[]): void;
|
||||
/**
|
||||
* Prints to `stdout` with newline.
|
||||
*/
|
||||
log(message?: any, ...optionalParams: any[]): void;
|
||||
/**
|
||||
* This method does not display anything unless used in the inspector.
|
||||
* Prints to `stdout` the array `array` formatted as a table.
|
||||
*/
|
||||
table(tabularData: any, properties?: ReadonlyArray<string>): void;
|
||||
/**
|
||||
* Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique `label`.
|
||||
*/
|
||||
time(label?: string): void;
|
||||
/**
|
||||
* Stops a timer that was previously started by calling {@link console.time()} and prints the result to `stdout`.
|
||||
*/
|
||||
timeEnd(label?: string): void;
|
||||
/**
|
||||
* For a timer that was previously started by calling {@link console.time()}, prints the elapsed time and other `data` arguments to `stdout`.
|
||||
*/
|
||||
timeLog(label?: string, ...data: any[]): void;
|
||||
/**
|
||||
* Prints to `stderr` the string 'Trace :', followed by the {@link util.format()} formatted message and stack trace to the current position in the code.
|
||||
*/
|
||||
trace(message?: any, ...optionalParams: any[]): void;
|
||||
/**
|
||||
* The {@link console.warn()} function is an alias for {@link console.error()}.
|
||||
*/
|
||||
warn(message?: any, ...optionalParams: any[]): void;
|
||||
|
||||
// --- Inspector mode only ---
|
||||
/**
|
||||
* This method does not display anything unless used in the inspector.
|
||||
* Starts a JavaScript CPU profile with an optional label.
|
||||
*/
|
||||
profile(label?: string): void;
|
||||
/**
|
||||
* This method does not display anything unless used in the inspector.
|
||||
* Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector.
|
||||
*/
|
||||
profileEnd(label?: string): void;
|
||||
/**
|
||||
* This method does not display anything unless used in the inspector.
|
||||
* Adds an event with the label `label` to the Timeline panel of the inspector.
|
||||
*/
|
||||
timeStamp(label?: string): void;
|
||||
}
|
||||
|
||||
var console: Console;
|
||||
|
||||
namespace NodeJS {
|
||||
interface ConsoleConstructorOptions {
|
||||
stdout: WritableStream;
|
||||
stderr?: WritableStream;
|
||||
ignoreErrors?: boolean;
|
||||
colorMode?: boolean | 'auto';
|
||||
inspectOptions?: InspectOptions;
|
||||
}
|
||||
|
||||
interface ConsoleConstructor {
|
||||
prototype: Console;
|
||||
new(stdout: WritableStream, stderr?: WritableStream, ignoreErrors?: boolean): Console;
|
||||
new(options: ConsoleConstructorOptions): Console;
|
||||
}
|
||||
|
||||
interface Global {
|
||||
console: typeof console;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export = console;
|
||||
}
|
||||
13
node_modules/@types/node/constants.d.ts
generated
vendored
13
node_modules/@types/node/constants.d.ts
generated
vendored
@@ -1,13 +0,0 @@
|
||||
/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
|
||||
declare module 'constants' {
|
||||
import { constants as osConstants, SignalConstants } from 'os';
|
||||
import { constants as cryptoConstants } from 'crypto';
|
||||
import { constants as fsConstants } from 'fs';
|
||||
|
||||
const exp: typeof osConstants.errno &
|
||||
typeof osConstants.priority &
|
||||
SignalConstants &
|
||||
typeof cryptoConstants &
|
||||
typeof fsConstants;
|
||||
export = exp;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user