mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
deps: upgrade npm to 9.6.3
PR-URL: https://github.com/nodejs/node/pull/47325 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Luke Karrys <luke@lukekarrys.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
ece029f64e
commit
c10729ffa7
321 files changed
+12279
-15797
No files matched your search
Vendored
+1
-11
@@ -27,17 +27,7 @@ curl -qL https://www.npmjs.com/install.sh | sh
|
||||
|
||||
#### Node Version Managers
|
||||
|
||||
If you're looking to manage multiple versions of **`node`** &/or **`npm`**, consider using a "Node Version Manager" such as:
|
||||
|
||||
* [**`nvm`**](https://github.com/nvm-sh/nvm)
|
||||
* [**`nvs`**](https://github.com/jasongin/nvs)
|
||||
* [**`nave`**](https://github.com/isaacs/nave)
|
||||
* [**`n`**](https://github.com/tj/n)
|
||||
* [**`volta`**](https://github.com/volta-cli/volta)
|
||||
* [**`nodenv`**](https://github.com/nodenv/nodenv)
|
||||
* [**`asdf-nodejs`**](https://github.com/asdf-vm/asdf-nodejs)
|
||||
* [**`nvm-windows`**](https://github.com/coreybutler/nvm-windows)
|
||||
* [**`fnm`**](https://github.com/Schniz/fnm)
|
||||
If you're looking to manage multiple versions of **`Node.js`** &/or **`npm`**, consider using a [node version manager](https://github.com/search?q=node%20version%20manager&type=repositories)
|
||||
|
||||
### Usage
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ packages will *also* show the paths to the specified packages. For
|
||||
example, running `npm ls promzard` in npm's source tree will show:
|
||||
|
||||
```bash
|
||||
npm@9.6.2 /path/to/npm
|
||||
npm@9.6.3 /path/to/npm
|
||||
└─┬ init-package-json@0.0.4
|
||||
└── promzard@0.1.5
|
||||
```
|
||||
|
||||
@@ -52,7 +52,6 @@ folder instead of the current working directory. See
|
||||
### See Also
|
||||
|
||||
* [npm root](/commands/npm-root)
|
||||
* [npm bin](/commands/npm-bin)
|
||||
* [npm folders](/configuring-npm/folders)
|
||||
* [npm config](/commands/npm-config)
|
||||
* [npmrc](/configuring-npm/npmrc)
|
||||
-1
@@ -44,7 +44,6 @@ folder instead of the current working directory. See
|
||||
### See Also
|
||||
|
||||
* [npm prefix](/commands/npm-prefix)
|
||||
* [npm bin](/commands/npm-bin)
|
||||
* [npm folders](/configuring-npm/folders)
|
||||
* [npm config](/commands/npm-config)
|
||||
* [npmrc](/configuring-npm/npmrc)
|
||||
+1
-1
@@ -14,7 +14,7 @@ Note: This command is unaware of workspaces.
|
||||
|
||||
### Version
|
||||
|
||||
9.6.2
|
||||
9.6.3
|
||||
|
||||
### Description
|
||||
|
||||
|
||||
+2
-11
@@ -38,17 +38,8 @@ npm -v
|
||||
Node version managers allow you to install and switch between multiple
|
||||
versions of Node.js and npm on your system so you can test your
|
||||
applications on multiple versions of npm to ensure they work for users on
|
||||
different versions.
|
||||
|
||||
#### OSX or Linux Node version managers
|
||||
|
||||
* [nvm](https://github.com/creationix/nvm)
|
||||
* [n](https://github.com/tj/n)
|
||||
|
||||
#### Windows Node version managers
|
||||
|
||||
* [nodist](https://github.com/marcelklehr/nodist)
|
||||
* [nvm-windows](https://github.com/coreybutler/nvm-windows)
|
||||
different versions. You can
|
||||
[search for them on GitHub](https://github.com/search?q=node%20version%20manager&type=repositories).
|
||||
|
||||
### Using a Node installer to install Node.js and npm
|
||||
|
||||
|
||||
+1
-1
@@ -160,7 +160,7 @@ tree at all, use <a href="../commands/npm-explain.html"><code>npm explain</code>
|
||||
the results to only the paths to the packages named. Note that nested
|
||||
packages will <em>also</em> show the paths to the specified packages. For
|
||||
example, running <code>npm ls promzard</code> in npm's source tree will show:</p>
|
||||
<pre><code class="language-bash">npm@9.6.2 /path/to/npm
|
||||
<pre><code class="language-bash">npm@9.6.3 /path/to/npm
|
||||
└─┬ init-package-json@0.0.4
|
||||
└── promzard@0.1.5
|
||||
</code></pre>
|
||||
|
||||
@@ -180,7 +180,6 @@ of the current working directory.</li>
|
||||
<h3 id="see-also">See Also</h3>
|
||||
<ul>
|
||||
<li><a href="../commands/npm-root.html">npm root</a></li>
|
||||
<li><a href="../commands/npm-bin.html">npm bin</a></li>
|
||||
<li><a href="../configuring-npm/folders.html">npm folders</a></li>
|
||||
<li><a href="../commands/npm-config.html">npm config</a></li>
|
||||
<li><a href="../configuring-npm/npmrc.html">npmrc</a></li>
|
||||
|
||||
-1
@@ -175,7 +175,6 @@ of the current working directory.</li>
|
||||
<h3 id="see-also">See Also</h3>
|
||||
<ul>
|
||||
<li><a href="../commands/npm-prefix.html">npm prefix</a></li>
|
||||
<li><a href="../commands/npm-bin.html">npm bin</a></li>
|
||||
<li><a href="../configuring-npm/folders.html">npm folders</a></li>
|
||||
<li><a href="../commands/npm-config.html">npm config</a></li>
|
||||
<li><a href="../configuring-npm/npmrc.html">npmrc</a></li>
|
||||
|
||||
+1
-1
@@ -150,7 +150,7 @@ npm command-line interface
|
||||
</code></pre>
|
||||
<p>Note: This command is unaware of workspaces.</p>
|
||||
<h3 id="version">Version</h3>
|
||||
<p>9.6.2</p>
|
||||
<p>9.6.3</p>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>npm is the package manager for the Node JavaScript platform. It puts
|
||||
modules in place so that node can find them, and manages dependency
|
||||
|
||||
+3
-12
@@ -142,7 +142,7 @@ npm command-line interface
|
||||
|
||||
<section id="table_of_contents">
|
||||
<h2 id="table-of-contents">Table of contents</h2>
|
||||
<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#overview">Overview</a></li><li><a href="#checking-your-version-of-npm-and-nodejs">Checking your version of npm and Node.js</a></li><li><a href="#using-a-node-version-manager-to-install-nodejs-and-npm">Using a Node version manager to install Node.js and npm</a></li><ul><li><a href="#osx-or-linux-node-version-managers">OSX or Linux Node version managers</a></li><li><a href="#windows-node-version-managers">Windows Node version managers</a></li></ul><li><a href="#using-a-node-installer-to-install-nodejs-and-npm">Using a Node installer to install Node.js and npm</a></li><ul><li><a href="#os-x-or-windows-node-installers">OS X or Windows Node installers</a></li><li><a href="#linux-or-other-operating-systems-node-installers">Linux or other operating systems Node installers</a></li><li><a href="#less-common-operating-systems">Less-common operating systems</a></li></ul></ul></div>
|
||||
<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#overview">Overview</a></li><li><a href="#checking-your-version-of-npm-and-nodejs">Checking your version of npm and Node.js</a></li><li><a href="#using-a-node-version-manager-to-install-nodejs-and-npm">Using a Node version manager to install Node.js and npm</a></li><li><a href="#using-a-node-installer-to-install-nodejs-and-npm">Using a Node installer to install Node.js and npm</a></li><ul><li><a href="#os-x-or-windows-node-installers">OS X or Windows Node installers</a></li><li><a href="#linux-or-other-operating-systems-node-installers">Linux or other operating systems Node installers</a></li><li><a href="#less-common-operating-systems">Less-common operating systems</a></li></ul></ul></div>
|
||||
</section>
|
||||
|
||||
<div id="_content"><h3 id="description">Description</h3>
|
||||
@@ -172,17 +172,8 @@ npm -v
|
||||
<p>Node version managers allow you to install and switch between multiple
|
||||
versions of Node.js and npm on your system so you can test your
|
||||
applications on multiple versions of npm to ensure they work for users on
|
||||
different versions.</p>
|
||||
<h4 id="osx-or-linux-node-version-managers">OSX or Linux Node version managers</h4>
|
||||
<ul>
|
||||
<li><a href="https://github.com/creationix/nvm">nvm</a></li>
|
||||
<li><a href="https://github.com/tj/n">n</a></li>
|
||||
</ul>
|
||||
<h4 id="windows-node-version-managers">Windows Node version managers</h4>
|
||||
<ul>
|
||||
<li><a href="https://github.com/marcelklehr/nodist">nodist</a></li>
|
||||
<li><a href="https://github.com/coreybutler/nvm-windows">nvm-windows</a></li>
|
||||
</ul>
|
||||
different versions. You can
|
||||
<a href="https://github.com/search?q=node%20version%20manager&type=repositories">search for them on GitHub</a>.</p>
|
||||
<h3 id="using-a-node-installer-to-install-nodejs-and-npm">Using a Node installer to install Node.js and npm</h3>
|
||||
<p>If you are unable to use a Node version manager, you can use a Node
|
||||
installer to install both Node.js and npm on your system.</p>
|
||||
|
||||
Vendored
+31
-76
@@ -1,41 +1,28 @@
|
||||
// This is separate to indicate that it should contain code we expect to work in
|
||||
// all conceivably runnable versions of node. This is a best effort to catch
|
||||
// syntax errors to give users a good error message if they are using a node
|
||||
// version that doesn't allow syntax we are using such as private properties, etc
|
||||
const createEnginesValidation = () => {
|
||||
const node = process.version.replace(/-.*$/, '')
|
||||
/* eslint-disable max-len */
|
||||
// Code in this file should work in all conceivably runnable versions of node.
|
||||
// A best effort is made to catch syntax errors to give users a good error message if they are using a node version that doesn't allow syntax we are using in other files such as private properties, etc
|
||||
|
||||
// Separated out for easier unit testing
|
||||
module.exports = async process => {
|
||||
// set it here so that regardless of what happens later, we don't
|
||||
// leak any private CLI configs to other programs
|
||||
process.title = 'npm'
|
||||
|
||||
// if npm is called as "npmg" or "npm_g", then run in global mode.
|
||||
if (process.argv[1][process.argv[1].length - 1] === 'g') {
|
||||
process.argv.splice(1, 1, 'npm', '-g')
|
||||
}
|
||||
|
||||
const nodeVersion = process.version.replace(/-.*$/, '')
|
||||
const pkg = require('../package.json')
|
||||
const engines = pkg.engines.node
|
||||
const npm = `v${pkg.version}`
|
||||
const npmVersion = `v${pkg.version}`
|
||||
|
||||
const cols = Math.min(Math.max(20, process.stdout.columns) || 80, 80)
|
||||
const wrap = (lines) => lines
|
||||
.join(' ')
|
||||
.split(/[ \n]+/)
|
||||
.reduce((left, right) => {
|
||||
const last = left.split('\n').pop()
|
||||
const join = last.length && last.length + right.length > cols ? '\n' : ' '
|
||||
return left + join + right
|
||||
})
|
||||
.trim()
|
||||
const unsupportedMessage = `npm ${npmVersion} does not support Node.js ${nodeVersion}. This version of npm supports the following node versions: \`${engines}\`. You can find the latest version at https://nodejs.org/.`
|
||||
|
||||
const unsupportedMessage = wrap([
|
||||
`npm ${npm} does not support Node.js ${node}.`,
|
||||
`You should probably upgrade to a newer version of node as we can't make any`,
|
||||
`promises that npm will work with this version.`,
|
||||
`This version of npm supports the following node versions: \`${engines}\`.`,
|
||||
'You can find the latest version at https://nodejs.org/.',
|
||||
])
|
||||
const brokenMessage = `ERROR: npm ${npmVersion} is known not to run on Node.js ${nodeVersion}. This version of npm supports the following node versions: \`${engines}\`. You can find the latest version at https://nodejs.org/.`
|
||||
|
||||
const brokenMessage = wrap([
|
||||
`ERROR: npm ${npm} is known not to run on Node.js ${node}.`,
|
||||
`You'll need to upgrade to a newer Node.js version in order to use this version of npm.`,
|
||||
`This version of npm supports the following node versions: \`${engines}\`.`,
|
||||
'You can find the latest version at https://nodejs.org/.',
|
||||
])
|
||||
|
||||
// coverage ignored because this is only hit in very unsupported node versions
|
||||
// and it's a best effort attempt to show something nice in those cases
|
||||
// Coverage ignored because this is only hit in very unsupported node versions and it's a best effort attempt to show something nice in those cases
|
||||
/* istanbul ignore next */
|
||||
const syntaxErrorHandler = (err) => {
|
||||
if (err instanceof SyntaxError) {
|
||||
@@ -51,74 +38,42 @@ const createEnginesValidation = () => {
|
||||
process.on('uncaughtException', syntaxErrorHandler)
|
||||
process.on('unhandledRejection', syntaxErrorHandler)
|
||||
|
||||
return {
|
||||
node,
|
||||
engines,
|
||||
unsupportedMessage,
|
||||
off: () => {
|
||||
process.off('uncaughtException', syntaxErrorHandler)
|
||||
process.off('unhandledRejection', syntaxErrorHandler)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Separated out for easier unit testing
|
||||
module.exports = async process => {
|
||||
// set it here so that regardless of what happens later, we don't
|
||||
// leak any private CLI configs to other programs
|
||||
process.title = 'npm'
|
||||
|
||||
// if npm is called as "npmg" or "npm_g", then run in global mode.
|
||||
if (process.argv[1][process.argv[1].length - 1] === 'g') {
|
||||
process.argv.splice(1, 1, 'npm', '-g')
|
||||
}
|
||||
|
||||
// Nothing should happen before this line if we can't guarantee it will
|
||||
// not have syntax errors in some version of node
|
||||
const validateEngines = createEnginesValidation()
|
||||
|
||||
const satisfies = require('semver/functions/satisfies')
|
||||
const exitHandler = require('./utils/exit-handler.js')
|
||||
const Npm = require('./npm.js')
|
||||
const npm = new Npm()
|
||||
exitHandler.setNpm(npm)
|
||||
|
||||
// only log node and npm paths in argv initially since argv can contain
|
||||
// sensitive info. a cleaned version will be logged later
|
||||
// only log node and npm paths in argv initially since argv can contain sensitive info. a cleaned version will be logged later
|
||||
const log = require('./utils/log-shim.js')
|
||||
log.verbose('cli', process.argv.slice(0, 2).join(' '))
|
||||
log.info('using', 'npm@%s', npm.version)
|
||||
log.info('using', 'node@%s', process.version)
|
||||
|
||||
// At this point we've required a few files and can be pretty sure
|
||||
// we dont contain invalid syntax for this version of node. It's
|
||||
// possible a lazy require would, but that's unlikely enough that
|
||||
// it's not worth catching anymore and we attach the more important
|
||||
// exit handlers.
|
||||
validateEngines.off()
|
||||
// At this point we've required a few files and can be pretty sure we dont contain invalid syntax for this version of node. It's possible a lazy require would, but that's unlikely enough that it's not worth catching anymore and we attach the more important exit handlers.
|
||||
process.off('uncaughtException', syntaxErrorHandler)
|
||||
process.off('unhandledRejection', syntaxErrorHandler)
|
||||
process.on('uncaughtException', exitHandler)
|
||||
process.on('unhandledRejection', exitHandler)
|
||||
|
||||
// It is now safe to log a warning if they are using a version of node
|
||||
// that is not going to fail on syntax errors but is still unsupported
|
||||
// and untested and might not work reliably. This is safe to use the logger
|
||||
// now which we want since this will show up in the error log too.
|
||||
if (!satisfies(validateEngines.node, validateEngines.engines)) {
|
||||
log.warn('cli', validateEngines.unsupportedMessage)
|
||||
// It is now safe to log a warning if they are using a version of node that is not going to fail on syntax errors but is still unsupported and untested and might not work reliably. This is safe to use the logger now which we want since this will show up in the error log too.
|
||||
if (!satisfies(nodeVersion, engines)) {
|
||||
log.warn('cli', unsupportedMessage)
|
||||
}
|
||||
|
||||
let cmd
|
||||
// now actually fire up npm and run the command.
|
||||
// this is how to use npm programmatically:
|
||||
// Now actually fire up npm and run the command.
|
||||
// This is how to use npm programmatically:
|
||||
try {
|
||||
await npm.load()
|
||||
|
||||
// npm -v
|
||||
if (npm.config.get('version', 'cli')) {
|
||||
npm.output(npm.version)
|
||||
return exitHandler()
|
||||
}
|
||||
|
||||
// npm --versions=cli
|
||||
// npm --versions
|
||||
if (npm.config.get('versions', 'cli')) {
|
||||
npm.argv = ['version']
|
||||
npm.config.set('usage', false, 'cli')
|
||||
|
||||
Vendored
+4
-5
@@ -34,9 +34,7 @@ const nopt = require('nopt')
|
||||
const { resolve } = require('path')
|
||||
|
||||
const { definitions, shorthands } = require('../utils/config/index.js')
|
||||
const { aliases, commands, plumbing } = require('../utils/cmd-list.js')
|
||||
const aliasNames = Object.keys(aliases)
|
||||
const fullList = commands.concat(aliasNames).filter(c => !plumbing.includes(c))
|
||||
const { commands, aliases } = require('../utils/cmd-list.js')
|
||||
const configNames = Object.keys(definitions)
|
||||
const shorthandNames = Object.keys(shorthands)
|
||||
const allConfs = configNames.concat(shorthandNames)
|
||||
@@ -263,7 +261,8 @@ const isFlag = word => {
|
||||
// complete against the npm commands
|
||||
// if they all resolve to the same thing, just return the thing it already is
|
||||
const cmdCompl = (opts, npm) => {
|
||||
const matches = fullList.filter(c => c.startsWith(opts.partialWord))
|
||||
const allCommands = commands.concat(Object.keys(aliases))
|
||||
const matches = allCommands.filter(c => c.startsWith(opts.partialWord))
|
||||
if (!matches.length) {
|
||||
return matches
|
||||
}
|
||||
@@ -273,7 +272,7 @@ const cmdCompl = (opts, npm) => {
|
||||
return [...derefs]
|
||||
}
|
||||
|
||||
return fullList
|
||||
return allCommands
|
||||
}
|
||||
|
||||
module.exports = Completion
|
||||
Vendored
+1
-1
@@ -78,7 +78,7 @@ class Explain extends ArboristWorkspaceCmd {
|
||||
this.npm.output(JSON.stringify(expls, null, 2))
|
||||
} else {
|
||||
this.npm.output(expls.map(expl => {
|
||||
return explainNode(expl, Infinity, this.npm.color)
|
||||
return explainNode(expl, Infinity, this.npm.chalk)
|
||||
}).join('\n\n'))
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-4
@@ -1,6 +1,5 @@
|
||||
const archy = require('archy')
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
const chalk = require('chalk')
|
||||
const pacote = require('pacote')
|
||||
const semver = require('semver')
|
||||
const npa = require('npm-package-arg')
|
||||
@@ -96,7 +95,6 @@ class Fund extends ArboristWorkspaceCmd {
|
||||
}
|
||||
|
||||
printHuman (fundingInfo) {
|
||||
const color = this.npm.color
|
||||
const unicode = this.npm.config.get('unicode')
|
||||
const seenUrls = new Map()
|
||||
|
||||
@@ -117,7 +115,7 @@ class Fund extends ArboristWorkspaceCmd {
|
||||
|
||||
if (url) {
|
||||
item.label = tree({
|
||||
label: color ? chalk.bgBlack.white(url) : url,
|
||||
label: this.npm.chalk.bgBlack.white(url),
|
||||
nodes: [pkgRef],
|
||||
}).trim()
|
||||
|
||||
@@ -154,7 +152,7 @@ class Fund extends ArboristWorkspaceCmd {
|
||||
})
|
||||
|
||||
const res = tree(result)
|
||||
return color ? chalk.reset(res) : res
|
||||
return this.npm.chalk.reset(res)
|
||||
}
|
||||
|
||||
async openFundingUrl ({ path, tree, spec, fundingSourceNumber }) {
|
||||
|
||||
Vendored
+6
-11
@@ -1,9 +1,6 @@
|
||||
const fs = require('fs')
|
||||
const { readFile } = require('fs/promises')
|
||||
const path = require('path')
|
||||
const chalk = require('chalk')
|
||||
const { promisify } = require('util')
|
||||
const glob = promisify(require('glob'))
|
||||
const readFile = promisify(fs.readFile)
|
||||
const glob = require('glob')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
const globify = pattern => pattern.split('\\').join('/')
|
||||
@@ -20,7 +17,9 @@ class HelpSearch extends BaseCommand {
|
||||
}
|
||||
|
||||
const docPath = path.resolve(this.npm.npmRoot, 'docs/content')
|
||||
const files = await glob(`${globify(docPath)}/*/*.md`)
|
||||
let files = await glob(`${globify(docPath)}/*/*.md`)
|
||||
// preserve glob@8 behavior
|
||||
files = files.sort((a, b) => a.localeCompare(b, 'en'))
|
||||
const data = await this.readFiles(files)
|
||||
const results = await this.searchFiles(args, data, files)
|
||||
const formatted = this.formatResults(args, results)
|
||||
@@ -163,10 +162,6 @@ class HelpSearch extends BaseCommand {
|
||||
return
|
||||
}
|
||||
|
||||
if (!this.npm.color) {
|
||||
out.push(line + '\n')
|
||||
return
|
||||
}
|
||||
const hilitLine = []
|
||||
for (const arg of args) {
|
||||
const finder = line.toLowerCase().split(arg.toLowerCase())
|
||||
@@ -174,7 +169,7 @@ class HelpSearch extends BaseCommand {
|
||||
for (const f of finder) {
|
||||
hilitLine.push(line.slice(p, p + f.length))
|
||||
const word = line.slice(p + f.length, p + f.length + arg.length)
|
||||
const hilit = chalk.bgBlack.red(word)
|
||||
const hilit = this.npm.chalk.bgBlack.red(word)
|
||||
hilitLine.push(hilit)
|
||||
p += f.length + arg.length
|
||||
}
|
||||
|
||||
Vendored
+8
-27
@@ -1,8 +1,7 @@
|
||||
const spawn = require('@npmcli/promise-spawn')
|
||||
const path = require('path')
|
||||
const openUrl = require('../utils/open-url.js')
|
||||
const { promisify } = require('util')
|
||||
const glob = promisify(require('glob'))
|
||||
const glob = require('glob')
|
||||
const localeCompare = require('@isaacs/string-locale-compare')('en')
|
||||
|
||||
const globify = pattern => pattern.split('\\').join('/')
|
||||
@@ -12,8 +11,6 @@ const BaseCommand = require('../base-command.js')
|
||||
// We don't currently compress our man pages but if we ever did this would
|
||||
// seamlessly continue supporting it
|
||||
const manNumberRegex = /\.(\d+)(\.[^/\\]*)?$/
|
||||
// Searches for the "npm-" prefix in page names, to prefer those.
|
||||
const manNpmPrefixRegex = /\/npm-/
|
||||
// hardcoded names for mansections
|
||||
// XXX: these are used in the docs workspace and should be exported
|
||||
// from npm so section names can changed more easily
|
||||
@@ -34,7 +31,9 @@ class Help extends BaseCommand {
|
||||
return []
|
||||
}
|
||||
const g = path.resolve(this.npm.npmRoot, 'man/man[0-9]/*.[0-9]')
|
||||
const files = await glob(globify(g))
|
||||
let files = await glob(globify(g))
|
||||
// preserve glob@8 behavior
|
||||
files = files.sort((a, b) => a.localeCompare(b, 'en'))
|
||||
|
||||
return Object.keys(files.reduce(function (acc, file) {
|
||||
file = path.basename(file).replace(/\.[0-9]+$/, '')
|
||||
@@ -65,31 +64,13 @@ class Help extends BaseCommand {
|
||||
const f = globify(path.resolve(this.npm.npmRoot, `man/${manSearch}/?(npm-)${arg}.[0-9]*`))
|
||||
|
||||
const [man] = await glob(f).then(r => r.sort((a, b) => {
|
||||
// Prefer the page with an npm prefix, if there's only one.
|
||||
const aHasPrefix = manNpmPrefixRegex.test(a)
|
||||
const bHasPrefix = manNpmPrefixRegex.test(b)
|
||||
if (aHasPrefix !== bHasPrefix) {
|
||||
/* istanbul ignore next */
|
||||
return aHasPrefix ? -1 : 1
|
||||
}
|
||||
|
||||
// Because the glob is (subtly) different from manNumberRegex,
|
||||
// we can't rely on it passing.
|
||||
const aManNumberMatch = a.match(manNumberRegex)
|
||||
const bManNumberMatch = b.match(manNumberRegex)
|
||||
if (aManNumberMatch) {
|
||||
/* istanbul ignore next */
|
||||
if (!bManNumberMatch) {
|
||||
return -1
|
||||
}
|
||||
// man number sort first so that 1 aka commands are preferred
|
||||
if (aManNumberMatch[1] !== bManNumberMatch[1]) {
|
||||
return aManNumberMatch[1] - bManNumberMatch[1]
|
||||
}
|
||||
} else if (bManNumberMatch) {
|
||||
return 1
|
||||
const aManNumberMatch = a.match(manNumberRegex)?.[1] || 999
|
||||
const bManNumberMatch = b.match(manNumberRegex)?.[1] || 999
|
||||
if (aManNumberMatch !== bManNumberMatch) {
|
||||
return aManNumberMatch - bManNumberMatch
|
||||
}
|
||||
|
||||
return localeCompare(a, b)
|
||||
}))
|
||||
|
||||
|
||||
Vendored
+13
-15
@@ -3,7 +3,6 @@ const relativePrefix = `.${sep}`
|
||||
const { EOL } = require('os')
|
||||
|
||||
const archy = require('archy')
|
||||
const chalk = require('chalk')
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
const { breadth } = require('treeverse')
|
||||
const npa = require('npm-package-arg')
|
||||
@@ -50,7 +49,7 @@ class LS extends ArboristWorkspaceCmd {
|
||||
|
||||
async exec (args) {
|
||||
const all = this.npm.config.get('all')
|
||||
const color = this.npm.color
|
||||
const chalk = this.npm.chalk
|
||||
const depth = this.npm.config.get('depth')
|
||||
const global = this.npm.global
|
||||
const json = this.npm.config.get('json')
|
||||
@@ -157,7 +156,7 @@ class LS extends ArboristWorkspaceCmd {
|
||||
? getJsonOutputItem(node, { global, long })
|
||||
: parseable
|
||||
? null
|
||||
: getHumanOutputItem(node, { args, color, global, long })
|
||||
: getHumanOutputItem(node, { args, chalk, global, long })
|
||||
|
||||
// loop through list of node problems to add them to global list
|
||||
if (node[_include]) {
|
||||
@@ -180,7 +179,7 @@ class LS extends ArboristWorkspaceCmd {
|
||||
this.npm.outputBuffer(
|
||||
json ? jsonOutput({ path, problems, result, rootError, seenItems }) :
|
||||
parseable ? parseableOutput({ seenNodes, global, long }) :
|
||||
humanOutput({ color, result, seenItems, unicode })
|
||||
humanOutput({ chalk, result, seenItems, unicode })
|
||||
)
|
||||
|
||||
// if filtering items, should exit with error code on no results
|
||||
@@ -278,9 +277,9 @@ const augmentItemWithIncludeMetadata = (node, item) => {
|
||||
return item
|
||||
}
|
||||
|
||||
const getHumanOutputItem = (node, { args, color, global, long }) => {
|
||||
const getHumanOutputItem = (node, { args, chalk, global, long }) => {
|
||||
const { pkgid, path } = node
|
||||
const workspacePkgId = color ? chalk.green(pkgid) : pkgid
|
||||
const workspacePkgId = chalk.green(pkgid)
|
||||
let printable = node.isWorkspace ? workspacePkgId : pkgid
|
||||
|
||||
// special formatting for top-level package name
|
||||
@@ -293,8 +292,7 @@ const getHumanOutputItem = (node, { args, color, global, long }) => {
|
||||
}
|
||||
}
|
||||
|
||||
const highlightDepName =
|
||||
color && args.length && node[_filteredBy]
|
||||
const highlightDepName = args.length && node[_filteredBy]
|
||||
const missingColor = isOptional(node)
|
||||
? chalk.yellow.bgBlack
|
||||
: chalk.red.bgBlack
|
||||
@@ -308,28 +306,28 @@ const getHumanOutputItem = (node, { args, color, global, long }) => {
|
||||
const label =
|
||||
(
|
||||
node[_missing]
|
||||
? (color ? missingColor(missingMsg) : missingMsg) + ' '
|
||||
? missingColor(missingMsg) + ' '
|
||||
: ''
|
||||
) +
|
||||
`${highlightDepName ? chalk.yellow.bgBlack(printable) : printable}` +
|
||||
(
|
||||
node[_dedupe]
|
||||
? ' ' + (color ? chalk.gray('deduped') : 'deduped')
|
||||
? ' ' + chalk.gray('deduped')
|
||||
: ''
|
||||
) +
|
||||
(
|
||||
invalid
|
||||
? ' ' + (color ? chalk.red.bgBlack(invalid) : invalid)
|
||||
? ' ' + chalk.red.bgBlack(invalid)
|
||||
: ''
|
||||
) +
|
||||
(
|
||||
isExtraneous(node, { global })
|
||||
? ' ' + (color ? chalk.green.bgBlack('extraneous') : 'extraneous')
|
||||
? ' ' + chalk.green.bgBlack('extraneous')
|
||||
: ''
|
||||
) +
|
||||
(
|
||||
node.overridden
|
||||
? ' ' + (color ? chalk.gray('overridden') : 'overridden')
|
||||
? ' ' + chalk.gray('overridden')
|
||||
: ''
|
||||
) +
|
||||
(isGitNode(node) ? ` (${node.resolved})` : '') +
|
||||
@@ -504,7 +502,7 @@ const augmentNodesWithMetadata = ({
|
||||
|
||||
const sortAlphabetically = ({ pkgid: a }, { pkgid: b }) => localeCompare(a, b)
|
||||
|
||||
const humanOutput = ({ color, result, seenItems, unicode }) => {
|
||||
const humanOutput = ({ chalk, result, seenItems, unicode }) => {
|
||||
// we need to traverse the entire tree in order to determine which items
|
||||
// should be included (since a nested transitive included dep will make it
|
||||
// so that all its ancestors should be displayed)
|
||||
@@ -520,7 +518,7 @@ const humanOutput = ({ color, result, seenItems, unicode }) => {
|
||||
}
|
||||
|
||||
const archyOutput = archy(result, '', { unicode })
|
||||
return color ? chalk.reset(archyOutput) : archyOutput
|
||||
return chalk.reset(archyOutput)
|
||||
}
|
||||
|
||||
const jsonOutput = ({ path, problems, result, rootError, seenItems }) => {
|
||||
|
||||
Vendored
+6
-11
@@ -2,7 +2,6 @@ const os = require('os')
|
||||
const { resolve } = require('path')
|
||||
const pacote = require('pacote')
|
||||
const table = require('text-table')
|
||||
const chalk = require('chalk')
|
||||
const npa = require('npm-package-arg')
|
||||
const pickManifest = require('npm-pick-manifest')
|
||||
const localeCompare = require('@isaacs/string-locale-compare')('en')
|
||||
@@ -104,9 +103,7 @@ class Outdated extends ArboristWorkspaceCmd {
|
||||
}
|
||||
const outTable = [outHead].concat(outList)
|
||||
|
||||
if (this.npm.color) {
|
||||
outTable[0] = outTable[0].map(heading => chalk.underline(heading))
|
||||
}
|
||||
outTable[0] = outTable[0].map(heading => this.npm.chalk.underline(heading))
|
||||
|
||||
const tableOpts = {
|
||||
align: ['l', 'r', 'r', 'r', 'l'],
|
||||
@@ -281,8 +278,8 @@ class Outdated extends ArboristWorkspaceCmd {
|
||||
? node.pkgid
|
||||
: node.name
|
||||
|
||||
return this.npm.color && humanOutput
|
||||
? chalk.green(workspaceName)
|
||||
return humanOutput
|
||||
? this.npm.chalk.green(workspaceName)
|
||||
: workspaceName
|
||||
}
|
||||
|
||||
@@ -306,11 +303,9 @@ class Outdated extends ArboristWorkspaceCmd {
|
||||
columns[7] = homepage
|
||||
}
|
||||
|
||||
if (this.npm.color) {
|
||||
columns[0] = chalk[current === wanted ? 'yellow' : 'red'](columns[0]) // current
|
||||
columns[2] = chalk.green(columns[2]) // wanted
|
||||
columns[3] = chalk.magenta(columns[3]) // latest
|
||||
}
|
||||
columns[0] = this.npm.chalk[current === wanted ? 'yellow' : 'red'](columns[0]) // current
|
||||
columns[2] = this.npm.chalk.green(columns[2]) // wanted
|
||||
columns[3] = this.npm.chalk.magenta(columns[3]) // latest
|
||||
|
||||
return columns
|
||||
}
|
||||
|
||||
Vendored
+1
-2
@@ -1,6 +1,5 @@
|
||||
const inspect = require('util').inspect
|
||||
const { URL } = require('url')
|
||||
const chalk = require('chalk')
|
||||
const log = require('../utils/log-shim.js')
|
||||
const npmProfile = require('npm-profile')
|
||||
const qrcodeTerminal = require('qrcode-terminal')
|
||||
@@ -161,7 +160,7 @@ class Profile extends BaseCommand {
|
||||
} else {
|
||||
const table = new Table()
|
||||
for (const key of Object.keys(cleaned)) {
|
||||
table.push({ [chalk.bold(key)]: cleaned[key] })
|
||||
table.push({ [this.npm.chalk.bold(key)]: cleaned[key] })
|
||||
}
|
||||
|
||||
this.npm.output(table.toString())
|
||||
|
||||
Vendored
+1
-11
@@ -1,5 +1,4 @@
|
||||
const { resolve } = require('path')
|
||||
const chalk = require('chalk')
|
||||
const runScript = require('@npmcli/run-script')
|
||||
const { isServerPackage } = runScript
|
||||
const rpj = require('read-package-json-fast')
|
||||
@@ -18,14 +17,6 @@ const cmdList = [
|
||||
'version',
|
||||
].reduce((l, p) => l.concat(['pre' + p, p, 'post' + p]), [])
|
||||
|
||||
const nocolor = {
|
||||
reset: s => s,
|
||||
bold: s => s,
|
||||
dim: s => s,
|
||||
blue: s => s,
|
||||
green: s => s,
|
||||
}
|
||||
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class RunScript extends BaseCommand {
|
||||
static description = 'Run arbitrary package scripts'
|
||||
@@ -138,7 +129,6 @@ class RunScript extends BaseCommand {
|
||||
path = path || this.npm.localPrefix
|
||||
const { scripts, name, _id } = await rpj(`${path}/package.json`)
|
||||
const pkgid = _id || name
|
||||
const color = this.npm.color
|
||||
|
||||
if (!scripts) {
|
||||
return []
|
||||
@@ -170,7 +160,7 @@ class RunScript extends BaseCommand {
|
||||
const list = cmdList.includes(script) ? cmds : runScripts
|
||||
list.push(script)
|
||||
}
|
||||
const colorize = color ? chalk : nocolor
|
||||
const colorize = this.npm.chalk
|
||||
|
||||
if (cmds.length) {
|
||||
this.npm.output(
|
||||
|
||||
Vendored
+1
-2
@@ -1,5 +1,4 @@
|
||||
const Table = require('cli-table3')
|
||||
const chalk = require('chalk')
|
||||
const { v4: isCidrV4, v6: isCidrV6 } = require('is-cidr')
|
||||
const log = require('../utils/log-shim.js')
|
||||
const profile = require('npm-profile')
|
||||
@@ -152,7 +151,7 @@ class Token extends BaseCommand {
|
||||
} else {
|
||||
const table = new Table()
|
||||
for (const k of Object.keys(result)) {
|
||||
table.push({ [chalk.bold(k)]: String(result[k]) })
|
||||
table.push({ [this.npm.chalk.bold(k)]: String(result[k]) })
|
||||
}
|
||||
this.npm.output(table.toString())
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,3 @@
|
||||
const chalk = require('chalk')
|
||||
const columns = require('cli-columns')
|
||||
const fs = require('fs')
|
||||
const jsonParse = require('json-parse-even-better-errors')
|
||||
@@ -315,6 +314,7 @@ class View extends BaseCommand {
|
||||
prettyView (packu, manifest) {
|
||||
// More modern, pretty printing of default view
|
||||
const unicode = this.npm.config.get('unicode')
|
||||
const chalk = this.npm.chalk
|
||||
const tags = []
|
||||
|
||||
Object.keys(packu['dist-tags']).forEach((t) => {
|
||||
|
||||
Vendored
+37
-10
@@ -5,6 +5,7 @@ const Config = require('@npmcli/config')
|
||||
const chalk = require('chalk')
|
||||
const which = require('which')
|
||||
const fs = require('fs/promises')
|
||||
const abbrev = require('abbrev')
|
||||
|
||||
// Patch the global fs module here at the app level
|
||||
require('graceful-fs').gracefulify(require('fs'))
|
||||
@@ -18,7 +19,7 @@ const log = require('./utils/log-shim')
|
||||
const replaceInfo = require('./utils/replace-info.js')
|
||||
const updateNotifier = require('./utils/update-notifier.js')
|
||||
const pkg = require('../package.json')
|
||||
const cmdList = require('./utils/cmd-list.js')
|
||||
const { commands, aliases } = require('./utils/cmd-list.js')
|
||||
|
||||
class Npm extends EventEmitter {
|
||||
static get version () {
|
||||
@@ -36,6 +37,8 @@ class Npm extends EventEmitter {
|
||||
#title = 'npm'
|
||||
#argvClean = []
|
||||
#chalk = null
|
||||
#logChalk = null
|
||||
#noColorChalk = new chalk.Instance({ level: 0 })
|
||||
#npmRoot = null
|
||||
#warnedNonDashArg = false
|
||||
|
||||
@@ -84,18 +87,30 @@ class Npm extends EventEmitter {
|
||||
if (!c) {
|
||||
return
|
||||
}
|
||||
|
||||
// Translate camelCase to snake-case (i.e. installTest to install-test)
|
||||
if (c.match(/[A-Z]/)) {
|
||||
c = c.replace(/([A-Z])/g, m => '-' + m.toLowerCase())
|
||||
}
|
||||
if (cmdList.plumbing.indexOf(c) !== -1) {
|
||||
|
||||
// if they asked for something exactly we are done
|
||||
if (commands.includes(c)) {
|
||||
return c
|
||||
}
|
||||
|
||||
// if they asked for a direct alias
|
||||
if (aliases[c]) {
|
||||
return aliases[c]
|
||||
}
|
||||
|
||||
const abbrevs = abbrev(commands.concat(Object.keys(aliases)))
|
||||
|
||||
// first deref the abbrev, if there is one
|
||||
// then resolve any aliases
|
||||
// so `npm install-cl` will resolve to `install-clean` then to `ci`
|
||||
let a = cmdList.abbrevs[c]
|
||||
while (cmdList.aliases[a]) {
|
||||
a = cmdList.aliases[a]
|
||||
let a = abbrevs[c]
|
||||
while (aliases[a]) {
|
||||
a = aliases[a]
|
||||
}
|
||||
return a
|
||||
}
|
||||
@@ -248,6 +263,7 @@ class Npm extends EventEmitter {
|
||||
this.#display.load({
|
||||
// Use logColor since that is based on stderr
|
||||
color: this.logColor,
|
||||
chalk: this.logChalk,
|
||||
progress: this.flatOptions.progress,
|
||||
silent: this.silent,
|
||||
timing: this.config.get('timing'),
|
||||
@@ -317,17 +333,28 @@ class Npm extends EventEmitter {
|
||||
return this.flatOptions.logColor
|
||||
}
|
||||
|
||||
get noColorChalk () {
|
||||
return this.#noColorChalk
|
||||
}
|
||||
|
||||
get chalk () {
|
||||
if (!this.#chalk) {
|
||||
let level = chalk.level
|
||||
if (!this.color) {
|
||||
level = 0
|
||||
}
|
||||
this.#chalk = new chalk.Instance({ level })
|
||||
this.#chalk = new chalk.Instance({
|
||||
level: this.color ? chalk.level : 0,
|
||||
})
|
||||
}
|
||||
return this.#chalk
|
||||
}
|
||||
|
||||
get logChalk () {
|
||||
if (!this.#logChalk) {
|
||||
this.#logChalk = new chalk.Instance({
|
||||
level: this.logColor ? chalk.stderr.level : 0,
|
||||
})
|
||||
}
|
||||
return this.#logChalk
|
||||
}
|
||||
|
||||
get global () {
|
||||
return this.config.get('global') || this.config.get('location') === 'global'
|
||||
}
|
||||
|
||||
Vendored
+71
-79
@@ -1,7 +1,75 @@
|
||||
const abbrev = require('abbrev')
|
||||
const localeCompare = require('@isaacs/string-locale-compare')('en')
|
||||
// These correspond to filenames in lib/commands
|
||||
// Please keep this list sorted alphabetically
|
||||
const commands = [
|
||||
'access',
|
||||
'adduser',
|
||||
'audit',
|
||||
'bugs',
|
||||
'cache',
|
||||
'ci',
|
||||
'completion',
|
||||
'config',
|
||||
'dedupe',
|
||||
'deprecate',
|
||||
'diff',
|
||||
'dist-tag',
|
||||
'docs',
|
||||
'doctor',
|
||||
'edit',
|
||||
'exec',
|
||||
'explain',
|
||||
'explore',
|
||||
'find-dupes',
|
||||
'fund',
|
||||
'get',
|
||||
'help',
|
||||
'help-search',
|
||||
'hook',
|
||||
'init',
|
||||
'install',
|
||||
'install-ci-test',
|
||||
'install-test',
|
||||
'link',
|
||||
'll',
|
||||
'login',
|
||||
'logout',
|
||||
'ls',
|
||||
'org',
|
||||
'outdated',
|
||||
'owner',
|
||||
'pack',
|
||||
'ping',
|
||||
'pkg',
|
||||
'prefix',
|
||||
'profile',
|
||||
'prune',
|
||||
'publish',
|
||||
'query',
|
||||
'rebuild',
|
||||
'repo',
|
||||
'restart',
|
||||
'root',
|
||||
'run-script',
|
||||
'search',
|
||||
'set',
|
||||
'shrinkwrap',
|
||||
'star',
|
||||
'stars',
|
||||
'start',
|
||||
'stop',
|
||||
'team',
|
||||
'test',
|
||||
'token',
|
||||
'uninstall',
|
||||
'unpublish',
|
||||
'unstar',
|
||||
'update',
|
||||
'version',
|
||||
'view',
|
||||
'whoami',
|
||||
]
|
||||
|
||||
// plumbing should not have any aliases
|
||||
// These must resolve to an entry in commands
|
||||
const aliases = {
|
||||
|
||||
// aliases
|
||||
@@ -68,83 +136,7 @@ const aliases = {
|
||||
'add-user': 'adduser',
|
||||
}
|
||||
|
||||
// these are filenames in .
|
||||
const commands = [
|
||||
'access',
|
||||
'adduser',
|
||||
'audit',
|
||||
'bugs',
|
||||
'cache',
|
||||
'ci',
|
||||
'completion',
|
||||
'config',
|
||||
'dedupe',
|
||||
'deprecate',
|
||||
'diff',
|
||||
'dist-tag',
|
||||
'docs',
|
||||
'doctor',
|
||||
'edit',
|
||||
'exec',
|
||||
'explain',
|
||||
'explore',
|
||||
'find-dupes',
|
||||
'fund',
|
||||
'get',
|
||||
'help',
|
||||
'hook',
|
||||
'init',
|
||||
'install',
|
||||
'install-ci-test',
|
||||
'install-test',
|
||||
'link',
|
||||
'll',
|
||||
'login', // This is an alias for `adduser` but it can be confusing
|
||||
'logout',
|
||||
'ls',
|
||||
'org',
|
||||
'outdated',
|
||||
'owner',
|
||||
'pack',
|
||||
'ping',
|
||||
'pkg',
|
||||
'prefix',
|
||||
'profile',
|
||||
'prune',
|
||||
'publish',
|
||||
'query',
|
||||
'rebuild',
|
||||
'repo',
|
||||
'restart',
|
||||
'root',
|
||||
'run-script',
|
||||
'search',
|
||||
'set',
|
||||
'shrinkwrap',
|
||||
'star',
|
||||
'stars',
|
||||
'start',
|
||||
'stop',
|
||||
'team',
|
||||
'test',
|
||||
'token',
|
||||
'uninstall',
|
||||
'unpublish',
|
||||
'unstar',
|
||||
'update',
|
||||
'version',
|
||||
'view',
|
||||
'whoami',
|
||||
].sort(localeCompare)
|
||||
|
||||
const plumbing = ['help-search']
|
||||
const allCommands = [...commands, ...plumbing].sort(localeCompare)
|
||||
const abbrevs = abbrev(commands.concat(Object.keys(aliases)))
|
||||
|
||||
module.exports = {
|
||||
abbrevs,
|
||||
aliases,
|
||||
commands,
|
||||
plumbing,
|
||||
allCommands,
|
||||
}
|
||||
Vendored
+6
-1
@@ -4,6 +4,8 @@ const log = require('./log-shim.js')
|
||||
const { explain } = require('./explain-eresolve.js')
|
||||
|
||||
class Display {
|
||||
#chalk = null
|
||||
|
||||
constructor () {
|
||||
// pause by default until config is loaded
|
||||
this.on()
|
||||
@@ -26,6 +28,7 @@ class Display {
|
||||
load (config) {
|
||||
const {
|
||||
color,
|
||||
chalk,
|
||||
timing,
|
||||
loglevel,
|
||||
unicode,
|
||||
@@ -34,6 +37,8 @@ class Display {
|
||||
heading = 'npm',
|
||||
} = config
|
||||
|
||||
this.#chalk = chalk
|
||||
|
||||
// npmlog is still going away someday, so this is a hack to dynamically
|
||||
// set the loglevel of timing based on the timing flag, instead of making
|
||||
// a breaking change to npmlog. The result is that timing logs are never
|
||||
@@ -111,7 +116,7 @@ class Display {
|
||||
expl && typeof expl === 'object'
|
||||
) {
|
||||
this.#npmlog(level, heading, message)
|
||||
this.#npmlog(level, '', explain(expl, log.useColor(), 2))
|
||||
this.#npmlog(level, '', explain(expl, this.#chalk, 2))
|
||||
// Return true to short circuit other log in chain
|
||||
return true
|
||||
}
|
||||
|
||||
Vendored
+30
-17
@@ -38,7 +38,7 @@ const errorMessage = (er, npm) => {
|
||||
// XXX(display): error messages are logged so we use the logColor since that is based
|
||||
// on stderr. This should be handled solely by the display layer so it could also be
|
||||
// printed to stdout if necessary.
|
||||
const { explanation, file } = report(er, !!npm.logColor)
|
||||
const { explanation, file } = report(er, npm.logChalk, npm.noColorChalk)
|
||||
detail.push(['', explanation])
|
||||
files.push(['eresolve-report.txt', file])
|
||||
break
|
||||
@@ -247,16 +247,34 @@ const errorMessage = (er, npm) => {
|
||||
break
|
||||
|
||||
case 'EBADPLATFORM': {
|
||||
const validOs =
|
||||
er.required && er.required.os && er.required.os.join
|
||||
? er.required.os.join(',')
|
||||
: er.required.os
|
||||
const validArch =
|
||||
er.required && er.required.cpu && er.required.cpu.join
|
||||
? er.required.cpu.join(',')
|
||||
: er.required.cpu
|
||||
const expected = { os: validOs, arch: validArch }
|
||||
const actual = { os: process.platform, arch: process.arch }
|
||||
const actual = er.current
|
||||
const expected = { ...er.required }
|
||||
const checkedKeys = []
|
||||
for (const key in expected) {
|
||||
if (Array.isArray(expected[key]) && expected[key].length > 0) {
|
||||
expected[key] = expected[key].join(',')
|
||||
checkedKeys.push(key)
|
||||
} else if (expected[key] === undefined ||
|
||||
Array.isArray(expected[key]) && expected[key].length === 0) {
|
||||
delete expected[key]
|
||||
delete actual[key]
|
||||
} else {
|
||||
checkedKeys.push(key)
|
||||
}
|
||||
}
|
||||
|
||||
const longestKey = Math.max(...checkedKeys.map((key) => key.length))
|
||||
const detailEntry = []
|
||||
for (const key of checkedKeys) {
|
||||
const padding = key.length === longestKey
|
||||
? 1
|
||||
: 1 + (longestKey - key.length)
|
||||
|
||||
// padding + 1 because 'actual' is longer than 'valid'
|
||||
detailEntry.push(`Valid ${key}:${' '.repeat(padding + 1)}${expected[key]}`)
|
||||
detailEntry.push(`Actual ${key}:${' '.repeat(padding)}${actual[key]}`)
|
||||
}
|
||||
|
||||
short.push([
|
||||
'notsup',
|
||||
[
|
||||
@@ -270,12 +288,7 @@ const errorMessage = (er, npm) => {
|
||||
])
|
||||
detail.push([
|
||||
'notsup',
|
||||
[
|
||||
'Valid OS: ' + validOs,
|
||||
'Valid Arch: ' + validArch,
|
||||
'Actual OS: ' + process.platform,
|
||||
'Actual Arch: ' + process.arch,
|
||||
].join('\n'),
|
||||
detailEntry.join('\n'),
|
||||
])
|
||||
break
|
||||
}
|
||||
|
||||
Vendored
+2
-4
@@ -5,8 +5,6 @@ const log = require('./log-shim.js')
|
||||
const errorMessage = require('./error-message.js')
|
||||
const replaceInfo = require('./replace-info.js')
|
||||
|
||||
const indent = (val) => Array.isArray(val) ? val.map(v => indent(v)) : ` ${val}`
|
||||
|
||||
let npm = null // set by the cli
|
||||
let exitHandlerCalled = false
|
||||
let showLogFileError = false
|
||||
@@ -73,7 +71,7 @@ process.on('exit', code => {
|
||||
const message = []
|
||||
|
||||
if (timingFile) {
|
||||
message.push('Timing info written to:', indent(timingFile))
|
||||
message.push(`Timing info written to: ${timingFile}`)
|
||||
} else if (timing) {
|
||||
message.push(
|
||||
`The timing file was not written due to an error writing to the directory: ${timingDir}`
|
||||
@@ -81,7 +79,7 @@ process.on('exit', code => {
|
||||
}
|
||||
|
||||
if (logFiles.length) {
|
||||
message.push('A complete log of this run can be found in:', ...indent(logFiles))
|
||||
message.push(`A complete log of this run can be found in: ${logFiles}`)
|
||||
} else if (logsMax <= 0) {
|
||||
// user specified no log file
|
||||
message.push(`Log files were not written due to the config logs-max=${logsMax}`)
|
||||
|
||||
Vendored
+28
-41
@@ -1,25 +1,12 @@
|
||||
const chalk = require('chalk')
|
||||
const nocolor = {
|
||||
bold: s => s,
|
||||
dim: s => s,
|
||||
red: s => s,
|
||||
yellow: s => s,
|
||||
cyan: s => s,
|
||||
magenta: s => s,
|
||||
blue: s => s,
|
||||
green: s => s,
|
||||
gray: s => s,
|
||||
}
|
||||
|
||||
const { relative } = require('path')
|
||||
|
||||
const explainNode = (node, depth, color) =>
|
||||
printNode(node, color) +
|
||||
explainDependents(node, depth, color) +
|
||||
explainLinksIn(node, depth, color)
|
||||
const explainNode = (node, depth, chalk) =>
|
||||
printNode(node, chalk) +
|
||||
explainDependents(node, depth, chalk) +
|
||||
explainLinksIn(node, depth, chalk)
|
||||
|
||||
const colorType = (type, color) => {
|
||||
const { red, yellow, cyan, magenta, blue, green, gray } = color ? chalk : nocolor
|
||||
const colorType = (type, chalk) => {
|
||||
const { red, yellow, cyan, magenta, blue, green, gray } = chalk
|
||||
const style = type === 'extraneous' ? red
|
||||
: type === 'dev' ? yellow
|
||||
: type === 'optional' ? cyan
|
||||
@@ -31,7 +18,7 @@ const colorType = (type, color) => {
|
||||
return style(type)
|
||||
}
|
||||
|
||||
const printNode = (node, color) => {
|
||||
const printNode = (node, chalk) => {
|
||||
const {
|
||||
name,
|
||||
version,
|
||||
@@ -44,30 +31,30 @@ const printNode = (node, color) => {
|
||||
isWorkspace,
|
||||
overridden,
|
||||
} = node
|
||||
const { bold, dim, green } = color ? chalk : nocolor
|
||||
const { bold, dim, green } = chalk
|
||||
const extra = []
|
||||
if (extraneous) {
|
||||
extra.push(' ' + bold(colorType('extraneous', color)))
|
||||
extra.push(' ' + bold(colorType('extraneous', chalk)))
|
||||
}
|
||||
|
||||
if (dev) {
|
||||
extra.push(' ' + bold(colorType('dev', color)))
|
||||
extra.push(' ' + bold(colorType('dev', chalk)))
|
||||
}
|
||||
|
||||
if (optional) {
|
||||
extra.push(' ' + bold(colorType('optional', color)))
|
||||
extra.push(' ' + bold(colorType('optional', chalk)))
|
||||
}
|
||||
|
||||
if (peer) {
|
||||
extra.push(' ' + bold(colorType('peer', color)))
|
||||
extra.push(' ' + bold(colorType('peer', chalk)))
|
||||
}
|
||||
|
||||
if (bundled) {
|
||||
extra.push(' ' + bold(colorType('bundled', color)))
|
||||
extra.push(' ' + bold(colorType('bundled', chalk)))
|
||||
}
|
||||
|
||||
if (overridden) {
|
||||
extra.push(' ' + bold(colorType('overridden', color)))
|
||||
extra.push(' ' + bold(colorType('overridden', chalk)))
|
||||
}
|
||||
|
||||
const pkgid = isWorkspace
|
||||
@@ -78,24 +65,24 @@ const printNode = (node, color) => {
|
||||
(location ? dim(`\n${location}`) : '')
|
||||
}
|
||||
|
||||
const explainLinksIn = ({ linksIn }, depth, color) => {
|
||||
const explainLinksIn = ({ linksIn }, depth, chalk) => {
|
||||
if (!linksIn || !linksIn.length || depth <= 0) {
|
||||
return ''
|
||||
}
|
||||
|
||||
const messages = linksIn.map(link => explainNode(link, depth - 1, color))
|
||||
const messages = linksIn.map(link => explainNode(link, depth - 1, chalk))
|
||||
const str = '\n' + messages.join('\n')
|
||||
return str.split('\n').join('\n ')
|
||||
}
|
||||
|
||||
const explainDependents = ({ name, dependents }, depth, color) => {
|
||||
const explainDependents = ({ name, dependents }, depth, chalk) => {
|
||||
if (!dependents || !dependents.length || depth <= 0) {
|
||||
return ''
|
||||
}
|
||||
|
||||
const max = Math.ceil(depth / 2)
|
||||
const messages = dependents.slice(0, max)
|
||||
.map(edge => explainEdge(edge, depth, color))
|
||||
.map(edge => explainEdge(edge, depth, chalk))
|
||||
|
||||
// show just the names of the first 5 deps that overflowed the list
|
||||
if (dependents.length > max) {
|
||||
@@ -119,30 +106,30 @@ const explainDependents = ({ name, dependents }, depth, color) => {
|
||||
return str.split('\n').join('\n ')
|
||||
}
|
||||
|
||||
const explainEdge = ({ name, type, bundled, from, spec, rawSpec, overridden }, depth, color) => {
|
||||
const { bold } = color ? chalk : nocolor
|
||||
const explainEdge = ({ name, type, bundled, from, spec, rawSpec, overridden }, depth, chalk) => {
|
||||
const { bold } = chalk
|
||||
let dep = type === 'workspace'
|
||||
? bold(relative(from.location, spec.slice('file:'.length)))
|
||||
: `${bold(name)}@"${bold(spec)}"`
|
||||
if (overridden) {
|
||||
dep = `${colorType('overridden', color)} ${dep} (was "${rawSpec}")`
|
||||
dep = `${colorType('overridden', chalk)} ${dep} (was "${rawSpec}")`
|
||||
}
|
||||
|
||||
const fromMsg = ` from ${explainFrom(from, depth, color)}`
|
||||
const fromMsg = ` from ${explainFrom(from, depth, chalk)}`
|
||||
|
||||
return (type === 'prod' ? '' : `${colorType(type, color)} `) +
|
||||
(bundled ? `${colorType('bundled', color)} ` : '') +
|
||||
return (type === 'prod' ? '' : `${colorType(type, chalk)} `) +
|
||||
(bundled ? `${colorType('bundled', chalk)} ` : '') +
|
||||
`${dep}${fromMsg}`
|
||||
}
|
||||
|
||||
const explainFrom = (from, depth, color) => {
|
||||
const explainFrom = (from, depth, chalk) => {
|
||||
if (!from.name && !from.version) {
|
||||
return 'the root project'
|
||||
}
|
||||
|
||||
return printNode(from, color) +
|
||||
explainDependents(from, depth - 1, color) +
|
||||
explainLinksIn(from, depth - 1, color)
|
||||
return printNode(from, chalk) +
|
||||
explainDependents(from, depth - 1, chalk) +
|
||||
explainLinksIn(from, depth - 1, chalk)
|
||||
}
|
||||
|
||||
module.exports = { explainNode, printNode, explainEdge }
|
||||
+11
-11
@@ -7,7 +7,7 @@ const { explainEdge, explainNode, printNode } = require('./explain-dep.js')
|
||||
// Depth is how far we want to want to descend into the object making a report.
|
||||
// The full report (ie, depth=Infinity) is always written to the cache folder
|
||||
// at ${cache}/eresolve-report.txt along with full json.
|
||||
const explain = (expl, color, depth) => {
|
||||
const explain = (expl, chalk, depth) => {
|
||||
const { edge, dep, current, peerConflict, currentEdge } = expl
|
||||
|
||||
const out = []
|
||||
@@ -15,28 +15,28 @@ const explain = (expl, color, depth) => {
|
||||
current && current.whileInstalling ||
|
||||
edge && edge.from && edge.from.whileInstalling
|
||||
if (whileInstalling) {
|
||||
out.push('While resolving: ' + printNode(whileInstalling, color))
|
||||
out.push('While resolving: ' + printNode(whileInstalling, chalk))
|
||||
}
|
||||
|
||||
// it "should" be impossible for an ERESOLVE explanation to lack both
|
||||
// current and currentEdge, but better to have a less helpful error
|
||||
// than a crashing failure.
|
||||
if (current) {
|
||||
out.push('Found: ' + explainNode(current, depth, color))
|
||||
out.push('Found: ' + explainNode(current, depth, chalk))
|
||||
} else if (peerConflict && peerConflict.current) {
|
||||
out.push('Found: ' + explainNode(peerConflict.current, depth, color))
|
||||
out.push('Found: ' + explainNode(peerConflict.current, depth, chalk))
|
||||
} else if (currentEdge) {
|
||||
out.push('Found: ' + explainEdge(currentEdge, depth, color))
|
||||
out.push('Found: ' + explainEdge(currentEdge, depth, chalk))
|
||||
} else /* istanbul ignore else - should always have one */ if (edge) {
|
||||
out.push('Found: ' + explainEdge(edge, depth, color))
|
||||
out.push('Found: ' + explainEdge(edge, depth, chalk))
|
||||
}
|
||||
|
||||
out.push('\nCould not resolve dependency:\n' +
|
||||
explainEdge(edge, depth, color))
|
||||
explainEdge(edge, depth, chalk))
|
||||
|
||||
if (peerConflict) {
|
||||
const heading = '\nConflicting peer dependency:'
|
||||
const pc = explainNode(peerConflict.peer, depth, color)
|
||||
const pc = explainNode(peerConflict.peer, depth, chalk)
|
||||
out.push(heading + ' ' + pc)
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ const explain = (expl, color, depth) => {
|
||||
}
|
||||
|
||||
// generate a full verbose report and tell the user how to fix it
|
||||
const report = (expl, color) => {
|
||||
const report = (expl, chalk, noColor) => {
|
||||
const flags = [
|
||||
expl.strictPeerDeps ? '--no-strict-peer-deps' : '',
|
||||
'--force',
|
||||
@@ -60,8 +60,8 @@ this command with ${or(flags)}
|
||||
to accept an incorrect (and potentially broken) dependency resolution.`
|
||||
|
||||
return {
|
||||
explanation: `${explain(expl, color, 4)}\n\n${fix}`,
|
||||
file: `# npm resolution error report\n\n${explain(expl, false, Infinity)}\n\n${fix}`,
|
||||
explanation: `${explain(expl, chalk, 4)}\n\n${fix}`,
|
||||
file: `# npm resolution error report\n\n${explain(expl, noColor, Infinity)}\n\n${fix}`,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+6
-3
@@ -1,7 +1,7 @@
|
||||
const os = require('os')
|
||||
const { join, dirname, basename } = require('path')
|
||||
const { format, promisify } = require('util')
|
||||
const glob = promisify(require('glob'))
|
||||
const { format } = require('util')
|
||||
const glob = require('glob')
|
||||
const MiniPass = require('minipass')
|
||||
const fsMiniPass = require('fs-minipass')
|
||||
const fs = require('fs/promises')
|
||||
@@ -223,7 +223,10 @@ class LogFiles {
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
log.warn('logfile', 'error cleaning log files', e)
|
||||
// Disable cleanup failure warnings when log writing is disabled
|
||||
if (this.#logsMax > 0) {
|
||||
log.warn('logfile', 'error cleaning log files', e)
|
||||
}
|
||||
} finally {
|
||||
log.silly('logfile', 'done cleaning log files')
|
||||
}
|
||||
|
||||
+7
-12
@@ -5,10 +5,7 @@
|
||||
const pacote = require('pacote')
|
||||
const ciInfo = require('ci-info')
|
||||
const semver = require('semver')
|
||||
const chalk = require('chalk')
|
||||
const { promisify } = require('util')
|
||||
const stat = promisify(require('fs').stat)
|
||||
const writeFile = promisify(require('fs').writeFile)
|
||||
const { stat, writeFile } = require('fs/promises')
|
||||
const { resolve } = require('path')
|
||||
|
||||
const SKIP = Symbol('SKIP')
|
||||
@@ -61,10 +58,6 @@ const updateNotifier = async (npm, spec = 'latest') => {
|
||||
return null
|
||||
}
|
||||
|
||||
// if they're currently using a prerelease, nudge to the next prerelease
|
||||
// otherwise, nudge to latest.
|
||||
const useColor = npm.logColor
|
||||
|
||||
const mani = await pacote.manifest(`npm@${spec}`, {
|
||||
// always prefer latest, even if doing --tag=whatever on the cmd
|
||||
defaultTag: 'latest',
|
||||
@@ -91,6 +84,9 @@ const updateNotifier = async (npm, spec = 'latest') => {
|
||||
return null
|
||||
}
|
||||
|
||||
const useColor = npm.logColor
|
||||
const chalk = npm.logChalk
|
||||
|
||||
// ok! notify the user about this update they should get.
|
||||
// The message is saved for printing at process exit so it will not get
|
||||
// lost in any other messages being printed as part of the command.
|
||||
@@ -99,12 +95,11 @@ const updateNotifier = async (npm, spec = 'latest') => {
|
||||
: update.minor !== current.minor ? 'minor'
|
||||
: update.patch !== current.patch ? 'patch'
|
||||
: 'prerelease'
|
||||
const typec = !useColor ? type
|
||||
: type === 'major' ? chalk.red(type)
|
||||
const typec = type === 'major' ? chalk.red(type)
|
||||
: type === 'minor' ? chalk.yellow(type)
|
||||
: chalk.green(type)
|
||||
const oldc = !useColor ? current : chalk.red(current)
|
||||
const latestc = !useColor ? latest : chalk.green(latest)
|
||||
const oldc = chalk.red(current)
|
||||
const latestc = chalk.green(latest)
|
||||
const changelog = `https://github.com/npm/cli/releases/tag/v${latest}`
|
||||
const changelogc = !useColor ? `<${changelog}>` : chalk.cyan(changelog)
|
||||
const cmd = `npm install -g npm@${latest}`
|
||||
|
||||
Vendored
+1
-1
@@ -20,7 +20,7 @@ Positional arguments are \fBname@version-range\fR identifiers, which will limit
|
||||
.P
|
||||
.RS 2
|
||||
.nf
|
||||
npm@9.6.2 /path/to/npm
|
||||
npm@9.6.3 /path/to/npm
|
||||
└─┬ init-package-json@0.0.4
|
||||
└── promzard@0.1.5
|
||||
.fi
|
||||
|
||||
Vendored
-2
@@ -55,8 +55,6 @@ man pages are linked to \fB{prefix}/share/man\fR
|
||||
.IP \(bu 4
|
||||
npm help root
|
||||
.IP \(bu 4
|
||||
npm help bin
|
||||
.IP \(bu 4
|
||||
npm help folders
|
||||
.IP \(bu 4
|
||||
npm help config
|
||||
|
||||
Vendored
-2
@@ -48,8 +48,6 @@ man pages are linked to \fB{prefix}/share/man\fR
|
||||
.IP \(bu 4
|
||||
npm help prefix
|
||||
.IP \(bu 4
|
||||
npm help bin
|
||||
.IP \(bu 4
|
||||
npm help folders
|
||||
.IP \(bu 4
|
||||
npm help config
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@ npm
|
||||
Note: This command is unaware of workspaces.
|
||||
.SS "Version"
|
||||
.P
|
||||
9.6.2
|
||||
9.6.3
|
||||
.SS "Description"
|
||||
.P
|
||||
npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency conflicts intelligently.
|
||||
|
||||
Vendored
+1
-17
@@ -26,23 +26,7 @@ npm -v
|
||||
.RE
|
||||
.SS "Using a Node version manager to install Node.js and npm"
|
||||
.P
|
||||
Node version managers allow you to install and switch between multiple versions of Node.js and npm on your system so you can test your applications on multiple versions of npm to ensure they work for users on different versions.
|
||||
.SS "OSX or Linux Node version managers"
|
||||
.RS 0
|
||||
.IP \(bu 4
|
||||
\fBnvm\fR \fI\(lahttps://github.com/creationix/nvm\(ra\fR
|
||||
.IP \(bu 4
|
||||
\fBn\fR \fI\(lahttps://github.com/tj/n\(ra\fR
|
||||
.RE 0
|
||||
|
||||
.SS "Windows Node version managers"
|
||||
.RS 0
|
||||
.IP \(bu 4
|
||||
\fBnodist\fR \fI\(lahttps://github.com/marcelklehr/nodist\(ra\fR
|
||||
.IP \(bu 4
|
||||
\fBnvm-windows\fR \fI\(lahttps://github.com/coreybutler/nvm-windows\(ra\fR
|
||||
.RE 0
|
||||
|
||||
Node version managers allow you to install and switch between multiple versions of Node.js and npm on your system so you can test your applications on multiple versions of npm to ensure they work for users on different versions. You can \fBsearch for them on GitHub\fR \fI\(lahttps://github.com/search?q=node%20version%20manager&type=repositories\(ra\fR.
|
||||
.SS "Using a Node installer to install Node.js and npm"
|
||||
.P
|
||||
If you are unable to use a Node version manager, you can use a Node installer to install both Node.js and npm on your system.
|
||||
|
||||
-136
@@ -1,136 +0,0 @@
|
||||
// Type definitions for @colors/colors 1.4+
|
||||
// Project: https://github.com/Marak/colors.js
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Staffan Eketorp <https://github.com/staeke>
|
||||
// Definitions: https://github.com/DABH/colors.js
|
||||
|
||||
export interface Color {
|
||||
(text: string): string;
|
||||
|
||||
strip: Color;
|
||||
stripColors: Color;
|
||||
|
||||
black: Color;
|
||||
red: Color;
|
||||
green: Color;
|
||||
yellow: Color;
|
||||
blue: Color;
|
||||
magenta: Color;
|
||||
cyan: Color;
|
||||
white: Color;
|
||||
gray: Color;
|
||||
grey: Color;
|
||||
|
||||
bgBlack: Color;
|
||||
bgRed: Color;
|
||||
bgGreen: Color;
|
||||
bgYellow: Color;
|
||||
bgBlue: Color;
|
||||
bgMagenta: Color;
|
||||
bgCyan: Color;
|
||||
bgWhite: Color;
|
||||
|
||||
reset: Color;
|
||||
bold: Color;
|
||||
dim: Color;
|
||||
italic: Color;
|
||||
underline: Color;
|
||||
inverse: Color;
|
||||
hidden: Color;
|
||||
strikethrough: Color;
|
||||
|
||||
rainbow: Color;
|
||||
zebra: Color;
|
||||
america: Color;
|
||||
trap: Color;
|
||||
random: Color;
|
||||
zalgo: Color;
|
||||
}
|
||||
|
||||
export function enable(): void;
|
||||
export function disable(): void;
|
||||
export function setTheme(theme: any): void;
|
||||
|
||||
export let enabled: boolean;
|
||||
|
||||
export const strip: Color;
|
||||
export const stripColors: Color;
|
||||
|
||||
export const black: Color;
|
||||
export const red: Color;
|
||||
export const green: Color;
|
||||
export const yellow: Color;
|
||||
export const blue: Color;
|
||||
export const magenta: Color;
|
||||
export const cyan: Color;
|
||||
export const white: Color;
|
||||
export const gray: Color;
|
||||
export const grey: Color;
|
||||
|
||||
export const bgBlack: Color;
|
||||
export const bgRed: Color;
|
||||
export const bgGreen: Color;
|
||||
export const bgYellow: Color;
|
||||
export const bgBlue: Color;
|
||||
export const bgMagenta: Color;
|
||||
export const bgCyan: Color;
|
||||
export const bgWhite: Color;
|
||||
|
||||
export const reset: Color;
|
||||
export const bold: Color;
|
||||
export const dim: Color;
|
||||
export const italic: Color;
|
||||
export const underline: Color;
|
||||
export const inverse: Color;
|
||||
export const hidden: Color;
|
||||
export const strikethrough: Color;
|
||||
|
||||
export const rainbow: Color;
|
||||
export const zebra: Color;
|
||||
export const america: Color;
|
||||
export const trap: Color;
|
||||
export const random: Color;
|
||||
export const zalgo: Color;
|
||||
|
||||
declare global {
|
||||
interface String {
|
||||
strip: string;
|
||||
stripColors: string;
|
||||
|
||||
black: string;
|
||||
red: string;
|
||||
green: string;
|
||||
yellow: string;
|
||||
blue: string;
|
||||
magenta: string;
|
||||
cyan: string;
|
||||
white: string;
|
||||
gray: string;
|
||||
grey: string;
|
||||
|
||||
bgBlack: string;
|
||||
bgRed: string;
|
||||
bgGreen: string;
|
||||
bgYellow: string;
|
||||
bgBlue: string;
|
||||
bgMagenta: string;
|
||||
bgCyan: string;
|
||||
bgWhite: string;
|
||||
|
||||
reset: string;
|
||||
// @ts-ignore
|
||||
bold: string;
|
||||
dim: string;
|
||||
italic: string;
|
||||
underline: string;
|
||||
inverse: string;
|
||||
hidden: string;
|
||||
strikethrough: string;
|
||||
|
||||
rainbow: string;
|
||||
zebra: string;
|
||||
america: string;
|
||||
trap: string;
|
||||
random: string;
|
||||
zalgo: string;
|
||||
}
|
||||
}
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
// Type definitions for Colors.js 1.2
|
||||
// Project: https://github.com/Marak/colors.js
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Staffan Eketorp <https://github.com/staeke>
|
||||
// Definitions: https://github.com/Marak/colors.js
|
||||
|
||||
export const enabled: boolean;
|
||||
export function enable(): void;
|
||||
export function disable(): void;
|
||||
export function setTheme(theme: any): void;
|
||||
|
||||
export function strip(str: string): string;
|
||||
export function stripColors(str: string): string;
|
||||
|
||||
export function black(str: string): string;
|
||||
export function red(str: string): string;
|
||||
export function green(str: string): string;
|
||||
export function yellow(str: string): string;
|
||||
export function blue(str: string): string;
|
||||
export function magenta(str: string): string;
|
||||
export function cyan(str: string): string;
|
||||
export function white(str: string): string;
|
||||
export function gray(str: string): string;
|
||||
export function grey(str: string): string;
|
||||
|
||||
export function bgBlack(str: string): string;
|
||||
export function bgRed(str: string): string;
|
||||
export function bgGreen(str: string): string;
|
||||
export function bgYellow(str: string): string;
|
||||
export function bgBlue(str: string): string;
|
||||
export function bgMagenta(str: string): string;
|
||||
export function bgCyan(str: string): string;
|
||||
export function bgWhite(str: string): string;
|
||||
|
||||
export function reset(str: string): string;
|
||||
export function bold(str: string): string;
|
||||
export function dim(str: string): string;
|
||||
export function italic(str: string): string;
|
||||
export function underline(str: string): string;
|
||||
export function inverse(str: string): string;
|
||||
export function hidden(str: string): string;
|
||||
export function strikethrough(str: string): string;
|
||||
|
||||
export function rainbow(str: string): string;
|
||||
export function zebra(str: string): string;
|
||||
export function america(str: string): string;
|
||||
export function trap(str: string): string;
|
||||
export function random(str: string): string;
|
||||
export function zalgo(str: string): string;
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@npmcli/arborist",
|
||||
"version": "6.2.5",
|
||||
"version": "6.2.6",
|
||||
"description": "Manage node_modules trees",
|
||||
"dependencies": {
|
||||
"@isaacs/string-locale-compare": "^1.1.0",
|
||||
@@ -19,7 +19,7 @@
|
||||
"hosted-git-info": "^6.1.1",
|
||||
"json-parse-even-better-errors": "^3.0.0",
|
||||
"json-stringify-nice": "^1.1.4",
|
||||
"minimatch": "^6.1.6",
|
||||
"minimatch": "^7.4.2",
|
||||
"nopt": "^7.0.0",
|
||||
"npm-install-checks": "^6.0.0",
|
||||
"npm-package-arg": "^10.1.0",
|
||||
@@ -39,7 +39,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@npmcli/eslint-config": "^4.0.0",
|
||||
"@npmcli/template-oss": "4.12.0",
|
||||
"@npmcli/template-oss": "4.12.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"chalk": "^4.1.0",
|
||||
"minify-registry-metadata": "^3.0.0",
|
||||
@@ -98,7 +98,7 @@
|
||||
},
|
||||
"templateOSS": {
|
||||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
||||
"version": "4.12.0",
|
||||
"version": "4.12.1",
|
||||
"content": "../../scripts/template-oss/index.js"
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@npmcli/config",
|
||||
"version": "6.1.4",
|
||||
"version": "6.1.5",
|
||||
"files": [
|
||||
"bin/",
|
||||
"lib/"
|
||||
@@ -33,7 +33,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@npmcli/eslint-config": "^4.0.0",
|
||||
"@npmcli/template-oss": "4.12.0",
|
||||
"@npmcli/template-oss": "4.12.1",
|
||||
"tap": "^16.3.4"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -50,6 +50,6 @@
|
||||
},
|
||||
"templateOSS": {
|
||||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
||||
"version": "4.12.0"
|
||||
"version": "4.12.1"
|
||||
}
|
||||
}
|
||||
+18
-17
@@ -27,8 +27,7 @@ const spawn = require('./spawn.js')
|
||||
const { isWindows } = require('./utils.js')
|
||||
|
||||
const pickManifest = require('npm-pick-manifest')
|
||||
const fs = require('fs')
|
||||
const mkdirp = require('mkdirp')
|
||||
const fs = require('fs/promises')
|
||||
|
||||
module.exports = (repo, ref = 'HEAD', target = null, opts = {}) =>
|
||||
getRevs(repo, opts).then(revs => clone(
|
||||
@@ -93,7 +92,7 @@ const other = (repo, revDoc, target, opts) => {
|
||||
.concat(shallow ? ['--depth=1'] : [])
|
||||
|
||||
const git = (args) => spawn(args, { ...opts, cwd: target })
|
||||
return mkdirp(target)
|
||||
return fs.mkdir(target, { recursive: true })
|
||||
.then(() => git(['init']))
|
||||
.then(() => isWindows(opts)
|
||||
? git(['config', '--local', '--add', 'core.longpaths', 'true'])
|
||||
@@ -141,19 +140,21 @@ const plain = (repo, revDoc, target, opts) => {
|
||||
return spawn(args, opts).then(() => revDoc.sha)
|
||||
}
|
||||
|
||||
const updateSubmodules = (target, opts) => new Promise(resolve =>
|
||||
fs.stat(target + '/.gitmodules', er => {
|
||||
if (er) {
|
||||
return resolve(null)
|
||||
}
|
||||
return resolve(spawn([
|
||||
'submodule',
|
||||
'update',
|
||||
'-q',
|
||||
'--init',
|
||||
'--recursive',
|
||||
], { ...opts, cwd: target }))
|
||||
}))
|
||||
const updateSubmodules = async (target, opts) => {
|
||||
const hasSubmodules = await fs.stat(`${target}/.gitmodules`)
|
||||
.then(() => true)
|
||||
.catch(() => false)
|
||||
if (!hasSubmodules) {
|
||||
return null
|
||||
}
|
||||
return spawn([
|
||||
'submodule',
|
||||
'update',
|
||||
'-q',
|
||||
'--init',
|
||||
'--recursive',
|
||||
], { ...opts, cwd: target })
|
||||
}
|
||||
|
||||
const unresolved = (repo, ref, target, opts) => {
|
||||
// can't do this one shallowly, because the ref isn't advertised
|
||||
@@ -161,7 +162,7 @@ const unresolved = (repo, ref, target, opts) => {
|
||||
const lp = isWindows(opts) ? ['--config', 'core.longpaths=true'] : []
|
||||
const cloneArgs = ['clone', '--mirror', '-q', repo, target + '/.git']
|
||||
const git = (args) => spawn(args, { ...opts, cwd: target })
|
||||
return mkdirp(target)
|
||||
return fs.mkdir(target, { recursive: true })
|
||||
.then(() => git(cloneArgs.concat(lp)))
|
||||
.then(() => git(['init']))
|
||||
.then(() => git(['checkout', ref]))
|
||||
|
||||
+3
-5
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@npmcli/git",
|
||||
"version": "4.0.3",
|
||||
"version": "4.0.4",
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"bin/",
|
||||
@@ -32,16 +32,14 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@npmcli/eslint-config": "^4.0.0",
|
||||
"@npmcli/template-oss": "4.8.0",
|
||||
"@npmcli/template-oss": "4.12.0",
|
||||
"npm-package-arg": "^10.0.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"slash": "^3.0.0",
|
||||
"tap": "^16.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@npmcli/promise-spawn": "^6.0.0",
|
||||
"lru-cache": "^7.4.4",
|
||||
"mkdirp": "^1.0.4",
|
||||
"npm-pick-manifest": "^8.0.0",
|
||||
"proc-log": "^3.0.0",
|
||||
"promise-inflight": "^1.0.1",
|
||||
@@ -55,6 +53,6 @@
|
||||
"templateOSS": {
|
||||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
||||
"windowsCI": false,
|
||||
"version": "4.8.0"
|
||||
"version": "4.12.0"
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,11 +1,9 @@
|
||||
const { promisify } = require('util')
|
||||
const path = require('path')
|
||||
|
||||
const getName = require('@npmcli/name-from-folder')
|
||||
const minimatch = require('minimatch')
|
||||
const rpj = require('read-package-json-fast')
|
||||
const glob = require('glob')
|
||||
const pGlob = promisify(glob)
|
||||
|
||||
function appendNegatedPatterns (patterns) {
|
||||
const results = []
|
||||
@@ -98,7 +96,9 @@ async function mapWorkspaces (opts = {}) {
|
||||
const getPackagePathname = pkgPathmame(opts)
|
||||
|
||||
for (const item of patterns) {
|
||||
const matches = await pGlob(getGlobPattern(item.pattern), getGlobOpts())
|
||||
let matches = await glob(getGlobPattern(item.pattern), getGlobOpts())
|
||||
// preserves glob@8 behavior
|
||||
matches = matches.sort((a, b) => a.localeCompare(b, 'en'))
|
||||
|
||||
for (const match of matches) {
|
||||
let pkg
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@npmcli/map-workspaces",
|
||||
"version": "3.0.2",
|
||||
"version": "3.0.3",
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"bin/",
|
||||
@@ -43,17 +43,17 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@npmcli/eslint-config": "^4.0.0",
|
||||
"@npmcli/template-oss": "4.11.3",
|
||||
"@npmcli/template-oss": "4.12.0",
|
||||
"tap": "^16.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@npmcli/name-from-folder": "^2.0.0",
|
||||
"glob": "^8.0.1",
|
||||
"minimatch": "^6.1.6",
|
||||
"glob": "^9.3.1",
|
||||
"minimatch": "^7.4.2",
|
||||
"read-package-json-fast": "^3.0.0"
|
||||
},
|
||||
"templateOSS": {
|
||||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
||||
"version": "4.11.3"
|
||||
"version": "4.12.0"
|
||||
}
|
||||
}
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
/** An authenticated message of arbitrary type. */
|
||||
export interface Envelope {
|
||||
/**
|
||||
* Message to be signed. (In JSON, this is encoded as base64.)
|
||||
* REQUIRED.
|
||||
*/
|
||||
payload: Buffer;
|
||||
/**
|
||||
* String unambiguously identifying how to interpret payload.
|
||||
* REQUIRED.
|
||||
*/
|
||||
payloadType: string;
|
||||
/**
|
||||
* Signature over:
|
||||
* PAE(type, body)
|
||||
* Where PAE is defined as:
|
||||
* PAE(type, body) = "DSSEv1" + SP + LEN(type) + SP + type + SP + LEN(body) + SP + body
|
||||
* + = concatenation
|
||||
* SP = ASCII space [0x20]
|
||||
* "DSSEv1" = ASCII [0x44, 0x53, 0x53, 0x45, 0x76, 0x31]
|
||||
* LEN(s) = ASCII decimal encoding of the byte length of s, with no leading zeros
|
||||
* REQUIRED (length >= 1).
|
||||
*/
|
||||
signatures: Signature[];
|
||||
}
|
||||
export interface Signature {
|
||||
/**
|
||||
* Signature itself. (In JSON, this is encoded as base64.)
|
||||
* REQUIRED.
|
||||
*/
|
||||
sig: Buffer;
|
||||
/**
|
||||
* Unauthenticated* hint identifying which public key was used.
|
||||
* OPTIONAL.
|
||||
*/
|
||||
keyid: string;
|
||||
}
|
||||
export declare const Envelope: {
|
||||
fromJSON(object: any): Envelope;
|
||||
toJSON(message: Envelope): unknown;
|
||||
};
|
||||
export declare const Signature: {
|
||||
fromJSON(object: any): Signature;
|
||||
toJSON(message: Signature): unknown;
|
||||
};
|
||||
Generated
Vendored
-52
@@ -1,52 +0,0 @@
|
||||
/**
|
||||
* An indicator of the behavior of a given field (for example, that a field
|
||||
* is required in requests, or given as output but ignored as input).
|
||||
* This **does not** change the behavior in protocol buffers itself; it only
|
||||
* denotes the behavior and may affect how API tooling handles the field.
|
||||
*
|
||||
* Note: This enum **may** receive new values in the future.
|
||||
*/
|
||||
export declare enum FieldBehavior {
|
||||
/** FIELD_BEHAVIOR_UNSPECIFIED - Conventional default for enums. Do not use this. */
|
||||
FIELD_BEHAVIOR_UNSPECIFIED = 0,
|
||||
/**
|
||||
* OPTIONAL - Specifically denotes a field as optional.
|
||||
* While all fields in protocol buffers are optional, this may be specified
|
||||
* for emphasis if appropriate.
|
||||
*/
|
||||
OPTIONAL = 1,
|
||||
/**
|
||||
* REQUIRED - Denotes a field as required.
|
||||
* This indicates that the field **must** be provided as part of the request,
|
||||
* and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
|
||||
*/
|
||||
REQUIRED = 2,
|
||||
/**
|
||||
* OUTPUT_ONLY - Denotes a field as output only.
|
||||
* This indicates that the field is provided in responses, but including the
|
||||
* field in a request does nothing (the server *must* ignore it and
|
||||
* *must not* throw an error as a result of the field's presence).
|
||||
*/
|
||||
OUTPUT_ONLY = 3,
|
||||
/**
|
||||
* INPUT_ONLY - Denotes a field as input only.
|
||||
* This indicates that the field is provided in requests, and the
|
||||
* corresponding field is not included in output.
|
||||
*/
|
||||
INPUT_ONLY = 4,
|
||||
/**
|
||||
* IMMUTABLE - Denotes a field as immutable.
|
||||
* This indicates that the field may be set once in a request to create a
|
||||
* resource, but may not be changed thereafter.
|
||||
*/
|
||||
IMMUTABLE = 5,
|
||||
/**
|
||||
* UNORDERED_LIST - Denotes that a (repeated) field is an unordered list.
|
||||
* This indicates that the service may provide the elements of the list
|
||||
* in any arbitrary order, rather than the order the user originally
|
||||
* provided. Additionally, the list's order may or may not be stable.
|
||||
*/
|
||||
UNORDERED_LIST = 6
|
||||
}
|
||||
export declare function fieldBehaviorFromJSON(object: any): FieldBehavior;
|
||||
export declare function fieldBehaviorToJSON(object: FieldBehavior): string;
|
||||
Generated
Vendored
-939
@@ -1,939 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
/**
|
||||
* The protocol compiler can output a FileDescriptorSet containing the .proto
|
||||
* files it parses.
|
||||
*/
|
||||
export interface FileDescriptorSet {
|
||||
file: FileDescriptorProto[];
|
||||
}
|
||||
/** Describes a complete .proto file. */
|
||||
export interface FileDescriptorProto {
|
||||
/** file name, relative to root of source tree */
|
||||
name: string;
|
||||
/** e.g. "foo", "foo.bar", etc. */
|
||||
package: string;
|
||||
/** Names of files imported by this file. */
|
||||
dependency: string[];
|
||||
/** Indexes of the public imported files in the dependency list above. */
|
||||
publicDependency: number[];
|
||||
/**
|
||||
* Indexes of the weak imported files in the dependency list.
|
||||
* For Google-internal migration only. Do not use.
|
||||
*/
|
||||
weakDependency: number[];
|
||||
/** All top-level definitions in this file. */
|
||||
messageType: DescriptorProto[];
|
||||
enumType: EnumDescriptorProto[];
|
||||
service: ServiceDescriptorProto[];
|
||||
extension: FieldDescriptorProto[];
|
||||
options: FileOptions | undefined;
|
||||
/**
|
||||
* This field contains optional information about the original source code.
|
||||
* You may safely remove this entire field without harming runtime
|
||||
* functionality of the descriptors -- the information is needed only by
|
||||
* development tools.
|
||||
*/
|
||||
sourceCodeInfo: SourceCodeInfo | undefined;
|
||||
/**
|
||||
* The syntax of the proto file.
|
||||
* The supported values are "proto2" and "proto3".
|
||||
*/
|
||||
syntax: string;
|
||||
}
|
||||
/** Describes a message type. */
|
||||
export interface DescriptorProto {
|
||||
name: string;
|
||||
field: FieldDescriptorProto[];
|
||||
extension: FieldDescriptorProto[];
|
||||
nestedType: DescriptorProto[];
|
||||
enumType: EnumDescriptorProto[];
|
||||
extensionRange: DescriptorProto_ExtensionRange[];
|
||||
oneofDecl: OneofDescriptorProto[];
|
||||
options: MessageOptions | undefined;
|
||||
reservedRange: DescriptorProto_ReservedRange[];
|
||||
/**
|
||||
* Reserved field names, which may not be used by fields in the same message.
|
||||
* A given name may only be reserved once.
|
||||
*/
|
||||
reservedName: string[];
|
||||
}
|
||||
export interface DescriptorProto_ExtensionRange {
|
||||
/** Inclusive. */
|
||||
start: number;
|
||||
/** Exclusive. */
|
||||
end: number;
|
||||
options: ExtensionRangeOptions | undefined;
|
||||
}
|
||||
/**
|
||||
* Range of reserved tag numbers. Reserved tag numbers may not be used by
|
||||
* fields or extension ranges in the same message. Reserved ranges may
|
||||
* not overlap.
|
||||
*/
|
||||
export interface DescriptorProto_ReservedRange {
|
||||
/** Inclusive. */
|
||||
start: number;
|
||||
/** Exclusive. */
|
||||
end: number;
|
||||
}
|
||||
export interface ExtensionRangeOptions {
|
||||
/** The parser stores options it doesn't recognize here. See above. */
|
||||
uninterpretedOption: UninterpretedOption[];
|
||||
}
|
||||
/** Describes a field within a message. */
|
||||
export interface FieldDescriptorProto {
|
||||
name: string;
|
||||
number: number;
|
||||
label: FieldDescriptorProto_Label;
|
||||
/**
|
||||
* If type_name is set, this need not be set. If both this and type_name
|
||||
* are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
|
||||
*/
|
||||
type: FieldDescriptorProto_Type;
|
||||
/**
|
||||
* For message and enum types, this is the name of the type. If the name
|
||||
* starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
|
||||
* rules are used to find the type (i.e. first the nested types within this
|
||||
* message are searched, then within the parent, on up to the root
|
||||
* namespace).
|
||||
*/
|
||||
typeName: string;
|
||||
/**
|
||||
* For extensions, this is the name of the type being extended. It is
|
||||
* resolved in the same manner as type_name.
|
||||
*/
|
||||
extendee: string;
|
||||
/**
|
||||
* For numeric types, contains the original text representation of the value.
|
||||
* For booleans, "true" or "false".
|
||||
* For strings, contains the default text contents (not escaped in any way).
|
||||
* For bytes, contains the C escaped value. All bytes >= 128 are escaped.
|
||||
*/
|
||||
defaultValue: string;
|
||||
/**
|
||||
* If set, gives the index of a oneof in the containing type's oneof_decl
|
||||
* list. This field is a member of that oneof.
|
||||
*/
|
||||
oneofIndex: number;
|
||||
/**
|
||||
* JSON name of this field. The value is set by protocol compiler. If the
|
||||
* user has set a "json_name" option on this field, that option's value
|
||||
* will be used. Otherwise, it's deduced from the field's name by converting
|
||||
* it to camelCase.
|
||||
*/
|
||||
jsonName: string;
|
||||
options: FieldOptions | undefined;
|
||||
/**
|
||||
* If true, this is a proto3 "optional". When a proto3 field is optional, it
|
||||
* tracks presence regardless of field type.
|
||||
*
|
||||
* When proto3_optional is true, this field must be belong to a oneof to
|
||||
* signal to old proto3 clients that presence is tracked for this field. This
|
||||
* oneof is known as a "synthetic" oneof, and this field must be its sole
|
||||
* member (each proto3 optional field gets its own synthetic oneof). Synthetic
|
||||
* oneofs exist in the descriptor only, and do not generate any API. Synthetic
|
||||
* oneofs must be ordered after all "real" oneofs.
|
||||
*
|
||||
* For message fields, proto3_optional doesn't create any semantic change,
|
||||
* since non-repeated message fields always track presence. However it still
|
||||
* indicates the semantic detail of whether the user wrote "optional" or not.
|
||||
* This can be useful for round-tripping the .proto file. For consistency we
|
||||
* give message fields a synthetic oneof also, even though it is not required
|
||||
* to track presence. This is especially important because the parser can't
|
||||
* tell if a field is a message or an enum, so it must always create a
|
||||
* synthetic oneof.
|
||||
*
|
||||
* Proto2 optional fields do not set this flag, because they already indicate
|
||||
* optional with `LABEL_OPTIONAL`.
|
||||
*/
|
||||
proto3Optional: boolean;
|
||||
}
|
||||
export declare enum FieldDescriptorProto_Type {
|
||||
/**
|
||||
* TYPE_DOUBLE - 0 is reserved for errors.
|
||||
* Order is weird for historical reasons.
|
||||
*/
|
||||
TYPE_DOUBLE = 1,
|
||||
TYPE_FLOAT = 2,
|
||||
/**
|
||||
* TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
|
||||
* negative values are likely.
|
||||
*/
|
||||
TYPE_INT64 = 3,
|
||||
TYPE_UINT64 = 4,
|
||||
/**
|
||||
* TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
|
||||
* negative values are likely.
|
||||
*/
|
||||
TYPE_INT32 = 5,
|
||||
TYPE_FIXED64 = 6,
|
||||
TYPE_FIXED32 = 7,
|
||||
TYPE_BOOL = 8,
|
||||
TYPE_STRING = 9,
|
||||
/**
|
||||
* TYPE_GROUP - Tag-delimited aggregate.
|
||||
* Group type is deprecated and not supported in proto3. However, Proto3
|
||||
* implementations should still be able to parse the group wire format and
|
||||
* treat group fields as unknown fields.
|
||||
*/
|
||||
TYPE_GROUP = 10,
|
||||
/** TYPE_MESSAGE - Length-delimited aggregate. */
|
||||
TYPE_MESSAGE = 11,
|
||||
/** TYPE_BYTES - New in version 2. */
|
||||
TYPE_BYTES = 12,
|
||||
TYPE_UINT32 = 13,
|
||||
TYPE_ENUM = 14,
|
||||
TYPE_SFIXED32 = 15,
|
||||
TYPE_SFIXED64 = 16,
|
||||
/** TYPE_SINT32 - Uses ZigZag encoding. */
|
||||
TYPE_SINT32 = 17,
|
||||
/** TYPE_SINT64 - Uses ZigZag encoding. */
|
||||
TYPE_SINT64 = 18
|
||||
}
|
||||
export declare function fieldDescriptorProto_TypeFromJSON(object: any): FieldDescriptorProto_Type;
|
||||
export declare function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Type): string;
|
||||
export declare enum FieldDescriptorProto_Label {
|
||||
/** LABEL_OPTIONAL - 0 is reserved for errors */
|
||||
LABEL_OPTIONAL = 1,
|
||||
LABEL_REQUIRED = 2,
|
||||
LABEL_REPEATED = 3
|
||||
}
|
||||
export declare function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptorProto_Label;
|
||||
export declare function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_Label): string;
|
||||
/** Describes a oneof. */
|
||||
export interface OneofDescriptorProto {
|
||||
name: string;
|
||||
options: OneofOptions | undefined;
|
||||
}
|
||||
/** Describes an enum type. */
|
||||
export interface EnumDescriptorProto {
|
||||
name: string;
|
||||
value: EnumValueDescriptorProto[];
|
||||
options: EnumOptions | undefined;
|
||||
/**
|
||||
* Range of reserved numeric values. Reserved numeric values may not be used
|
||||
* by enum values in the same enum declaration. Reserved ranges may not
|
||||
* overlap.
|
||||
*/
|
||||
reservedRange: EnumDescriptorProto_EnumReservedRange[];
|
||||
/**
|
||||
* Reserved enum value names, which may not be reused. A given name may only
|
||||
* be reserved once.
|
||||
*/
|
||||
reservedName: string[];
|
||||
}
|
||||
/**
|
||||
* Range of reserved numeric values. Reserved values may not be used by
|
||||
* entries in the same enum. Reserved ranges may not overlap.
|
||||
*
|
||||
* Note that this is distinct from DescriptorProto.ReservedRange in that it
|
||||
* is inclusive such that it can appropriately represent the entire int32
|
||||
* domain.
|
||||
*/
|
||||
export interface EnumDescriptorProto_EnumReservedRange {
|
||||
/** Inclusive. */
|
||||
start: number;
|
||||
/** Inclusive. */
|
||||
end: number;
|
||||
}
|
||||
/** Describes a value within an enum. */
|
||||
export interface EnumValueDescriptorProto {
|
||||
name: string;
|
||||
number: number;
|
||||
options: EnumValueOptions | undefined;
|
||||
}
|
||||
/** Describes a service. */
|
||||
export interface ServiceDescriptorProto {
|
||||
name: string;
|
||||
method: MethodDescriptorProto[];
|
||||
options: ServiceOptions | undefined;
|
||||
}
|
||||
/** Describes a method of a service. */
|
||||
export interface MethodDescriptorProto {
|
||||
name: string;
|
||||
/**
|
||||
* Input and output type names. These are resolved in the same way as
|
||||
* FieldDescriptorProto.type_name, but must refer to a message type.
|
||||
*/
|
||||
inputType: string;
|
||||
outputType: string;
|
||||
options: MethodOptions | undefined;
|
||||
/** Identifies if client streams multiple client messages */
|
||||
clientStreaming: boolean;
|
||||
/** Identifies if server streams multiple server messages */
|
||||
serverStreaming: boolean;
|
||||
}
|
||||
export interface FileOptions {
|
||||
/**
|
||||
* Sets the Java package where classes generated from this .proto will be
|
||||
* placed. By default, the proto package is used, but this is often
|
||||
* inappropriate because proto packages do not normally start with backwards
|
||||
* domain names.
|
||||
*/
|
||||
javaPackage: string;
|
||||
/**
|
||||
* Controls the name of the wrapper Java class generated for the .proto file.
|
||||
* That class will always contain the .proto file's getDescriptor() method as
|
||||
* well as any top-level extensions defined in the .proto file.
|
||||
* If java_multiple_files is disabled, then all the other classes from the
|
||||
* .proto file will be nested inside the single wrapper outer class.
|
||||
*/
|
||||
javaOuterClassname: string;
|
||||
/**
|
||||
* If enabled, then the Java code generator will generate a separate .java
|
||||
* file for each top-level message, enum, and service defined in the .proto
|
||||
* file. Thus, these types will *not* be nested inside the wrapper class
|
||||
* named by java_outer_classname. However, the wrapper class will still be
|
||||
* generated to contain the file's getDescriptor() method as well as any
|
||||
* top-level extensions defined in the file.
|
||||
*/
|
||||
javaMultipleFiles: boolean;
|
||||
/**
|
||||
* This option does nothing.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
javaGenerateEqualsAndHash: boolean;
|
||||
/**
|
||||
* If set true, then the Java2 code generator will generate code that
|
||||
* throws an exception whenever an attempt is made to assign a non-UTF-8
|
||||
* byte sequence to a string field.
|
||||
* Message reflection will do the same.
|
||||
* However, an extension field still accepts non-UTF-8 byte sequences.
|
||||
* This option has no effect on when used with the lite runtime.
|
||||
*/
|
||||
javaStringCheckUtf8: boolean;
|
||||
optimizeFor: FileOptions_OptimizeMode;
|
||||
/**
|
||||
* Sets the Go package where structs generated from this .proto will be
|
||||
* placed. If omitted, the Go package will be derived from the following:
|
||||
* - The basename of the package import path, if provided.
|
||||
* - Otherwise, the package statement in the .proto file, if present.
|
||||
* - Otherwise, the basename of the .proto file, without extension.
|
||||
*/
|
||||
goPackage: string;
|
||||
/**
|
||||
* Should generic services be generated in each language? "Generic" services
|
||||
* are not specific to any particular RPC system. They are generated by the
|
||||
* main code generators in each language (without additional plugins).
|
||||
* Generic services were the only kind of service generation supported by
|
||||
* early versions of google.protobuf.
|
||||
*
|
||||
* Generic services are now considered deprecated in favor of using plugins
|
||||
* that generate code specific to your particular RPC system. Therefore,
|
||||
* these default to false. Old code which depends on generic services should
|
||||
* explicitly set them to true.
|
||||
*/
|
||||
ccGenericServices: boolean;
|
||||
javaGenericServices: boolean;
|
||||
pyGenericServices: boolean;
|
||||
phpGenericServices: boolean;
|
||||
/**
|
||||
* Is this file deprecated?
|
||||
* Depending on the target platform, this can emit Deprecated annotations
|
||||
* for everything in the file, or it will be completely ignored; in the very
|
||||
* least, this is a formalization for deprecating files.
|
||||
*/
|
||||
deprecated: boolean;
|
||||
/**
|
||||
* Enables the use of arenas for the proto messages in this file. This applies
|
||||
* only to generated classes for C++.
|
||||
*/
|
||||
ccEnableArenas: boolean;
|
||||
/**
|
||||
* Sets the objective c class prefix which is prepended to all objective c
|
||||
* generated classes from this .proto. There is no default.
|
||||
*/
|
||||
objcClassPrefix: string;
|
||||
/** Namespace for generated classes; defaults to the package. */
|
||||
csharpNamespace: string;
|
||||
/**
|
||||
* By default Swift generators will take the proto package and CamelCase it
|
||||
* replacing '.' with underscore and use that to prefix the types/symbols
|
||||
* defined. When this options is provided, they will use this value instead
|
||||
* to prefix the types/symbols defined.
|
||||
*/
|
||||
swiftPrefix: string;
|
||||
/**
|
||||
* Sets the php class prefix which is prepended to all php generated classes
|
||||
* from this .proto. Default is empty.
|
||||
*/
|
||||
phpClassPrefix: string;
|
||||
/**
|
||||
* Use this option to change the namespace of php generated classes. Default
|
||||
* is empty. When this option is empty, the package name will be used for
|
||||
* determining the namespace.
|
||||
*/
|
||||
phpNamespace: string;
|
||||
/**
|
||||
* Use this option to change the namespace of php generated metadata classes.
|
||||
* Default is empty. When this option is empty, the proto file name will be
|
||||
* used for determining the namespace.
|
||||
*/
|
||||
phpMetadataNamespace: string;
|
||||
/**
|
||||
* Use this option to change the package of ruby generated classes. Default
|
||||
* is empty. When this option is not set, the package name will be used for
|
||||
* determining the ruby package.
|
||||
*/
|
||||
rubyPackage: string;
|
||||
/**
|
||||
* The parser stores options it doesn't recognize here.
|
||||
* See the documentation for the "Options" section above.
|
||||
*/
|
||||
uninterpretedOption: UninterpretedOption[];
|
||||
}
|
||||
/** Generated classes can be optimized for speed or code size. */
|
||||
export declare enum FileOptions_OptimizeMode {
|
||||
/** SPEED - Generate complete code for parsing, serialization, */
|
||||
SPEED = 1,
|
||||
/** CODE_SIZE - etc. */
|
||||
CODE_SIZE = 2,
|
||||
/** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */
|
||||
LITE_RUNTIME = 3
|
||||
}
|
||||
export declare function fileOptions_OptimizeModeFromJSON(object: any): FileOptions_OptimizeMode;
|
||||
export declare function fileOptions_OptimizeModeToJSON(object: FileOptions_OptimizeMode): string;
|
||||
export interface MessageOptions {
|
||||
/**
|
||||
* Set true to use the old proto1 MessageSet wire format for extensions.
|
||||
* This is provided for backwards-compatibility with the MessageSet wire
|
||||
* format. You should not use this for any other reason: It's less
|
||||
* efficient, has fewer features, and is more complicated.
|
||||
*
|
||||
* The message must be defined exactly as follows:
|
||||
* message Foo {
|
||||
* option message_set_wire_format = true;
|
||||
* extensions 4 to max;
|
||||
* }
|
||||
* Note that the message cannot have any defined fields; MessageSets only
|
||||
* have extensions.
|
||||
*
|
||||
* All extensions of your type must be singular messages; e.g. they cannot
|
||||
* be int32s, enums, or repeated messages.
|
||||
*
|
||||
* Because this is an option, the above two restrictions are not enforced by
|
||||
* the protocol compiler.
|
||||
*/
|
||||
messageSetWireFormat: boolean;
|
||||
/**
|
||||
* Disables the generation of the standard "descriptor()" accessor, which can
|
||||
* conflict with a field of the same name. This is meant to make migration
|
||||
* from proto1 easier; new code should avoid fields named "descriptor".
|
||||
*/
|
||||
noStandardDescriptorAccessor: boolean;
|
||||
/**
|
||||
* Is this message deprecated?
|
||||
* Depending on the target platform, this can emit Deprecated annotations
|
||||
* for the message, or it will be completely ignored; in the very least,
|
||||
* this is a formalization for deprecating messages.
|
||||
*/
|
||||
deprecated: boolean;
|
||||
/**
|
||||
* Whether the message is an automatically generated map entry type for the
|
||||
* maps field.
|
||||
*
|
||||
* For maps fields:
|
||||
* map<KeyType, ValueType> map_field = 1;
|
||||
* The parsed descriptor looks like:
|
||||
* message MapFieldEntry {
|
||||
* option map_entry = true;
|
||||
* optional KeyType key = 1;
|
||||
* optional ValueType value = 2;
|
||||
* }
|
||||
* repeated MapFieldEntry map_field = 1;
|
||||
*
|
||||
* Implementations may choose not to generate the map_entry=true message, but
|
||||
* use a native map in the target language to hold the keys and values.
|
||||
* The reflection APIs in such implementations still need to work as
|
||||
* if the field is a repeated message field.
|
||||
*
|
||||
* NOTE: Do not set the option in .proto files. Always use the maps syntax
|
||||
* instead. The option should only be implicitly set by the proto compiler
|
||||
* parser.
|
||||
*/
|
||||
mapEntry: boolean;
|
||||
/** The parser stores options it doesn't recognize here. See above. */
|
||||
uninterpretedOption: UninterpretedOption[];
|
||||
}
|
||||
export interface FieldOptions {
|
||||
/**
|
||||
* The ctype option instructs the C++ code generator to use a different
|
||||
* representation of the field than it normally would. See the specific
|
||||
* options below. This option is not yet implemented in the open source
|
||||
* release -- sorry, we'll try to include it in a future version!
|
||||
*/
|
||||
ctype: FieldOptions_CType;
|
||||
/**
|
||||
* The packed option can be enabled for repeated primitive fields to enable
|
||||
* a more efficient representation on the wire. Rather than repeatedly
|
||||
* writing the tag and type for each element, the entire array is encoded as
|
||||
* a single length-delimited blob. In proto3, only explicit setting it to
|
||||
* false will avoid using packed encoding.
|
||||
*/
|
||||
packed: boolean;
|
||||
/**
|
||||
* The jstype option determines the JavaScript type used for values of the
|
||||
* field. The option is permitted only for 64 bit integral and fixed types
|
||||
* (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
|
||||
* is represented as JavaScript string, which avoids loss of precision that
|
||||
* can happen when a large value is converted to a floating point JavaScript.
|
||||
* Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
|
||||
* use the JavaScript "number" type. The behavior of the default option
|
||||
* JS_NORMAL is implementation dependent.
|
||||
*
|
||||
* This option is an enum to permit additional types to be added, e.g.
|
||||
* goog.math.Integer.
|
||||
*/
|
||||
jstype: FieldOptions_JSType;
|
||||
/**
|
||||
* Should this field be parsed lazily? Lazy applies only to message-type
|
||||
* fields. It means that when the outer message is initially parsed, the
|
||||
* inner message's contents will not be parsed but instead stored in encoded
|
||||
* form. The inner message will actually be parsed when it is first accessed.
|
||||
*
|
||||
* This is only a hint. Implementations are free to choose whether to use
|
||||
* eager or lazy parsing regardless of the value of this option. However,
|
||||
* setting this option true suggests that the protocol author believes that
|
||||
* using lazy parsing on this field is worth the additional bookkeeping
|
||||
* overhead typically needed to implement it.
|
||||
*
|
||||
* This option does not affect the public interface of any generated code;
|
||||
* all method signatures remain the same. Furthermore, thread-safety of the
|
||||
* interface is not affected by this option; const methods remain safe to
|
||||
* call from multiple threads concurrently, while non-const methods continue
|
||||
* to require exclusive access.
|
||||
*
|
||||
* Note that implementations may choose not to check required fields within
|
||||
* a lazy sub-message. That is, calling IsInitialized() on the outer message
|
||||
* may return true even if the inner message has missing required fields.
|
||||
* This is necessary because otherwise the inner message would have to be
|
||||
* parsed in order to perform the check, defeating the purpose of lazy
|
||||
* parsing. An implementation which chooses not to check required fields
|
||||
* must be consistent about it. That is, for any particular sub-message, the
|
||||
* implementation must either *always* check its required fields, or *never*
|
||||
* check its required fields, regardless of whether or not the message has
|
||||
* been parsed.
|
||||
*
|
||||
* As of 2021, lazy does no correctness checks on the byte stream during
|
||||
* parsing. This may lead to crashes if and when an invalid byte stream is
|
||||
* finally parsed upon access.
|
||||
*
|
||||
* TODO(b/211906113): Enable validation on lazy fields.
|
||||
*/
|
||||
lazy: boolean;
|
||||
/**
|
||||
* unverified_lazy does no correctness checks on the byte stream. This should
|
||||
* only be used where lazy with verification is prohibitive for performance
|
||||
* reasons.
|
||||
*/
|
||||
unverifiedLazy: boolean;
|
||||
/**
|
||||
* Is this field deprecated?
|
||||
* Depending on the target platform, this can emit Deprecated annotations
|
||||
* for accessors, or it will be completely ignored; in the very least, this
|
||||
* is a formalization for deprecating fields.
|
||||
*/
|
||||
deprecated: boolean;
|
||||
/** For Google-internal migration only. Do not use. */
|
||||
weak: boolean;
|
||||
/** The parser stores options it doesn't recognize here. See above. */
|
||||
uninterpretedOption: UninterpretedOption[];
|
||||
}
|
||||
export declare enum FieldOptions_CType {
|
||||
/** STRING - Default mode. */
|
||||
STRING = 0,
|
||||
CORD = 1,
|
||||
STRING_PIECE = 2
|
||||
}
|
||||
export declare function fieldOptions_CTypeFromJSON(object: any): FieldOptions_CType;
|
||||
export declare function fieldOptions_CTypeToJSON(object: FieldOptions_CType): string;
|
||||
export declare enum FieldOptions_JSType {
|
||||
/** JS_NORMAL - Use the default type. */
|
||||
JS_NORMAL = 0,
|
||||
/** JS_STRING - Use JavaScript strings. */
|
||||
JS_STRING = 1,
|
||||
/** JS_NUMBER - Use JavaScript numbers. */
|
||||
JS_NUMBER = 2
|
||||
}
|
||||
export declare function fieldOptions_JSTypeFromJSON(object: any): FieldOptions_JSType;
|
||||
export declare function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string;
|
||||
export interface OneofOptions {
|
||||
/** The parser stores options it doesn't recognize here. See above. */
|
||||
uninterpretedOption: UninterpretedOption[];
|
||||
}
|
||||
export interface EnumOptions {
|
||||
/**
|
||||
* Set this option to true to allow mapping different tag names to the same
|
||||
* value.
|
||||
*/
|
||||
allowAlias: boolean;
|
||||
/**
|
||||
* Is this enum deprecated?
|
||||
* Depending on the target platform, this can emit Deprecated annotations
|
||||
* for the enum, or it will be completely ignored; in the very least, this
|
||||
* is a formalization for deprecating enums.
|
||||
*/
|
||||
deprecated: boolean;
|
||||
/** The parser stores options it doesn't recognize here. See above. */
|
||||
uninterpretedOption: UninterpretedOption[];
|
||||
}
|
||||
export interface EnumValueOptions {
|
||||
/**
|
||||
* Is this enum value deprecated?
|
||||
* Depending on the target platform, this can emit Deprecated annotations
|
||||
* for the enum value, or it will be completely ignored; in the very least,
|
||||
* this is a formalization for deprecating enum values.
|
||||
*/
|
||||
deprecated: boolean;
|
||||
/** The parser stores options it doesn't recognize here. See above. */
|
||||
uninterpretedOption: UninterpretedOption[];
|
||||
}
|
||||
export interface ServiceOptions {
|
||||
/**
|
||||
* Is this service deprecated?
|
||||
* Depending on the target platform, this can emit Deprecated annotations
|
||||
* for the service, or it will be completely ignored; in the very least,
|
||||
* this is a formalization for deprecating services.
|
||||
*/
|
||||
deprecated: boolean;
|
||||
/** The parser stores options it doesn't recognize here. See above. */
|
||||
uninterpretedOption: UninterpretedOption[];
|
||||
}
|
||||
export interface MethodOptions {
|
||||
/**
|
||||
* Is this method deprecated?
|
||||
* Depending on the target platform, this can emit Deprecated annotations
|
||||
* for the method, or it will be completely ignored; in the very least,
|
||||
* this is a formalization for deprecating methods.
|
||||
*/
|
||||
deprecated: boolean;
|
||||
idempotencyLevel: MethodOptions_IdempotencyLevel;
|
||||
/** The parser stores options it doesn't recognize here. See above. */
|
||||
uninterpretedOption: UninterpretedOption[];
|
||||
}
|
||||
/**
|
||||
* Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
|
||||
* or neither? HTTP based RPC implementation may choose GET verb for safe
|
||||
* methods, and PUT verb for idempotent methods instead of the default POST.
|
||||
*/
|
||||
export declare enum MethodOptions_IdempotencyLevel {
|
||||
IDEMPOTENCY_UNKNOWN = 0,
|
||||
/** NO_SIDE_EFFECTS - implies idempotent */
|
||||
NO_SIDE_EFFECTS = 1,
|
||||
/** IDEMPOTENT - idempotent, but may have side effects */
|
||||
IDEMPOTENT = 2
|
||||
}
|
||||
export declare function methodOptions_IdempotencyLevelFromJSON(object: any): MethodOptions_IdempotencyLevel;
|
||||
export declare function methodOptions_IdempotencyLevelToJSON(object: MethodOptions_IdempotencyLevel): string;
|
||||
/**
|
||||
* A message representing a option the parser does not recognize. This only
|
||||
* appears in options protos created by the compiler::Parser class.
|
||||
* DescriptorPool resolves these when building Descriptor objects. Therefore,
|
||||
* options protos in descriptor objects (e.g. returned by Descriptor::options(),
|
||||
* or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
|
||||
* in them.
|
||||
*/
|
||||
export interface UninterpretedOption {
|
||||
name: UninterpretedOption_NamePart[];
|
||||
/**
|
||||
* The value of the uninterpreted option, in whatever type the tokenizer
|
||||
* identified it as during parsing. Exactly one of these should be set.
|
||||
*/
|
||||
identifierValue: string;
|
||||
positiveIntValue: string;
|
||||
negativeIntValue: string;
|
||||
doubleValue: number;
|
||||
stringValue: Buffer;
|
||||
aggregateValue: string;
|
||||
}
|
||||
/**
|
||||
* The name of the uninterpreted option. Each string represents a segment in
|
||||
* a dot-separated name. is_extension is true iff a segment represents an
|
||||
* extension (denoted with parentheses in options specs in .proto files).
|
||||
* E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents
|
||||
* "foo.(bar.baz).moo".
|
||||
*/
|
||||
export interface UninterpretedOption_NamePart {
|
||||
namePart: string;
|
||||
isExtension: boolean;
|
||||
}
|
||||
/**
|
||||
* Encapsulates information about the original source file from which a
|
||||
* FileDescriptorProto was generated.
|
||||
*/
|
||||
export interface SourceCodeInfo {
|
||||
/**
|
||||
* A Location identifies a piece of source code in a .proto file which
|
||||
* corresponds to a particular definition. This information is intended
|
||||
* to be useful to IDEs, code indexers, documentation generators, and similar
|
||||
* tools.
|
||||
*
|
||||
* For example, say we have a file like:
|
||||
* message Foo {
|
||||
* optional string foo = 1;
|
||||
* }
|
||||
* Let's look at just the field definition:
|
||||
* optional string foo = 1;
|
||||
* ^ ^^ ^^ ^ ^^^
|
||||
* a bc de f ghi
|
||||
* We have the following locations:
|
||||
* span path represents
|
||||
* [a,i) [ 4, 0, 2, 0 ] The whole field definition.
|
||||
* [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
|
||||
* [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
|
||||
* [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
|
||||
* [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
|
||||
*
|
||||
* Notes:
|
||||
* - A location may refer to a repeated field itself (i.e. not to any
|
||||
* particular index within it). This is used whenever a set of elements are
|
||||
* logically enclosed in a single code segment. For example, an entire
|
||||
* extend block (possibly containing multiple extension definitions) will
|
||||
* have an outer location whose path refers to the "extensions" repeated
|
||||
* field without an index.
|
||||
* - Multiple locations may have the same path. This happens when a single
|
||||
* logical declaration is spread out across multiple places. The most
|
||||
* obvious example is the "extend" block again -- there may be multiple
|
||||
* extend blocks in the same scope, each of which will have the same path.
|
||||
* - A location's span is not always a subset of its parent's span. For
|
||||
* example, the "extendee" of an extension declaration appears at the
|
||||
* beginning of the "extend" block and is shared by all extensions within
|
||||
* the block.
|
||||
* - Just because a location's span is a subset of some other location's span
|
||||
* does not mean that it is a descendant. For example, a "group" defines
|
||||
* both a type and a field in a single declaration. Thus, the locations
|
||||
* corresponding to the type and field and their components will overlap.
|
||||
* - Code which tries to interpret locations should probably be designed to
|
||||
* ignore those that it doesn't understand, as more types of locations could
|
||||
* be recorded in the future.
|
||||
*/
|
||||
location: SourceCodeInfo_Location[];
|
||||
}
|
||||
export interface SourceCodeInfo_Location {
|
||||
/**
|
||||
* Identifies which part of the FileDescriptorProto was defined at this
|
||||
* location.
|
||||
*
|
||||
* Each element is a field number or an index. They form a path from
|
||||
* the root FileDescriptorProto to the place where the definition occurs.
|
||||
* For example, this path:
|
||||
* [ 4, 3, 2, 7, 1 ]
|
||||
* refers to:
|
||||
* file.message_type(3) // 4, 3
|
||||
* .field(7) // 2, 7
|
||||
* .name() // 1
|
||||
* This is because FileDescriptorProto.message_type has field number 4:
|
||||
* repeated DescriptorProto message_type = 4;
|
||||
* and DescriptorProto.field has field number 2:
|
||||
* repeated FieldDescriptorProto field = 2;
|
||||
* and FieldDescriptorProto.name has field number 1:
|
||||
* optional string name = 1;
|
||||
*
|
||||
* Thus, the above path gives the location of a field name. If we removed
|
||||
* the last element:
|
||||
* [ 4, 3, 2, 7 ]
|
||||
* this path refers to the whole field declaration (from the beginning
|
||||
* of the label to the terminating semicolon).
|
||||
*/
|
||||
path: number[];
|
||||
/**
|
||||
* Always has exactly three or four elements: start line, start column,
|
||||
* end line (optional, otherwise assumed same as start line), end column.
|
||||
* These are packed into a single field for efficiency. Note that line
|
||||
* and column numbers are zero-based -- typically you will want to add
|
||||
* 1 to each before displaying to a user.
|
||||
*/
|
||||
span: number[];
|
||||
/**
|
||||
* If this SourceCodeInfo represents a complete declaration, these are any
|
||||
* comments appearing before and after the declaration which appear to be
|
||||
* attached to the declaration.
|
||||
*
|
||||
* A series of line comments appearing on consecutive lines, with no other
|
||||
* tokens appearing on those lines, will be treated as a single comment.
|
||||
*
|
||||
* leading_detached_comments will keep paragraphs of comments that appear
|
||||
* before (but not connected to) the current element. Each paragraph,
|
||||
* separated by empty lines, will be one comment element in the repeated
|
||||
* field.
|
||||
*
|
||||
* Only the comment content is provided; comment markers (e.g. //) are
|
||||
* stripped out. For block comments, leading whitespace and an asterisk
|
||||
* will be stripped from the beginning of each line other than the first.
|
||||
* Newlines are included in the output.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* optional int32 foo = 1; // Comment attached to foo.
|
||||
* // Comment attached to bar.
|
||||
* optional int32 bar = 2;
|
||||
*
|
||||
* optional string baz = 3;
|
||||
* // Comment attached to baz.
|
||||
* // Another line attached to baz.
|
||||
*
|
||||
* // Comment attached to moo.
|
||||
* //
|
||||
* // Another line attached to moo.
|
||||
* optional double moo = 4;
|
||||
*
|
||||
* // Detached comment for corge. This is not leading or trailing comments
|
||||
* // to moo or corge because there are blank lines separating it from
|
||||
* // both.
|
||||
*
|
||||
* // Detached comment for corge paragraph 2.
|
||||
*
|
||||
* optional string corge = 5;
|
||||
* /* Block comment attached
|
||||
* * to corge. Leading asterisks
|
||||
* * will be removed. * /
|
||||
* /* Block comment attached to
|
||||
* * grault. * /
|
||||
* optional int32 grault = 6;
|
||||
*
|
||||
* // ignored detached comments.
|
||||
*/
|
||||
leadingComments: string;
|
||||
trailingComments: string;
|
||||
leadingDetachedComments: string[];
|
||||
}
|
||||
/**
|
||||
* Describes the relationship between generated code and its original source
|
||||
* file. A GeneratedCodeInfo message is associated with only one generated
|
||||
* source file, but may contain references to different source .proto files.
|
||||
*/
|
||||
export interface GeneratedCodeInfo {
|
||||
/**
|
||||
* An Annotation connects some span of text in generated code to an element
|
||||
* of its generating .proto file.
|
||||
*/
|
||||
annotation: GeneratedCodeInfo_Annotation[];
|
||||
}
|
||||
export interface GeneratedCodeInfo_Annotation {
|
||||
/**
|
||||
* Identifies the element in the original source .proto file. This field
|
||||
* is formatted the same as SourceCodeInfo.Location.path.
|
||||
*/
|
||||
path: number[];
|
||||
/** Identifies the filesystem path to the original source .proto. */
|
||||
sourceFile: string;
|
||||
/**
|
||||
* Identifies the starting offset in bytes in the generated code
|
||||
* that relates to the identified object.
|
||||
*/
|
||||
begin: number;
|
||||
/**
|
||||
* Identifies the ending offset in bytes in the generated code that
|
||||
* relates to the identified offset. The end offset should be one past
|
||||
* the last relevant byte (so the length of the text = end - begin).
|
||||
*/
|
||||
end: number;
|
||||
}
|
||||
export declare const FileDescriptorSet: {
|
||||
fromJSON(object: any): FileDescriptorSet;
|
||||
toJSON(message: FileDescriptorSet): unknown;
|
||||
};
|
||||
export declare const FileDescriptorProto: {
|
||||
fromJSON(object: any): FileDescriptorProto;
|
||||
toJSON(message: FileDescriptorProto): unknown;
|
||||
};
|
||||
export declare const DescriptorProto: {
|
||||
fromJSON(object: any): DescriptorProto;
|
||||
toJSON(message: DescriptorProto): unknown;
|
||||
};
|
||||
export declare const DescriptorProto_ExtensionRange: {
|
||||
fromJSON(object: any): DescriptorProto_ExtensionRange;
|
||||
toJSON(message: DescriptorProto_ExtensionRange): unknown;
|
||||
};
|
||||
export declare const DescriptorProto_ReservedRange: {
|
||||
fromJSON(object: any): DescriptorProto_ReservedRange;
|
||||
toJSON(message: DescriptorProto_ReservedRange): unknown;
|
||||
};
|
||||
export declare const ExtensionRangeOptions: {
|
||||
fromJSON(object: any): ExtensionRangeOptions;
|
||||
toJSON(message: ExtensionRangeOptions): unknown;
|
||||
};
|
||||
export declare const FieldDescriptorProto: {
|
||||
fromJSON(object: any): FieldDescriptorProto;
|
||||
toJSON(message: FieldDescriptorProto): unknown;
|
||||
};
|
||||
export declare const OneofDescriptorProto: {
|
||||
fromJSON(object: any): OneofDescriptorProto;
|
||||
toJSON(message: OneofDescriptorProto): unknown;
|
||||
};
|
||||
export declare const EnumDescriptorProto: {
|
||||
fromJSON(object: any): EnumDescriptorProto;
|
||||
toJSON(message: EnumDescriptorProto): unknown;
|
||||
};
|
||||
export declare const EnumDescriptorProto_EnumReservedRange: {
|
||||
fromJSON(object: any): EnumDescriptorProto_EnumReservedRange;
|
||||
toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown;
|
||||
};
|
||||
export declare const EnumValueDescriptorProto: {
|
||||
fromJSON(object: any): EnumValueDescriptorProto;
|
||||
toJSON(message: EnumValueDescriptorProto): unknown;
|
||||
};
|
||||
export declare const ServiceDescriptorProto: {
|
||||
fromJSON(object: any): ServiceDescriptorProto;
|
||||
toJSON(message: ServiceDescriptorProto): unknown;
|
||||
};
|
||||
export declare const MethodDescriptorProto: {
|
||||
fromJSON(object: any): MethodDescriptorProto;
|
||||
toJSON(message: MethodDescriptorProto): unknown;
|
||||
};
|
||||
export declare const FileOptions: {
|
||||
fromJSON(object: any): FileOptions;
|
||||
toJSON(message: FileOptions): unknown;
|
||||
};
|
||||
export declare const MessageOptions: {
|
||||
fromJSON(object: any): MessageOptions;
|
||||
toJSON(message: MessageOptions): unknown;
|
||||
};
|
||||
export declare const FieldOptions: {
|
||||
fromJSON(object: any): FieldOptions;
|
||||
toJSON(message: FieldOptions): unknown;
|
||||
};
|
||||
export declare const OneofOptions: {
|
||||
fromJSON(object: any): OneofOptions;
|
||||
toJSON(message: OneofOptions): unknown;
|
||||
};
|
||||
export declare const EnumOptions: {
|
||||
fromJSON(object: any): EnumOptions;
|
||||
toJSON(message: EnumOptions): unknown;
|
||||
};
|
||||
export declare const EnumValueOptions: {
|
||||
fromJSON(object: any): EnumValueOptions;
|
||||
toJSON(message: EnumValueOptions): unknown;
|
||||
};
|
||||
export declare const ServiceOptions: {
|
||||
fromJSON(object: any): ServiceOptions;
|
||||
toJSON(message: ServiceOptions): unknown;
|
||||
};
|
||||
export declare const MethodOptions: {
|
||||
fromJSON(object: any): MethodOptions;
|
||||
toJSON(message: MethodOptions): unknown;
|
||||
};
|
||||
export declare const UninterpretedOption: {
|
||||
fromJSON(object: any): UninterpretedOption;
|
||||
toJSON(message: UninterpretedOption): unknown;
|
||||
};
|
||||
export declare const UninterpretedOption_NamePart: {
|
||||
fromJSON(object: any): UninterpretedOption_NamePart;
|
||||
toJSON(message: UninterpretedOption_NamePart): unknown;
|
||||
};
|
||||
export declare const SourceCodeInfo: {
|
||||
fromJSON(object: any): SourceCodeInfo;
|
||||
toJSON(message: SourceCodeInfo): unknown;
|
||||
};
|
||||
export declare const SourceCodeInfo_Location: {
|
||||
fromJSON(object: any): SourceCodeInfo_Location;
|
||||
toJSON(message: SourceCodeInfo_Location): unknown;
|
||||
};
|
||||
export declare const GeneratedCodeInfo: {
|
||||
fromJSON(object: any): GeneratedCodeInfo;
|
||||
toJSON(message: GeneratedCodeInfo): unknown;
|
||||
};
|
||||
export declare const GeneratedCodeInfo_Annotation: {
|
||||
fromJSON(object: any): GeneratedCodeInfo_Annotation;
|
||||
toJSON(message: GeneratedCodeInfo_Annotation): unknown;
|
||||
};
|
||||
Generated
Vendored
-110
@@ -1,110 +0,0 @@
|
||||
/**
|
||||
* A Timestamp represents a point in time independent of any time zone or local
|
||||
* calendar, encoded as a count of seconds and fractions of seconds at
|
||||
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
||||
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
||||
* Gregorian calendar backwards to year one.
|
||||
*
|
||||
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
||||
* second table is needed for interpretation, using a [24-hour linear
|
||||
* smear](https://developers.google.com/time/smear).
|
||||
*
|
||||
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
||||
* restricting to that range, we ensure that we can convert to and from [RFC
|
||||
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* Example 1: Compute Timestamp from POSIX `time()`.
|
||||
*
|
||||
* Timestamp timestamp;
|
||||
* timestamp.set_seconds(time(NULL));
|
||||
* timestamp.set_nanos(0);
|
||||
*
|
||||
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
||||
*
|
||||
* struct timeval tv;
|
||||
* gettimeofday(&tv, NULL);
|
||||
*
|
||||
* Timestamp timestamp;
|
||||
* timestamp.set_seconds(tv.tv_sec);
|
||||
* timestamp.set_nanos(tv.tv_usec * 1000);
|
||||
*
|
||||
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
||||
*
|
||||
* FILETIME ft;
|
||||
* GetSystemTimeAsFileTime(&ft);
|
||||
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
||||
*
|
||||
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
||||
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
||||
* Timestamp timestamp;
|
||||
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
||||
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
||||
*
|
||||
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
||||
*
|
||||
* long millis = System.currentTimeMillis();
|
||||
*
|
||||
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
||||
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
||||
*
|
||||
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
||||
*
|
||||
* Instant now = Instant.now();
|
||||
*
|
||||
* Timestamp timestamp =
|
||||
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
||||
* .setNanos(now.getNano()).build();
|
||||
*
|
||||
* Example 6: Compute Timestamp from current time in Python.
|
||||
*
|
||||
* timestamp = Timestamp()
|
||||
* timestamp.GetCurrentTime()
|
||||
*
|
||||
* # JSON Mapping
|
||||
*
|
||||
* In JSON format, the Timestamp type is encoded as a string in the
|
||||
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
||||
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
||||
* where {year} is always expressed using four digits while {month}, {day},
|
||||
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
||||
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
||||
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
||||
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
||||
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
||||
* able to accept both UTC and other timezones (as indicated by an offset).
|
||||
*
|
||||
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
||||
* 01:30 UTC on January 15, 2017.
|
||||
*
|
||||
* In JavaScript, one can convert a Date object to this format using the
|
||||
* standard
|
||||
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
||||
* method. In Python, a standard `datetime.datetime` object can be converted
|
||||
* to this format using
|
||||
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
||||
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
||||
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
||||
* http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
||||
* ) to obtain a formatter capable of generating timestamps in this format.
|
||||
*/
|
||||
export interface Timestamp {
|
||||
/**
|
||||
* Represents seconds of UTC time since Unix epoch
|
||||
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
||||
* 9999-12-31T23:59:59Z inclusive.
|
||||
*/
|
||||
seconds: string;
|
||||
/**
|
||||
* Non-negative fractions of a second at nanosecond resolution. Negative
|
||||
* second values with fractions must still have non-negative nanos values
|
||||
* that count forward in time. Must be from 0 to 999,999,999
|
||||
* inclusive.
|
||||
*/
|
||||
nanos: number;
|
||||
}
|
||||
export declare const Timestamp: {
|
||||
fromJSON(object: any): Timestamp;
|
||||
toJSON(message: Timestamp): unknown;
|
||||
};
|
||||
Generated
Vendored
-72
@@ -1,72 +0,0 @@
|
||||
import { Envelope } from "./envelope";
|
||||
import { MessageSignature, PublicKeyIdentifier, RFC3161SignedTimestamp, X509CertificateChain } from "./sigstore_common";
|
||||
import { TransparencyLogEntry } from "./sigstore_rekor";
|
||||
/**
|
||||
* Various timestamped counter signatures over the artifacts signature.
|
||||
* Currently only RFC3161 signatures are provided. More formats may be added
|
||||
* in the future.
|
||||
*/
|
||||
export interface TimestampVerificationData {
|
||||
/**
|
||||
* A list of RFC3161 signed timestamps provided by the user.
|
||||
* This can be used when the entry has not been stored on a
|
||||
* transparency log, or in conjunction for a stronger trust model.
|
||||
* Clients MUST verify the hashed message in the message imprint
|
||||
* against the signature in the bundle.
|
||||
*/
|
||||
rfc3161Timestamps: RFC3161SignedTimestamp[];
|
||||
}
|
||||
/**
|
||||
* VerificationMaterial captures details on the materials used to verify
|
||||
* signatures.
|
||||
*/
|
||||
export interface VerificationMaterial {
|
||||
content?: {
|
||||
$case: "publicKey";
|
||||
publicKey: PublicKeyIdentifier;
|
||||
} | {
|
||||
$case: "x509CertificateChain";
|
||||
x509CertificateChain: X509CertificateChain;
|
||||
};
|
||||
/**
|
||||
* This is the inclusion promise and/or proof, where
|
||||
* the timestamp is coming from the transparency log.
|
||||
*/
|
||||
tlogEntries: TransparencyLogEntry[];
|
||||
/** Timestamp verification data, over the artifact's signature. */
|
||||
timestampVerificationData: TimestampVerificationData | undefined;
|
||||
}
|
||||
export interface Bundle {
|
||||
/**
|
||||
* MUST be application/vnd.dev.sigstore.bundle+json;version=0.1
|
||||
* when encoded as JSON.
|
||||
*/
|
||||
mediaType: string;
|
||||
/**
|
||||
* When a signer is identified by a X.509 certificate, a verifier MUST
|
||||
* verify that the signature was computed at the time the certificate
|
||||
* was valid as described in the Sigstore client spec: "Verification
|
||||
* using a Bundle".
|
||||
* <https://docs.google.com/document/d/1kbhK2qyPPk8SLavHzYSDM8-Ueul9_oxIMVFuWMWKz0E/edit#heading=h.x8bduppe89ln>
|
||||
*/
|
||||
verificationMaterial: VerificationMaterial | undefined;
|
||||
content?: {
|
||||
$case: "messageSignature";
|
||||
messageSignature: MessageSignature;
|
||||
} | {
|
||||
$case: "dsseEnvelope";
|
||||
dsseEnvelope: Envelope;
|
||||
};
|
||||
}
|
||||
export declare const TimestampVerificationData: {
|
||||
fromJSON(object: any): TimestampVerificationData;
|
||||
toJSON(message: TimestampVerificationData): unknown;
|
||||
};
|
||||
export declare const VerificationMaterial: {
|
||||
fromJSON(object: any): VerificationMaterial;
|
||||
toJSON(message: VerificationMaterial): unknown;
|
||||
};
|
||||
export declare const Bundle: {
|
||||
fromJSON(object: any): Bundle;
|
||||
toJSON(message: Bundle): unknown;
|
||||
};
|
||||
Generated
Vendored
-228
@@ -1,228 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
/**
|
||||
* Only a subset of the secure hash standard algorithms are supported.
|
||||
* See <https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf> for more
|
||||
* details.
|
||||
* UNSPECIFIED SHOULD not be used, primary reason for inclusion is to force
|
||||
* any proto JSON serialization to emit the used hash algorithm, as default
|
||||
* option is to *omit* the default value of an enum (which is the first
|
||||
* value, represented by '0'.
|
||||
*/
|
||||
export declare enum HashAlgorithm {
|
||||
HASH_ALGORITHM_UNSPECIFIED = 0,
|
||||
SHA2_256 = 1
|
||||
}
|
||||
export declare function hashAlgorithmFromJSON(object: any): HashAlgorithm;
|
||||
export declare function hashAlgorithmToJSON(object: HashAlgorithm): string;
|
||||
/**
|
||||
* Details of a specific public key, capturing the the key encoding method,
|
||||
* and signature algorithm.
|
||||
* To avoid the possibility of contradicting formats such as PKCS1 with
|
||||
* ED25519 the valid permutations are listed as a linear set instead of a
|
||||
* cartesian set (i.e one combined variable instead of two, one for encoding
|
||||
* and one for the signature algorithm).
|
||||
*/
|
||||
export declare enum PublicKeyDetails {
|
||||
PUBLIC_KEY_DETAILS_UNSPECIFIED = 0,
|
||||
/** PKCS1_RSA_PKCS1V5 - RSA */
|
||||
PKCS1_RSA_PKCS1V5 = 1,
|
||||
/** PKCS1_RSA_PSS - See RFC8017 */
|
||||
PKCS1_RSA_PSS = 2,
|
||||
PKIX_RSA_PKCS1V5 = 3,
|
||||
PKIX_RSA_PSS = 4,
|
||||
/** PKIX_ECDSA_P256_SHA_256 - ECDSA */
|
||||
PKIX_ECDSA_P256_SHA_256 = 5,
|
||||
/** PKIX_ECDSA_P256_HMAC_SHA_256 - See RFC6979 */
|
||||
PKIX_ECDSA_P256_HMAC_SHA_256 = 6,
|
||||
/** PKIX_ED25519 - Ed 25519 */
|
||||
PKIX_ED25519 = 7
|
||||
}
|
||||
export declare function publicKeyDetailsFromJSON(object: any): PublicKeyDetails;
|
||||
export declare function publicKeyDetailsToJSON(object: PublicKeyDetails): string;
|
||||
export declare enum SubjectAlternativeNameType {
|
||||
SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED = 0,
|
||||
EMAIL = 1,
|
||||
URI = 2,
|
||||
/**
|
||||
* OTHER_NAME - OID 1.3.6.1.4.1.57264.1.7
|
||||
* See https://github.com/sigstore/fulcio/blob/main/docs/oid-info.md#1361415726417--othername-san
|
||||
* for more details.
|
||||
*/
|
||||
OTHER_NAME = 3
|
||||
}
|
||||
export declare function subjectAlternativeNameTypeFromJSON(object: any): SubjectAlternativeNameType;
|
||||
export declare function subjectAlternativeNameTypeToJSON(object: SubjectAlternativeNameType): string;
|
||||
/**
|
||||
* HashOutput captures a digest of a 'message' (generic octet sequence)
|
||||
* and the corresponding hash algorithm used.
|
||||
*/
|
||||
export interface HashOutput {
|
||||
algorithm: HashAlgorithm;
|
||||
/**
|
||||
* This is the raw octets of the message digest as computed by
|
||||
* the hash algorithm.
|
||||
*/
|
||||
digest: Buffer;
|
||||
}
|
||||
/** MessageSignature stores the computed signature over a message. */
|
||||
export interface MessageSignature {
|
||||
/** Message digest can be used to identify the artifact. */
|
||||
messageDigest: HashOutput | undefined;
|
||||
/**
|
||||
* The raw bytes as returned from the signature algorithm.
|
||||
* The signature algorithm (and so the format of the signature bytes)
|
||||
* are determined by the contents of the 'verification_material',
|
||||
* either a key-pair or a certificate. If using a certificate, the
|
||||
* certificate contains the required information on the signature
|
||||
* algorithm.
|
||||
* When using a key pair, the algorithm MUST be part of the public
|
||||
* key, which MUST be communicated out-of-band.
|
||||
*/
|
||||
signature: Buffer;
|
||||
}
|
||||
/** LogId captures the identity of a transparency log. */
|
||||
export interface LogId {
|
||||
/**
|
||||
* The unique id of the log, represented as the SHA-256 hash
|
||||
* of the log's public key, computed over the DER encoding.
|
||||
* <https://www.rfc-editor.org/rfc/rfc6962#section-3.2>
|
||||
*/
|
||||
keyId: Buffer;
|
||||
}
|
||||
/** This message holds a RFC 3161 timestamp. */
|
||||
export interface RFC3161SignedTimestamp {
|
||||
/**
|
||||
* Signed timestamp is the DER encoded TimeStampResponse.
|
||||
* See https://www.rfc-editor.org/rfc/rfc3161.html#section-2.4.2
|
||||
*/
|
||||
signedTimestamp: Buffer;
|
||||
}
|
||||
export interface PublicKey {
|
||||
/**
|
||||
* DER-encoded public key, encoding method is specified by the
|
||||
* key_details attribute.
|
||||
*/
|
||||
rawBytes?: Buffer | undefined;
|
||||
/** Key encoding and signature algorithm to use for this key. */
|
||||
keyDetails: PublicKeyDetails;
|
||||
/** Optional validity period for this key. */
|
||||
validFor?: TimeRange | undefined;
|
||||
}
|
||||
/**
|
||||
* PublicKeyIdentifier can be used to identify an (out of band) delivered
|
||||
* key, to verify a signature.
|
||||
*/
|
||||
export interface PublicKeyIdentifier {
|
||||
/**
|
||||
* Optional unauthenticated hint on which key to use.
|
||||
* The format of the hint must be agreed upon out of band by the
|
||||
* signer and the verifiers, and so is not subject to this
|
||||
* specification.
|
||||
* Example use-case is to specify the public key to use, from a
|
||||
* trusted key-ring.
|
||||
* Implementors are RECOMMENDED to derive the value from the public
|
||||
* key as described in RFC 6962.
|
||||
* See: <https://www.rfc-editor.org/rfc/rfc6962#section-3.2>
|
||||
*/
|
||||
hint: string;
|
||||
}
|
||||
/** An ASN.1 OBJECT IDENTIFIER */
|
||||
export interface ObjectIdentifier {
|
||||
id: number[];
|
||||
}
|
||||
/** An OID and the corresponding (byte) value. */
|
||||
export interface ObjectIdentifierValuePair {
|
||||
oid: ObjectIdentifier | undefined;
|
||||
value: Buffer;
|
||||
}
|
||||
export interface DistinguishedName {
|
||||
organization: string;
|
||||
commonName: string;
|
||||
}
|
||||
export interface X509Certificate {
|
||||
/** DER-encoded X.509 certificate. */
|
||||
rawBytes: Buffer;
|
||||
}
|
||||
export interface SubjectAlternativeName {
|
||||
type: SubjectAlternativeNameType;
|
||||
identity?: {
|
||||
$case: "regexp";
|
||||
regexp: string;
|
||||
} | {
|
||||
$case: "value";
|
||||
value: string;
|
||||
};
|
||||
}
|
||||
/** A chain of X.509 certificates. */
|
||||
export interface X509CertificateChain {
|
||||
/**
|
||||
* The chain of certificates, with indices 0 to n.
|
||||
* The first certificate in the array must be the leaf
|
||||
* certificate used for signing. Any intermediate certificates
|
||||
* must be stored as offset 1 to n-1, and the root certificate at
|
||||
* position n.
|
||||
*/
|
||||
certificates: X509Certificate[];
|
||||
}
|
||||
/**
|
||||
* The time range is half-open and does not include the end timestamp,
|
||||
* i.e [start, end).
|
||||
* End is optional to be able to capture a period that has started but
|
||||
* has no known end.
|
||||
*/
|
||||
export interface TimeRange {
|
||||
start: Date | undefined;
|
||||
end?: Date | undefined;
|
||||
}
|
||||
export declare const HashOutput: {
|
||||
fromJSON(object: any): HashOutput;
|
||||
toJSON(message: HashOutput): unknown;
|
||||
};
|
||||
export declare const MessageSignature: {
|
||||
fromJSON(object: any): MessageSignature;
|
||||
toJSON(message: MessageSignature): unknown;
|
||||
};
|
||||
export declare const LogId: {
|
||||
fromJSON(object: any): LogId;
|
||||
toJSON(message: LogId): unknown;
|
||||
};
|
||||
export declare const RFC3161SignedTimestamp: {
|
||||
fromJSON(object: any): RFC3161SignedTimestamp;
|
||||
toJSON(message: RFC3161SignedTimestamp): unknown;
|
||||
};
|
||||
export declare const PublicKey: {
|
||||
fromJSON(object: any): PublicKey;
|
||||
toJSON(message: PublicKey): unknown;
|
||||
};
|
||||
export declare const PublicKeyIdentifier: {
|
||||
fromJSON(object: any): PublicKeyIdentifier;
|
||||
toJSON(message: PublicKeyIdentifier): unknown;
|
||||
};
|
||||
export declare const ObjectIdentifier: {
|
||||
fromJSON(object: any): ObjectIdentifier;
|
||||
toJSON(message: ObjectIdentifier): unknown;
|
||||
};
|
||||
export declare const ObjectIdentifierValuePair: {
|
||||
fromJSON(object: any): ObjectIdentifierValuePair;
|
||||
toJSON(message: ObjectIdentifierValuePair): unknown;
|
||||
};
|
||||
export declare const DistinguishedName: {
|
||||
fromJSON(object: any): DistinguishedName;
|
||||
toJSON(message: DistinguishedName): unknown;
|
||||
};
|
||||
export declare const X509Certificate: {
|
||||
fromJSON(object: any): X509Certificate;
|
||||
toJSON(message: X509Certificate): unknown;
|
||||
};
|
||||
export declare const SubjectAlternativeName: {
|
||||
fromJSON(object: any): SubjectAlternativeName;
|
||||
toJSON(message: SubjectAlternativeName): unknown;
|
||||
};
|
||||
export declare const X509CertificateChain: {
|
||||
fromJSON(object: any): X509CertificateChain;
|
||||
toJSON(message: X509CertificateChain): unknown;
|
||||
};
|
||||
export declare const TimeRange: {
|
||||
fromJSON(object: any): TimeRange;
|
||||
toJSON(message: TimeRange): unknown;
|
||||
};
|
||||
Generated
Vendored
-136
@@ -1,136 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
import { LogId } from "./sigstore_common";
|
||||
/** KindVersion contains the entry's kind and api version. */
|
||||
export interface KindVersion {
|
||||
/**
|
||||
* Kind is the type of entry being stored in the log.
|
||||
* See here for a list: https://github.com/sigstore/rekor/tree/main/pkg/types
|
||||
*/
|
||||
kind: string;
|
||||
/** The specific api version of the type. */
|
||||
version: string;
|
||||
}
|
||||
/**
|
||||
* The checkpoint contains a signature of the tree head (root hash),
|
||||
* size of the tree, the transparency log's unique identifier (log ID),
|
||||
* hostname and the current time.
|
||||
* The result is a string, the format is described here
|
||||
* https://github.com/transparency-dev/formats/blob/main/log/README.md
|
||||
* The details are here https://github.com/sigstore/rekor/blob/a6e58f72b6b18cc06cefe61808efd562b9726330/pkg/util/signed_note.go#L114
|
||||
* The signature has the same format as
|
||||
* InclusionPromise.signed_entry_timestamp. See below for more details.
|
||||
*/
|
||||
export interface Checkpoint {
|
||||
envelope: string;
|
||||
}
|
||||
/**
|
||||
* InclusionProof is the proof returned from the transparency log. Can
|
||||
* be used for on line verification against the log.
|
||||
*/
|
||||
export interface InclusionProof {
|
||||
/** The index of the entry in the log. */
|
||||
logIndex: string;
|
||||
/**
|
||||
* The hash digest stored at the root of the merkle tree at the time
|
||||
* the proof was generated.
|
||||
*/
|
||||
rootHash: Buffer;
|
||||
/** The size of the merkle tree at the time the proof was generated. */
|
||||
treeSize: string;
|
||||
/**
|
||||
* A list of hashes required to compute the inclusion proof, sorted
|
||||
* in order from leaf to root.
|
||||
* Not that leaf and root hashes are not included.
|
||||
* The root has is available separately in this message, and the
|
||||
* leaf hash should be calculated by the client.
|
||||
*/
|
||||
hashes: Buffer[];
|
||||
/**
|
||||
* Signature of the tree head, as of the time of this proof was
|
||||
* generated. See above info on 'Checkpoint' for more details.
|
||||
*/
|
||||
checkpoint: Checkpoint | undefined;
|
||||
}
|
||||
/**
|
||||
* The inclusion promise is calculated by Rekor. It's calculated as a
|
||||
* signature over a canonical JSON serialization of the persisted entry, the
|
||||
* log ID, log index and the integration timestamp.
|
||||
* See https://github.com/sigstore/rekor/blob/a6e58f72b6b18cc06cefe61808efd562b9726330/pkg/api/entries.go#L54
|
||||
* The format of the signature depends on the transparency log's public key.
|
||||
* If the signature algorithm requires a hash function and/or a signature
|
||||
* scheme (e.g. RSA) those has to be retrieved out-of-band from the log's
|
||||
* operators, together with the public key.
|
||||
* This is used to verify the integration timestamp's value and that the log
|
||||
* has promised to include the entry.
|
||||
*/
|
||||
export interface InclusionPromise {
|
||||
signedEntryTimestamp: Buffer;
|
||||
}
|
||||
/**
|
||||
* TransparencyLogEntry captures all the details required from Rekor to
|
||||
* reconstruct an entry, given that the payload is provided via other means.
|
||||
* This type can easily be created from the existing response from Rekor.
|
||||
* Future iterations could rely on Rekor returning the minimal set of
|
||||
* attributes (excluding the payload) that are required for verifying the
|
||||
* inclusion promise. The inclusion promise (called SignedEntryTimestamp in
|
||||
* the response from Rekor) is similar to a Signed Certificate Timestamp
|
||||
* as described here https://www.rfc-editor.org/rfc/rfc9162#name-signed-certificate-timestam.
|
||||
*/
|
||||
export interface TransparencyLogEntry {
|
||||
/** The index of the entry in the log. */
|
||||
logIndex: string;
|
||||
/** The unique identifier of the log. */
|
||||
logId: LogId | undefined;
|
||||
/**
|
||||
* The kind (type) and version of the object associated with this
|
||||
* entry. These values are required to construct the entry during
|
||||
* verification.
|
||||
*/
|
||||
kindVersion: KindVersion | undefined;
|
||||
/** The UNIX timestamp from the log when the entry was persisted. */
|
||||
integratedTime: string;
|
||||
/** The inclusion promise/signed entry timestamp from the log. */
|
||||
inclusionPromise: InclusionPromise | undefined;
|
||||
/**
|
||||
* The inclusion proof can be used for online verification that the
|
||||
* entry was appended to the log, and that the log has not been
|
||||
* altered.
|
||||
*/
|
||||
inclusionProof: InclusionProof | undefined;
|
||||
/**
|
||||
* The canonicalized transparency log entry, used to reconstruct
|
||||
* the Signed Entry Timestamp (SET) during verification.
|
||||
* The contents of this field are the same as the `body` field in
|
||||
* a Rekor response, meaning that it does **not** include the "full"
|
||||
* canonicalized form (of log index, ID, etc.) which are
|
||||
* exposed as separate fields. The verifier is responsible for
|
||||
* combining the `canonicalized_body`, `log_index`, `log_id`,
|
||||
* and `integrated_time` into the payload that the SET's signature
|
||||
* is generated over.
|
||||
*
|
||||
* Clients MUST verify that the signatured referenced in the
|
||||
* `canonicalized_body` matches the signature provided in the
|
||||
* `Bundle.content`.
|
||||
*/
|
||||
canonicalizedBody: Buffer;
|
||||
}
|
||||
export declare const KindVersion: {
|
||||
fromJSON(object: any): KindVersion;
|
||||
toJSON(message: KindVersion): unknown;
|
||||
};
|
||||
export declare const Checkpoint: {
|
||||
fromJSON(object: any): Checkpoint;
|
||||
toJSON(message: Checkpoint): unknown;
|
||||
};
|
||||
export declare const InclusionProof: {
|
||||
fromJSON(object: any): InclusionProof;
|
||||
toJSON(message: InclusionProof): unknown;
|
||||
};
|
||||
export declare const InclusionPromise: {
|
||||
fromJSON(object: any): InclusionPromise;
|
||||
toJSON(message: InclusionPromise): unknown;
|
||||
};
|
||||
export declare const TransparencyLogEntry: {
|
||||
fromJSON(object: any): TransparencyLogEntry;
|
||||
toJSON(message: TransparencyLogEntry): unknown;
|
||||
};
|
||||
Generated
Vendored
-89
@@ -1,89 +0,0 @@
|
||||
import { DistinguishedName, HashAlgorithm, LogId, PublicKey, TimeRange, X509CertificateChain } from "./sigstore_common";
|
||||
/**
|
||||
* TransparencyLogInstance describes the immutable parameters from a
|
||||
* transparency log.
|
||||
* See https://www.rfc-editor.org/rfc/rfc9162.html#name-log-parameters
|
||||
* for more details.
|
||||
* The incluced parameters are the minimal set required to identify a log,
|
||||
* and verify an inclusion promise.
|
||||
*/
|
||||
export interface TransparencyLogInstance {
|
||||
/** The base URL at which can be used to URLs for the client. */
|
||||
baseUrl: string;
|
||||
/** The hash algorithm used for the Merkle Tree. */
|
||||
hashAlgorithm: HashAlgorithm;
|
||||
/**
|
||||
* The public key used to verify signatures generated by the log.
|
||||
* This attribute contains the signature algorithm used by the log.
|
||||
*/
|
||||
publicKey: PublicKey | undefined;
|
||||
/** The unique identifier for this transparency log. */
|
||||
logId: LogId | undefined;
|
||||
}
|
||||
/**
|
||||
* CertificateAuthority enlists the information required to identify which
|
||||
* CA to use and perform signature verification.
|
||||
*/
|
||||
export interface CertificateAuthority {
|
||||
/**
|
||||
* The root certificate MUST be self-signed, and so the subject and
|
||||
* issuer are the same.
|
||||
*/
|
||||
subject: DistinguishedName | undefined;
|
||||
/** The URI at which the CA can be accessed. */
|
||||
uri: string;
|
||||
/** The certificate chain for this CA. */
|
||||
certChain: X509CertificateChain | undefined;
|
||||
/**
|
||||
* The time the *entire* chain was valid. This is at max the
|
||||
* longest interval when *all* certificates in the chain were valid,
|
||||
* but it MAY be shorter.
|
||||
*/
|
||||
validFor: TimeRange | undefined;
|
||||
}
|
||||
/**
|
||||
* TrustedRoot describes the client's complete set of trusted entities.
|
||||
* How the TrustedRoot is populated is not specified, but can be a
|
||||
* combination of many sources such as TUF repositories, files on disk etc.
|
||||
*
|
||||
* The TrustedRoot is not meant to be used for any artifact verification, only
|
||||
* to capture the complete/global set of trusted verification materials.
|
||||
* When verifying an artifact, based on the artifact and policies, a selection
|
||||
* of keys/authorities are expected to be extracted and provided to the
|
||||
* verification function. This way the set of keys/authorities kan be kept to
|
||||
* a minimal set by the policy to gain better control over what signatures
|
||||
* that are allowed.
|
||||
*/
|
||||
export interface TrustedRoot {
|
||||
/** MUST be application/vnd.dev.sigstore.trustedroot+json;version=0.1 */
|
||||
mediaType: string;
|
||||
/** A set of trusted Rekor servers. */
|
||||
tlogs: TransparencyLogInstance[];
|
||||
/**
|
||||
* A set of trusted certificate authorites (e.g Fulcio), and any
|
||||
* intermediate certificates they provide.
|
||||
* If a CA is issuing multiple intermediate certificate, each
|
||||
* combination shall be represented as separate chain. I.e, a single
|
||||
* root cert may appear in multiple chains but with different
|
||||
* intermediate and/or leaf certificates.
|
||||
* The certificates are intended to be used for verifying artifact
|
||||
* signatures.
|
||||
*/
|
||||
certificateAuthorities: CertificateAuthority[];
|
||||
/** A set of trusted certificate transparency logs. */
|
||||
ctlogs: TransparencyLogInstance[];
|
||||
/** A set of trusted timestamping authorities. */
|
||||
timestampAuthorities: CertificateAuthority[];
|
||||
}
|
||||
export declare const TransparencyLogInstance: {
|
||||
fromJSON(object: any): TransparencyLogInstance;
|
||||
toJSON(message: TransparencyLogInstance): unknown;
|
||||
};
|
||||
export declare const CertificateAuthority: {
|
||||
fromJSON(object: any): CertificateAuthority;
|
||||
toJSON(message: CertificateAuthority): unknown;
|
||||
};
|
||||
export declare const TrustedRoot: {
|
||||
fromJSON(object: any): TrustedRoot;
|
||||
toJSON(message: TrustedRoot): unknown;
|
||||
};
|
||||
Generated
Vendored
-156
@@ -1,156 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
import { Bundle } from "./sigstore_bundle";
|
||||
import { ObjectIdentifierValuePair, PublicKey, SubjectAlternativeName } from "./sigstore_common";
|
||||
import { TrustedRoot } from "./sigstore_trustroot";
|
||||
/** The identity of a X.509 Certificate signer. */
|
||||
export interface CertificateIdentity {
|
||||
/** The X.509v3 issuer extension (OID 1.3.6.1.4.1.57264.1.1) */
|
||||
issuer: string;
|
||||
san: SubjectAlternativeName | undefined;
|
||||
/**
|
||||
* An unordered list of OIDs that must be verified.
|
||||
* All OID/values provided in this list MUST exactly match against
|
||||
* the values in the certificate for verification to be successful.
|
||||
*/
|
||||
oids: ObjectIdentifierValuePair[];
|
||||
}
|
||||
export interface CertificateIdentities {
|
||||
identities: CertificateIdentity[];
|
||||
}
|
||||
export interface PublicKeyIdentities {
|
||||
publicKeys: PublicKey[];
|
||||
}
|
||||
/**
|
||||
* A light-weight set of options/policies for identifying trusted signers,
|
||||
* used during verification of a single artifact.
|
||||
*/
|
||||
export interface ArtifactVerificationOptions {
|
||||
signers?: {
|
||||
$case: "certificateIdentities";
|
||||
certificateIdentities: CertificateIdentities;
|
||||
} | {
|
||||
$case: "publicKeys";
|
||||
publicKeys: PublicKeyIdentities;
|
||||
};
|
||||
/**
|
||||
* Optional options for artifact transparency log verification.
|
||||
* If none is provided, the default verification options are:
|
||||
* Threshold: 1
|
||||
* Online verification: false
|
||||
* Disable: false
|
||||
*/
|
||||
tlogOptions?: ArtifactVerificationOptions_TlogOptions | undefined;
|
||||
/**
|
||||
* Optional options for certificate transparency log verification.
|
||||
* If none is provided, the default verification options are:
|
||||
* Threshold: 1
|
||||
* Detached SCT: false
|
||||
* Disable: false
|
||||
*/
|
||||
ctlogOptions?: ArtifactVerificationOptions_CtlogOptions | undefined;
|
||||
/**
|
||||
* Optional options for certificate signed timestamp verification.
|
||||
* If none is provided, the default verification options are:
|
||||
* Threshold: 1
|
||||
* Disable: false
|
||||
*/
|
||||
tsaOptions?: ArtifactVerificationOptions_TimestampAuthorityOptions | undefined;
|
||||
}
|
||||
export interface ArtifactVerificationOptions_TlogOptions {
|
||||
/** Number of transparency logs the entry must appear on. */
|
||||
threshold: number;
|
||||
/** Perform an online inclusion proof. */
|
||||
performOnlineVerification: boolean;
|
||||
/** Disable verification for transparency logs. */
|
||||
disable: boolean;
|
||||
}
|
||||
export interface ArtifactVerificationOptions_CtlogOptions {
|
||||
/**
|
||||
* The number of ct transparency logs the certificate must
|
||||
* appear on.
|
||||
*/
|
||||
threshold: number;
|
||||
/**
|
||||
* Expect detached SCTs.
|
||||
* This is not supported right now as we can't capture an
|
||||
* detached SCT in the bundle.
|
||||
*/
|
||||
detachedSct: boolean;
|
||||
/** Disable ct transparency log verification */
|
||||
disable: boolean;
|
||||
}
|
||||
export interface ArtifactVerificationOptions_TimestampAuthorityOptions {
|
||||
/** The number of signed timestamps that are expected. */
|
||||
threshold: number;
|
||||
/** Disable signed timestamp verification. */
|
||||
disable: boolean;
|
||||
}
|
||||
export interface Artifact {
|
||||
data?: {
|
||||
$case: "artifactUri";
|
||||
artifactUri: string;
|
||||
} | {
|
||||
$case: "artifact";
|
||||
artifact: Buffer;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Input captures all that is needed to call the bundle verification method,
|
||||
* to verify a single artifact referenced by the bundle.
|
||||
*/
|
||||
export interface Input {
|
||||
/**
|
||||
* The verification materials provided during a bundle verification.
|
||||
* The running process is usually preloaded with a "global"
|
||||
* dev.sisgtore.trustroot.TrustedRoot.v1 instance. Prior to
|
||||
* verifying an artifact (i.e a bundle), and/or based on current
|
||||
* policy, some selection is expected to happen, to filter out the
|
||||
* exact certificate authority to use, which transparency logs are
|
||||
* relevant etc. The result should b ecaptured in the
|
||||
* `artifact_trust_root`.
|
||||
*/
|
||||
artifactTrustRoot: TrustedRoot | undefined;
|
||||
artifactVerificationOptions: ArtifactVerificationOptions | undefined;
|
||||
bundle: Bundle | undefined;
|
||||
/**
|
||||
* If the bundle contains a message signature, the artifact must be
|
||||
* provided.
|
||||
*/
|
||||
artifact?: Artifact | undefined;
|
||||
}
|
||||
export declare const CertificateIdentity: {
|
||||
fromJSON(object: any): CertificateIdentity;
|
||||
toJSON(message: CertificateIdentity): unknown;
|
||||
};
|
||||
export declare const CertificateIdentities: {
|
||||
fromJSON(object: any): CertificateIdentities;
|
||||
toJSON(message: CertificateIdentities): unknown;
|
||||
};
|
||||
export declare const PublicKeyIdentities: {
|
||||
fromJSON(object: any): PublicKeyIdentities;
|
||||
toJSON(message: PublicKeyIdentities): unknown;
|
||||
};
|
||||
export declare const ArtifactVerificationOptions: {
|
||||
fromJSON(object: any): ArtifactVerificationOptions;
|
||||
toJSON(message: ArtifactVerificationOptions): unknown;
|
||||
};
|
||||
export declare const ArtifactVerificationOptions_TlogOptions: {
|
||||
fromJSON(object: any): ArtifactVerificationOptions_TlogOptions;
|
||||
toJSON(message: ArtifactVerificationOptions_TlogOptions): unknown;
|
||||
};
|
||||
export declare const ArtifactVerificationOptions_CtlogOptions: {
|
||||
fromJSON(object: any): ArtifactVerificationOptions_CtlogOptions;
|
||||
toJSON(message: ArtifactVerificationOptions_CtlogOptions): unknown;
|
||||
};
|
||||
export declare const ArtifactVerificationOptions_TimestampAuthorityOptions: {
|
||||
fromJSON(object: any): ArtifactVerificationOptions_TimestampAuthorityOptions;
|
||||
toJSON(message: ArtifactVerificationOptions_TimestampAuthorityOptions): unknown;
|
||||
};
|
||||
export declare const Artifact: {
|
||||
fromJSON(object: any): Artifact;
|
||||
toJSON(message: Artifact): unknown;
|
||||
};
|
||||
export declare const Input: {
|
||||
fromJSON(object: any): Input;
|
||||
toJSON(message: Input): unknown;
|
||||
};
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
export * from './__generated__/envelope';
|
||||
export * from './__generated__/sigstore_bundle';
|
||||
export * from './__generated__/sigstore_common';
|
||||
export * from './__generated__/sigstore_rekor';
|
||||
export * from './__generated__/sigstore_trustroot';
|
||||
export * from './__generated__/sigstore_verification';
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
import { EventEmitter } from 'events';
|
||||
import { EventNames, EventListenerParameters, AbortSignal } from './types';
|
||||
export interface OnceOptions {
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
export default function once<Emitter extends EventEmitter, Event extends EventNames<Emitter>>(emitter: Emitter, name: Event, { signal }?: OnceOptions): Promise<EventListenerParameters<Emitter, Event>>;
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAOA,SAAwB,IAAI,CAI3B,OAAgB,EAChB,IAAW,EACX,EAAE,MAAM,KAAkB,EAAE;IAE5B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,SAAS,OAAO;YACf,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC9C,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACtC,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC1C,CAAC;QACD,SAAS,OAAO,CAAC,GAAG,IAAW;YAC9B,OAAO,EAAE,CAAC;YACV,OAAO,CAAC,IAA+C,CAAC,CAAC;QAC1D,CAAC;QACD,SAAS,OAAO,CAAC,GAAU;YAC1B,OAAO,EAAE,CAAC;YACV,MAAM,CAAC,GAAG,CAAC,CAAC;QACb,CAAC;QACD,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACJ,CAAC;AA1BD,uBA0BC"}
|
||||
-231
@@ -1,231 +0,0 @@
|
||||
export declare type OverloadedParameters<T> = T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
(...args: infer A13): any;
|
||||
(...args: infer A14): any;
|
||||
(...args: infer A15): any;
|
||||
(...args: infer A16): any;
|
||||
(...args: infer A17): any;
|
||||
(...args: infer A18): any;
|
||||
(...args: infer A19): any;
|
||||
(...args: infer A20): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 | A17 | A18 | A19 | A20 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
(...args: infer A13): any;
|
||||
(...args: infer A14): any;
|
||||
(...args: infer A15): any;
|
||||
(...args: infer A16): any;
|
||||
(...args: infer A17): any;
|
||||
(...args: infer A18): any;
|
||||
(...args: infer A19): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 | A17 | A18 | A19 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
(...args: infer A13): any;
|
||||
(...args: infer A14): any;
|
||||
(...args: infer A15): any;
|
||||
(...args: infer A16): any;
|
||||
(...args: infer A17): any;
|
||||
(...args: infer A18): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 | A17 | A18 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
(...args: infer A13): any;
|
||||
(...args: infer A14): any;
|
||||
(...args: infer A15): any;
|
||||
(...args: infer A16): any;
|
||||
(...args: infer A17): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 | A17 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
(...args: infer A13): any;
|
||||
(...args: infer A14): any;
|
||||
(...args: infer A15): any;
|
||||
(...args: infer A16): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
(...args: infer A13): any;
|
||||
(...args: infer A14): any;
|
||||
(...args: infer A15): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
(...args: infer A13): any;
|
||||
(...args: infer A14): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
(...args: infer A13): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
} ? A1 | A2 | A3 | A4 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
} ? A1 | A2 | A3 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
} ? A1 | A2 : T extends {
|
||||
(...args: infer A1): any;
|
||||
} ? A1 : any;
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"overloaded-parameters.js","sourceRoot":"","sources":["../src/overloaded-parameters.ts"],"names":[],"mappings":""}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
import { EventEmitter } from 'events';
|
||||
import { OverloadedParameters } from './overloaded-parameters';
|
||||
export declare type FirstParameter<T> = T extends [infer R, ...any[]] ? R : never;
|
||||
export declare type EventListener<F, T extends string | symbol> = F extends [
|
||||
T,
|
||||
infer R,
|
||||
...any[]
|
||||
] ? R : never;
|
||||
export declare type EventParameters<Emitter extends EventEmitter> = OverloadedParameters<Emitter['on']>;
|
||||
export declare type EventNames<Emitter extends EventEmitter> = FirstParameter<EventParameters<Emitter>>;
|
||||
export declare type EventListenerParameters<Emitter extends EventEmitter, Event extends EventNames<Emitter>> = WithDefault<Parameters<EventListener<EventParameters<Emitter>, Event>>, unknown[]>;
|
||||
export declare type WithDefault<T, D> = [T] extends [never] ? D : T;
|
||||
export interface AbortSignal {
|
||||
addEventListener: (name: string, listener: (...args: any[]) => any) => void;
|
||||
removeEventListener: (name: string, listener: (...args: any[]) => any) => void;
|
||||
}
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
import { Signature } from './signature';
|
||||
import { JSONObject, JSONValue } from './utils';
|
||||
export interface Signable {
|
||||
signatures: Record<string, Signature>;
|
||||
signed: Signed;
|
||||
}
|
||||
export interface SignedOptions {
|
||||
version?: number;
|
||||
specVersion?: string;
|
||||
expires?: string;
|
||||
unrecognizedFields?: Record<string, JSONValue>;
|
||||
}
|
||||
export declare enum MetadataKind {
|
||||
Root = "root",
|
||||
Timestamp = "timestamp",
|
||||
Snapshot = "snapshot",
|
||||
Targets = "targets"
|
||||
}
|
||||
export declare function isMetadataKind(value: unknown): value is MetadataKind;
|
||||
/***
|
||||
* A base class for the signed part of TUF metadata.
|
||||
*
|
||||
* Objects with base class Signed are usually included in a ``Metadata`` object
|
||||
* on the signed attribute. This class provides attributes and methods that
|
||||
* are common for all TUF metadata types (roles).
|
||||
*/
|
||||
export declare abstract class Signed {
|
||||
readonly specVersion: string;
|
||||
readonly expires: string;
|
||||
readonly version: number;
|
||||
readonly unrecognizedFields: Record<string, JSONValue>;
|
||||
constructor(options: SignedOptions);
|
||||
equals(other: Signed): boolean;
|
||||
isExpired(referenceTime?: Date): boolean;
|
||||
static commonFieldsFromJSON(data: JSONObject): SignedOptions;
|
||||
abstract toJSON(): JSONObject;
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
import { Key } from './key';
|
||||
import { DelegatedRole, SuccinctRoles } from './role';
|
||||
import { JSONObject, JSONValue } from './utils';
|
||||
type DelegatedRoleMap = Record<string, DelegatedRole>;
|
||||
type KeyMap = Record<string, Key>;
|
||||
interface DelegationsOptions {
|
||||
keys: KeyMap;
|
||||
roles?: DelegatedRoleMap;
|
||||
succinctRoles?: SuccinctRoles;
|
||||
unrecognizedFields?: Record<string, JSONValue>;
|
||||
}
|
||||
/**
|
||||
* A container object storing information about all delegations.
|
||||
*
|
||||
* Targets roles that are trusted to provide signed metadata files
|
||||
* describing targets with designated pathnames and/or further delegations.
|
||||
*/
|
||||
export declare class Delegations {
|
||||
readonly keys: KeyMap;
|
||||
readonly roles?: DelegatedRoleMap;
|
||||
readonly unrecognizedFields?: Record<string, JSONValue>;
|
||||
readonly succinctRoles?: SuccinctRoles;
|
||||
constructor(options: DelegationsOptions);
|
||||
equals(other: Delegations): boolean;
|
||||
rolesForTarget(targetPath: string): Generator<{
|
||||
role: string;
|
||||
terminating: boolean;
|
||||
}>;
|
||||
toJSON(): JSONObject;
|
||||
static fromJSON(data: JSONObject): Delegations;
|
||||
}
|
||||
export {};
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
export declare class ValueError extends Error {
|
||||
}
|
||||
export declare class RepositoryError extends Error {
|
||||
}
|
||||
export declare class UnsignedMetadataError extends RepositoryError {
|
||||
}
|
||||
export declare class LengthOrHashMismatchError extends RepositoryError {
|
||||
}
|
||||
export declare class CryptoError extends Error {
|
||||
}
|
||||
export declare class UnsupportedAlgorithmError extends CryptoError {
|
||||
}
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import { Readable } from 'stream';
|
||||
import { JSONObject, JSONValue } from './utils';
|
||||
interface MetaFileOptions {
|
||||
version: number;
|
||||
length?: number;
|
||||
hashes?: Record<string, string>;
|
||||
unrecognizedFields?: Record<string, JSONValue>;
|
||||
}
|
||||
export declare class MetaFile {
|
||||
readonly version: number;
|
||||
readonly length?: number;
|
||||
readonly hashes?: Record<string, string>;
|
||||
readonly unrecognizedFields?: Record<string, JSONValue>;
|
||||
constructor(opts: MetaFileOptions);
|
||||
equals(other: MetaFile): boolean;
|
||||
verify(data: Buffer): void;
|
||||
toJSON(): JSONObject;
|
||||
static fromJSON(data: JSONObject): MetaFile;
|
||||
}
|
||||
interface TargetFileOptions {
|
||||
length: number;
|
||||
path: string;
|
||||
hashes: Record<string, string>;
|
||||
unrecognizedFields?: Record<string, JSONValue>;
|
||||
}
|
||||
export declare class TargetFile {
|
||||
readonly length: number;
|
||||
readonly path: string;
|
||||
readonly hashes: Record<string, string>;
|
||||
readonly unrecognizedFields: Record<string, JSONValue>;
|
||||
constructor(opts: TargetFileOptions);
|
||||
get custom(): Record<string, unknown>;
|
||||
equals(other: TargetFile): boolean;
|
||||
verify(stream: Readable): Promise<void>;
|
||||
toJSON(): JSONObject;
|
||||
static fromJSON(path: string, data: JSONObject): TargetFile;
|
||||
}
|
||||
export {};
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
export { MetadataKind } from './base';
|
||||
export { ValueError } from './error';
|
||||
export { MetaFile, TargetFile } from './file';
|
||||
export { Key } from './key';
|
||||
export { Metadata } from './metadata';
|
||||
export { Root } from './root';
|
||||
export { Signature } from './signature';
|
||||
export { Snapshot } from './snapshot';
|
||||
export { Targets } from './targets';
|
||||
export { Timestamp } from './timestamp';
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
import { Signable } from './base';
|
||||
import { JSONObject, JSONValue } from './utils';
|
||||
export interface KeyOptions {
|
||||
keyID: string;
|
||||
keyType: string;
|
||||
scheme: string;
|
||||
keyVal: Record<string, string>;
|
||||
unrecognizedFields?: Record<string, JSONValue>;
|
||||
}
|
||||
export declare class Key {
|
||||
readonly keyID: string;
|
||||
readonly keyType: string;
|
||||
readonly scheme: string;
|
||||
readonly keyVal: Record<string, string>;
|
||||
readonly unrecognizedFields?: Record<string, JSONValue>;
|
||||
constructor(options: KeyOptions);
|
||||
verifySignature(metadata: Signable): void;
|
||||
equals(other: Key): boolean;
|
||||
toJSON(): JSONObject;
|
||||
static fromJSON(keyID: string, data: JSONObject): Key;
|
||||
}
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
import { MetadataKind, Signable } from './base';
|
||||
import { Root } from './root';
|
||||
import { Signature } from './signature';
|
||||
import { Snapshot } from './snapshot';
|
||||
import { Targets } from './targets';
|
||||
import { Timestamp } from './timestamp';
|
||||
import { JSONObject, JSONValue } from './utils';
|
||||
type MetadataType = Root | Timestamp | Snapshot | Targets;
|
||||
/***
|
||||
* A container for signed TUF metadata.
|
||||
*
|
||||
* Provides methods to convert to and from json, read and write to and
|
||||
* from JSON and to create and verify metadata signatures.
|
||||
*
|
||||
* ``Metadata[T]`` is a generic container type where T can be any one type of
|
||||
* [``Root``, ``Timestamp``, ``Snapshot``, ``Targets``]. The purpose of this
|
||||
* is to allow static type checking of the signed attribute in code using
|
||||
* Metadata::
|
||||
*
|
||||
* root_md = Metadata[Root].fromJSON("root.json")
|
||||
* # root_md type is now Metadata[Root]. This means signed and its
|
||||
* # attributes like consistent_snapshot are now statically typed and the
|
||||
* # types can be verified by static type checkers and shown by IDEs
|
||||
*
|
||||
* Using a type constraint is not required but not doing so means T is not a
|
||||
* specific type so static typing cannot happen. Note that the type constraint
|
||||
* ``[Root]`` is not validated at runtime (as pure annotations are not available
|
||||
* then).
|
||||
*
|
||||
* Apart from ``expires`` all of the arguments to the inner constructors have
|
||||
* reasonable default values for new metadata.
|
||||
*/
|
||||
export declare class Metadata<T extends MetadataType> implements Signable {
|
||||
signed: T;
|
||||
signatures: Record<string, Signature>;
|
||||
unrecognizedFields: Record<string, JSONValue>;
|
||||
constructor(signed: T, signatures?: Record<string, Signature>, unrecognizedFields?: Record<string, JSONValue>);
|
||||
sign(signer: (data: Buffer) => Signature, append?: boolean): void;
|
||||
verifyDelegate(delegatedRole: string, delegatedMetadata: Metadata<MetadataType>): void;
|
||||
equals(other: T): boolean;
|
||||
toJSON(): JSONObject;
|
||||
static fromJSON(type: MetadataKind.Root, data: JSONObject): Metadata<Root>;
|
||||
static fromJSON(type: MetadataKind.Timestamp, data: JSONObject): Metadata<Timestamp>;
|
||||
static fromJSON(type: MetadataKind.Snapshot, data: JSONObject): Metadata<Snapshot>;
|
||||
static fromJSON(type: MetadataKind.Targets, data: JSONObject): Metadata<Targets>;
|
||||
}
|
||||
export {};
|
||||
-103
@@ -1,103 +0,0 @@
|
||||
import { JSONObject, JSONValue } from './utils';
|
||||
export declare const TOP_LEVEL_ROLE_NAMES: string[];
|
||||
export interface RoleOptions {
|
||||
keyIDs: string[];
|
||||
threshold: number;
|
||||
unrecognizedFields?: Record<string, JSONValue>;
|
||||
}
|
||||
/**
|
||||
* Container that defines which keys are required to sign roles metadata.
|
||||
*
|
||||
* Role defines how many keys are required to successfully sign the roles
|
||||
* metadata, and which keys are accepted.
|
||||
*/
|
||||
export declare class Role {
|
||||
readonly keyIDs: string[];
|
||||
readonly threshold: number;
|
||||
readonly unrecognizedFields?: Record<string, JSONValue>;
|
||||
constructor(options: RoleOptions);
|
||||
equals(other: Role): boolean;
|
||||
toJSON(): JSONObject;
|
||||
static fromJSON(data: JSONObject): Role;
|
||||
}
|
||||
interface DelegatedRoleOptions extends RoleOptions {
|
||||
name: string;
|
||||
terminating: boolean;
|
||||
paths?: string[];
|
||||
pathHashPrefixes?: string[];
|
||||
}
|
||||
/**
|
||||
* A container with information about a delegated role.
|
||||
*
|
||||
* A delegation can happen in two ways:
|
||||
* - ``paths`` is set: delegates targets matching any path pattern in ``paths``
|
||||
* - ``pathHashPrefixes`` is set: delegates targets whose target path hash
|
||||
* starts with any of the prefixes in ``pathHashPrefixes``
|
||||
*
|
||||
* ``paths`` and ``pathHashPrefixes`` are mutually exclusive: both cannot be
|
||||
* set, at least one of them must be set.
|
||||
*/
|
||||
export declare class DelegatedRole extends Role {
|
||||
readonly name: string;
|
||||
readonly terminating: boolean;
|
||||
readonly paths?: string[];
|
||||
readonly pathHashPrefixes?: string[];
|
||||
constructor(opts: DelegatedRoleOptions);
|
||||
equals(other: DelegatedRole): boolean;
|
||||
isDelegatedPath(targetFilepath: string): boolean;
|
||||
toJSON(): JSONObject;
|
||||
static fromJSON(data: JSONObject): DelegatedRole;
|
||||
}
|
||||
interface SuccinctRolesOption extends RoleOptions {
|
||||
bitLength: number;
|
||||
namePrefix: string;
|
||||
}
|
||||
/**
|
||||
* Succinctly defines a hash bin delegation graph.
|
||||
*
|
||||
* A ``SuccinctRoles`` object describes a delegation graph that covers all
|
||||
* targets, distributing them uniformly over the delegated roles (i.e. bins)
|
||||
* in the graph.
|
||||
*
|
||||
* The total number of bins is 2 to the power of the passed ``bit_length``.
|
||||
*
|
||||
* Bin names are the concatenation of the passed ``name_prefix`` and a
|
||||
* zero-padded hex representation of the bin index separated by a hyphen.
|
||||
*
|
||||
* The passed ``keyids`` and ``threshold`` is used for each bin, and each bin
|
||||
* is 'terminating'.
|
||||
*
|
||||
* For details: https://github.com/theupdateframework/taps/blob/master/tap15.md
|
||||
*/
|
||||
export declare class SuccinctRoles extends Role {
|
||||
readonly bitLength: number;
|
||||
readonly namePrefix: string;
|
||||
readonly numberOfBins: number;
|
||||
readonly suffixLen: number;
|
||||
constructor(opts: SuccinctRolesOption);
|
||||
equals(other: SuccinctRoles): boolean;
|
||||
/***
|
||||
* Calculates the name of the delegated role responsible for 'target_filepath'.
|
||||
*
|
||||
* The target at path ''target_filepath' is assigned to a bin by casting
|
||||
* the left-most 'bit_length' of bits of the file path hash digest to
|
||||
* int, using it as bin index between 0 and '2**bit_length - 1'.
|
||||
*
|
||||
* Args:
|
||||
* target_filepath: URL path to a target file, relative to a base
|
||||
* targets URL.
|
||||
*/
|
||||
getRoleForTarget(targetFilepath: string): string;
|
||||
getRoles(): Generator<string>;
|
||||
/***
|
||||
* Determines whether the given ``role_name`` is in one of
|
||||
* the delegated roles that ``SuccinctRoles`` represents.
|
||||
*
|
||||
* Args:
|
||||
* role_name: The name of the role to check against.
|
||||
*/
|
||||
isDelegatedRole(roleName: string): boolean;
|
||||
toJSON(): JSONObject;
|
||||
static fromJSON(data: JSONObject): SuccinctRoles;
|
||||
}
|
||||
export {};
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
import { MetadataKind, Signed, SignedOptions } from './base';
|
||||
import { Key } from './key';
|
||||
import { Role } from './role';
|
||||
import { JSONObject } from './utils';
|
||||
type KeyMap = Record<string, Key>;
|
||||
type RoleMap = Record<string, Role>;
|
||||
export interface RootOptions extends SignedOptions {
|
||||
keys?: Record<string, Key>;
|
||||
roles?: Record<string, Role>;
|
||||
consistentSnapshot?: boolean;
|
||||
}
|
||||
/**
|
||||
* A container for the signed part of root metadata.
|
||||
*
|
||||
* The top-level role and metadata file signed by the root keys.
|
||||
* This role specifies trusted keys for all other top-level roles, which may further delegate trust.
|
||||
*/
|
||||
export declare class Root extends Signed {
|
||||
readonly type = MetadataKind.Root;
|
||||
readonly keys: KeyMap;
|
||||
readonly roles: RoleMap;
|
||||
readonly consistentSnapshot: boolean;
|
||||
constructor(options: RootOptions);
|
||||
addKey(key: Key, role: string): void;
|
||||
equals(other: Root): boolean;
|
||||
toJSON(): JSONObject;
|
||||
static fromJSON(data: JSONObject): Root;
|
||||
}
|
||||
export {};
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
import { JSONObject } from './utils';
|
||||
export interface SignatureOptions {
|
||||
keyID: string;
|
||||
sig: string;
|
||||
}
|
||||
/**
|
||||
* A container class containing information about a signature.
|
||||
*
|
||||
* Contains a signature and the keyid uniquely identifying the key used
|
||||
* to generate the signature.
|
||||
*
|
||||
* Provide a `fromJSON` method to create a Signature from a JSON object.
|
||||
*/
|
||||
export declare class Signature {
|
||||
readonly keyID: string;
|
||||
readonly sig: string;
|
||||
constructor(options: SignatureOptions);
|
||||
toJSON(): JSONObject;
|
||||
static fromJSON(data: JSONObject): Signature;
|
||||
}
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
import { MetadataKind, Signed, SignedOptions } from './base';
|
||||
import { MetaFile } from './file';
|
||||
import { JSONObject } from './utils';
|
||||
type MetaFileMap = Record<string, MetaFile>;
|
||||
export interface SnapshotOptions extends SignedOptions {
|
||||
meta?: MetaFileMap;
|
||||
}
|
||||
/**
|
||||
* A container for the signed part of snapshot metadata.
|
||||
*
|
||||
* Snapshot contains information about all target Metadata files.
|
||||
* A top-level role that specifies the latest versions of all targets metadata files,
|
||||
* and hence the latest versions of all targets (including any dependencies between them) on the repository.
|
||||
*/
|
||||
export declare class Snapshot extends Signed {
|
||||
readonly type = MetadataKind.Snapshot;
|
||||
readonly meta: MetaFileMap;
|
||||
constructor(opts: SnapshotOptions);
|
||||
equals(other: Snapshot): boolean;
|
||||
toJSON(): JSONObject;
|
||||
static fromJSON(data: JSONObject): Snapshot;
|
||||
}
|
||||
export {};
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
import { MetadataKind, Signed, SignedOptions } from './base';
|
||||
import { Delegations } from './delegations';
|
||||
import { TargetFile } from './file';
|
||||
import { JSONObject } from './utils';
|
||||
type TargetFileMap = Record<string, TargetFile>;
|
||||
interface TargetsOptions extends SignedOptions {
|
||||
targets?: TargetFileMap;
|
||||
delegations?: Delegations;
|
||||
}
|
||||
export declare class Targets extends Signed {
|
||||
readonly type = MetadataKind.Targets;
|
||||
readonly targets: TargetFileMap;
|
||||
readonly delegations?: Delegations;
|
||||
constructor(options: TargetsOptions);
|
||||
addTarget(target: TargetFile): void;
|
||||
equals(other: Targets): boolean;
|
||||
toJSON(): JSONObject;
|
||||
static fromJSON(data: JSONObject): Targets;
|
||||
}
|
||||
export {};
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
import { MetadataKind, Signed, SignedOptions } from './base';
|
||||
import { MetaFile } from './file';
|
||||
import { JSONObject } from './utils';
|
||||
interface TimestampOptions extends SignedOptions {
|
||||
snapshotMeta?: MetaFile;
|
||||
}
|
||||
/**
|
||||
* A container for the signed part of timestamp metadata.
|
||||
*
|
||||
* A top-level that specifies the latest version of the snapshot role metadata file,
|
||||
* and hence the latest versions of all metadata and targets on the repository.
|
||||
*/
|
||||
export declare class Timestamp extends Signed {
|
||||
readonly type = MetadataKind.Timestamp;
|
||||
readonly snapshotMeta: MetaFile;
|
||||
constructor(options: TimestampOptions);
|
||||
equals(other: Timestamp): boolean;
|
||||
toJSON(): JSONObject;
|
||||
static fromJSON(data: JSONObject): Timestamp;
|
||||
}
|
||||
export {};
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
import { JSONObject } from './types';
|
||||
export declare function isDefined<T>(val: T | undefined): val is T;
|
||||
export declare function isObject(value: unknown): value is JSONObject;
|
||||
export declare function isStringArray(value: unknown): value is string[];
|
||||
export declare function isObjectArray(value: unknown): value is JSONObject[];
|
||||
export declare function isStringRecord(value: unknown): value is Record<string, string>;
|
||||
export declare function isObjectRecord(value: unknown): value is Record<string, JSONObject>;
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
export * as guard from './guard';
|
||||
export { JSONObject, JSONValue } from './types';
|
||||
export * as crypto from './verify';
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
export declare function canonicalize(object: any): Buffer;
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
import { VerifyKeyObjectInput } from 'crypto';
|
||||
interface KeyInfo {
|
||||
keyType: string;
|
||||
scheme: string;
|
||||
keyVal: string;
|
||||
}
|
||||
export declare function getPublicKey(keyInfo: KeyInfo): VerifyKeyObjectInput;
|
||||
export {};
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
export declare function encodeOIDString(oid: string): Buffer;
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
export type JSONObject = {
|
||||
[key: string]: JSONValue;
|
||||
};
|
||||
export type JSONValue = null | boolean | number | string | JSONValue[] | JSONObject;
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
import crypto from 'crypto';
|
||||
import { JSONObject } from '../utils/types';
|
||||
export declare const verifySignature: (metaDataSignedData: JSONObject, key: crypto.VerifyKeyObjectInput, signature: string) => boolean;
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tufjs/models",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "TUF metadata models",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
@@ -26,14 +26,14 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/theupdateframework/tuf-js/issues"
|
||||
},
|
||||
"homepage": "https://github.com/theupdateframework/tuf-js/packages/models#readme",
|
||||
"homepage": "https://github.com/theupdateframework/tuf-js/tree/main/packages/models#readme",
|
||||
"devDependencies": {
|
||||
"@types/minimatch": "^5.1.2",
|
||||
"@types/node": "^18.14.1",
|
||||
"@types/node": "^18.15.3",
|
||||
"typescript": "^4.9.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"minimatch": "^6.1.0"
|
||||
"minimatch": "^7.4.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
|
||||
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
import { EventTarget } from "event-target-shim"
|
||||
|
||||
type Events = {
|
||||
abort: any
|
||||
}
|
||||
type EventAttributes = {
|
||||
onabort: any
|
||||
}
|
||||
/**
|
||||
* The signal class.
|
||||
* @see https://dom.spec.whatwg.org/#abortsignal
|
||||
*/
|
||||
declare class AbortSignal extends EventTarget<Events, EventAttributes> {
|
||||
/**
|
||||
* AbortSignal cannot be constructed directly.
|
||||
*/
|
||||
constructor()
|
||||
/**
|
||||
* Returns `true` if this `AbortSignal`"s `AbortController` has signaled to abort, and `false` otherwise.
|
||||
*/
|
||||
readonly aborted: boolean
|
||||
}
|
||||
/**
|
||||
* The AbortController.
|
||||
* @see https://dom.spec.whatwg.org/#abortcontroller
|
||||
*/
|
||||
declare class AbortController {
|
||||
/**
|
||||
* Initialize this controller.
|
||||
*/
|
||||
constructor()
|
||||
/**
|
||||
* Returns the `AbortSignal` object associated with this object.
|
||||
*/
|
||||
readonly signal: AbortSignal
|
||||
/**
|
||||
* Abort and signal to any observers that the associated activity is to be aborted.
|
||||
*/
|
||||
abort(): void
|
||||
}
|
||||
|
||||
export default AbortController
|
||||
export { AbortController, AbortSignal }
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"abort-controller.js","sources":["../src/abort-signal.ts","../src/abort-controller.ts"],"sourcesContent":["import {\n // Event,\n EventTarget,\n // Type,\n defineEventAttribute,\n} from \"event-target-shim\"\n\n// Known Limitation\n// Use `any` because the type of `AbortSignal` in `lib.dom.d.ts` is wrong and\n// to make assignable our `AbortSignal` into that.\n// https://github.com/Microsoft/TSJS-lib-generator/pull/623\ntype Events = {\n abort: any // Event & Type<\"abort\">\n}\ntype EventAttributes = {\n onabort: any // Event & Type<\"abort\">\n}\n\n/**\n * The signal class.\n * @see https://dom.spec.whatwg.org/#abortsignal\n */\nexport default class AbortSignal extends EventTarget<Events, EventAttributes> {\n /**\n * AbortSignal cannot be constructed directly.\n */\n public constructor() {\n super()\n throw new TypeError(\"AbortSignal cannot be constructed directly\")\n }\n\n /**\n * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.\n */\n public get aborted(): boolean {\n const aborted = abortedFlags.get(this)\n if (typeof aborted !== \"boolean\") {\n throw new TypeError(\n `Expected 'this' to be an 'AbortSignal' object, but got ${\n this === null ? \"null\" : typeof this\n }`,\n )\n }\n return aborted\n }\n}\ndefineEventAttribute(AbortSignal.prototype, \"abort\")\n\n/**\n * Create an AbortSignal object.\n */\nexport function createAbortSignal(): AbortSignal {\n const signal = Object.create(AbortSignal.prototype)\n EventTarget.call(signal)\n abortedFlags.set(signal, false)\n return signal\n}\n\n/**\n * Abort a given signal.\n */\nexport function abortSignal(signal: AbortSignal): void {\n if (abortedFlags.get(signal) !== false) {\n return\n }\n\n abortedFlags.set(signal, true)\n signal.dispatchEvent<\"abort\">({ type: \"abort\" })\n}\n\n/**\n * Aborted flag for each instances.\n */\nconst abortedFlags = new WeakMap<AbortSignal, boolean>()\n\n// Properties should be enumerable.\nObject.defineProperties(AbortSignal.prototype, {\n aborted: { enumerable: true },\n})\n\n// `toString()` should return `\"[object AbortSignal]\"`\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortSignal\",\n })\n}\n","import AbortSignal, { abortSignal, createAbortSignal } from \"./abort-signal\"\n\n/**\n * The AbortController.\n * @see https://dom.spec.whatwg.org/#abortcontroller\n */\nexport default class AbortController {\n /**\n * Initialize this controller.\n */\n public constructor() {\n signals.set(this, createAbortSignal())\n }\n\n /**\n * Returns the `AbortSignal` object associated with this object.\n */\n public get signal(): AbortSignal {\n return getSignal(this)\n }\n\n /**\n * Abort and signal to any observers that the associated activity is to be aborted.\n */\n public abort(): void {\n abortSignal(getSignal(this))\n }\n}\n\n/**\n * Associated signals.\n */\nconst signals = new WeakMap<AbortController, AbortSignal>()\n\n/**\n * Get the associated signal of a given controller.\n */\nfunction getSignal(controller: AbortController): AbortSignal {\n const signal = signals.get(controller)\n if (signal == null) {\n throw new TypeError(\n `Expected 'this' to be an 'AbortController' object, but got ${\n controller === null ? \"null\" : typeof controller\n }`,\n )\n }\n return signal\n}\n\n// Properties should be enumerable.\nObject.defineProperties(AbortController.prototype, {\n signal: { enumerable: true },\n abort: { enumerable: true },\n})\n\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortController\",\n })\n}\n\nexport { AbortController, AbortSignal }\n"],"names":["EventTarget","defineEventAttribute"],"mappings":";;;;;;;;;;AAkBA;;;;AAIA,MAAqB,WAAY,SAAQA,2BAAoC;;;;IAIzE;QACI,KAAK,EAAE,CAAA;QACP,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAA;KACpE;;;;IAKD,IAAW,OAAO;QACd,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACtC,IAAI,OAAO,OAAO,KAAK,SAAS,EAAE;YAC9B,MAAM,IAAI,SAAS,CACf,0DACI,IAAI,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,IACpC,EAAE,CACL,CAAA;SACJ;QACD,OAAO,OAAO,CAAA;KACjB;CACJ;AACDC,oCAAoB,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;;;;AAKpD,SAAgB,iBAAiB;IAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;IACnDD,2BAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACxB,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAC/B,OAAO,MAAM,CAAA;CAChB;;;;AAKD,SAAgB,WAAW,CAAC,MAAmB;IAC3C,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,Line truncated
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"abort-controller.mjs","sources":["../src/abort-signal.ts","../src/abort-controller.ts"],"sourcesContent":["import {\n // Event,\n EventTarget,\n // Type,\n defineEventAttribute,\n} from \"event-target-shim\"\n\n// Known Limitation\n// Use `any` because the type of `AbortSignal` in `lib.dom.d.ts` is wrong and\n// to make assignable our `AbortSignal` into that.\n// https://github.com/Microsoft/TSJS-lib-generator/pull/623\ntype Events = {\n abort: any // Event & Type<\"abort\">\n}\ntype EventAttributes = {\n onabort: any // Event & Type<\"abort\">\n}\n\n/**\n * The signal class.\n * @see https://dom.spec.whatwg.org/#abortsignal\n */\nexport default class AbortSignal extends EventTarget<Events, EventAttributes> {\n /**\n * AbortSignal cannot be constructed directly.\n */\n public constructor() {\n super()\n throw new TypeError(\"AbortSignal cannot be constructed directly\")\n }\n\n /**\n * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.\n */\n public get aborted(): boolean {\n const aborted = abortedFlags.get(this)\n if (typeof aborted !== \"boolean\") {\n throw new TypeError(\n `Expected 'this' to be an 'AbortSignal' object, but got ${\n this === null ? \"null\" : typeof this\n }`,\n )\n }\n return aborted\n }\n}\ndefineEventAttribute(AbortSignal.prototype, \"abort\")\n\n/**\n * Create an AbortSignal object.\n */\nexport function createAbortSignal(): AbortSignal {\n const signal = Object.create(AbortSignal.prototype)\n EventTarget.call(signal)\n abortedFlags.set(signal, false)\n return signal\n}\n\n/**\n * Abort a given signal.\n */\nexport function abortSignal(signal: AbortSignal): void {\n if (abortedFlags.get(signal) !== false) {\n return\n }\n\n abortedFlags.set(signal, true)\n signal.dispatchEvent<\"abort\">({ type: \"abort\" })\n}\n\n/**\n * Aborted flag for each instances.\n */\nconst abortedFlags = new WeakMap<AbortSignal, boolean>()\n\n// Properties should be enumerable.\nObject.defineProperties(AbortSignal.prototype, {\n aborted: { enumerable: true },\n})\n\n// `toString()` should return `\"[object AbortSignal]\"`\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortSignal\",\n })\n}\n","import AbortSignal, { abortSignal, createAbortSignal } from \"./abort-signal\"\n\n/**\n * The AbortController.\n * @see https://dom.spec.whatwg.org/#abortcontroller\n */\nexport default class AbortController {\n /**\n * Initialize this controller.\n */\n public constructor() {\n signals.set(this, createAbortSignal())\n }\n\n /**\n * Returns the `AbortSignal` object associated with this object.\n */\n public get signal(): AbortSignal {\n return getSignal(this)\n }\n\n /**\n * Abort and signal to any observers that the associated activity is to be aborted.\n */\n public abort(): void {\n abortSignal(getSignal(this))\n }\n}\n\n/**\n * Associated signals.\n */\nconst signals = new WeakMap<AbortController, AbortSignal>()\n\n/**\n * Get the associated signal of a given controller.\n */\nfunction getSignal(controller: AbortController): AbortSignal {\n const signal = signals.get(controller)\n if (signal == null) {\n throw new TypeError(\n `Expected 'this' to be an 'AbortController' object, but got ${\n controller === null ? \"null\" : typeof controller\n }`,\n )\n }\n return signal\n}\n\n// Properties should be enumerable.\nObject.defineProperties(AbortController.prototype, {\n signal: { enumerable: true },\n abort: { enumerable: true },\n})\n\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortController\",\n })\n}\n\nexport { AbortController, AbortSignal }\n"],"names":[],"mappings":";;;;;;AAkBA;;;;AAIA,MAAqB,WAAY,SAAQ,WAAoC;;;;IAIzE;QACI,KAAK,EAAE,CAAA;QACP,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAA;KACpE;;;;IAKD,IAAW,OAAO;QACd,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACtC,IAAI,OAAO,OAAO,KAAK,SAAS,EAAE;YAC9B,MAAM,IAAI,SAAS,CACf,0DACI,IAAI,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,IACpC,EAAE,CACL,CAAA;SACJ;QACD,OAAO,OAAO,CAAA;KACjB;CACJ;AACD,oBAAoB,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;;;;AAKpD,SAAgB,iBAAiB;IAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;IACnD,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACxB,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAC/B,OAAO,MAAM,CAAA;CAChB;;;;AAKD,SAAgB,WAAW,CAAC,MAAmB;IAC3C,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,KAAK,EAAE;QACpC,OAAM;KACT;IAED,YAAY,CAALine truncated
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"abort-controller.umd.js","sources":["../node_modules/event-target-shim/dist/event-target-shim.mjs","../src/abort-signal.ts","../src/abort-controller.ts"],"sourcesContent":["/**\n * @author Toru Nagashima <https://github.com/mysticatea>\n * @copyright 2015 Toru Nagashima. All rights reserved.\n * See LICENSE file in root directory for full license.\n */\n/**\n * @typedef {object} PrivateData\n * @property {EventTarget} eventTarget The event target.\n * @property {{type:string}} event The original event object.\n * @property {number} eventPhase The current event phase.\n * @property {EventTarget|null} currentTarget The current event target.\n * @property {boolean} canceled The flag to prevent default.\n * @property {boolean} stopped The flag to stop propagation.\n * @property {boolean} immediateStopped The flag to stop propagation immediately.\n * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.\n * @property {number} timeStamp The unix time.\n * @private\n */\n\n/**\n * Private data for event wrappers.\n * @type {WeakMap<Event, PrivateData>}\n * @private\n */\nconst privateData = new WeakMap();\n\n/**\n * Cache for wrapper classes.\n * @type {WeakMap<Object, Function>}\n * @private\n */\nconst wrappers = new WeakMap();\n\n/**\n * Get private data.\n * @param {Event} event The event object to get private data.\n * @returns {PrivateData} The private data of the event.\n * @private\n */\nfunction pd(event) {\n const retv = privateData.get(event);\n console.assert(\n retv != null,\n \"'this' is expected an Event object, but got\",\n event\n );\n return retv\n}\n\n/**\n * https://dom.spec.whatwg.org/#set-the-canceled-flag\n * @param data {PrivateData} private data.\n */\nfunction setCancelFlag(data) {\n if (data.passiveListener != null) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(\n \"Unable to preventDefault inside passive event listener invocation.\",\n data.passiveListener\n );\n }\n return\n }\n if (!data.event.cancelable) {\n return\n }\n\n data.canceled = true;\n if (typeof data.event.preventDefault === \"function\") {\n data.event.preventDefault();\n }\n}\n\n/**\n * @see https://dom.spec.whatwg.org/#interface-event\n * @private\n */\n/**\n * The event wrapper.\n * @constructor\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Event|{type:string}} event The original event to wrap.\n */\nfunction Event(eventTarget, event) {\n privateData.set(this, {\n eventTarget,\n event,\n eventPhase: 2,\n currentTarget: eventTarget,\n canceled: false,\n stopped: false,\n immediateStopped: false,\n passiveListener: null,\n timeStamp: event.timeStamp || Date.now(),\n });\n\n // https://heycam.github.io/webidl/#Unforgeable\n Object.defineProperty(this, \"isTrusted\", { value: false, enumerable: true });\n\n // Define accessors\n const keys = Object.keys(event);\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i];\n if (!(key in this)) {\n Object.defineProperty(this, key, defineRedirectDescriptor(key));\n }\n }\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEvent.prototype = {\n /**\n * The type of this event.\n * @type {string}\n */\n get type() {\n return pd(this).event.type\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get target() {\n return pd(this).eventTarget\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get currentTarget() {\n return pd(this).currentTarget\n },\n\n /**\n * @returns {EventTarget[]} The composed path of this event.\n */\n composedPath() {\n const currentTarget = pd(this).currentTarget;\n if (currentTarget == null) {\n return []\n }\n return [currentTarget]\n },\n\n /**\n * Constant of NONE.\n * @type {number}\n */\n get NONE() {\n return 0\n },\n\n /**\n * Constant of CAPTURING_PHASE.\n * @type {number}\n */\n get CAPTURING_PHASE() {\n return 1\n },\n\n /**\n * Constant of AT_TARGET.\n * @type {number}\n */\n get AT_TARGET() {\n return 2\n },\n\n /**\n * Constant of BUBBLING_PHASE.\n * @type {number}\n */\n get BUBBLING_PHASE() {\n return 3\n },\n\n /**\n * The target of this event.\n * @type {number}\n */\n get eventPhase() {\n return pd(this).eventPhase\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopPropagation() {\n consLine truncated
|
||||
-78
@@ -1,78 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
import net from 'net';
|
||||
import http from 'http';
|
||||
import https from 'https';
|
||||
import { Duplex } from 'stream';
|
||||
import { EventEmitter } from 'events';
|
||||
declare function createAgent(opts?: createAgent.AgentOptions): createAgent.Agent;
|
||||
declare function createAgent(callback: createAgent.AgentCallback, opts?: createAgent.AgentOptions): createAgent.Agent;
|
||||
declare namespace createAgent {
|
||||
interface ClientRequest extends http.ClientRequest {
|
||||
_last?: boolean;
|
||||
_hadError?: boolean;
|
||||
method: string;
|
||||
}
|
||||
interface AgentRequestOptions {
|
||||
host?: string;
|
||||
path?: string;
|
||||
port: number;
|
||||
}
|
||||
interface HttpRequestOptions extends AgentRequestOptions, Omit<http.RequestOptions, keyof AgentRequestOptions> {
|
||||
secureEndpoint: false;
|
||||
}
|
||||
interface HttpsRequestOptions extends AgentRequestOptions, Omit<https.RequestOptions, keyof AgentRequestOptions> {
|
||||
secureEndpoint: true;
|
||||
}
|
||||
type RequestOptions = HttpRequestOptions | HttpsRequestOptions;
|
||||
type AgentLike = Pick<createAgent.Agent, 'addRequest'> | http.Agent;
|
||||
type AgentCallbackReturn = Duplex | AgentLike;
|
||||
type AgentCallbackCallback = (err?: Error | null, socket?: createAgent.AgentCallbackReturn) => void;
|
||||
type AgentCallbackPromise = (req: createAgent.ClientRequest, opts: createAgent.RequestOptions) => createAgent.AgentCallbackReturn | Promise<createAgent.AgentCallbackReturn>;
|
||||
type AgentCallback = typeof Agent.prototype.callback;
|
||||
type AgentOptions = {
|
||||
timeout?: number;
|
||||
};
|
||||
/**
|
||||
* Base `http.Agent` implementation.
|
||||
* No pooling/keep-alive is implemented by default.
|
||||
*
|
||||
* @param {Function} callback
|
||||
* @api public
|
||||
*/
|
||||
class Agent extends EventEmitter {
|
||||
timeout: number | null;
|
||||
maxFreeSockets: number;
|
||||
maxTotalSockets: number;
|
||||
maxSockets: number;
|
||||
sockets: {
|
||||
[key: string]: net.Socket[];
|
||||
};
|
||||
freeSockets: {
|
||||
[key: string]: net.Socket[];
|
||||
};
|
||||
requests: {
|
||||
[key: string]: http.IncomingMessage[];
|
||||
};
|
||||
options: https.AgentOptions;
|
||||
private promisifiedCallback?;
|
||||
private explicitDefaultPort?;
|
||||
private explicitProtocol?;
|
||||
constructor(callback?: createAgent.AgentCallback | createAgent.AgentOptions, _opts?: createAgent.AgentOptions);
|
||||
get defaultPort(): number;
|
||||
set defaultPort(v: number);
|
||||
get protocol(): string;
|
||||
set protocol(v: string);
|
||||
callback(req: createAgent.ClientRequest, opts: createAgent.RequestOptions, fn: createAgent.AgentCallbackCallback): void;
|
||||
callback(req: createAgent.ClientRequest, opts: createAgent.RequestOptions): createAgent.AgentCallbackReturn | Promise<createAgent.AgentCallbackReturn>;
|
||||
/**
|
||||
* Called by node-core's "_http_client.js" module when creating
|
||||
* a new HTTP request with this Agent instance.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
addRequest(req: ClientRequest, _opts: RequestOptions): void;
|
||||
freeSocket(socket: net.Socket, opts: AgentOptions): void;
|
||||
destroy(): void;
|
||||
}
|
||||
}
|
||||
export = createAgent;
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAIA,mCAAsC;AACtC,kDAAgC;AAChC,4DAAoC;AAEpC,MAAM,KAAK,GAAG,eAAW,CAAC,YAAY,CAAC,CAAC;AAExC,SAAS,OAAO,CAAC,CAAM;IACtB,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC;AACzD,CAAC;AAED,SAAS,gBAAgB;IACxB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,KAAK,EAAE,CAAC;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAK,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACxG,CAAC;AAOD,SAAS,WAAW,CACnB,QAA+D,EAC/D,IAA+B;IAE/B,OAAO,IAAI,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,WAAU,WAAW;IAmDpB;;;;;;OAMG;IACH,MAAa,KAAM,SAAQ,qBAAY;QAmBtC,YACC,QAA+D,EAC/D,KAAgC;YAEhC,KAAK,EAAE,CAAC;YAER,IAAI,IAAI,GAAG,KAAK,CAAC;YACjB,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;gBACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;aACzB;iBAAM,IAAI,QAAQ,EAAE;gBACpB,IAAI,GAAG,QAAQ,CAAC;aAChB;YAED,0DAA0D;YAC1D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE;gBAC7C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;aAC5B;YAED,+DAA+D;YAC/D,0DAA0D;YAC1D,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;YACxB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;YACpB,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC;YAChC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;YAClB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;YACtB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QACnB,CAAC;QAED,IAAI,WAAW;YACd,IAAI,OAAO,IAAI,CAAC,mBAAmB,KAAK,QAAQ,EAAE;gBACjD,OAAO,IAAI,CAAC,mBAAmB,CAAC;aAChC;YACD,OAAO,gBAAgB,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACtC,CAAC;QAED,IAAI,WAAW,CAAC,CAAS;YACxB,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC;QAC9B,CAAC;QAED,IAAI,QAAQ;YACX,IAAI,OAAO,IAAI,CAAC,gBAAgB,KAAK,QAAQ,EAAE;gBAC9C,OAAO,IAAI,CAAC,gBAAgB,CAAC;aAC7B;YACD,OAAO,gBAAgB,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;QAChD,CAAC;QAED,IAAI,QAAQ,CAAC,CAAS;YACrB,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC3B,CAAC;QAaD,QAAQ,CACP,GAA8B,EAC9B,IAA8B,EAC9B,EAAsC;YAKtC,MAAM,IAAI,KAAK,CACd,yFAAyF,CACzF,CAAC;QACH,CAAC;QAED;;;;;WAKG;QACH,UAAU,CAAC,GAAkB,EAAE,KAAqB;YACnD,MAAM,IAAI,qBAAwB,KAAK,CAAE,CAAC;YAE1C,IAAI,OAAO,IAAI,CAAC,cAAc,KAAK,SAAS,EAAE;gBAC7C,IAAI,CAAC,cAAc,GAAG,gBAAgB,EAAE,CAAC;aACzC;YAED,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE;gBACtB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;aACxB;YAED,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE;gBACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;aAC3C;YAED,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,EAAE;gBAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;aACzD;YAED,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE;gBAC3B,2DAA2D;gBAC3D,0DAA0D;gBAC1D,4DAA4D;gBAC5D,8CAA8C;gBAC9C,OAAO,IAAI,CAAC,IAAI,CAAC;aACjB;YAED,OAAO,IAAI,CAAC,KAAK,CAAC;YAClB,OAAO,IAAI,CAAC,QAAQ,CAAC;YACrB,OAAO,IAAI,CAAC,aAAa,CAAC;YAC1B,OAAO,IAAI,CAAC,WAAW,CAAC;YACxB,OAAO,IAAI,CAAC,gBAAgB,CAAC;YAE7B,kCAAkC;YAClC,2CAA2C;YAC3C,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC;YACjB,GAAG,CAAC,eAAe,GAAG,KAAK,CAAC;YAE5B,IAAI,QAAQ,GAAG,KAAK,CAAC;YACrB,IAAI,SAAS,GAAyC,IAAI,CAAC;YAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;YAE/C,MAAM,OAAO,GAAG,CAAC,GAA0B,EAAE,EAAE;gBAC9C,IAAI,GAAG,CAAC,SAAS;oBAAE,OAAO;gBAC1B,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;gBACvB,yDAAyD;gBACzD,iEAAiE;gBACjE,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,CAAC,CAAC;YAEF,MAAM,SAAS,GAAG,GAAG,EAAE;gBACtB,SAAS,GAAG,IAAI,CAAC;gBACjB,QAAQ,GAAG,IAAI,CAAC;gBAChB,MAAM,GAAG,GAA0B,IAAI,KAAK,CAC3C,sDAAsD,SAAS,IAAI,CACnE,CAAC;gBACF,GAAG,CAAC,IAAI,GAAG,UAAU,CAAC;gBACtB,OAAO,CAAC,GAAG,CAAC,CAAC;YACd,CAAC,CAAC;YAEF,MAAM,aAAa,GAAG,CAAC,GAA0B,EAAE,EAAE;gBACpD,IAAI,QAAQ;oBAAE,OAAO;gBACrB,IAAI,SAAS,KAAK,IAAI,EAAE;oBACvB,YAAY,CAAC,SAAS,CAAC,CAAC;oBACxB,SAAS,GAAG,IAAI,CAAC;iBACjB;gBACD,OAAO,CAAC,GAAG,CAAC,CAAC;YACd,CAAC,CAAC;YAEF,MAAM,QAAQ,GAAG,CAAC,MAA2B,EAAE,EAAE;gBAChD,IAAI,QAAQ;oBAAE,OAAO;gBACrB,IAAI,SAAS,IAAI,IAAI,EAAE;oBACtB,YAAY,CAAC,SAAS,CAAC,CAAC;oBACxB,SAAS,GAAG,IAAI,CAAC;iBACjB;gBAED,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE;oBACpB,oDAAoD;oBACpD,wDAAwD;oBACxD,eAAe;oBACf,KAAK,CACJ,6CAA6C,EAC7C,MAAM,CAAC,WAAW,CAAC,IAAI,CACvB,CAAC;oBACD,MAA4B,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;oBACpD,OAAO;iBACP;gBAED,IAAI,MAAM,EAAE;oBACX,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE;wBACxB,IAAI,CAAC,UAAU,CAAC,MAAoB,EAAE,IAAI,CAAC,CAAC;oBAC7C,CAAC,CAAC,CAAC;oBACH,GAAG,CAAC,QAAQ,CAAC,MAAoB,CAAC,CAAC;oBACnC,OAAO;iBACP;gBAED,MAAM,GAAG,GAAG,IAAI,KAAK,CACpB,qDAAqD,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,IAAI,CAC/E,CAAC;gBACF,OAAO,CAAC,GAAG,CAAC,CAAC;YACd,CAAC,CAAC;YAEF,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,UAAU,EAAE;gBACxC,OAAO,CAAC,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC,CAAC;gBAChD,OAAO;aACP;YAED,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE;gBAC9B,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,EAAE;oBAC9B,KAAK,CAAC,gDAAgD,CAAC,CAAC;oBACxD,IAAI,CAAC,mBAAmB,GAAG,mBAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iBACpD;qBAAM;oBACN,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,QAAQ,CAAC;iBACzC;aACD;YAED,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,GAAG,CAAC,EAAE;gBACnD,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;aAC7C;YAED,IAAI,MAAM,IAAI,IAAI,IAAI,OALine truncated
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
import { ClientRequest, RequestOptions, AgentCallbackCallback, AgentCallbackPromise } from './index';
|
||||
declare type LegacyCallback = (req: ClientRequest, opts: RequestOptions, fn: AgentCallbackCallback) => void;
|
||||
export default function promisify(fn: LegacyCallback): AgentCallbackPromise;
|
||||
export {};
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"promisify.js","sourceRoot":"","sources":["../../src/promisify.ts"],"names":[],"mappings":";;AAeA,SAAwB,SAAS,CAAC,EAAkB;IACnD,OAAO,UAAsB,GAAkB,EAAE,IAAoB;QACpE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,EAAE,CAAC,IAAI,CACN,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,CAAC,GAA6B,EAAE,GAAyB,EAAE,EAAE;gBAC5D,IAAI,GAAG,EAAE;oBACR,MAAM,CAAC,GAAG,CAAC,CAAC;iBACZ;qBAAM;oBACN,OAAO,CAAC,GAAG,CAAC,CAAC;iBACb;YACF,CAAC,CACD,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC;AAjBD,4BAiBC"}
|
||||
-345
@@ -1,345 +0,0 @@
|
||||
import net from 'net';
|
||||
import http from 'http';
|
||||
import https from 'https';
|
||||
import { Duplex } from 'stream';
|
||||
import { EventEmitter } from 'events';
|
||||
import createDebug from 'debug';
|
||||
import promisify from './promisify';
|
||||
|
||||
const debug = createDebug('agent-base');
|
||||
|
||||
function isAgent(v: any): v is createAgent.AgentLike {
|
||||
return Boolean(v) && typeof v.addRequest === 'function';
|
||||
}
|
||||
|
||||
function isSecureEndpoint(): boolean {
|
||||
const { stack } = new Error();
|
||||
if (typeof stack !== 'string') return false;
|
||||
return stack.split('\n').some(l => l.indexOf('(https.js:') !== -1 || l.indexOf('node:https:') !== -1);
|
||||
}
|
||||
|
||||
function createAgent(opts?: createAgent.AgentOptions): createAgent.Agent;
|
||||
function createAgent(
|
||||
callback: createAgent.AgentCallback,
|
||||
opts?: createAgent.AgentOptions
|
||||
): createAgent.Agent;
|
||||
function createAgent(
|
||||
callback?: createAgent.AgentCallback | createAgent.AgentOptions,
|
||||
opts?: createAgent.AgentOptions
|
||||
) {
|
||||
return new createAgent.Agent(callback, opts);
|
||||
}
|
||||
|
||||
namespace createAgent {
|
||||
export interface ClientRequest extends http.ClientRequest {
|
||||
_last?: boolean;
|
||||
_hadError?: boolean;
|
||||
method: string;
|
||||
}
|
||||
|
||||
export interface AgentRequestOptions {
|
||||
host?: string;
|
||||
path?: string;
|
||||
// `port` on `http.RequestOptions` can be a string or undefined,
|
||||
// but `net.TcpNetConnectOpts` expects only a number
|
||||
port: number;
|
||||
}
|
||||
|
||||
export interface HttpRequestOptions
|
||||
extends AgentRequestOptions,
|
||||
Omit<http.RequestOptions, keyof AgentRequestOptions> {
|
||||
secureEndpoint: false;
|
||||
}
|
||||
|
||||
export interface HttpsRequestOptions
|
||||
extends AgentRequestOptions,
|
||||
Omit<https.RequestOptions, keyof AgentRequestOptions> {
|
||||
secureEndpoint: true;
|
||||
}
|
||||
|
||||
export type RequestOptions = HttpRequestOptions | HttpsRequestOptions;
|
||||
|
||||
export type AgentLike = Pick<createAgent.Agent, 'addRequest'> | http.Agent;
|
||||
|
||||
export type AgentCallbackReturn = Duplex | AgentLike;
|
||||
|
||||
export type AgentCallbackCallback = (
|
||||
err?: Error | null,
|
||||
socket?: createAgent.AgentCallbackReturn
|
||||
) => void;
|
||||
|
||||
export type AgentCallbackPromise = (
|
||||
req: createAgent.ClientRequest,
|
||||
opts: createAgent.RequestOptions
|
||||
) =>
|
||||
| createAgent.AgentCallbackReturn
|
||||
| Promise<createAgent.AgentCallbackReturn>;
|
||||
|
||||
export type AgentCallback = typeof Agent.prototype.callback;
|
||||
|
||||
export type AgentOptions = {
|
||||
timeout?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Base `http.Agent` implementation.
|
||||
* No pooling/keep-alive is implemented by default.
|
||||
*
|
||||
* @param {Function} callback
|
||||
* @api public
|
||||
*/
|
||||
export class Agent extends EventEmitter {
|
||||
public timeout: number | null;
|
||||
public maxFreeSockets: number;
|
||||
public maxTotalSockets: number;
|
||||
public maxSockets: number;
|
||||
public sockets: {
|
||||
[key: string]: net.Socket[];
|
||||
};
|
||||
public freeSockets: {
|
||||
[key: string]: net.Socket[];
|
||||
};
|
||||
public requests: {
|
||||
[key: string]: http.IncomingMessage[];
|
||||
};
|
||||
public options: https.AgentOptions;
|
||||
private promisifiedCallback?: createAgent.AgentCallbackPromise;
|
||||
private explicitDefaultPort?: number;
|
||||
private explicitProtocol?: string;
|
||||
|
||||
constructor(
|
||||
callback?: createAgent.AgentCallback | createAgent.AgentOptions,
|
||||
_opts?: createAgent.AgentOptions
|
||||
) {
|
||||
super();
|
||||
|
||||
let opts = _opts;
|
||||
if (typeof callback === 'function') {
|
||||
this.callback = callback;
|
||||
} else if (callback) {
|
||||
opts = callback;
|
||||
}
|
||||
|
||||
// Timeout for the socket to be returned from the callback
|
||||
this.timeout = null;
|
||||
if (opts && typeof opts.timeout === 'number') {
|
||||
this.timeout = opts.timeout;
|
||||
}
|
||||
|
||||
// These aren't actually used by `agent-base`, but are required
|
||||
// for the TypeScript definition files in `@types/node` :/
|
||||
this.maxFreeSockets = 1;
|
||||
this.maxSockets = 1;
|
||||
this.maxTotalSockets = Infinity;
|
||||
this.sockets = {};
|
||||
this.freeSockets = {};
|
||||
this.requests = {};
|
||||
this.options = {};
|
||||
}
|
||||
|
||||
get defaultPort(): number {
|
||||
if (typeof this.explicitDefaultPort === 'number') {
|
||||
return this.explicitDefaultPort;
|
||||
}
|
||||
return isSecureEndpoint() ? 443 : 80;
|
||||
}
|
||||
|
||||
set defaultPort(v: number) {
|
||||
this.explicitDefaultPort = v;
|
||||
}
|
||||
|
||||
get protocol(): string {
|
||||
if (typeof this.explicitProtocol === 'string') {
|
||||
return this.explicitProtocol;
|
||||
}
|
||||
return isSecureEndpoint() ? 'https:' : 'http:';
|
||||
}
|
||||
|
||||
set protocol(v: string) {
|
||||
this.explicitProtocol = v;
|
||||
}
|
||||
|
||||
callback(
|
||||
req: createAgent.ClientRequest,
|
||||
opts: createAgent.RequestOptions,
|
||||
fn: createAgent.AgentCallbackCallback
|
||||
): void;
|
||||
callback(
|
||||
req: createAgent.ClientRequest,
|
||||
opts: createAgent.RequestOptions
|
||||
):
|
||||
| createAgent.AgentCallbackReturn
|
||||
| Promise<createAgent.AgentCallbackReturn>;
|
||||
callback(
|
||||
req: createAgent.ClientRequest,
|
||||
opts: createAgent.AgentOptions,
|
||||
fn?: createAgent.AgentCallbackCallback
|
||||
):
|
||||
| createAgent.AgentCallbackReturn
|
||||
| Promise<createAgent.AgentCallbackReturn>
|
||||
| void {
|
||||
throw new Error(
|
||||
'"agent-base" has no default implementation, you must subclass and override `callback()`'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by node-core's "_http_client.js" module when creating
|
||||
* a new HTTP request with this Agent instance.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
addRequest(req: ClientRequest, _opts: RequestOptions): void {
|
||||
const opts: RequestOptions = { ..._opts };
|
||||
|
||||
if (typeof opts.secureEndpoint !== 'boolean') {
|
||||
opts.secureEndpoint = isSecureEndpoint();
|
||||
}
|
||||
|
||||
if (opts.host == null) {
|
||||
opts.host = 'localhost';
|
||||
}
|
||||
|
||||
if (opts.port == null) {
|
||||
opts.port = opts.secureEndpoint ? 443 : 80;
|
||||
}
|
||||
|
||||
if (opts.protocol == null) {
|
||||
opts.protocol = opts.secureEndpoint ? 'https:' : 'http:';
|
||||
}
|
||||
|
||||
if (opts.host && opts.path) {
|
||||
// If both a `host` and `path` are specified then it's most
|
||||
// likely the result of a `url.parse()` call... we need to
|
||||
// remove the `path` portion so that `net.connect()` doesn't
|
||||
// attempt to open that as a unix socket file.
|
||||
delete opts.path;
|
||||
}
|
||||
|
||||
delete opts.agent;
|
||||
delete opts.hostname;
|
||||
delete opts._defaultAgent;
|
||||
delete opts.defaultPort;
|
||||
delete opts.createConnection;
|
||||
|
||||
// Hint to use "Connection: close"
|
||||
// XXX: non-documented `http` module API :(
|
||||
req._last = true;
|
||||
req.shouldKeepAlive = false;
|
||||
|
||||
let timedOut = false;
|
||||
let timeoutId: ReturnType<typeof setTimeout> | null = null;
|
||||
const timeoutMs = opts.timeout || this.timeout;
|
||||
|
||||
const onerror = (err: NodeJS.ErrnoException) => {
|
||||
if (req._hadError) return;
|
||||
req.emit('error', err);
|
||||
// For Safety. Some additional errors might fire later on
|
||||
// and we need to make sure we don't double-fire the error event.
|
||||
req._hadError = true;
|
||||
};
|
||||
|
||||
const ontimeout = () => {
|
||||
timeoutId = null;
|
||||
timedOut = true;
|
||||
const err: NodeJS.ErrnoException = new Error(
|
||||
`A "socket" was not created for HTTP request before ${timeoutMs}ms`
|
||||
);
|
||||
err.code = 'ETIMEOUT';
|
||||
onerror(err);
|
||||
};
|
||||
|
||||
const callbackError = (err: NodeJS.ErrnoException) => {
|
||||
if (timedOut) return;
|
||||
if (timeoutId !== null) {
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = null;
|
||||
}
|
||||
onerror(err);
|
||||
};
|
||||
|
||||
const onsocket = (socket: AgentCallbackReturn) => {
|
||||
if (timedOut) return;
|
||||
if (timeoutId != null) {
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = null;
|
||||
}
|
||||
|
||||
if (isAgent(socket)) {
|
||||
// `socket` is actually an `http.Agent` instance, so
|
||||
// relinquish responsibility for this `req` to the Agent
|
||||
// from here on
|
||||
debug(
|
||||
'Callback returned another Agent instance %o',
|
||||
socket.constructor.name
|
||||
);
|
||||
(socket as createAgent.Agent).addRequest(req, opts);
|
||||
return;
|
||||
}
|
||||
|
||||
if (socket) {
|
||||
socket.once('free', () => {
|
||||
this.freeSocket(socket as net.Socket, opts);
|
||||
});
|
||||
req.onSocket(socket as net.Socket);
|
||||
return;
|
||||
}
|
||||
|
||||
const err = new Error(
|
||||
`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``
|
||||
);
|
||||
onerror(err);
|
||||
};
|
||||
|
||||
if (typeof this.callback !== 'function') {
|
||||
onerror(new Error('`callback` is not defined'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.promisifiedCallback) {
|
||||
if (this.callback.length >= 3) {
|
||||
debug('Converting legacy callback function to promise');
|
||||
this.promisifiedCallback = promisify(this.callback);
|
||||
} else {
|
||||
this.promisifiedCallback = this.callback;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof timeoutMs === 'number' && timeoutMs > 0) {
|
||||
timeoutId = setTimeout(ontimeout, timeoutMs);
|
||||
}
|
||||
|
||||
if ('port' in opts && typeof opts.port !== 'number') {
|
||||
opts.port = Number(opts.port);
|
||||
}
|
||||
|
||||
try {
|
||||
debug(
|
||||
'Resolving socket for %o request: %o',
|
||||
opts.protocol,
|
||||
`${req.method} ${req.path}`
|
||||
);
|
||||
Promise.resolve(this.promisifiedCallback(req, opts)).then(
|
||||
onsocket,
|
||||
callbackError
|
||||
);
|
||||
} catch (err) {
|
||||
Promise.reject(err).catch(callbackError);
|
||||
}
|
||||
}
|
||||
|
||||
freeSocket(socket: net.Socket, opts: AgentOptions) {
|
||||
debug('Freeing socket %o %o', socket.constructor.name, opts);
|
||||
socket.destroy();
|
||||
}
|
||||
|
||||
destroy() {
|
||||
debug('Destroying agent %o', this.constructor.name);
|
||||
}
|
||||
}
|
||||
|
||||
// So that `instanceof` works correctly
|
||||
createAgent.prototype = createAgent.Agent.prototype;
|
||||
}
|
||||
|
||||
export = createAgent;
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
import {
|
||||
Agent,
|
||||
ClientRequest,
|
||||
RequestOptions,
|
||||
AgentCallbackCallback,
|
||||
AgentCallbackPromise,
|
||||
AgentCallbackReturn
|
||||
} from './index';
|
||||
|
||||
type LegacyCallback = (
|
||||
req: ClientRequest,
|
||||
opts: RequestOptions,
|
||||
fn: AgentCallbackCallback
|
||||
) => void;
|
||||
|
||||
export default function promisify(fn: LegacyCallback): AgentCallbackPromise {
|
||||
return function(this: Agent, req: ClientRequest, opts: RequestOptions) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fn.call(
|
||||
this,
|
||||
req,
|
||||
opts,
|
||||
(err: Error | null | undefined, rtn?: AgentCallbackReturn) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve(rtn);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
}
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
|
||||
interface PlainObject {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
declare class HttpAgent extends http.Agent {
|
||||
constructor(opts?: AgentKeepAlive.HttpOptions);
|
||||
readonly statusChanged: boolean;
|
||||
createSocket(req: http.IncomingMessage, options: http.RequestOptions, cb: Function): void;
|
||||
getCurrentStatus(): AgentKeepAlive.AgentStatus;
|
||||
}
|
||||
|
||||
interface Constants {
|
||||
CURRENT_ID: Symbol;
|
||||
CREATE_ID: Symbol;
|
||||
INIT_SOCKET: Symbol;
|
||||
CREATE_HTTPS_CONNECTION: Symbol;
|
||||
SOCKET_CREATED_TIME: Symbol;
|
||||
SOCKET_NAME: Symbol;
|
||||
SOCKET_REQUEST_COUNT: Symbol;
|
||||
SOCKET_REQUEST_FINISHED_COUNT: Symbol;
|
||||
}
|
||||
|
||||
declare class AgentKeepAlive extends HttpAgent {}
|
||||
|
||||
declare namespace AgentKeepAlive {
|
||||
export interface AgentStatus {
|
||||
createSocketCount: number;
|
||||
createSocketErrorCount: number;
|
||||
closeSocketCount: number;
|
||||
errorSocketCount: number;
|
||||
timeoutSocketCount: number;
|
||||
requestCount: number;
|
||||
freeSockets: PlainObject;
|
||||
sockets: PlainObject;
|
||||
requests: PlainObject;
|
||||
}
|
||||
|
||||
interface CommonHttpOption {
|
||||
keepAlive?: boolean | undefined;
|
||||
freeSocketTimeout?: number | undefined;
|
||||
freeSocketKeepAliveTimeout?: number | undefined;
|
||||
timeout?: number | undefined;
|
||||
socketActiveTTL?: number | undefined;
|
||||
}
|
||||
|
||||
export interface HttpOptions extends http.AgentOptions, CommonHttpOption { }
|
||||
export interface HttpsOptions extends https.AgentOptions, CommonHttpOption { }
|
||||
|
||||
export class HttpsAgent extends https.Agent {
|
||||
constructor(opts?: HttpsOptions);
|
||||
readonly statusChanged: boolean;
|
||||
createSocket(req: http.IncomingMessage, options: http.RequestOptions, cb: Function): void;
|
||||
getCurrentStatus(): AgentStatus;
|
||||
}
|
||||
|
||||
export const constants: Constants;
|
||||
}
|
||||
|
||||
export = AgentKeepAlive;
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
/**
|
||||
Create an error from multiple errors.
|
||||
*/
|
||||
declare class AggregateError<T extends Error = Error> extends Error implements Iterable<T> {
|
||||
readonly name: 'AggregateError';
|
||||
|
||||
/**
|
||||
@param errors - If a string, a new `Error` is created with the string as the error message. If a non-Error object, a new `Error` is created with all properties from the object copied over.
|
||||
@returns An Error that is also an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators#Iterables) for the individual errors.
|
||||
|
||||
@example
|
||||
```
|
||||
import AggregateError = require('aggregate-error');
|
||||
|
||||
const error = new AggregateError([new Error('foo'), 'bar', {message: 'baz'}]);
|
||||
|
||||
throw error;
|
||||
|
||||
// AggregateError:
|
||||
// Error: foo
|
||||
// at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:33)
|
||||
// Error: bar
|
||||
// at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:13)
|
||||
// Error: baz
|
||||
// at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:13)
|
||||
// at AggregateError (/Users/sindresorhus/dev/aggregate-error/index.js:19:3)
|
||||
// at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:13)
|
||||
// at Module._compile (module.js:556:32)
|
||||
// at Object.Module._extensions..js (module.js:565:10)
|
||||
// at Module.load (module.js:473:32)
|
||||
// at tryModuleLoad (module.js:432:12)
|
||||
// at Function.Module._load (module.js:424:3)
|
||||
// at Module.runMain (module.js:590:10)
|
||||
// at run (bootstrap_node.js:394:7)
|
||||
// at startup (bootstrap_node.js:149:9)
|
||||
|
||||
|
||||
for (const individualError of error) {
|
||||
console.log(individualError);
|
||||
}
|
||||
//=> [Error: foo]
|
||||
//=> [Error: bar]
|
||||
//=> [Error: baz]
|
||||
```
|
||||
*/
|
||||
constructor(errors: ReadonlyArray<T | {[key: string]: any} | string>);
|
||||
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
}
|
||||
|
||||
export = AggregateError;
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
declare namespace ansiRegex {
|
||||
interface Options {
|
||||
/**
|
||||
Match only the first ANSI escape.
|
||||
|
||||
@default false
|
||||
*/
|
||||
onlyFirst: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Regular expression for matching ANSI escape codes.
|
||||
|
||||
@example
|
||||
```
|
||||
import ansiRegex = require('ansi-regex');
|
||||
|
||||
ansiRegex().test('\u001B[4mcake\u001B[0m');
|
||||
//=> true
|
||||
|
||||
ansiRegex().test('cake');
|
||||
//=> false
|
||||
|
||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex());
|
||||
//=> ['\u001B[4m', '\u001B[0m']
|
||||
|
||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
|
||||
//=> ['\u001B[4m']
|
||||
|
||||
'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
|
||||
//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
|
||||
```
|
||||
*/
|
||||
declare function ansiRegex(options?: ansiRegex.Options): RegExp;
|
||||
|
||||
export = ansiRegex;
|
||||
-345
@@ -1,345 +0,0 @@
|
||||
declare type CSSColor =
|
||||
| 'aliceblue'
|
||||
| 'antiquewhite'
|
||||
| 'aqua'
|
||||
| 'aquamarine'
|
||||
| 'azure'
|
||||
| 'beige'
|
||||
| 'bisque'
|
||||
| 'black'
|
||||
| 'blanchedalmond'
|
||||
| 'blue'
|
||||
| 'blueviolet'
|
||||
| 'brown'
|
||||
| 'burlywood'
|
||||
| 'cadetblue'
|
||||
| 'chartreuse'
|
||||
| 'chocolate'
|
||||
| 'coral'
|
||||
| 'cornflowerblue'
|
||||
| 'cornsilk'
|
||||
| 'crimson'
|
||||
| 'cyan'
|
||||
| 'darkblue'
|
||||
| 'darkcyan'
|
||||
| 'darkgoldenrod'
|
||||
| 'darkgray'
|
||||
| 'darkgreen'
|
||||
| 'darkgrey'
|
||||
| 'darkkhaki'
|
||||
| 'darkmagenta'
|
||||
| 'darkolivegreen'
|
||||
| 'darkorange'
|
||||
| 'darkorchid'
|
||||
| 'darkred'
|
||||
| 'darksalmon'
|
||||
| 'darkseagreen'
|
||||
| 'darkslateblue'
|
||||
| 'darkslategray'
|
||||
| 'darkslategrey'
|
||||
| 'darkturquoise'
|
||||
| 'darkviolet'
|
||||
| 'deeppink'
|
||||
| 'deepskyblue'
|
||||
| 'dimgray'
|
||||
| 'dimgrey'
|
||||
| 'dodgerblue'
|
||||
| 'firebrick'
|
||||
| 'floralwhite'
|
||||
| 'forestgreen'
|
||||
| 'fuchsia'
|
||||
| 'gainsboro'
|
||||
| 'ghostwhite'
|
||||
| 'gold'
|
||||
| 'goldenrod'
|
||||
| 'gray'
|
||||
| 'green'
|
||||
| 'greenyellow'
|
||||
| 'grey'
|
||||
| 'honeydew'
|
||||
| 'hotpink'
|
||||
| 'indianred'
|
||||
| 'indigo'
|
||||
| 'ivory'
|
||||
| 'khaki'
|
||||
| 'lavender'
|
||||
| 'lavenderblush'
|
||||
| 'lawngreen'
|
||||
| 'lemonchiffon'
|
||||
| 'lightblue'
|
||||
| 'lightcoral'
|
||||
| 'lightcyan'
|
||||
| 'lightgoldenrodyellow'
|
||||
| 'lightgray'
|
||||
| 'lightgreen'
|
||||
| 'lightgrey'
|
||||
| 'lightpink'
|
||||
| 'lightsalmon'
|
||||
| 'lightseagreen'
|
||||
| 'lightskyblue'
|
||||
| 'lightslategray'
|
||||
| 'lightslategrey'
|
||||
| 'lightsteelblue'
|
||||
| 'lightyellow'
|
||||
| 'lime'
|
||||
| 'limegreen'
|
||||
| 'linen'
|
||||
| 'magenta'
|
||||
| 'maroon'
|
||||
| 'mediumaquamarine'
|
||||
| 'mediumblue'
|
||||
| 'mediumorchid'
|
||||
| 'mediumpurple'
|
||||
| 'mediumseagreen'
|
||||
| 'mediumslateblue'
|
||||
| 'mediumspringgreen'
|
||||
| 'mediumturquoise'
|
||||
| 'mediumvioletred'
|
||||
| 'midnightblue'
|
||||
| 'mintcream'
|
||||
| 'mistyrose'
|
||||
| 'moccasin'
|
||||
| 'navajowhite'
|
||||
| 'navy'
|
||||
| 'oldlace'
|
||||
| 'olive'
|
||||
| 'olivedrab'
|
||||
| 'orange'
|
||||
| 'orangered'
|
||||
| 'orchid'
|
||||
| 'palegoldenrod'
|
||||
| 'palegreen'
|
||||
| 'paleturquoise'
|
||||
| 'palevioletred'
|
||||
| 'papayawhip'
|
||||
| 'peachpuff'
|
||||
| 'peru'
|
||||
| 'pink'
|
||||
| 'plum'
|
||||
| 'powderblue'
|
||||
| 'purple'
|
||||
| 'rebeccapurple'
|
||||
| 'red'
|
||||
| 'rosybrown'
|
||||
| 'royalblue'
|
||||
| 'saddlebrown'
|
||||
| 'salmon'
|
||||
| 'sandybrown'
|
||||
| 'seagreen'
|
||||
| 'seashell'
|
||||
| 'sienna'
|
||||
| 'silver'
|
||||
| 'skyblue'
|
||||
| 'slateblue'
|
||||
| 'slategray'
|
||||
| 'slategrey'
|
||||
| 'snow'
|
||||
| 'springgreen'
|
||||
| 'steelblue'
|
||||
| 'tan'
|
||||
| 'teal'
|
||||
| 'thistle'
|
||||
| 'tomato'
|
||||
| 'turquoise'
|
||||
| 'violet'
|
||||
| 'wheat'
|
||||
| 'white'
|
||||
| 'whitesmoke'
|
||||
| 'yellow'
|
||||
| 'yellowgreen';
|
||||
|
||||
declare namespace ansiStyles {
|
||||
interface ColorConvert {
|
||||
/**
|
||||
The RGB color space.
|
||||
|
||||
@param red - (`0`-`255`)
|
||||
@param green - (`0`-`255`)
|
||||
@param blue - (`0`-`255`)
|
||||
*/
|
||||
rgb(red: number, green: number, blue: number): string;
|
||||
|
||||
/**
|
||||
The RGB HEX color space.
|
||||
|
||||
@param hex - A hexadecimal string containing RGB data.
|
||||
*/
|
||||
hex(hex: string): string;
|
||||
|
||||
/**
|
||||
@param keyword - A CSS color name.
|
||||
*/
|
||||
keyword(keyword: CSSColor): string;
|
||||
|
||||
/**
|
||||
The HSL color space.
|
||||
|
||||
@param hue - (`0`-`360`)
|
||||
@param saturation - (`0`-`100`)
|
||||
@param lightness - (`0`-`100`)
|
||||
*/
|
||||
hsl(hue: number, saturation: number, lightness: number): string;
|
||||
|
||||
/**
|
||||
The HSV color space.
|
||||
|
||||
@param hue - (`0`-`360`)
|
||||
@param saturation - (`0`-`100`)
|
||||
@param value - (`0`-`100`)
|
||||
*/
|
||||
hsv(hue: number, saturation: number, value: number): string;
|
||||
|
||||
/**
|
||||
The HSV color space.
|
||||
|
||||
@param hue - (`0`-`360`)
|
||||
@param whiteness - (`0`-`100`)
|
||||
@param blackness - (`0`-`100`)
|
||||
*/
|
||||
hwb(hue: number, whiteness: number, blackness: number): string;
|
||||
|
||||
/**
|
||||
Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color.
|
||||
*/
|
||||
ansi(ansi: number): string;
|
||||
|
||||
/**
|
||||
Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
||||
*/
|
||||
ansi256(ansi: number): string;
|
||||
}
|
||||
|
||||
interface CSPair {
|
||||
/**
|
||||
The ANSI terminal control sequence for starting this style.
|
||||
*/
|
||||
readonly open: string;
|
||||
|
||||
/**
|
||||
The ANSI terminal control sequence for ending this style.
|
||||
*/
|
||||
readonly close: string;
|
||||
}
|
||||
|
||||
interface ColorBase {
|
||||
readonly ansi: ColorConvert;
|
||||
readonly ansi256: ColorConvert;
|
||||
readonly ansi16m: ColorConvert;
|
||||
|
||||
/**
|
||||
The ANSI terminal control sequence for ending this color.
|
||||
*/
|
||||
readonly close: string;
|
||||
}
|
||||
|
||||
interface Modifier {
|
||||
/**
|
||||
Resets the current color chain.
|
||||
*/
|
||||
readonly reset: CSPair;
|
||||
|
||||
/**
|
||||
Make text bold.
|
||||
*/
|
||||
readonly bold: CSPair;
|
||||
|
||||
/**
|
||||
Emitting only a small amount of light.
|
||||
*/
|
||||
readonly dim: CSPair;
|
||||
|
||||
/**
|
||||
Make text italic. (Not widely supported)
|
||||
*/
|
||||
readonly italic: CSPair;
|
||||
|
||||
/**
|
||||
Make text underline. (Not widely supported)
|
||||
*/
|
||||
readonly underline: CSPair;
|
||||
|
||||
/**
|
||||
Inverse background and foreground colors.
|
||||
*/
|
||||
readonly inverse: CSPair;
|
||||
|
||||
/**
|
||||
Prints the text, but makes it invisible.
|
||||
*/
|
||||
readonly hidden: CSPair;
|
||||
|
||||
/**
|
||||
Puts a horizontal line through the center of the text. (Not widely supported)
|
||||
*/
|
||||
readonly strikethrough: CSPair;
|
||||
}
|
||||
|
||||
interface ForegroundColor {
|
||||
readonly black: CSPair;
|
||||
readonly red: CSPair;
|
||||
readonly green: CSPair;
|
||||
readonly yellow: CSPair;
|
||||
readonly blue: CSPair;
|
||||
readonly cyan: CSPair;
|
||||
readonly magenta: CSPair;
|
||||
readonly white: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly gray: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly grey: CSPair;
|
||||
|
||||
readonly blackBright: CSPair;
|
||||
readonly redBright: CSPair;
|
||||
readonly greenBright: CSPair;
|
||||
readonly yellowBright: CSPair;
|
||||
readonly blueBright: CSPair;
|
||||
readonly cyanBright: CSPair;
|
||||
readonly magentaBright: CSPair;
|
||||
readonly whiteBright: CSPair;
|
||||
}
|
||||
|
||||
interface BackgroundColor {
|
||||
readonly bgBlack: CSPair;
|
||||
readonly bgRed: CSPair;
|
||||
readonly bgGreen: CSPair;
|
||||
readonly bgYellow: CSPair;
|
||||
readonly bgBlue: CSPair;
|
||||
readonly bgCyan: CSPair;
|
||||
readonly bgMagenta: CSPair;
|
||||
readonly bgWhite: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGray: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGrey: CSPair;
|
||||
|
||||
readonly bgBlackBright: CSPair;
|
||||
readonly bgRedBright: CSPair;
|
||||
readonly bgGreenBright: CSPair;
|
||||
readonly bgYellowBright: CSPair;
|
||||
readonly bgBlueBright: CSPair;
|
||||
readonly bgCyanBright: CSPair;
|
||||
readonly bgMagentaBright: CSPair;
|
||||
readonly bgWhiteBright: CSPair;
|
||||
}
|
||||
}
|
||||
|
||||
declare const ansiStyles: {
|
||||
readonly modifier: ansiStyles.Modifier;
|
||||
readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase;
|
||||
readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase;
|
||||
readonly codes: ReadonlyMap<number, number>;
|
||||
} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier;
|
||||
|
||||
export = ansiStyles;
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
export function byteLength(b64: string): number;
|
||||
export function toByteArray(b64: string): Uint8Array;
|
||||
export function fromByteArray(uint8: Uint8Array): string;
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
declare const binaryExtensionsJson: readonly string[];
|
||||
|
||||
export = binaryExtensionsJson;
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
/**
|
||||
List of binary file extensions.
|
||||
|
||||
@example
|
||||
```
|
||||
import binaryExtensions = require('binary-extensions');
|
||||
|
||||
console.log(binaryExtensions);
|
||||
//=> ['3ds', '3g2', …]
|
||||
```
|
||||
*/
|
||||
declare const binaryExtensions: readonly string[];
|
||||
|
||||
export = binaryExtensions;
|
||||
-194
@@ -1,194 +0,0 @@
|
||||
export class Buffer extends Uint8Array {
|
||||
length: number
|
||||
write(string: string, offset?: number, length?: number, encoding?: string): number;
|
||||
toString(encoding?: string, start?: number, end?: number): string;
|
||||
toJSON(): { type: 'Buffer', data: any[] };
|
||||
equals(otherBuffer: Buffer): boolean;
|
||||
compare(otherBuffer: Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
|
||||
copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
||||
slice(start?: number, end?: number): Buffer;
|
||||
writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readUInt8(offset: number, noAssert?: boolean): number;
|
||||
readUInt16LE(offset: number, noAssert?: boolean): number;
|
||||
readUInt16BE(offset: number, noAssert?: boolean): number;
|
||||
readUInt32LE(offset: number, noAssert?: boolean): number;
|
||||
readUInt32BE(offset: number, noAssert?: boolean): number;
|
||||
readBigUInt64LE(offset: number): BigInt;
|
||||
readBigUInt64BE(offset: number): BigInt;
|
||||
readInt8(offset: number, noAssert?: boolean): number;
|
||||
readInt16LE(offset: number, noAssert?: boolean): number;
|
||||
readInt16BE(offset: number, noAssert?: boolean): number;
|
||||
readInt32LE(offset: number, noAssert?: boolean): number;
|
||||
readInt32BE(offset: number, noAssert?: boolean): number;
|
||||
readBigInt64LE(offset: number): BigInt;
|
||||
readBigInt64BE(offset: number): BigInt;
|
||||
readFloatLE(offset: number, noAssert?: boolean): number;
|
||||
readFloatBE(offset: number, noAssert?: boolean): number;
|
||||
readDoubleLE(offset: number, noAssert?: boolean): number;
|
||||
readDoubleBE(offset: number, noAssert?: boolean): number;
|
||||
reverse(): this;
|
||||
swap16(): Buffer;
|
||||
swap32(): Buffer;
|
||||
swap64(): Buffer;
|
||||
writeUInt8(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeUInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeUInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeUInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeUInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeBigUInt64LE(value: number, offset: number): BigInt;
|
||||
writeBigUInt64BE(value: number, offset: number): BigInt;
|
||||
writeInt8(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeBigInt64LE(value: number, offset: number): BigInt;
|
||||
writeBigInt64BE(value: number, offset: number): BigInt;
|
||||
writeFloatLE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeFloatBE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
|
||||
fill(value: any, offset?: number, end?: number): this;
|
||||
indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
||||
lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
||||
includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean;
|
||||
|
||||
/**
|
||||
* Allocates a new buffer containing the given {str}.
|
||||
*
|
||||
* @param str String to store in buffer.
|
||||
* @param encoding encoding to use, optional. Default is 'utf8'
|
||||
*/
|
||||
constructor (str: string, encoding?: string);
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets.
|
||||
*
|
||||
* @param size count of octets to allocate.
|
||||
*/
|
||||
constructor (size: number);
|
||||
/**
|
||||
* Allocates a new buffer containing the given {array} of octets.
|
||||
*
|
||||
* @param array The octets to store.
|
||||
*/
|
||||
constructor (array: Uint8Array);
|
||||
/**
|
||||
* Produces a Buffer backed by the same allocated memory as
|
||||
* the given {ArrayBuffer}.
|
||||
*
|
||||
*
|
||||
* @param arrayBuffer The ArrayBuffer with which to share memory.
|
||||
*/
|
||||
constructor (arrayBuffer: ArrayBuffer);
|
||||
/**
|
||||
* Allocates a new buffer containing the given {array} of octets.
|
||||
*
|
||||
* @param array The octets to store.
|
||||
*/
|
||||
constructor (array: any[]);
|
||||
/**
|
||||
* Copies the passed {buffer} data onto a new {Buffer} instance.
|
||||
*
|
||||
* @param buffer The buffer to copy.
|
||||
*/
|
||||
constructor (buffer: Buffer);
|
||||
prototype: Buffer;
|
||||
/**
|
||||
* Allocates a new Buffer using an {array} of octets.
|
||||
*
|
||||
* @param array
|
||||
*/
|
||||
static from(array: any[]): Buffer;
|
||||
/**
|
||||
* When passed a reference to the .buffer property of a TypedArray instance,
|
||||
* the newly created Buffer will share the same allocated memory as the TypedArray.
|
||||
* The optional {byteOffset} and {length} arguments specify a memory range
|
||||
* within the {arrayBuffer} that will be shared by the Buffer.
|
||||
*
|
||||
* @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer()
|
||||
* @param byteOffset
|
||||
* @param length
|
||||
*/
|
||||
static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
||||
/**
|
||||
* Copies the passed {buffer} data onto a new Buffer instance.
|
||||
*
|
||||
* @param buffer
|
||||
*/
|
||||
static from(buffer: Buffer | Uint8Array): Buffer;
|
||||
/**
|
||||
* Creates a new Buffer containing the given JavaScript string {str}.
|
||||
* If provided, the {encoding} parameter identifies the character encoding.
|
||||
* If not provided, {encoding} defaults to 'utf8'.
|
||||
*
|
||||
* @param str
|
||||
*/
|
||||
static from(str: string, encoding?: string): Buffer;
|
||||
/**
|
||||
* Returns true if {obj} is a Buffer
|
||||
*
|
||||
* @param obj object to test.
|
||||
*/
|
||||
static isBuffer(obj: any): obj is Buffer;
|
||||
/**
|
||||
* Returns true if {encoding} is a valid encoding argument.
|
||||
* Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
||||
*
|
||||
* @param encoding string to test.
|
||||
*/
|
||||
static isEncoding(encoding: string): boolean;
|
||||
/**
|
||||
* Gives the actual byte length of a string. encoding defaults to 'utf8'.
|
||||
* This is not the same as String.prototype.length since that returns the number of characters in a string.
|
||||
*
|
||||
* @param string string to test.
|
||||
* @param encoding encoding used to evaluate (defaults to 'utf8')
|
||||
*/
|
||||
static byteLength(string: string, encoding?: string): number;
|
||||
/**
|
||||
* Returns a buffer which is the result of concatenating all the buffers in the list together.
|
||||
*
|
||||
* If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
|
||||
* If the list has exactly one item, then the first item of the list is returned.
|
||||
* If the list has more than one item, then a new Buffer is created.
|
||||
*
|
||||
* @param list An array of Buffer objects to concatenate
|
||||
* @param totalLength Total length of the buffers when concatenated.
|
||||
* If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
|
||||
*/
|
||||
static concat(list: Uint8Array[], totalLength?: number): Buffer;
|
||||
/**
|
||||
* The same as buf1.compare(buf2).
|
||||
*/
|
||||
static compare(buf1: Uint8Array, buf2: Uint8Array): number;
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets.
|
||||
*
|
||||
* @param size count of octets to allocate.
|
||||
* @param fill if specified, buffer will be initialized by calling buf.fill(fill).
|
||||
* If parameter is omitted, buffer will be filled with zeros.
|
||||
* @param encoding encoding used for call to buf.fill while initializing
|
||||
*/
|
||||
static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer;
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
|
||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
||||
*
|
||||
* @param size count of octets to allocate
|
||||
*/
|
||||
static allocUnsafe(size: number): Buffer;
|
||||
/**
|
||||
* Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
|
||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
||||
*
|
||||
* @param size count of octets to allocate
|
||||
*/
|
||||
static allocUnsafeSlow(size: number): Buffer;
|
||||
}
|
||||
Loaded 100 of 321 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user