mirror of
https://github.com/github/codeql-action.git
synced 2026-05-07 22:30:44 +00:00
merge chris
This commit is contained in:
+8
@@ -2,7 +2,11 @@
|
||||
"_args": [
|
||||
[
|
||||
"@types/color-name@1.1.1",
|
||||
<<<<<<< HEAD
|
||||
"/home/marco/repos/github/codeql-action"
|
||||
=======
|
||||
"/home/chris/src/github.com/github/codeql-action"
|
||||
>>>>>>> origin/results-cache-test
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
@@ -34,7 +38,11 @@
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
|
||||
"_spec": "1.1.1",
|
||||
<<<<<<< HEAD
|
||||
"_where": "/home/marco/repos/github/codeql-action",
|
||||
=======
|
||||
"_where": "/home/chris/src/github.com/github/codeql-action",
|
||||
>>>>>>> origin/results-cache-test
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
|
||||
+8
@@ -2,7 +2,11 @@
|
||||
"_args": [
|
||||
[
|
||||
"@types/events@3.0.0",
|
||||
<<<<<<< HEAD
|
||||
"/home/marco/repos/github/codeql-action"
|
||||
=======
|
||||
"/home/chris/src/github.com/github/codeql-action"
|
||||
>>>>>>> origin/results-cache-test
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
@@ -28,7 +32,11 @@
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz",
|
||||
"_spec": "3.0.0",
|
||||
<<<<<<< HEAD
|
||||
"_where": "/home/marco/repos/github/codeql-action",
|
||||
=======
|
||||
"_where": "/home/chris/src/github.com/github/codeql-action",
|
||||
>>>>>>> origin/results-cache-test
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
|
||||
+8
@@ -2,7 +2,11 @@
|
||||
"_args": [
|
||||
[
|
||||
"@types/glob@7.1.1",
|
||||
<<<<<<< HEAD
|
||||
"/home/marco/repos/github/codeql-action"
|
||||
=======
|
||||
"/home/chris/src/github.com/github/codeql-action"
|
||||
>>>>>>> origin/results-cache-test
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
@@ -28,7 +32,11 @@
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz",
|
||||
"_spec": "7.1.1",
|
||||
<<<<<<< HEAD
|
||||
"_where": "/home/marco/repos/github/codeql-action",
|
||||
=======
|
||||
"_where": "/home/chris/src/github.com/github/codeql-action",
|
||||
>>>>>>> origin/results-cache-test
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
|
||||
+8
@@ -2,7 +2,11 @@
|
||||
"_args": [
|
||||
[
|
||||
"@types/json-schema@7.0.6",
|
||||
<<<<<<< HEAD
|
||||
"/home/marco/repos/github/codeql-action"
|
||||
=======
|
||||
"/home/chris/src/github.com/github/codeql-action"
|
||||
>>>>>>> origin/results-cache-test
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
@@ -28,7 +32,11 @@
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz",
|
||||
"_spec": "7.0.6",
|
||||
<<<<<<< HEAD
|
||||
"_where": "/home/marco/repos/github/codeql-action",
|
||||
=======
|
||||
"_where": "/home/chris/src/github.com/github/codeql-action",
|
||||
>>>>>>> origin/results-cache-test
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
|
||||
+8
@@ -2,7 +2,11 @@
|
||||
"_args": [
|
||||
[
|
||||
"@types/json5@0.0.29",
|
||||
<<<<<<< HEAD
|
||||
"/home/marco/repos/github/codeql-action"
|
||||
=======
|
||||
"/home/chris/src/github.com/github/codeql-action"
|
||||
>>>>>>> origin/results-cache-test
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
@@ -28,7 +32,11 @@
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
||||
"_spec": "0.0.29",
|
||||
<<<<<<< HEAD
|
||||
"_where": "/home/marco/repos/github/codeql-action",
|
||||
=======
|
||||
"_where": "/home/chris/src/github.com/github/codeql-action",
|
||||
>>>>>>> origin/results-cache-test
|
||||
"author": {
|
||||
"name": "Jason Swearingen",
|
||||
"email": "https://jasonswearingen.github.io"
|
||||
|
||||
+21
-21
@@ -1,21 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
||||
|
||||
+3
-16
@@ -1,16 +1,3 @@
|
||||
# Installation
|
||||
> `npm install --save @types/jszip`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for JSZip ( http://stuk.github.com/jszip/ ).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jszip
|
||||
|
||||
Additional Details
|
||||
* Last updated: Mon, 20 May 2019 21:14:34 GMT
|
||||
* Dependencies: @types/node
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by mzeiher <https://github.com/mzeiher>, forabi <https://github.com/forabi>.
|
||||
This is a stub types definition for jszip (https://github.com/Stuk/jszip).
|
||||
|
||||
jszip provides its own type definitions, so you don't need @types/jszip installed!
|
||||
-260
@@ -1,260 +0,0 @@
|
||||
// Type definitions for JSZip 3.1
|
||||
// Project: http://stuk.github.com/jszip/, https://github.com/stuk/jszip
|
||||
// Definitions by: mzeiher <https://github.com/mzeiher>, forabi <https://github.com/forabi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
interface JSZipSupport {
|
||||
arraybuffer: boolean;
|
||||
uint8array: boolean;
|
||||
blob: boolean;
|
||||
nodebuffer: boolean;
|
||||
}
|
||||
|
||||
type Compression = 'STORE' | 'DEFLATE';
|
||||
|
||||
interface Metadata {
|
||||
percent: number;
|
||||
currentFile: string;
|
||||
}
|
||||
|
||||
type OnUpdateCallback = (metadata: Metadata) => void;
|
||||
|
||||
interface InputByType {
|
||||
base64: string;
|
||||
string: string;
|
||||
text: string;
|
||||
binarystring: string;
|
||||
array: number[];
|
||||
uint8array: Uint8Array;
|
||||
arraybuffer: ArrayBuffer;
|
||||
blob: Blob;
|
||||
stream: NodeJS.ReadableStream;
|
||||
}
|
||||
|
||||
interface OutputByType {
|
||||
base64: string;
|
||||
text: string;
|
||||
binarystring: string;
|
||||
array: number[];
|
||||
uint8array: Uint8Array;
|
||||
arraybuffer: ArrayBuffer;
|
||||
blob: Blob;
|
||||
nodebuffer: Buffer;
|
||||
}
|
||||
|
||||
type InputFileFormat = InputByType[keyof InputByType];
|
||||
|
||||
declare namespace JSZip {
|
||||
type InputType = keyof InputByType;
|
||||
|
||||
type OutputType = keyof OutputByType;
|
||||
|
||||
interface JSZipObject {
|
||||
name: string;
|
||||
dir: boolean;
|
||||
date: Date;
|
||||
comment: string;
|
||||
/** The UNIX permissions of the file, if any. */
|
||||
unixPermissions: number | string | null;
|
||||
/** The UNIX permissions of the file, if any. */
|
||||
dosPermissions: number | null;
|
||||
options: JSZipObjectOptions;
|
||||
|
||||
/**
|
||||
* Prepare the content in the asked type.
|
||||
* @param type the type of the result.
|
||||
* @param onUpdate a function to call on each internal update.
|
||||
* @return Promise the promise of the result.
|
||||
*/
|
||||
async<T extends OutputType>(type: T, onUpdate?: OnUpdateCallback): Promise<OutputByType[T]>;
|
||||
nodeStream(type?: 'nodestream', onUpdate?: OnUpdateCallback): NodeJS.ReadableStream;
|
||||
}
|
||||
|
||||
interface JSZipFileOptions {
|
||||
/** Set to `true` if the data is `base64` encoded. For example image data from a `<canvas>` element. Plain text and HTML do not need this option. */
|
||||
base64?: boolean;
|
||||
/**
|
||||
* Set to `true` if the data should be treated as raw content, `false` if this is a text. If `base64` is used,
|
||||
* this defaults to `true`, if the data is not a `string`, this will be set to `true`.
|
||||
*/
|
||||
binary?: boolean;
|
||||
/**
|
||||
* The last modification date, defaults to the current date.
|
||||
*/
|
||||
date?: Date;
|
||||
compression?: string;
|
||||
comment?: string;
|
||||
/** Set to `true` if (and only if) the input is a "binary string" and has already been prepared with a `0xFF` mask. */
|
||||
optimizedBinaryString?: boolean;
|
||||
/** Set to `true` if folders in the file path should be automatically created, otherwise there will only be virtual folders that represent the path to the file. */
|
||||
createFolders?: boolean;
|
||||
/** Set to `true` if this is a directory and content should be ignored. */
|
||||
dir?: boolean;
|
||||
|
||||
/** 6 bits number. The DOS permissions of the file, if any. */
|
||||
dosPermissions?: number | null;
|
||||
/**
|
||||
* 16 bits number. The UNIX permissions of the file, if any.
|
||||
* Also accepts a `string` representing the octal value: `"644"`, `"755"`, etc.
|
||||
*/
|
||||
unixPermissions?: number | string | null;
|
||||
}
|
||||
|
||||
interface JSZipObjectOptions {
|
||||
compression: Compression;
|
||||
}
|
||||
|
||||
interface JSZipGeneratorOptions<T extends OutputType = OutputType> {
|
||||
compression?: Compression;
|
||||
compressionOptions?: null | {
|
||||
level: number;
|
||||
};
|
||||
type?: T;
|
||||
comment?: string;
|
||||
/**
|
||||
* mime-type for the generated file.
|
||||
* Useful when you need to generate a file with a different extension, ie: “.ods”.
|
||||
* @default 'application/zip'
|
||||
*/
|
||||
mimeType?: string;
|
||||
encodeFileName?(filename: string): string;
|
||||
/** Stream the files and create file descriptors */
|
||||
streamFiles?: boolean;
|
||||
/** DOS (default) or UNIX */
|
||||
platform?: 'DOS' | 'UNIX';
|
||||
}
|
||||
|
||||
interface JSZipLoadOptions {
|
||||
base64?: boolean;
|
||||
checkCRC32?: boolean;
|
||||
optimizedBinaryString?: boolean;
|
||||
createFolders?: boolean;
|
||||
decodeFileName?(filenameBytes: Uint8Array): string;
|
||||
}
|
||||
}
|
||||
|
||||
interface JSZip {
|
||||
files: {[key: string]: JSZip.JSZipObject};
|
||||
|
||||
/**
|
||||
* Get a file from the archive
|
||||
*
|
||||
* @param Path relative path to file
|
||||
* @return File matching path, null if no file found
|
||||
*/
|
||||
file(path: string): JSZip.JSZipObject;
|
||||
|
||||
/**
|
||||
* Get files matching a RegExp from archive
|
||||
*
|
||||
* @param path RegExp to match
|
||||
* @return Return all matching files or an empty array
|
||||
*/
|
||||
file(path: RegExp): JSZip.JSZipObject[];
|
||||
|
||||
/**
|
||||
* Add a file to the archive
|
||||
*
|
||||
* @param path Relative path to file
|
||||
* @param data Content of the file
|
||||
* @param options Optional information about the file
|
||||
* @return JSZip object
|
||||
*/
|
||||
file<T extends JSZip.InputType>(path: string, data: InputByType[T] | Promise<InputByType[T]>, options?: JSZip.JSZipFileOptions): this;
|
||||
file<T extends JSZip.InputType>(path: string, data: null, options?: JSZip.JSZipFileOptions & { dir: true }): this;
|
||||
|
||||
/**
|
||||
* Returns an new JSZip instance with the given folder as root
|
||||
*
|
||||
* @param name Name of the folder
|
||||
* @return New JSZip object with the given folder as root or null
|
||||
*/
|
||||
folder(name: string): JSZip;
|
||||
|
||||
/**
|
||||
* Returns new JSZip instances with the matching folders as root
|
||||
*
|
||||
* @param name RegExp to match
|
||||
* @return New array of JSZipFile objects which match the RegExp
|
||||
*/
|
||||
folder(name: RegExp): JSZip.JSZipObject[];
|
||||
|
||||
/**
|
||||
* Call a callback function for each entry at this folder level.
|
||||
*
|
||||
* @param callback function
|
||||
*/
|
||||
forEach(callback: (relativePath: string, file: JSZip.JSZipObject) => void): void;
|
||||
|
||||
/**
|
||||
* Get all files which match the given filter function
|
||||
*
|
||||
* @param predicate Filter function
|
||||
* @return Array of matched elements
|
||||
*/
|
||||
filter(predicate: (relativePath: string, file: JSZip.JSZipObject) => boolean): JSZip.JSZipObject[];
|
||||
|
||||
/**
|
||||
* Removes the file or folder from the archive
|
||||
*
|
||||
* @param path Relative path of file or folder
|
||||
* @return Returns the JSZip instance
|
||||
*/
|
||||
remove(path: string): JSZip;
|
||||
|
||||
/**
|
||||
* Generates a new archive asynchronously
|
||||
*
|
||||
* @param options Optional options for the generator
|
||||
* @param onUpdate The optional function called on each internal update with the metadata.
|
||||
* @return The serialized archive
|
||||
*/
|
||||
generateAsync<T extends JSZip.OutputType>(options?: JSZip.JSZipGeneratorOptions<T>, onUpdate?: OnUpdateCallback): Promise<OutputByType[T]>;
|
||||
|
||||
/**
|
||||
* Generates a new archive asynchronously
|
||||
*
|
||||
* @param options Optional options for the generator
|
||||
* @param onUpdate The optional function called on each internal update with the metadata.
|
||||
* @return A Node.js `ReadableStream`
|
||||
*/
|
||||
generateNodeStream(options?: JSZip.JSZipGeneratorOptions<'nodebuffer'>, onUpdate?: OnUpdateCallback): NodeJS.ReadableStream;
|
||||
|
||||
/**
|
||||
* Deserialize zip file asynchronously
|
||||
*
|
||||
* @param data Serialized zip file
|
||||
* @param options Options for deserializing
|
||||
* @return Returns promise
|
||||
*/
|
||||
loadAsync(data: InputFileFormat, options?: JSZip.JSZipLoadOptions): Promise<JSZip>;
|
||||
|
||||
/**
|
||||
* Create JSZip instance
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create JSZip instance
|
||||
* If no parameters given an empty zip archive will be created
|
||||
*
|
||||
* @param data Serialized zip archive
|
||||
* @param options Description of the serialized zip archive
|
||||
*/
|
||||
new (data?: InputFileFormat, options?: JSZip.JSZipLoadOptions): this;
|
||||
|
||||
(): JSZip;
|
||||
|
||||
prototype: JSZip;
|
||||
support: JSZipSupport;
|
||||
external: {
|
||||
Promise: PromiseConstructorLike;
|
||||
};
|
||||
version: string;
|
||||
}
|
||||
|
||||
declare var JSZip: JSZip;
|
||||
|
||||
export = JSZip;
|
||||
+11
-60
@@ -1,63 +1,14 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@types/jszip@3.1.6",
|
||||
"/home/marco/repos/github/codeql-action"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@types/jszip@3.1.6",
|
||||
"_id": "@types/jszip@3.1.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-m8uFcI+O2EupCfbEVQWsBM/4nhbegjOHL7cQgBpM95FeF98kdFJXzy9/8yhx4b3lCRl/gMBhcvyh30Qt3X+XPQ==",
|
||||
"_location": "/@types/jszip",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@types/jszip@3.1.6",
|
||||
"name": "@types/jszip",
|
||||
"escapedName": "@types%2fjszip",
|
||||
"scope": "@types",
|
||||
"rawSpec": "3.1.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.1.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/jszip/-/jszip-3.1.6.tgz",
|
||||
"_spec": "3.1.6",
|
||||
"_where": "/home/marco/repos/github/codeql-action",
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "mzeiher",
|
||||
"url": "https://github.com/mzeiher"
|
||||
},
|
||||
{
|
||||
"name": "forabi",
|
||||
"url": "https://github.com/forabi"
|
||||
"version": "3.4.1",
|
||||
"typings": null,
|
||||
"description": "Stub TypeScript definitions entry for jszip, which provides its own types definitions",
|
||||
"main": "",
|
||||
"scripts": {},
|
||||
"author": "",
|
||||
"repository": "https://github.com/Stuk/jszip",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"jszip": "*"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
},
|
||||
"description": "TypeScript definitions for JSZip",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
|
||||
"license": "MIT",
|
||||
"main": "",
|
||||
"name": "@types/jszip",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/jszip"
|
||||
},
|
||||
"scripts": {},
|
||||
"typeScriptVersion": "2.3",
|
||||
"types": "index",
|
||||
"typesPublisherContentHash": "b39880f7d79a626d32182cc6886711e3db5e4728ace6005cbfd57457fee69d85",
|
||||
"version": "3.1.6"
|
||||
}
|
||||
}
|
||||
+20
-53
@@ -1,55 +1,22 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@types/long@4.0.0",
|
||||
"/home/marco/repos/github/codeql-action"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@types/long@4.0.0",
|
||||
"_id": "@types/long@4.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-1w52Nyx4Gq47uuu0EVcsHBxZFJgurQ+rTKS3qMHxR1GY2T8c2AJYd6vZoZ9q1rupaDjU0yT+Jc2XTyXkjeMA+Q==",
|
||||
"_location": "/@types/long",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@types/long@4.0.0",
|
||||
"name": "@types/long",
|
||||
"escapedName": "@types%2flong",
|
||||
"scope": "@types",
|
||||
"rawSpec": "4.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "4.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.0.tgz",
|
||||
"_spec": "4.0.0",
|
||||
"_where": "/home/marco/repos/github/codeql-action",
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Peter Kooijmans",
|
||||
"url": "https://github.com/peterkooijmans"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "TypeScript definitions for long.js",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
|
||||
"license": "MIT",
|
||||
"main": "",
|
||||
"name": "@types/long",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"typeScriptVersion": "2.0",
|
||||
"typesPublisherContentHash": "cc3246302180c8c161d2e2c0c3f0a419226efa475d2cd5afbe51986d60cd8287",
|
||||
"version": "4.0.0"
|
||||
}
|
||||
"version": "4.0.0",
|
||||
"description": "TypeScript definitions for long.js",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Peter Kooijmans",
|
||||
"url": "https://github.com/peterkooijmans",
|
||||
"githubUsername": "peterkooijmans"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"typesPublisherContentHash": "cc3246302180c8c161d2e2c0c3f0a419226efa475d2cd5afbe51986d60cd8287",
|
||||
"typeScriptVersion": "2.0"
|
||||
}
|
||||
+8
@@ -2,7 +2,11 @@
|
||||
"_args": [
|
||||
[
|
||||
"@types/minimatch@3.0.3",
|
||||
<<<<<<< HEAD
|
||||
"/home/marco/repos/github/codeql-action"
|
||||
=======
|
||||
"/home/chris/src/github.com/github/codeql-action"
|
||||
>>>>>>> origin/results-cache-test
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
@@ -28,7 +32,11 @@
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
|
||||
"_spec": "3.0.3",
|
||||
<<<<<<< HEAD
|
||||
"_where": "/home/marco/repos/github/codeql-action",
|
||||
=======
|
||||
"_where": "/home/chris/src/github.com/github/codeql-action",
|
||||
>>>>>>> origin/results-cache-test
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
|
||||
+12
-49
@@ -1,51 +1,14 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@types/nock@11.1.0",
|
||||
"/home/marco/repos/github/codeql-action"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@types/nock@11.1.0",
|
||||
"_id": "@types/nock@11.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-jI/ewavBQ7X5178262JQR0ewicPAcJhXS/iFaNJl0VHLfyosZ/kwSrsa6VNQNSO8i9d8SqdRgOtZSOKJ/+iNMw==",
|
||||
"_location": "/@types/nock",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@types/nock@11.1.0",
|
||||
"name": "@types/nock",
|
||||
"escapedName": "@types%2fnock",
|
||||
"scope": "@types",
|
||||
"rawSpec": "11.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "11.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/nock/-/nock-11.1.0.tgz",
|
||||
"_spec": "11.1.0",
|
||||
"_where": "/home/marco/repos/github/codeql-action",
|
||||
"author": "",
|
||||
"bugs": {
|
||||
"url": "https://github.com/nock/nock/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"nock": "*"
|
||||
},
|
||||
"description": "Stub TypeScript definitions entry for nock, which provides its own types definitions",
|
||||
"homepage": "https://github.com/nock/nock#readme",
|
||||
"license": "MIT",
|
||||
"main": "",
|
||||
"name": "@types/nock",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/nock/nock.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"typings": null,
|
||||
"version": "11.1.0"
|
||||
}
|
||||
"version": "11.1.0",
|
||||
"typings": null,
|
||||
"description": "Stub TypeScript definitions entry for nock, which provides its own types definitions",
|
||||
"main": "",
|
||||
"scripts": {},
|
||||
"author": "",
|
||||
"repository": "https://github.com/nock/nock",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"nock": "*"
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
# Installation
|
||||
> `npm install --save @types/node-fetch`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for node-fetch (https://github.com/bitinn/node-fetch).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Thu, 23 Apr 2020 19:30:58 GMT
|
||||
* Dependencies: [@types/form-data](https://npmjs.com/package/@types/form-data), [@types/node](https://npmjs.com/package/@types/node)
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Torsten Werner](https://github.com/torstenwerner), [Niklas Lindgren](https://github.com/nikcorg), [Vinay Bedre](https://github.com/vinaybedre), [Antonio Román](https://github.com/kyranet), [Andrew Leedham](https://github.com/AndrewLeedham), [Jason Li](https://github.com/JasonLi914), [Brandon Wilson](https://github.com/wilsonianb), [Steve Faulkner](https://github.com/southpolesteve), [ExE Boss](https://github.com/ExE-Boss), [Alex Savin](https://github.com/alexandrusavin), [Alexis Tyler](https://github.com/OmgImAlexis), and [Jakub Kisielewski](https://github.com/kbkk).
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// `AbortSignal` is defined here to prevent a dependency on a particular
|
||||
// implementation like the `abort-controller` package, and to avoid requiring
|
||||
// the `dom` library in `tsconfig.json`.
|
||||
|
||||
export interface AbortSignal {
|
||||
aborted: boolean;
|
||||
|
||||
addEventListener: (type: "abort", listener: ((this: AbortSignal, event: any) => any), options?: boolean | {
|
||||
capture?: boolean,
|
||||
once?: boolean,
|
||||
passive?: boolean
|
||||
}) => void;
|
||||
|
||||
removeEventListener: (type: "abort", listener: ((this: AbortSignal, event: any) => any), options?: boolean | {
|
||||
capture?: boolean
|
||||
}) => void;
|
||||
|
||||
dispatchEvent: (event: any) => boolean;
|
||||
|
||||
onabort?: null | ((this: AbortSignal, event: any) => void);
|
||||
}
|
||||
+223
@@ -0,0 +1,223 @@
|
||||
// Type definitions for node-fetch 2.5
|
||||
// Project: https://github.com/bitinn/node-fetch
|
||||
// Definitions by: Torsten Werner <https://github.com/torstenwerner>
|
||||
// Niklas Lindgren <https://github.com/nikcorg>
|
||||
// Vinay Bedre <https://github.com/vinaybedre>
|
||||
// Antonio Román <https://github.com/kyranet>
|
||||
// Andrew Leedham <https://github.com/AndrewLeedham>
|
||||
// Jason Li <https://github.com/JasonLi914>
|
||||
// Brandon Wilson <https://github.com/wilsonianb>
|
||||
// Steve Faulkner <https://github.com/southpolesteve>
|
||||
// ExE Boss <https://github.com/ExE-Boss>
|
||||
// Alex Savin <https://github.com/alexandrusavin>
|
||||
// Alexis Tyler <https://github.com/OmgImAlexis>
|
||||
// Jakub Kisielewski <https://github.com/kbkk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import FormData = require('form-data');
|
||||
import { Agent } from "http";
|
||||
import { URLSearchParams, URL } from "url";
|
||||
import { AbortSignal } from "./externals";
|
||||
|
||||
export class Request extends Body {
|
||||
constructor(input: RequestInfo, init?: RequestInit);
|
||||
clone(): Request;
|
||||
context: RequestContext;
|
||||
headers: Headers;
|
||||
method: string;
|
||||
redirect: RequestRedirect;
|
||||
referrer: string;
|
||||
url: string;
|
||||
|
||||
// node-fetch extensions to the whatwg/fetch spec
|
||||
agent?: Agent | ((parsedUrl: URL) => Agent);
|
||||
compress: boolean;
|
||||
counter: number;
|
||||
follow: number;
|
||||
hostname: string;
|
||||
port?: number;
|
||||
protocol: string;
|
||||
size: number;
|
||||
timeout: number;
|
||||
}
|
||||
|
||||
export interface RequestInit {
|
||||
// whatwg/fetch standard options
|
||||
body?: BodyInit;
|
||||
headers?: HeadersInit;
|
||||
method?: string;
|
||||
redirect?: RequestRedirect;
|
||||
signal?: AbortSignal | null;
|
||||
|
||||
// node-fetch extensions
|
||||
agent?: Agent | ((parsedUrl: URL) => Agent); // =null http.Agent instance, allows custom proxy, certificate etc.
|
||||
compress?: boolean; // =true support gzip/deflate content encoding. false to disable
|
||||
follow?: number; // =20 maximum redirect count. 0 to not follow redirect
|
||||
size?: number; // =0 maximum response body size in bytes. 0 to disable
|
||||
timeout?: number; // =0 req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies)
|
||||
|
||||
// node-fetch does not support mode, cache or credentials options
|
||||
}
|
||||
|
||||
export type RequestContext =
|
||||
"audio"
|
||||
| "beacon"
|
||||
| "cspreport"
|
||||
| "download"
|
||||
| "embed"
|
||||
| "eventsource"
|
||||
| "favicon"
|
||||
| "fetch"
|
||||
| "font"
|
||||
| "form"
|
||||
| "frame"
|
||||
| "hyperlink"
|
||||
| "iframe"
|
||||
| "image"
|
||||
| "imageset"
|
||||
| "import"
|
||||
| "internal"
|
||||
| "location"
|
||||
| "manifest"
|
||||
| "object"
|
||||
| "ping"
|
||||
| "plugin"
|
||||
| "prefetch"
|
||||
| "script"
|
||||
| "serviceworker"
|
||||
| "sharedworker"
|
||||
| "style"
|
||||
| "subresource"
|
||||
| "track"
|
||||
| "video"
|
||||
| "worker"
|
||||
| "xmlhttprequest"
|
||||
| "xslt";
|
||||
export type RequestMode = "cors" | "no-cors" | "same-origin";
|
||||
export type RequestRedirect = "error" | "follow" | "manual";
|
||||
export type RequestCredentials = "omit" | "include" | "same-origin";
|
||||
|
||||
export type RequestCache =
|
||||
"default"
|
||||
| "force-cache"
|
||||
| "no-cache"
|
||||
| "no-store"
|
||||
| "only-if-cached"
|
||||
| "reload";
|
||||
|
||||
export class Headers implements Iterable<[string, string]> {
|
||||
constructor(init?: HeadersInit);
|
||||
forEach(callback: (value: string, name: string) => void): void;
|
||||
append(name: string, value: string): void;
|
||||
delete(name: string): void;
|
||||
get(name: string): string | null;
|
||||
has(name: string): boolean;
|
||||
raw(): { [k: string]: string[] };
|
||||
set(name: string, value: string): void;
|
||||
|
||||
// Iterable methods
|
||||
entries(): IterableIterator<[string, string]>;
|
||||
keys(): IterableIterator<string>;
|
||||
values(): IterableIterator<[string]>;
|
||||
[Symbol.iterator](): Iterator<[string, string]>;
|
||||
}
|
||||
|
||||
type BlobPart = ArrayBuffer | ArrayBufferView | Blob | string;
|
||||
|
||||
interface BlobOptions {
|
||||
type?: string;
|
||||
endings?: "transparent" | "native";
|
||||
}
|
||||
|
||||
export class Blob {
|
||||
constructor(blobParts?: BlobPart[], options?: BlobOptions);
|
||||
readonly type: string;
|
||||
readonly size: number;
|
||||
slice(start?: number, end?: number): Blob;
|
||||
}
|
||||
|
||||
export class Body {
|
||||
constructor(body?: any, opts?: { size?: number; timeout?: number });
|
||||
arrayBuffer(): Promise<ArrayBuffer>;
|
||||
blob(): Promise<Blob>;
|
||||
body: NodeJS.ReadableStream;
|
||||
bodyUsed: boolean;
|
||||
buffer(): Promise<Buffer>;
|
||||
json(): Promise<any>;
|
||||
size: number;
|
||||
text(): Promise<string>;
|
||||
textConverted(): Promise<string>;
|
||||
timeout: number;
|
||||
}
|
||||
|
||||
interface SystemError extends Error {
|
||||
code?: string;
|
||||
}
|
||||
|
||||
export class FetchError extends Error {
|
||||
name: "FetchError";
|
||||
constructor(message: string, type: string, systemError?: SystemError);
|
||||
type: string;
|
||||
code?: string;
|
||||
errno?: string;
|
||||
}
|
||||
|
||||
export class Response extends Body {
|
||||
constructor(body?: BodyInit, init?: ResponseInit);
|
||||
static error(): Response;
|
||||
static redirect(url: string, status: number): Response;
|
||||
clone(): Response;
|
||||
headers: Headers;
|
||||
ok: boolean;
|
||||
redirected: boolean;
|
||||
status: number;
|
||||
statusText: string;
|
||||
type: ResponseType;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export type ResponseType =
|
||||
"basic"
|
||||
| "cors"
|
||||
| "default"
|
||||
| "error"
|
||||
| "opaque"
|
||||
| "opaqueredirect";
|
||||
|
||||
export interface ResponseInit {
|
||||
headers?: HeadersInit;
|
||||
size?: number;
|
||||
status?: number;
|
||||
statusText?: string;
|
||||
timeout?: number;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
interface URLLike {
|
||||
href: string;
|
||||
}
|
||||
|
||||
export type HeadersInit = Headers | string[][] | { [key: string]: string };
|
||||
// HeaderInit is exported to support backwards compatibility. See PR #34382
|
||||
export type HeaderInit = HeadersInit;
|
||||
export type BodyInit =
|
||||
ArrayBuffer
|
||||
| ArrayBufferView
|
||||
| NodeJS.ReadableStream
|
||||
| string
|
||||
| URLSearchParams
|
||||
| FormData;
|
||||
export type RequestInfo = string | URLLike | Request;
|
||||
|
||||
declare function fetch(
|
||||
url: RequestInfo,
|
||||
init?: RequestInit
|
||||
): Promise<Response>;
|
||||
|
||||
declare namespace fetch {
|
||||
function isRedirect(code: number): boolean;
|
||||
}
|
||||
|
||||
export default fetch;
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
+351
@@ -0,0 +1,351 @@
|
||||
# Form-Data [](https://www.npmjs.com/package/form-data) [](https://gitter.im/form-data/form-data)
|
||||
|
||||
A library to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications.
|
||||
|
||||
The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd].
|
||||
|
||||
[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface
|
||||
|
||||
[](https://travis-ci.org/form-data/form-data)
|
||||
[](https://travis-ci.org/form-data/form-data)
|
||||
[](https://travis-ci.org/form-data/form-data)
|
||||
|
||||
[](https://coveralls.io/github/form-data/form-data?branch=master)
|
||||
[](https://david-dm.org/form-data/form-data)
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm install --save form-data
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
In this example we are constructing a form with 3 fields that contain a string,
|
||||
a buffer and a file stream.
|
||||
|
||||
``` javascript
|
||||
var FormData = require('form-data');
|
||||
var fs = require('fs');
|
||||
|
||||
var form = new FormData();
|
||||
form.append('my_field', 'my value');
|
||||
form.append('my_buffer', new Buffer(10));
|
||||
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
|
||||
```
|
||||
|
||||
Also you can use http-response stream:
|
||||
|
||||
``` javascript
|
||||
var FormData = require('form-data');
|
||||
var http = require('http');
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
http.request('http://nodejs.org/images/logo.png', function(response) {
|
||||
form.append('my_field', 'my value');
|
||||
form.append('my_buffer', new Buffer(10));
|
||||
form.append('my_logo', response);
|
||||
});
|
||||
```
|
||||
|
||||
Or @mikeal's [request](https://github.com/request/request) stream:
|
||||
|
||||
``` javascript
|
||||
var FormData = require('form-data');
|
||||
var request = require('request');
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
form.append('my_field', 'my value');
|
||||
form.append('my_buffer', new Buffer(10));
|
||||
form.append('my_logo', request('http://nodejs.org/images/logo.png'));
|
||||
```
|
||||
|
||||
In order to submit this form to a web application, call ```submit(url, [callback])``` method:
|
||||
|
||||
``` javascript
|
||||
form.submit('http://example.org/', function(err, res) {
|
||||
// res – response object (http.IncomingMessage) //
|
||||
res.resume();
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods.
|
||||
|
||||
### Custom options
|
||||
|
||||
You can provide custom options, such as `maxDataSize`:
|
||||
|
||||
``` javascript
|
||||
var FormData = require('form-data');
|
||||
|
||||
var form = new FormData({ maxDataSize: 20971520 });
|
||||
form.append('my_field', 'my value');
|
||||
form.append('my_buffer', /* something big */);
|
||||
```
|
||||
|
||||
List of available options could be found in [combined-stream](https://github.com/felixge/node-combined-stream/blob/master/lib/combined_stream.js#L7-L15)
|
||||
|
||||
### Alternative submission methods
|
||||
|
||||
You can use node's http client interface:
|
||||
|
||||
``` javascript
|
||||
var http = require('http');
|
||||
|
||||
var request = http.request({
|
||||
method: 'post',
|
||||
host: 'example.org',
|
||||
path: '/upload',
|
||||
headers: form.getHeaders()
|
||||
});
|
||||
|
||||
form.pipe(request);
|
||||
|
||||
request.on('response', function(res) {
|
||||
console.log(res.statusCode);
|
||||
});
|
||||
```
|
||||
|
||||
Or if you would prefer the `'Content-Length'` header to be set for you:
|
||||
|
||||
``` javascript
|
||||
form.submit('example.org/upload', function(err, res) {
|
||||
console.log(res.statusCode);
|
||||
});
|
||||
```
|
||||
|
||||
To use custom headers and pre-known length in parts:
|
||||
|
||||
``` javascript
|
||||
var CRLF = '\r\n';
|
||||
var form = new FormData();
|
||||
|
||||
var options = {
|
||||
header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF,
|
||||
knownLength: 1
|
||||
};
|
||||
|
||||
form.append('my_buffer', buffer, options);
|
||||
|
||||
form.submit('http://example.com/', function(err, res) {
|
||||
if (err) throw err;
|
||||
console.log('Done');
|
||||
});
|
||||
```
|
||||
|
||||
Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually:
|
||||
|
||||
``` javascript
|
||||
someModule.stream(function(err, stdout, stderr) {
|
||||
if (err) throw err;
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
form.append('file', stdout, {
|
||||
filename: 'unicycle.jpg', // ... or:
|
||||
filepath: 'photos/toys/unicycle.jpg',
|
||||
contentType: 'image/jpeg',
|
||||
knownLength: 19806
|
||||
});
|
||||
|
||||
form.submit('http://example.com/', function(err, res) {
|
||||
if (err) throw err;
|
||||
console.log('Done');
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
The `filepath` property overrides `filename` and may contain a relative path. This is typically used when uploading [multiple files from a directory](https://wicg.github.io/entries-api/#dom-htmlinputelement-webkitdirectory).
|
||||
|
||||
For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter:
|
||||
|
||||
``` javascript
|
||||
form.submit({
|
||||
host: 'example.com',
|
||||
path: '/probably.php?extra=params',
|
||||
auth: 'username:password'
|
||||
}, function(err, res) {
|
||||
console.log(res.statusCode);
|
||||
});
|
||||
```
|
||||
|
||||
In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`:
|
||||
|
||||
``` javascript
|
||||
form.submit({
|
||||
host: 'example.com',
|
||||
path: '/surelynot.php',
|
||||
headers: {'x-test-header': 'test-header-value'}
|
||||
}, function(err, res) {
|
||||
console.log(res.statusCode);
|
||||
});
|
||||
```
|
||||
|
||||
### Methods
|
||||
|
||||
- [_Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] )](https://github.com/form-data/form-data#void-append-string-field-mixed-value--mixed-options-).
|
||||
- [_Headers_ getHeaders( [**Headers** _userHeaders_] )](https://github.com/form-data/form-data#array-getheaders-array-userheaders-)
|
||||
- [_String_ getBoundary()](https://github.com/form-data/form-data#string-getboundary)
|
||||
- [_Buffer_ getBuffer()](https://github.com/form-data/form-data#buffer-getbuffer)
|
||||
- [_Integer_ getLengthSync()](https://github.com/form-data/form-data#integer-getlengthsync)
|
||||
- [_Integer_ getLength( **function** _callback_ )](https://github.com/form-data/form-data#integer-getlength-function-callback-)
|
||||
- [_Boolean_ hasKnownLength()](https://github.com/form-data/form-data#boolean-hasknownlength)
|
||||
- [_Request_ submit( _params_, **function** _callback_ )](https://github.com/form-data/form-data#request-submit-params-function-callback-)
|
||||
- [_String_ toString()](https://github.com/form-data/form-data#string-tostring)
|
||||
|
||||
#### _Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] )
|
||||
Append data to the form. You can submit about any format (string, integer, boolean, buffer, etc.). However, Arrays are not supported and need to be turned into strings by the user.
|
||||
```javascript
|
||||
var form = new FormData();
|
||||
form.append( 'my_string', 'my value' );
|
||||
form.append( 'my_integer', 1 );
|
||||
form.append( 'my_boolean', true );
|
||||
form.append( 'my_buffer', new Buffer(10) );
|
||||
form.append( 'my_array_as_json', JSON.stringify( ['bird','cute'] ) )
|
||||
```
|
||||
|
||||
You may provide a string for options, or an object.
|
||||
```javascript
|
||||
// Set filename by providing a string for options
|
||||
form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), 'bar.jpg' );
|
||||
|
||||
// provide an object.
|
||||
form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), {filename: 'bar.jpg', contentType: 'image/jpeg', knownLength: 19806} );
|
||||
```
|
||||
|
||||
#### _Headers_ getHeaders( [**Headers** _userHeaders_] )
|
||||
This method ads the correct `content-type` header to the provided array of `userHeaders`.
|
||||
|
||||
#### _String_ getBoundary()
|
||||
Return the boundary of the formData. A boundary consists of 26 `-` followed by 24 numbers
|
||||
for example:
|
||||
```javascript
|
||||
--------------------------515890814546601021194782
|
||||
```
|
||||
_Note: The boundary must be unique and may not appear in the data._
|
||||
|
||||
#### _Buffer_ getBuffer()
|
||||
Return the full formdata request package, as a Buffer. You can insert this Buffer in e.g. Axios to send multipart data.
|
||||
```javascript
|
||||
var form = new FormData();
|
||||
form.append( 'my_buffer', Buffer.from([0x4a,0x42,0x20,0x52,0x6f,0x63,0x6b,0x73]) );
|
||||
form.append( 'my_file', fs.readFileSync('/foo/bar.jpg') );
|
||||
|
||||
axios.post( 'https://example.com/path/to/api',
|
||||
form.getBuffer(),
|
||||
form.getHeaders()
|
||||
)
|
||||
```
|
||||
**Note:** Because the output is of type Buffer, you can only append types that are accepted by Buffer: *string, Buffer, ArrayBuffer, Array, or Array-like Object*. A ReadStream for example will result in an error.
|
||||
|
||||
#### _Integer_ getLengthSync()
|
||||
Same as `getLength` but synchronous.
|
||||
|
||||
_Note: getLengthSync __doesn't__ calculate streams length._
|
||||
|
||||
#### _Integer_ getLength( **function** _callback_ )
|
||||
Returns the `Content-Length` async. The callback is used to handle errors and continue once the length has been calculated
|
||||
```javascript
|
||||
this.getLength(function(err, length) {
|
||||
if (err) {
|
||||
this._error(err);
|
||||
return;
|
||||
}
|
||||
|
||||
// add content length
|
||||
request.setHeader('Content-Length', length);
|
||||
|
||||
...
|
||||
}.bind(this));
|
||||
```
|
||||
|
||||
#### _Boolean_ hasKnownLength()
|
||||
Checks if the length of added values is known.
|
||||
|
||||
#### _Request_ submit( _params_, **function** _callback_ )
|
||||
Submit the form to a web application.
|
||||
```javascript
|
||||
var form = new FormData();
|
||||
form.append( 'my_string', 'Hello World' );
|
||||
|
||||
form.submit( 'http://example.com/', function(err, res) {
|
||||
// res – response object (http.IncomingMessage) //
|
||||
res.resume();
|
||||
} );
|
||||
```
|
||||
|
||||
#### _String_ toString()
|
||||
Returns the form data as a string. Don't use this if you are sending files or buffers, use `getBuffer()` instead.
|
||||
|
||||
### Integration with other libraries
|
||||
|
||||
#### Request
|
||||
|
||||
Form submission using [request](https://github.com/request/request):
|
||||
|
||||
```javascript
|
||||
var formData = {
|
||||
my_field: 'my_value',
|
||||
my_file: fs.createReadStream(__dirname + '/unicycle.jpg'),
|
||||
};
|
||||
|
||||
request.post({url:'http://service.com/upload', formData: formData}, function(err, httpResponse, body) {
|
||||
if (err) {
|
||||
return console.error('upload failed:', err);
|
||||
}
|
||||
console.log('Upload successful! Server responded with:', body);
|
||||
});
|
||||
```
|
||||
|
||||
For more details see [request readme](https://github.com/request/request#multipartform-data-multipart-form-uploads).
|
||||
|
||||
#### node-fetch
|
||||
|
||||
You can also submit a form using [node-fetch](https://github.com/bitinn/node-fetch):
|
||||
|
||||
```javascript
|
||||
var form = new FormData();
|
||||
|
||||
form.append('a', 1);
|
||||
|
||||
fetch('http://example.com', { method: 'POST', body: form })
|
||||
.then(function(res) {
|
||||
return res.json();
|
||||
}).then(function(json) {
|
||||
console.log(json);
|
||||
});
|
||||
```
|
||||
|
||||
#### axios
|
||||
|
||||
In Node.js you can post a file using [axios](https://github.com/axios/axios):
|
||||
```javascript
|
||||
const form = new FormData();
|
||||
const stream = fs.createReadStream(PATH_TO_FILE);
|
||||
|
||||
form.append('image', stream);
|
||||
|
||||
// In Node.js environment you need to set boundary in the header field 'Content-Type' by calling method `getHeaders`
|
||||
const formHeaders = form.getHeaders();
|
||||
|
||||
axios.post('http://example.com', form, {
|
||||
headers: {
|
||||
...formHeaders,
|
||||
},
|
||||
})
|
||||
.then(response => response)
|
||||
.catch(error => error)
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround.
|
||||
- Starting version `2.x` FormData has dropped support for `node@0.10.x`.
|
||||
- Starting version `3.x` FormData has dropped support for `node@4.x`.
|
||||
|
||||
## License
|
||||
|
||||
Form-Data is released under the [MIT](License) license.
|
||||
+351
@@ -0,0 +1,351 @@
|
||||
# Form-Data [](https://www.npmjs.com/package/form-data) [](https://gitter.im/form-data/form-data)
|
||||
|
||||
A library to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications.
|
||||
|
||||
The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd].
|
||||
|
||||
[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface
|
||||
|
||||
[](https://travis-ci.org/form-data/form-data)
|
||||
[](https://travis-ci.org/form-data/form-data)
|
||||
[](https://travis-ci.org/form-data/form-data)
|
||||
|
||||
[](https://coveralls.io/github/form-data/form-data?branch=master)
|
||||
[](https://david-dm.org/form-data/form-data)
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm install --save form-data
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
In this example we are constructing a form with 3 fields that contain a string,
|
||||
a buffer and a file stream.
|
||||
|
||||
``` javascript
|
||||
var FormData = require('form-data');
|
||||
var fs = require('fs');
|
||||
|
||||
var form = new FormData();
|
||||
form.append('my_field', 'my value');
|
||||
form.append('my_buffer', new Buffer(10));
|
||||
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
|
||||
```
|
||||
|
||||
Also you can use http-response stream:
|
||||
|
||||
``` javascript
|
||||
var FormData = require('form-data');
|
||||
var http = require('http');
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
http.request('http://nodejs.org/images/logo.png', function(response) {
|
||||
form.append('my_field', 'my value');
|
||||
form.append('my_buffer', new Buffer(10));
|
||||
form.append('my_logo', response);
|
||||
});
|
||||
```
|
||||
|
||||
Or @mikeal's [request](https://github.com/request/request) stream:
|
||||
|
||||
``` javascript
|
||||
var FormData = require('form-data');
|
||||
var request = require('request');
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
form.append('my_field', 'my value');
|
||||
form.append('my_buffer', new Buffer(10));
|
||||
form.append('my_logo', request('http://nodejs.org/images/logo.png'));
|
||||
```
|
||||
|
||||
In order to submit this form to a web application, call ```submit(url, [callback])``` method:
|
||||
|
||||
``` javascript
|
||||
form.submit('http://example.org/', function(err, res) {
|
||||
// res – response object (http.IncomingMessage) //
|
||||
res.resume();
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods.
|
||||
|
||||
### Custom options
|
||||
|
||||
You can provide custom options, such as `maxDataSize`:
|
||||
|
||||
``` javascript
|
||||
var FormData = require('form-data');
|
||||
|
||||
var form = new FormData({ maxDataSize: 20971520 });
|
||||
form.append('my_field', 'my value');
|
||||
form.append('my_buffer', /* something big */);
|
||||
```
|
||||
|
||||
List of available options could be found in [combined-stream](https://github.com/felixge/node-combined-stream/blob/master/lib/combined_stream.js#L7-L15)
|
||||
|
||||
### Alternative submission methods
|
||||
|
||||
You can use node's http client interface:
|
||||
|
||||
``` javascript
|
||||
var http = require('http');
|
||||
|
||||
var request = http.request({
|
||||
method: 'post',
|
||||
host: 'example.org',
|
||||
path: '/upload',
|
||||
headers: form.getHeaders()
|
||||
});
|
||||
|
||||
form.pipe(request);
|
||||
|
||||
request.on('response', function(res) {
|
||||
console.log(res.statusCode);
|
||||
});
|
||||
```
|
||||
|
||||
Or if you would prefer the `'Content-Length'` header to be set for you:
|
||||
|
||||
``` javascript
|
||||
form.submit('example.org/upload', function(err, res) {
|
||||
console.log(res.statusCode);
|
||||
});
|
||||
```
|
||||
|
||||
To use custom headers and pre-known length in parts:
|
||||
|
||||
``` javascript
|
||||
var CRLF = '\r\n';
|
||||
var form = new FormData();
|
||||
|
||||
var options = {
|
||||
header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF,
|
||||
knownLength: 1
|
||||
};
|
||||
|
||||
form.append('my_buffer', buffer, options);
|
||||
|
||||
form.submit('http://example.com/', function(err, res) {
|
||||
if (err) throw err;
|
||||
console.log('Done');
|
||||
});
|
||||
```
|
||||
|
||||
Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually:
|
||||
|
||||
``` javascript
|
||||
someModule.stream(function(err, stdout, stderr) {
|
||||
if (err) throw err;
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
form.append('file', stdout, {
|
||||
filename: 'unicycle.jpg', // ... or:
|
||||
filepath: 'photos/toys/unicycle.jpg',
|
||||
contentType: 'image/jpeg',
|
||||
knownLength: 19806
|
||||
});
|
||||
|
||||
form.submit('http://example.com/', function(err, res) {
|
||||
if (err) throw err;
|
||||
console.log('Done');
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
The `filepath` property overrides `filename` and may contain a relative path. This is typically used when uploading [multiple files from a directory](https://wicg.github.io/entries-api/#dom-htmlinputelement-webkitdirectory).
|
||||
|
||||
For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter:
|
||||
|
||||
``` javascript
|
||||
form.submit({
|
||||
host: 'example.com',
|
||||
path: '/probably.php?extra=params',
|
||||
auth: 'username:password'
|
||||
}, function(err, res) {
|
||||
console.log(res.statusCode);
|
||||
});
|
||||
```
|
||||
|
||||
In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`:
|
||||
|
||||
``` javascript
|
||||
form.submit({
|
||||
host: 'example.com',
|
||||
path: '/surelynot.php',
|
||||
headers: {'x-test-header': 'test-header-value'}
|
||||
}, function(err, res) {
|
||||
console.log(res.statusCode);
|
||||
});
|
||||
```
|
||||
|
||||
### Methods
|
||||
|
||||
- [_Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] )](https://github.com/form-data/form-data#void-append-string-field-mixed-value--mixed-options-).
|
||||
- [_Headers_ getHeaders( [**Headers** _userHeaders_] )](https://github.com/form-data/form-data#array-getheaders-array-userheaders-)
|
||||
- [_String_ getBoundary()](https://github.com/form-data/form-data#string-getboundary)
|
||||
- [_Buffer_ getBuffer()](https://github.com/form-data/form-data#buffer-getbuffer)
|
||||
- [_Integer_ getLengthSync()](https://github.com/form-data/form-data#integer-getlengthsync)
|
||||
- [_Integer_ getLength( **function** _callback_ )](https://github.com/form-data/form-data#integer-getlength-function-callback-)
|
||||
- [_Boolean_ hasKnownLength()](https://github.com/form-data/form-data#boolean-hasknownlength)
|
||||
- [_Request_ submit( _params_, **function** _callback_ )](https://github.com/form-data/form-data#request-submit-params-function-callback-)
|
||||
- [_String_ toString()](https://github.com/form-data/form-data#string-tostring)
|
||||
|
||||
#### _Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] )
|
||||
Append data to the form. You can submit about any format (string, integer, boolean, buffer, etc.). However, Arrays are not supported and need to be turned into strings by the user.
|
||||
```javascript
|
||||
var form = new FormData();
|
||||
form.append( 'my_string', 'my value' );
|
||||
form.append( 'my_integer', 1 );
|
||||
form.append( 'my_boolean', true );
|
||||
form.append( 'my_buffer', new Buffer(10) );
|
||||
form.append( 'my_array_as_json', JSON.stringify( ['bird','cute'] ) )
|
||||
```
|
||||
|
||||
You may provide a string for options, or an object.
|
||||
```javascript
|
||||
// Set filename by providing a string for options
|
||||
form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), 'bar.jpg' );
|
||||
|
||||
// provide an object.
|
||||
form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), {filename: 'bar.jpg', contentType: 'image/jpeg', knownLength: 19806} );
|
||||
```
|
||||
|
||||
#### _Headers_ getHeaders( [**Headers** _userHeaders_] )
|
||||
This method ads the correct `content-type` header to the provided array of `userHeaders`.
|
||||
|
||||
#### _String_ getBoundary()
|
||||
Return the boundary of the formData. A boundary consists of 26 `-` followed by 24 numbers
|
||||
for example:
|
||||
```javascript
|
||||
--------------------------515890814546601021194782
|
||||
```
|
||||
_Note: The boundary must be unique and may not appear in the data._
|
||||
|
||||
#### _Buffer_ getBuffer()
|
||||
Return the full formdata request package, as a Buffer. You can insert this Buffer in e.g. Axios to send multipart data.
|
||||
```javascript
|
||||
var form = new FormData();
|
||||
form.append( 'my_buffer', Buffer.from([0x4a,0x42,0x20,0x52,0x6f,0x63,0x6b,0x73]) );
|
||||
form.append( 'my_file', fs.readFileSync('/foo/bar.jpg') );
|
||||
|
||||
axios.post( 'https://example.com/path/to/api',
|
||||
form.getBuffer(),
|
||||
form.getHeaders()
|
||||
)
|
||||
```
|
||||
**Note:** Because the output is of type Buffer, you can only append types that are accepted by Buffer: *string, Buffer, ArrayBuffer, Array, or Array-like Object*. A ReadStream for example will result in an error.
|
||||
|
||||
#### _Integer_ getLengthSync()
|
||||
Same as `getLength` but synchronous.
|
||||
|
||||
_Note: getLengthSync __doesn't__ calculate streams length._
|
||||
|
||||
#### _Integer_ getLength( **function** _callback_ )
|
||||
Returns the `Content-Length` async. The callback is used to handle errors and continue once the length has been calculated
|
||||
```javascript
|
||||
this.getLength(function(err, length) {
|
||||
if (err) {
|
||||
this._error(err);
|
||||
return;
|
||||
}
|
||||
|
||||
// add content length
|
||||
request.setHeader('Content-Length', length);
|
||||
|
||||
...
|
||||
}.bind(this));
|
||||
```
|
||||
|
||||
#### _Boolean_ hasKnownLength()
|
||||
Checks if the length of added values is known.
|
||||
|
||||
#### _Request_ submit( _params_, **function** _callback_ )
|
||||
Submit the form to a web application.
|
||||
```javascript
|
||||
var form = new FormData();
|
||||
form.append( 'my_string', 'Hello World' );
|
||||
|
||||
form.submit( 'http://example.com/', function(err, res) {
|
||||
// res – response object (http.IncomingMessage) //
|
||||
res.resume();
|
||||
} );
|
||||
```
|
||||
|
||||
#### _String_ toString()
|
||||
Returns the form data as a string. Don't use this if you are sending files or buffers, use `getBuffer()` instead.
|
||||
|
||||
### Integration with other libraries
|
||||
|
||||
#### Request
|
||||
|
||||
Form submission using [request](https://github.com/request/request):
|
||||
|
||||
```javascript
|
||||
var formData = {
|
||||
my_field: 'my_value',
|
||||
my_file: fs.createReadStream(__dirname + '/unicycle.jpg'),
|
||||
};
|
||||
|
||||
request.post({url:'http://service.com/upload', formData: formData}, function(err, httpResponse, body) {
|
||||
if (err) {
|
||||
return console.error('upload failed:', err);
|
||||
}
|
||||
console.log('Upload successful! Server responded with:', body);
|
||||
});
|
||||
```
|
||||
|
||||
For more details see [request readme](https://github.com/request/request#multipartform-data-multipart-form-uploads).
|
||||
|
||||
#### node-fetch
|
||||
|
||||
You can also submit a form using [node-fetch](https://github.com/bitinn/node-fetch):
|
||||
|
||||
```javascript
|
||||
var form = new FormData();
|
||||
|
||||
form.append('a', 1);
|
||||
|
||||
fetch('http://example.com', { method: 'POST', body: form })
|
||||
.then(function(res) {
|
||||
return res.json();
|
||||
}).then(function(json) {
|
||||
console.log(json);
|
||||
});
|
||||
```
|
||||
|
||||
#### axios
|
||||
|
||||
In Node.js you can post a file using [axios](https://github.com/axios/axios):
|
||||
```javascript
|
||||
const form = new FormData();
|
||||
const stream = fs.createReadStream(PATH_TO_FILE);
|
||||
|
||||
form.append('image', stream);
|
||||
|
||||
// In Node.js environment you need to set boundary in the header field 'Content-Type' by calling method `getHeaders`
|
||||
const formHeaders = form.getHeaders();
|
||||
|
||||
axios.post('http://example.com', form, {
|
||||
headers: {
|
||||
...formHeaders,
|
||||
},
|
||||
})
|
||||
.then(response => response)
|
||||
.catch(error => error)
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround.
|
||||
- Starting version `2.x` FormData has dropped support for `node@0.10.x`.
|
||||
- Starting version `3.x` FormData has dropped support for `node@4.x`.
|
||||
|
||||
## License
|
||||
|
||||
Form-Data is released under the [MIT](License) license.
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>
|
||||
// Leon Yu <https://github.com/leonyu>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Maple Miao <https://github.com/mapleeit>
|
||||
|
||||
/// <reference types="node" />
|
||||
import * as stream from 'stream';
|
||||
import * as http from 'http';
|
||||
|
||||
export = FormData;
|
||||
|
||||
// Extracted because @types/node doesn't export interfaces.
|
||||
interface ReadableOptions {
|
||||
highWaterMark?: number;
|
||||
encoding?: string;
|
||||
objectMode?: boolean;
|
||||
read?(this: stream.Readable, size: number): void;
|
||||
destroy?(this: stream.Readable, error: Error | null, callback: (error: Error | null) => void): void;
|
||||
autoDestroy?: boolean;
|
||||
}
|
||||
|
||||
interface Options extends ReadableOptions {
|
||||
writable?: boolean;
|
||||
readable?: boolean;
|
||||
dataSize?: number;
|
||||
maxDataSize?: number;
|
||||
pauseStreams?: boolean;
|
||||
}
|
||||
|
||||
declare class FormData extends stream.Readable {
|
||||
constructor(options?: Options);
|
||||
append(key: string, value: any, options?: FormData.AppendOptions | string): void;
|
||||
getHeaders(userHeaders?: FormData.Headers): FormData.Headers;
|
||||
submit(
|
||||
params: string | FormData.SubmitOptions,
|
||||
callback?: (error: Error | null, response: http.IncomingMessage) => void
|
||||
): http.ClientRequest;
|
||||
getBuffer(): Buffer;
|
||||
getBoundary(): string;
|
||||
getLength(callback: (err: Error | null, length: number) => void): void;
|
||||
getLengthSync(): number;
|
||||
hasKnownLength(): boolean;
|
||||
}
|
||||
|
||||
declare namespace FormData {
|
||||
interface Headers {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface AppendOptions {
|
||||
header?: string | Headers;
|
||||
knownLength?: number;
|
||||
filename?: string;
|
||||
filepath?: string;
|
||||
contentType?: string;
|
||||
}
|
||||
|
||||
interface SubmitOptions extends http.RequestOptions {
|
||||
protocol?: 'https:' | 'http:';
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
/* eslint-env browser */
|
||||
module.exports = typeof self == 'object' ? self.FormData : window.FormData;
|
||||
+494
@@ -0,0 +1,494 @@
|
||||
var CombinedStream = require('combined-stream');
|
||||
var util = require('util');
|
||||
var path = require('path');
|
||||
var http = require('http');
|
||||
var https = require('https');
|
||||
var parseUrl = require('url').parse;
|
||||
var fs = require('fs');
|
||||
var mime = require('mime-types');
|
||||
var asynckit = require('asynckit');
|
||||
var populate = require('./populate.js');
|
||||
|
||||
// Public API
|
||||
module.exports = FormData;
|
||||
|
||||
// make it a Stream
|
||||
util.inherits(FormData, CombinedStream);
|
||||
|
||||
/**
|
||||
* Create readable "multipart/form-data" streams.
|
||||
* Can be used to submit forms
|
||||
* and file uploads to other web applications.
|
||||
*
|
||||
* @constructor
|
||||
* @param {Object} options - Properties to be added/overriden for FormData and CombinedStream
|
||||
*/
|
||||
function FormData(options) {
|
||||
if (!(this instanceof FormData)) {
|
||||
return new FormData(options);
|
||||
}
|
||||
|
||||
this._overheadLength = 0;
|
||||
this._valueLength = 0;
|
||||
this._valuesToMeasure = [];
|
||||
|
||||
CombinedStream.call(this);
|
||||
|
||||
options = options || {};
|
||||
for (var option in options) {
|
||||
this[option] = options[option];
|
||||
}
|
||||
}
|
||||
|
||||
FormData.LINE_BREAK = '\r\n';
|
||||
FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream';
|
||||
|
||||
FormData.prototype.append = function(field, value, options) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
// allow filename as single option
|
||||
if (typeof options == 'string') {
|
||||
options = {filename: options};
|
||||
}
|
||||
|
||||
var append = CombinedStream.prototype.append.bind(this);
|
||||
|
||||
// all that streamy business can't handle numbers
|
||||
if (typeof value == 'number') {
|
||||
value = '' + value;
|
||||
}
|
||||
|
||||
// https://github.com/felixge/node-form-data/issues/38
|
||||
if (util.isArray(value)) {
|
||||
// Please convert your array into string
|
||||
// the way web server expects it
|
||||
this._error(new Error('Arrays are not supported.'));
|
||||
return;
|
||||
}
|
||||
|
||||
var header = this._multiPartHeader(field, value, options);
|
||||
var footer = this._multiPartFooter();
|
||||
|
||||
append(header);
|
||||
append(value);
|
||||
append(footer);
|
||||
|
||||
// pass along options.knownLength
|
||||
this._trackLength(header, value, options);
|
||||
};
|
||||
|
||||
FormData.prototype._trackLength = function(header, value, options) {
|
||||
var valueLength = 0;
|
||||
|
||||
// used w/ getLengthSync(), when length is known.
|
||||
// e.g. for streaming directly from a remote server,
|
||||
// w/ a known file a size, and not wanting to wait for
|
||||
// incoming file to finish to get its size.
|
||||
if (options.knownLength != null) {
|
||||
valueLength += +options.knownLength;
|
||||
} else if (Buffer.isBuffer(value)) {
|
||||
valueLength = value.length;
|
||||
} else if (typeof value === 'string') {
|
||||
valueLength = Buffer.byteLength(value);
|
||||
}
|
||||
|
||||
this._valueLength += valueLength;
|
||||
|
||||
// @check why add CRLF? does this account for custom/multiple CRLFs?
|
||||
this._overheadLength +=
|
||||
Buffer.byteLength(header) +
|
||||
FormData.LINE_BREAK.length;
|
||||
|
||||
// empty or either doesn't have path or not an http response
|
||||
if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) )) {
|
||||
return;
|
||||
}
|
||||
|
||||
// no need to bother with the length
|
||||
if (!options.knownLength) {
|
||||
this._valuesToMeasure.push(value);
|
||||
}
|
||||
};
|
||||
|
||||
FormData.prototype._lengthRetriever = function(value, callback) {
|
||||
|
||||
if (value.hasOwnProperty('fd')) {
|
||||
|
||||
// take read range into a account
|
||||
// `end` = Infinity –> read file till the end
|
||||
//
|
||||
// TODO: Looks like there is bug in Node fs.createReadStream
|
||||
// it doesn't respect `end` options without `start` options
|
||||
// Fix it when node fixes it.
|
||||
// https://github.com/joyent/node/issues/7819
|
||||
if (value.end != undefined && value.end != Infinity && value.start != undefined) {
|
||||
|
||||
// when end specified
|
||||
// no need to calculate range
|
||||
// inclusive, starts with 0
|
||||
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
||||
|
||||
// not that fast snoopy
|
||||
} else {
|
||||
// still need to fetch file size from fs
|
||||
fs.stat(value.path, function(err, stat) {
|
||||
|
||||
var fileSize;
|
||||
|
||||
if (err) {
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
|
||||
// update final size based on the range options
|
||||
fileSize = stat.size - (value.start ? value.start : 0);
|
||||
callback(null, fileSize);
|
||||
});
|
||||
}
|
||||
|
||||
// or http response
|
||||
} else if (value.hasOwnProperty('httpVersion')) {
|
||||
callback(null, +value.headers['content-length']);
|
||||
|
||||
// or request stream http://github.com/mikeal/request
|
||||
} else if (value.hasOwnProperty('httpModule')) {
|
||||
// wait till response come back
|
||||
value.on('response', function(response) {
|
||||
value.pause();
|
||||
callback(null, +response.headers['content-length']);
|
||||
});
|
||||
value.resume();
|
||||
|
||||
// something else
|
||||
} else {
|
||||
callback('Unknown stream');
|
||||
}
|
||||
};
|
||||
|
||||
FormData.prototype._multiPartHeader = function(field, value, options) {
|
||||
// custom header specified (as string)?
|
||||
// it becomes responsible for boundary
|
||||
// (e.g. to handle extra CRLFs on .NET servers)
|
||||
if (typeof options.header == 'string') {
|
||||
return options.header;
|
||||
}
|
||||
|
||||
var contentDisposition = this._getContentDisposition(value, options);
|
||||
var contentType = this._getContentType(value, options);
|
||||
|
||||
var contents = '';
|
||||
var headers = {
|
||||
// add custom disposition as third element or keep it two elements if not
|
||||
'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []),
|
||||
// if no content type. allow it to be empty array
|
||||
'Content-Type': [].concat(contentType || [])
|
||||
};
|
||||
|
||||
// allow custom headers.
|
||||
if (typeof options.header == 'object') {
|
||||
populate(headers, options.header);
|
||||
}
|
||||
|
||||
var header;
|
||||
for (var prop in headers) {
|
||||
if (!headers.hasOwnProperty(prop)) continue;
|
||||
header = headers[prop];
|
||||
|
||||
// skip nullish headers.
|
||||
if (header == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// convert all headers to arrays.
|
||||
if (!Array.isArray(header)) {
|
||||
header = [header];
|
||||
}
|
||||
|
||||
// add non-empty headers.
|
||||
if (header.length) {
|
||||
contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK;
|
||||
}
|
||||
}
|
||||
|
||||
return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK;
|
||||
};
|
||||
|
||||
FormData.prototype._getContentDisposition = function(value, options) {
|
||||
|
||||
var filename
|
||||
, contentDisposition
|
||||
;
|
||||
|
||||
if (typeof options.filepath === 'string') {
|
||||
// custom filepath for relative paths
|
||||
filename = path.normalize(options.filepath).replace(/\\/g, '/');
|
||||
} else if (options.filename || value.name || value.path) {
|
||||
// custom filename take precedence
|
||||
// formidable and the browser add a name property
|
||||
// fs- and request- streams have path property
|
||||
filename = path.basename(options.filename || value.name || value.path);
|
||||
} else if (value.readable && value.hasOwnProperty('httpVersion')) {
|
||||
// or try http response
|
||||
filename = path.basename(value.client._httpMessage.path || '');
|
||||
}
|
||||
|
||||
if (filename) {
|
||||
contentDisposition = 'filename="' + filename + '"';
|
||||
}
|
||||
|
||||
return contentDisposition;
|
||||
};
|
||||
|
||||
FormData.prototype._getContentType = function(value, options) {
|
||||
|
||||
// use custom content-type above all
|
||||
var contentType = options.contentType;
|
||||
|
||||
// or try `name` from formidable, browser
|
||||
if (!contentType && value.name) {
|
||||
contentType = mime.lookup(value.name);
|
||||
}
|
||||
|
||||
// or try `path` from fs-, request- streams
|
||||
if (!contentType && value.path) {
|
||||
contentType = mime.lookup(value.path);
|
||||
}
|
||||
|
||||
// or if it's http-reponse
|
||||
if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) {
|
||||
contentType = value.headers['content-type'];
|
||||
}
|
||||
|
||||
// or guess it from the filepath or filename
|
||||
if (!contentType && (options.filepath || options.filename)) {
|
||||
contentType = mime.lookup(options.filepath || options.filename);
|
||||
}
|
||||
|
||||
// fallback to the default content type if `value` is not simple value
|
||||
if (!contentType && typeof value == 'object') {
|
||||
contentType = FormData.DEFAULT_CONTENT_TYPE;
|
||||
}
|
||||
|
||||
return contentType;
|
||||
};
|
||||
|
||||
FormData.prototype._multiPartFooter = function() {
|
||||
return function(next) {
|
||||
var footer = FormData.LINE_BREAK;
|
||||
|
||||
var lastPart = (this._streams.length === 0);
|
||||
if (lastPart) {
|
||||
footer += this._lastBoundary();
|
||||
}
|
||||
|
||||
next(footer);
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
FormData.prototype._lastBoundary = function() {
|
||||
return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK;
|
||||
};
|
||||
|
||||
FormData.prototype.getHeaders = function(userHeaders) {
|
||||
var header;
|
||||
var formHeaders = {
|
||||
'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
|
||||
};
|
||||
|
||||
for (header in userHeaders) {
|
||||
if (userHeaders.hasOwnProperty(header)) {
|
||||
formHeaders[header.toLowerCase()] = userHeaders[header];
|
||||
}
|
||||
}
|
||||
|
||||
return formHeaders;
|
||||
};
|
||||
|
||||
FormData.prototype.getBoundary = function() {
|
||||
if (!this._boundary) {
|
||||
this._generateBoundary();
|
||||
}
|
||||
|
||||
return this._boundary;
|
||||
};
|
||||
|
||||
FormData.prototype.getBuffer = function() {
|
||||
var dataBuffer = new Buffer.alloc( 0 );
|
||||
var boundary = this.getBoundary();
|
||||
|
||||
// Create the form content. Add Line breaks to the end of data.
|
||||
for (var i = 0, len = this._streams.length; i < len; i++) {
|
||||
if (typeof this._streams[i] !== 'function') {
|
||||
|
||||
// Add content to the buffer.
|
||||
if(Buffer.isBuffer(this._streams[i])) {
|
||||
dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]);
|
||||
}else {
|
||||
dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]);
|
||||
}
|
||||
|
||||
// Add break after content.
|
||||
if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) {
|
||||
dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add the footer and return the Buffer object.
|
||||
return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] );
|
||||
};
|
||||
|
||||
FormData.prototype._generateBoundary = function() {
|
||||
// This generates a 50 character boundary similar to those used by Firefox.
|
||||
// They are optimized for boyer-moore parsing.
|
||||
var boundary = '--------------------------';
|
||||
for (var i = 0; i < 24; i++) {
|
||||
boundary += Math.floor(Math.random() * 10).toString(16);
|
||||
}
|
||||
|
||||
this._boundary = boundary;
|
||||
};
|
||||
|
||||
// Note: getLengthSync DOESN'T calculate streams length
|
||||
// As workaround one can calculate file size manually
|
||||
// and add it as knownLength option
|
||||
FormData.prototype.getLengthSync = function() {
|
||||
var knownLength = this._overheadLength + this._valueLength;
|
||||
|
||||
// Don't get confused, there are 3 "internal" streams for each keyval pair
|
||||
// so it basically checks if there is any value added to the form
|
||||
if (this._streams.length) {
|
||||
knownLength += this._lastBoundary().length;
|
||||
}
|
||||
|
||||
// https://github.com/form-data/form-data/issues/40
|
||||
if (!this.hasKnownLength()) {
|
||||
// Some async length retrievers are present
|
||||
// therefore synchronous length calculation is false.
|
||||
// Please use getLength(callback) to get proper length
|
||||
this._error(new Error('Cannot calculate proper length in synchronous way.'));
|
||||
}
|
||||
|
||||
return knownLength;
|
||||
};
|
||||
|
||||
// Public API to check if length of added values is known
|
||||
// https://github.com/form-data/form-data/issues/196
|
||||
// https://github.com/form-data/form-data/issues/262
|
||||
FormData.prototype.hasKnownLength = function() {
|
||||
var hasKnownLength = true;
|
||||
|
||||
if (this._valuesToMeasure.length) {
|
||||
hasKnownLength = false;
|
||||
}
|
||||
|
||||
return hasKnownLength;
|
||||
};
|
||||
|
||||
FormData.prototype.getLength = function(cb) {
|
||||
var knownLength = this._overheadLength + this._valueLength;
|
||||
|
||||
if (this._streams.length) {
|
||||
knownLength += this._lastBoundary().length;
|
||||
}
|
||||
|
||||
if (!this._valuesToMeasure.length) {
|
||||
process.nextTick(cb.bind(this, null, knownLength));
|
||||
return;
|
||||
}
|
||||
|
||||
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
|
||||
if (err) {
|
||||
cb(err);
|
||||
return;
|
||||
}
|
||||
|
||||
values.forEach(function(length) {
|
||||
knownLength += length;
|
||||
});
|
||||
|
||||
cb(null, knownLength);
|
||||
});
|
||||
};
|
||||
|
||||
FormData.prototype.submit = function(params, cb) {
|
||||
var request
|
||||
, options
|
||||
, defaults = {method: 'post'}
|
||||
;
|
||||
|
||||
// parse provided url if it's string
|
||||
// or treat it as options object
|
||||
if (typeof params == 'string') {
|
||||
|
||||
params = parseUrl(params);
|
||||
options = populate({
|
||||
port: params.port,
|
||||
path: params.pathname,
|
||||
host: params.hostname,
|
||||
protocol: params.protocol
|
||||
}, defaults);
|
||||
|
||||
// use custom params
|
||||
} else {
|
||||
|
||||
options = populate(params, defaults);
|
||||
// if no port provided use default one
|
||||
if (!options.port) {
|
||||
options.port = options.protocol == 'https:' ? 443 : 80;
|
||||
}
|
||||
}
|
||||
|
||||
// put that good code in getHeaders to some use
|
||||
options.headers = this.getHeaders(params.headers);
|
||||
|
||||
// https if specified, fallback to http in any other case
|
||||
if (options.protocol == 'https:') {
|
||||
request = https.request(options);
|
||||
} else {
|
||||
request = http.request(options);
|
||||
}
|
||||
|
||||
// get content length and fire away
|
||||
this.getLength(function(err, length) {
|
||||
if (err) {
|
||||
this._error(err);
|
||||
return;
|
||||
}
|
||||
|
||||
// add content length
|
||||
request.setHeader('Content-Length', length);
|
||||
|
||||
this.pipe(request);
|
||||
if (cb) {
|
||||
var onResponse;
|
||||
|
||||
var callback = function (error, responce) {
|
||||
request.removeListener('error', callback);
|
||||
request.removeListener('response', onResponse);
|
||||
|
||||
return cb.call(this, error, responce);
|
||||
};
|
||||
|
||||
onResponse = callback.bind(this, null);
|
||||
|
||||
request.on('error', callback);
|
||||
request.on('response', onResponse);
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
return request;
|
||||
};
|
||||
|
||||
FormData.prototype._error = function(err) {
|
||||
if (!this.error) {
|
||||
this.error = err;
|
||||
this.pause();
|
||||
this.emit('error', err);
|
||||
}
|
||||
};
|
||||
|
||||
FormData.prototype.toString = function () {
|
||||
return '[object FormData]';
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// populates missing values
|
||||
module.exports = function(dst, src) {
|
||||
|
||||
Object.keys(src).forEach(function(prop)
|
||||
{
|
||||
dst[prop] = dst[prop] || src[prop];
|
||||
});
|
||||
|
||||
return dst;
|
||||
};
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"_from": "form-data@^3.0.0",
|
||||
"_id": "form-data@3.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==",
|
||||
"_location": "/@types/node-fetch/form-data",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "form-data@^3.0.0",
|
||||
"name": "form-data",
|
||||
"escapedName": "form-data",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@types/node-fetch"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz",
|
||||
"_shasum": "31b7e39c85f1355b7139ee0c647cf0de7f83c682",
|
||||
"_spec": "form-data@^3.0.0",
|
||||
"_where": "/home/chris/src/github.com/github/codeql-action/node_modules/@types/node-fetch",
|
||||
"author": {
|
||||
"name": "Felix Geisendörfer",
|
||||
"email": "felix@debuggable.com",
|
||||
"url": "http://debuggable.com/"
|
||||
},
|
||||
"browser": "./lib/browser",
|
||||
"bugs": {
|
||||
"url": "https://github.com/form-data/form-data/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.",
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.10",
|
||||
"browserify": "^13.1.1",
|
||||
"browserify-istanbul": "^2.0.0",
|
||||
"coveralls": "^3.0.4",
|
||||
"cross-spawn": "^6.0.5",
|
||||
"eslint": "^6.0.1",
|
||||
"fake": "^0.2.2",
|
||||
"far": "^0.0.7",
|
||||
"formidable": "^1.0.17",
|
||||
"in-publish": "^2.0.0",
|
||||
"is-node-modern": "^1.0.0",
|
||||
"istanbul": "^0.4.5",
|
||||
"obake": "^0.1.2",
|
||||
"pkgfiles": "^2.3.0",
|
||||
"pre-commit": "^1.1.3",
|
||||
"puppeteer": "^1.19.0",
|
||||
"request": "^2.88.0",
|
||||
"rimraf": "^2.7.1",
|
||||
"tape": "^4.6.2",
|
||||
"typescript": "^3.5.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
},
|
||||
"homepage": "https://github.com/form-data/form-data#readme",
|
||||
"license": "MIT",
|
||||
"main": "./lib/form_data",
|
||||
"name": "form-data",
|
||||
"pre-commit": [
|
||||
"lint",
|
||||
"ci-test",
|
||||
"check"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/form-data/form-data.git"
|
||||
},
|
||||
"scripts": {
|
||||
"browser": "browserify -t browserify-istanbul test/run-browser.js | obake --coverage",
|
||||
"check": "istanbul check-coverage coverage/coverage*.json",
|
||||
"ci-lint": "is-node-modern 8 && npm run lint || is-node-not-modern 8",
|
||||
"ci-test": "npm run test && npm run browser && npm run report",
|
||||
"debug": "verbose=1 ./test/run.js",
|
||||
"files": "pkgfiles --sort=name",
|
||||
"get-version": "node -e \"console.log(require('./package.json').version)\"",
|
||||
"lint": "eslint lib/*.js test/*.js test/integration/*.js",
|
||||
"postpublish": "npm run restore-readme",
|
||||
"posttest": "istanbul report lcov text",
|
||||
"predebug": "rimraf coverage test/tmp",
|
||||
"prepublish": "in-publish && npm run update-readme || not-in-publish",
|
||||
"pretest": "rimraf coverage test/tmp",
|
||||
"report": "istanbul report lcov text",
|
||||
"restore-readme": "mv README.md.bak README.md",
|
||||
"test": "istanbul cover test/run.js",
|
||||
"update-readme": "sed -i.bak 's/\\/master\\.svg/\\/v'$(npm --silent run get-version)'.svg/g' README.md"
|
||||
},
|
||||
"typings": "./index.d.ts",
|
||||
"version": "3.0.0"
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
{
|
||||
"_from": "@types/node-fetch@^2.3.7",
|
||||
"_id": "@types/node-fetch@2.5.7",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw==",
|
||||
"_location": "/@types/node-fetch",
|
||||
"_phantomChildren": {
|
||||
"asynckit": "0.4.0",
|
||||
"combined-stream": "1.0.8",
|
||||
"mime-types": "2.1.27"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@types/node-fetch@^2.3.7",
|
||||
"name": "@types/node-fetch",
|
||||
"escapedName": "@types%2fnode-fetch",
|
||||
"scope": "@types",
|
||||
"rawSpec": "^2.3.7",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.3.7"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@azure/core-http",
|
||||
"/@azure/ms-rest-js"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.7.tgz",
|
||||
"_shasum": "20a2afffa882ab04d44ca786449a276f9f6bbf3c",
|
||||
"_spec": "@types/node-fetch@^2.3.7",
|
||||
"_where": "/home/chris/src/github.com/github/codeql-action/node_modules/@azure/ms-rest-js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Torsten Werner",
|
||||
"url": "https://github.com/torstenwerner"
|
||||
},
|
||||
{
|
||||
"name": "Niklas Lindgren",
|
||||
"url": "https://github.com/nikcorg"
|
||||
},
|
||||
{
|
||||
"name": "Vinay Bedre",
|
||||
"url": "https://github.com/vinaybedre"
|
||||
},
|
||||
{
|
||||
"name": "Antonio Román",
|
||||
"url": "https://github.com/kyranet"
|
||||
},
|
||||
{
|
||||
"name": "Andrew Leedham",
|
||||
"url": "https://github.com/AndrewLeedham"
|
||||
},
|
||||
{
|
||||
"name": "Jason Li",
|
||||
"url": "https://github.com/JasonLi914"
|
||||
},
|
||||
{
|
||||
"name": "Brandon Wilson",
|
||||
"url": "https://github.com/wilsonianb"
|
||||
},
|
||||
{
|
||||
"name": "Steve Faulkner",
|
||||
"url": "https://github.com/southpolesteve"
|
||||
},
|
||||
{
|
||||
"name": "ExE Boss",
|
||||
"url": "https://github.com/ExE-Boss"
|
||||
},
|
||||
{
|
||||
"name": "Alex Savin",
|
||||
"url": "https://github.com/alexandrusavin"
|
||||
},
|
||||
{
|
||||
"name": "Alexis Tyler",
|
||||
"url": "https://github.com/OmgImAlexis"
|
||||
},
|
||||
{
|
||||
"name": "Jakub Kisielewski",
|
||||
"url": "https://github.com/kbkk"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"form-data": "^3.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "TypeScript definitions for node-fetch",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
|
||||
"license": "MIT",
|
||||
"main": "",
|
||||
"name": "@types/node-fetch",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/node-fetch"
|
||||
},
|
||||
"scripts": {},
|
||||
"typeScriptVersion": "2.8",
|
||||
"types": "index.d.ts",
|
||||
"typesPublisherContentHash": "108c44e190ea37e4618fa6c4d6835aedecb20ddd8433a81984ee5cdfdd915b01",
|
||||
"version": "2.5.7"
|
||||
}
|
||||
+21
-21
@@ -1,21 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
||||
|
||||
+4
-4
@@ -5,12 +5,12 @@
|
||||
This package contains type definitions for Node.js (http://nodejs.org/).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v12.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Mon, 25 Nov 2019 22:58:16 GMT
|
||||
* Last updated: Mon, 30 Nov 2020 19:02:20 GMT
|
||||
* Dependencies: none
|
||||
* Global values: `Buffer`, `NodeJS`, `Symbol`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
|
||||
* Global values: `Buffer`, `NodeJS`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
|
||||
|
||||
# Credits
|
||||
These definitions were written by Microsoft TypeScript (https://github.com/Microsoft), DefinitelyTyped (https://github.com/DefinitelyTyped), Alberto Schiabel (https://github.com/jkomyno), Alexander T. (https://github.com/a-tarasyuk), Alvis HT Tang (https://github.com/alvis), Andrew Makarov (https://github.com/r3nya), Benjamin Toueg (https://github.com/btoueg), Bruno Scheufler (https://github.com/brunoscheufler), Chigozirim C. (https://github.com/smac89), Christian Vaagland Tellnes (https://github.com/tellnes), David Junger (https://github.com/touffy), Deividas Bakanas (https://github.com/DeividasBakanas), Eugene Y. Q. Shen (https://github.com/eyqs), Flarna (https://github.com/Flarna), Hannes Magnusson (https://github.com/Hannes-Magnusson-CK), Hoàng Văn Khải (https://github.com/KSXGitHub), Huw (https://github.com/hoo29), Kelvin Jin (https://github.com/kjin), Klaus Meinhardt (https://github.com/ajafff), Lishude (https://github.com/islishude), Mariusz Wiktorczyk (https://github.com/mwiktorczyk), Mohsen Azimi (https://github.com/mohsen1), Nicolas Even (https://github.com/n-e), Nicolas Voigt (https://github.com/octo-sniffle), Nikita Galkin (https://github.com/galkin), Parambir Singh (https://github.com/parambirs), Sebastian Silbermann (https://github.com/eps1lon), Simon Schick (https://github.com/SimonSchick), Thomas den Hollander (https://github.com/ThomasdenH), Wilco Bakker (https://github.com/WilcoBakker), wwwy3y3 (https://github.com/wwwy3y3), Zane Hannan AU (https://github.com/ZaneHannanAU), Samuel Ainsworth (https://github.com/samuela), Kyle Uehlein (https://github.com/kuehlein), Jordi Oliveras Rovira (https://github.com/j-oliveras), Thanik Bhongbhibhat (https://github.com/bhongy), Marcin Kopacz (https://github.com/chyzwar), Trivikram Kamat (https://github.com/trivikr), Minh Son Nguyen (https://github.com/nguymin4), Junxiao Shi (https://github.com/yoursunny), and Ilia Baryshnikov (https://github.com/qwelias).
|
||||
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alexander T.](https://github.com/a-tarasyuk), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Bruno Scheufler](https://github.com/brunoscheufler), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Flarna](https://github.com/Flarna), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Hoàng Văn Khải](https://github.com/KSXGitHub), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Zane Hannan AU](https://github.com/ZaneHannanAU), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Jordi Oliveras Rovira](https://github.com/j-oliveras), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), and [Jason Kwok](https://github.com/JasonHK).
|
||||
|
||||
+79
-14
@@ -1,6 +1,6 @@
|
||||
declare module "assert" {
|
||||
function internal(value: any, message?: string | Error): void;
|
||||
namespace internal {
|
||||
declare module 'assert' {
|
||||
function assert(value: any, message?: string | Error): asserts value;
|
||||
namespace assert {
|
||||
class AssertionError implements Error {
|
||||
name: string;
|
||||
message: string;
|
||||
@@ -11,22 +11,53 @@ declare module "assert" {
|
||||
code: 'ERR_ASSERTION';
|
||||
|
||||
constructor(options?: {
|
||||
message?: string; actual?: any; expected?: any;
|
||||
operator?: string; stackStartFn?: Function
|
||||
message?: string;
|
||||
actual?: any;
|
||||
expected?: any;
|
||||
operator?: string;
|
||||
stackStartFn?: Function;
|
||||
});
|
||||
}
|
||||
|
||||
class CallTracker {
|
||||
calls(exact?: number): () => void;
|
||||
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
|
||||
report(): CallTrackerReportInformation[];
|
||||
verify(): void;
|
||||
}
|
||||
interface CallTrackerReportInformation {
|
||||
message: string;
|
||||
/** The actual number of times the function was called. */
|
||||
actual: number;
|
||||
/** The number of times the function was expected to be called. */
|
||||
expected: number;
|
||||
/** The name of the function that is wrapped. */
|
||||
operator: string;
|
||||
/** A stack trace of the function. */
|
||||
stack: object;
|
||||
}
|
||||
|
||||
function fail(message?: string | Error): never;
|
||||
/** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
|
||||
function fail(actual: any, expected: any, message?: string | Error, operator?: string, stackStartFn?: Function): never;
|
||||
function ok(value: any, message?: string | Error): void;
|
||||
function fail(
|
||||
actual: any,
|
||||
expected: any,
|
||||
message?: string | Error,
|
||||
operator?: string,
|
||||
stackStartFn?: Function,
|
||||
): never;
|
||||
function ok(value: any, message?: string | Error): asserts value;
|
||||
/** @deprecated since v9.9.0 - use strictEqual() instead. */
|
||||
function equal(actual: any, expected: any, message?: string | Error): void;
|
||||
/** @deprecated since v9.9.0 - use notStrictEqual() instead. */
|
||||
function notEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
/** @deprecated since v9.9.0 - use deepStrictEqual() instead. */
|
||||
function deepEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
/** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */
|
||||
function notDeepEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
function strictEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
function strictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
|
||||
function notStrictEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
function deepStrictEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
function deepStrictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
|
||||
function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
|
||||
function throws(block: () => any, message?: string | Error): void;
|
||||
@@ -34,15 +65,49 @@ declare module "assert" {
|
||||
function doesNotThrow(block: () => any, message?: string | Error): void;
|
||||
function doesNotThrow(block: () => any, error: RegExp | Function, message?: string | Error): void;
|
||||
|
||||
function ifError(value: any): void;
|
||||
function ifError(value: any): asserts value is null | undefined;
|
||||
|
||||
function rejects(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
|
||||
function rejects(block: (() => Promise<any>) | Promise<any>, error: RegExp | Function | Object | Error, message?: string | Error): Promise<void>;
|
||||
function rejects(
|
||||
block: (() => Promise<any>) | Promise<any>,
|
||||
error: RegExp | Function | Object | Error,
|
||||
message?: string | Error,
|
||||
): Promise<void>;
|
||||
function doesNotReject(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
|
||||
function doesNotReject(block: (() => Promise<any>) | Promise<any>, error: RegExp | Function, message?: string | Error): Promise<void>;
|
||||
function doesNotReject(
|
||||
block: (() => Promise<any>) | Promise<any>,
|
||||
error: RegExp | Function,
|
||||
message?: string | Error,
|
||||
): Promise<void>;
|
||||
|
||||
const strict: typeof internal;
|
||||
const strict: Omit<
|
||||
typeof assert,
|
||||
| 'equal'
|
||||
| 'notEqual'
|
||||
| 'deepEqual'
|
||||
| 'notDeepEqual'
|
||||
| 'ok'
|
||||
| 'strictEqual'
|
||||
| 'deepStrictEqual'
|
||||
| 'ifError'
|
||||
| 'strict'
|
||||
> & {
|
||||
(value: any, message?: string | Error): asserts value;
|
||||
equal: typeof strictEqual;
|
||||
notEqual: typeof notStrictEqual;
|
||||
deepEqual: typeof deepStrictEqual;
|
||||
notDeepEqual: typeof notDeepStrictEqual;
|
||||
|
||||
// Mapped types and assertion functions are incompatible?
|
||||
// TS2775: Assertions require every name in the call target
|
||||
// to be declared with an explicit type annotation.
|
||||
ok: typeof ok;
|
||||
strictEqual: typeof strictEqual;
|
||||
deepStrictEqual: typeof deepStrictEqual;
|
||||
ifError: typeof ifError;
|
||||
strict: typeof strict;
|
||||
};
|
||||
}
|
||||
|
||||
export = internal;
|
||||
export = assert;
|
||||
}
|
||||
|
||||
+115
-1
@@ -7,6 +7,20 @@ declare module "async_hooks" {
|
||||
*/
|
||||
function executionAsyncId(): number;
|
||||
|
||||
/**
|
||||
* The resource representing the current execution.
|
||||
* Useful to store data within the resource.
|
||||
*
|
||||
* Resource objects returned by `executionAsyncResource()` are most often internal
|
||||
* Node.js handle objects with undocumented APIs. Using any functions or properties
|
||||
* on the object is likely to crash your application and should be avoided.
|
||||
*
|
||||
* Using `executionAsyncResource()` in the top-level execution context will
|
||||
* return an empty object as there is no handle or request object to use,
|
||||
* but having an object representing the top-level can be helpful.
|
||||
*/
|
||||
function executionAsyncResource(): object;
|
||||
|
||||
/**
|
||||
* Returns the ID of the resource responsible for calling the callback that is currently being executed.
|
||||
*/
|
||||
@@ -20,7 +34,7 @@ declare module "async_hooks" {
|
||||
* @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
|
||||
* @param resource reference to the resource representing the async operation, needs to be released during destroy
|
||||
*/
|
||||
init?(asyncId: number, type: string, triggerAsyncId: number, resource: Object): void;
|
||||
init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
|
||||
|
||||
/**
|
||||
* When an asynchronous operation is initiated or completes a callback is called to notify the user.
|
||||
@@ -101,6 +115,19 @@ declare module "async_hooks" {
|
||||
*/
|
||||
constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions);
|
||||
|
||||
/**
|
||||
* Binds the given function to the current execution context.
|
||||
* @param fn The function to bind to the current execution context.
|
||||
* @param type An optional name to associate with the underlying `AsyncResource`.
|
||||
*/
|
||||
static bind<Func extends (...args: any[]) => any>(fn: Func, type?: string): Func & { asyncResource: AsyncResource };
|
||||
|
||||
/**
|
||||
* Binds the given function to execute to this `AsyncResource`'s scope.
|
||||
* @param fn The function to bind to the current `AsyncResource`.
|
||||
*/
|
||||
bind<Func extends (...args: any[]) => any>(fn: Func): Func & { asyncResource: AsyncResource };
|
||||
|
||||
/**
|
||||
* Call the provided function with the provided arguments in the
|
||||
* execution context of the async resource. This will establish the
|
||||
@@ -129,4 +156,91 @@ declare module "async_hooks" {
|
||||
*/
|
||||
triggerAsyncId(): number;
|
||||
}
|
||||
|
||||
/**
|
||||
* When having multiple instances of `AsyncLocalStorage`, they are independent
|
||||
* from each other. It is safe to instantiate this class multiple times.
|
||||
*/
|
||||
class AsyncLocalStorage<T> {
|
||||
/**
|
||||
* This method disables the instance of `AsyncLocalStorage`. All subsequent calls
|
||||
* to `asyncLocalStorage.getStore()` will return `undefined` until
|
||||
* `asyncLocalStorage.run()` or `asyncLocalStorage.runSyncAndReturn()`
|
||||
* is called again.
|
||||
*
|
||||
* When calling `asyncLocalStorage.disable()`, all current contexts linked to the
|
||||
* instance will be exited.
|
||||
*
|
||||
* Calling `asyncLocalStorage.disable()` is required before the
|
||||
* `asyncLocalStorage` can be garbage collected. This does not apply to stores
|
||||
* provided by the `asyncLocalStorage`, as those objects are garbage collected
|
||||
* along with the corresponding async resources.
|
||||
*
|
||||
* This method is to be used when the `asyncLocalStorage` is not in use anymore
|
||||
* in the current process.
|
||||
*/
|
||||
disable(): void;
|
||||
|
||||
/**
|
||||
* This method returns the current store.
|
||||
* If this method is called outside of an asynchronous context initialized by
|
||||
* calling `asyncLocalStorage.run` or `asyncLocalStorage.runAndReturn`, it will
|
||||
* return `undefined`.
|
||||
*/
|
||||
getStore(): T | undefined;
|
||||
|
||||
/**
|
||||
* Calling `asyncLocalStorage.run(callback)` will create a new asynchronous
|
||||
* context.
|
||||
* Within the callback function and the asynchronous operations from the callback,
|
||||
* `asyncLocalStorage.getStore()` will return an instance of `Map` known as
|
||||
* "the store". This store will be persistent through the following
|
||||
* asynchronous calls.
|
||||
*
|
||||
* The callback will be ran asynchronously. Optionally, arguments can be passed
|
||||
* to the function. They will be passed to the callback function.
|
||||
*
|
||||
* If an error is thrown by the callback function, it will not be caught by
|
||||
* a `try/catch` block as the callback is ran in a new asynchronous resource.
|
||||
* Also, the stacktrace will be impacted by the asynchronous call.
|
||||
*/
|
||||
// TODO: Apply generic vararg once available
|
||||
run(store: T, callback: (...args: any[]) => void, ...args: any[]): void;
|
||||
|
||||
/**
|
||||
* Calling `asyncLocalStorage.exit(callback)` will create a new asynchronous
|
||||
* context.
|
||||
* Within the callback function and the asynchronous operations from the callback,
|
||||
* `asyncLocalStorage.getStore()` will return `undefined`.
|
||||
*
|
||||
* The callback will be ran asynchronously. Optionally, arguments can be passed
|
||||
* to the function. They will be passed to the callback function.
|
||||
*
|
||||
* If an error is thrown by the callback function, it will not be caught by
|
||||
* a `try/catch` block as the callback is ran in a new asynchronous resource.
|
||||
* Also, the stacktrace will be impacted by the asynchronous call.
|
||||
*/
|
||||
exit(callback: (...args: any[]) => void, ...args: any[]): void;
|
||||
|
||||
/**
|
||||
* This methods runs a function synchronously outside of a context and return its
|
||||
* return value. The store is not accessible within the callback function or
|
||||
* the asynchronous operations created within the callback.
|
||||
*
|
||||
* Optionally, arguments can be passed to the function. They will be passed to
|
||||
* the callback function.
|
||||
*
|
||||
* If the callback function throws an error, it will be thrown by
|
||||
* `exitSyncAndReturn` too. The stacktrace will not be impacted by this call and
|
||||
* the context will be re-entered.
|
||||
*/
|
||||
exitSyncAndReturn<R>(callback: (...args: any[]) => R, ...args: any[]): R;
|
||||
|
||||
/**
|
||||
* Calling `asyncLocalStorage.enterWith(store)` will transition into the context
|
||||
* for the remainder of the current synchronous execution and will persist
|
||||
* through any following asynchronous calls.
|
||||
*/
|
||||
enterWith(store: T): void;
|
||||
}
|
||||
}
|
||||
|
||||
+18
-40
@@ -1,41 +1,19 @@
|
||||
// base definnitions for all NodeJS modules that are not specific to any version of TypeScript
|
||||
/// <reference path="globals.d.ts" />
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.7.
|
||||
|
||||
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
|
||||
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
|
||||
// - ~/index.d.ts - Definitions specific to TypeScript 2.1
|
||||
// - ~/ts3.7/base.d.ts - Definitions specific to TypeScript 3.7
|
||||
// - ~/ts3.7/index.d.ts - Definitions specific to TypeScript 3.7 with assert pulled in
|
||||
|
||||
// Reference required types from the default lib:
|
||||
/// <reference lib="es2018" />
|
||||
/// <reference lib="esnext.asynciterable" />
|
||||
/// <reference lib="esnext.intl" />
|
||||
/// <reference lib="esnext.bigint" />
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
/// <reference path="ts3.6/base.d.ts" />
|
||||
|
||||
// TypeScript 3.7-specific augmentations:
|
||||
/// <reference path="assert.d.ts" />
|
||||
/// <reference path="async_hooks.d.ts" />
|
||||
/// <reference path="buffer.d.ts" />
|
||||
/// <reference path="child_process.d.ts" />
|
||||
/// <reference path="cluster.d.ts" />
|
||||
/// <reference path="console.d.ts" />
|
||||
/// <reference path="constants.d.ts" />
|
||||
/// <reference path="crypto.d.ts" />
|
||||
/// <reference path="dgram.d.ts" />
|
||||
/// <reference path="dns.d.ts" />
|
||||
/// <reference path="domain.d.ts" />
|
||||
/// <reference path="events.d.ts" />
|
||||
/// <reference path="fs.d.ts" />
|
||||
/// <reference path="http.d.ts" />
|
||||
/// <reference path="http2.d.ts" />
|
||||
/// <reference path="https.d.ts" />
|
||||
/// <reference path="inspector.d.ts" />
|
||||
/// <reference path="module.d.ts" />
|
||||
/// <reference path="net.d.ts" />
|
||||
/// <reference path="os.d.ts" />
|
||||
/// <reference path="path.d.ts" />
|
||||
/// <reference path="perf_hooks.d.ts" />
|
||||
/// <reference path="process.d.ts" />
|
||||
/// <reference path="punycode.d.ts" />
|
||||
/// <reference path="querystring.d.ts" />
|
||||
/// <reference path="readline.d.ts" />
|
||||
/// <reference path="repl.d.ts" />
|
||||
/// <reference path="stream.d.ts" />
|
||||
/// <reference path="string_decoder.d.ts" />
|
||||
/// <reference path="timers.d.ts" />
|
||||
/// <reference path="tls.d.ts" />
|
||||
/// <reference path="trace_events.d.ts" />
|
||||
/// <reference path="tty.d.ts" />
|
||||
/// <reference path="url.d.ts" />
|
||||
/// <reference path="util.d.ts" />
|
||||
/// <reference path="v8.d.ts" />
|
||||
/// <reference path="vm.d.ts" />
|
||||
/// <reference path="worker_threads.d.ts" />
|
||||
/// <reference path="zlib.d.ts" />
|
||||
|
||||
+33
-19
@@ -18,7 +18,11 @@ declare module "child_process" {
|
||||
readonly killed: boolean;
|
||||
readonly pid: number;
|
||||
readonly connected: boolean;
|
||||
kill(signal?: NodeJS.Signals | number): void;
|
||||
readonly exitCode: number | null;
|
||||
readonly signalCode: number | null;
|
||||
readonly spawnargs: string[];
|
||||
readonly spawnfile: string;
|
||||
kill(signal?: NodeJS.Signals | number): boolean;
|
||||
send(message: any, callback?: (error: Error | null) => void): boolean;
|
||||
send(message: any, sendHandle?: net.Socket | net.Server, callback?: (error: Error | null) => void): boolean;
|
||||
send(message: any, sendHandle?: net.Socket | net.Server, options?: MessageOptions, callback?: (error: Error | null) => void): boolean;
|
||||
@@ -320,25 +324,25 @@ declare module "child_process" {
|
||||
function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess;
|
||||
|
||||
// no `options` definitely means stdout/stderr are `string`.
|
||||
function execFile(file: string, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
function execFile(file: string, args: ReadonlyArray<string> | undefined | null, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
function execFile(file: string, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
function execFile(file: string, args: ReadonlyArray<string> | undefined | null, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
|
||||
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
||||
function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
||||
function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
||||
function execFile(
|
||||
file: string,
|
||||
args: ReadonlyArray<string> | undefined | null,
|
||||
options: ExecFileOptionsWithBufferEncoding,
|
||||
callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void,
|
||||
callback: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void,
|
||||
): ChildProcess;
|
||||
|
||||
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
|
||||
function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
function execFile(
|
||||
file: string,
|
||||
args: ReadonlyArray<string> | undefined | null,
|
||||
options: ExecFileOptionsWithStringEncoding,
|
||||
callback: (error: Error | null, stdout: string, stderr: string) => void,
|
||||
callback: (error: ExecException | null, stdout: string, stderr: string) => void,
|
||||
): ChildProcess;
|
||||
|
||||
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
||||
@@ -346,48 +350,57 @@ declare module "child_process" {
|
||||
function execFile(
|
||||
file: string,
|
||||
options: ExecFileOptionsWithOtherEncoding,
|
||||
callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
||||
callback: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
||||
): ChildProcess;
|
||||
function execFile(
|
||||
file: string,
|
||||
args: ReadonlyArray<string> | undefined | null,
|
||||
options: ExecFileOptionsWithOtherEncoding,
|
||||
callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
||||
callback: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
||||
): ChildProcess;
|
||||
|
||||
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
||||
function execFile(file: string, options: ExecFileOptions, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptions, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
function execFile(file: string, options: ExecFileOptions, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
function execFile(
|
||||
file: string,
|
||||
args: ReadonlyArray<string> | undefined | null,
|
||||
options: ExecFileOptions,
|
||||
callback: (error: ExecException | null, stdout: string, stderr: string) => void
|
||||
): ChildProcess;
|
||||
|
||||
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
||||
function execFile(
|
||||
file: string,
|
||||
options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
|
||||
callback: ((error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
|
||||
callback: ((error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
|
||||
): ChildProcess;
|
||||
function execFile(
|
||||
file: string,
|
||||
args: ReadonlyArray<string> | undefined | null,
|
||||
options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
|
||||
callback: ((error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
|
||||
callback: ((error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
|
||||
): ChildProcess;
|
||||
|
||||
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
||||
namespace execFile {
|
||||
function __promisify__(file: string): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(file: string, args: string[] | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
|
||||
function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
|
||||
function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
|
||||
function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
||||
function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
||||
function __promisify__(
|
||||
file: string,
|
||||
args: ReadonlyArray<string> | undefined | null,
|
||||
options: ExecFileOptionsWithOtherEncoding,
|
||||
): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
||||
function __promisify__(file: string, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
||||
function __promisify__(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
||||
function __promisify__(
|
||||
file: string,
|
||||
args: string[] | undefined | null,
|
||||
args: ReadonlyArray<string> | undefined | null,
|
||||
options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
|
||||
): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
||||
}
|
||||
@@ -400,6 +413,7 @@ declare module "child_process" {
|
||||
detached?: boolean;
|
||||
windowsVerbatimArguments?: boolean;
|
||||
}
|
||||
function fork(modulePath: string, options?: ForkOptions): ChildProcess;
|
||||
function fork(modulePath: string, args?: ReadonlyArray<string>, options?: ForkOptions): ChildProcess;
|
||||
|
||||
interface SpawnSyncOptions extends CommonOptions {
|
||||
|
||||
+165
-15
@@ -160,7 +160,7 @@ declare module "crypto" {
|
||||
asymmetricKeySize?: number;
|
||||
export(options: KeyExportOptions<'pem'>): string | Buffer;
|
||||
export(options?: KeyExportOptions<'der'>): Buffer;
|
||||
symmetricSize?: number;
|
||||
symmetricKeySize?: number;
|
||||
type: KeyObjectType;
|
||||
}
|
||||
|
||||
@@ -210,14 +210,14 @@ declare module "crypto" {
|
||||
final(output_encoding: string): string;
|
||||
setAutoPadding(auto_padding?: boolean): this;
|
||||
// getAuthTag(): Buffer;
|
||||
// setAAD(buffer: Buffer): this; // docs only say buffer
|
||||
// setAAD(buffer: NodeJS.ArrayBufferView): this;
|
||||
}
|
||||
interface CipherCCM extends Cipher {
|
||||
setAAD(buffer: Buffer, options: { plaintextLength: number }): this;
|
||||
setAAD(buffer: NodeJS.ArrayBufferView, options: { plaintextLength: number }): this;
|
||||
getAuthTag(): Buffer;
|
||||
}
|
||||
interface CipherGCM extends Cipher {
|
||||
setAAD(buffer: Buffer, options?: { plaintextLength: number }): this;
|
||||
setAAD(buffer: NodeJS.ArrayBufferView, options?: { plaintextLength: number }): this;
|
||||
getAuthTag(): Buffer;
|
||||
}
|
||||
/** @deprecated since v10.0.0 use createDecipheriv() */
|
||||
@@ -277,20 +277,31 @@ declare module "crypto" {
|
||||
|
||||
function createPrivateKey(key: PrivateKeyInput | string | Buffer): KeyObject;
|
||||
function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject): KeyObject;
|
||||
function createSecretKey(key: Buffer): KeyObject;
|
||||
function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject;
|
||||
|
||||
function createSign(algorithm: string, options?: stream.WritableOptions): Signer;
|
||||
|
||||
type DSAEncoding = 'der' | 'ieee-p1363';
|
||||
|
||||
interface SigningOptions {
|
||||
/**
|
||||
* @See crypto.constants.RSA_PKCS1_PADDING
|
||||
*/
|
||||
padding?: number;
|
||||
saltLength?: number;
|
||||
dsaEncoding?: DSAEncoding;
|
||||
}
|
||||
|
||||
interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {
|
||||
}
|
||||
interface SignKeyObjectInput extends SigningOptions {
|
||||
key: KeyObject;
|
||||
}
|
||||
interface VerifyPublicKeyInput extends PublicKeyInput, SigningOptions {
|
||||
}
|
||||
interface VerifyKeyObjectInput extends SigningOptions {
|
||||
key: KeyObject;
|
||||
}
|
||||
|
||||
type KeyLike = string | Buffer | KeyObject;
|
||||
|
||||
@@ -299,8 +310,8 @@ declare module "crypto" {
|
||||
|
||||
update(data: BinaryLike): Signer;
|
||||
update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Signer;
|
||||
sign(private_key: SignPrivateKeyInput | KeyLike): Buffer;
|
||||
sign(private_key: SignPrivateKeyInput | KeyLike, output_format: HexBase64Latin1Encoding): string;
|
||||
sign(private_key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
|
||||
sign(private_key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, output_format: HexBase64Latin1Encoding): string;
|
||||
}
|
||||
|
||||
function createVerify(algorithm: string, options?: stream.WritableOptions): Verify;
|
||||
@@ -309,8 +320,8 @@ declare module "crypto" {
|
||||
|
||||
update(data: BinaryLike): Verify;
|
||||
update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Verify;
|
||||
verify(object: Object | KeyLike, signature: NodeJS.ArrayBufferView): boolean;
|
||||
verify(object: Object | KeyLike, signature: string, signature_format?: HexBase64Latin1Encoding): boolean;
|
||||
verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): boolean;
|
||||
verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: string, signature_format?: HexBase64Latin1Encoding): boolean;
|
||||
// https://nodejs.org/api/crypto.html#crypto_verifier_verify_object_signature_signature_format
|
||||
// The signature field accepts a TypedArray type, but it is only available starting ES2017
|
||||
}
|
||||
@@ -357,6 +368,11 @@ declare module "crypto" {
|
||||
function pseudoRandomBytes(size: number): Buffer;
|
||||
function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
|
||||
|
||||
function randomInt(max: number): number;
|
||||
function randomInt(min: number, max: number): number;
|
||||
function randomInt(max: number, callback: (err: Error | null, value: number) => void): void;
|
||||
function randomInt(min: number, max: number, callback: (err: Error | null, value: number) => void): void;
|
||||
|
||||
function randomFillSync<T extends NodeJS.ArrayBufferView>(buffer: T, offset?: number, size?: number): T;
|
||||
function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, callback: (err: Error | null, buf: T) => void): void;
|
||||
function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void;
|
||||
@@ -402,6 +418,7 @@ declare module "crypto" {
|
||||
function privateEncrypt(private_key: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
|
||||
function getCiphers(): string[];
|
||||
function getCurves(): string[];
|
||||
function getFips(): 1 | 0;
|
||||
function getHashes(): string[];
|
||||
class ECDH {
|
||||
private constructor();
|
||||
@@ -430,7 +447,7 @@ declare module "crypto" {
|
||||
/** @deprecated since v10.0.0 */
|
||||
const DEFAULT_ENCODING: string;
|
||||
|
||||
type KeyType = 'rsa' | 'dsa' | 'ec';
|
||||
type KeyType = 'rsa' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448';
|
||||
type KeyFormat = 'pem' | 'der';
|
||||
|
||||
interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
|
||||
@@ -444,6 +461,30 @@ declare module "crypto" {
|
||||
privateKey: KeyObject;
|
||||
}
|
||||
|
||||
interface ED25519KeyPairKeyObjectOptions {
|
||||
/**
|
||||
* No options.
|
||||
*/
|
||||
}
|
||||
|
||||
interface ED448KeyPairKeyObjectOptions {
|
||||
/**
|
||||
* No options.
|
||||
*/
|
||||
}
|
||||
|
||||
interface X25519KeyPairKeyObjectOptions {
|
||||
/**
|
||||
* No options.
|
||||
*/
|
||||
}
|
||||
|
||||
interface X448KeyPairKeyObjectOptions {
|
||||
/**
|
||||
* No options.
|
||||
*/
|
||||
}
|
||||
|
||||
interface ECKeyPairKeyObjectOptions {
|
||||
/**
|
||||
* Name of the curve to use.
|
||||
@@ -528,6 +569,46 @@ declare module "crypto" {
|
||||
};
|
||||
}
|
||||
|
||||
interface ED25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
||||
publicKeyEncoding: {
|
||||
type: 'spki';
|
||||
format: PubF;
|
||||
};
|
||||
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
||||
type: 'pkcs8';
|
||||
};
|
||||
}
|
||||
|
||||
interface ED448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
||||
publicKeyEncoding: {
|
||||
type: 'spki';
|
||||
format: PubF;
|
||||
};
|
||||
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
||||
type: 'pkcs8';
|
||||
};
|
||||
}
|
||||
|
||||
interface X25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
||||
publicKeyEncoding: {
|
||||
type: 'spki';
|
||||
format: PubF;
|
||||
};
|
||||
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
||||
type: 'pkcs8';
|
||||
};
|
||||
}
|
||||
|
||||
interface X448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
||||
publicKeyEncoding: {
|
||||
type: 'spki';
|
||||
format: PubF;
|
||||
};
|
||||
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
||||
type: 'pkcs8';
|
||||
};
|
||||
}
|
||||
|
||||
interface KeyPairSyncResult<T1 extends string | Buffer, T2 extends string | Buffer> {
|
||||
publicKey: T1;
|
||||
privateKey: T2;
|
||||
@@ -551,6 +632,30 @@ declare module "crypto" {
|
||||
function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
|
||||
function generateKeyPairSync(type: 'ec', options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
||||
|
||||
function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
|
||||
function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
|
||||
function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
|
||||
function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
|
||||
function generateKeyPairSync(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
||||
|
||||
function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
|
||||
function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
|
||||
function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
|
||||
function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
|
||||
function generateKeyPairSync(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
||||
|
||||
function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
|
||||
function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
|
||||
function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
|
||||
function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
|
||||
function generateKeyPairSync(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
||||
|
||||
function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
|
||||
function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
|
||||
function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
|
||||
function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
|
||||
function generateKeyPairSync(type: 'x448', options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
||||
|
||||
function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
|
||||
function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
|
||||
function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
|
||||
@@ -569,6 +674,30 @@ declare module "crypto" {
|
||||
function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
|
||||
function generateKeyPair(type: 'ec', options: ECKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
|
||||
|
||||
function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
|
||||
function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
|
||||
function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
|
||||
function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
|
||||
function generateKeyPair(type: 'ed25519', options: ED25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
|
||||
|
||||
function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
|
||||
function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
|
||||
function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
|
||||
function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
|
||||
function generateKeyPair(type: 'ed448', options: ED448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
|
||||
|
||||
function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
|
||||
function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
|
||||
function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
|
||||
function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
|
||||
function generateKeyPair(type: 'x25519', options: X25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
|
||||
|
||||
function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
|
||||
function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
|
||||
function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
|
||||
function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
|
||||
function generateKeyPair(type: 'x448', options: X448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
|
||||
|
||||
namespace generateKeyPair {
|
||||
function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
|
||||
function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
|
||||
@@ -587,6 +716,30 @@ declare module "crypto" {
|
||||
function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
|
||||
function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
|
||||
function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
||||
|
||||
function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
|
||||
function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
|
||||
function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
|
||||
function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
|
||||
function __promisify__(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
||||
|
||||
function __promisify__(type: "ed448", options: ED448KeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
|
||||
function __promisify__(type: "ed448", options: ED448KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
|
||||
function __promisify__(type: "ed448", options: ED448KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
|
||||
function __promisify__(type: "ed448", options: ED448KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
|
||||
function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
||||
|
||||
function __promisify__(type: "x25519", options: X25519KeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
|
||||
function __promisify__(type: "x25519", options: X25519KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
|
||||
function __promisify__(type: "x25519", options: X25519KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
|
||||
function __promisify__(type: "x25519", options: X25519KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
|
||||
function __promisify__(type: "x25519", options?: X25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
||||
|
||||
function __promisify__(type: "x448", options: X448KeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
|
||||
function __promisify__(type: "x448", options: X448KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
|
||||
function __promisify__(type: "x448", options: X448KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
|
||||
function __promisify__(type: "x448", options: X448KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
|
||||
function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -597,10 +750,7 @@ declare module "crypto" {
|
||||
* If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
|
||||
* passed to [`crypto.createPrivateKey()`][].
|
||||
*/
|
||||
function sign(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignPrivateKeyInput): Buffer;
|
||||
|
||||
interface VerifyKeyWithOptions extends KeyObject, SigningOptions {
|
||||
}
|
||||
function sign(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
|
||||
|
||||
/**
|
||||
* Calculates and returns the signature for `data` using the given private key and
|
||||
@@ -610,5 +760,5 @@ declare module "crypto" {
|
||||
* If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
|
||||
* passed to [`crypto.createPublicKey()`][].
|
||||
*/
|
||||
function verify(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | VerifyKeyWithOptions, signature: NodeJS.ArrayBufferView): Buffer;
|
||||
function verify(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): Buffer;
|
||||
}
|
||||
|
||||
+3
-3
@@ -50,9 +50,9 @@ declare module "dgram" {
|
||||
getSendBufferSize(): number;
|
||||
ref(): this;
|
||||
remoteAddress(): AddressInfo;
|
||||
send(msg: string | Uint8Array | any[], port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
|
||||
send(msg: string | Uint8Array | any[], port?: number, callback?: (error: Error | null, bytes: number) => void): void;
|
||||
send(msg: string | Uint8Array | any[], callback?: (error: Error | null, bytes: number) => void): void;
|
||||
send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
|
||||
send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
|
||||
send(msg: string | Uint8Array | ReadonlyArray<any>, callback?: (error: Error | null, bytes: number) => void): void;
|
||||
send(msg: string | Uint8Array, offset: number, length: number, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
|
||||
send(msg: string | Uint8Array, offset: number, length: number, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
|
||||
send(msg: string | Uint8Array, offset: number, length: number, callback?: (error: Error | null, bytes: number) => void): void;
|
||||
|
||||
+13
-1
@@ -12,7 +12,19 @@ declare module "events" {
|
||||
namespace internal {
|
||||
function once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>;
|
||||
function once(emitter: DOMEventTarget, event: string): Promise<any[]>;
|
||||
class EventEmitter extends internal {
|
||||
|
||||
/**
|
||||
* This symbol shall be used to install a listener for only monitoring `'error'`
|
||||
* events. Listeners installed using this symbol are called before the regular
|
||||
* `'error'` listeners are called.
|
||||
*
|
||||
* Installing a listener using this symbol does not change the behavior once an
|
||||
* `'error'` event is emitted, therefore the process will still crash if no
|
||||
* regular `'error'` listener is installed.
|
||||
*/
|
||||
const errorMonitor: unique symbol;
|
||||
|
||||
class EventEmitter extends internal {
|
||||
/** @deprecated since v4.0.0 */
|
||||
static listenerCount(emitter: EventEmitter, event: string | symbol): number;
|
||||
static defaultMaxListeners: number;
|
||||
|
||||
+104
-34
@@ -19,20 +19,20 @@ declare module "fs" {
|
||||
isFIFO(): boolean;
|
||||
isSocket(): boolean;
|
||||
|
||||
dev: number;
|
||||
ino: number;
|
||||
mode: number;
|
||||
nlink: number;
|
||||
uid: number;
|
||||
gid: number;
|
||||
rdev: number;
|
||||
size: number;
|
||||
blksize: number;
|
||||
blocks: number;
|
||||
atimeMs: number;
|
||||
mtimeMs: number;
|
||||
ctimeMs: number;
|
||||
birthtimeMs: number;
|
||||
dev: T;
|
||||
ino: T;
|
||||
mode: T;
|
||||
nlink: T;
|
||||
uid: T;
|
||||
gid: T;
|
||||
rdev: T;
|
||||
size: T;
|
||||
blksize: T;
|
||||
blocks: T;
|
||||
atimeMs: T;
|
||||
mtimeMs: T;
|
||||
ctimeMs: T;
|
||||
birthtimeMs: T;
|
||||
atime: Date;
|
||||
mtime: Date;
|
||||
ctime: Date;
|
||||
@@ -107,22 +107,27 @@ declare module "fs" {
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
addListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
|
||||
addListener(event: "error", listener: (error: Error) => void): this;
|
||||
addListener(event: "close", listener: () => void): this;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
|
||||
on(event: "error", listener: (error: Error) => void): this;
|
||||
on(event: "close", listener: () => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
|
||||
once(event: "error", listener: (error: Error) => void): this;
|
||||
once(event: "close", listener: () => void): this;
|
||||
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
|
||||
prependListener(event: "error", listener: (error: Error) => void): this;
|
||||
prependListener(event: "close", listener: () => void): this;
|
||||
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
|
||||
prependOnceListener(event: "error", listener: (error: Error) => void): this;
|
||||
prependOnceListener(event: "close", listener: () => void): this;
|
||||
}
|
||||
|
||||
class ReadStream extends stream.Readable {
|
||||
@@ -341,6 +346,39 @@ declare module "fs" {
|
||||
*/
|
||||
function lchownSync(path: PathLike, uid: number, gid: number): void;
|
||||
|
||||
/**
|
||||
* Changes the access and modification times of a file in the same way as `fs.utimes()`,
|
||||
* with the difference that if the path refers to a symbolic link, then the link is not
|
||||
* dereferenced: instead, the timestamps of the symbolic link itself are changed.
|
||||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
||||
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
||||
*/
|
||||
function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void;
|
||||
|
||||
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
||||
namespace lutimes {
|
||||
/**
|
||||
* Changes the access and modification times of a file in the same way as `fsPromises.utimes()`,
|
||||
* with the difference that if the path refers to a symbolic link, then the link is not
|
||||
* dereferenced: instead, the timestamps of the symbolic link itself are changed.
|
||||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
||||
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
||||
*/
|
||||
function __promisify__(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the file system timestamps of the symbolic link referenced by `path`. Returns `undefined`,
|
||||
* or throws an exception when parameters are incorrect or the operation fails.
|
||||
* This is the synchronous version of `fs.lutimes()`.
|
||||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
||||
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
||||
*/
|
||||
function lutimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void;
|
||||
|
||||
/**
|
||||
* Asynchronous chmod(2) - Change permissions of a file.
|
||||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||
@@ -417,6 +455,8 @@ declare module "fs" {
|
||||
* Asynchronous stat(2) - Get file status.
|
||||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||
*/
|
||||
function stat(path: PathLike, options: BigIntOptions, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
|
||||
function stat(path: PathLike, options: StatOptions, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
||||
function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
||||
|
||||
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
||||
@@ -425,6 +465,8 @@ declare module "fs" {
|
||||
* Asynchronous stat(2) - Get file status.
|
||||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||
*/
|
||||
function __promisify__(path: PathLike, options: BigIntOptions): Promise<BigIntStats>;
|
||||
function __promisify__(path: PathLike, options: StatOptions): Promise<Stats | BigIntStats>;
|
||||
function __promisify__(path: PathLike): Promise<Stats>;
|
||||
}
|
||||
|
||||
@@ -432,6 +474,8 @@ declare module "fs" {
|
||||
* Synchronous stat(2) - Get file status.
|
||||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||
*/
|
||||
function statSync(path: PathLike, options: BigIntOptions): BigIntStats;
|
||||
function statSync(path: PathLike, options: StatOptions): Stats | BigIntStats;
|
||||
function statSync(path: PathLike): Stats;
|
||||
|
||||
/**
|
||||
@@ -728,6 +772,14 @@ declare module "fs" {
|
||||
function unlinkSync(path: PathLike): void;
|
||||
|
||||
interface RmDirOptions {
|
||||
/**
|
||||
* If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is
|
||||
* encountered, Node.js will retry the operation with a linear backoff wait of
|
||||
* 100ms longer on each try. This option represents the number of retries. This
|
||||
* option is ignored if the `recursive` option is not `true`.
|
||||
* @default 3
|
||||
*/
|
||||
maxRetries?: number;
|
||||
/**
|
||||
* If `true`, perform a recursive directory removal. In
|
||||
* recursive mode, errors are not reported if `path` does not exist, and
|
||||
@@ -736,9 +788,6 @@ declare module "fs" {
|
||||
* @default false
|
||||
*/
|
||||
recursive?: boolean;
|
||||
}
|
||||
|
||||
interface RmDirAsyncOptions extends RmDirOptions {
|
||||
/**
|
||||
* If an `EMFILE` error is encountered, Node.js will
|
||||
* retry the operation with a linear backoff of 1ms longer on each try until the
|
||||
@@ -747,14 +796,6 @@ declare module "fs" {
|
||||
* @default 1000
|
||||
*/
|
||||
emfileWait?: number;
|
||||
/**
|
||||
* If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is
|
||||
* encountered, Node.js will retry the operation with a linear backoff wait of
|
||||
* 100ms longer on each try. This option represents the number of retries. This
|
||||
* option is ignored if the `recursive` option is not `true`.
|
||||
* @default 3
|
||||
*/
|
||||
maxBusyTries?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -762,7 +803,7 @@ declare module "fs" {
|
||||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||
*/
|
||||
function rmdir(path: PathLike, callback: NoParamCallback): void;
|
||||
function rmdir(path: PathLike, options: RmDirAsyncOptions, callback: NoParamCallback): void;
|
||||
function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void;
|
||||
|
||||
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
||||
namespace rmdir {
|
||||
@@ -770,7 +811,7 @@ declare module "fs" {
|
||||
* Asynchronous rmdir(2) - delete a directory.
|
||||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||
*/
|
||||
function __promisify__(path: PathLike, options?: RmDirAsyncOptions): Promise<void>;
|
||||
function __promisify__(path: PathLike, options?: RmDirOptions): Promise<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -789,7 +830,7 @@ declare module "fs" {
|
||||
* A file mode. If a string is passed, it is parsed as an octal integer. If not specified
|
||||
* @default 0o777.
|
||||
*/
|
||||
mode?: number;
|
||||
mode?: number | string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1819,6 +1860,7 @@ declare module "fs" {
|
||||
fd?: number;
|
||||
mode?: number;
|
||||
autoClose?: boolean;
|
||||
emitClose?: boolean;
|
||||
start?: number;
|
||||
highWaterMark?: number;
|
||||
}): WriteStream;
|
||||
@@ -1904,12 +1946,12 @@ declare module "fs" {
|
||||
*/
|
||||
function writev(
|
||||
fd: number,
|
||||
buffers: NodeJS.ArrayBufferView[],
|
||||
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
||||
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void
|
||||
): void;
|
||||
function writev(
|
||||
fd: number,
|
||||
buffers: NodeJS.ArrayBufferView[],
|
||||
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
||||
position: number,
|
||||
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void
|
||||
): void;
|
||||
@@ -1920,13 +1962,13 @@ declare module "fs" {
|
||||
}
|
||||
|
||||
namespace writev {
|
||||
function __promisify__(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): Promise<WriteVResult>;
|
||||
function __promisify__(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<WriteVResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* See `writev`.
|
||||
*/
|
||||
function writevSync(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): number;
|
||||
function writevSync(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): number;
|
||||
|
||||
interface OpenDirOptions {
|
||||
encoding?: BufferEncoding;
|
||||
@@ -2070,7 +2112,7 @@ declare module "fs" {
|
||||
/**
|
||||
* See `fs.writev` promisified version.
|
||||
*/
|
||||
writev(buffers: NodeJS.ArrayBufferView[], position?: number): Promise<WriteVResult>;
|
||||
writev(buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<WriteVResult>;
|
||||
|
||||
/**
|
||||
* Asynchronous close(2) - close a `FileHandle`.
|
||||
@@ -2177,7 +2219,7 @@ declare module "fs" {
|
||||
* Asynchronous rmdir(2) - delete a directory.
|
||||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||
*/
|
||||
function rmdir(path: PathLike, options?: RmDirAsyncOptions): Promise<void>;
|
||||
function rmdir(path: PathLike, options?: RmDirOptions): Promise<void>;
|
||||
|
||||
/**
|
||||
* Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
|
||||
@@ -2315,6 +2357,16 @@ declare module "fs" {
|
||||
*/
|
||||
function lchown(path: PathLike, uid: number, gid: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Changes the access and modification times of a file in the same way as `fsPromises.utimes()`,
|
||||
* with the difference that if the path refers to a symbolic link, then the link is not
|
||||
* dereferenced: instead, the timestamps of the symbolic link itself are changed.
|
||||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
||||
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
||||
*/
|
||||
function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
|
||||
|
||||
/**
|
||||
* Asynchronous fchown(2) - Change ownership of a file.
|
||||
* @param handle A `FileHandle`.
|
||||
@@ -2443,4 +2495,22 @@ declare module "fs" {
|
||||
|
||||
function opendir(path: string, options?: OpenDirOptions): Promise<Dir>;
|
||||
}
|
||||
|
||||
interface BigIntStats extends StatsBase<bigint> {
|
||||
}
|
||||
|
||||
class BigIntStats {
|
||||
atimeNs: bigint;
|
||||
mtimeNs: bigint;
|
||||
ctimeNs: bigint;
|
||||
birthtimeNs: bigint;
|
||||
}
|
||||
|
||||
interface BigIntOptions {
|
||||
bigint: true;
|
||||
}
|
||||
|
||||
interface StatOptions {
|
||||
bigint: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
+68
-17
@@ -62,7 +62,7 @@ interface Console {
|
||||
* This method does not display anything unless used in the inspector.
|
||||
* Prints to `stdout` the array `array` formatted as a table.
|
||||
*/
|
||||
table(tabularData: any, properties?: string[]): void;
|
||||
table(tabularData: any, properties?: ReadonlyArray<string>): void;
|
||||
/**
|
||||
* Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique `label`.
|
||||
*/
|
||||
@@ -152,6 +152,11 @@ interface String {
|
||||
trimLeft(): string;
|
||||
/** Removes whitespace from the right end of a string. */
|
||||
trimRight(): string;
|
||||
|
||||
/** Returns a copy with leading whitespace removed. */
|
||||
trimStart(): string;
|
||||
/** Returns a copy with trailing whitespace removed. */
|
||||
trimEnd(): string;
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
@@ -164,7 +169,6 @@ interface ImportMeta {
|
||||
* *
|
||||
------------------------------------------------*/
|
||||
declare var process: NodeJS.Process;
|
||||
declare var global: NodeJS.Global;
|
||||
declare var console: Console;
|
||||
|
||||
declare var __filename: string;
|
||||
@@ -189,7 +193,6 @@ declare function queueMicrotask(callback: () => void): void;
|
||||
|
||||
// TODO: change to `type NodeRequireFunction = (id: string) => any;` in next mayor version.
|
||||
interface NodeRequireFunction {
|
||||
/* tslint:disable-next-line:callable-types */
|
||||
(id: string): any;
|
||||
}
|
||||
|
||||
@@ -227,8 +230,15 @@ interface NodeModule {
|
||||
id: string;
|
||||
filename: string;
|
||||
loaded: boolean;
|
||||
parent: NodeModule | null;
|
||||
/** @deprecated since 12.19.0 Please use `require.main` and `module.children` instead. */
|
||||
parent: NodeModule | null | undefined;
|
||||
children: NodeModule[];
|
||||
/**
|
||||
* @since 11.14.0
|
||||
*
|
||||
* The directory name of the module. This is usually the same as the path.dirname() of the module.id.
|
||||
*/
|
||||
path: string;
|
||||
paths: string[];
|
||||
}
|
||||
|
||||
@@ -242,6 +252,14 @@ type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2"
|
||||
|
||||
interface Buffer {
|
||||
constructor: typeof Buffer;
|
||||
readBigUInt64BE(offset?: number): bigint;
|
||||
readBigUInt64LE(offset?: number): bigint;
|
||||
readBigInt64BE(offset?: number): bigint;
|
||||
readBigInt64LE(offset?: number): bigint;
|
||||
writeBigInt64BE(value: bigint, offset?: number): number;
|
||||
writeBigInt64LE(value: bigint, offset?: number): number;
|
||||
writeBigUInt64BE(value: bigint, offset?: number): number;
|
||||
writeBigUInt64LE(value: bigint, offset?: number): number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,7 +305,7 @@ declare class Buffer extends Uint8Array {
|
||||
* @param array The octets to store.
|
||||
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
||||
*/
|
||||
constructor(array: any[]);
|
||||
constructor(array: ReadonlyArray<any>);
|
||||
/**
|
||||
* Copies the passed {buffer} data onto a new {Buffer} instance.
|
||||
*
|
||||
@@ -308,8 +326,14 @@ declare class Buffer extends Uint8Array {
|
||||
* Creates a new Buffer using the passed {data}
|
||||
* @param data data to create a new Buffer
|
||||
*/
|
||||
static from(data: number[]): Buffer;
|
||||
static from(data: ReadonlyArray<number>): Buffer;
|
||||
static from(data: Uint8Array): Buffer;
|
||||
/**
|
||||
* Creates a new buffer containing the coerced value of an object
|
||||
* A `TypeError` will be thrown if {obj} has not mentioned methods or is not of other type appropriate for `Buffer.from()` variants.
|
||||
* @param obj An object supporting `Symbol.toPrimitive` or `valueOf()`.
|
||||
*/
|
||||
static from(obj: { valueOf(): string | object } | { [Symbol.toPrimitive](hint: 'string'): string }, byteOffset?: number, length?: number): Buffer;
|
||||
/**
|
||||
* Creates a new Buffer containing the given JavaScript string {str}.
|
||||
* If provided, the {encoding} parameter identifies the character encoding.
|
||||
@@ -356,7 +380,7 @@ declare class Buffer extends Uint8Array {
|
||||
* @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;
|
||||
static concat(list: ReadonlyArray<Uint8Array>, totalLength?: number): Buffer;
|
||||
/**
|
||||
* The same as buf1.compare(buf2).
|
||||
*/
|
||||
@@ -739,6 +763,7 @@ declare namespace NodeJS {
|
||||
|
||||
interface HRTime {
|
||||
(time?: [number, number]): [number, number];
|
||||
bigint(): bigint;
|
||||
}
|
||||
|
||||
interface ProcessReport {
|
||||
@@ -840,7 +865,7 @@ declare namespace NodeJS {
|
||||
argv0: string;
|
||||
execArgv: string[];
|
||||
execPath: string;
|
||||
abort(): void;
|
||||
abort(): never;
|
||||
chdir(directory: string): void;
|
||||
cwd(): string;
|
||||
debugPort: number;
|
||||
@@ -857,7 +882,7 @@ declare namespace NodeJS {
|
||||
getegid(): number;
|
||||
setegid(id: number | string): void;
|
||||
getgroups(): number[];
|
||||
setgroups(groups: Array<string | number>): void;
|
||||
setgroups(groups: ReadonlyArray<string | number>): void;
|
||||
setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void;
|
||||
hasUncaughtExceptionCaptureCallback(): boolean;
|
||||
version: string;
|
||||
@@ -888,7 +913,7 @@ declare namespace NodeJS {
|
||||
visibility: string;
|
||||
};
|
||||
};
|
||||
kill(pid: number, signal?: string | number): void;
|
||||
kill(pid: number, signal?: string | number): true;
|
||||
pid: number;
|
||||
ppid: number;
|
||||
title: string;
|
||||
@@ -909,10 +934,16 @@ declare namespace NodeJS {
|
||||
tls_ocsp: boolean;
|
||||
tls: boolean;
|
||||
};
|
||||
/**
|
||||
* @deprecated since v12.19.0 - Calling process.umask() with no argument causes
|
||||
* the process-wide umask to be written twice. This introduces a race condition between threads,
|
||||
* and is a potential security vulnerability. There is no safe, cross-platform alternative API.
|
||||
*/
|
||||
umask(): number;
|
||||
/**
|
||||
* Can only be set if not in worker thread.
|
||||
*/
|
||||
umask(mask?: number): number;
|
||||
umask(mask: string | number): number;
|
||||
uptime(): number;
|
||||
hrtime: HRTime;
|
||||
domain: Domain;
|
||||
@@ -1115,6 +1146,7 @@ declare namespace NodeJS {
|
||||
ref(): this;
|
||||
refresh(): this;
|
||||
unref(): this;
|
||||
[Symbol.toPrimitive](): number;
|
||||
}
|
||||
|
||||
class Immediate {
|
||||
@@ -1129,6 +1161,7 @@ declare namespace NodeJS {
|
||||
ref(): this;
|
||||
refresh(): this;
|
||||
unref(): this;
|
||||
[Symbol.toPrimitive](): number;
|
||||
}
|
||||
|
||||
class Module {
|
||||
@@ -1149,17 +1182,35 @@ declare namespace NodeJS {
|
||||
id: string;
|
||||
filename: string;
|
||||
loaded: boolean;
|
||||
parent: Module | null;
|
||||
/** @deprecated since 12.19.0 Please use `require.main` and `module.children` instead. */
|
||||
parent: Module | null | undefined;
|
||||
children: Module[];
|
||||
/**
|
||||
* @since 11.14.0
|
||||
*
|
||||
* The directory name of the module. This is usually the same as the path.dirname() of the module.id.
|
||||
*/
|
||||
path: string;
|
||||
paths: string[];
|
||||
|
||||
constructor(id: string, parent?: Module);
|
||||
}
|
||||
|
||||
type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;
|
||||
type ArrayBufferView = TypedArray | DataView;
|
||||
interface Dict<T> {
|
||||
[key: string]: T | undefined;
|
||||
}
|
||||
|
||||
// The value type here is a "poor man's `unknown`". When these types support TypeScript
|
||||
// 3.0+, we can replace this with `unknown`.
|
||||
type PoorMansUnknown = {} | null | undefined;
|
||||
type TypedArray =
|
||||
| Uint8Array
|
||||
| Uint8ClampedArray
|
||||
| Uint16Array
|
||||
| Uint32Array
|
||||
| Int8Array
|
||||
| Int16Array
|
||||
| Int32Array
|
||||
| BigUint64Array
|
||||
| BigInt64Array
|
||||
| Float32Array
|
||||
| Float64Array;
|
||||
type ArrayBufferView = TypedArray | DataView;
|
||||
}
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
declare var global: NodeJS.Global & typeof globalThis;
|
||||
+16
-4
@@ -16,6 +16,8 @@ declare module "http" {
|
||||
'access-control-allow-origin'?: string;
|
||||
'access-control-expose-headers'?: string;
|
||||
'access-control-max-age'?: string;
|
||||
'access-control-request-headers'?: string;
|
||||
'access-control-request-method'?: string;
|
||||
'age'?: string;
|
||||
'allow'?: string;
|
||||
'alt-svc'?: string;
|
||||
@@ -42,6 +44,7 @@ declare module "http" {
|
||||
'if-unmodified-since'?: string;
|
||||
'last-modified'?: string;
|
||||
'location'?: string;
|
||||
'origin'?: string;
|
||||
'pragma'?: string;
|
||||
'proxy-authenticate'?: string;
|
||||
'proxy-authorization'?: string;
|
||||
@@ -132,13 +135,13 @@ declare module "http" {
|
||||
constructor();
|
||||
|
||||
setTimeout(msecs: number, callback?: () => void): this;
|
||||
setHeader(name: string, value: number | string | string[]): void;
|
||||
setHeader(name: string, value: number | string | ReadonlyArray<string>): void;
|
||||
getHeader(name: string): number | string | string[] | undefined;
|
||||
getHeaders(): OutgoingHttpHeaders;
|
||||
getHeaderNames(): string[];
|
||||
hasHeader(name: string): boolean;
|
||||
removeHeader(name: string): void;
|
||||
addTrailers(headers: OutgoingHttpHeaders | Array<[string, string]>): void;
|
||||
addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void;
|
||||
flushHeaders(): void;
|
||||
}
|
||||
|
||||
@@ -170,14 +173,17 @@ declare module "http" {
|
||||
rawHeaders: string[];
|
||||
}
|
||||
|
||||
// https://github.com/nodejs/node/blob/master/lib/_http_client.js#L77
|
||||
// https://github.com/nodejs/node/blob/v12.20.0/lib/_http_client.js#L85
|
||||
class ClientRequest extends OutgoingMessage {
|
||||
connection: Socket;
|
||||
socket: Socket;
|
||||
aborted: number;
|
||||
aborted: boolean;
|
||||
host: string;
|
||||
protocol: string;
|
||||
|
||||
constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void);
|
||||
|
||||
method: string;
|
||||
readonly path: string;
|
||||
abort(): void;
|
||||
onSocket(socket: Socket): void;
|
||||
@@ -269,6 +275,7 @@ declare module "http" {
|
||||
class IncomingMessage extends stream.Readable {
|
||||
constructor(socket: Socket);
|
||||
|
||||
aborted: boolean;
|
||||
httpVersion: string;
|
||||
httpVersionMajor: number;
|
||||
httpVersionMinor: number;
|
||||
@@ -313,6 +320,10 @@ declare module "http" {
|
||||
* Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
|
||||
*/
|
||||
maxSockets?: number;
|
||||
/**
|
||||
* Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity.
|
||||
*/
|
||||
maxTotalSockets?: number;
|
||||
/**
|
||||
* Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256.
|
||||
*/
|
||||
@@ -326,6 +337,7 @@ declare module "http" {
|
||||
class Agent {
|
||||
maxFreeSockets: number;
|
||||
maxSockets: number;
|
||||
maxTotalSockets: number;
|
||||
readonly sockets: {
|
||||
readonly [key: string]: Socket[];
|
||||
};
|
||||
|
||||
+3
-3
@@ -356,7 +356,7 @@ declare module "http2" {
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
emit(event: "altsvc", alt: string, origin: string, stream: number): boolean;
|
||||
emit(event: "origin", origins: string[]): boolean;
|
||||
emit(event: "origin", origins: ReadonlyArray<string>): boolean;
|
||||
emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
|
||||
emit(event: "stream", stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
@@ -570,7 +570,7 @@ declare module "http2" {
|
||||
}
|
||||
|
||||
export class Http2ServerRequest extends stream.Readable {
|
||||
constructor(stream: ServerHttp2Stream, headers: IncomingHttpHeaders, options: stream.ReadableOptions, rawHeaders: string[]);
|
||||
constructor(stream: ServerHttp2Stream, headers: IncomingHttpHeaders, options: stream.ReadableOptions, rawHeaders: ReadonlyArray<string>);
|
||||
|
||||
readonly aborted: boolean;
|
||||
readonly authority: string;
|
||||
@@ -657,7 +657,7 @@ declare module "http2" {
|
||||
getHeaders(): OutgoingHttpHeaders;
|
||||
hasHeader(name: string): boolean;
|
||||
removeHeader(name: string): void;
|
||||
setHeader(name: string, value: number | string | string[]): void;
|
||||
setHeader(name: string, value: number | string | ReadonlyArray<string>): void;
|
||||
setTimeout(msecs: number, callback?: () => void): void;
|
||||
write(chunk: string | Uint8Array, callback?: (err: Error) => void): boolean;
|
||||
write(chunk: string | Uint8Array, encoding: string, callback?: (err: Error) => void): boolean;
|
||||
|
||||
+6
-60
@@ -1,4 +1,4 @@
|
||||
// Type definitions for non-npm package Node.js 12.12
|
||||
// Type definitions for non-npm package Node.js 12.19
|
||||
// Project: http://nodejs.org/
|
||||
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
|
||||
// DefinitelyTyped <https://github.com/DefinitelyTyped>
|
||||
@@ -9,7 +9,6 @@
|
||||
// Benjamin Toueg <https://github.com/btoueg>
|
||||
// Bruno Scheufler <https://github.com/brunoscheufler>
|
||||
// Chigozirim C. <https://github.com/smac89>
|
||||
// Christian Vaagland Tellnes <https://github.com/tellnes>
|
||||
// David Junger <https://github.com/touffy>
|
||||
// Deividas Bakanas <https://github.com/DeividasBakanas>
|
||||
// Eugene Y. Q. Shen <https://github.com/eyqs>
|
||||
@@ -23,7 +22,6 @@
|
||||
// Mariusz Wiktorczyk <https://github.com/mwiktorczyk>
|
||||
// Mohsen Azimi <https://github.com/mohsen1>
|
||||
// Nicolas Even <https://github.com/n-e>
|
||||
// Nicolas Voigt <https://github.com/octo-sniffle>
|
||||
// Nikita Galkin <https://github.com/galkin>
|
||||
// Parambir Singh <https://github.com/parambirs>
|
||||
// Sebastian Silbermann <https://github.com/eps1lon>
|
||||
@@ -41,64 +39,12 @@
|
||||
// Minh Son Nguyen <https://github.com/nguymin4>
|
||||
// Junxiao Shi <https://github.com/yoursunny>
|
||||
// Ilia Baryshnikov <https://github.com/qwelias>
|
||||
// ExE Boss <https://github.com/ExE-Boss>
|
||||
// Jason Kwok <https://github.com/JasonHK>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.2.
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.7.
|
||||
// This isn't strictly needed since 3.7 has the assert module, but this way we're consistent.
|
||||
// Typically type modificatons should be made in base.d.ts instead of here
|
||||
|
||||
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
|
||||
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
|
||||
// - ~/index.d.ts - Definitions specific to TypeScript 2.1
|
||||
// - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2
|
||||
|
||||
// NOTE: Augmentations for TypeScript 3.2 and later should use individual files for overrides
|
||||
// within the respective ~/ts3.2 (or later) folder. However, this is disallowed for versions
|
||||
// prior to TypeScript 3.2, so the older definitions will be found here.
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
/// <reference path="base.d.ts" />
|
||||
|
||||
// TypeScript 2.1-specific augmentations:
|
||||
|
||||
// Forward-declarations for needed types from es2015 and later (in case users are using `--lib es5`)
|
||||
// Empty interfaces are used here which merge fine with the real declarations in the lib XXX files
|
||||
// just to ensure the names are known and node typings can be sued without importing these libs.
|
||||
// if someone really needs these types the libs need to be added via --lib or in tsconfig.json
|
||||
interface MapConstructor { }
|
||||
interface WeakMapConstructor { }
|
||||
interface SetConstructor { }
|
||||
interface WeakSetConstructor { }
|
||||
interface Set<T> {}
|
||||
interface Map<K, V> {}
|
||||
interface ReadonlySet<T> {}
|
||||
interface Iterable<T> { }
|
||||
interface IteratorResult<T> { }
|
||||
interface AsyncIterable<T> { }
|
||||
interface Iterator<T> {
|
||||
next(value?: any): IteratorResult<T>;
|
||||
}
|
||||
interface IterableIterator<T> { }
|
||||
interface AsyncIterableIterator<T> {}
|
||||
interface SymbolConstructor {
|
||||
readonly iterator: symbol;
|
||||
readonly asyncIterator: symbol;
|
||||
}
|
||||
declare var Symbol: SymbolConstructor;
|
||||
// even this is just a forward declaration some properties are added otherwise
|
||||
// it would be allowed to pass anything to e.g. Buffer.from()
|
||||
interface SharedArrayBuffer {
|
||||
readonly byteLength: number;
|
||||
slice(begin?: number, end?: number): SharedArrayBuffer;
|
||||
}
|
||||
|
||||
declare module "util" {
|
||||
namespace inspect {
|
||||
const custom: symbol;
|
||||
}
|
||||
namespace promisify {
|
||||
const custom: symbol;
|
||||
}
|
||||
namespace types {
|
||||
function isBigInt64Array(value: any): boolean;
|
||||
function isBigUint64Array(value: any): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
+232
-223
@@ -1,227 +1,236 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@types/node@12.12.14",
|
||||
"/home/marco/repos/github/codeql-action"
|
||||
]
|
||||
],
|
||||
"_from": "@types/node@12.12.14",
|
||||
"_id": "@types/node@12.12.14",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-u/SJDyXwuihpwjXy7hOOghagLEV1KdAST6syfnOk6QZAMzZuWZqXy5aYYZbh8Jdpd4escVFP0MvftHNDb9pruA==",
|
||||
"_location": "/@types/node",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@types/node@12.12.14",
|
||||
"name": "@types/node",
|
||||
"escapedName": "@types%2fnode",
|
||||
"scope": "@types",
|
||||
"rawSpec": "12.12.14",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "12.12.14"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/",
|
||||
"/@octokit/types",
|
||||
"/@types/glob",
|
||||
"/@types/jszip",
|
||||
"/@types/semver"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.14.tgz",
|
||||
"_spec": "12.12.14",
|
||||
"_where": "/home/marco/repos/github/codeql-action",
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Microsoft TypeScript",
|
||||
"url": "https://github.com/Microsoft"
|
||||
"version": "12.19.8",
|
||||
"description": "TypeScript definitions for Node.js",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Microsoft TypeScript",
|
||||
"url": "https://github.com/Microsoft",
|
||||
"githubUsername": "Microsoft"
|
||||
},
|
||||
{
|
||||
"name": "DefinitelyTyped",
|
||||
"url": "https://github.com/DefinitelyTyped",
|
||||
"githubUsername": "DefinitelyTyped"
|
||||
},
|
||||
{
|
||||
"name": "Alberto Schiabel",
|
||||
"url": "https://github.com/jkomyno",
|
||||
"githubUsername": "jkomyno"
|
||||
},
|
||||
{
|
||||
"name": "Alexander T.",
|
||||
"url": "https://github.com/a-tarasyuk",
|
||||
"githubUsername": "a-tarasyuk"
|
||||
},
|
||||
{
|
||||
"name": "Alvis HT Tang",
|
||||
"url": "https://github.com/alvis",
|
||||
"githubUsername": "alvis"
|
||||
},
|
||||
{
|
||||
"name": "Andrew Makarov",
|
||||
"url": "https://github.com/r3nya",
|
||||
"githubUsername": "r3nya"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Toueg",
|
||||
"url": "https://github.com/btoueg",
|
||||
"githubUsername": "btoueg"
|
||||
},
|
||||
{
|
||||
"name": "Bruno Scheufler",
|
||||
"url": "https://github.com/brunoscheufler",
|
||||
"githubUsername": "brunoscheufler"
|
||||
},
|
||||
{
|
||||
"name": "Chigozirim C.",
|
||||
"url": "https://github.com/smac89",
|
||||
"githubUsername": "smac89"
|
||||
},
|
||||
{
|
||||
"name": "David Junger",
|
||||
"url": "https://github.com/touffy",
|
||||
"githubUsername": "touffy"
|
||||
},
|
||||
{
|
||||
"name": "Deividas Bakanas",
|
||||
"url": "https://github.com/DeividasBakanas",
|
||||
"githubUsername": "DeividasBakanas"
|
||||
},
|
||||
{
|
||||
"name": "Eugene Y. Q. Shen",
|
||||
"url": "https://github.com/eyqs",
|
||||
"githubUsername": "eyqs"
|
||||
},
|
||||
{
|
||||
"name": "Flarna",
|
||||
"url": "https://github.com/Flarna",
|
||||
"githubUsername": "Flarna"
|
||||
},
|
||||
{
|
||||
"name": "Hannes Magnusson",
|
||||
"url": "https://github.com/Hannes-Magnusson-CK",
|
||||
"githubUsername": "Hannes-Magnusson-CK"
|
||||
},
|
||||
{
|
||||
"name": "Hoàng Văn Khải",
|
||||
"url": "https://github.com/KSXGitHub",
|
||||
"githubUsername": "KSXGitHub"
|
||||
},
|
||||
{
|
||||
"name": "Huw",
|
||||
"url": "https://github.com/hoo29",
|
||||
"githubUsername": "hoo29"
|
||||
},
|
||||
{
|
||||
"name": "Kelvin Jin",
|
||||
"url": "https://github.com/kjin",
|
||||
"githubUsername": "kjin"
|
||||
},
|
||||
{
|
||||
"name": "Klaus Meinhardt",
|
||||
"url": "https://github.com/ajafff",
|
||||
"githubUsername": "ajafff"
|
||||
},
|
||||
{
|
||||
"name": "Lishude",
|
||||
"url": "https://github.com/islishude",
|
||||
"githubUsername": "islishude"
|
||||
},
|
||||
{
|
||||
"name": "Mariusz Wiktorczyk",
|
||||
"url": "https://github.com/mwiktorczyk",
|
||||
"githubUsername": "mwiktorczyk"
|
||||
},
|
||||
{
|
||||
"name": "Mohsen Azimi",
|
||||
"url": "https://github.com/mohsen1",
|
||||
"githubUsername": "mohsen1"
|
||||
},
|
||||
{
|
||||
"name": "Nicolas Even",
|
||||
"url": "https://github.com/n-e",
|
||||
"githubUsername": "n-e"
|
||||
},
|
||||
{
|
||||
"name": "Nikita Galkin",
|
||||
"url": "https://github.com/galkin",
|
||||
"githubUsername": "galkin"
|
||||
},
|
||||
{
|
||||
"name": "Parambir Singh",
|
||||
"url": "https://github.com/parambirs",
|
||||
"githubUsername": "parambirs"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Silbermann",
|
||||
"url": "https://github.com/eps1lon",
|
||||
"githubUsername": "eps1lon"
|
||||
},
|
||||
{
|
||||
"name": "Simon Schick",
|
||||
"url": "https://github.com/SimonSchick",
|
||||
"githubUsername": "SimonSchick"
|
||||
},
|
||||
{
|
||||
"name": "Thomas den Hollander",
|
||||
"url": "https://github.com/ThomasdenH",
|
||||
"githubUsername": "ThomasdenH"
|
||||
},
|
||||
{
|
||||
"name": "Wilco Bakker",
|
||||
"url": "https://github.com/WilcoBakker",
|
||||
"githubUsername": "WilcoBakker"
|
||||
},
|
||||
{
|
||||
"name": "wwwy3y3",
|
||||
"url": "https://github.com/wwwy3y3",
|
||||
"githubUsername": "wwwy3y3"
|
||||
},
|
||||
{
|
||||
"name": "Zane Hannan AU",
|
||||
"url": "https://github.com/ZaneHannanAU",
|
||||
"githubUsername": "ZaneHannanAU"
|
||||
},
|
||||
{
|
||||
"name": "Samuel Ainsworth",
|
||||
"url": "https://github.com/samuela",
|
||||
"githubUsername": "samuela"
|
||||
},
|
||||
{
|
||||
"name": "Kyle Uehlein",
|
||||
"url": "https://github.com/kuehlein",
|
||||
"githubUsername": "kuehlein"
|
||||
},
|
||||
{
|
||||
"name": "Jordi Oliveras Rovira",
|
||||
"url": "https://github.com/j-oliveras",
|
||||
"githubUsername": "j-oliveras"
|
||||
},
|
||||
{
|
||||
"name": "Thanik Bhongbhibhat",
|
||||
"url": "https://github.com/bhongy",
|
||||
"githubUsername": "bhongy"
|
||||
},
|
||||
{
|
||||
"name": "Marcin Kopacz",
|
||||
"url": "https://github.com/chyzwar",
|
||||
"githubUsername": "chyzwar"
|
||||
},
|
||||
{
|
||||
"name": "Trivikram Kamat",
|
||||
"url": "https://github.com/trivikr",
|
||||
"githubUsername": "trivikr"
|
||||
},
|
||||
{
|
||||
"name": "Minh Son Nguyen",
|
||||
"url": "https://github.com/nguymin4",
|
||||
"githubUsername": "nguymin4"
|
||||
},
|
||||
{
|
||||
"name": "Junxiao Shi",
|
||||
"url": "https://github.com/yoursunny",
|
||||
"githubUsername": "yoursunny"
|
||||
},
|
||||
{
|
||||
"name": "Ilia Baryshnikov",
|
||||
"url": "https://github.com/qwelias",
|
||||
"githubUsername": "qwelias"
|
||||
},
|
||||
{
|
||||
"name": "ExE Boss",
|
||||
"url": "https://github.com/ExE-Boss",
|
||||
"githubUsername": "ExE-Boss"
|
||||
},
|
||||
{
|
||||
"name": "Jason Kwok",
|
||||
"url": "https://github.com/JasonHK",
|
||||
"githubUsername": "JasonHK"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"typesVersions": {
|
||||
"<=3.3": {
|
||||
"*": [
|
||||
"ts3.3/*"
|
||||
]
|
||||
},
|
||||
"<=3.6": {
|
||||
"*": [
|
||||
"ts3.6/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "DefinitelyTyped",
|
||||
"url": "https://github.com/DefinitelyTyped"
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/node"
|
||||
},
|
||||
{
|
||||
"name": "Alberto Schiabel",
|
||||
"url": "https://github.com/jkomyno"
|
||||
},
|
||||
{
|
||||
"name": "Alexander T.",
|
||||
"url": "https://github.com/a-tarasyuk"
|
||||
},
|
||||
{
|
||||
"name": "Alvis HT Tang",
|
||||
"url": "https://github.com/alvis"
|
||||
},
|
||||
{
|
||||
"name": "Andrew Makarov",
|
||||
"url": "https://github.com/r3nya"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Toueg",
|
||||
"url": "https://github.com/btoueg"
|
||||
},
|
||||
{
|
||||
"name": "Bruno Scheufler",
|
||||
"url": "https://github.com/brunoscheufler"
|
||||
},
|
||||
{
|
||||
"name": "Chigozirim C.",
|
||||
"url": "https://github.com/smac89"
|
||||
},
|
||||
{
|
||||
"name": "Christian Vaagland Tellnes",
|
||||
"url": "https://github.com/tellnes"
|
||||
},
|
||||
{
|
||||
"name": "David Junger",
|
||||
"url": "https://github.com/touffy"
|
||||
},
|
||||
{
|
||||
"name": "Deividas Bakanas",
|
||||
"url": "https://github.com/DeividasBakanas"
|
||||
},
|
||||
{
|
||||
"name": "Eugene Y. Q. Shen",
|
||||
"url": "https://github.com/eyqs"
|
||||
},
|
||||
{
|
||||
"name": "Flarna",
|
||||
"url": "https://github.com/Flarna"
|
||||
},
|
||||
{
|
||||
"name": "Hannes Magnusson",
|
||||
"url": "https://github.com/Hannes-Magnusson-CK"
|
||||
},
|
||||
{
|
||||
"name": "Hoàng Văn Khải",
|
||||
"url": "https://github.com/KSXGitHub"
|
||||
},
|
||||
{
|
||||
"name": "Huw",
|
||||
"url": "https://github.com/hoo29"
|
||||
},
|
||||
{
|
||||
"name": "Kelvin Jin",
|
||||
"url": "https://github.com/kjin"
|
||||
},
|
||||
{
|
||||
"name": "Klaus Meinhardt",
|
||||
"url": "https://github.com/ajafff"
|
||||
},
|
||||
{
|
||||
"name": "Lishude",
|
||||
"url": "https://github.com/islishude"
|
||||
},
|
||||
{
|
||||
"name": "Mariusz Wiktorczyk",
|
||||
"url": "https://github.com/mwiktorczyk"
|
||||
},
|
||||
{
|
||||
"name": "Mohsen Azimi",
|
||||
"url": "https://github.com/mohsen1"
|
||||
},
|
||||
{
|
||||
"name": "Nicolas Even",
|
||||
"url": "https://github.com/n-e"
|
||||
},
|
||||
{
|
||||
"name": "Nicolas Voigt",
|
||||
"url": "https://github.com/octo-sniffle"
|
||||
},
|
||||
{
|
||||
"name": "Nikita Galkin",
|
||||
"url": "https://github.com/galkin"
|
||||
},
|
||||
{
|
||||
"name": "Parambir Singh",
|
||||
"url": "https://github.com/parambirs"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Silbermann",
|
||||
"url": "https://github.com/eps1lon"
|
||||
},
|
||||
{
|
||||
"name": "Simon Schick",
|
||||
"url": "https://github.com/SimonSchick"
|
||||
},
|
||||
{
|
||||
"name": "Thomas den Hollander",
|
||||
"url": "https://github.com/ThomasdenH"
|
||||
},
|
||||
{
|
||||
"name": "Wilco Bakker",
|
||||
"url": "https://github.com/WilcoBakker"
|
||||
},
|
||||
{
|
||||
"name": "wwwy3y3",
|
||||
"url": "https://github.com/wwwy3y3"
|
||||
},
|
||||
{
|
||||
"name": "Zane Hannan AU",
|
||||
"url": "https://github.com/ZaneHannanAU"
|
||||
},
|
||||
{
|
||||
"name": "Samuel Ainsworth",
|
||||
"url": "https://github.com/samuela"
|
||||
},
|
||||
{
|
||||
"name": "Kyle Uehlein",
|
||||
"url": "https://github.com/kuehlein"
|
||||
},
|
||||
{
|
||||
"name": "Jordi Oliveras Rovira",
|
||||
"url": "https://github.com/j-oliveras"
|
||||
},
|
||||
{
|
||||
"name": "Thanik Bhongbhibhat",
|
||||
"url": "https://github.com/bhongy"
|
||||
},
|
||||
{
|
||||
"name": "Marcin Kopacz",
|
||||
"url": "https://github.com/chyzwar"
|
||||
},
|
||||
{
|
||||
"name": "Trivikram Kamat",
|
||||
"url": "https://github.com/trivikr"
|
||||
},
|
||||
{
|
||||
"name": "Minh Son Nguyen",
|
||||
"url": "https://github.com/nguymin4"
|
||||
},
|
||||
{
|
||||
"name": "Junxiao Shi",
|
||||
"url": "https://github.com/yoursunny"
|
||||
},
|
||||
{
|
||||
"name": "Ilia Baryshnikov",
|
||||
"url": "https://github.com/qwelias"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "TypeScript definitions for Node.js",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
|
||||
"license": "MIT",
|
||||
"main": "",
|
||||
"name": "@types/node",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/node"
|
||||
},
|
||||
"scripts": {},
|
||||
"typeScriptVersion": "2.8",
|
||||
"types": "index.d.ts",
|
||||
"typesPublisherContentHash": "305a8ff81632f0e70287898475e87d6aedbd683a5e37cb775f9ea845625cfa06",
|
||||
"typesVersions": {
|
||||
">=3.2.0-0": {
|
||||
"*": [
|
||||
"ts3.2/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": "12.12.14"
|
||||
}
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"typesPublisherContentHash": "fbb8d0256722db1e7d6892cfbf2ebb540436e14769bf24b8e54853751ec8d869",
|
||||
"typeScriptVersion": "3.3"
|
||||
}
|
||||
+26
-71
@@ -35,78 +35,52 @@ declare module "perf_hooks" {
|
||||
interface PerformanceNodeTiming extends PerformanceEntry {
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which the Node.js process completed bootstrap.
|
||||
* If bootstrapping has not yet finished, the property has the value of -1.
|
||||
*/
|
||||
readonly bootstrapComplete: number;
|
||||
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which cluster processing ended.
|
||||
* The high resolution millisecond timestamp at which the Node.js process completed bootstrapping.
|
||||
* If bootstrapping has not yet finished, the property has the value of -1.
|
||||
*/
|
||||
readonly clusterSetupEnd: number;
|
||||
readonly environment: number;
|
||||
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which cluster processing started.
|
||||
* The high resolution millisecond timestamp at which the Node.js environment was initialized.
|
||||
*/
|
||||
readonly clusterSetupStart: number;
|
||||
readonly idleTime: number;
|
||||
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which the Node.js event loop exited.
|
||||
* If the event loop has not yet exited, the property has the value of -1.
|
||||
* It can only have a value of not -1 in a handler of the 'exit' event.
|
||||
*/
|
||||
readonly loopExit: number;
|
||||
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which the Node.js event loop started.
|
||||
* If the event loop has not yet started (e.g., in the first tick of the main script), the property has the value of -1.
|
||||
*/
|
||||
readonly loopStart: number;
|
||||
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which main module load ended.
|
||||
*/
|
||||
readonly moduleLoadEnd: number;
|
||||
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which main module load started.
|
||||
*/
|
||||
readonly moduleLoadStart: number;
|
||||
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which the Node.js process was initialized.
|
||||
*/
|
||||
readonly nodeStart: number;
|
||||
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which preload module load ended.
|
||||
*/
|
||||
readonly preloadModuleLoadEnd: number;
|
||||
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which preload module load started.
|
||||
*/
|
||||
readonly preloadModuleLoadStart: number;
|
||||
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which third_party_main processing ended.
|
||||
*/
|
||||
readonly thirdPartyMainEnd: number;
|
||||
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which third_party_main processing started.
|
||||
*/
|
||||
readonly thirdPartyMainStart: number;
|
||||
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which the V8 platform was initialized.
|
||||
*/
|
||||
readonly v8Start: number;
|
||||
}
|
||||
|
||||
interface Performance {
|
||||
/**
|
||||
* If name is not provided, removes all PerformanceFunction objects from the Performance Timeline.
|
||||
* If name is provided, removes entries with name.
|
||||
* @param name
|
||||
*/
|
||||
clearFunctions(name?: string): void;
|
||||
interface EventLoopUtilization {
|
||||
idle: number;
|
||||
active: number;
|
||||
utilization: number;
|
||||
}
|
||||
|
||||
interface Performance {
|
||||
/**
|
||||
* If name is not provided, removes all PerformanceMark objects from the Performance Timeline.
|
||||
* If name is provided, removes only the named mark.
|
||||
@@ -114,35 +88,6 @@ declare module "perf_hooks" {
|
||||
*/
|
||||
clearMarks(name?: string): void;
|
||||
|
||||
/**
|
||||
* If name is not provided, removes all PerformanceMeasure objects from the Performance Timeline.
|
||||
* If name is provided, removes only objects whose performanceEntry.name matches name.
|
||||
*/
|
||||
clearMeasures(name?: string): void;
|
||||
|
||||
/**
|
||||
* Returns a list of all PerformanceEntry objects in chronological order with respect to performanceEntry.startTime.
|
||||
* @return list of all PerformanceEntry objects
|
||||
*/
|
||||
getEntries(): PerformanceEntry[];
|
||||
|
||||
/**
|
||||
* Returns a list of all PerformanceEntry objects in chronological order with respect to performanceEntry.startTime
|
||||
* whose performanceEntry.name is equal to name, and optionally, whose performanceEntry.entryType is equal to type.
|
||||
* @param name
|
||||
* @param type
|
||||
* @return list of all PerformanceEntry objects
|
||||
*/
|
||||
getEntriesByName(name: string, type?: string): PerformanceEntry[];
|
||||
|
||||
/**
|
||||
* Returns a list of all PerformanceEntry objects in chronological order with respect to performanceEntry.startTime
|
||||
* whose performanceEntry.entryType is equal to type.
|
||||
* @param type
|
||||
* @return list of all PerformanceEntry objects
|
||||
*/
|
||||
getEntriesByType(type: string): PerformanceEntry[];
|
||||
|
||||
/**
|
||||
* Creates a new PerformanceMark entry in the Performance Timeline.
|
||||
* A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark',
|
||||
@@ -190,6 +135,16 @@ declare module "perf_hooks" {
|
||||
* @param fn
|
||||
*/
|
||||
timerify<T extends (...optionalParams: any[]) => any>(fn: T): T;
|
||||
|
||||
/**
|
||||
* eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time.
|
||||
* It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait).
|
||||
* No other CPU idle time is taken into consideration.
|
||||
*
|
||||
* @param util1 The result of a previous call to eventLoopUtilization()
|
||||
* @param util2 The result of a previous call to eventLoopUtilization() prior to util1
|
||||
*/
|
||||
eventLoopUtilization(util1?: EventLoopUtilization, util2?: EventLoopUtilization): EventLoopUtilization;
|
||||
}
|
||||
|
||||
interface PerformanceObserverEntryList {
|
||||
@@ -227,7 +182,7 @@ declare module "perf_hooks" {
|
||||
* Property buffered defaults to false.
|
||||
* @param options
|
||||
*/
|
||||
observe(options: { entryTypes: string[], buffered?: boolean }): void;
|
||||
observe(options: { entryTypes: ReadonlyArray<string>, buffered?: boolean }): void;
|
||||
}
|
||||
|
||||
namespace constants {
|
||||
|
||||
+57
-1
@@ -1,12 +1,68 @@
|
||||
declare module "punycode" {
|
||||
/**
|
||||
* @deprecated since v7.0.0
|
||||
* The version of the punycode module bundled in Node.js is being deprecated.
|
||||
* In a future major version of Node.js this module will be removed.
|
||||
* Users currently depending on the punycode module should switch to using
|
||||
* the userland-provided Punycode.js module instead.
|
||||
*/
|
||||
function decode(string: string): string;
|
||||
/**
|
||||
* @deprecated since v7.0.0
|
||||
* The version of the punycode module bundled in Node.js is being deprecated.
|
||||
* In a future major version of Node.js this module will be removed.
|
||||
* Users currently depending on the punycode module should switch to using
|
||||
* the userland-provided Punycode.js module instead.
|
||||
*/
|
||||
function encode(string: string): string;
|
||||
/**
|
||||
* @deprecated since v7.0.0
|
||||
* The version of the punycode module bundled in Node.js is being deprecated.
|
||||
* In a future major version of Node.js this module will be removed.
|
||||
* Users currently depending on the punycode module should switch to using
|
||||
* the userland-provided Punycode.js module instead.
|
||||
*/
|
||||
function toUnicode(domain: string): string;
|
||||
/**
|
||||
* @deprecated since v7.0.0
|
||||
* The version of the punycode module bundled in Node.js is being deprecated.
|
||||
* In a future major version of Node.js this module will be removed.
|
||||
* Users currently depending on the punycode module should switch to using
|
||||
* the userland-provided Punycode.js module instead.
|
||||
*/
|
||||
function toASCII(domain: string): string;
|
||||
/**
|
||||
* @deprecated since v7.0.0
|
||||
* The version of the punycode module bundled in Node.js is being deprecated.
|
||||
* In a future major version of Node.js this module will be removed.
|
||||
* Users currently depending on the punycode module should switch to using
|
||||
* the userland-provided Punycode.js module instead.
|
||||
*/
|
||||
const ucs2: ucs2;
|
||||
interface ucs2 {
|
||||
/**
|
||||
* @deprecated since v7.0.0
|
||||
* The version of the punycode module bundled in Node.js is being deprecated.
|
||||
* In a future major version of Node.js this module will be removed.
|
||||
* Users currently depending on the punycode module should switch to using
|
||||
* the userland-provided Punycode.js module instead.
|
||||
*/
|
||||
decode(string: string): number[];
|
||||
encode(codePoints: number[]): string;
|
||||
/**
|
||||
* @deprecated since v7.0.0
|
||||
* The version of the punycode module bundled in Node.js is being deprecated.
|
||||
* In a future major version of Node.js this module will be removed.
|
||||
* Users currently depending on the punycode module should switch to using
|
||||
* the userland-provided Punycode.js module instead.
|
||||
*/
|
||||
encode(codePoints: ReadonlyArray<number>): string;
|
||||
}
|
||||
/**
|
||||
* @deprecated since v7.0.0
|
||||
* The version of the punycode module bundled in Node.js is being deprecated.
|
||||
* In a future major version of Node.js this module will be removed.
|
||||
* Users currently depending on the punycode module should switch to using
|
||||
* the userland-provided Punycode.js module instead.
|
||||
*/
|
||||
const version: string;
|
||||
}
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ declare module "querystring" {
|
||||
interface ParsedUrlQuery { [key: string]: string | string[]; }
|
||||
|
||||
interface ParsedUrlQueryInput {
|
||||
[key: string]: NodeJS.PoorMansUnknown;
|
||||
[key: string]: string | number | boolean | ReadonlyArray<string> | ReadonlyArray<number> | ReadonlyArray<boolean> | undefined | null;
|
||||
}
|
||||
|
||||
function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string;
|
||||
|
||||
+8
@@ -13,6 +13,13 @@ declare module "readline" {
|
||||
class Interface extends events.EventEmitter {
|
||||
readonly terminal: boolean;
|
||||
|
||||
// Need direct access to line/cursor data, for use in external processes
|
||||
// see: https://github.com/nodejs/node/issues/30347
|
||||
/** The current input data */
|
||||
readonly line: string;
|
||||
/** The current cursor position in the input line */
|
||||
readonly cursor: number;
|
||||
|
||||
/**
|
||||
* NOTE: According to the documentation:
|
||||
*
|
||||
@@ -123,6 +130,7 @@ declare module "readline" {
|
||||
prompt?: string;
|
||||
crlfDelay?: number;
|
||||
removeHistoryDuplicates?: boolean;
|
||||
escapeCodeTimeout?: number;
|
||||
}
|
||||
|
||||
function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
|
||||
|
||||
+10
-2
@@ -131,13 +131,21 @@ declare module "repl" {
|
||||
*/
|
||||
readonly context: Context;
|
||||
/**
|
||||
* The `Readable` stream from which REPL input will be read.
|
||||
* Outdated alias for `input`.
|
||||
*/
|
||||
readonly inputStream: NodeJS.ReadableStream;
|
||||
/**
|
||||
* The `Writable` stream to which REPL output will be written.
|
||||
* Outdated alias for `output`.
|
||||
*/
|
||||
readonly outputStream: NodeJS.WritableStream;
|
||||
/**
|
||||
* The `Readable` stream from which REPL input will be read.
|
||||
*/
|
||||
readonly input: NodeJS.ReadableStream;
|
||||
/**
|
||||
* The `Writable` stream to which REPL output will be written.
|
||||
*/
|
||||
readonly output: NodeJS.WritableStream;
|
||||
/**
|
||||
* The commands registered via `replServer.defineCommand()`.
|
||||
*/
|
||||
|
||||
+17
-3
@@ -24,6 +24,9 @@ declare module "stream" {
|
||||
static from(iterable: Iterable<any> | AsyncIterable<any>, options?: ReadableOptions): Readable;
|
||||
|
||||
readable: boolean;
|
||||
readonly readableEncoding: BufferEncoding | null;
|
||||
readonly readableEnded: boolean;
|
||||
readonly readableFlowing: boolean | null;
|
||||
readonly readableHighWaterMark: number;
|
||||
readonly readableLength: number;
|
||||
readonly readableObjectMode: boolean;
|
||||
@@ -210,6 +213,8 @@ declare module "stream" {
|
||||
allowHalfOpen?: boolean;
|
||||
readableObjectMode?: boolean;
|
||||
writableObjectMode?: boolean;
|
||||
readableHighWaterMark?: number;
|
||||
writableHighWaterMark?: number;
|
||||
read?(this: Duplex, size: number): void;
|
||||
write?(this: Duplex, chunk: any, encoding: string, callback: (error?: Error | null) => void): void;
|
||||
writev?(this: Duplex, chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void;
|
||||
@@ -260,9 +265,15 @@ declare module "stream" {
|
||||
|
||||
class PassThrough extends Transform { }
|
||||
|
||||
interface FinishedOptions {
|
||||
error?: boolean;
|
||||
readable?: boolean;
|
||||
writable?: boolean;
|
||||
}
|
||||
function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options: FinishedOptions, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
|
||||
function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
|
||||
namespace finished {
|
||||
function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream): Promise<void>;
|
||||
function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise<void>;
|
||||
}
|
||||
|
||||
function pipeline<T extends NodeJS.WritableStream>(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException | null) => void): T;
|
||||
@@ -282,7 +293,10 @@ declare module "stream" {
|
||||
stream5: T,
|
||||
callback?: (err: NodeJS.ErrnoException | null) => void,
|
||||
): T;
|
||||
function pipeline(streams: Array<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>, callback?: (err: NodeJS.ErrnoException | null) => void): NodeJS.WritableStream;
|
||||
function pipeline(
|
||||
streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
|
||||
callback?: (err: NodeJS.ErrnoException | null) => void,
|
||||
): NodeJS.WritableStream;
|
||||
function pipeline(
|
||||
stream1: NodeJS.ReadableStream,
|
||||
stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
|
||||
@@ -299,7 +313,7 @@ declare module "stream" {
|
||||
stream4: NodeJS.ReadWriteStream,
|
||||
stream5: NodeJS.WritableStream,
|
||||
): Promise<void>;
|
||||
function __promisify__(streams: Array<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>): Promise<void>;
|
||||
function __promisify__(streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>): Promise<void>;
|
||||
function __promisify__(
|
||||
stream1: NodeJS.ReadableStream,
|
||||
stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
|
||||
|
||||
+307
-11
@@ -44,6 +44,7 @@ declare module "tls" {
|
||||
valid_from: string;
|
||||
valid_to: string;
|
||||
fingerprint: string;
|
||||
fingerprint256: string;
|
||||
ext_key_usage: string[];
|
||||
serialNumber: string;
|
||||
raw: Buffer;
|
||||
@@ -64,6 +65,43 @@ declare module "tls" {
|
||||
version: string;
|
||||
}
|
||||
|
||||
interface EphemeralKeyInfo {
|
||||
/**
|
||||
* The supported types are 'DH' and 'ECDH'.
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* The name property is available only when type is 'ECDH'.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* The size of parameter of an ephemeral key exchange.
|
||||
*/
|
||||
size: number;
|
||||
}
|
||||
|
||||
interface KeyObject {
|
||||
/**
|
||||
* Private keys in PEM format.
|
||||
*/
|
||||
pem: string | Buffer;
|
||||
/**
|
||||
* Optional passphrase.
|
||||
*/
|
||||
passphrase?: string;
|
||||
}
|
||||
|
||||
interface PxfObject {
|
||||
/**
|
||||
* PFX or PKCS12 encoded private key and certificate chain.
|
||||
*/
|
||||
buf: string | Buffer;
|
||||
/**
|
||||
* Optional passphrase.
|
||||
*/
|
||||
passphrase?: string;
|
||||
}
|
||||
|
||||
interface TLSSocketOptions extends SecureContextOptions, CommonConnectionOptions {
|
||||
/**
|
||||
* If true the TLS socket will be instantiated in server-mode.
|
||||
@@ -114,12 +152,50 @@ declare module "tls" {
|
||||
*/
|
||||
alpnProtocol?: string;
|
||||
|
||||
/**
|
||||
* Returns an object representing the local certificate. The returned
|
||||
* object has some properties corresponding to the fields of the
|
||||
* certificate.
|
||||
*
|
||||
* See tls.TLSSocket.getPeerCertificate() for an example of the
|
||||
* certificate structure.
|
||||
*
|
||||
* If there is no local certificate, an empty object will be returned.
|
||||
* If the socket has been destroyed, null will be returned.
|
||||
*/
|
||||
getCertificate(): PeerCertificate | object | null;
|
||||
/**
|
||||
* Returns an object representing the cipher name and the SSL/TLS protocol version of the current connection.
|
||||
* @returns Returns an object representing the cipher name
|
||||
* and the SSL/TLS protocol version of the current connection.
|
||||
*/
|
||||
getCipher(): CipherNameAndProtocol;
|
||||
/**
|
||||
* Returns an object representing the type, name, and size of parameter
|
||||
* of an ephemeral key exchange in Perfect Forward Secrecy on a client
|
||||
* connection. It returns an empty object when the key exchange is not
|
||||
* ephemeral. As this is only supported on a client socket; null is
|
||||
* returned if called on a server socket. The supported types are 'DH'
|
||||
* and 'ECDH'. The name property is available only when type is 'ECDH'.
|
||||
*
|
||||
* For example: { type: 'ECDH', name: 'prime256v1', size: 256 }.
|
||||
*/
|
||||
getEphemeralKeyInfo(): EphemeralKeyInfo | object | null;
|
||||
/**
|
||||
* Returns the latest Finished message that has
|
||||
* been sent to the socket as part of a SSL/TLS handshake, or undefined
|
||||
* if no Finished message has been sent yet.
|
||||
*
|
||||
* As the Finished messages are message digests of the complete
|
||||
* handshake (with a total of 192 bits for TLS 1.0 and more for SSL
|
||||
* 3.0), they can be used for external authentication procedures when
|
||||
* the authentication provided by SSL/TLS is not desired or is not
|
||||
* enough.
|
||||
*
|
||||
* Corresponds to the SSL_get_finished routine in OpenSSL and may be
|
||||
* used to implement the tls-unique channel binding from RFC 5929.
|
||||
*/
|
||||
getFinished(): Buffer | undefined;
|
||||
/**
|
||||
* Returns an object representing the peer's certificate.
|
||||
* The returned object has some properties corresponding to the field of the certificate.
|
||||
@@ -132,6 +208,21 @@ declare module "tls" {
|
||||
getPeerCertificate(detailed: true): DetailedPeerCertificate;
|
||||
getPeerCertificate(detailed?: false): PeerCertificate;
|
||||
getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate;
|
||||
/**
|
||||
* Returns the latest Finished message that is expected or has actually
|
||||
* been received from the socket as part of a SSL/TLS handshake, or
|
||||
* undefined if there is no Finished message so far.
|
||||
*
|
||||
* As the Finished messages are message digests of the complete
|
||||
* handshake (with a total of 192 bits for TLS 1.0 and more for SSL
|
||||
* 3.0), they can be used for external authentication procedures when
|
||||
* the authentication provided by SSL/TLS is not desired or is not
|
||||
* enough.
|
||||
*
|
||||
* Corresponds to the SSL_get_peer_finished routine in OpenSSL and may
|
||||
* be used to implement the tls-unique channel binding from RFC 5929.
|
||||
*/
|
||||
getPeerFinished(): Buffer | undefined;
|
||||
/**
|
||||
* Returns a string containing the negotiated SSL/TLS protocol version of the current connection.
|
||||
* The value `'unknown'` will be returned for connected sockets that have not completed the handshaking process.
|
||||
@@ -145,12 +236,21 @@ declare module "tls" {
|
||||
* @returns ASN.1 encoded TLS session or undefined if none was negotiated.
|
||||
*/
|
||||
getSession(): Buffer | undefined;
|
||||
/**
|
||||
* Returns a list of signature algorithms shared between the server and
|
||||
* the client in the order of decreasing preference.
|
||||
*/
|
||||
getSharedSigalgs(): string[];
|
||||
/**
|
||||
* NOTE: Works only with client TLS sockets.
|
||||
* Useful only for debugging, for session reuse provide session option to tls.connect().
|
||||
* @returns TLS session ticket or undefined if none was negotiated.
|
||||
*/
|
||||
getTLSTicket(): Buffer | undefined;
|
||||
/**
|
||||
* Returns true if the session was reused, false otherwise.
|
||||
*/
|
||||
isSessionReused(): boolean;
|
||||
/**
|
||||
* Initiate TLS renegotiation process.
|
||||
*
|
||||
@@ -175,6 +275,13 @@ declare module "tls" {
|
||||
*/
|
||||
setMaxSendFragment(size: number): boolean;
|
||||
|
||||
/**
|
||||
* Disables TLS renegotiation for this TLSSocket instance. Once called,
|
||||
* attempts to renegotiate will trigger an 'error' event on the
|
||||
* TLSSocket.
|
||||
*/
|
||||
disableRenegotiation(): void;
|
||||
|
||||
/**
|
||||
* When enabled, TLS packet trace information is written to `stderr`. This can be
|
||||
* used to debug TLS connection problems.
|
||||
@@ -266,8 +373,22 @@ declare module "tls" {
|
||||
}
|
||||
|
||||
interface TlsOptions extends SecureContextOptions, CommonConnectionOptions {
|
||||
/**
|
||||
* Abort the connection if the SSL/TLS handshake does not finish in the
|
||||
* specified number of milliseconds. A 'tlsClientError' is emitted on
|
||||
* the tls.Server object whenever a handshake times out. Default:
|
||||
* 120000 (120 seconds).
|
||||
*/
|
||||
handshakeTimeout?: number;
|
||||
/**
|
||||
* The number of seconds after which a TLS session created by the
|
||||
* server will no longer be resumable. See Session Resumption for more
|
||||
* information. Default: 300.
|
||||
*/
|
||||
sessionTimeout?: number;
|
||||
/**
|
||||
* 48-bytes of cryptographically strong pseudo-random data.
|
||||
*/
|
||||
ticketKeys?: Buffer;
|
||||
}
|
||||
|
||||
@@ -285,7 +406,29 @@ declare module "tls" {
|
||||
}
|
||||
|
||||
class Server extends net.Server {
|
||||
/**
|
||||
* The server.addContext() method adds a secure context that will be
|
||||
* used if the client request's SNI name matches the supplied hostname
|
||||
* (or wildcard).
|
||||
*/
|
||||
addContext(hostName: string, credentials: SecureContextOptions): void;
|
||||
/**
|
||||
* Returns the session ticket keys.
|
||||
*/
|
||||
getTicketKeys(): Buffer;
|
||||
/**
|
||||
*
|
||||
* The server.setSecureContext() method replaces the
|
||||
* secure context of an existing server. Existing connections to the
|
||||
* server are not interrupted.
|
||||
*/
|
||||
setSecureContext(details: SecureContextOptions): void;
|
||||
/**
|
||||
* The server.setSecureContext() method replaces the secure context of
|
||||
* an existing server. Existing connections to the server are not
|
||||
* interrupted.
|
||||
*/
|
||||
setTicketKeys(keys: Buffer): void;
|
||||
|
||||
/**
|
||||
* events.EventEmitter
|
||||
@@ -294,6 +437,7 @@ declare module "tls" {
|
||||
* 3. OCSPRequest
|
||||
* 4. resumeSession
|
||||
* 5. secureConnection
|
||||
* 6. keylog
|
||||
*/
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
|
||||
@@ -352,20 +496,93 @@ declare module "tls" {
|
||||
type SecureVersion = 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1';
|
||||
|
||||
interface SecureContextOptions {
|
||||
pfx?: string | Buffer | Array<string | Buffer | Object>;
|
||||
key?: string | Buffer | Array<Buffer | Object>;
|
||||
passphrase?: string;
|
||||
cert?: string | Buffer | Array<string | Buffer>;
|
||||
/**
|
||||
* Optionally override the trusted CA certificates. Default is to trust
|
||||
* the well-known CAs curated by Mozilla. Mozilla's CAs are completely
|
||||
* replaced when CAs are explicitly specified using this option.
|
||||
*/
|
||||
ca?: string | Buffer | Array<string | Buffer>;
|
||||
/**
|
||||
* Cert chains in PEM format. One cert chain should be provided per
|
||||
* private key. Each cert chain should consist of the PEM formatted
|
||||
* certificate for a provided private key, followed by the PEM
|
||||
* formatted intermediate certificates (if any), in order, and not
|
||||
* including the root CA (the root CA must be pre-known to the peer,
|
||||
* see ca). When providing multiple cert chains, they do not have to
|
||||
* be in the same order as their private keys in key. If the
|
||||
* intermediate certificates are not provided, the peer will not be
|
||||
* able to validate the certificate, and the handshake will fail.
|
||||
*/
|
||||
cert?: string | Buffer | Array<string | Buffer>;
|
||||
/**
|
||||
* Colon-separated list of supported signature algorithms. The list
|
||||
* can contain digest algorithms (SHA256, MD5 etc.), public key
|
||||
* algorithms (RSA-PSS, ECDSA etc.), combination of both (e.g
|
||||
* 'RSA+SHA384') or TLS v1.3 scheme names (e.g. rsa_pss_pss_sha512).
|
||||
*/
|
||||
sigalgs?: string;
|
||||
/**
|
||||
* Cipher suite specification, replacing the default. For more
|
||||
* information, see modifying the default cipher suite. Permitted
|
||||
* ciphers can be obtained via tls.getCiphers(). Cipher names must be
|
||||
* uppercased in order for OpenSSL to accept them.
|
||||
*/
|
||||
ciphers?: string;
|
||||
honorCipherOrder?: boolean;
|
||||
ecdhCurve?: string;
|
||||
/**
|
||||
* Name of an OpenSSL engine which can provide the client certificate.
|
||||
*/
|
||||
clientCertEngine?: string;
|
||||
/**
|
||||
* PEM formatted CRLs (Certificate Revocation Lists).
|
||||
*/
|
||||
crl?: string | Buffer | Array<string | Buffer>;
|
||||
/**
|
||||
* Diffie Hellman parameters, required for Perfect Forward Secrecy. Use
|
||||
* openssl dhparam to create the parameters. The key length must be
|
||||
* greater than or equal to 1024 bits or else an error will be thrown.
|
||||
* Although 1024 bits is permissible, use 2048 bits or larger for
|
||||
* stronger security. If omitted or invalid, the parameters are
|
||||
* silently discarded and DHE ciphers will not be available.
|
||||
*/
|
||||
dhparam?: string | Buffer;
|
||||
secureOptions?: number; // Value is a numeric bitmask of the `SSL_OP_*` options
|
||||
secureProtocol?: string; // SSL Method, e.g. SSLv23_method
|
||||
sessionIdContext?: string;
|
||||
/**
|
||||
* A string describing a named curve or a colon separated list of curve
|
||||
* NIDs or names, for example P-521:P-384:P-256, to use for ECDH key
|
||||
* agreement. Set to auto to select the curve automatically. Use
|
||||
* crypto.getCurves() to obtain a list of available curve names. On
|
||||
* recent releases, openssl ecparam -list_curves will also display the
|
||||
* name and description of each available elliptic curve. Default:
|
||||
* tls.DEFAULT_ECDH_CURVE.
|
||||
*/
|
||||
ecdhCurve?: string;
|
||||
/**
|
||||
* Attempt to use the server's cipher suite preferences instead of the
|
||||
* client's. When true, causes SSL_OP_CIPHER_SERVER_PREFERENCE to be
|
||||
* set in secureOptions
|
||||
*/
|
||||
honorCipherOrder?: boolean;
|
||||
/**
|
||||
* Private keys in PEM format. PEM allows the option of private keys
|
||||
* being encrypted. Encrypted keys will be decrypted with
|
||||
* options.passphrase. Multiple keys using different algorithms can be
|
||||
* provided either as an array of unencrypted key strings or buffers,
|
||||
* or an array of objects in the form {pem: <string|buffer>[,
|
||||
* passphrase: <string>]}. The object form can only occur in an array.
|
||||
* object.passphrase is optional. Encrypted keys will be decrypted with
|
||||
* object.passphrase if provided, or options.passphrase if it is not.
|
||||
*/
|
||||
key?: string | Buffer | Array<Buffer | KeyObject>;
|
||||
/**
|
||||
* Name of an OpenSSL engine to get private key from. Should be used
|
||||
* together with privateKeyIdentifier.
|
||||
*/
|
||||
privateKeyEngine?: string;
|
||||
/**
|
||||
* Identifier of a private key managed by an OpenSSL engine. Should be
|
||||
* used together with privateKeyEngine. Should not be set together with
|
||||
* key, because both options define a private key in different ways.
|
||||
*/
|
||||
privateKeyIdentifier?: string;
|
||||
/**
|
||||
* Optionally set the maximum TLS version to allow. One
|
||||
* of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the
|
||||
@@ -386,6 +603,55 @@ declare module "tls" {
|
||||
* 'TLSv1.3'. If multiple of the options are provided, the lowest minimum is used.
|
||||
*/
|
||||
minVersion?: SecureVersion;
|
||||
/**
|
||||
* Shared passphrase used for a single private key and/or a PFX.
|
||||
*/
|
||||
passphrase?: string;
|
||||
/**
|
||||
* PFX or PKCS12 encoded private key and certificate chain. pfx is an
|
||||
* alternative to providing key and cert individually. PFX is usually
|
||||
* encrypted, if it is, passphrase will be used to decrypt it. Multiple
|
||||
* PFX can be provided either as an array of unencrypted PFX buffers,
|
||||
* or an array of objects in the form {buf: <string|buffer>[,
|
||||
* passphrase: <string>]}. The object form can only occur in an array.
|
||||
* object.passphrase is optional. Encrypted PFX will be decrypted with
|
||||
* object.passphrase if provided, or options.passphrase if it is not.
|
||||
*/
|
||||
pfx?: string | Buffer | Array<string | Buffer | PxfObject>;
|
||||
/**
|
||||
* Optionally affect the OpenSSL protocol behavior, which is not
|
||||
* usually necessary. This should be used carefully if at all! Value is
|
||||
* a numeric bitmask of the SSL_OP_* options from OpenSSL Options
|
||||
*/
|
||||
secureOptions?: number; // Value is a numeric bitmask of the `SSL_OP_*` options
|
||||
/**
|
||||
* Legacy mechanism to select the TLS protocol version to use, it does
|
||||
* not support independent control of the minimum and maximum version,
|
||||
* and does not support limiting the protocol to TLSv1.3. Use
|
||||
* minVersion and maxVersion instead. The possible values are listed as
|
||||
* SSL_METHODS, use the function names as strings. For example, use
|
||||
* 'TLSv1_1_method' to force TLS version 1.1, or 'TLS_method' to allow
|
||||
* any TLS protocol version up to TLSv1.3. It is not recommended to use
|
||||
* TLS versions less than 1.2, but it may be required for
|
||||
* interoperability. Default: none, see minVersion.
|
||||
*/
|
||||
secureProtocol?: string;
|
||||
/**
|
||||
* Opaque identifier used by servers to ensure session state is not
|
||||
* shared between applications. Unused by clients.
|
||||
*/
|
||||
sessionIdContext?: string;
|
||||
/**
|
||||
* 48-bytes of cryptographically strong pseudo-random data.
|
||||
* See Session Resumption for more information.
|
||||
*/
|
||||
ticketKeys?: Buffer;
|
||||
/**
|
||||
* The number of seconds after which a TLS session created by the
|
||||
* server will no longer be resumable. See Session Resumption for more
|
||||
* information. Default: 300.
|
||||
*/
|
||||
sessionTimeout?: number;
|
||||
}
|
||||
|
||||
interface SecureContext {
|
||||
@@ -409,10 +675,40 @@ declare module "tls" {
|
||||
* @deprecated
|
||||
*/
|
||||
function createSecurePair(credentials?: SecureContext, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;
|
||||
function createSecureContext(details: SecureContextOptions): SecureContext;
|
||||
function createSecureContext(options?: SecureContextOptions): SecureContext;
|
||||
function getCiphers(): string[];
|
||||
|
||||
const DEFAULT_ECDH_CURVE: string;
|
||||
/**
|
||||
* The default curve name to use for ECDH key agreement in a tls server.
|
||||
* The default value is 'auto'. See tls.createSecureContext() for further
|
||||
* information.
|
||||
*/
|
||||
let DEFAULT_ECDH_CURVE: string;
|
||||
/**
|
||||
* The default value of the maxVersion option of
|
||||
* tls.createSecureContext(). It can be assigned any of the supported TLS
|
||||
* protocol versions, 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default:
|
||||
* 'TLSv1.3', unless changed using CLI options. Using --tls-max-v1.2 sets
|
||||
* the default to 'TLSv1.2'. Using --tls-max-v1.3 sets the default to
|
||||
* 'TLSv1.3'. If multiple of the options are provided, the highest maximum
|
||||
* is used.
|
||||
*/
|
||||
let DEFAULT_MAX_VERSION: SecureVersion;
|
||||
/**
|
||||
* The default value of the minVersion option of tls.createSecureContext().
|
||||
* It can be assigned any of the supported TLS protocol versions,
|
||||
* 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: 'TLSv1.2', unless
|
||||
* changed using CLI options. Using --tls-min-v1.0 sets the default to
|
||||
* 'TLSv1'. Using --tls-min-v1.1 sets the default to 'TLSv1.1'. Using
|
||||
* --tls-min-v1.3 sets the default to 'TLSv1.3'. If multiple of the options
|
||||
* are provided, the lowest minimum is used.
|
||||
*/
|
||||
let DEFAULT_MIN_VERSION: SecureVersion;
|
||||
|
||||
/**
|
||||
* An immutable array of strings representing the root certificates (in PEM
|
||||
* format) used for verifying peer certificates. This is the default value
|
||||
* of the ca option to tls.createSecureContext().
|
||||
*/
|
||||
const rootCertificates: ReadonlyArray<string>;
|
||||
}
|
||||
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../fs.d.ts" />
|
||||
|
||||
declare module 'fs' {
|
||||
interface BigIntStats extends StatsBase<BigInt> {
|
||||
}
|
||||
|
||||
class BigIntStats {
|
||||
atimeNs: BigInt;
|
||||
mtimeNs: BigInt;
|
||||
ctimeNs: BigInt;
|
||||
birthtimeNs: BigInt;
|
||||
}
|
||||
|
||||
interface BigIntOptions {
|
||||
bigint: true;
|
||||
}
|
||||
|
||||
interface StatOptions {
|
||||
bigint: boolean;
|
||||
}
|
||||
|
||||
function stat(path: PathLike, options: BigIntOptions, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
|
||||
function stat(path: PathLike, options: StatOptions, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
||||
|
||||
namespace stat {
|
||||
function __promisify__(path: PathLike, options: BigIntOptions): Promise<BigIntStats>;
|
||||
function __promisify__(path: PathLike, options: StatOptions): Promise<Stats | BigIntStats>;
|
||||
}
|
||||
|
||||
function statSync(path: PathLike, options: BigIntOptions): BigIntStats;
|
||||
function statSync(path: PathLike, options: StatOptions): Stats | BigIntStats;
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../globals.d.ts" />
|
||||
|
||||
declare namespace NodeJS {
|
||||
interface HRTime {
|
||||
bigint(): bigint;
|
||||
}
|
||||
}
|
||||
|
||||
interface Buffer extends Uint8Array {
|
||||
readBigUInt64BE(offset?: number): bigint;
|
||||
readBigUInt64LE(offset?: number): bigint;
|
||||
readBigInt64BE(offset?: number): bigint;
|
||||
readBigInt64LE(offset?: number): bigint;
|
||||
writeBigInt64BE(value: bigint, offset?: number): number;
|
||||
writeBigInt64LE(value: bigint, offset?: number): number;
|
||||
writeBigUInt64BE(value: bigint, offset?: number): number;
|
||||
writeBigUInt64LE(value: bigint, offset?: number): number;
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../util.d.ts" />
|
||||
|
||||
declare module "util" {
|
||||
namespace inspect {
|
||||
const custom: unique symbol;
|
||||
}
|
||||
namespace promisify {
|
||||
const custom: unique symbol;
|
||||
}
|
||||
namespace types {
|
||||
function isBigInt64Array(value: any): value is BigInt64Array;
|
||||
function isBigUint64Array(value: any): value is BigUint64Array;
|
||||
}
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
declare module 'assert' {
|
||||
function assert(value: any, message?: string | Error): void;
|
||||
namespace assert {
|
||||
class AssertionError implements Error {
|
||||
name: string;
|
||||
message: string;
|
||||
actual: any;
|
||||
expected: any;
|
||||
operator: string;
|
||||
generatedMessage: boolean;
|
||||
code: 'ERR_ASSERTION';
|
||||
|
||||
constructor(options?: {
|
||||
message?: string;
|
||||
actual?: any;
|
||||
expected?: any;
|
||||
operator?: string;
|
||||
stackStartFn?: Function;
|
||||
});
|
||||
}
|
||||
|
||||
class CallTracker {
|
||||
calls(exact?: number): () => void;
|
||||
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
|
||||
report(): CallTrackerReportInformation[];
|
||||
verify(): void;
|
||||
}
|
||||
interface CallTrackerReportInformation {
|
||||
message: string;
|
||||
/** The actual number of times the function was called. */
|
||||
actual: number;
|
||||
/** The number of times the function was expected to be called. */
|
||||
expected: number;
|
||||
/** The name of the function that is wrapped. */
|
||||
operator: string;
|
||||
/** A stack trace of the function. */
|
||||
stack: object;
|
||||
}
|
||||
|
||||
function fail(message?: string | Error): never;
|
||||
/** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
|
||||
function fail(
|
||||
actual: any,
|
||||
expected: any,
|
||||
message?: string | Error,
|
||||
operator?: string,
|
||||
stackStartFn?: Function,
|
||||
): never;
|
||||
function ok(value: any, message?: string | Error): void;
|
||||
/** @deprecated since v9.9.0 - use strictEqual() instead. */
|
||||
function equal(actual: any, expected: any, message?: string | Error): void;
|
||||
/** @deprecated since v9.9.0 - use notStrictEqual() instead. */
|
||||
function notEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
/** @deprecated since v9.9.0 - use deepStrictEqual() instead. */
|
||||
function deepEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
/** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */
|
||||
function notDeepEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
function strictEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
function notStrictEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
function deepStrictEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
|
||||
function throws(block: () => any, message?: string | Error): void;
|
||||
function throws(block: () => any, error: RegExp | Function | Object | Error, message?: string | Error): void;
|
||||
function doesNotThrow(block: () => any, message?: string | Error): void;
|
||||
function doesNotThrow(block: () => any, error: RegExp | Function, message?: string | Error): void;
|
||||
|
||||
function ifError(value: any): void;
|
||||
|
||||
function rejects(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
|
||||
function rejects(
|
||||
block: (() => Promise<any>) | Promise<any>,
|
||||
error: RegExp | Function | Object | Error,
|
||||
message?: string | Error,
|
||||
): Promise<void>;
|
||||
function doesNotReject(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
|
||||
function doesNotReject(
|
||||
block: (() => Promise<any>) | Promise<any>,
|
||||
error: RegExp | Function,
|
||||
message?: string | Error,
|
||||
): Promise<void>;
|
||||
|
||||
const strict: typeof assert;
|
||||
}
|
||||
|
||||
export = assert;
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.2.
|
||||
|
||||
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
|
||||
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
|
||||
// - ~/index.d.ts - Definitions specific to TypeScript 2.1
|
||||
// - ~/ts3.2/base.d.ts - Definitions specific to TypeScript 3.2
|
||||
// - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2 with global and assert pulled in
|
||||
|
||||
// Reference required types from the default lib:
|
||||
/// <reference lib="es2018" />
|
||||
/// <reference lib="esnext.asynciterable" />
|
||||
/// <reference lib="esnext.intl" />
|
||||
/// <reference lib="esnext.bigint" />
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
/// <reference path="../globals.d.ts" />
|
||||
/// <reference path="../async_hooks.d.ts" />
|
||||
/// <reference path="../buffer.d.ts" />
|
||||
/// <reference path="../child_process.d.ts" />
|
||||
/// <reference path="../cluster.d.ts" />
|
||||
/// <reference path="../console.d.ts" />
|
||||
/// <reference path="../constants.d.ts" />
|
||||
/// <reference path="../crypto.d.ts" />
|
||||
/// <reference path="../dgram.d.ts" />
|
||||
/// <reference path="../dns.d.ts" />
|
||||
/// <reference path="../domain.d.ts" />
|
||||
/// <reference path="../events.d.ts" />
|
||||
/// <reference path="../fs.d.ts" />
|
||||
/// <reference path="../http.d.ts" />
|
||||
/// <reference path="../http2.d.ts" />
|
||||
/// <reference path="../https.d.ts" />
|
||||
/// <reference path="../inspector.d.ts" />
|
||||
/// <reference path="../module.d.ts" />
|
||||
/// <reference path="../net.d.ts" />
|
||||
/// <reference path="../os.d.ts" />
|
||||
/// <reference path="../path.d.ts" />
|
||||
/// <reference path="../perf_hooks.d.ts" />
|
||||
/// <reference path="../process.d.ts" />
|
||||
/// <reference path="../punycode.d.ts" />
|
||||
/// <reference path="../querystring.d.ts" />
|
||||
/// <reference path="../readline.d.ts" />
|
||||
/// <reference path="../repl.d.ts" />
|
||||
/// <reference path="../stream.d.ts" />
|
||||
/// <reference path="../string_decoder.d.ts" />
|
||||
/// <reference path="../timers.d.ts" />
|
||||
/// <reference path="../tls.d.ts" />
|
||||
/// <reference path="../trace_events.d.ts" />
|
||||
/// <reference path="../tty.d.ts" />
|
||||
/// <reference path="../url.d.ts" />
|
||||
/// <reference path="../util.d.ts" />
|
||||
/// <reference path="../v8.d.ts" />
|
||||
/// <reference path="../vm.d.ts" />
|
||||
/// <reference path="../worker_threads.d.ts" />
|
||||
/// <reference path="../zlib.d.ts" />
|
||||
+1
@@ -0,0 +1 @@
|
||||
declare var global: NodeJS.Global;
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.2.
|
||||
// This is requried to enable globalThis support for global in ts3.4 without causing errors
|
||||
// This is requried to enable typing assert in ts3.7 without causing errors
|
||||
// Typically type modifiations should be made in base.d.ts instead of here
|
||||
|
||||
/// <reference path="base.d.ts" />
|
||||
/// <reference path="assert.d.ts" />
|
||||
/// <reference path="globals.global.d.ts" />
|
||||
Generated
Vendored
+7
-8
@@ -1,9 +1,10 @@
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.2.
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.4.
|
||||
|
||||
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
|
||||
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
|
||||
// - ~/index.d.ts - Definitions specific to TypeScript 2.1
|
||||
// - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2
|
||||
// - ~/ts3.4/base.d.ts - Definitions specific to TypeScript 3.4
|
||||
// - ~/ts3.4/index.d.ts - Definitions specific to TypeScript 3.4 with assert pulled in
|
||||
|
||||
// Reference required types from the default lib:
|
||||
/// <reference lib="es2018" />
|
||||
@@ -12,10 +13,8 @@
|
||||
/// <reference lib="esnext.bigint" />
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../base.d.ts" />
|
||||
/// <reference path="../ts3.3/base.d.ts" />
|
||||
|
||||
// TypeScript 3.2-specific augmentations:
|
||||
/// <reference path="fs.d.ts" />
|
||||
/// <reference path="util.d.ts" />
|
||||
/// <reference path="globals.d.ts" />
|
||||
// TypeScript 3.5-specific augmentations:
|
||||
/// <reference path="../globals.global.d.ts" />
|
||||
/// <reference path="../wasi.d.ts" />
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.4.
|
||||
// This is required to enable typing assert in ts3.7 without causing errors
|
||||
// Typically type modifications should be made in base.d.ts instead of here
|
||||
|
||||
/// <reference path="base.d.ts" />
|
||||
|
||||
/// <reference path="../ts3.3/assert.d.ts" />
|
||||
+1
-1
@@ -5,7 +5,7 @@ declare module "tty" {
|
||||
class ReadStream extends net.Socket {
|
||||
constructor(fd: number, options?: net.SocketConstructorOpts);
|
||||
isRaw: boolean;
|
||||
setRawMode(mode: boolean): void;
|
||||
setRawMode(mode: boolean): this;
|
||||
isTTY: boolean;
|
||||
}
|
||||
/**
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ declare module "url" {
|
||||
}
|
||||
|
||||
class URLSearchParams implements Iterable<[string, string]> {
|
||||
constructor(init?: URLSearchParams | string | { [key: string]: string | string[] | undefined } | Iterable<[string, string]> | Array<[string, string]>);
|
||||
constructor(init?: URLSearchParams | string | { [key: string]: string | ReadonlyArray<string> | undefined } | Iterable<[string, string]> | ReadonlyArray<[string, string]>);
|
||||
append(name: string, value: string): void;
|
||||
delete(name: string): void;
|
||||
entries(): IterableIterator<[string, string]>;
|
||||
|
||||
+32
-12
@@ -7,6 +7,7 @@ declare module "util" {
|
||||
function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
||||
function inspect(object: any, options: InspectOptions): string;
|
||||
namespace inspect {
|
||||
const custom: unique symbol;
|
||||
let colors: {
|
||||
[color: string]: [number, number] | undefined
|
||||
};
|
||||
@@ -105,44 +106,63 @@ declare module "util" {
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
||||
function promisify(fn: Function): Function;
|
||||
namespace promisify {
|
||||
const custom: unique symbol;
|
||||
}
|
||||
|
||||
namespace types {
|
||||
function isAnyArrayBuffer(object: any): boolean;
|
||||
function isAnyArrayBuffer(object: any): object is ArrayBufferLike;
|
||||
function isArgumentsObject(object: any): object is IArguments;
|
||||
function isArrayBuffer(object: any): object is ArrayBuffer;
|
||||
function isArrayBufferView(object: any): object is NodeJS.ArrayBufferView;
|
||||
function isAsyncFunction(object: any): boolean;
|
||||
function isBigInt64Array(value: any): value is BigInt64Array;
|
||||
function isBigUint64Array(value: any): value is BigUint64Array;
|
||||
function isBooleanObject(object: any): object is Boolean;
|
||||
function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* | Object(BigInt) | Object(Symbol) */);
|
||||
function isBoxedPrimitive(object: any): object is String | Number | BigInt | Boolean | Symbol;
|
||||
function isDataView(object: any): object is DataView;
|
||||
function isDate(object: any): object is Date;
|
||||
function isExternal(object: any): boolean;
|
||||
function isFloat32Array(object: any): object is Float32Array;
|
||||
function isFloat64Array(object: any): object is Float64Array;
|
||||
function isGeneratorFunction(object: any): boolean;
|
||||
function isGeneratorObject(object: any): boolean;
|
||||
function isGeneratorFunction(object: any): object is GeneratorFunction;
|
||||
function isGeneratorObject(object: any): object is Generator;
|
||||
function isInt8Array(object: any): object is Int8Array;
|
||||
function isInt16Array(object: any): object is Int16Array;
|
||||
function isInt32Array(object: any): object is Int32Array;
|
||||
function isMap(object: any): boolean;
|
||||
function isMap<T>(
|
||||
object: T | {},
|
||||
): object is T extends ReadonlyMap<any, any>
|
||||
? unknown extends T
|
||||
? never
|
||||
: ReadonlyMap<any, any>
|
||||
: Map<any, any>;
|
||||
function isMapIterator(object: any): boolean;
|
||||
function isModuleNamespaceObject(value: any): boolean;
|
||||
function isNativeError(object: any): object is Error;
|
||||
function isNumberObject(object: any): object is Number;
|
||||
function isPromise(object: any): boolean;
|
||||
function isPromise(object: any): object is Promise<any>;
|
||||
function isProxy(object: any): boolean;
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
function isSet(object: any): boolean;
|
||||
function isSet<T>(
|
||||
object: T | {},
|
||||
): object is T extends ReadonlySet<any>
|
||||
? unknown extends T
|
||||
? never
|
||||
: ReadonlySet<any>
|
||||
: Set<any>;
|
||||
function isSetIterator(object: any): boolean;
|
||||
function isSharedArrayBuffer(object: any): boolean;
|
||||
function isStringObject(object: any): boolean;
|
||||
function isSymbolObject(object: any): boolean;
|
||||
function isSharedArrayBuffer(object: any): object is SharedArrayBuffer;
|
||||
function isStringObject(object: any): object is String;
|
||||
function isSymbolObject(object: any): object is Symbol;
|
||||
function isTypedArray(object: any): object is NodeJS.TypedArray;
|
||||
function isUint8Array(object: any): object is Uint8Array;
|
||||
function isUint8ClampedArray(object: any): object is Uint8ClampedArray;
|
||||
function isUint16Array(object: any): object is Uint16Array;
|
||||
function isUint32Array(object: any): object is Uint32Array;
|
||||
function isWeakMap(object: any): boolean;
|
||||
function isWeakSet(object: any): boolean;
|
||||
function isWeakMap(object: any): object is WeakMap<any, any>;
|
||||
function isWeakSet(object: any): object is WeakSet<any>;
|
||||
/** @deprecated Removed in v14.0.0 */
|
||||
function isWebAssemblyCompiledModule(object: any): boolean;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -106,5 +106,5 @@ declare module "vm" {
|
||||
function runInContext(code: string, contextifiedSandbox: Context, options?: RunningScriptOptions | string): any;
|
||||
function runInNewContext(code: string, sandbox?: Context, options?: RunningScriptOptions | string): any;
|
||||
function runInThisContext(code: string, options?: RunningScriptOptions | string): any;
|
||||
function compileFunction(code: string, params: string[], options: CompileFunctionOptions): Function;
|
||||
function compileFunction(code: string, params?: ReadonlyArray<string>, options?: CompileFunctionOptions): Function;
|
||||
}
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
declare module 'wasi' {
|
||||
interface WASIOptions {
|
||||
/**
|
||||
* An array of strings that the WebAssembly application will
|
||||
* see as command line arguments. The first argument is the virtual path to the
|
||||
* WASI command itself.
|
||||
*/
|
||||
args?: string[];
|
||||
|
||||
/**
|
||||
* An object similar to `process.env` that the WebAssembly
|
||||
* application will see as its environment.
|
||||
*/
|
||||
env?: object;
|
||||
|
||||
/**
|
||||
* This object represents the WebAssembly application's
|
||||
* sandbox directory structure. The string keys of `preopens` are treated as
|
||||
* directories within the sandbox. The corresponding values in `preopens` are
|
||||
* the real paths to those directories on the host machine.
|
||||
*/
|
||||
preopens?: NodeJS.Dict<string>;
|
||||
|
||||
/**
|
||||
* By default, WASI applications terminate the Node.js
|
||||
* process via the `__wasi_proc_exit()` function. Setting this option to `true`
|
||||
* causes `wasi.start()` to return the exit code rather than terminate the
|
||||
* process.
|
||||
* @default false
|
||||
*/
|
||||
returnOnExit?: boolean;
|
||||
}
|
||||
|
||||
class WASI {
|
||||
constructor(options?: WASIOptions);
|
||||
/**
|
||||
*
|
||||
* Attempt to begin execution of `instance` by invoking its `_start()` export.
|
||||
* If `instance` does not contain a `_start()` export, then `start()` attempts to
|
||||
* invoke the `__wasi_unstable_reactor_start()` export. If neither of those exports
|
||||
* is present on `instance`, then `start()` does nothing.
|
||||
*
|
||||
* `start()` requires that `instance` exports a [`WebAssembly.Memory`][] named
|
||||
* `memory`. If `instance` does not have a `memory` export an exception is thrown.
|
||||
*/
|
||||
start(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
|
||||
|
||||
/**
|
||||
* Is an object that implements the WASI system call API. This object
|
||||
* should be passed as the `wasi_snapshot_preview1` import during the instantiation of a
|
||||
* [`WebAssembly.Instance`][].
|
||||
*/
|
||||
readonly wasiImport: NodeJS.Dict<any>; // TODO: Narrow to DOM types
|
||||
}
|
||||
}
|
||||
+79
-25
@@ -2,9 +2,12 @@ declare module "worker_threads" {
|
||||
import { Context } from "vm";
|
||||
import { EventEmitter } from "events";
|
||||
import { Readable, Writable } from "stream";
|
||||
import { promises } from "fs";
|
||||
|
||||
const isMainThread: boolean;
|
||||
const parentPort: null | MessagePort;
|
||||
const resourceLimits: ResourceLimits;
|
||||
const SHARE_ENV: unique symbol;
|
||||
const threadId: number;
|
||||
const workerData: any;
|
||||
|
||||
@@ -13,9 +16,11 @@ declare module "worker_threads" {
|
||||
readonly port2: MessagePort;
|
||||
}
|
||||
|
||||
type TransferListItem = ArrayBuffer | MessagePort | promises.FileHandle;
|
||||
|
||||
class MessagePort extends EventEmitter {
|
||||
close(): void;
|
||||
postMessage(value: any, transferList?: Array<ArrayBuffer | MessagePort>): void;
|
||||
postMessage(value: any, transferList?: ReadonlyArray<TransferListItem>): void;
|
||||
ref(): void;
|
||||
unref(): void;
|
||||
start(): void;
|
||||
@@ -55,11 +60,38 @@ declare module "worker_threads" {
|
||||
|
||||
interface WorkerOptions {
|
||||
eval?: boolean;
|
||||
env?: NodeJS.ProcessEnv | typeof SHARE_ENV;
|
||||
workerData?: any;
|
||||
stdin?: boolean;
|
||||
stdout?: boolean;
|
||||
stderr?: boolean;
|
||||
execArgv?: string[];
|
||||
resourceLimits?: ResourceLimits;
|
||||
/**
|
||||
* Additional data to send in the first worker message.
|
||||
*/
|
||||
transferList?: TransferListItem[];
|
||||
trackUnmanagedFds?: boolean;
|
||||
}
|
||||
|
||||
interface ResourceLimits {
|
||||
/**
|
||||
* The maximum size of a heap space for recently created objects.
|
||||
*/
|
||||
maxYoungGenerationSizeMb?: number;
|
||||
/**
|
||||
* The maximum size of the main heap in MB.
|
||||
*/
|
||||
maxOldGenerationSizeMb?: number;
|
||||
/**
|
||||
* The size of a pre-allocated memory range used for generated code.
|
||||
*/
|
||||
codeRangeSizeMb?: number;
|
||||
/**
|
||||
* The default maximum stack size for the thread. Small values may lead to unusable Worker instances.
|
||||
* @default 4
|
||||
*/
|
||||
stackSizeMb?: number;
|
||||
}
|
||||
|
||||
class Worker extends EventEmitter {
|
||||
@@ -67,10 +99,11 @@ declare module "worker_threads" {
|
||||
readonly stdout: Readable;
|
||||
readonly stderr: Readable;
|
||||
readonly threadId: number;
|
||||
readonly resourceLimits?: ResourceLimits;
|
||||
|
||||
constructor(filename: string, options?: WorkerOptions);
|
||||
|
||||
postMessage(value: any, transferList?: Array<ArrayBuffer | MessagePort>): void;
|
||||
postMessage(value: any, transferList?: ReadonlyArray<TransferListItem>): void;
|
||||
ref(): void;
|
||||
unref(): void;
|
||||
/**
|
||||
@@ -78,76 +111,97 @@ declare module "worker_threads" {
|
||||
* Returns a Promise for the exit code that is fulfilled when the `exit` event is emitted.
|
||||
*/
|
||||
terminate(): Promise<number>;
|
||||
/**
|
||||
* Transfer a `MessagePort` to a different `vm` Context. The original `port`
|
||||
* object will be rendered unusable, and the returned `MessagePort` instance will
|
||||
* take its place.
|
||||
*
|
||||
* The returned `MessagePort` will be an object in the target context, and will
|
||||
* inherit from its global `Object` class. Objects passed to the
|
||||
* `port.onmessage()` listener will also be created in the target context
|
||||
* and inherit from its global `Object` class.
|
||||
*
|
||||
* However, the created `MessagePort` will no longer inherit from
|
||||
* `EventEmitter`, and only `port.onmessage()` can be used to receive
|
||||
* events using it.
|
||||
*/
|
||||
moveMessagePortToContext(port: MessagePort, context: Context): MessagePort;
|
||||
|
||||
/**
|
||||
* Receive a single message from a given `MessagePort`. If no message is available,
|
||||
* `undefined` is returned, otherwise an object with a single `message` property
|
||||
* that contains the message payload, corresponding to the oldest message in the
|
||||
* `MessagePort`’s queue.
|
||||
*/
|
||||
receiveMessageOnPort(port: MessagePort): {} | undefined;
|
||||
|
||||
addListener(event: "error", listener: (err: Error) => void): this;
|
||||
addListener(event: "exit", listener: (exitCode: number) => void): this;
|
||||
addListener(event: "message", listener: (value: any) => void): this;
|
||||
addListener(event: "messageerror", listener: (error: Error) => void): this;
|
||||
addListener(event: "online", listener: () => void): this;
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
emit(event: "error", err: Error): boolean;
|
||||
emit(event: "exit", exitCode: number): boolean;
|
||||
emit(event: "message", value: any): boolean;
|
||||
emit(event: "messageerror", error: Error): boolean;
|
||||
emit(event: "online"): boolean;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
|
||||
on(event: "error", listener: (err: Error) => void): this;
|
||||
on(event: "exit", listener: (exitCode: number) => void): this;
|
||||
on(event: "message", listener: (value: any) => void): this;
|
||||
on(event: "messageerror", listener: (error: Error) => void): this;
|
||||
on(event: "online", listener: () => void): this;
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
once(event: "error", listener: (err: Error) => void): this;
|
||||
once(event: "exit", listener: (exitCode: number) => void): this;
|
||||
once(event: "message", listener: (value: any) => void): this;
|
||||
once(event: "messageerror", listener: (error: Error) => void): this;
|
||||
once(event: "online", listener: () => void): this;
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependListener(event: "error", listener: (err: Error) => void): this;
|
||||
prependListener(event: "exit", listener: (exitCode: number) => void): this;
|
||||
prependListener(event: "message", listener: (value: any) => void): this;
|
||||
prependListener(event: "messageerror", listener: (error: Error) => void): this;
|
||||
prependListener(event: "online", listener: () => void): this;
|
||||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
||||
prependOnceListener(event: "exit", listener: (exitCode: number) => void): this;
|
||||
prependOnceListener(event: "message", listener: (value: any) => void): this;
|
||||
prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
|
||||
prependOnceListener(event: "online", listener: () => void): this;
|
||||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
removeListener(event: "error", listener: (err: Error) => void): this;
|
||||
removeListener(event: "exit", listener: (exitCode: number) => void): this;
|
||||
removeListener(event: "message", listener: (value: any) => void): this;
|
||||
removeListener(event: "messageerror", listener: (error: Error) => void): this;
|
||||
removeListener(event: "online", listener: () => void): this;
|
||||
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
off(event: "error", listener: (err: Error) => void): this;
|
||||
off(event: "exit", listener: (exitCode: number) => void): this;
|
||||
off(event: "message", listener: (value: any) => void): this;
|
||||
off(event: "messageerror", listener: (error: Error) => void): this;
|
||||
off(event: "online", listener: () => void): this;
|
||||
off(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark an object as not transferable.
|
||||
* If `object` occurs in the transfer list of a `port.postMessage()` call, it will be ignored.
|
||||
*
|
||||
* In particular, this makes sense for objects that can be cloned, rather than transferred,
|
||||
* and which are used by other objects on the sending side. For example, Node.js marks
|
||||
* the `ArrayBuffer`s it uses for its Buffer pool with this.
|
||||
*
|
||||
* This operation cannot be undone.
|
||||
*/
|
||||
function markAsUntransferable(object: object): void;
|
||||
|
||||
/**
|
||||
* Transfer a `MessagePort` to a different `vm` Context. The original `port`
|
||||
* object will be rendered unusable, and the returned `MessagePort` instance will
|
||||
* take its place.
|
||||
*
|
||||
* The returned `MessagePort` will be an object in the target context, and will
|
||||
* inherit from its global `Object` class. Objects passed to the
|
||||
* `port.onmessage()` listener will also be created in the target context
|
||||
* and inherit from its global `Object` class.
|
||||
*
|
||||
* However, the created `MessagePort` will no longer inherit from
|
||||
* `EventEmitter`, and only `port.onmessage()` can be used to receive
|
||||
* events using it.
|
||||
*/
|
||||
function moveMessagePortToContext(port: MessagePort, context: Context): MessagePort;
|
||||
|
||||
/**
|
||||
* Receive a single message from a given `MessagePort`. If no message is available,
|
||||
* `undefined` is returned, otherwise an object with a single `message` property
|
||||
* that contains the message payload, corresponding to the oldest message in the
|
||||
* `MessagePort`’s queue.
|
||||
*/
|
||||
function receiveMessageOnPort(port: MessagePort): { message: any } | undefined;
|
||||
}
|
||||
|
||||
+129
-125
@@ -19,6 +19,8 @@ declare module "zlib" {
|
||||
memLevel?: number; // compression only
|
||||
strategy?: number; // compression only
|
||||
dictionary?: NodeJS.ArrayBufferView | ArrayBuffer; // deflate/inflate only, empty dictionary by default
|
||||
info?: boolean;
|
||||
maxOutputLength?: number;
|
||||
}
|
||||
|
||||
interface BrotliOptions {
|
||||
@@ -40,6 +42,7 @@ declare module "zlib" {
|
||||
*/
|
||||
[key: number]: boolean | number;
|
||||
};
|
||||
maxOutputLength?: number;
|
||||
}
|
||||
|
||||
interface Zlib {
|
||||
@@ -48,7 +51,8 @@ declare module "zlib" {
|
||||
readonly bytesWritten: number;
|
||||
shell?: boolean | string;
|
||||
close(callback?: () => void): void;
|
||||
flush(kind?: number | (() => void), callback?: () => void): void;
|
||||
flush(kind?: number, callback?: () => void): void;
|
||||
flush(callback?: () => void): void;
|
||||
}
|
||||
|
||||
interface ZlibParams {
|
||||
@@ -85,30 +89,74 @@ declare module "zlib" {
|
||||
|
||||
function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
|
||||
function brotliCompress(buf: InputType, callback: CompressCallback): void;
|
||||
namespace brotliCompress {
|
||||
function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<Buffer>;
|
||||
}
|
||||
|
||||
function brotliCompressSync(buf: InputType, options?: BrotliOptions): Buffer;
|
||||
|
||||
function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
|
||||
function brotliDecompress(buf: InputType, callback: CompressCallback): void;
|
||||
namespace brotliDecompress {
|
||||
function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<Buffer>;
|
||||
}
|
||||
|
||||
function brotliDecompressSync(buf: InputType, options?: BrotliOptions): Buffer;
|
||||
|
||||
function deflate(buf: InputType, callback: CompressCallback): void;
|
||||
function deflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
||||
namespace deflate {
|
||||
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
|
||||
}
|
||||
|
||||
function deflateSync(buf: InputType, options?: ZlibOptions): Buffer;
|
||||
|
||||
function deflateRaw(buf: InputType, callback: CompressCallback): void;
|
||||
function deflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
||||
namespace deflateRaw {
|
||||
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
|
||||
}
|
||||
|
||||
function deflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
|
||||
|
||||
function gzip(buf: InputType, callback: CompressCallback): void;
|
||||
function gzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
||||
namespace gzip {
|
||||
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
|
||||
}
|
||||
|
||||
function gzipSync(buf: InputType, options?: ZlibOptions): Buffer;
|
||||
|
||||
function gunzip(buf: InputType, callback: CompressCallback): void;
|
||||
function gunzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
||||
namespace gunzip {
|
||||
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
|
||||
}
|
||||
|
||||
function gunzipSync(buf: InputType, options?: ZlibOptions): Buffer;
|
||||
|
||||
function inflate(buf: InputType, callback: CompressCallback): void;
|
||||
function inflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
||||
namespace inflate {
|
||||
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
|
||||
}
|
||||
|
||||
function inflateSync(buf: InputType, options?: ZlibOptions): Buffer;
|
||||
|
||||
function inflateRaw(buf: InputType, callback: CompressCallback): void;
|
||||
function inflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
||||
namespace inflateRaw {
|
||||
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
|
||||
}
|
||||
|
||||
function inflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
|
||||
|
||||
function unzip(buf: InputType, callback: CompressCallback): void;
|
||||
function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
||||
namespace unzip {
|
||||
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
|
||||
}
|
||||
|
||||
function unzipSync(buf: InputType, options?: ZlibOptions): Buffer;
|
||||
|
||||
namespace constants {
|
||||
@@ -188,165 +236,121 @@ declare module "zlib" {
|
||||
const INFLATERAW: number;
|
||||
const UNZIP: number;
|
||||
|
||||
const Z_BEST_COMPRESSION: number;
|
||||
const Z_BEST_SPEED: number;
|
||||
const Z_BLOCK: number;
|
||||
const Z_BUF_ERROR: number;
|
||||
const Z_DATA_ERROR: number;
|
||||
|
||||
const Z_DEFAULT_CHUNK: number;
|
||||
const Z_DEFAULT_COMPRESSION: number;
|
||||
const Z_DEFAULT_LEVEL: number;
|
||||
const Z_DEFAULT_MEMLEVEL: number;
|
||||
const Z_DEFAULT_STRATEGY: number;
|
||||
const Z_DEFAULT_WINDOWBITS: number;
|
||||
|
||||
const Z_ERRNO: number;
|
||||
const Z_FILTERED: number;
|
||||
const Z_FINISH: number;
|
||||
const Z_FIXED: number;
|
||||
const Z_FULL_FLUSH: number;
|
||||
const Z_HUFFMAN_ONLY: number;
|
||||
const Z_MAX_CHUNK: number;
|
||||
const Z_MAX_LEVEL: number;
|
||||
const Z_MAX_MEMLEVEL: number;
|
||||
const Z_MAX_WINDOWBITS: number;
|
||||
const Z_MEM_ERROR: number;
|
||||
const Z_MIN_CHUNK: number;
|
||||
const Z_MIN_LEVEL: number;
|
||||
const Z_MIN_MEMLEVEL: number;
|
||||
const Z_MIN_WINDOWBITS: number;
|
||||
const Z_NEED_DICT: number;
|
||||
const Z_NO_COMPRESSION: number;
|
||||
const Z_NO_FLUSH: number;
|
||||
const Z_OK: number;
|
||||
const Z_PARTIAL_FLUSH: number;
|
||||
const Z_RLE: number;
|
||||
const Z_STREAM_END: number;
|
||||
const Z_STREAM_ERROR: number;
|
||||
const Z_SYNC_FLUSH: number;
|
||||
const Z_FULL_FLUSH: number;
|
||||
const Z_FINISH: number;
|
||||
const Z_BLOCK: number;
|
||||
const Z_TREES: number;
|
||||
|
||||
const Z_OK: number;
|
||||
const Z_STREAM_END: number;
|
||||
const Z_NEED_DICT: number;
|
||||
const Z_ERRNO: number;
|
||||
const Z_STREAM_ERROR: number;
|
||||
const Z_DATA_ERROR: number;
|
||||
const Z_MEM_ERROR: number;
|
||||
const Z_BUF_ERROR: number;
|
||||
const Z_VERSION_ERROR: number;
|
||||
|
||||
const Z_NO_COMPRESSION: number;
|
||||
const Z_BEST_SPEED: number;
|
||||
const Z_BEST_COMPRESSION: number;
|
||||
const Z_DEFAULT_COMPRESSION: number;
|
||||
|
||||
const Z_FILTERED: number;
|
||||
const Z_HUFFMAN_ONLY: number;
|
||||
const Z_RLE: number;
|
||||
const Z_FIXED: number;
|
||||
const Z_DEFAULT_STRATEGY: number;
|
||||
|
||||
const Z_DEFAULT_WINDOWBITS: number;
|
||||
const Z_MIN_WINDOWBITS: number;
|
||||
const Z_MAX_WINDOWBITS: number;
|
||||
|
||||
const Z_MIN_CHUNK: number;
|
||||
const Z_MAX_CHUNK: number;
|
||||
const Z_DEFAULT_CHUNK: number;
|
||||
|
||||
const Z_MIN_MEMLEVEL: number;
|
||||
const Z_MAX_MEMLEVEL: number;
|
||||
const Z_DEFAULT_MEMLEVEL: number;
|
||||
|
||||
const Z_MIN_LEVEL: number;
|
||||
const Z_MAX_LEVEL: number;
|
||||
const Z_DEFAULT_LEVEL: number;
|
||||
|
||||
const ZLIB_VERNUM: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
// Allowed flush values.
|
||||
/** @deprecated Use `constants.Z_NO_FLUSH` */
|
||||
const Z_NO_FLUSH: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_PARTIAL_FLUSH` */
|
||||
const Z_PARTIAL_FLUSH: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_SYNC_FLUSH` */
|
||||
const Z_SYNC_FLUSH: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_FULL_FLUSH` */
|
||||
const Z_FULL_FLUSH: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_FINISH` */
|
||||
const Z_FINISH: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_BLOCK` */
|
||||
const Z_BLOCK: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_TREES` */
|
||||
const Z_TREES: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
||||
// Return codes for the compression/decompression functions.
|
||||
// Negative values are errors, positive values are used for special but normal events.
|
||||
/** @deprecated Use `constants.Z_OK` */
|
||||
const Z_OK: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_STREAM_END` */
|
||||
const Z_STREAM_END: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_NEED_DICT` */
|
||||
const Z_NEED_DICT: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_ERRNO` */
|
||||
const Z_ERRNO: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_STREAM_ERROR` */
|
||||
const Z_STREAM_ERROR: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_DATA_ERROR` */
|
||||
const Z_DATA_ERROR: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_MEM_ERROR` */
|
||||
const Z_MEM_ERROR: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_BUF_ERROR` */
|
||||
const Z_BUF_ERROR: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_VERSION_ERROR` */
|
||||
const Z_VERSION_ERROR: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
||||
// Compression levels.
|
||||
/** @deprecated Use `constants.Z_NO_COMPRESSION` */
|
||||
const Z_NO_COMPRESSION: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_BEST_SPEED` */
|
||||
const Z_BEST_SPEED: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_BEST_COMPRESSION` */
|
||||
const Z_BEST_COMPRESSION: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_DEFAULT_COMPRESSION` */
|
||||
const Z_DEFAULT_COMPRESSION: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
||||
// Compression strategy.
|
||||
/** @deprecated Use `constants.Z_FILTERED` */
|
||||
const Z_FILTERED: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_HUFFMAN_ONLY` */
|
||||
const Z_HUFFMAN_ONLY: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_RLE` */
|
||||
const Z_RLE: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_FIXED` */
|
||||
const Z_FIXED: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated Use `constants.Z_DEFAULT_STRATEGY` */
|
||||
const Z_DEFAULT_STRATEGY: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
||||
/** @deprecated */
|
||||
const Z_BINARY: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated */
|
||||
const Z_TEXT: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated */
|
||||
const Z_ASCII: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated */
|
||||
const Z_UNKNOWN: number;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/** @deprecated */
|
||||
const Z_DEFLATED: number;
|
||||
}
|
||||
|
||||
+8
@@ -2,7 +2,11 @@
|
||||
"_args": [
|
||||
[
|
||||
"@types/normalize-package-data@2.4.0",
|
||||
<<<<<<< HEAD
|
||||
"/home/marco/repos/github/codeql-action"
|
||||
=======
|
||||
"/home/chris/src/github.com/github/codeql-action"
|
||||
>>>>>>> origin/results-cache-test
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
@@ -28,7 +32,11 @@
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz",
|
||||
"_spec": "2.4.0",
|
||||
<<<<<<< HEAD
|
||||
"_where": "/home/marco/repos/github/codeql-action",
|
||||
=======
|
||||
"_where": "/home/chris/src/github.com/github/codeql-action",
|
||||
>>>>>>> origin/results-cache-test
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ This package contains type definitions for semver (https://github.com/npm/node-s
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/semver.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Wed, 13 May 2020 16:20:54 GMT
|
||||
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
||||
* Last updated: Mon, 14 Sep 2020 20:52:56 GMT
|
||||
* Dependencies: none
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import sermver = require('../');
|
||||
import sermver = require('../index');
|
||||
import SemVer = require('./semver');
|
||||
|
||||
declare class Comparator {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
import Comparator = require('./comparator');
|
||||
import SemVer = require('./semver');
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
declare class SemVer {
|
||||
constructor(version: string | SemVer, optionsOrLoose?: boolean | semver.Options);
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Returns cleaned (removed leading/trailing whitespace, remove '=v' prefix) and parsed version, or null if version is invalid.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
import SemVer = require('../classes/semver');
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
import SemVer = require('../classes/semver');
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
import SemVer = require('../classes/semver');
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
import SemVer = require('../classes/semver');
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* v1 == v2 This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* v1 > v2
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* v1 >= v2
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Return the version incremented by the release type (major, minor, patch, or prerelease), or null if it's not valid.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* v1 < v2
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* v1 <= v2
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Return the major version number.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Return the minor version number.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* v1 != v2 The opposite of eq.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Return the parsed version as a SemVer object, or null if it's not valid.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Return the patch version number.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Returns an array of prerelease components, or null if none exist.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* The reverse of compare.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Sorts an array of semver entries in descending order using `compareBuild()`.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import Range = require('../classes/range');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Return true if the version satisfies the range.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Sorts an array of semver entries in ascending order using `compareBuild()`.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
import SemVer = require('../classes/semver');
|
||||
/**
|
||||
* Return the parsed version as a string, or null if it's not valid.
|
||||
|
||||
+6
-6
@@ -1,4 +1,4 @@
|
||||
// Type definitions for semver 7.2
|
||||
// Type definitions for semver 7.3
|
||||
// Project: https://github.com/npm/node-semver
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
@@ -6,9 +6,7 @@
|
||||
// Klaus Meinhardt <https://github.com/ajafff>
|
||||
// ExE Boss <https://github.com/ExE-Boss>
|
||||
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/semver
|
||||
|
||||
/// <reference types="node" />
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// re-exports for index file
|
||||
|
||||
@@ -79,7 +77,8 @@ import semverOutside = require('./ranges/outside');
|
||||
import semverGtr = require('./ranges/gtr');
|
||||
import semverLtr = require('./ranges/ltr');
|
||||
import semverIntersects = require('./ranges/intersects');
|
||||
import simplifyRange = require('./ranges/simplify');
|
||||
import simplify = require('./ranges/simplify');
|
||||
import rangeSubset = require('./ranges/subset');
|
||||
|
||||
export {
|
||||
semverSatisfies as satisfies,
|
||||
@@ -92,7 +91,8 @@ export {
|
||||
semverGtr as gtr,
|
||||
semverLtr as ltr,
|
||||
semverIntersects as intersects,
|
||||
simplifyRange as simplify,
|
||||
simplify as simplifyRange,
|
||||
rangeSubset as subset,
|
||||
};
|
||||
|
||||
// classes
|
||||
|
||||
+46
-76
@@ -1,79 +1,49 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@types/semver@7.2.0",
|
||||
"/home/marco/repos/github/codeql-action"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@types/semver@7.2.0",
|
||||
"_id": "@types/semver@7.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-TbB0A8ACUWZt3Y6bQPstW9QNbhNeebdgLX4T/ZfkrswAfUzRiXrgd9seol+X379Wa589Pu4UEx9Uok0D4RjRCQ==",
|
||||
"_location": "/@types/semver",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@types/semver@7.2.0",
|
||||
"name": "@types/semver",
|
||||
"escapedName": "@types%2fsemver",
|
||||
"scope": "@types",
|
||||
"rawSpec": "7.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.2.0.tgz",
|
||||
"_spec": "7.2.0",
|
||||
"_where": "/home/marco/repos/github/codeql-action",
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Bart van der Schoor",
|
||||
"url": "https://github.com/Bartvds"
|
||||
"version": "7.3.4",
|
||||
"description": "TypeScript definitions for semver",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Bart van der Schoor",
|
||||
"url": "https://github.com/Bartvds",
|
||||
"githubUsername": "Bartvds"
|
||||
},
|
||||
{
|
||||
"name": "BendingBender",
|
||||
"url": "https://github.com/BendingBender",
|
||||
"githubUsername": "BendingBender"
|
||||
},
|
||||
{
|
||||
"name": "Lucian Buzzo",
|
||||
"url": "https://github.com/LucianBuzzo",
|
||||
"githubUsername": "LucianBuzzo"
|
||||
},
|
||||
{
|
||||
"name": "Klaus Meinhardt",
|
||||
"url": "https://github.com/ajafff",
|
||||
"githubUsername": "ajafff"
|
||||
},
|
||||
{
|
||||
"name": "ExE Boss",
|
||||
"url": "https://github.com/ExE-Boss",
|
||||
"githubUsername": "ExE-Boss"
|
||||
},
|
||||
{
|
||||
"name": "Piotr Błażejewicz",
|
||||
"url": "https://github.com/peterblazejewicz",
|
||||
"githubUsername": "peterblazejewicz"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/semver"
|
||||
},
|
||||
{
|
||||
"name": "BendingBender",
|
||||
"url": "https://github.com/BendingBender"
|
||||
},
|
||||
{
|
||||
"name": "Lucian Buzzo",
|
||||
"url": "https://github.com/LucianBuzzo"
|
||||
},
|
||||
{
|
||||
"name": "Klaus Meinhardt",
|
||||
"url": "https://github.com/ajafff"
|
||||
},
|
||||
{
|
||||
"name": "ExE Boss",
|
||||
"url": "https://github.com/ExE-Boss"
|
||||
},
|
||||
{
|
||||
"name": "Piotr Błażejewicz",
|
||||
"url": "https://github.com/peterblazejewicz"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
},
|
||||
"description": "TypeScript definitions for semver",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
|
||||
"license": "MIT",
|
||||
"main": "",
|
||||
"name": "@types/semver",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/semver"
|
||||
},
|
||||
"scripts": {},
|
||||
"typeScriptVersion": "2.9",
|
||||
"types": "index.d.ts",
|
||||
"typesPublisherContentHash": "a85c812786f6121af7012f9234a35445623e4933797ddf4b52584d65deaec9ef",
|
||||
"version": "7.2.0"
|
||||
}
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"typesPublisherContentHash": "a1c2692f5183ed55b16d7ffb43be1851eae8ad440f4450f11296ed5a83f5c3df",
|
||||
"typeScriptVersion": "3.1"
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import Range = require('../classes/range');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Return true if version is greater than all the versions possible in the range.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import Range = require('../classes/range');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Return true if any of the ranges comparators intersect
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import Range = require('../classes/range');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Return true if version is less than all the versions possible in the range.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import Range = require('../classes/range');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Return the highest version in the list that satisfies the range, or null if none of them do.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import Range = require('../classes/range');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Return the lowest version in the list that satisfies the range, or null if none of them do.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import Range = require('../classes/range');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Return the lowest version that can possibly match the given range.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import Range = require('../classes/range');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../');
|
||||
import semver = require('../index');
|
||||
|
||||
/**
|
||||
* Return true if the version is outside the bounds of the range in either the high or low direction.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user