mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
Deploy Production Code for Commit 95ad738c59
🚀
This commit is contained in:
parent
95ad738c59
commit
e6d003d083
2
lib/constants.d.ts
vendored
2
lib/constants.d.ts
vendored
@ -53,7 +53,7 @@ export interface ActionInterface {
|
|||||||
/** The minimum required values to run the action as a node module. */
|
/** The minimum required values to run the action as a node module. */
|
||||||
export interface NodeActionInterface {
|
export interface NodeActionInterface {
|
||||||
/** The branch that the action should deploy to. */
|
/** The branch that the action should deploy to. */
|
||||||
branch: string;
|
branch?: string;
|
||||||
/** The folder to deploy. */
|
/** The folder to deploy. */
|
||||||
folder: string;
|
folder: string;
|
||||||
/** The repository path, for example JamesIves/github-pages-deploy-action. */
|
/** The repository path, for example JamesIves/github-pages-deploy-action. */
|
||||||
|
@ -48,7 +48,11 @@ function run(configuration) {
|
|||||||
❓ Discussions / Q&A: https://github.com/JamesIves/github-pages-deploy-action/discussions
|
❓ Discussions / Q&A: https://github.com/JamesIves/github-pages-deploy-action/discussions
|
||||||
🔧 Report a Bug: https://github.com/JamesIves/github-pages-deploy-action/issues`);
|
🔧 Report a Bug: https://github.com/JamesIves/github-pages-deploy-action/issues`);
|
||||||
(0, core_1.info)('Checking configuration and starting deployment… 🚦');
|
(0, core_1.info)('Checking configuration and starting deployment… 🚦');
|
||||||
const settings = Object.assign({}, configuration);
|
const settings = Object.assign(Object.assign({}, configuration), {
|
||||||
|
// Set the default branch for Node configurations
|
||||||
|
branch: !(0, util_1.isNullOrUndefined)(configuration.branch)
|
||||||
|
? configuration.branch
|
||||||
|
: 'gh-pages' });
|
||||||
// Defines the repository/folder paths and token types.
|
// Defines the repository/folder paths and token types.
|
||||||
// Also verifies that the action has all of the required parameters.
|
// Also verifies that the action has all of the required parameters.
|
||||||
settings.folderPath = (0, util_1.generateFolderPath)(settings);
|
settings.folderPath = (0, util_1.generateFolderPath)(settings);
|
||||||
|
2
lib/util.d.ts
vendored
2
lib/util.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
import { ActionInterface } from './constants';
|
import { ActionInterface } from './constants';
|
||||||
export declare const isNullOrUndefined: (value: unknown) => boolean;
|
export declare const isNullOrUndefined: (value: unknown) => value is "" | null | undefined;
|
||||||
export declare const generateTokenType: (action: ActionInterface) => string;
|
export declare const generateTokenType: (action: ActionInterface) => string;
|
||||||
export declare const generateRepositoryPath: (action: ActionInterface) => string;
|
export declare const generateRepositoryPath: (action: ActionInterface) => string;
|
||||||
export declare const generateFolderPath: (action: ActionInterface) => string;
|
export declare const generateFolderPath: (action: ActionInterface) => string;
|
||||||
|
25
node_modules/@actions/core/README.md
generated
vendored
25
node_modules/@actions/core/README.md
generated
vendored
@ -309,4 +309,27 @@ outputs:
|
|||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Filesystem path helpers
|
||||||
|
|
||||||
|
You can use these methods to manipulate file paths across operating systems.
|
||||||
|
|
||||||
|
The `toPosixPath` function converts input paths to Posix-style (Linux) paths.
|
||||||
|
The `toWin32Path` function converts input paths to Windows-style paths. These
|
||||||
|
functions work independently of the underlying runner operating system.
|
||||||
|
|
||||||
|
```js
|
||||||
|
toPosixPath('\\foo\\bar') // => /foo/bar
|
||||||
|
toWin32Path('/foo/bar') // => \foo\bar
|
||||||
|
```
|
||||||
|
|
||||||
|
The `toPlatformPath` function converts input paths to the expected value on the runner's operating system.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// On a Windows runner.
|
||||||
|
toPlatformPath('/foo/bar') // => \foo\bar
|
||||||
|
|
||||||
|
// On a Linux runner.
|
||||||
|
toPlatformPath('\\foo\\bar') // => /foo/bar
|
||||||
|
```
|
||||||
|
12
node_modules/@actions/core/lib/core.d.ts
generated
vendored
12
node_modules/@actions/core/lib/core.d.ts
generated
vendored
@ -184,3 +184,15 @@ export declare function saveState(name: string, value: any): void;
|
|||||||
*/
|
*/
|
||||||
export declare function getState(name: string): string;
|
export declare function getState(name: string): string;
|
||||||
export declare function getIDToken(aud?: string): Promise<string>;
|
export declare function getIDToken(aud?: string): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Summary exports
|
||||||
|
*/
|
||||||
|
export { summary } from './summary';
|
||||||
|
/**
|
||||||
|
* @deprecated use core.summary
|
||||||
|
*/
|
||||||
|
export { markdownSummary } from './summary';
|
||||||
|
/**
|
||||||
|
* Path exports
|
||||||
|
*/
|
||||||
|
export { toPosixPath, toWin32Path, toPlatformPath } from './path-utils';
|
||||||
|
17
node_modules/@actions/core/lib/core.js
generated
vendored
17
node_modules/@actions/core/lib/core.js
generated
vendored
@ -309,4 +309,21 @@ function getIDToken(aud) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.getIDToken = getIDToken;
|
exports.getIDToken = getIDToken;
|
||||||
|
/**
|
||||||
|
* Summary exports
|
||||||
|
*/
|
||||||
|
var summary_1 = require("./summary");
|
||||||
|
Object.defineProperty(exports, "summary", { enumerable: true, get: function () { return summary_1.summary; } });
|
||||||
|
/**
|
||||||
|
* @deprecated use core.summary
|
||||||
|
*/
|
||||||
|
var summary_2 = require("./summary");
|
||||||
|
Object.defineProperty(exports, "markdownSummary", { enumerable: true, get: function () { return summary_2.markdownSummary; } });
|
||||||
|
/**
|
||||||
|
* Path exports
|
||||||
|
*/
|
||||||
|
var path_utils_1 = require("./path-utils");
|
||||||
|
Object.defineProperty(exports, "toPosixPath", { enumerable: true, get: function () { return path_utils_1.toPosixPath; } });
|
||||||
|
Object.defineProperty(exports, "toWin32Path", { enumerable: true, get: function () { return path_utils_1.toWin32Path; } });
|
||||||
|
Object.defineProperty(exports, "toPlatformPath", { enumerable: true, get: function () { return path_utils_1.toPlatformPath; } });
|
||||||
//# sourceMappingURL=core.js.map
|
//# sourceMappingURL=core.js.map
|
2
node_modules/@actions/core/lib/core.js.map
generated
vendored
2
node_modules/@actions/core/lib/core.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/@actions/core/lib/oidc-utils.js
generated
vendored
2
node_modules/@actions/core/lib/oidc-utils.js
generated
vendored
@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.OidcClient = void 0;
|
exports.OidcClient = void 0;
|
||||||
const http_client_1 = require("@actions/http-client");
|
const http_client_1 = require("@actions/http-client");
|
||||||
const auth_1 = require("@actions/http-client/auth");
|
const auth_1 = require("@actions/http-client/lib/auth");
|
||||||
const core_1 = require("./core");
|
const core_1 = require("./core");
|
||||||
class OidcClient {
|
class OidcClient {
|
||||||
static createHttpClient(allowRetry = true, maxRetry = 10) {
|
static createHttpClient(allowRetry = true, maxRetry = 10) {
|
||||||
|
2
node_modules/@actions/core/lib/oidc-utils.js.map
generated
vendored
2
node_modules/@actions/core/lib/oidc-utils.js.map
generated
vendored
@ -1 +1 @@
|
|||||||
{"version":3,"file":"oidc-utils.js","sourceRoot":"","sources":["../src/oidc-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,sDAA+C;AAC/C,oDAAiE;AACjE,iCAAuC;AAKvC,MAAa,UAAU;IACb,MAAM,CAAC,gBAAgB,CAC7B,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,EAAE;QAEb,MAAM,cAAc,GAAoB;YACtC,YAAY,EAAE,UAAU;YACxB,UAAU,EAAE,QAAQ;SACrB,CAAA;QAED,OAAO,IAAI,wBAAU,CACnB,qBAAqB,EACrB,CAAC,IAAI,8BAAuB,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC,EAC3D,cAAc,CACf,CAAA;IACH,CAAC;IAEO,MAAM,CAAC,eAAe;QAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;QAC3D,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAA;SACF;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAEO,MAAM,CAAC,aAAa;QAC1B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;QAC9D,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;SAC3E;QACD,OAAO,UAAU,CAAA;IACnB,CAAC;IAEO,MAAM,CAAO,OAAO,CAAC,YAAoB;;;YAC/C,MAAM,UAAU,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAA;YAEhD,MAAM,GAAG,GAAG,MAAM,UAAU;iBACzB,OAAO,CAAgB,YAAY,CAAC;iBACpC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACb,MAAM,IAAI,KAAK,CACb;uBACa,KAAK,CAAC,UAAU;yBACd,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CACtC,CAAA;YACH,CAAC,CAAC,CAAA;YAEJ,MAAM,QAAQ,SAAG,GAAG,CAAC,MAAM,0CAAE,KAAK,CAAA;YAClC,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;aACjE;YACD,OAAO,QAAQ,CAAA;;KAChB;IAED,MAAM,CAAO,UAAU,CAAC,QAAiB;;YACvC,IAAI;gBACF,gDAAgD;gBAChD,IAAI,YAAY,GAAW,UAAU,CAAC,aAAa,EAAE,CAAA;gBACrD,IAAI,QAAQ,EAAE;oBACZ,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAA;oBACpD,YAAY,GAAG,GAAG,YAAY,aAAa,eAAe,EAAE,CAAA;iBAC7D;gBAED,YAAK,CAAC,mBAAmB,YAAY,EAAE,CAAC,CAAA;gBAExC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;gBACvD,gBAAS,CAAC,QAAQ,CAAC,CAAA;gBACnB,OAAO,QAAQ,CAAA;aAChB;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;aACnD;QACH,CAAC;KAAA;CACF;AAzED,gCAyEC"}
|
{"version":3,"file":"oidc-utils.js","sourceRoot":"","sources":["../src/oidc-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,sDAA+C;AAC/C,wDAAqE;AACrE,iCAAuC;AAKvC,MAAa,UAAU;IACb,MAAM,CAAC,gBAAgB,CAC7B,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,EAAE;QAEb,MAAM,cAAc,GAAmB;YACrC,YAAY,EAAE,UAAU;YACxB,UAAU,EAAE,QAAQ;SACrB,CAAA;QAED,OAAO,IAAI,wBAAU,CACnB,qBAAqB,EACrB,CAAC,IAAI,8BAAuB,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC,EAC3D,cAAc,CACf,CAAA;IACH,CAAC;IAEO,MAAM,CAAC,eAAe;QAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;QAC3D,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAA;SACF;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAEO,MAAM,CAAC,aAAa;QAC1B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;QAC9D,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;SAC3E;QACD,OAAO,UAAU,CAAA;IACnB,CAAC;IAEO,MAAM,CAAO,OAAO,CAAC,YAAoB;;;YAC/C,MAAM,UAAU,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAA;YAEhD,MAAM,GAAG,GAAG,MAAM,UAAU;iBACzB,OAAO,CAAgB,YAAY,CAAC;iBACpC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACb,MAAM,IAAI,KAAK,CACb;uBACa,KAAK,CAAC,UAAU;yBACd,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CACtC,CAAA;YACH,CAAC,CAAC,CAAA;YAEJ,MAAM,QAAQ,SAAG,GAAG,CAAC,MAAM,0CAAE,KAAK,CAAA;YAClC,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;aACjE;YACD,OAAO,QAAQ,CAAA;;KAChB;IAED,MAAM,CAAO,UAAU,CAAC,QAAiB;;YACvC,IAAI;gBACF,gDAAgD;gBAChD,IAAI,YAAY,GAAW,UAAU,CAAC,aAAa,EAAE,CAAA;gBACrD,IAAI,QAAQ,EAAE;oBACZ,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAA;oBACpD,YAAY,GAAG,GAAG,YAAY,aAAa,eAAe,EAAE,CAAA;iBAC7D;gBAED,YAAK,CAAC,mBAAmB,YAAY,EAAE,CAAC,CAAA;gBAExC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;gBACvD,gBAAS,CAAC,QAAQ,CAAC,CAAA;gBACnB,OAAO,QAAQ,CAAA;aAChB;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;aACnD;QACH,CAAC;KAAA;CACF;AAzED,gCAyEC"}
|
25
node_modules/@actions/core/lib/path-utils.d.ts
generated
vendored
Normal file
25
node_modules/@actions/core/lib/path-utils.d.ts
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* toPosixPath converts the given path to the posix form. On Windows, \\ will be
|
||||||
|
* replaced with /.
|
||||||
|
*
|
||||||
|
* @param pth. Path to transform.
|
||||||
|
* @return string Posix path.
|
||||||
|
*/
|
||||||
|
export declare function toPosixPath(pth: string): string;
|
||||||
|
/**
|
||||||
|
* toWin32Path converts the given path to the win32 form. On Linux, / will be
|
||||||
|
* replaced with \\.
|
||||||
|
*
|
||||||
|
* @param pth. Path to transform.
|
||||||
|
* @return string Win32 path.
|
||||||
|
*/
|
||||||
|
export declare function toWin32Path(pth: string): string;
|
||||||
|
/**
|
||||||
|
* toPlatformPath converts the given path to a platform-specific path. It does
|
||||||
|
* this by replacing instances of / and \ with the platform-specific path
|
||||||
|
* separator.
|
||||||
|
*
|
||||||
|
* @param pth The path to platformize.
|
||||||
|
* @return string The platform-specific path.
|
||||||
|
*/
|
||||||
|
export declare function toPlatformPath(pth: string): string;
|
58
node_modules/@actions/core/lib/path-utils.js
generated
vendored
Normal file
58
node_modules/@actions/core/lib/path-utils.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0;
|
||||||
|
const path = __importStar(require("path"));
|
||||||
|
/**
|
||||||
|
* toPosixPath converts the given path to the posix form. On Windows, \\ will be
|
||||||
|
* replaced with /.
|
||||||
|
*
|
||||||
|
* @param pth. Path to transform.
|
||||||
|
* @return string Posix path.
|
||||||
|
*/
|
||||||
|
function toPosixPath(pth) {
|
||||||
|
return pth.replace(/[\\]/g, '/');
|
||||||
|
}
|
||||||
|
exports.toPosixPath = toPosixPath;
|
||||||
|
/**
|
||||||
|
* toWin32Path converts the given path to the win32 form. On Linux, / will be
|
||||||
|
* replaced with \\.
|
||||||
|
*
|
||||||
|
* @param pth. Path to transform.
|
||||||
|
* @return string Win32 path.
|
||||||
|
*/
|
||||||
|
function toWin32Path(pth) {
|
||||||
|
return pth.replace(/[/]/g, '\\');
|
||||||
|
}
|
||||||
|
exports.toWin32Path = toWin32Path;
|
||||||
|
/**
|
||||||
|
* toPlatformPath converts the given path to a platform-specific path. It does
|
||||||
|
* this by replacing instances of / and \ with the platform-specific path
|
||||||
|
* separator.
|
||||||
|
*
|
||||||
|
* @param pth The path to platformize.
|
||||||
|
* @return string The platform-specific path.
|
||||||
|
*/
|
||||||
|
function toPlatformPath(pth) {
|
||||||
|
return pth.replace(/[/\\]/g, path.sep);
|
||||||
|
}
|
||||||
|
exports.toPlatformPath = toPlatformPath;
|
||||||
|
//# sourceMappingURL=path-utils.js.map
|
1
node_modules/@actions/core/lib/path-utils.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/path-utils.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"path-utils.js","sourceRoot":"","sources":["../src/path-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4B;AAE5B;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;AAClC,CAAC;AAFD,kCAEC;AAED;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AAClC,CAAC;AAFD,kCAEC;AAED;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,GAAW;IACxC,OAAO,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,wCAEC"}
|
202
node_modules/@actions/core/lib/summary.d.ts
generated
vendored
Normal file
202
node_modules/@actions/core/lib/summary.d.ts
generated
vendored
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
export declare const SUMMARY_ENV_VAR = "GITHUB_STEP_SUMMARY";
|
||||||
|
export declare const SUMMARY_DOCS_URL = "https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";
|
||||||
|
export declare type SummaryTableRow = (SummaryTableCell | string)[];
|
||||||
|
export interface SummaryTableCell {
|
||||||
|
/**
|
||||||
|
* Cell content
|
||||||
|
*/
|
||||||
|
data: string;
|
||||||
|
/**
|
||||||
|
* Render cell as header
|
||||||
|
* (optional) default: false
|
||||||
|
*/
|
||||||
|
header?: boolean;
|
||||||
|
/**
|
||||||
|
* Number of columns the cell extends
|
||||||
|
* (optional) default: '1'
|
||||||
|
*/
|
||||||
|
colspan?: string;
|
||||||
|
/**
|
||||||
|
* Number of rows the cell extends
|
||||||
|
* (optional) default: '1'
|
||||||
|
*/
|
||||||
|
rowspan?: string;
|
||||||
|
}
|
||||||
|
export interface SummaryImageOptions {
|
||||||
|
/**
|
||||||
|
* The width of the image in pixels. Must be an integer without a unit.
|
||||||
|
* (optional)
|
||||||
|
*/
|
||||||
|
width?: string;
|
||||||
|
/**
|
||||||
|
* The height of the image in pixels. Must be an integer without a unit.
|
||||||
|
* (optional)
|
||||||
|
*/
|
||||||
|
height?: string;
|
||||||
|
}
|
||||||
|
export interface SummaryWriteOptions {
|
||||||
|
/**
|
||||||
|
* Replace all existing content in summary file with buffer contents
|
||||||
|
* (optional) default: false
|
||||||
|
*/
|
||||||
|
overwrite?: boolean;
|
||||||
|
}
|
||||||
|
declare class Summary {
|
||||||
|
private _buffer;
|
||||||
|
private _filePath?;
|
||||||
|
constructor();
|
||||||
|
/**
|
||||||
|
* Finds the summary file path from the environment, rejects if env var is not found or file does not exist
|
||||||
|
* Also checks r/w permissions.
|
||||||
|
*
|
||||||
|
* @returns step summary file path
|
||||||
|
*/
|
||||||
|
private filePath;
|
||||||
|
/**
|
||||||
|
* Wraps content in an HTML tag, adding any HTML attributes
|
||||||
|
*
|
||||||
|
* @param {string} tag HTML tag to wrap
|
||||||
|
* @param {string | null} content content within the tag
|
||||||
|
* @param {[attribute: string]: string} attrs key-value list of HTML attributes to add
|
||||||
|
*
|
||||||
|
* @returns {string} content wrapped in HTML element
|
||||||
|
*/
|
||||||
|
private wrap;
|
||||||
|
/**
|
||||||
|
* Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.
|
||||||
|
*
|
||||||
|
* @param {SummaryWriteOptions} [options] (optional) options for write operation
|
||||||
|
*
|
||||||
|
* @returns {Promise<Summary>} summary instance
|
||||||
|
*/
|
||||||
|
write(options?: SummaryWriteOptions): Promise<Summary>;
|
||||||
|
/**
|
||||||
|
* Clears the summary buffer and wipes the summary file
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
clear(): Promise<Summary>;
|
||||||
|
/**
|
||||||
|
* Returns the current summary buffer as a string
|
||||||
|
*
|
||||||
|
* @returns {string} string of summary buffer
|
||||||
|
*/
|
||||||
|
stringify(): string;
|
||||||
|
/**
|
||||||
|
* If the summary buffer is empty
|
||||||
|
*
|
||||||
|
* @returns {boolen} true if the buffer is empty
|
||||||
|
*/
|
||||||
|
isEmptyBuffer(): boolean;
|
||||||
|
/**
|
||||||
|
* Resets the summary buffer without writing to summary file
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
emptyBuffer(): Summary;
|
||||||
|
/**
|
||||||
|
* Adds raw text to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} text content to add
|
||||||
|
* @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addRaw(text: string, addEOL?: boolean): Summary;
|
||||||
|
/**
|
||||||
|
* Adds the operating system-specific end-of-line marker to the buffer
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addEOL(): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML codeblock to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} code content to render within fenced code block
|
||||||
|
* @param {string} lang (optional) language to syntax highlight code
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addCodeBlock(code: string, lang?: string): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML list to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string[]} items list of items to render
|
||||||
|
* @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addList(items: string[], ordered?: boolean): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML table to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {SummaryTableCell[]} rows table rows
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addTable(rows: SummaryTableRow[]): Summary;
|
||||||
|
/**
|
||||||
|
* Adds a collapsable HTML details element to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} label text for the closed state
|
||||||
|
* @param {string} content collapsable content
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addDetails(label: string, content: string): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML image tag to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} src path to the image you to embed
|
||||||
|
* @param {string} alt text description of the image
|
||||||
|
* @param {SummaryImageOptions} options (optional) addition image attributes
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addImage(src: string, alt: string, options?: SummaryImageOptions): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML section heading element
|
||||||
|
*
|
||||||
|
* @param {string} text heading text
|
||||||
|
* @param {number | string} [level=1] (optional) the heading level, default: 1
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addHeading(text: string, level?: number | string): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML thematic break (<hr>) to the summary buffer
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addSeparator(): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML line break (<br>) to the summary buffer
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addBreak(): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML blockquote to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} text quote text
|
||||||
|
* @param {string} cite (optional) citation url
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addQuote(text: string, cite?: string): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML anchor tag to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} text link text/content
|
||||||
|
* @param {string} href hyperlink
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addLink(text: string, href: string): Summary;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @deprecated use `core.summary`
|
||||||
|
*/
|
||||||
|
export declare const markdownSummary: Summary;
|
||||||
|
export declare const summary: Summary;
|
||||||
|
export {};
|
283
node_modules/@actions/core/lib/summary.js
generated
vendored
Normal file
283
node_modules/@actions/core/lib/summary.js
generated
vendored
Normal file
@ -0,0 +1,283 @@
|
|||||||
|
"use strict";
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0;
|
||||||
|
const os_1 = require("os");
|
||||||
|
const fs_1 = require("fs");
|
||||||
|
const { access, appendFile, writeFile } = fs_1.promises;
|
||||||
|
exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY';
|
||||||
|
exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary';
|
||||||
|
class Summary {
|
||||||
|
constructor() {
|
||||||
|
this._buffer = '';
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Finds the summary file path from the environment, rejects if env var is not found or file does not exist
|
||||||
|
* Also checks r/w permissions.
|
||||||
|
*
|
||||||
|
* @returns step summary file path
|
||||||
|
*/
|
||||||
|
filePath() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (this._filePath) {
|
||||||
|
return this._filePath;
|
||||||
|
}
|
||||||
|
const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR];
|
||||||
|
if (!pathFromEnv) {
|
||||||
|
throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK);
|
||||||
|
}
|
||||||
|
catch (_a) {
|
||||||
|
throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`);
|
||||||
|
}
|
||||||
|
this._filePath = pathFromEnv;
|
||||||
|
return this._filePath;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Wraps content in an HTML tag, adding any HTML attributes
|
||||||
|
*
|
||||||
|
* @param {string} tag HTML tag to wrap
|
||||||
|
* @param {string | null} content content within the tag
|
||||||
|
* @param {[attribute: string]: string} attrs key-value list of HTML attributes to add
|
||||||
|
*
|
||||||
|
* @returns {string} content wrapped in HTML element
|
||||||
|
*/
|
||||||
|
wrap(tag, content, attrs = {}) {
|
||||||
|
const htmlAttrs = Object.entries(attrs)
|
||||||
|
.map(([key, value]) => ` ${key}="${value}"`)
|
||||||
|
.join('');
|
||||||
|
if (!content) {
|
||||||
|
return `<${tag}${htmlAttrs}>`;
|
||||||
|
}
|
||||||
|
return `<${tag}${htmlAttrs}>${content}</${tag}>`;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.
|
||||||
|
*
|
||||||
|
* @param {SummaryWriteOptions} [options] (optional) options for write operation
|
||||||
|
*
|
||||||
|
* @returns {Promise<Summary>} summary instance
|
||||||
|
*/
|
||||||
|
write(options) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite);
|
||||||
|
const filePath = yield this.filePath();
|
||||||
|
const writeFunc = overwrite ? writeFile : appendFile;
|
||||||
|
yield writeFunc(filePath, this._buffer, { encoding: 'utf8' });
|
||||||
|
return this.emptyBuffer();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Clears the summary buffer and wipes the summary file
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
clear() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.emptyBuffer().write({ overwrite: true });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the current summary buffer as a string
|
||||||
|
*
|
||||||
|
* @returns {string} string of summary buffer
|
||||||
|
*/
|
||||||
|
stringify() {
|
||||||
|
return this._buffer;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* If the summary buffer is empty
|
||||||
|
*
|
||||||
|
* @returns {boolen} true if the buffer is empty
|
||||||
|
*/
|
||||||
|
isEmptyBuffer() {
|
||||||
|
return this._buffer.length === 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Resets the summary buffer without writing to summary file
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
emptyBuffer() {
|
||||||
|
this._buffer = '';
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds raw text to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} text content to add
|
||||||
|
* @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addRaw(text, addEOL = false) {
|
||||||
|
this._buffer += text;
|
||||||
|
return addEOL ? this.addEOL() : this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds the operating system-specific end-of-line marker to the buffer
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addEOL() {
|
||||||
|
return this.addRaw(os_1.EOL);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML codeblock to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} code content to render within fenced code block
|
||||||
|
* @param {string} lang (optional) language to syntax highlight code
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addCodeBlock(code, lang) {
|
||||||
|
const attrs = Object.assign({}, (lang && { lang }));
|
||||||
|
const element = this.wrap('pre', this.wrap('code', code), attrs);
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML list to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string[]} items list of items to render
|
||||||
|
* @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addList(items, ordered = false) {
|
||||||
|
const tag = ordered ? 'ol' : 'ul';
|
||||||
|
const listItems = items.map(item => this.wrap('li', item)).join('');
|
||||||
|
const element = this.wrap(tag, listItems);
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML table to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {SummaryTableCell[]} rows table rows
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addTable(rows) {
|
||||||
|
const tableBody = rows
|
||||||
|
.map(row => {
|
||||||
|
const cells = row
|
||||||
|
.map(cell => {
|
||||||
|
if (typeof cell === 'string') {
|
||||||
|
return this.wrap('td', cell);
|
||||||
|
}
|
||||||
|
const { header, data, colspan, rowspan } = cell;
|
||||||
|
const tag = header ? 'th' : 'td';
|
||||||
|
const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan }));
|
||||||
|
return this.wrap(tag, data, attrs);
|
||||||
|
})
|
||||||
|
.join('');
|
||||||
|
return this.wrap('tr', cells);
|
||||||
|
})
|
||||||
|
.join('');
|
||||||
|
const element = this.wrap('table', tableBody);
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds a collapsable HTML details element to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} label text for the closed state
|
||||||
|
* @param {string} content collapsable content
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addDetails(label, content) {
|
||||||
|
const element = this.wrap('details', this.wrap('summary', label) + content);
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML image tag to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} src path to the image you to embed
|
||||||
|
* @param {string} alt text description of the image
|
||||||
|
* @param {SummaryImageOptions} options (optional) addition image attributes
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addImage(src, alt, options) {
|
||||||
|
const { width, height } = options || {};
|
||||||
|
const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height }));
|
||||||
|
const element = this.wrap('img', null, Object.assign({ src, alt }, attrs));
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML section heading element
|
||||||
|
*
|
||||||
|
* @param {string} text heading text
|
||||||
|
* @param {number | string} [level=1] (optional) the heading level, default: 1
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addHeading(text, level) {
|
||||||
|
const tag = `h${level}`;
|
||||||
|
const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag)
|
||||||
|
? tag
|
||||||
|
: 'h1';
|
||||||
|
const element = this.wrap(allowedTag, text);
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML thematic break (<hr>) to the summary buffer
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addSeparator() {
|
||||||
|
const element = this.wrap('hr', null);
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML line break (<br>) to the summary buffer
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addBreak() {
|
||||||
|
const element = this.wrap('br', null);
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML blockquote to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} text quote text
|
||||||
|
* @param {string} cite (optional) citation url
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addQuote(text, cite) {
|
||||||
|
const attrs = Object.assign({}, (cite && { cite }));
|
||||||
|
const element = this.wrap('blockquote', text, attrs);
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML anchor tag to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} text link text/content
|
||||||
|
* @param {string} href hyperlink
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addLink(text, href) {
|
||||||
|
const element = this.wrap('a', text, { href });
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const _summary = new Summary();
|
||||||
|
/**
|
||||||
|
* @deprecated use `core.summary`
|
||||||
|
*/
|
||||||
|
exports.markdownSummary = _summary;
|
||||||
|
exports.summary = _summary;
|
||||||
|
//# sourceMappingURL=summary.js.map
|
1
node_modules/@actions/core/lib/summary.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/summary.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
node_modules/@actions/core/package.json
generated
vendored
4
node_modules/@actions/core/package.json
generated
vendored
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/core",
|
"name": "@actions/core",
|
||||||
"version": "1.6.0",
|
"version": "1.9.0",
|
||||||
"description": "Actions core lib",
|
"description": "Actions core lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"github",
|
"github",
|
||||||
@ -36,7 +36,7 @@
|
|||||||
"url": "https://github.com/actions/toolkit/issues"
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/http-client": "^1.0.11"
|
"@actions/http-client": "^2.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^12.0.2"
|
"@types/node": "^12.0.2"
|
||||||
|
4
node_modules/@actions/github/package.json
generated
vendored
4
node_modules/@actions/github/package.json
generated
vendored
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/github",
|
"name": "@actions/github",
|
||||||
"version": "5.0.1",
|
"version": "5.0.3",
|
||||||
"description": "Actions github lib",
|
"description": "Actions github lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"github",
|
"github",
|
||||||
@ -38,7 +38,7 @@
|
|||||||
"url": "https://github.com/actions/toolkit/issues"
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/http-client": "^1.0.11",
|
"@actions/http-client": "^2.0.1",
|
||||||
"@octokit/core": "^3.6.0",
|
"@octokit/core": "^3.6.0",
|
||||||
"@octokit/plugin-paginate-rest": "^2.17.0",
|
"@octokit/plugin-paginate-rest": "^2.17.0",
|
||||||
"@octokit/plugin-rest-endpoint-methods": "^5.13.0"
|
"@octokit/plugin-rest-endpoint-methods": "^5.13.0"
|
||||||
|
32
node_modules/@actions/http-client/README.md
generated
vendored
32
node_modules/@actions/http-client/README.md
generated
vendored
@ -1,18 +1,11 @@
|
|||||||
|
# `@actions/http-client`
|
||||||
|
|
||||||
<p align="center">
|
A lightweight HTTP client optimized for building actions.
|
||||||
<img src="actions.png">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
# Actions Http-Client
|
|
||||||
|
|
||||||
[![Http Status](https://github.com/actions/http-client/workflows/http-tests/badge.svg)](https://github.com/actions/http-client/actions)
|
|
||||||
|
|
||||||
A lightweight HTTP client optimized for use with actions, TypeScript with generics and async await.
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- HTTP client with TypeScript generics and async/await/Promises
|
- HTTP client with TypeScript generics and async/await/Promises
|
||||||
- Typings included so no need to acquire separately (great for intellisense and no versioning drift)
|
- Typings included!
|
||||||
- [Proxy support](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners#using-a-proxy-server-with-self-hosted-runners) just works with actions and the runner
|
- [Proxy support](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners#using-a-proxy-server-with-self-hosted-runners) just works with actions and the runner
|
||||||
- Targets ES2019 (runner runs actions with node 12+). Only supported on node 12+.
|
- Targets ES2019 (runner runs actions with node 12+). Only supported on node 12+.
|
||||||
- Basic, Bearer and PAT Support out of the box. Extensible handlers for others.
|
- Basic, Bearer and PAT Support out of the box. Extensible handlers for others.
|
||||||
@ -28,7 +21,7 @@ npm install @actions/http-client --save
|
|||||||
|
|
||||||
## Samples
|
## Samples
|
||||||
|
|
||||||
See the [HTTP](./__tests__) tests for detailed examples.
|
See the [tests](./__tests__) for detailed examples.
|
||||||
|
|
||||||
## Errors
|
## Errors
|
||||||
|
|
||||||
@ -39,13 +32,13 @@ The HTTP client does not throw unless truly exceptional.
|
|||||||
* A request that successfully executes resulting in a 404, 500 etc... will return a response object with a status code and a body.
|
* A request that successfully executes resulting in a 404, 500 etc... will return a response object with a status code and a body.
|
||||||
* Redirects (3xx) will be followed by default.
|
* Redirects (3xx) will be followed by default.
|
||||||
|
|
||||||
See [HTTP tests](./__tests__) for detailed examples.
|
See the [tests](./__tests__) for detailed examples.
|
||||||
|
|
||||||
## Debugging
|
## Debugging
|
||||||
|
|
||||||
To enable detailed console logging of all HTTP requests and responses, set the NODE_DEBUG environment varible:
|
To enable detailed console logging of all HTTP requests and responses, set the NODE_DEBUG environment varible:
|
||||||
|
|
||||||
```
|
```shell
|
||||||
export NODE_DEBUG=http
|
export NODE_DEBUG=http
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -63,17 +56,18 @@ We welcome PRs. Please create an issue and if applicable, a design before proce
|
|||||||
|
|
||||||
once:
|
once:
|
||||||
|
|
||||||
```bash
|
```
|
||||||
$ npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
To build:
|
To build:
|
||||||
|
|
||||||
```bash
|
```
|
||||||
$ npm run build
|
npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
To run all tests:
|
To run all tests:
|
||||||
```bash
|
|
||||||
$ npm test
|
```
|
||||||
|
npm test
|
||||||
```
|
```
|
||||||
|
26
node_modules/@actions/http-client/RELEASES.md
generated
vendored
26
node_modules/@actions/http-client/RELEASES.md
generated
vendored
@ -1,26 +0,0 @@
|
|||||||
## Releases
|
|
||||||
|
|
||||||
## 1.0.10
|
|
||||||
|
|
||||||
Contains a bug fix where proxy is defined without a user and password. see [PR here](https://github.com/actions/http-client/pull/42)
|
|
||||||
|
|
||||||
## 1.0.9
|
|
||||||
Throw HttpClientError instead of a generic Error from the \<verb>Json() helper methods when the server responds with a non-successful status code.
|
|
||||||
|
|
||||||
## 1.0.8
|
|
||||||
Fixed security issue where a redirect (e.g. 302) to another domain would pass headers. The fix was to strip the authorization header if the hostname was different. More [details in PR #27](https://github.com/actions/http-client/pull/27)
|
|
||||||
|
|
||||||
## 1.0.7
|
|
||||||
Update NPM dependencies and add 429 to the list of HttpCodes
|
|
||||||
|
|
||||||
## 1.0.6
|
|
||||||
Automatically sends Content-Type and Accept application/json headers for \<verb>Json() helper methods if not set in the client or parameters.
|
|
||||||
|
|
||||||
## 1.0.5
|
|
||||||
Adds \<verb>Json() helper methods for json over http scenarios.
|
|
||||||
|
|
||||||
## 1.0.4
|
|
||||||
Started to add \<verb>Json() helper methods. Do not use this release for that. Use >= 1.0.5 since there was an issue with types.
|
|
||||||
|
|
||||||
## 1.0.1 to 1.0.3
|
|
||||||
Adds proxy support.
|
|
BIN
node_modules/@actions/http-client/actions.png
generated
vendored
BIN
node_modules/@actions/http-client/actions.png
generated
vendored
Binary file not shown.
Before Width: | Height: | Size: 33 KiB |
23
node_modules/@actions/http-client/auth.d.ts
generated
vendored
23
node_modules/@actions/http-client/auth.d.ts
generated
vendored
@ -1,23 +0,0 @@
|
|||||||
import ifm = require('./interfaces');
|
|
||||||
export declare class BasicCredentialHandler implements ifm.IRequestHandler {
|
|
||||||
username: string;
|
|
||||||
password: string;
|
|
||||||
constructor(username: string, password: string);
|
|
||||||
prepareRequest(options: any): void;
|
|
||||||
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
|
||||||
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
|
||||||
}
|
|
||||||
export declare class BearerCredentialHandler implements ifm.IRequestHandler {
|
|
||||||
token: string;
|
|
||||||
constructor(token: string);
|
|
||||||
prepareRequest(options: any): void;
|
|
||||||
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
|
||||||
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
|
||||||
}
|
|
||||||
export declare class PersonalAccessTokenCredentialHandler implements ifm.IRequestHandler {
|
|
||||||
token: string;
|
|
||||||
constructor(token: string);
|
|
||||||
prepareRequest(options: any): void;
|
|
||||||
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
|
||||||
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
|
||||||
}
|
|
58
node_modules/@actions/http-client/auth.js
generated
vendored
58
node_modules/@actions/http-client/auth.js
generated
vendored
@ -1,58 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
class BasicCredentialHandler {
|
|
||||||
constructor(username, password) {
|
|
||||||
this.username = username;
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
prepareRequest(options) {
|
|
||||||
options.headers['Authorization'] =
|
|
||||||
'Basic ' +
|
|
||||||
Buffer.from(this.username + ':' + this.password).toString('base64');
|
|
||||||
}
|
|
||||||
// This handler cannot handle 401
|
|
||||||
canHandleAuthentication(response) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
handleAuthentication(httpClient, requestInfo, objs) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.BasicCredentialHandler = BasicCredentialHandler;
|
|
||||||
class BearerCredentialHandler {
|
|
||||||
constructor(token) {
|
|
||||||
this.token = token;
|
|
||||||
}
|
|
||||||
// currently implements pre-authorization
|
|
||||||
// TODO: support preAuth = false where it hooks on 401
|
|
||||||
prepareRequest(options) {
|
|
||||||
options.headers['Authorization'] = 'Bearer ' + this.token;
|
|
||||||
}
|
|
||||||
// This handler cannot handle 401
|
|
||||||
canHandleAuthentication(response) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
handleAuthentication(httpClient, requestInfo, objs) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.BearerCredentialHandler = BearerCredentialHandler;
|
|
||||||
class PersonalAccessTokenCredentialHandler {
|
|
||||||
constructor(token) {
|
|
||||||
this.token = token;
|
|
||||||
}
|
|
||||||
// currently implements pre-authorization
|
|
||||||
// TODO: support preAuth = false where it hooks on 401
|
|
||||||
prepareRequest(options) {
|
|
||||||
options.headers['Authorization'] =
|
|
||||||
'Basic ' + Buffer.from('PAT:' + this.token).toString('base64');
|
|
||||||
}
|
|
||||||
// This handler cannot handle 401
|
|
||||||
canHandleAuthentication(response) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
handleAuthentication(httpClient, requestInfo, objs) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
|
|
537
node_modules/@actions/http-client/index.js
generated
vendored
537
node_modules/@actions/http-client/index.js
generated
vendored
@ -1,537 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const http = require("http");
|
|
||||||
const https = require("https");
|
|
||||||
const pm = require("./proxy");
|
|
||||||
let tunnel;
|
|
||||||
var HttpCodes;
|
|
||||||
(function (HttpCodes) {
|
|
||||||
HttpCodes[HttpCodes["OK"] = 200] = "OK";
|
|
||||||
HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
|
|
||||||
HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
|
|
||||||
HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
|
|
||||||
HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
|
|
||||||
HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
|
|
||||||
HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
|
|
||||||
HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
|
|
||||||
HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
|
||||||
HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
|
|
||||||
HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
|
|
||||||
HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
|
|
||||||
HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
|
|
||||||
HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
|
|
||||||
HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
|
|
||||||
HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
|
||||||
HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
|
|
||||||
HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
|
||||||
HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
|
|
||||||
HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
|
|
||||||
HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
|
|
||||||
HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
|
|
||||||
HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
|
|
||||||
HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
|
|
||||||
HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
|
|
||||||
HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
|
||||||
HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
||||||
})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {}));
|
|
||||||
var Headers;
|
|
||||||
(function (Headers) {
|
|
||||||
Headers["Accept"] = "accept";
|
|
||||||
Headers["ContentType"] = "content-type";
|
|
||||||
})(Headers = exports.Headers || (exports.Headers = {}));
|
|
||||||
var MediaTypes;
|
|
||||||
(function (MediaTypes) {
|
|
||||||
MediaTypes["ApplicationJson"] = "application/json";
|
|
||||||
})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {}));
|
|
||||||
/**
|
|
||||||
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
|
||||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
|
||||||
*/
|
|
||||||
function getProxyUrl(serverUrl) {
|
|
||||||
let proxyUrl = pm.getProxyUrl(new URL(serverUrl));
|
|
||||||
return proxyUrl ? proxyUrl.href : '';
|
|
||||||
}
|
|
||||||
exports.getProxyUrl = getProxyUrl;
|
|
||||||
const HttpRedirectCodes = [
|
|
||||||
HttpCodes.MovedPermanently,
|
|
||||||
HttpCodes.ResourceMoved,
|
|
||||||
HttpCodes.SeeOther,
|
|
||||||
HttpCodes.TemporaryRedirect,
|
|
||||||
HttpCodes.PermanentRedirect
|
|
||||||
];
|
|
||||||
const HttpResponseRetryCodes = [
|
|
||||||
HttpCodes.BadGateway,
|
|
||||||
HttpCodes.ServiceUnavailable,
|
|
||||||
HttpCodes.GatewayTimeout
|
|
||||||
];
|
|
||||||
const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
|
|
||||||
const ExponentialBackoffCeiling = 10;
|
|
||||||
const ExponentialBackoffTimeSlice = 5;
|
|
||||||
class HttpClientError extends Error {
|
|
||||||
constructor(message, statusCode) {
|
|
||||||
super(message);
|
|
||||||
this.name = 'HttpClientError';
|
|
||||||
this.statusCode = statusCode;
|
|
||||||
Object.setPrototypeOf(this, HttpClientError.prototype);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.HttpClientError = HttpClientError;
|
|
||||||
class HttpClientResponse {
|
|
||||||
constructor(message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
readBody() {
|
|
||||||
return new Promise(async (resolve, reject) => {
|
|
||||||
let output = Buffer.alloc(0);
|
|
||||||
this.message.on('data', (chunk) => {
|
|
||||||
output = Buffer.concat([output, chunk]);
|
|
||||||
});
|
|
||||||
this.message.on('end', () => {
|
|
||||||
resolve(output.toString());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.HttpClientResponse = HttpClientResponse;
|
|
||||||
function isHttps(requestUrl) {
|
|
||||||
let parsedUrl = new URL(requestUrl);
|
|
||||||
return parsedUrl.protocol === 'https:';
|
|
||||||
}
|
|
||||||
exports.isHttps = isHttps;
|
|
||||||
class HttpClient {
|
|
||||||
constructor(userAgent, handlers, requestOptions) {
|
|
||||||
this._ignoreSslError = false;
|
|
||||||
this._allowRedirects = true;
|
|
||||||
this._allowRedirectDowngrade = false;
|
|
||||||
this._maxRedirects = 50;
|
|
||||||
this._allowRetries = false;
|
|
||||||
this._maxRetries = 1;
|
|
||||||
this._keepAlive = false;
|
|
||||||
this._disposed = false;
|
|
||||||
this.userAgent = userAgent;
|
|
||||||
this.handlers = handlers || [];
|
|
||||||
this.requestOptions = requestOptions;
|
|
||||||
if (requestOptions) {
|
|
||||||
if (requestOptions.ignoreSslError != null) {
|
|
||||||
this._ignoreSslError = requestOptions.ignoreSslError;
|
|
||||||
}
|
|
||||||
this._socketTimeout = requestOptions.socketTimeout;
|
|
||||||
if (requestOptions.allowRedirects != null) {
|
|
||||||
this._allowRedirects = requestOptions.allowRedirects;
|
|
||||||
}
|
|
||||||
if (requestOptions.allowRedirectDowngrade != null) {
|
|
||||||
this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
|
|
||||||
}
|
|
||||||
if (requestOptions.maxRedirects != null) {
|
|
||||||
this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
|
|
||||||
}
|
|
||||||
if (requestOptions.keepAlive != null) {
|
|
||||||
this._keepAlive = requestOptions.keepAlive;
|
|
||||||
}
|
|
||||||
if (requestOptions.allowRetries != null) {
|
|
||||||
this._allowRetries = requestOptions.allowRetries;
|
|
||||||
}
|
|
||||||
if (requestOptions.maxRetries != null) {
|
|
||||||
this._maxRetries = requestOptions.maxRetries;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
options(requestUrl, additionalHeaders) {
|
|
||||||
return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
get(requestUrl, additionalHeaders) {
|
|
||||||
return this.request('GET', requestUrl, null, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
del(requestUrl, additionalHeaders) {
|
|
||||||
return this.request('DELETE', requestUrl, null, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
post(requestUrl, data, additionalHeaders) {
|
|
||||||
return this.request('POST', requestUrl, data, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
patch(requestUrl, data, additionalHeaders) {
|
|
||||||
return this.request('PATCH', requestUrl, data, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
put(requestUrl, data, additionalHeaders) {
|
|
||||||
return this.request('PUT', requestUrl, data, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
head(requestUrl, additionalHeaders) {
|
|
||||||
return this.request('HEAD', requestUrl, null, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
sendStream(verb, requestUrl, stream, additionalHeaders) {
|
|
||||||
return this.request(verb, requestUrl, stream, additionalHeaders);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Gets a typed object from an endpoint
|
|
||||||
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
|
||||||
*/
|
|
||||||
async getJson(requestUrl, additionalHeaders = {}) {
|
|
||||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|
||||||
let res = await this.get(requestUrl, additionalHeaders);
|
|
||||||
return this._processResponse(res, this.requestOptions);
|
|
||||||
}
|
|
||||||
async postJson(requestUrl, obj, additionalHeaders = {}) {
|
|
||||||
let data = JSON.stringify(obj, null, 2);
|
|
||||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|
||||||
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
|
||||||
let res = await this.post(requestUrl, data, additionalHeaders);
|
|
||||||
return this._processResponse(res, this.requestOptions);
|
|
||||||
}
|
|
||||||
async putJson(requestUrl, obj, additionalHeaders = {}) {
|
|
||||||
let data = JSON.stringify(obj, null, 2);
|
|
||||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|
||||||
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
|
||||||
let res = await this.put(requestUrl, data, additionalHeaders);
|
|
||||||
return this._processResponse(res, this.requestOptions);
|
|
||||||
}
|
|
||||||
async patchJson(requestUrl, obj, additionalHeaders = {}) {
|
|
||||||
let data = JSON.stringify(obj, null, 2);
|
|
||||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|
||||||
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
|
||||||
let res = await this.patch(requestUrl, data, additionalHeaders);
|
|
||||||
return this._processResponse(res, this.requestOptions);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Makes a raw http request.
|
|
||||||
* All other methods such as get, post, patch, and request ultimately call this.
|
|
||||||
* Prefer get, del, post and patch
|
|
||||||
*/
|
|
||||||
async request(verb, requestUrl, data, headers) {
|
|
||||||
if (this._disposed) {
|
|
||||||
throw new Error('Client has already been disposed.');
|
|
||||||
}
|
|
||||||
let parsedUrl = new URL(requestUrl);
|
|
||||||
let info = this._prepareRequest(verb, parsedUrl, headers);
|
|
||||||
// Only perform retries on reads since writes may not be idempotent.
|
|
||||||
let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1
|
|
||||||
? this._maxRetries + 1
|
|
||||||
: 1;
|
|
||||||
let numTries = 0;
|
|
||||||
let response;
|
|
||||||
while (numTries < maxTries) {
|
|
||||||
response = await this.requestRaw(info, data);
|
|
||||||
// Check if it's an authentication challenge
|
|
||||||
if (response &&
|
|
||||||
response.message &&
|
|
||||||
response.message.statusCode === HttpCodes.Unauthorized) {
|
|
||||||
let authenticationHandler;
|
|
||||||
for (let i = 0; i < this.handlers.length; i++) {
|
|
||||||
if (this.handlers[i].canHandleAuthentication(response)) {
|
|
||||||
authenticationHandler = this.handlers[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (authenticationHandler) {
|
|
||||||
return authenticationHandler.handleAuthentication(this, info, data);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// We have received an unauthorized response but have no handlers to handle it.
|
|
||||||
// Let the response return to the caller.
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let redirectsRemaining = this._maxRedirects;
|
|
||||||
while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&
|
|
||||||
this._allowRedirects &&
|
|
||||||
redirectsRemaining > 0) {
|
|
||||||
const redirectUrl = response.message.headers['location'];
|
|
||||||
if (!redirectUrl) {
|
|
||||||
// if there's no location to redirect to, we won't
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
let parsedRedirectUrl = new URL(redirectUrl);
|
|
||||||
if (parsedUrl.protocol == 'https:' &&
|
|
||||||
parsedUrl.protocol != parsedRedirectUrl.protocol &&
|
|
||||||
!this._allowRedirectDowngrade) {
|
|
||||||
throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
|
|
||||||
}
|
|
||||||
// we need to finish reading the response before reassigning response
|
|
||||||
// which will leak the open socket.
|
|
||||||
await response.readBody();
|
|
||||||
// strip authorization header if redirected to a different hostname
|
|
||||||
if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
|
|
||||||
for (let header in headers) {
|
|
||||||
// header names are case insensitive
|
|
||||||
if (header.toLowerCase() === 'authorization') {
|
|
||||||
delete headers[header];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// let's make the request with the new redirectUrl
|
|
||||||
info = this._prepareRequest(verb, parsedRedirectUrl, headers);
|
|
||||||
response = await this.requestRaw(info, data);
|
|
||||||
redirectsRemaining--;
|
|
||||||
}
|
|
||||||
if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {
|
|
||||||
// If not a retry code, return immediately instead of retrying
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
numTries += 1;
|
|
||||||
if (numTries < maxTries) {
|
|
||||||
await response.readBody();
|
|
||||||
await this._performExponentialBackoff(numTries);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Needs to be called if keepAlive is set to true in request options.
|
|
||||||
*/
|
|
||||||
dispose() {
|
|
||||||
if (this._agent) {
|
|
||||||
this._agent.destroy();
|
|
||||||
}
|
|
||||||
this._disposed = true;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Raw request.
|
|
||||||
* @param info
|
|
||||||
* @param data
|
|
||||||
*/
|
|
||||||
requestRaw(info, data) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
let callbackForResult = function (err, res) {
|
|
||||||
if (err) {
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
resolve(res);
|
|
||||||
};
|
|
||||||
this.requestRawWithCallback(info, data, callbackForResult);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Raw request with callback.
|
|
||||||
* @param info
|
|
||||||
* @param data
|
|
||||||
* @param onResult
|
|
||||||
*/
|
|
||||||
requestRawWithCallback(info, data, onResult) {
|
|
||||||
let socket;
|
|
||||||
if (typeof data === 'string') {
|
|
||||||
info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
|
|
||||||
}
|
|
||||||
let callbackCalled = false;
|
|
||||||
let handleResult = (err, res) => {
|
|
||||||
if (!callbackCalled) {
|
|
||||||
callbackCalled = true;
|
|
||||||
onResult(err, res);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let req = info.httpModule.request(info.options, (msg) => {
|
|
||||||
let res = new HttpClientResponse(msg);
|
|
||||||
handleResult(null, res);
|
|
||||||
});
|
|
||||||
req.on('socket', sock => {
|
|
||||||
socket = sock;
|
|
||||||
});
|
|
||||||
// If we ever get disconnected, we want the socket to timeout eventually
|
|
||||||
req.setTimeout(this._socketTimeout || 3 * 60000, () => {
|
|
||||||
if (socket) {
|
|
||||||
socket.end();
|
|
||||||
}
|
|
||||||
handleResult(new Error('Request timeout: ' + info.options.path), null);
|
|
||||||
});
|
|
||||||
req.on('error', function (err) {
|
|
||||||
// err has statusCode property
|
|
||||||
// res should have headers
|
|
||||||
handleResult(err, null);
|
|
||||||
});
|
|
||||||
if (data && typeof data === 'string') {
|
|
||||||
req.write(data, 'utf8');
|
|
||||||
}
|
|
||||||
if (data && typeof data !== 'string') {
|
|
||||||
data.on('close', function () {
|
|
||||||
req.end();
|
|
||||||
});
|
|
||||||
data.pipe(req);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
req.end();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Gets an http agent. This function is useful when you need an http agent that handles
|
|
||||||
* routing through a proxy server - depending upon the url and proxy environment variables.
|
|
||||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
|
||||||
*/
|
|
||||||
getAgent(serverUrl) {
|
|
||||||
let parsedUrl = new URL(serverUrl);
|
|
||||||
return this._getAgent(parsedUrl);
|
|
||||||
}
|
|
||||||
_prepareRequest(method, requestUrl, headers) {
|
|
||||||
const info = {};
|
|
||||||
info.parsedUrl = requestUrl;
|
|
||||||
const usingSsl = info.parsedUrl.protocol === 'https:';
|
|
||||||
info.httpModule = usingSsl ? https : http;
|
|
||||||
const defaultPort = usingSsl ? 443 : 80;
|
|
||||||
info.options = {};
|
|
||||||
info.options.host = info.parsedUrl.hostname;
|
|
||||||
info.options.port = info.parsedUrl.port
|
|
||||||
? parseInt(info.parsedUrl.port)
|
|
||||||
: defaultPort;
|
|
||||||
info.options.path =
|
|
||||||
(info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
|
|
||||||
info.options.method = method;
|
|
||||||
info.options.headers = this._mergeHeaders(headers);
|
|
||||||
if (this.userAgent != null) {
|
|
||||||
info.options.headers['user-agent'] = this.userAgent;
|
|
||||||
}
|
|
||||||
info.options.agent = this._getAgent(info.parsedUrl);
|
|
||||||
// gives handlers an opportunity to participate
|
|
||||||
if (this.handlers) {
|
|
||||||
this.handlers.forEach(handler => {
|
|
||||||
handler.prepareRequest(info.options);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
_mergeHeaders(headers) {
|
|
||||||
const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
|
|
||||||
if (this.requestOptions && this.requestOptions.headers) {
|
|
||||||
return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers));
|
|
||||||
}
|
|
||||||
return lowercaseKeys(headers || {});
|
|
||||||
}
|
|
||||||
_getExistingOrDefaultHeader(additionalHeaders, header, _default) {
|
|
||||||
const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
|
|
||||||
let clientHeader;
|
|
||||||
if (this.requestOptions && this.requestOptions.headers) {
|
|
||||||
clientHeader = lowercaseKeys(this.requestOptions.headers)[header];
|
|
||||||
}
|
|
||||||
return additionalHeaders[header] || clientHeader || _default;
|
|
||||||
}
|
|
||||||
_getAgent(parsedUrl) {
|
|
||||||
let agent;
|
|
||||||
let proxyUrl = pm.getProxyUrl(parsedUrl);
|
|
||||||
let useProxy = proxyUrl && proxyUrl.hostname;
|
|
||||||
if (this._keepAlive && useProxy) {
|
|
||||||
agent = this._proxyAgent;
|
|
||||||
}
|
|
||||||
if (this._keepAlive && !useProxy) {
|
|
||||||
agent = this._agent;
|
|
||||||
}
|
|
||||||
// if agent is already assigned use that agent.
|
|
||||||
if (!!agent) {
|
|
||||||
return agent;
|
|
||||||
}
|
|
||||||
const usingSsl = parsedUrl.protocol === 'https:';
|
|
||||||
let maxSockets = 100;
|
|
||||||
if (!!this.requestOptions) {
|
|
||||||
maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
|
|
||||||
}
|
|
||||||
if (useProxy) {
|
|
||||||
// If using proxy, need tunnel
|
|
||||||
if (!tunnel) {
|
|
||||||
tunnel = require('tunnel');
|
|
||||||
}
|
|
||||||
const agentOptions = {
|
|
||||||
maxSockets: maxSockets,
|
|
||||||
keepAlive: this._keepAlive,
|
|
||||||
proxy: {
|
|
||||||
...((proxyUrl.username || proxyUrl.password) && {
|
|
||||||
proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
|
|
||||||
}),
|
|
||||||
host: proxyUrl.hostname,
|
|
||||||
port: proxyUrl.port
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let tunnelAgent;
|
|
||||||
const overHttps = proxyUrl.protocol === 'https:';
|
|
||||||
if (usingSsl) {
|
|
||||||
tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
|
|
||||||
}
|
|
||||||
agent = tunnelAgent(agentOptions);
|
|
||||||
this._proxyAgent = agent;
|
|
||||||
}
|
|
||||||
// if reusing agent across request and tunneling agent isn't assigned create a new agent
|
|
||||||
if (this._keepAlive && !agent) {
|
|
||||||
const options = { keepAlive: this._keepAlive, maxSockets: maxSockets };
|
|
||||||
agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
|
|
||||||
this._agent = agent;
|
|
||||||
}
|
|
||||||
// if not using private agent and tunnel agent isn't setup then use global agent
|
|
||||||
if (!agent) {
|
|
||||||
agent = usingSsl ? https.globalAgent : http.globalAgent;
|
|
||||||
}
|
|
||||||
if (usingSsl && this._ignoreSslError) {
|
|
||||||
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
|
|
||||||
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
|
|
||||||
// we have to cast it to any and change it directly
|
|
||||||
agent.options = Object.assign(agent.options || {}, {
|
|
||||||
rejectUnauthorized: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return agent;
|
|
||||||
}
|
|
||||||
_performExponentialBackoff(retryNumber) {
|
|
||||||
retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
|
|
||||||
const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
|
|
||||||
return new Promise(resolve => setTimeout(() => resolve(), ms));
|
|
||||||
}
|
|
||||||
static dateTimeDeserializer(key, value) {
|
|
||||||
if (typeof value === 'string') {
|
|
||||||
let a = new Date(value);
|
|
||||||
if (!isNaN(a.valueOf())) {
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
async _processResponse(res, options) {
|
|
||||||
return new Promise(async (resolve, reject) => {
|
|
||||||
const statusCode = res.message.statusCode;
|
|
||||||
const response = {
|
|
||||||
statusCode: statusCode,
|
|
||||||
result: null,
|
|
||||||
headers: {}
|
|
||||||
};
|
|
||||||
// not found leads to null obj returned
|
|
||||||
if (statusCode == HttpCodes.NotFound) {
|
|
||||||
resolve(response);
|
|
||||||
}
|
|
||||||
let obj;
|
|
||||||
let contents;
|
|
||||||
// get the result from the body
|
|
||||||
try {
|
|
||||||
contents = await res.readBody();
|
|
||||||
if (contents && contents.length > 0) {
|
|
||||||
if (options && options.deserializeDates) {
|
|
||||||
obj = JSON.parse(contents, HttpClient.dateTimeDeserializer);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
obj = JSON.parse(contents);
|
|
||||||
}
|
|
||||||
response.result = obj;
|
|
||||||
}
|
|
||||||
response.headers = res.message.headers;
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// Invalid resource (contents not json); leaving result obj null
|
|
||||||
}
|
|
||||||
// note that 3xx redirects are handled by the http layer.
|
|
||||||
if (statusCode > 299) {
|
|
||||||
let msg;
|
|
||||||
// if exception/error in body, attempt to get better error
|
|
||||||
if (obj && obj.message) {
|
|
||||||
msg = obj.message;
|
|
||||||
}
|
|
||||||
else if (contents && contents.length > 0) {
|
|
||||||
// it may be the case that the exception is in the body message as string
|
|
||||||
msg = contents;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
msg = 'Failed request: (' + statusCode + ')';
|
|
||||||
}
|
|
||||||
let err = new HttpClientError(msg, statusCode);
|
|
||||||
err.result = response.result;
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
resolve(response);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.HttpClient = HttpClient;
|
|
49
node_modules/@actions/http-client/interfaces.d.ts
generated
vendored
49
node_modules/@actions/http-client/interfaces.d.ts
generated
vendored
@ -1,49 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import http = require('http');
|
|
||||||
export interface IHeaders {
|
|
||||||
[key: string]: any;
|
|
||||||
}
|
|
||||||
export interface IHttpClient {
|
|
||||||
options(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
get(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
del(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
post(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
patch(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
put(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
requestRaw(info: IRequestInfo, data: string | NodeJS.ReadableStream): Promise<IHttpClientResponse>;
|
|
||||||
requestRawWithCallback(info: IRequestInfo, data: string | NodeJS.ReadableStream, onResult: (err: any, res: IHttpClientResponse) => void): void;
|
|
||||||
}
|
|
||||||
export interface IRequestHandler {
|
|
||||||
prepareRequest(options: http.RequestOptions): void;
|
|
||||||
canHandleAuthentication(response: IHttpClientResponse): boolean;
|
|
||||||
handleAuthentication(httpClient: IHttpClient, requestInfo: IRequestInfo, objs: any): Promise<IHttpClientResponse>;
|
|
||||||
}
|
|
||||||
export interface IHttpClientResponse {
|
|
||||||
message: http.IncomingMessage;
|
|
||||||
readBody(): Promise<string>;
|
|
||||||
}
|
|
||||||
export interface IRequestInfo {
|
|
||||||
options: http.RequestOptions;
|
|
||||||
parsedUrl: URL;
|
|
||||||
httpModule: any;
|
|
||||||
}
|
|
||||||
export interface IRequestOptions {
|
|
||||||
headers?: IHeaders;
|
|
||||||
socketTimeout?: number;
|
|
||||||
ignoreSslError?: boolean;
|
|
||||||
allowRedirects?: boolean;
|
|
||||||
allowRedirectDowngrade?: boolean;
|
|
||||||
maxRedirects?: number;
|
|
||||||
maxSockets?: number;
|
|
||||||
keepAlive?: boolean;
|
|
||||||
deserializeDates?: boolean;
|
|
||||||
allowRetries?: boolean;
|
|
||||||
maxRetries?: number;
|
|
||||||
}
|
|
||||||
export interface ITypedResponse<T> {
|
|
||||||
statusCode: number;
|
|
||||||
result: T | null;
|
|
||||||
headers: Object;
|
|
||||||
}
|
|
26
node_modules/@actions/http-client/lib/auth.d.ts
generated
vendored
Normal file
26
node_modules/@actions/http-client/lib/auth.d.ts
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import * as http from 'http';
|
||||||
|
import * as ifm from './interfaces';
|
||||||
|
import { HttpClientResponse } from './index';
|
||||||
|
export declare class BasicCredentialHandler implements ifm.RequestHandler {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
constructor(username: string, password: string);
|
||||||
|
prepareRequest(options: http.RequestOptions): void;
|
||||||
|
canHandleAuthentication(): boolean;
|
||||||
|
handleAuthentication(): Promise<HttpClientResponse>;
|
||||||
|
}
|
||||||
|
export declare class BearerCredentialHandler implements ifm.RequestHandler {
|
||||||
|
token: string;
|
||||||
|
constructor(token: string);
|
||||||
|
prepareRequest(options: http.RequestOptions): void;
|
||||||
|
canHandleAuthentication(): boolean;
|
||||||
|
handleAuthentication(): Promise<HttpClientResponse>;
|
||||||
|
}
|
||||||
|
export declare class PersonalAccessTokenCredentialHandler implements ifm.RequestHandler {
|
||||||
|
token: string;
|
||||||
|
constructor(token: string);
|
||||||
|
prepareRequest(options: http.RequestOptions): void;
|
||||||
|
canHandleAuthentication(): boolean;
|
||||||
|
handleAuthentication(): Promise<HttpClientResponse>;
|
||||||
|
}
|
81
node_modules/@actions/http-client/lib/auth.js
generated
vendored
Normal file
81
node_modules/@actions/http-client/lib/auth.js
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
"use strict";
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0;
|
||||||
|
class BasicCredentialHandler {
|
||||||
|
constructor(username, password) {
|
||||||
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
prepareRequest(options) {
|
||||||
|
if (!options.headers) {
|
||||||
|
throw Error('The request has no headers');
|
||||||
|
}
|
||||||
|
options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`;
|
||||||
|
}
|
||||||
|
// This handler cannot handle 401
|
||||||
|
canHandleAuthentication() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
handleAuthentication() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
throw new Error('not implemented');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.BasicCredentialHandler = BasicCredentialHandler;
|
||||||
|
class BearerCredentialHandler {
|
||||||
|
constructor(token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
// currently implements pre-authorization
|
||||||
|
// TODO: support preAuth = false where it hooks on 401
|
||||||
|
prepareRequest(options) {
|
||||||
|
if (!options.headers) {
|
||||||
|
throw Error('The request has no headers');
|
||||||
|
}
|
||||||
|
options.headers['Authorization'] = `Bearer ${this.token}`;
|
||||||
|
}
|
||||||
|
// This handler cannot handle 401
|
||||||
|
canHandleAuthentication() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
handleAuthentication() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
throw new Error('not implemented');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.BearerCredentialHandler = BearerCredentialHandler;
|
||||||
|
class PersonalAccessTokenCredentialHandler {
|
||||||
|
constructor(token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
// currently implements pre-authorization
|
||||||
|
// TODO: support preAuth = false where it hooks on 401
|
||||||
|
prepareRequest(options) {
|
||||||
|
if (!options.headers) {
|
||||||
|
throw Error('The request has no headers');
|
||||||
|
}
|
||||||
|
options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;
|
||||||
|
}
|
||||||
|
// This handler cannot handle 401
|
||||||
|
canHandleAuthentication() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
handleAuthentication() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
throw new Error('not implemented');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
|
||||||
|
//# sourceMappingURL=auth.js.map
|
1
node_modules/@actions/http-client/lib/auth.js.map
generated
vendored
Normal file
1
node_modules/@actions/http-client/lib/auth.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,MAAa,sBAAsB;IAIjC,YAAY,QAAgB,EAAE,QAAgB;QAC5C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAED,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,MAAM,CAAC,IAAI,CACrD,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CACpC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAA;IACxB,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AA1BD,wDA0BC;AAED,MAAa,uBAAuB;IAGlC,YAAY,KAAa;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,yCAAyC;IACzC,sDAAsD;IACtD,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,IAAI,CAAC,KAAK,EAAE,CAAA;IAC3D,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AAxBD,0DAwBC;AAED,MAAa,oCAAoC;IAI/C,YAAY,KAAa;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,yCAAyC;IACzC,sDAAsD;IACtD,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,MAAM,CAAC,IAAI,CACrD,OAAO,IAAI,CAAC,KAAK,EAAE,CACpB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAA;IACxB,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AA3BD,oFA2BC"}
|
@ -1,6 +1,6 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import http = require('http');
|
import * as http from 'http';
|
||||||
import ifm = require('./interfaces');
|
import * as ifm from './interfaces';
|
||||||
export declare enum HttpCodes {
|
export declare enum HttpCodes {
|
||||||
OK = 200,
|
OK = 200,
|
||||||
MultipleChoices = 300,
|
MultipleChoices = 300,
|
||||||
@ -47,7 +47,7 @@ export declare class HttpClientError extends Error {
|
|||||||
statusCode: number;
|
statusCode: number;
|
||||||
result?: any;
|
result?: any;
|
||||||
}
|
}
|
||||||
export declare class HttpClientResponse implements ifm.IHttpClientResponse {
|
export declare class HttpClientResponse {
|
||||||
constructor(message: http.IncomingMessage);
|
constructor(message: http.IncomingMessage);
|
||||||
message: http.IncomingMessage;
|
message: http.IncomingMessage;
|
||||||
readBody(): Promise<string>;
|
readBody(): Promise<string>;
|
||||||
@ -55,8 +55,8 @@ export declare class HttpClientResponse implements ifm.IHttpClientResponse {
|
|||||||
export declare function isHttps(requestUrl: string): boolean;
|
export declare function isHttps(requestUrl: string): boolean;
|
||||||
export declare class HttpClient {
|
export declare class HttpClient {
|
||||||
userAgent: string | undefined;
|
userAgent: string | undefined;
|
||||||
handlers: ifm.IRequestHandler[];
|
handlers: ifm.RequestHandler[];
|
||||||
requestOptions: ifm.IRequestOptions;
|
requestOptions: ifm.RequestOptions | undefined;
|
||||||
private _ignoreSslError;
|
private _ignoreSslError;
|
||||||
private _socketTimeout;
|
private _socketTimeout;
|
||||||
private _allowRedirects;
|
private _allowRedirects;
|
||||||
@ -68,29 +68,29 @@ export declare class HttpClient {
|
|||||||
private _proxyAgent;
|
private _proxyAgent;
|
||||||
private _keepAlive;
|
private _keepAlive;
|
||||||
private _disposed;
|
private _disposed;
|
||||||
constructor(userAgent?: string, handlers?: ifm.IRequestHandler[], requestOptions?: ifm.IRequestOptions);
|
constructor(userAgent?: string, handlers?: ifm.RequestHandler[], requestOptions?: ifm.RequestOptions);
|
||||||
options(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
options(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
get(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
get(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
del(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
del(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
post(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
post(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
patch(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
patch(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
put(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
put(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
head(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
head(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
/**
|
/**
|
||||||
* Gets a typed object from an endpoint
|
* Gets a typed object from an endpoint
|
||||||
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
||||||
*/
|
*/
|
||||||
getJson<T>(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
getJson<T>(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<ifm.TypedResponse<T>>;
|
||||||
postJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
postJson<T>(requestUrl: string, obj: any, additionalHeaders?: http.OutgoingHttpHeaders): Promise<ifm.TypedResponse<T>>;
|
||||||
putJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
putJson<T>(requestUrl: string, obj: any, additionalHeaders?: http.OutgoingHttpHeaders): Promise<ifm.TypedResponse<T>>;
|
||||||
patchJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
patchJson<T>(requestUrl: string, obj: any, additionalHeaders?: http.OutgoingHttpHeaders): Promise<ifm.TypedResponse<T>>;
|
||||||
/**
|
/**
|
||||||
* Makes a raw http request.
|
* Makes a raw http request.
|
||||||
* All other methods such as get, post, patch, and request ultimately call this.
|
* All other methods such as get, post, patch, and request ultimately call this.
|
||||||
* Prefer get, del, post and patch
|
* Prefer get, del, post and patch
|
||||||
*/
|
*/
|
||||||
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream | null, headers?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
/**
|
/**
|
||||||
* Needs to be called if keepAlive is set to true in request options.
|
* Needs to be called if keepAlive is set to true in request options.
|
||||||
*/
|
*/
|
||||||
@ -100,14 +100,14 @@ export declare class HttpClient {
|
|||||||
* @param info
|
* @param info
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
requestRaw(info: ifm.IRequestInfo, data: string | NodeJS.ReadableStream): Promise<ifm.IHttpClientResponse>;
|
requestRaw(info: ifm.RequestInfo, data: string | NodeJS.ReadableStream | null): Promise<HttpClientResponse>;
|
||||||
/**
|
/**
|
||||||
* Raw request with callback.
|
* Raw request with callback.
|
||||||
* @param info
|
* @param info
|
||||||
* @param data
|
* @param data
|
||||||
* @param onResult
|
* @param onResult
|
||||||
*/
|
*/
|
||||||
requestRawWithCallback(info: ifm.IRequestInfo, data: string | NodeJS.ReadableStream, onResult: (err: any, res: ifm.IHttpClientResponse) => void): void;
|
requestRawWithCallback(info: ifm.RequestInfo, data: string | NodeJS.ReadableStream | null, onResult: (err?: Error, res?: HttpClientResponse) => void): void;
|
||||||
/**
|
/**
|
||||||
* Gets an http agent. This function is useful when you need an http agent that handles
|
* Gets an http agent. This function is useful when you need an http agent that handles
|
||||||
* routing through a proxy server - depending upon the url and proxy environment variables.
|
* routing through a proxy server - depending upon the url and proxy environment variables.
|
||||||
@ -119,6 +119,5 @@ export declare class HttpClient {
|
|||||||
private _getExistingOrDefaultHeader;
|
private _getExistingOrDefaultHeader;
|
||||||
private _getAgent;
|
private _getAgent;
|
||||||
private _performExponentialBackoff;
|
private _performExponentialBackoff;
|
||||||
private static dateTimeDeserializer;
|
|
||||||
private _processResponse;
|
private _processResponse;
|
||||||
}
|
}
|
605
node_modules/@actions/http-client/lib/index.js
generated
vendored
Normal file
605
node_modules/@actions/http-client/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,605 @@
|
|||||||
|
"use strict";
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0;
|
||||||
|
const http = __importStar(require("http"));
|
||||||
|
const https = __importStar(require("https"));
|
||||||
|
const pm = __importStar(require("./proxy"));
|
||||||
|
const tunnel = __importStar(require("tunnel"));
|
||||||
|
var HttpCodes;
|
||||||
|
(function (HttpCodes) {
|
||||||
|
HttpCodes[HttpCodes["OK"] = 200] = "OK";
|
||||||
|
HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
|
||||||
|
HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
|
||||||
|
HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
|
||||||
|
HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
|
||||||
|
HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
|
||||||
|
HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
|
||||||
|
HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
|
||||||
|
HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
||||||
|
HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
|
||||||
|
HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
|
||||||
|
HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
|
||||||
|
HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
|
||||||
|
HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
|
||||||
|
HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
|
||||||
|
HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
||||||
|
HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
|
||||||
|
HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
||||||
|
HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
|
||||||
|
HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
|
||||||
|
HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
|
||||||
|
HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
|
||||||
|
HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
|
||||||
|
HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
|
||||||
|
HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
|
||||||
|
HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
||||||
|
HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
|
||||||
|
})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {}));
|
||||||
|
var Headers;
|
||||||
|
(function (Headers) {
|
||||||
|
Headers["Accept"] = "accept";
|
||||||
|
Headers["ContentType"] = "content-type";
|
||||||
|
})(Headers = exports.Headers || (exports.Headers = {}));
|
||||||
|
var MediaTypes;
|
||||||
|
(function (MediaTypes) {
|
||||||
|
MediaTypes["ApplicationJson"] = "application/json";
|
||||||
|
})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {}));
|
||||||
|
/**
|
||||||
|
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
||||||
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||||
|
*/
|
||||||
|
function getProxyUrl(serverUrl) {
|
||||||
|
const proxyUrl = pm.getProxyUrl(new URL(serverUrl));
|
||||||
|
return proxyUrl ? proxyUrl.href : '';
|
||||||
|
}
|
||||||
|
exports.getProxyUrl = getProxyUrl;
|
||||||
|
const HttpRedirectCodes = [
|
||||||
|
HttpCodes.MovedPermanently,
|
||||||
|
HttpCodes.ResourceMoved,
|
||||||
|
HttpCodes.SeeOther,
|
||||||
|
HttpCodes.TemporaryRedirect,
|
||||||
|
HttpCodes.PermanentRedirect
|
||||||
|
];
|
||||||
|
const HttpResponseRetryCodes = [
|
||||||
|
HttpCodes.BadGateway,
|
||||||
|
HttpCodes.ServiceUnavailable,
|
||||||
|
HttpCodes.GatewayTimeout
|
||||||
|
];
|
||||||
|
const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
|
||||||
|
const ExponentialBackoffCeiling = 10;
|
||||||
|
const ExponentialBackoffTimeSlice = 5;
|
||||||
|
class HttpClientError extends Error {
|
||||||
|
constructor(message, statusCode) {
|
||||||
|
super(message);
|
||||||
|
this.name = 'HttpClientError';
|
||||||
|
this.statusCode = statusCode;
|
||||||
|
Object.setPrototypeOf(this, HttpClientError.prototype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.HttpClientError = HttpClientError;
|
||||||
|
class HttpClientResponse {
|
||||||
|
constructor(message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
readBody() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let output = Buffer.alloc(0);
|
||||||
|
this.message.on('data', (chunk) => {
|
||||||
|
output = Buffer.concat([output, chunk]);
|
||||||
|
});
|
||||||
|
this.message.on('end', () => {
|
||||||
|
resolve(output.toString());
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.HttpClientResponse = HttpClientResponse;
|
||||||
|
function isHttps(requestUrl) {
|
||||||
|
const parsedUrl = new URL(requestUrl);
|
||||||
|
return parsedUrl.protocol === 'https:';
|
||||||
|
}
|
||||||
|
exports.isHttps = isHttps;
|
||||||
|
class HttpClient {
|
||||||
|
constructor(userAgent, handlers, requestOptions) {
|
||||||
|
this._ignoreSslError = false;
|
||||||
|
this._allowRedirects = true;
|
||||||
|
this._allowRedirectDowngrade = false;
|
||||||
|
this._maxRedirects = 50;
|
||||||
|
this._allowRetries = false;
|
||||||
|
this._maxRetries = 1;
|
||||||
|
this._keepAlive = false;
|
||||||
|
this._disposed = false;
|
||||||
|
this.userAgent = userAgent;
|
||||||
|
this.handlers = handlers || [];
|
||||||
|
this.requestOptions = requestOptions;
|
||||||
|
if (requestOptions) {
|
||||||
|
if (requestOptions.ignoreSslError != null) {
|
||||||
|
this._ignoreSslError = requestOptions.ignoreSslError;
|
||||||
|
}
|
||||||
|
this._socketTimeout = requestOptions.socketTimeout;
|
||||||
|
if (requestOptions.allowRedirects != null) {
|
||||||
|
this._allowRedirects = requestOptions.allowRedirects;
|
||||||
|
}
|
||||||
|
if (requestOptions.allowRedirectDowngrade != null) {
|
||||||
|
this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
|
||||||
|
}
|
||||||
|
if (requestOptions.maxRedirects != null) {
|
||||||
|
this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
|
||||||
|
}
|
||||||
|
if (requestOptions.keepAlive != null) {
|
||||||
|
this._keepAlive = requestOptions.keepAlive;
|
||||||
|
}
|
||||||
|
if (requestOptions.allowRetries != null) {
|
||||||
|
this._allowRetries = requestOptions.allowRetries;
|
||||||
|
}
|
||||||
|
if (requestOptions.maxRetries != null) {
|
||||||
|
this._maxRetries = requestOptions.maxRetries;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
options(requestUrl, additionalHeaders) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
get(requestUrl, additionalHeaders) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.request('GET', requestUrl, null, additionalHeaders || {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
del(requestUrl, additionalHeaders) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.request('DELETE', requestUrl, null, additionalHeaders || {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
post(requestUrl, data, additionalHeaders) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.request('POST', requestUrl, data, additionalHeaders || {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
patch(requestUrl, data, additionalHeaders) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.request('PATCH', requestUrl, data, additionalHeaders || {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
put(requestUrl, data, additionalHeaders) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.request('PUT', requestUrl, data, additionalHeaders || {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
head(requestUrl, additionalHeaders) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.request('HEAD', requestUrl, null, additionalHeaders || {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
sendStream(verb, requestUrl, stream, additionalHeaders) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.request(verb, requestUrl, stream, additionalHeaders);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets a typed object from an endpoint
|
||||||
|
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
||||||
|
*/
|
||||||
|
getJson(requestUrl, additionalHeaders = {}) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||||
|
const res = yield this.get(requestUrl, additionalHeaders);
|
||||||
|
return this._processResponse(res, this.requestOptions);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
postJson(requestUrl, obj, additionalHeaders = {}) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const data = JSON.stringify(obj, null, 2);
|
||||||
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||||
|
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
||||||
|
const res = yield this.post(requestUrl, data, additionalHeaders);
|
||||||
|
return this._processResponse(res, this.requestOptions);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
putJson(requestUrl, obj, additionalHeaders = {}) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const data = JSON.stringify(obj, null, 2);
|
||||||
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||||
|
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
||||||
|
const res = yield this.put(requestUrl, data, additionalHeaders);
|
||||||
|
return this._processResponse(res, this.requestOptions);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
patchJson(requestUrl, obj, additionalHeaders = {}) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const data = JSON.stringify(obj, null, 2);
|
||||||
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||||
|
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
||||||
|
const res = yield this.patch(requestUrl, data, additionalHeaders);
|
||||||
|
return this._processResponse(res, this.requestOptions);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Makes a raw http request.
|
||||||
|
* All other methods such as get, post, patch, and request ultimately call this.
|
||||||
|
* Prefer get, del, post and patch
|
||||||
|
*/
|
||||||
|
request(verb, requestUrl, data, headers) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (this._disposed) {
|
||||||
|
throw new Error('Client has already been disposed.');
|
||||||
|
}
|
||||||
|
const parsedUrl = new URL(requestUrl);
|
||||||
|
let info = this._prepareRequest(verb, parsedUrl, headers);
|
||||||
|
// Only perform retries on reads since writes may not be idempotent.
|
||||||
|
const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)
|
||||||
|
? this._maxRetries + 1
|
||||||
|
: 1;
|
||||||
|
let numTries = 0;
|
||||||
|
let response;
|
||||||
|
do {
|
||||||
|
response = yield this.requestRaw(info, data);
|
||||||
|
// Check if it's an authentication challenge
|
||||||
|
if (response &&
|
||||||
|
response.message &&
|
||||||
|
response.message.statusCode === HttpCodes.Unauthorized) {
|
||||||
|
let authenticationHandler;
|
||||||
|
for (const handler of this.handlers) {
|
||||||
|
if (handler.canHandleAuthentication(response)) {
|
||||||
|
authenticationHandler = handler;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (authenticationHandler) {
|
||||||
|
return authenticationHandler.handleAuthentication(this, info, data);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// We have received an unauthorized response but have no handlers to handle it.
|
||||||
|
// Let the response return to the caller.
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let redirectsRemaining = this._maxRedirects;
|
||||||
|
while (response.message.statusCode &&
|
||||||
|
HttpRedirectCodes.includes(response.message.statusCode) &&
|
||||||
|
this._allowRedirects &&
|
||||||
|
redirectsRemaining > 0) {
|
||||||
|
const redirectUrl = response.message.headers['location'];
|
||||||
|
if (!redirectUrl) {
|
||||||
|
// if there's no location to redirect to, we won't
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const parsedRedirectUrl = new URL(redirectUrl);
|
||||||
|
if (parsedUrl.protocol === 'https:' &&
|
||||||
|
parsedUrl.protocol !== parsedRedirectUrl.protocol &&
|
||||||
|
!this._allowRedirectDowngrade) {
|
||||||
|
throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
|
||||||
|
}
|
||||||
|
// we need to finish reading the response before reassigning response
|
||||||
|
// which will leak the open socket.
|
||||||
|
yield response.readBody();
|
||||||
|
// strip authorization header if redirected to a different hostname
|
||||||
|
if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
|
||||||
|
for (const header in headers) {
|
||||||
|
// header names are case insensitive
|
||||||
|
if (header.toLowerCase() === 'authorization') {
|
||||||
|
delete headers[header];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// let's make the request with the new redirectUrl
|
||||||
|
info = this._prepareRequest(verb, parsedRedirectUrl, headers);
|
||||||
|
response = yield this.requestRaw(info, data);
|
||||||
|
redirectsRemaining--;
|
||||||
|
}
|
||||||
|
if (!response.message.statusCode ||
|
||||||
|
!HttpResponseRetryCodes.includes(response.message.statusCode)) {
|
||||||
|
// If not a retry code, return immediately instead of retrying
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
numTries += 1;
|
||||||
|
if (numTries < maxTries) {
|
||||||
|
yield response.readBody();
|
||||||
|
yield this._performExponentialBackoff(numTries);
|
||||||
|
}
|
||||||
|
} while (numTries < maxTries);
|
||||||
|
return response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Needs to be called if keepAlive is set to true in request options.
|
||||||
|
*/
|
||||||
|
dispose() {
|
||||||
|
if (this._agent) {
|
||||||
|
this._agent.destroy();
|
||||||
|
}
|
||||||
|
this._disposed = true;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Raw request.
|
||||||
|
* @param info
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
requestRaw(info, data) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
function callbackForResult(err, res) {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
else if (!res) {
|
||||||
|
// If `err` is not passed, then `res` must be passed.
|
||||||
|
reject(new Error('Unknown error'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
resolve(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.requestRawWithCallback(info, data, callbackForResult);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Raw request with callback.
|
||||||
|
* @param info
|
||||||
|
* @param data
|
||||||
|
* @param onResult
|
||||||
|
*/
|
||||||
|
requestRawWithCallback(info, data, onResult) {
|
||||||
|
if (typeof data === 'string') {
|
||||||
|
if (!info.options.headers) {
|
||||||
|
info.options.headers = {};
|
||||||
|
}
|
||||||
|
info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
|
||||||
|
}
|
||||||
|
let callbackCalled = false;
|
||||||
|
function handleResult(err, res) {
|
||||||
|
if (!callbackCalled) {
|
||||||
|
callbackCalled = true;
|
||||||
|
onResult(err, res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const req = info.httpModule.request(info.options, (msg) => {
|
||||||
|
const res = new HttpClientResponse(msg);
|
||||||
|
handleResult(undefined, res);
|
||||||
|
});
|
||||||
|
let socket;
|
||||||
|
req.on('socket', sock => {
|
||||||
|
socket = sock;
|
||||||
|
});
|
||||||
|
// If we ever get disconnected, we want the socket to timeout eventually
|
||||||
|
req.setTimeout(this._socketTimeout || 3 * 60000, () => {
|
||||||
|
if (socket) {
|
||||||
|
socket.end();
|
||||||
|
}
|
||||||
|
handleResult(new Error(`Request timeout: ${info.options.path}`));
|
||||||
|
});
|
||||||
|
req.on('error', function (err) {
|
||||||
|
// err has statusCode property
|
||||||
|
// res should have headers
|
||||||
|
handleResult(err);
|
||||||
|
});
|
||||||
|
if (data && typeof data === 'string') {
|
||||||
|
req.write(data, 'utf8');
|
||||||
|
}
|
||||||
|
if (data && typeof data !== 'string') {
|
||||||
|
data.on('close', function () {
|
||||||
|
req.end();
|
||||||
|
});
|
||||||
|
data.pipe(req);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
req.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets an http agent. This function is useful when you need an http agent that handles
|
||||||
|
* routing through a proxy server - depending upon the url and proxy environment variables.
|
||||||
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||||
|
*/
|
||||||
|
getAgent(serverUrl) {
|
||||||
|
const parsedUrl = new URL(serverUrl);
|
||||||
|
return this._getAgent(parsedUrl);
|
||||||
|
}
|
||||||
|
_prepareRequest(method, requestUrl, headers) {
|
||||||
|
const info = {};
|
||||||
|
info.parsedUrl = requestUrl;
|
||||||
|
const usingSsl = info.parsedUrl.protocol === 'https:';
|
||||||
|
info.httpModule = usingSsl ? https : http;
|
||||||
|
const defaultPort = usingSsl ? 443 : 80;
|
||||||
|
info.options = {};
|
||||||
|
info.options.host = info.parsedUrl.hostname;
|
||||||
|
info.options.port = info.parsedUrl.port
|
||||||
|
? parseInt(info.parsedUrl.port)
|
||||||
|
: defaultPort;
|
||||||
|
info.options.path =
|
||||||
|
(info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
|
||||||
|
info.options.method = method;
|
||||||
|
info.options.headers = this._mergeHeaders(headers);
|
||||||
|
if (this.userAgent != null) {
|
||||||
|
info.options.headers['user-agent'] = this.userAgent;
|
||||||
|
}
|
||||||
|
info.options.agent = this._getAgent(info.parsedUrl);
|
||||||
|
// gives handlers an opportunity to participate
|
||||||
|
if (this.handlers) {
|
||||||
|
for (const handler of this.handlers) {
|
||||||
|
handler.prepareRequest(info.options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
_mergeHeaders(headers) {
|
||||||
|
if (this.requestOptions && this.requestOptions.headers) {
|
||||||
|
return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {}));
|
||||||
|
}
|
||||||
|
return lowercaseKeys(headers || {});
|
||||||
|
}
|
||||||
|
_getExistingOrDefaultHeader(additionalHeaders, header, _default) {
|
||||||
|
let clientHeader;
|
||||||
|
if (this.requestOptions && this.requestOptions.headers) {
|
||||||
|
clientHeader = lowercaseKeys(this.requestOptions.headers)[header];
|
||||||
|
}
|
||||||
|
return additionalHeaders[header] || clientHeader || _default;
|
||||||
|
}
|
||||||
|
_getAgent(parsedUrl) {
|
||||||
|
let agent;
|
||||||
|
const proxyUrl = pm.getProxyUrl(parsedUrl);
|
||||||
|
const useProxy = proxyUrl && proxyUrl.hostname;
|
||||||
|
if (this._keepAlive && useProxy) {
|
||||||
|
agent = this._proxyAgent;
|
||||||
|
}
|
||||||
|
if (this._keepAlive && !useProxy) {
|
||||||
|
agent = this._agent;
|
||||||
|
}
|
||||||
|
// if agent is already assigned use that agent.
|
||||||
|
if (agent) {
|
||||||
|
return agent;
|
||||||
|
}
|
||||||
|
const usingSsl = parsedUrl.protocol === 'https:';
|
||||||
|
let maxSockets = 100;
|
||||||
|
if (this.requestOptions) {
|
||||||
|
maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
|
||||||
|
}
|
||||||
|
// This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis.
|
||||||
|
if (proxyUrl && proxyUrl.hostname) {
|
||||||
|
const agentOptions = {
|
||||||
|
maxSockets,
|
||||||
|
keepAlive: this._keepAlive,
|
||||||
|
proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && {
|
||||||
|
proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
|
||||||
|
})), { host: proxyUrl.hostname, port: proxyUrl.port })
|
||||||
|
};
|
||||||
|
let tunnelAgent;
|
||||||
|
const overHttps = proxyUrl.protocol === 'https:';
|
||||||
|
if (usingSsl) {
|
||||||
|
tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
|
||||||
|
}
|
||||||
|
agent = tunnelAgent(agentOptions);
|
||||||
|
this._proxyAgent = agent;
|
||||||
|
}
|
||||||
|
// if reusing agent across request and tunneling agent isn't assigned create a new agent
|
||||||
|
if (this._keepAlive && !agent) {
|
||||||
|
const options = { keepAlive: this._keepAlive, maxSockets };
|
||||||
|
agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
|
||||||
|
this._agent = agent;
|
||||||
|
}
|
||||||
|
// if not using private agent and tunnel agent isn't setup then use global agent
|
||||||
|
if (!agent) {
|
||||||
|
agent = usingSsl ? https.globalAgent : http.globalAgent;
|
||||||
|
}
|
||||||
|
if (usingSsl && this._ignoreSslError) {
|
||||||
|
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
|
||||||
|
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
|
||||||
|
// we have to cast it to any and change it directly
|
||||||
|
agent.options = Object.assign(agent.options || {}, {
|
||||||
|
rejectUnauthorized: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return agent;
|
||||||
|
}
|
||||||
|
_performExponentialBackoff(retryNumber) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
|
||||||
|
const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
|
||||||
|
return new Promise(resolve => setTimeout(() => resolve(), ms));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_processResponse(res, options) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const statusCode = res.message.statusCode || 0;
|
||||||
|
const response = {
|
||||||
|
statusCode,
|
||||||
|
result: null,
|
||||||
|
headers: {}
|
||||||
|
};
|
||||||
|
// not found leads to null obj returned
|
||||||
|
if (statusCode === HttpCodes.NotFound) {
|
||||||
|
resolve(response);
|
||||||
|
}
|
||||||
|
// get the result from the body
|
||||||
|
function dateTimeDeserializer(key, value) {
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
const a = new Date(value);
|
||||||
|
if (!isNaN(a.valueOf())) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
let obj;
|
||||||
|
let contents;
|
||||||
|
try {
|
||||||
|
contents = yield res.readBody();
|
||||||
|
if (contents && contents.length > 0) {
|
||||||
|
if (options && options.deserializeDates) {
|
||||||
|
obj = JSON.parse(contents, dateTimeDeserializer);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
obj = JSON.parse(contents);
|
||||||
|
}
|
||||||
|
response.result = obj;
|
||||||
|
}
|
||||||
|
response.headers = res.message.headers;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// Invalid resource (contents not json); leaving result obj null
|
||||||
|
}
|
||||||
|
// note that 3xx redirects are handled by the http layer.
|
||||||
|
if (statusCode > 299) {
|
||||||
|
let msg;
|
||||||
|
// if exception/error in body, attempt to get better error
|
||||||
|
if (obj && obj.message) {
|
||||||
|
msg = obj.message;
|
||||||
|
}
|
||||||
|
else if (contents && contents.length > 0) {
|
||||||
|
// it may be the case that the exception is in the body message as string
|
||||||
|
msg = contents;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
msg = `Failed request: (${statusCode})`;
|
||||||
|
}
|
||||||
|
const err = new HttpClientError(msg, statusCode);
|
||||||
|
err.result = response.result;
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
resolve(response);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.HttpClient = HttpClient;
|
||||||
|
const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
|
||||||
|
//# sourceMappingURL=index.js.map
|
1
node_modules/@actions/http-client/lib/index.js.map
generated
vendored
Normal file
1
node_modules/@actions/http-client/lib/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
44
node_modules/@actions/http-client/lib/interfaces.d.ts
generated
vendored
Normal file
44
node_modules/@actions/http-client/lib/interfaces.d.ts
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import * as http from 'http';
|
||||||
|
import * as https from 'https';
|
||||||
|
import { HttpClientResponse } from './index';
|
||||||
|
export interface HttpClient {
|
||||||
|
options(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
get(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
del(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
post(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
patch(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
put(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
requestRaw(info: RequestInfo, data: string | NodeJS.ReadableStream): Promise<HttpClientResponse>;
|
||||||
|
requestRawWithCallback(info: RequestInfo, data: string | NodeJS.ReadableStream, onResult: (err?: Error, res?: HttpClientResponse) => void): void;
|
||||||
|
}
|
||||||
|
export interface RequestHandler {
|
||||||
|
prepareRequest(options: http.RequestOptions): void;
|
||||||
|
canHandleAuthentication(response: HttpClientResponse): boolean;
|
||||||
|
handleAuthentication(httpClient: HttpClient, requestInfo: RequestInfo, data: string | NodeJS.ReadableStream | null): Promise<HttpClientResponse>;
|
||||||
|
}
|
||||||
|
export interface RequestInfo {
|
||||||
|
options: http.RequestOptions;
|
||||||
|
parsedUrl: URL;
|
||||||
|
httpModule: typeof http | typeof https;
|
||||||
|
}
|
||||||
|
export interface RequestOptions {
|
||||||
|
headers?: http.OutgoingHttpHeaders;
|
||||||
|
socketTimeout?: number;
|
||||||
|
ignoreSslError?: boolean;
|
||||||
|
allowRedirects?: boolean;
|
||||||
|
allowRedirectDowngrade?: boolean;
|
||||||
|
maxRedirects?: number;
|
||||||
|
maxSockets?: number;
|
||||||
|
keepAlive?: boolean;
|
||||||
|
deserializeDates?: boolean;
|
||||||
|
allowRetries?: boolean;
|
||||||
|
maxRetries?: number;
|
||||||
|
}
|
||||||
|
export interface TypedResponse<T> {
|
||||||
|
statusCode: number;
|
||||||
|
result: T | null;
|
||||||
|
headers: http.IncomingHttpHeaders;
|
||||||
|
}
|
@ -1,2 +1,3 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
//# sourceMappingURL=interfaces.js.map
|
1
node_modules/@actions/http-client/lib/interfaces.js.map
generated
vendored
Normal file
1
node_modules/@actions/http-client/lib/interfaces.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""}
|
@ -1,29 +1,32 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.checkBypass = exports.getProxyUrl = void 0;
|
||||||
function getProxyUrl(reqUrl) {
|
function getProxyUrl(reqUrl) {
|
||||||
let usingSsl = reqUrl.protocol === 'https:';
|
const usingSsl = reqUrl.protocol === 'https:';
|
||||||
let proxyUrl;
|
|
||||||
if (checkBypass(reqUrl)) {
|
if (checkBypass(reqUrl)) {
|
||||||
return proxyUrl;
|
return undefined;
|
||||||
}
|
}
|
||||||
let proxyVar;
|
const proxyVar = (() => {
|
||||||
if (usingSsl) {
|
if (usingSsl) {
|
||||||
proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY'];
|
return process.env['https_proxy'] || process.env['HTTPS_PROXY'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return process.env['http_proxy'] || process.env['HTTP_PROXY'];
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
if (proxyVar) {
|
||||||
|
return new URL(proxyVar);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY'];
|
return undefined;
|
||||||
}
|
}
|
||||||
if (proxyVar) {
|
|
||||||
proxyUrl = new URL(proxyVar);
|
|
||||||
}
|
|
||||||
return proxyUrl;
|
|
||||||
}
|
}
|
||||||
exports.getProxyUrl = getProxyUrl;
|
exports.getProxyUrl = getProxyUrl;
|
||||||
function checkBypass(reqUrl) {
|
function checkBypass(reqUrl) {
|
||||||
if (!reqUrl.hostname) {
|
if (!reqUrl.hostname) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
|
const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
|
||||||
if (!noProxy) {
|
if (!noProxy) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -39,12 +42,12 @@ function checkBypass(reqUrl) {
|
|||||||
reqPort = 443;
|
reqPort = 443;
|
||||||
}
|
}
|
||||||
// Format the request hostname and hostname with port
|
// Format the request hostname and hostname with port
|
||||||
let upperReqHosts = [reqUrl.hostname.toUpperCase()];
|
const upperReqHosts = [reqUrl.hostname.toUpperCase()];
|
||||||
if (typeof reqPort === 'number') {
|
if (typeof reqPort === 'number') {
|
||||||
upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
|
upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
|
||||||
}
|
}
|
||||||
// Compare request host against noproxy
|
// Compare request host against noproxy
|
||||||
for (let upperNoProxyItem of noProxy
|
for (const upperNoProxyItem of noProxy
|
||||||
.split(',')
|
.split(',')
|
||||||
.map(x => x.trim().toUpperCase())
|
.map(x => x.trim().toUpperCase())
|
||||||
.filter(x => x)) {
|
.filter(x => x)) {
|
||||||
@ -55,3 +58,4 @@ function checkBypass(reqUrl) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
exports.checkBypass = checkBypass;
|
exports.checkBypass = checkBypass;
|
||||||
|
//# sourceMappingURL=proxy.js.map
|
1
node_modules/@actions/http-client/lib/proxy.js.map
generated
vendored
Normal file
1
node_modules/@actions/http-client/lib/proxy.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAC,MAAW;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAA;IAE7C,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QACvB,OAAO,SAAS,CAAA;KACjB;IAED,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE;QACrB,IAAI,QAAQ,EAAE;YACZ,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;SAChE;aAAM;YACL,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;SAC9D;IACH,CAAC,CAAC,EAAE,CAAA;IAEJ,IAAI,QAAQ,EAAE;QACZ,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAA;KACzB;SAAM;QACL,OAAO,SAAS,CAAA;KACjB;AACH,CAAC;AApBD,kCAoBC;AAED,SAAgB,WAAW,CAAC,MAAW;IACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;QACpB,OAAO,KAAK,CAAA;KACb;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAA;IACxE,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,KAAK,CAAA;KACb;IAED,6BAA6B;IAC7B,IAAI,OAA2B,CAAA;IAC/B,IAAI,MAAM,CAAC,IAAI,EAAE;QACf,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;KAC9B;SAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,EAAE;QACtC,OAAO,GAAG,EAAE,CAAA;KACb;SAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE;QACvC,OAAO,GAAG,GAAG,CAAA;KACd;IAED,qDAAqD;IACrD,MAAM,aAAa,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAA;IACrD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,aAAa,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC,CAAA;KACrD;IAED,uCAAuC;IACvC,KAAK,MAAM,gBAAgB,IAAI,OAAO;SACnC,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;SAChC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;QACjB,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,gBAAgB,CAAC,EAAE;YACnD,OAAO,IAAI,CAAA;SACZ;KACF;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AArCD,kCAqCC"}
|
59
node_modules/@actions/http-client/package.json
generated
vendored
59
node_modules/@actions/http-client/package.json
generated
vendored
@ -1,39 +1,48 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/http-client",
|
"name": "@actions/http-client",
|
||||||
"version": "1.0.11",
|
"version": "2.0.1",
|
||||||
"description": "Actions Http Client",
|
"description": "Actions Http Client",
|
||||||
"main": "index.js",
|
"keywords": [
|
||||||
"scripts": {
|
"github",
|
||||||
"build": "rm -Rf ./_out && tsc && cp package*.json ./_out && cp *.md ./_out && cp LICENSE ./_out && cp actions.png ./_out",
|
"actions",
|
||||||
"test": "jest",
|
"http"
|
||||||
"format": "prettier --write *.ts && prettier --write **/*.ts",
|
],
|
||||||
"format-check": "prettier --check *.ts && prettier --check **/*.ts",
|
"homepage": "https://github.com/actions/toolkit/tree/main/packages/http-client",
|
||||||
"audit-check": "npm audit --audit-level=moderate"
|
"license": "MIT",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"types": "lib/index.d.ts",
|
||||||
|
"directories": {
|
||||||
|
"lib": "lib",
|
||||||
|
"test": "__tests__"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib",
|
||||||
|
"!.DS_Store"
|
||||||
|
],
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/actions/http-client.git"
|
"url": "git+https://github.com/actions/toolkit.git",
|
||||||
|
"directory": "packages/http-client"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||||
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
|
"build": "tsc",
|
||||||
|
"format": "prettier --write **/*.ts",
|
||||||
|
"format-check": "prettier --check **/*.ts",
|
||||||
|
"tsc": "tsc"
|
||||||
},
|
},
|
||||||
"keywords": [
|
|
||||||
"Actions",
|
|
||||||
"Http"
|
|
||||||
],
|
|
||||||
"author": "GitHub, Inc.",
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/actions/http-client/issues"
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/actions/http-client#readme",
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^25.1.4",
|
"@types/tunnel": "0.0.3",
|
||||||
"@types/node": "^12.12.31",
|
"proxy": "^1.0.1"
|
||||||
"jest": "^25.1.0",
|
|
||||||
"prettier": "^2.0.4",
|
|
||||||
"proxy": "^1.0.1",
|
|
||||||
"ts-jest": "^25.2.1",
|
|
||||||
"typescript": "^3.8.3"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tunnel": "0.0.6"
|
"tunnel": "^0.0.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
6
node_modules/@types/node/README.md
generated
vendored
6
node_modules/@types/node/README.md
generated
vendored
@ -8,9 +8,9 @@ This package contains type definitions for Node.js (https://nodejs.org/).
|
|||||||
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.
|
||||||
|
|
||||||
### Additional Details
|
### Additional Details
|
||||||
* Last updated: Sun, 24 Apr 2022 21:01:37 GMT
|
* Last updated: Wed, 15 Jun 2022 23:01:34 GMT
|
||||||
* Dependencies: none
|
* Dependencies: none
|
||||||
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
|
||||||
|
|
||||||
# Credits
|
# Credits
|
||||||
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), and [wafuwafu13](https://github.com/wafuwafu13).
|
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), and [Matteo Collina](https://github.com/mcollina).
|
||||||
|
15
node_modules/@types/node/assert.d.ts
generated
vendored
15
node_modules/@types/node/assert.d.ts
generated
vendored
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* The `assert` module provides a set of assertion functions for verifying
|
* The `assert` module provides a set of assertion functions for verifying
|
||||||
* invariants.
|
* invariants.
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/assert.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/assert.js)
|
||||||
*/
|
*/
|
||||||
declare module 'assert' {
|
declare module 'assert' {
|
||||||
/**
|
/**
|
||||||
@ -237,8 +237,8 @@ declare module 'assert' {
|
|||||||
* > Stability: 3 - Legacy: Use {@link strictEqual} instead.
|
* > Stability: 3 - Legacy: Use {@link strictEqual} instead.
|
||||||
*
|
*
|
||||||
* Tests shallow, coercive equality between the `actual` and `expected` parameters
|
* Tests shallow, coercive equality between the `actual` and `expected` parameters
|
||||||
* using the [Abstract Equality Comparison](https://tc39.github.io/ecma262/#sec-abstract-equality-comparison) ( `==` ). `NaN` is special handled
|
* using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled
|
||||||
* and treated as being identical in case both sides are `NaN`.
|
* and treated as being identical if both sides are `NaN`.
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* import assert from 'assert';
|
* import assert from 'assert';
|
||||||
@ -270,9 +270,8 @@ declare module 'assert' {
|
|||||||
*
|
*
|
||||||
* > Stability: 3 - Legacy: Use {@link notStrictEqual} instead.
|
* > Stability: 3 - Legacy: Use {@link notStrictEqual} instead.
|
||||||
*
|
*
|
||||||
* Tests shallow, coercive inequality with the [Abstract Equality Comparison](https://tc39.github.io/ecma262/#sec-abstract-equality-comparison)(`!=` ). `NaN` is special handled and treated as
|
* Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is
|
||||||
* being identical in case both
|
* specially handled and treated as being identical if both sides are `NaN`.
|
||||||
* sides are `NaN`.
|
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* import assert from 'assert';
|
* import assert from 'assert';
|
||||||
@ -362,7 +361,7 @@ declare module 'assert' {
|
|||||||
function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
/**
|
/**
|
||||||
* Tests strict equality between the `actual` and `expected` parameters as
|
* Tests strict equality between the `actual` and `expected` parameters as
|
||||||
* determined by the [SameValue Comparison](https://tc39.github.io/ecma262/#sec-samevalue).
|
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* import assert from 'assert/strict';
|
* import assert from 'assert/strict';
|
||||||
@ -400,7 +399,7 @@ declare module 'assert' {
|
|||||||
function strictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
function strictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
||||||
/**
|
/**
|
||||||
* Tests strict inequality between the `actual` and `expected` parameters as
|
* Tests strict inequality between the `actual` and `expected` parameters as
|
||||||
* determined by the [SameValue Comparison](https://tc39.github.io/ecma262/#sec-samevalue).
|
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* import assert from 'assert/strict';
|
* import assert from 'assert/strict';
|
||||||
|
6
node_modules/@types/node/async_hooks.d.ts
generated
vendored
6
node_modules/@types/node/async_hooks.d.ts
generated
vendored
@ -6,7 +6,7 @@
|
|||||||
* import async_hooks from 'async_hooks';
|
* import async_hooks from 'async_hooks';
|
||||||
* ```
|
* ```
|
||||||
* @experimental
|
* @experimental
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/async_hooks.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/async_hooks.js)
|
||||||
*/
|
*/
|
||||||
declare module 'async_hooks' {
|
declare module 'async_hooks' {
|
||||||
/**
|
/**
|
||||||
@ -258,7 +258,7 @@ declare module 'async_hooks' {
|
|||||||
* @param type The type of async event.
|
* @param type The type of async event.
|
||||||
* @param triggerAsyncId The ID of the execution context that created
|
* @param triggerAsyncId The ID of the execution context that created
|
||||||
* this async event (default: `executionAsyncId()`), or an
|
* this async event (default: `executionAsyncId()`), or an
|
||||||
* AsyncResourceOptions object (since 9.3)
|
* AsyncResourceOptions object (since v9.3.0)
|
||||||
*/
|
*/
|
||||||
constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions);
|
constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions);
|
||||||
/**
|
/**
|
||||||
@ -364,7 +364,7 @@ declare module 'async_hooks' {
|
|||||||
*
|
*
|
||||||
* Each instance of `AsyncLocalStorage` maintains an independent storage context.
|
* Each instance of `AsyncLocalStorage` maintains an independent storage context.
|
||||||
* Multiple instances can safely exist simultaneously without risk of interfering
|
* Multiple instances can safely exist simultaneously without risk of interfering
|
||||||
* with each other data.
|
* with each other's data.
|
||||||
* @since v13.10.0, v12.17.0
|
* @since v13.10.0, v12.17.0
|
||||||
*/
|
*/
|
||||||
class AsyncLocalStorage<T> {
|
class AsyncLocalStorage<T> {
|
||||||
|
16
node_modules/@types/node/buffer.d.ts
generated
vendored
16
node_modules/@types/node/buffer.d.ts
generated
vendored
@ -41,7 +41,7 @@
|
|||||||
* // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
|
* // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
|
||||||
* const buf7 = Buffer.from('tést', 'latin1');
|
* const buf7 = Buffer.from('tést', 'latin1');
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/buffer.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/buffer.js)
|
||||||
*/
|
*/
|
||||||
declare module 'buffer' {
|
declare module 'buffer' {
|
||||||
import { BinaryLike } from 'node:crypto';
|
import { BinaryLike } from 'node:crypto';
|
||||||
@ -114,7 +114,6 @@ declare module 'buffer' {
|
|||||||
* A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across
|
* A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across
|
||||||
* multiple worker threads.
|
* multiple worker threads.
|
||||||
* @since v15.7.0, v14.18.0
|
* @since v15.7.0, v14.18.0
|
||||||
* @experimental
|
|
||||||
*/
|
*/
|
||||||
export class Blob {
|
export class Blob {
|
||||||
/**
|
/**
|
||||||
@ -763,8 +762,6 @@ declare module 'buffer' {
|
|||||||
* Returns a new `Buffer` that references the same memory as the original, but
|
* Returns a new `Buffer` that references the same memory as the original, but
|
||||||
* offset and cropped by the `start` and `end` indices.
|
* offset and cropped by the `start` and `end` indices.
|
||||||
*
|
*
|
||||||
* This is the same behavior as `buf.subarray()`.
|
|
||||||
*
|
|
||||||
* This method is not compatible with the `Uint8Array.prototype.slice()`,
|
* This method is not compatible with the `Uint8Array.prototype.slice()`,
|
||||||
* which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`.
|
* which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`.
|
||||||
*
|
*
|
||||||
@ -780,8 +777,17 @@ declare module 'buffer' {
|
|||||||
*
|
*
|
||||||
* console.log(buf.toString());
|
* console.log(buf.toString());
|
||||||
* // Prints: buffer
|
* // Prints: buffer
|
||||||
|
*
|
||||||
|
* // With buf.slice(), the original buffer is modified.
|
||||||
|
* const notReallyCopiedBuf = buf.slice();
|
||||||
|
* notReallyCopiedBuf[0]++;
|
||||||
|
* console.log(notReallyCopiedBuf.toString());
|
||||||
|
* // Prints: cuffer
|
||||||
|
* console.log(buf.toString());
|
||||||
|
* // Also prints: cuffer (!)
|
||||||
* ```
|
* ```
|
||||||
* @since v0.3.0
|
* @since v0.3.0
|
||||||
|
* @deprecated Use `subarray` instead.
|
||||||
* @param [start=0] Where the new `Buffer` will start.
|
* @param [start=0] Where the new `Buffer` will start.
|
||||||
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
||||||
*/
|
*/
|
||||||
@ -1948,7 +1954,7 @@ declare module 'buffer' {
|
|||||||
*
|
*
|
||||||
* * a string, `value` is interpreted according to the character encoding in`encoding`.
|
* * a string, `value` is interpreted according to the character encoding in`encoding`.
|
||||||
* * a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), `value` will be used in its entirety.
|
* * a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), `value` will be used in its entirety.
|
||||||
* To compare a partial `Buffer`, use `buf.slice()`.
|
* To compare a partial `Buffer`, use `buf.subarray`.
|
||||||
* * a number, `value` will be interpreted as an unsigned 8-bit integer
|
* * a number, `value` will be interpreted as an unsigned 8-bit integer
|
||||||
* value between `0` and `255`.
|
* value between `0` and `255`.
|
||||||
*
|
*
|
||||||
|
9
node_modules/@types/node/child_process.d.ts
generated
vendored
9
node_modules/@types/node/child_process.d.ts
generated
vendored
@ -28,8 +28,11 @@
|
|||||||
* identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }`option if the output will not be consumed.
|
* identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }`option if the output will not be consumed.
|
||||||
*
|
*
|
||||||
* The command lookup is performed using the `options.env.PATH` environment
|
* The command lookup is performed using the `options.env.PATH` environment
|
||||||
* variable if it is in the `options` object. Otherwise, `process.env.PATH` is
|
* variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is
|
||||||
* used.
|
* used. If `options.env` is set without `PATH`, lookup on Unix is performed
|
||||||
|
* on a default search path search of `/usr/bin:/bin` (see your operating system's
|
||||||
|
* manual for execvpe/execvp), on Windows the current processes environment
|
||||||
|
* variable `PATH` is used.
|
||||||
*
|
*
|
||||||
* On Windows, environment variables are case-insensitive. Node.js
|
* On Windows, environment variables are case-insensitive. Node.js
|
||||||
* lexicographically sorts the `env` keys and uses the first one that
|
* lexicographically sorts the `env` keys and uses the first one that
|
||||||
@ -60,7 +63,7 @@
|
|||||||
* For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
|
* For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
|
||||||
* the synchronous methods can have significant impact on performance due to
|
* the synchronous methods can have significant impact on performance due to
|
||||||
* stalling the event loop while spawned processes complete.
|
* stalling the event loop while spawned processes complete.
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/child_process.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/child_process.js)
|
||||||
*/
|
*/
|
||||||
declare module 'child_process' {
|
declare module 'child_process' {
|
||||||
import { ObjectEncodingOptions } from 'node:fs';
|
import { ObjectEncodingOptions } from 'node:fs';
|
||||||
|
32
node_modules/@types/node/cluster.d.ts
generated
vendored
32
node_modules/@types/node/cluster.d.ts
generated
vendored
@ -1,7 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* A single instance of Node.js runs in a single thread. To take advantage of
|
* Clusters of Node.js processes can be used to run multiple instances of Node.js
|
||||||
* multi-core systems, the user will sometimes want to launch a cluster of Node.js
|
* that can distribute workloads among their application threads. When process
|
||||||
* processes to handle the load.
|
* isolation is not needed, use the `worker_threads` module instead, which
|
||||||
|
* allows running multiple application threads within a single Node.js instance.
|
||||||
*
|
*
|
||||||
* The cluster module allows easy creation of child processes that all share
|
* The cluster module allows easy creation of child processes that all share
|
||||||
* server ports.
|
* server ports.
|
||||||
@ -49,7 +50,7 @@
|
|||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* On Windows, it is not yet possible to set up a named pipe server in a worker.
|
* On Windows, it is not yet possible to set up a named pipe server in a worker.
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/cluster.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/cluster.js)
|
||||||
*/
|
*/
|
||||||
declare module 'cluster' {
|
declare module 'cluster' {
|
||||||
import * as child from 'node:child_process';
|
import * as child from 'node:child_process';
|
||||||
@ -99,9 +100,9 @@ declare module 'cluster' {
|
|||||||
/**
|
/**
|
||||||
* Send a message to a worker or primary, optionally with a handle.
|
* Send a message to a worker or primary, optionally with a handle.
|
||||||
*
|
*
|
||||||
* In the primary this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
|
* In the primary, this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
|
||||||
*
|
*
|
||||||
* In a worker this sends a message to the primary. It is identical to`process.send()`.
|
* In a worker, this sends a message to the primary. It is identical to`process.send()`.
|
||||||
*
|
*
|
||||||
* This example will echo back all messages from the primary:
|
* This example will echo back all messages from the primary:
|
||||||
*
|
*
|
||||||
@ -123,19 +124,13 @@ declare module 'cluster' {
|
|||||||
send(message: child.Serializable, sendHandle: child.SendHandle, callback?: (error: Error | null) => void): boolean;
|
send(message: child.Serializable, sendHandle: child.SendHandle, callback?: (error: Error | null) => void): boolean;
|
||||||
send(message: child.Serializable, sendHandle: child.SendHandle, options?: child.MessageOptions, callback?: (error: Error | null) => void): boolean;
|
send(message: child.Serializable, sendHandle: child.SendHandle, options?: child.MessageOptions, callback?: (error: Error | null) => void): boolean;
|
||||||
/**
|
/**
|
||||||
* This function will kill the worker. In the primary, it does this
|
* This function will kill the worker. In the primary worker, it does this by
|
||||||
* by disconnecting the `worker.process`, and once disconnected, killing
|
* disconnecting the `worker.process`, and once disconnected, killing with`signal`. In the worker, it does it by killing the process with `signal`.
|
||||||
* with `signal`. In the worker, it does it by disconnecting the channel,
|
|
||||||
* and then exiting with code `0`.
|
|
||||||
*
|
*
|
||||||
* Because `kill()` attempts to gracefully disconnect the worker process, it is
|
* The `kill()` function kills the worker process without waiting for a graceful
|
||||||
* susceptible to waiting indefinitely for the disconnect to complete. For example,
|
* disconnect, it has the same behavior as `worker.process.kill()`.
|
||||||
* if the worker enters an infinite loop, a graceful disconnect will never occur.
|
|
||||||
* If the graceful disconnect behavior is not needed, use `worker.process.kill()`.
|
|
||||||
*
|
*
|
||||||
* Causes `.exitedAfterDisconnect` to be set.
|
* This method is aliased as `worker.destroy()` for backwards compatibility.
|
||||||
*
|
|
||||||
* This method is aliased as `worker.destroy()` for backward compatibility.
|
|
||||||
*
|
*
|
||||||
* In a worker, `process.kill()` exists, but it is not this function;
|
* In a worker, `process.kill()` exists, but it is not this function;
|
||||||
* it is `kill()`.
|
* it is `kill()`.
|
||||||
@ -253,7 +248,8 @@ declare module 'cluster' {
|
|||||||
*/
|
*/
|
||||||
isDead(): boolean;
|
isDead(): boolean;
|
||||||
/**
|
/**
|
||||||
* This property is `true` if the worker exited due to `.kill()` or`.disconnect()`. If the worker exited any other way, it is `false`. If the
|
* This property is `true` if the worker exited due to `.disconnect()`.
|
||||||
|
* If the worker exited any other way, it is `false`. If the
|
||||||
* worker has not exited, it is `undefined`.
|
* worker has not exited, it is `undefined`.
|
||||||
*
|
*
|
||||||
* The boolean `worker.exitedAfterDisconnect` allows distinguishing between
|
* The boolean `worker.exitedAfterDisconnect` allows distinguishing between
|
||||||
|
2
node_modules/@types/node/console.d.ts
generated
vendored
2
node_modules/@types/node/console.d.ts
generated
vendored
@ -53,7 +53,7 @@
|
|||||||
* myConsole.warn(`Danger ${name}! Danger!`);
|
* myConsole.warn(`Danger ${name}! Danger!`);
|
||||||
* // Prints: Danger Will Robinson! Danger!, to err
|
* // Prints: Danger Will Robinson! Danger!, to err
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/console.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/console.js)
|
||||||
*/
|
*/
|
||||||
declare module 'console' {
|
declare module 'console' {
|
||||||
import console = require('node:console');
|
import console = require('node:console');
|
||||||
|
169
node_modules/@types/node/crypto.d.ts
generated
vendored
169
node_modules/@types/node/crypto.d.ts
generated
vendored
@ -13,12 +13,64 @@
|
|||||||
* // Prints:
|
* // Prints:
|
||||||
* // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
|
* // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/crypto.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/crypto.js)
|
||||||
*/
|
*/
|
||||||
declare module 'crypto' {
|
declare module 'crypto' {
|
||||||
import * as stream from 'node:stream';
|
import * as stream from 'node:stream';
|
||||||
import { PeerCertificate } from 'node:tls';
|
import { PeerCertificate } from 'node:tls';
|
||||||
interface Certificate {
|
/**
|
||||||
|
* SPKAC is a Certificate Signing Request mechanism originally implemented by
|
||||||
|
* Netscape and was specified formally as part of [HTML5's `keygen` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/keygen).
|
||||||
|
*
|
||||||
|
* `<keygen>` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects
|
||||||
|
* should not use this element anymore.
|
||||||
|
*
|
||||||
|
* The `crypto` module provides the `Certificate` class for working with SPKAC
|
||||||
|
* data. The most common usage is handling output generated by the HTML5`<keygen>` element. Node.js uses [OpenSSL's SPKAC
|
||||||
|
* implementation](https://www.openssl.org/docs/man1.1.0/apps/openssl-spkac.html) internally.
|
||||||
|
* @since v0.11.8
|
||||||
|
*/
|
||||||
|
class Certificate {
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* const { Certificate } = await import('crypto');
|
||||||
|
* const spkac = getSpkacSomehow();
|
||||||
|
* const challenge = Certificate.exportChallenge(spkac);
|
||||||
|
* console.log(challenge.toString('utf8'));
|
||||||
|
* // Prints: the challenge as a UTF8 string
|
||||||
|
* ```
|
||||||
|
* @since v9.0.0
|
||||||
|
* @param encoding The `encoding` of the `spkac` string.
|
||||||
|
* @return The challenge component of the `spkac` data structure, which includes a public key and a challenge.
|
||||||
|
*/
|
||||||
|
static exportChallenge(spkac: BinaryLike): Buffer;
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* const { Certificate } = await import('crypto');
|
||||||
|
* const spkac = getSpkacSomehow();
|
||||||
|
* const publicKey = Certificate.exportPublicKey(spkac);
|
||||||
|
* console.log(publicKey);
|
||||||
|
* // Prints: the public key as <Buffer ...>
|
||||||
|
* ```
|
||||||
|
* @since v9.0.0
|
||||||
|
* @param encoding The `encoding` of the `spkac` string.
|
||||||
|
* @return The public key component of the `spkac` data structure, which includes a public key and a challenge.
|
||||||
|
*/
|
||||||
|
static exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'buffer';
|
||||||
|
* const { Certificate } = await import('crypto');
|
||||||
|
*
|
||||||
|
* const spkac = getSpkacSomehow();
|
||||||
|
* console.log(Certificate.verifySpkac(Buffer.from(spkac)));
|
||||||
|
* // Prints: true or false
|
||||||
|
* ```
|
||||||
|
* @since v9.0.0
|
||||||
|
* @param encoding The `encoding` of the `spkac` string.
|
||||||
|
* @return `true` if the given `spkac` data structure is valid, `false` otherwise.
|
||||||
|
*/
|
||||||
|
static verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* @param spkac
|
* @param spkac
|
||||||
@ -42,31 +94,6 @@ declare module 'crypto' {
|
|||||||
*/
|
*/
|
||||||
verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
|
verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
|
||||||
}
|
}
|
||||||
const Certificate: Certificate & {
|
|
||||||
/** @deprecated since v14.9.0 - Use static methods of `crypto.Certificate` instead. */
|
|
||||||
new (): Certificate;
|
|
||||||
/** @deprecated since v14.9.0 - Use static methods of `crypto.Certificate` instead. */
|
|
||||||
(): Certificate;
|
|
||||||
/**
|
|
||||||
* @param spkac
|
|
||||||
* @returns The challenge component of the `spkac` data structure,
|
|
||||||
* which includes a public key and a challenge.
|
|
||||||
*/
|
|
||||||
exportChallenge(spkac: BinaryLike): Buffer;
|
|
||||||
/**
|
|
||||||
* @param spkac
|
|
||||||
* @param encoding The encoding of the spkac string.
|
|
||||||
* @returns The public key component of the `spkac` data structure,
|
|
||||||
* which includes a public key and a challenge.
|
|
||||||
*/
|
|
||||||
exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
|
|
||||||
/**
|
|
||||||
* @param spkac
|
|
||||||
* @returns `true` if the given `spkac` data structure is valid,
|
|
||||||
* `false` otherwise.
|
|
||||||
*/
|
|
||||||
verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
|
|
||||||
};
|
|
||||||
namespace constants {
|
namespace constants {
|
||||||
// https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html#crypto_crypto_constants
|
// https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html#crypto_crypto_constants
|
||||||
const OPENSSL_VERSION_NUMBER: number;
|
const OPENSSL_VERSION_NUMBER: number;
|
||||||
@ -172,7 +199,7 @@ declare module 'crypto' {
|
|||||||
*
|
*
|
||||||
* The `algorithm` is dependent on the available algorithms supported by the
|
* The `algorithm` is dependent on the available algorithms supported by the
|
||||||
* version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
|
* version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
|
||||||
* On recent releases of OpenSSL, `openssl list -digest-algorithms`(`openssl list-message-digest-algorithms` for older versions of OpenSSL) will
|
* On recent releases of OpenSSL, `openssl list -digest-algorithms` will
|
||||||
* display the available digest algorithms.
|
* display the available digest algorithms.
|
||||||
*
|
*
|
||||||
* Example: generating the sha256 sum of a file
|
* Example: generating the sha256 sum of a file
|
||||||
@ -212,7 +239,7 @@ declare module 'crypto' {
|
|||||||
*
|
*
|
||||||
* The `algorithm` is dependent on the available algorithms supported by the
|
* The `algorithm` is dependent on the available algorithms supported by the
|
||||||
* version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
|
* version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
|
||||||
* On recent releases of OpenSSL, `openssl list -digest-algorithms`(`openssl list-message-digest-algorithms` for older versions of OpenSSL) will
|
* On recent releases of OpenSSL, `openssl list -digest-algorithms` will
|
||||||
* display the available digest algorithms.
|
* display the available digest algorithms.
|
||||||
*
|
*
|
||||||
* The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is
|
* The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is
|
||||||
@ -662,12 +689,13 @@ declare module 'crypto' {
|
|||||||
* Creates and returns a `Cipher` object that uses the given `algorithm` and`password`.
|
* Creates and returns a `Cipher` object that uses the given `algorithm` and`password`.
|
||||||
*
|
*
|
||||||
* The `options` argument controls stream behavior and is optional except when a
|
* The `options` argument controls stream behavior and is optional except when a
|
||||||
* cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the`authTagLength` option is required and specifies the length of the
|
* cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
|
||||||
* authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication
|
* authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication
|
||||||
* tag that will be returned by `getAuthTag()` and defaults to 16 bytes.
|
* tag that will be returned by `getAuthTag()` and defaults to 16 bytes.
|
||||||
|
* For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
|
||||||
*
|
*
|
||||||
* The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
|
* The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
|
||||||
* recent OpenSSL releases, `openssl list -cipher-algorithms`(`openssl list-cipher-algorithms` for older versions of OpenSSL) will
|
* recent OpenSSL releases, `openssl list -cipher-algorithms` will
|
||||||
* display the available cipher algorithms.
|
* display the available cipher algorithms.
|
||||||
*
|
*
|
||||||
* The `password` is used to derive the cipher key and initialization vector (IV).
|
* The `password` is used to derive the cipher key and initialization vector (IV).
|
||||||
@ -700,12 +728,13 @@ declare module 'crypto' {
|
|||||||
* initialization vector (`iv`).
|
* initialization vector (`iv`).
|
||||||
*
|
*
|
||||||
* The `options` argument controls stream behavior and is optional except when a
|
* The `options` argument controls stream behavior and is optional except when a
|
||||||
* cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the`authTagLength` option is required and specifies the length of the
|
* cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
|
||||||
* authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication
|
* authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication
|
||||||
* tag that will be returned by `getAuthTag()` and defaults to 16 bytes.
|
* tag that will be returned by `getAuthTag()` and defaults to 16 bytes.
|
||||||
|
* For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
|
||||||
*
|
*
|
||||||
* The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
|
* The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
|
||||||
* recent OpenSSL releases, `openssl list -cipher-algorithms`(`openssl list-cipher-algorithms` for older versions of OpenSSL) will
|
* recent OpenSSL releases, `openssl list -cipher-algorithms` will
|
||||||
* display the available cipher algorithms.
|
* display the available cipher algorithms.
|
||||||
*
|
*
|
||||||
* The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded
|
* The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded
|
||||||
@ -925,8 +954,9 @@ declare module 'crypto' {
|
|||||||
* Creates and returns a `Decipher` object that uses the given `algorithm` and`password` (key).
|
* Creates and returns a `Decipher` object that uses the given `algorithm` and`password` (key).
|
||||||
*
|
*
|
||||||
* The `options` argument controls stream behavior and is optional except when a
|
* The `options` argument controls stream behavior and is optional except when a
|
||||||
* cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the`authTagLength` option is required and specifies the length of the
|
* cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
|
||||||
* authentication tag in bytes, see `CCM mode`.
|
* authentication tag in bytes, see `CCM mode`.
|
||||||
|
* For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
|
||||||
*
|
*
|
||||||
* The implementation of `crypto.createDecipher()` derives keys using the OpenSSL
|
* The implementation of `crypto.createDecipher()` derives keys using the OpenSSL
|
||||||
* function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one
|
* function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one
|
||||||
@ -951,12 +981,13 @@ declare module 'crypto' {
|
|||||||
* Creates and returns a `Decipher` object that uses the given `algorithm`, `key`and initialization vector (`iv`).
|
* Creates and returns a `Decipher` object that uses the given `algorithm`, `key`and initialization vector (`iv`).
|
||||||
*
|
*
|
||||||
* The `options` argument controls stream behavior and is optional except when a
|
* The `options` argument controls stream behavior and is optional except when a
|
||||||
* cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the`authTagLength` option is required and specifies the length of the
|
* cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
|
||||||
* authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to restrict accepted authentication tags
|
* authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to restrict accepted authentication tags
|
||||||
* to those with the specified length.
|
* to those with the specified length.
|
||||||
|
* For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
|
||||||
*
|
*
|
||||||
* The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
|
* The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
|
||||||
* recent OpenSSL releases, `openssl list -cipher-algorithms`(`openssl list-cipher-algorithms` for older versions of OpenSSL) will
|
* recent OpenSSL releases, `openssl list -cipher-algorithms` will
|
||||||
* display the available cipher algorithms.
|
* display the available cipher algorithms.
|
||||||
*
|
*
|
||||||
* The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded
|
* The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded
|
||||||
@ -2272,7 +2303,8 @@ declare module 'crypto' {
|
|||||||
* comparing HMAC digests or secret values like authentication cookies or [capability urls](https://www.w3.org/TR/capability-urls/).
|
* comparing HMAC digests or secret values like authentication cookies or [capability urls](https://www.w3.org/TR/capability-urls/).
|
||||||
*
|
*
|
||||||
* `a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they
|
* `a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they
|
||||||
* must have the same byte length.
|
* must have the same byte length. An error is thrown if `a` and `b` have
|
||||||
|
* different byte lengths.
|
||||||
*
|
*
|
||||||
* If at least one of `a` and `b` is a `TypedArray` with more than one byte per
|
* If at least one of `a` and `b` is a `TypedArray` with more than one byte per
|
||||||
* entry, such as `Uint16Array`, the result will be computed using the platform
|
* entry, such as `Uint16Array`, the result will be computed using the platform
|
||||||
@ -3094,12 +3126,16 @@ declare module 'crypto' {
|
|||||||
*/
|
*/
|
||||||
class X509Certificate {
|
class X509Certificate {
|
||||||
/**
|
/**
|
||||||
* Will be \`true\` if this is a Certificate Authority (ca) certificate.
|
* Will be \`true\` if this is a Certificate Authority (CA) certificate.
|
||||||
* @since v15.6.0
|
* @since v15.6.0
|
||||||
*/
|
*/
|
||||||
readonly ca: boolean;
|
readonly ca: boolean;
|
||||||
/**
|
/**
|
||||||
* The SHA-1 fingerprint of this certificate.
|
* The SHA-1 fingerprint of this certificate.
|
||||||
|
*
|
||||||
|
* Because SHA-1 is cryptographically broken and because the security of SHA-1 is
|
||||||
|
* significantly worse than that of algorithms that are commonly used to sign
|
||||||
|
* certificates, consider using `x509.fingerprint256` instead.
|
||||||
* @since v15.6.0
|
* @since v15.6.0
|
||||||
*/
|
*/
|
||||||
readonly fingerprint: string;
|
readonly fingerprint: string;
|
||||||
@ -3108,21 +3144,28 @@ declare module 'crypto' {
|
|||||||
* @since v15.6.0
|
* @since v15.6.0
|
||||||
*/
|
*/
|
||||||
readonly fingerprint256: string;
|
readonly fingerprint256: string;
|
||||||
|
/**
|
||||||
|
* The SHA-512 fingerprint of this certificate.
|
||||||
|
* @since v16.14.0
|
||||||
|
*/
|
||||||
|
readonly fingerprint512: string;
|
||||||
/**
|
/**
|
||||||
* The complete subject of this certificate.
|
* The complete subject of this certificate.
|
||||||
* @since v15.6.0
|
* @since v15.6.0
|
||||||
*/
|
*/
|
||||||
readonly subject: string;
|
readonly subject: string;
|
||||||
/**
|
/**
|
||||||
* The subject alternative name specified for this certificate.
|
* The subject alternative name specified for this certificate or `undefined`
|
||||||
|
* if not available.
|
||||||
* @since v15.6.0
|
* @since v15.6.0
|
||||||
*/
|
*/
|
||||||
readonly subjectAltName: string;
|
readonly subjectAltName: string | undefined;
|
||||||
/**
|
/**
|
||||||
* The information access content of this certificate.
|
* The information access content of this certificate or `undefined` if not
|
||||||
|
* available.
|
||||||
* @since v15.6.0
|
* @since v15.6.0
|
||||||
*/
|
*/
|
||||||
readonly infoAccess: string;
|
readonly infoAccess: string | undefined;
|
||||||
/**
|
/**
|
||||||
* An array detailing the key usages for this certificate.
|
* An array detailing the key usages for this certificate.
|
||||||
* @since v15.6.0
|
* @since v15.6.0
|
||||||
@ -3151,6 +3194,10 @@ declare module 'crypto' {
|
|||||||
readonly raw: Buffer;
|
readonly raw: Buffer;
|
||||||
/**
|
/**
|
||||||
* The serial number of this certificate.
|
* The serial number of this certificate.
|
||||||
|
*
|
||||||
|
* Serial numbers are assigned by certificate authorities and do not uniquely
|
||||||
|
* identify certificates. Consider using `x509.fingerprint256` as a unique
|
||||||
|
* identifier instead.
|
||||||
* @since v15.6.0
|
* @since v15.6.0
|
||||||
*/
|
*/
|
||||||
readonly serialNumber: string;
|
readonly serialNumber: string;
|
||||||
@ -3167,22 +3214,54 @@ declare module 'crypto' {
|
|||||||
constructor(buffer: BinaryLike);
|
constructor(buffer: BinaryLike);
|
||||||
/**
|
/**
|
||||||
* Checks whether the certificate matches the given email address.
|
* Checks whether the certificate matches the given email address.
|
||||||
|
*
|
||||||
|
* If the `'subject'` option is undefined or set to `'default'`, the certificate
|
||||||
|
* subject is only considered if the subject alternative name extension either does
|
||||||
|
* not exist or does not contain any email addresses.
|
||||||
|
*
|
||||||
|
* If the `'subject'` option is set to `'always'` and if the subject alternative
|
||||||
|
* name extension either does not exist or does not contain a matching email
|
||||||
|
* address, the certificate subject is considered.
|
||||||
|
*
|
||||||
|
* If the `'subject'` option is set to `'never'`, the certificate subject is never
|
||||||
|
* considered, even if the certificate contains no subject alternative names.
|
||||||
* @since v15.6.0
|
* @since v15.6.0
|
||||||
* @return Returns `email` if the certificate matches, `undefined` if it does not.
|
* @return Returns `email` if the certificate matches, `undefined` if it does not.
|
||||||
*/
|
*/
|
||||||
checkEmail(email: string, options?: X509CheckOptions): string | undefined;
|
checkEmail(email: string, options?: Pick<X509CheckOptions, 'subject'>): string | undefined;
|
||||||
/**
|
/**
|
||||||
* Checks whether the certificate matches the given host name.
|
* Checks whether the certificate matches the given host name.
|
||||||
|
*
|
||||||
|
* If the certificate matches the given host name, the matching subject name is
|
||||||
|
* returned. The returned name might be an exact match (e.g., `foo.example.com`)
|
||||||
|
* or it might contain wildcards (e.g., `*.example.com`). Because host name
|
||||||
|
* comparisons are case-insensitive, the returned subject name might also differ
|
||||||
|
* from the given `name` in capitalization.
|
||||||
|
*
|
||||||
|
* If the `'subject'` option is undefined or set to `'default'`, the certificate
|
||||||
|
* subject is only considered if the subject alternative name extension either does
|
||||||
|
* not exist or does not contain any DNS names. This behavior is consistent with [RFC 2818](https://www.rfc-editor.org/rfc/rfc2818.txt) ("HTTP Over TLS").
|
||||||
|
*
|
||||||
|
* If the `'subject'` option is set to `'always'` and if the subject alternative
|
||||||
|
* name extension either does not exist or does not contain a matching DNS name,
|
||||||
|
* the certificate subject is considered.
|
||||||
|
*
|
||||||
|
* If the `'subject'` option is set to `'never'`, the certificate subject is never
|
||||||
|
* considered, even if the certificate contains no subject alternative names.
|
||||||
* @since v15.6.0
|
* @since v15.6.0
|
||||||
* @return Returns `name` if the certificate matches, `undefined` if it does not.
|
* @return Returns a subject name that matches `name`, or `undefined` if no subject name matches `name`.
|
||||||
*/
|
*/
|
||||||
checkHost(name: string, options?: X509CheckOptions): string | undefined;
|
checkHost(name: string, options?: X509CheckOptions): string | undefined;
|
||||||
/**
|
/**
|
||||||
* Checks whether the certificate matches the given IP address (IPv4 or IPv6).
|
* Checks whether the certificate matches the given IP address (IPv4 or IPv6).
|
||||||
|
*
|
||||||
|
* Only [RFC 5280](https://www.rfc-editor.org/rfc/rfc5280.txt) `iPAddress` subject alternative names are considered, and they
|
||||||
|
* must match the given `ip` address exactly. Other subject alternative names as
|
||||||
|
* well as the subject field of the certificate are ignored.
|
||||||
* @since v15.6.0
|
* @since v15.6.0
|
||||||
* @return Returns `ip` if the certificate matches, `undefined` if it does not.
|
* @return Returns `ip` if the certificate matches, `undefined` if it does not.
|
||||||
*/
|
*/
|
||||||
checkIP(ip: string, options?: X509CheckOptions): string | undefined;
|
checkIP(ip: string): string | undefined;
|
||||||
/**
|
/**
|
||||||
* Checks whether this certificate was issued by the given `otherCert`.
|
* Checks whether this certificate was issued by the given `otherCert`.
|
||||||
* @since v15.6.0
|
* @since v15.6.0
|
||||||
|
4
node_modules/@types/node/dgram.d.ts
generated
vendored
4
node_modules/@types/node/dgram.d.ts
generated
vendored
@ -23,7 +23,7 @@
|
|||||||
* server.bind(41234);
|
* server.bind(41234);
|
||||||
* // Prints: server listening 0.0.0.0:41234
|
* // Prints: server listening 0.0.0.0:41234
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/dgram.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/dgram.js)
|
||||||
*/
|
*/
|
||||||
declare module 'dgram' {
|
declare module 'dgram' {
|
||||||
import { AddressInfo } from 'node:net';
|
import { AddressInfo } from 'node:net';
|
||||||
@ -451,7 +451,7 @@ declare module 'dgram' {
|
|||||||
* TTL. If the TTL is decremented to 0 by a router, it will not be forwarded.
|
* TTL. If the TTL is decremented to 0 by a router, it will not be forwarded.
|
||||||
* Changing TTL values is typically done for network probes or when multicasting.
|
* Changing TTL values is typically done for network probes or when multicasting.
|
||||||
*
|
*
|
||||||
* The `ttl` argument may be between between 1 and 255\. The default on most systems
|
* The `ttl` argument may be between 1 and 255\. The default on most systems
|
||||||
* is 64.
|
* is 64.
|
||||||
*
|
*
|
||||||
* This method throws `EBADF` if called on an unbound socket.
|
* This method throws `EBADF` if called on an unbound socket.
|
||||||
|
23
node_modules/@types/node/diagnostics_channel.d.ts
generated
vendored
23
node_modules/@types/node/diagnostics_channel.d.ts
generated
vendored
@ -20,7 +20,7 @@
|
|||||||
* should generally include the module name to avoid collisions with data from
|
* should generally include the module name to avoid collisions with data from
|
||||||
* other modules.
|
* other modules.
|
||||||
* @experimental
|
* @experimental
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/diagnostics_channel.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/diagnostics_channel.js)
|
||||||
*/
|
*/
|
||||||
declare module 'diagnostics_channel' {
|
declare module 'diagnostics_channel' {
|
||||||
/**
|
/**
|
||||||
@ -57,7 +57,7 @@ declare module 'diagnostics_channel' {
|
|||||||
* @return The named channel object
|
* @return The named channel object
|
||||||
*/
|
*/
|
||||||
function channel(name: string): Channel;
|
function channel(name: string): Channel;
|
||||||
type ChannelListener = (name: string, message: unknown) => void;
|
type ChannelListener = (message: unknown, name: string) => void;
|
||||||
/**
|
/**
|
||||||
* The class `Channel` represents an individual named channel within the data
|
* The class `Channel` represents an individual named channel within the data
|
||||||
* pipeline. It is use to track subscribers and to publish messages when there
|
* pipeline. It is use to track subscribers and to publish messages when there
|
||||||
@ -89,6 +89,24 @@ declare module 'diagnostics_channel' {
|
|||||||
*/
|
*/
|
||||||
readonly hasSubscribers: boolean;
|
readonly hasSubscribers: boolean;
|
||||||
private constructor(name: string);
|
private constructor(name: string);
|
||||||
|
/**
|
||||||
|
* Publish a message to any subscribers to the channel. This will
|
||||||
|
* trigger message handlers synchronously so they will execute within
|
||||||
|
* the same context.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import diagnostics_channel from 'diagnostics_channel';
|
||||||
|
*
|
||||||
|
* const channel = diagnostics_channel.channel('my-channel');
|
||||||
|
*
|
||||||
|
* channel.publish({
|
||||||
|
* some: 'message'
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v15.1.0, v14.17.0
|
||||||
|
* @param message The message to send to the channel subscribers
|
||||||
|
*/
|
||||||
|
publish(message: unknown): void;
|
||||||
/**
|
/**
|
||||||
* Register a message handler to subscribe to this channel. This message handler
|
* Register a message handler to subscribe to this channel. This message handler
|
||||||
* will be run synchronously whenever a message is published to the channel. Any
|
* will be run synchronously whenever a message is published to the channel. Any
|
||||||
@ -125,6 +143,7 @@ declare module 'diagnostics_channel' {
|
|||||||
* ```
|
* ```
|
||||||
* @since v15.1.0, v14.17.0
|
* @since v15.1.0, v14.17.0
|
||||||
* @param onMessage The previous subscribed handler to remove
|
* @param onMessage The previous subscribed handler to remove
|
||||||
|
* @return `true` if the handler was found, `false` otherwise.
|
||||||
*/
|
*/
|
||||||
unsubscribe(onMessage: ChannelListener): void;
|
unsubscribe(onMessage: ChannelListener): void;
|
||||||
}
|
}
|
||||||
|
4
node_modules/@types/node/dns.d.ts
generated
vendored
4
node_modules/@types/node/dns.d.ts
generated
vendored
@ -42,7 +42,7 @@
|
|||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* See the `Implementation considerations section` for more information.
|
* See the `Implementation considerations section` for more information.
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/dns.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/dns.js)
|
||||||
*/
|
*/
|
||||||
declare module 'dns' {
|
declare module 'dns' {
|
||||||
import * as dnsPromises from 'node:dns/promises';
|
import * as dnsPromises from 'node:dns/promises';
|
||||||
@ -244,7 +244,7 @@ declare module 'dns' {
|
|||||||
*
|
*
|
||||||
* <omitted>
|
* <omitted>
|
||||||
*
|
*
|
||||||
* On error, `err` is an `Error` object, where `err.code` is one of theDNS error codes.
|
* On error, `err` is an `Error` object, where `err.code` is one of the `DNS error codes`.
|
||||||
* @since v0.1.27
|
* @since v0.1.27
|
||||||
* @param hostname Host name to resolve.
|
* @param hostname Host name to resolve.
|
||||||
* @param [rrtype='A'] Resource record type.
|
* @param [rrtype='A'] Resource record type.
|
||||||
|
4
node_modules/@types/node/dns/promises.d.ts
generated
vendored
4
node_modules/@types/node/dns/promises.d.ts
generated
vendored
@ -119,7 +119,7 @@ declare module 'dns/promises' {
|
|||||||
*
|
*
|
||||||
* <omitted>
|
* <omitted>
|
||||||
*
|
*
|
||||||
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the DNS error codes.
|
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`.
|
||||||
* @since v10.6.0
|
* @since v10.6.0
|
||||||
* @param hostname Host name to resolve.
|
* @param hostname Host name to resolve.
|
||||||
* @param [rrtype='A'] Resource record type.
|
* @param [rrtype='A'] Resource record type.
|
||||||
@ -300,7 +300,7 @@ declare module 'dns/promises' {
|
|||||||
* Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
|
* Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
|
||||||
* array of host names.
|
* array of host names.
|
||||||
*
|
*
|
||||||
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the DNS error codes.
|
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`.
|
||||||
* @since v10.6.0
|
* @since v10.6.0
|
||||||
*/
|
*/
|
||||||
function reverse(ip: string): Promise<string[]>;
|
function reverse(ip: string): Promise<string[]>;
|
||||||
|
5
node_modules/@types/node/domain.d.ts
generated
vendored
5
node_modules/@types/node/domain.d.ts
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* **This module is pending deprecation.** Once a replacement API has been
|
* **This module is pending deprecation.** Once a replacement API has been
|
||||||
* finalized, this module will be fully deprecated. Most developers should**not** have cause to use this module. Users who absolutely must have
|
* finalized, this module will be fully deprecated. Most developers should
|
||||||
|
* **not** have cause to use this module. Users who absolutely must have
|
||||||
* the functionality that domains provide may rely on it for the time being
|
* the functionality that domains provide may rely on it for the time being
|
||||||
* but should expect to have to migrate to a different solution
|
* but should expect to have to migrate to a different solution
|
||||||
* in the future.
|
* in the future.
|
||||||
@ -11,7 +12,7 @@
|
|||||||
* will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
|
* will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
|
||||||
* exit immediately with an error code.
|
* exit immediately with an error code.
|
||||||
* @deprecated Since v1.4.2 - Deprecated
|
* @deprecated Since v1.4.2 - Deprecated
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/domain.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/domain.js)
|
||||||
*/
|
*/
|
||||||
declare module 'domain' {
|
declare module 'domain' {
|
||||||
import EventEmitter = require('node:events');
|
import EventEmitter = require('node:events');
|
||||||
|
42
node_modules/@types/node/events.d.ts
generated
vendored
42
node_modules/@types/node/events.d.ts
generated
vendored
@ -32,7 +32,7 @@
|
|||||||
* });
|
* });
|
||||||
* myEmitter.emit('event');
|
* myEmitter.emit('event');
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/events.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/events.js)
|
||||||
*/
|
*/
|
||||||
declare module 'events' {
|
declare module 'events' {
|
||||||
interface EventEmitterOptions {
|
interface EventEmitterOptions {
|
||||||
@ -50,7 +50,7 @@ declare module 'events' {
|
|||||||
listener: (...args: any[]) => void,
|
listener: (...args: any[]) => void,
|
||||||
opts?: {
|
opts?: {
|
||||||
once: boolean;
|
once: boolean;
|
||||||
},
|
}
|
||||||
): any;
|
): any;
|
||||||
}
|
}
|
||||||
interface StaticEventEmitterOptions {
|
interface StaticEventEmitterOptions {
|
||||||
@ -154,11 +154,7 @@ declare module 'events' {
|
|||||||
* ```
|
* ```
|
||||||
* @since v11.13.0, v10.16.0
|
* @since v11.13.0, v10.16.0
|
||||||
*/
|
*/
|
||||||
static once(
|
static once(emitter: NodeEventTarget, eventName: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>;
|
||||||
emitter: NodeEventTarget,
|
|
||||||
eventName: string | symbol,
|
|
||||||
options?: StaticEventEmitterOptions,
|
|
||||||
): Promise<any[]>;
|
|
||||||
static once(emitter: DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
|
static once(emitter: DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
|
||||||
/**
|
/**
|
||||||
* ```js
|
* ```js
|
||||||
@ -218,11 +214,7 @@ declare module 'events' {
|
|||||||
* @param eventName The name of the event being listened for
|
* @param eventName The name of the event being listened for
|
||||||
* @return that iterates `eventName` events emitted by the `emitter`
|
* @return that iterates `eventName` events emitted by the `emitter`
|
||||||
*/
|
*/
|
||||||
static on(
|
static on(emitter: NodeJS.EventEmitter, eventName: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>;
|
||||||
emitter: NodeJS.EventEmitter,
|
|
||||||
eventName: string,
|
|
||||||
options?: StaticEventEmitterOptions,
|
|
||||||
): AsyncIterableIterator<any>;
|
|
||||||
/**
|
/**
|
||||||
* A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.
|
* A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.
|
||||||
*
|
*
|
||||||
@ -269,23 +261,21 @@ declare module 'events' {
|
|||||||
*/
|
*/
|
||||||
static getEventListeners(emitter: DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
|
static getEventListeners(emitter: DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
|
||||||
/**
|
/**
|
||||||
* By default `EventEmitter`s will print a warning if more than `10` listeners are
|
|
||||||
* added for a particular event. This is a useful default that helps finding
|
|
||||||
* memory leaks. The `EventEmitter.setMaxListeners()` method allows the default limit to be
|
|
||||||
* modified (if eventTargets is empty) or modify the limit specified in every `EventTarget` | `EventEmitter` passed as arguments.
|
|
||||||
* The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners.
|
|
||||||
*
|
|
||||||
* ```js
|
* ```js
|
||||||
* EventEmitter.setMaxListeners(20);
|
* const {
|
||||||
* // Equivalent to
|
* setMaxListeners,
|
||||||
* EventEmitter.defaultMaxListeners = 20;
|
* EventEmitter
|
||||||
|
* } = require('events');
|
||||||
*
|
*
|
||||||
* const eventTarget = new EventTarget();
|
* const target = new EventTarget();
|
||||||
* // Only way to increase limit for `EventTarget` instances
|
* const emitter = new EventEmitter();
|
||||||
* // as these doesn't expose its own `setMaxListeners` method
|
*
|
||||||
* EventEmitter.setMaxListeners(20, eventTarget);
|
* setMaxListeners(5, target, emitter);
|
||||||
* ```
|
* ```
|
||||||
* @since v15.3.0, v14.17.0
|
* @since v15.4.0
|
||||||
|
* @param n A non-negative number. The maximum number of listeners per `EventTarget` event.
|
||||||
|
* @param eventsTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter}
|
||||||
|
* objects.
|
||||||
*/
|
*/
|
||||||
static setMaxListeners(n?: number, ...eventTargets: Array<DOMEventTarget | NodeJS.EventEmitter>): void;
|
static setMaxListeners(n?: number, ...eventTargets: Array<DOMEventTarget | NodeJS.EventEmitter>): void;
|
||||||
/**
|
/**
|
||||||
|
71
node_modules/@types/node/fs.d.ts
generated
vendored
71
node_modules/@types/node/fs.d.ts
generated
vendored
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* All file system operations have synchronous, callback, and promise-based
|
* All file system operations have synchronous, callback, and promise-based
|
||||||
* forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM).
|
* forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM).
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/fs.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/fs.js)
|
||||||
*/
|
*/
|
||||||
declare module 'fs' {
|
declare module 'fs' {
|
||||||
import * as stream from 'node:stream';
|
import * as stream from 'node:stream';
|
||||||
@ -1123,15 +1123,15 @@ declare module 'fs' {
|
|||||||
* ```js
|
* ```js
|
||||||
* import { symlink } from 'fs';
|
* import { symlink } from 'fs';
|
||||||
*
|
*
|
||||||
* symlink('./mew', './example/mewtwo', callback);
|
* symlink('./mew', './mewtwo', callback);
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* The above example creates a symbolic link `mewtwo` in the `example` which points
|
* The above example creates a symbolic link `mewtwo` which points to `mew` in the
|
||||||
* to `mew` in the same directory:
|
* same directory:
|
||||||
*
|
*
|
||||||
* ```bash
|
* ```bash
|
||||||
* $ tree example/
|
* $ tree .
|
||||||
* example/
|
* .
|
||||||
* ├── mew
|
* ├── mew
|
||||||
* └── mewtwo -> ./mew
|
* └── mewtwo -> ./mew
|
||||||
* ```
|
* ```
|
||||||
@ -1998,12 +1998,19 @@ declare module 'fs' {
|
|||||||
* @param [flags='r'] See `support of file system `flags``.
|
* @param [flags='r'] See `support of file system `flags``.
|
||||||
* @param [mode=0o666]
|
* @param [mode=0o666]
|
||||||
*/
|
*/
|
||||||
export function open(path: PathLike, flags: OpenMode, mode: Mode | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
|
export function open(path: PathLike, flags: OpenMode | undefined, mode: Mode | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
|
||||||
|
/**
|
||||||
|
* Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
|
||||||
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||||
|
* @param [flags='r'] See `support of file system `flags``.
|
||||||
|
*/
|
||||||
|
export function open(path: PathLike, flags: OpenMode | undefined, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
|
||||||
/**
|
/**
|
||||||
* Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
|
* Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
|
||||||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||||
*/
|
*/
|
||||||
export function open(path: PathLike, flags: OpenMode, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
|
export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
|
||||||
|
|
||||||
export namespace open {
|
export namespace open {
|
||||||
/**
|
/**
|
||||||
* Asynchronous open(2) - open and possibly create a file.
|
* Asynchronous open(2) - open and possibly create a file.
|
||||||
@ -2092,8 +2099,7 @@ declare module 'fs' {
|
|||||||
*/
|
*/
|
||||||
export function fsyncSync(fd: number): void;
|
export function fsyncSync(fd: number): void;
|
||||||
/**
|
/**
|
||||||
* Write `buffer` to the file specified by `fd`. If `buffer` is a normal object, it
|
* Write `buffer` to the file specified by `fd`.
|
||||||
* must have an own `toString` function property.
|
|
||||||
*
|
*
|
||||||
* `offset` determines the part of the buffer to be written, and `length` is
|
* `offset` determines the part of the buffer to be written, and `length` is
|
||||||
* an integer specifying the number of bytes to write.
|
* an integer specifying the number of bytes to write.
|
||||||
@ -2216,8 +2222,6 @@ declare module 'fs' {
|
|||||||
}>;
|
}>;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* If `buffer` is a plain object, it must have an own (not inherited) `toString`function property.
|
|
||||||
*
|
|
||||||
* For detailed information, see the documentation of the asynchronous version of
|
* For detailed information, see the documentation of the asynchronous version of
|
||||||
* this API: {@link write}.
|
* this API: {@link write}.
|
||||||
* @since v0.1.21
|
* @since v0.1.21
|
||||||
@ -2289,10 +2293,7 @@ declare module 'fs' {
|
|||||||
options: ReadAsyncOptions<TBuffer>,
|
options: ReadAsyncOptions<TBuffer>,
|
||||||
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void
|
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void
|
||||||
): void;
|
): void;
|
||||||
export function read(
|
export function read(fd: number, callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NodeJS.ArrayBufferView) => void): void;
|
||||||
fd: number,
|
|
||||||
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NodeJS.ArrayBufferView) => void
|
|
||||||
): void;
|
|
||||||
export namespace read {
|
export namespace read {
|
||||||
/**
|
/**
|
||||||
* @param fd A file descriptor.
|
* @param fd A file descriptor.
|
||||||
@ -2318,9 +2319,7 @@ declare module 'fs' {
|
|||||||
bytesRead: number;
|
bytesRead: number;
|
||||||
buffer: TBuffer;
|
buffer: TBuffer;
|
||||||
}>;
|
}>;
|
||||||
function __promisify__(
|
function __promisify__(fd: number): Promise<{
|
||||||
fd: number
|
|
||||||
): Promise<{
|
|
||||||
bytesRead: number;
|
bytesRead: number;
|
||||||
buffer: NodeJS.ArrayBufferView;
|
buffer: NodeJS.ArrayBufferView;
|
||||||
}>;
|
}>;
|
||||||
@ -2588,8 +2587,6 @@ declare module 'fs' {
|
|||||||
*
|
*
|
||||||
* The `mode` option only affects the newly created file. See {@link open} for more details.
|
* The `mode` option only affects the newly created file. See {@link open} for more details.
|
||||||
*
|
*
|
||||||
* If `data` is a plain object, it must have an own (not inherited) `toString`function property.
|
|
||||||
*
|
|
||||||
* ```js
|
* ```js
|
||||||
* import { writeFile } from 'fs';
|
* import { writeFile } from 'fs';
|
||||||
* import { Buffer } from 'buffer';
|
* import { Buffer } from 'buffer';
|
||||||
@ -2666,8 +2663,6 @@ declare module 'fs' {
|
|||||||
/**
|
/**
|
||||||
* Returns `undefined`.
|
* Returns `undefined`.
|
||||||
*
|
*
|
||||||
* If `data` is a plain object, it must have an own (not inherited) `toString`function property.
|
|
||||||
*
|
|
||||||
* The `mode` option only affects the newly created file. See {@link open} for more details.
|
* The `mode` option only affects the newly created file. See {@link open} for more details.
|
||||||
*
|
*
|
||||||
* For detailed information, see the documentation of the asynchronous version of
|
* For detailed information, see the documentation of the asynchronous version of
|
||||||
@ -3265,9 +3260,9 @@ declare module 'fs' {
|
|||||||
/**
|
/**
|
||||||
* Tests a user's permissions for the file or directory specified by `path`.
|
* Tests a user's permissions for the file or directory specified by `path`.
|
||||||
* The `mode` argument is an optional integer that specifies the accessibility
|
* The `mode` argument is an optional integer that specifies the accessibility
|
||||||
* checks to be performed. Check `File access constants` for possible values
|
* checks to be performed. `mode` should be either the value `fs.constants.F_OK`or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`,`fs.constants.W_OK`, and `fs.constants.X_OK`
|
||||||
* of `mode`. It is possible to create a mask consisting of the bitwise OR of
|
* (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for
|
||||||
* two or more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`).
|
* possible values of `mode`.
|
||||||
*
|
*
|
||||||
* The final argument, `callback`, is a callback function that is invoked with
|
* The final argument, `callback`, is a callback function that is invoked with
|
||||||
* a possible error argument. If any of the accessibility checks fail, the error
|
* a possible error argument. If any of the accessibility checks fail, the error
|
||||||
@ -3293,14 +3288,9 @@ declare module 'fs' {
|
|||||||
* console.log(`${file} ${err ? 'is not writable' : 'is writable'}`);
|
* console.log(`${file} ${err ? 'is not writable' : 'is writable'}`);
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* // Check if the file exists in the current directory, and if it is writable.
|
* // Check if the file is readable and writable.
|
||||||
* access(file, constants.F_OK | constants.W_OK, (err) => {
|
* access(file, constants.R_OK | constants.W_OK, (err) => {
|
||||||
* if (err) {
|
* console.log(`${file} ${err ? 'is not' : 'is'} readable and writable`);
|
||||||
* console.error(
|
|
||||||
* `${file} ${err.code === 'ENOENT' ? 'does not exist' : 'is read-only'}`);
|
|
||||||
* } else {
|
|
||||||
* console.log(`${file} exists, and it is writable`);
|
|
||||||
* }
|
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
@ -3444,10 +3434,9 @@ declare module 'fs' {
|
|||||||
/**
|
/**
|
||||||
* Synchronously tests a user's permissions for the file or directory specified
|
* Synchronously tests a user's permissions for the file or directory specified
|
||||||
* by `path`. The `mode` argument is an optional integer that specifies the
|
* by `path`. The `mode` argument is an optional integer that specifies the
|
||||||
* accessibility checks to be performed. Check `File access constants` for
|
* accessibility checks to be performed. `mode` should be either the value`fs.constants.F_OK` or a mask consisting of the bitwise OR of any of`fs.constants.R_OK`, `fs.constants.W_OK`, and
|
||||||
* possible values of `mode`. It is possible to create a mask consisting of
|
* `fs.constants.X_OK` (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for
|
||||||
* the bitwise OR of two or more values
|
* possible values of `mode`.
|
||||||
* (e.g. `fs.constants.W_OK | fs.constants.R_OK`).
|
|
||||||
*
|
*
|
||||||
* If any of the accessibility checks fail, an `Error` will be thrown. Otherwise,
|
* If any of the accessibility checks fail, an `Error` will be thrown. Otherwise,
|
||||||
* the method will return `undefined`.
|
* the method will return `undefined`.
|
||||||
@ -3550,9 +3539,9 @@ declare module 'fs' {
|
|||||||
/**
|
/**
|
||||||
* `options` may also include a `start` option to allow writing data at some
|
* `options` may also include a `start` option to allow writing data at some
|
||||||
* position past the beginning of the file, allowed values are in the
|
* position past the beginning of the file, allowed values are in the
|
||||||
* \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than replacing
|
* \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than
|
||||||
* it may require the `flags` option to be set to `r+` rather than the default `w`.
|
* replacing it may require the `flags` option to be set to `r+` rather than the
|
||||||
* The `encoding` can be any one of those accepted by `Buffer`.
|
* default `w`. The `encoding` can be any one of those accepted by `Buffer`.
|
||||||
*
|
*
|
||||||
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false,
|
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false,
|
||||||
* then the file descriptor won't be closed, even if there's an error.
|
* then the file descriptor won't be closed, even if there's an error.
|
||||||
|
55
node_modules/@types/node/fs/promises.d.ts
generated
vendored
55
node_modules/@types/node/fs/promises.d.ts
generated
vendored
@ -11,6 +11,7 @@
|
|||||||
declare module 'fs/promises' {
|
declare module 'fs/promises' {
|
||||||
import { Abortable } from 'node:events';
|
import { Abortable } from 'node:events';
|
||||||
import { Stream } from 'node:stream';
|
import { Stream } from 'node:stream';
|
||||||
|
import { ReadableStream } from 'node:stream/web';
|
||||||
import {
|
import {
|
||||||
Stats,
|
Stats,
|
||||||
BigIntStats,
|
BigIntStats,
|
||||||
@ -163,9 +164,9 @@ declare module 'fs/promises' {
|
|||||||
/**
|
/**
|
||||||
* `options` may also include a `start` option to allow writing data at some
|
* `options` may also include a `start` option to allow writing data at some
|
||||||
* position past the beginning of the file, allowed values are in the
|
* position past the beginning of the file, allowed values are in the
|
||||||
* \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than replacing
|
* \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than
|
||||||
* it may require the `flags` `open` option to be set to `r+` rather than the
|
* replacing it may require the `flags` `open` option to be set to `r+` rather than
|
||||||
* default `r`. The `encoding` can be any one of those accepted by `Buffer`.
|
* the default `r`. The `encoding` can be any one of those accepted by `Buffer`.
|
||||||
*
|
*
|
||||||
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false,
|
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false,
|
||||||
* then the file descriptor won't be closed, even if there's an error.
|
* then the file descriptor won't be closed, even if there's an error.
|
||||||
@ -209,6 +210,29 @@ declare module 'fs/promises' {
|
|||||||
*/
|
*/
|
||||||
read<T extends NodeJS.ArrayBufferView>(buffer: T, offset?: number | null, length?: number | null, position?: number | null): Promise<FileReadResult<T>>;
|
read<T extends NodeJS.ArrayBufferView>(buffer: T, offset?: number | null, length?: number | null, position?: number | null): Promise<FileReadResult<T>>;
|
||||||
read<T extends NodeJS.ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>;
|
read<T extends NodeJS.ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>;
|
||||||
|
/**
|
||||||
|
* Returns a `ReadableStream` that may be used to read the files data.
|
||||||
|
*
|
||||||
|
* An error will be thrown if this method is called more than once or is called after the `FileHandle` is closed
|
||||||
|
* or closing.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { open } from 'node:fs/promises';
|
||||||
|
*
|
||||||
|
* const file = await open('./some/file/to/read');
|
||||||
|
*
|
||||||
|
* for await (const chunk of file.readableWebStream())
|
||||||
|
* console.log(chunk);
|
||||||
|
*
|
||||||
|
* await file.close();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* While the `ReadableStream` will read the file to completion, it will not close the `FileHandle` automatically. User code must still call the `fileHandle.close()` method.
|
||||||
|
*
|
||||||
|
* @since v17.0.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
readableWebStream(): ReadableStream;
|
||||||
/**
|
/**
|
||||||
* Asynchronously reads the entire contents of a file.
|
* Asynchronously reads the entire contents of a file.
|
||||||
*
|
*
|
||||||
@ -309,9 +333,8 @@ declare module 'fs/promises' {
|
|||||||
/**
|
/**
|
||||||
* Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an
|
* Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an
|
||||||
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface) or
|
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface) or
|
||||||
* [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object, or an
|
* [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object.
|
||||||
* object with an own `toString` function
|
* The promise is resolved with no arguments upon success.
|
||||||
* property. The promise is resolved with no arguments upon success.
|
|
||||||
*
|
*
|
||||||
* If `options` is a string, then it specifies the `encoding`.
|
* If `options` is a string, then it specifies the `encoding`.
|
||||||
*
|
*
|
||||||
@ -329,20 +352,18 @@ declare module 'fs/promises' {
|
|||||||
/**
|
/**
|
||||||
* Write `buffer` to the file.
|
* Write `buffer` to the file.
|
||||||
*
|
*
|
||||||
* If `buffer` is a plain object, it must have an own (not inherited) `toString`function property.
|
|
||||||
*
|
|
||||||
* The promise is resolved with an object containing two properties:
|
* The promise is resolved with an object containing two properties:
|
||||||
*
|
*
|
||||||
* It is unsafe to use `filehandle.write()` multiple times on the same file
|
* It is unsafe to use `filehandle.write()` multiple times on the same file
|
||||||
* without waiting for the promise to be resolved (or rejected). For this
|
* without waiting for the promise to be resolved (or rejected). For this
|
||||||
* scenario, use `fs.createWriteStream()`.
|
* scenario, use `filehandle.createWriteStream()`.
|
||||||
*
|
*
|
||||||
* On Linux, positional writes do not work when the file is opened in append mode.
|
* On Linux, positional writes do not work when the file is opened in append mode.
|
||||||
* The kernel ignores the position argument and always appends the data to
|
* The kernel ignores the position argument and always appends the data to
|
||||||
* the end of the file.
|
* the end of the file.
|
||||||
* @since v10.0.0
|
* @since v10.0.0
|
||||||
* @param [offset=0] The start position from within `buffer` where the data to write begins.
|
* @param [offset=0] The start position from within `buffer` where the data to write begins.
|
||||||
* @param [length=buffer.byteLength] The number of bytes from `buffer` to write.
|
* @param [length=buffer.byteLength - offset] The number of bytes from `buffer` to write.
|
||||||
* @param position The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current position.
|
* @param position The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current position.
|
||||||
* See the POSIX pwrite(2) documentation for more detail.
|
* See the POSIX pwrite(2) documentation for more detail.
|
||||||
*/
|
*/
|
||||||
@ -408,9 +429,9 @@ declare module 'fs/promises' {
|
|||||||
/**
|
/**
|
||||||
* Tests a user's permissions for the file or directory specified by `path`.
|
* Tests a user's permissions for the file or directory specified by `path`.
|
||||||
* The `mode` argument is an optional integer that specifies the accessibility
|
* The `mode` argument is an optional integer that specifies the accessibility
|
||||||
* checks to be performed. Check `File access constants` for possible values
|
* checks to be performed. `mode` should be either the value `fs.constants.F_OK`or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`,`fs.constants.W_OK`, and `fs.constants.X_OK`
|
||||||
* of `mode`. It is possible to create a mask consisting of the bitwise OR of
|
* (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for
|
||||||
* two or more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`).
|
* possible values of `mode`.
|
||||||
*
|
*
|
||||||
* If the accessibility check is successful, the promise is resolved with no
|
* If the accessibility check is successful, the promise is resolved with no
|
||||||
* value. If any of the accessibility checks fail, the promise is rejected
|
* value. If any of the accessibility checks fail, the promise is rejected
|
||||||
@ -487,7 +508,7 @@ declare module 'fs/promises' {
|
|||||||
* @param [mode=0o666] Sets the file mode (permission and sticky bits) if the file is created.
|
* @param [mode=0o666] Sets the file mode (permission and sticky bits) if the file is created.
|
||||||
* @return Fulfills with a {FileHandle} object.
|
* @return Fulfills with a {FileHandle} object.
|
||||||
*/
|
*/
|
||||||
function open(path: PathLike, flags: string | number, mode?: Mode): Promise<FileHandle>;
|
function open(path: PathLike, flags?: string | number, mode?: Mode): Promise<FileHandle>;
|
||||||
/**
|
/**
|
||||||
* Renames `oldPath` to `newPath`.
|
* Renames `oldPath` to `newPath`.
|
||||||
* @since v10.0.0
|
* @since v10.0.0
|
||||||
@ -830,7 +851,9 @@ declare module 'fs/promises' {
|
|||||||
*/
|
*/
|
||||||
function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
|
function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
|
||||||
/**
|
/**
|
||||||
* Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a `Buffer`, or, an object with an own (not inherited)`toString` function property.
|
* Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an
|
||||||
|
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface) or
|
||||||
|
* [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object.
|
||||||
*
|
*
|
||||||
* The `encoding` option is ignored if `data` is a buffer.
|
* The `encoding` option is ignored if `data` is a buffer.
|
||||||
*
|
*
|
||||||
@ -845,7 +868,7 @@ declare module 'fs/promises' {
|
|||||||
*
|
*
|
||||||
* Similarly to `fsPromises.readFile` \- `fsPromises.writeFile` is a convenience
|
* Similarly to `fsPromises.readFile` \- `fsPromises.writeFile` is a convenience
|
||||||
* method that performs multiple `write` calls internally to write the buffer
|
* method that performs multiple `write` calls internally to write the buffer
|
||||||
* passed to it. For performance sensitive code consider using `fs.createWriteStream()`.
|
* passed to it. For performance sensitive code consider using `fs.createWriteStream()` or `filehandle.createWriteStream()`.
|
||||||
*
|
*
|
||||||
* It is possible to use an `AbortSignal` to cancel an `fsPromises.writeFile()`.
|
* It is possible to use an `AbortSignal` to cancel an `fsPromises.writeFile()`.
|
||||||
* Cancelation is "best effort", and some amount of data is likely still
|
* Cancelation is "best effort", and some amount of data is likely still
|
||||||
|
14
node_modules/@types/node/globals.d.ts
generated
vendored
14
node_modules/@types/node/globals.d.ts
generated
vendored
@ -100,6 +100,16 @@ interface BigInt64Array extends RelativeIndexable<bigint> {}
|
|||||||
interface BigUint64Array extends RelativeIndexable<bigint> {}
|
interface BigUint64Array extends RelativeIndexable<bigint> {}
|
||||||
//#endregion ArrayLike.at() end
|
//#endregion ArrayLike.at() end
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since v17.0.0
|
||||||
|
*
|
||||||
|
* Creates a deep clone of an object.
|
||||||
|
*/
|
||||||
|
declare function structuredClone<T>(
|
||||||
|
value: T,
|
||||||
|
transfer?: { transfer: ReadonlyArray<import('worker_threads').TransferListItem> },
|
||||||
|
): T;
|
||||||
|
|
||||||
/*----------------------------------------------*
|
/*----------------------------------------------*
|
||||||
* *
|
* *
|
||||||
* GLOBAL INTERFACES *
|
* GLOBAL INTERFACES *
|
||||||
@ -262,11 +272,11 @@ declare namespace NodeJS {
|
|||||||
id: string;
|
id: string;
|
||||||
filename: string;
|
filename: string;
|
||||||
loaded: boolean;
|
loaded: boolean;
|
||||||
/** @deprecated since 14.6.0 Please use `require.main` and `module.children` instead. */
|
/** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */
|
||||||
parent: Module | null | undefined;
|
parent: Module | null | undefined;
|
||||||
children: Module[];
|
children: Module[];
|
||||||
/**
|
/**
|
||||||
* @since 11.14.0
|
* @since v11.14.0
|
||||||
*
|
*
|
||||||
* The directory name of the module. This is usually the same as the path.dirname() of the module.id.
|
* The directory name of the module. This is usually the same as the path.dirname() of the module.id.
|
||||||
*/
|
*/
|
||||||
|
92
node_modules/@types/node/http.d.ts
generated
vendored
92
node_modules/@types/node/http.d.ts
generated
vendored
@ -13,7 +13,7 @@
|
|||||||
* { 'content-length': '123',
|
* { 'content-length': '123',
|
||||||
* 'content-type': 'text/plain',
|
* 'content-type': 'text/plain',
|
||||||
* 'connection': 'keep-alive',
|
* 'connection': 'keep-alive',
|
||||||
* 'host': 'mysite.com',
|
* 'host': 'example.com',
|
||||||
* 'accept': '*' }
|
* 'accept': '*' }
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
@ -34,10 +34,10 @@
|
|||||||
* 'content-LENGTH', '123',
|
* 'content-LENGTH', '123',
|
||||||
* 'content-type', 'text/plain',
|
* 'content-type', 'text/plain',
|
||||||
* 'CONNECTION', 'keep-alive',
|
* 'CONNECTION', 'keep-alive',
|
||||||
* 'Host', 'mysite.com',
|
* 'Host', 'example.com',
|
||||||
* 'accepT', '*' ]
|
* 'accepT', '*' ]
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/http.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/http.js)
|
||||||
*/
|
*/
|
||||||
declare module 'http' {
|
declare module 'http' {
|
||||||
import * as stream from 'node:stream';
|
import * as stream from 'node:stream';
|
||||||
@ -211,14 +211,12 @@ declare module 'http' {
|
|||||||
* Limit the amount of time the parser will wait to receive the complete HTTP
|
* Limit the amount of time the parser will wait to receive the complete HTTP
|
||||||
* headers.
|
* headers.
|
||||||
*
|
*
|
||||||
* In case of inactivity, the rules defined in `server.timeout` apply. However,
|
* If the timeout expires, the server responds with status 408 without
|
||||||
* that inactivity based timeout would still allow the connection to be kept open
|
* forwarding the request to the request listener and then closes the connection.
|
||||||
* if the headers are being sent very slowly (by default, up to a byte per 2
|
*
|
||||||
* minutes). In order to prevent this, whenever header data arrives an additional
|
* It must be set to a non-zero value (e.g. 120 seconds) to protect against
|
||||||
* check is made that more than `server.headersTimeout` milliseconds has not
|
* potential Denial-of-Service attacks in case the server is deployed without a
|
||||||
* passed since the connection was established. If the check fails, a `'timeout'`event is emitted on the server object, and (by default) the socket is destroyed.
|
* reverse proxy in front.
|
||||||
* See `server.timeout` for more information on how timeout behavior can be
|
|
||||||
* customized.
|
|
||||||
* @since v11.3.0, v10.14.0
|
* @since v11.3.0, v10.14.0
|
||||||
*/
|
*/
|
||||||
headersTimeout: number;
|
headersTimeout: number;
|
||||||
@ -392,13 +390,13 @@ declare module 'http' {
|
|||||||
* const headers = outgoingMessage.getHeaders();
|
* const headers = outgoingMessage.getHeaders();
|
||||||
* // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] }
|
* // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] }
|
||||||
* ```
|
* ```
|
||||||
* @since v8.0.0
|
* @since v7.7.0
|
||||||
*/
|
*/
|
||||||
getHeaders(): OutgoingHttpHeaders;
|
getHeaders(): OutgoingHttpHeaders;
|
||||||
/**
|
/**
|
||||||
* Returns an array of names of headers of the outgoing outgoingMessage. All
|
* Returns an array of names of headers of the outgoing outgoingMessage. All
|
||||||
* names are lowercase.
|
* names are lowercase.
|
||||||
* @since v8.0.0
|
* @since v7.7.0
|
||||||
*/
|
*/
|
||||||
getHeaderNames(): string[];
|
getHeaderNames(): string[];
|
||||||
/**
|
/**
|
||||||
@ -408,7 +406,7 @@ declare module 'http' {
|
|||||||
* ```js
|
* ```js
|
||||||
* const hasContentType = outgoingMessage.hasHeader('content-type');
|
* const hasContentType = outgoingMessage.hasHeader('content-type');
|
||||||
* ```
|
* ```
|
||||||
* @since v8.0.0
|
* @since v7.7.0
|
||||||
*/
|
*/
|
||||||
hasHeader(name: string): boolean;
|
hasHeader(name: string): boolean;
|
||||||
/**
|
/**
|
||||||
@ -418,6 +416,7 @@ declare module 'http' {
|
|||||||
* outgoingMessage.removeHeader('Content-Encoding');
|
* outgoingMessage.removeHeader('Content-Encoding');
|
||||||
* ```
|
* ```
|
||||||
* @since v0.4.0
|
* @since v0.4.0
|
||||||
|
* @param name Header name
|
||||||
*/
|
*/
|
||||||
removeHeader(name: string): void;
|
removeHeader(name: string): void;
|
||||||
/**
|
/**
|
||||||
@ -608,7 +607,7 @@ declare module 'http' {
|
|||||||
* The `request.aborted` property will be `true` if the request has
|
* The `request.aborted` property will be `true` if the request has
|
||||||
* been aborted.
|
* been aborted.
|
||||||
* @since v0.11.14
|
* @since v0.11.14
|
||||||
* @deprecated Since v17.0.0 - Check `destroyed` instead.
|
* @deprecated Since v17.0.0,v16.12.0 - Check `destroyed` instead.
|
||||||
*/
|
*/
|
||||||
aborted: boolean;
|
aborted: boolean;
|
||||||
/**
|
/**
|
||||||
@ -622,13 +621,58 @@ declare module 'http' {
|
|||||||
*/
|
*/
|
||||||
protocol: string;
|
protocol: string;
|
||||||
/**
|
/**
|
||||||
* Whether the request is send through a reused socket.
|
* When sending request through a keep-alive enabled agent, the underlying socket
|
||||||
|
* might be reused. But if server closes connection at unfortunate time, client
|
||||||
|
* may run into a 'ECONNRESET' error.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const http = require('http');
|
||||||
|
*
|
||||||
|
* // Server has a 5 seconds keep-alive timeout by default
|
||||||
|
* http
|
||||||
|
* .createServer((req, res) => {
|
||||||
|
* res.write('hello\n');
|
||||||
|
* res.end();
|
||||||
|
* })
|
||||||
|
* .listen(3000);
|
||||||
|
*
|
||||||
|
* setInterval(() => {
|
||||||
|
* // Adapting a keep-alive agent
|
||||||
|
* http.get('http://localhost:3000', { agent }, (res) => {
|
||||||
|
* res.on('data', (data) => {
|
||||||
|
* // Do nothing
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* }, 5000); // Sending request on 5s interval so it's easy to hit idle timeout
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* By marking a request whether it reused socket or not, we can do
|
||||||
|
* automatic error retry base on it.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const http = require('http');
|
||||||
|
* const agent = new http.Agent({ keepAlive: true });
|
||||||
|
*
|
||||||
|
* function retriableRequest() {
|
||||||
|
* const req = http
|
||||||
|
* .get('http://localhost:3000', { agent }, (res) => {
|
||||||
|
* // ...
|
||||||
|
* })
|
||||||
|
* .on('error', (err) => {
|
||||||
|
* // Check if retry is needed
|
||||||
|
* if (req.reusedSocket && err.code === 'ECONNRESET') {
|
||||||
|
* retriableRequest();
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* retriableRequest();
|
||||||
|
* ```
|
||||||
* @since v13.0.0, v12.16.0
|
* @since v13.0.0, v12.16.0
|
||||||
*/
|
*/
|
||||||
reusedSocket: boolean;
|
reusedSocket: boolean;
|
||||||
/**
|
/**
|
||||||
* Limits maximum response headers count. If set to 0, no limit will be applied.
|
* Limits maximum response headers count. If set to 0, no limit will be applied.
|
||||||
* @default 2000
|
|
||||||
*/
|
*/
|
||||||
maxHeadersCount: number;
|
maxHeadersCount: number;
|
||||||
constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void);
|
constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void);
|
||||||
@ -788,7 +832,7 @@ declare module 'http' {
|
|||||||
* The `message.aborted` property will be `true` if the request has
|
* The `message.aborted` property will be `true` if the request has
|
||||||
* been aborted.
|
* been aborted.
|
||||||
* @since v10.1.0
|
* @since v10.1.0
|
||||||
* @deprecated Since v17.0.0 - Check `message.destroyed` from [stream.Readable](https://nodejs.org/dist/latest-v17.x/docs/api/stream.html#class-streamreadable).
|
* @deprecated Since v17.0.0,v16.12.0 - Check `message.destroyed` from <a href="stream.html#class-streamreadable" class="type">stream.Readable</a>.
|
||||||
*/
|
*/
|
||||||
aborted: boolean;
|
aborted: boolean;
|
||||||
/**
|
/**
|
||||||
@ -840,7 +884,7 @@ declare module 'http' {
|
|||||||
*
|
*
|
||||||
* This property is guaranteed to be an instance of the `net.Socket` class,
|
* This property is guaranteed to be an instance of the `net.Socket` class,
|
||||||
* a subclass of `stream.Duplex`, unless the user specified a socket
|
* a subclass of `stream.Duplex`, unless the user specified a socket
|
||||||
* type other than `net.Socket`.
|
* type other than `net.Socket` or internally nulled.
|
||||||
* @since v0.3.0
|
* @since v0.3.0
|
||||||
*/
|
*/
|
||||||
socket: Socket;
|
socket: Socket;
|
||||||
@ -855,7 +899,7 @@ declare module 'http' {
|
|||||||
* // { 'user-agent': 'curl/7.22.0',
|
* // { 'user-agent': 'curl/7.22.0',
|
||||||
* // host: '127.0.0.1:8000',
|
* // host: '127.0.0.1:8000',
|
||||||
* // accept: '*' }
|
* // accept: '*' }
|
||||||
* console.log(request.headers);
|
* console.log(request.getHeaders());
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* Duplicates in raw headers are handled in the following ways, depending on the
|
* Duplicates in raw headers are handled in the following ways, depending on the
|
||||||
@ -931,14 +975,14 @@ declare module 'http' {
|
|||||||
* To parse the URL into its parts:
|
* To parse the URL into its parts:
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* new URL(request.url, `http://${request.headers.host}`);
|
* new URL(request.url, `http://${request.getHeaders().host}`);
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* When `request.url` is `'/status?name=ryan'` and`request.headers.host` is `'localhost:3000'`:
|
* When `request.url` is `'/status?name=ryan'` and`request.getHeaders().host` is `'localhost:3000'`:
|
||||||
*
|
*
|
||||||
* ```console
|
* ```console
|
||||||
* $ node
|
* $ node
|
||||||
* > new URL(request.url, `http://${request.headers.host}`)
|
* > new URL(request.url, `http://${request.getHeaders().host}`)
|
||||||
* URL {
|
* URL {
|
||||||
* href: 'http://localhost:3000/status?name=ryan',
|
* href: 'http://localhost:3000/status?name=ryan',
|
||||||
* origin: 'http://localhost:3000',
|
* origin: 'http://localhost:3000',
|
||||||
@ -1137,6 +1181,8 @@ declare module 'http' {
|
|||||||
// create interface RequestOptions would make the naming more clear to developers
|
// create interface RequestOptions would make the naming more clear to developers
|
||||||
interface RequestOptions extends ClientRequestArgs {}
|
interface RequestOptions extends ClientRequestArgs {}
|
||||||
/**
|
/**
|
||||||
|
* `options` in `socket.connect()` are also supported.
|
||||||
|
*
|
||||||
* Node.js maintains several connections per server to make HTTP requests.
|
* Node.js maintains several connections per server to make HTTP requests.
|
||||||
* This function allows one to transparently issue requests.
|
* This function allows one to transparently issue requests.
|
||||||
*
|
*
|
||||||
|
10
node_modules/@types/node/http2.d.ts
generated
vendored
10
node_modules/@types/node/http2.d.ts
generated
vendored
@ -6,7 +6,7 @@
|
|||||||
* const http2 = require('http2');
|
* const http2 = require('http2');
|
||||||
* ```
|
* ```
|
||||||
* @since v8.4.0
|
* @since v8.4.0
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/http2.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/http2.js)
|
||||||
*/
|
*/
|
||||||
declare module 'http2' {
|
declare module 'http2' {
|
||||||
import EventEmitter = require('node:events');
|
import EventEmitter = require('node:events');
|
||||||
@ -83,7 +83,7 @@ declare module 'http2' {
|
|||||||
*/
|
*/
|
||||||
readonly destroyed: boolean;
|
readonly destroyed: boolean;
|
||||||
/**
|
/**
|
||||||
* Set the `true` if the `END_STREAM` flag was set in the request or response
|
* Set to `true` if the `END_STREAM` flag was set in the request or response
|
||||||
* HEADERS frame received, indicating that no additional data should be received
|
* HEADERS frame received, indicating that no additional data should be received
|
||||||
* and the readable side of the `Http2Stream` will be closed.
|
* and the readable side of the `Http2Stream` will be closed.
|
||||||
* @since v10.11.0
|
* @since v10.11.0
|
||||||
@ -580,6 +580,7 @@ declare module 'http2' {
|
|||||||
parent?: number | undefined;
|
parent?: number | undefined;
|
||||||
weight?: number | undefined;
|
weight?: number | undefined;
|
||||||
waitForTrailers?: boolean | undefined;
|
waitForTrailers?: boolean | undefined;
|
||||||
|
signal?: AbortSignal | undefined;
|
||||||
}
|
}
|
||||||
export interface SessionState {
|
export interface SessionState {
|
||||||
effectiveLocalWindowSize?: number | undefined;
|
effectiveLocalWindowSize?: number | undefined;
|
||||||
@ -845,6 +846,11 @@ declare module 'http2' {
|
|||||||
* For HTTP/2 Client `Http2Session` instances only, the `http2session.request()`creates and returns an `Http2Stream` instance that can be used to send an
|
* For HTTP/2 Client `Http2Session` instances only, the `http2session.request()`creates and returns an `Http2Stream` instance that can be used to send an
|
||||||
* HTTP/2 request to the connected server.
|
* HTTP/2 request to the connected server.
|
||||||
*
|
*
|
||||||
|
* When a `ClientHttp2Session` is first created, the socket may not yet be
|
||||||
|
* connected. if `clienthttp2session.request()` is called during this time, the
|
||||||
|
* actual request will be deferred until the socket is ready to go.
|
||||||
|
* If the `session` is closed before the actual request be executed, an`ERR_HTTP2_GOAWAY_SESSION` is thrown.
|
||||||
|
*
|
||||||
* This method is only available if `http2session.type` is equal to`http2.constants.NGHTTP2_SESSION_CLIENT`.
|
* This method is only available if `http2session.type` is equal to`http2.constants.NGHTTP2_SESSION_CLIENT`.
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
|
2
node_modules/@types/node/https.d.ts
generated
vendored
2
node_modules/@types/node/https.d.ts
generated
vendored
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
|
* HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
|
||||||
* separate module.
|
* separate module.
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/https.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/https.js)
|
||||||
*/
|
*/
|
||||||
declare module 'https' {
|
declare module 'https' {
|
||||||
import { Duplex } from 'node:stream';
|
import { Duplex } from 'node:stream';
|
||||||
|
4
node_modules/@types/node/index.d.ts
generated
vendored
4
node_modules/@types/node/index.d.ts
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
// Type definitions for non-npm package Node.js 17.0
|
// Type definitions for non-npm package Node.js 18.0
|
||||||
// Project: https://nodejs.org/
|
// Project: https://nodejs.org/
|
||||||
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
|
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
|
||||||
// DefinitelyTyped <https://github.com/DefinitelyTyped>
|
// DefinitelyTyped <https://github.com/DefinitelyTyped>
|
||||||
@ -40,6 +40,7 @@
|
|||||||
// NodeJS Contributors <https://github.com/NodeJS>
|
// NodeJS Contributors <https://github.com/NodeJS>
|
||||||
// Linus Unnebäck <https://github.com/LinusU>
|
// Linus Unnebäck <https://github.com/LinusU>
|
||||||
// wafuwafu13 <https://github.com/wafuwafu13>
|
// wafuwafu13 <https://github.com/wafuwafu13>
|
||||||
|
// Matteo Collina <https://github.com/mcollina>
|
||||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -113,6 +114,7 @@
|
|||||||
/// <reference path="stream/consumers.d.ts" />
|
/// <reference path="stream/consumers.d.ts" />
|
||||||
/// <reference path="stream/web.d.ts" />
|
/// <reference path="stream/web.d.ts" />
|
||||||
/// <reference path="string_decoder.d.ts" />
|
/// <reference path="string_decoder.d.ts" />
|
||||||
|
/// <reference path="test.d.ts" />
|
||||||
/// <reference path="timers.d.ts" />
|
/// <reference path="timers.d.ts" />
|
||||||
/// <reference path="timers/promises.d.ts" />
|
/// <reference path="timers/promises.d.ts" />
|
||||||
/// <reference path="tls.d.ts" />
|
/// <reference path="tls.d.ts" />
|
||||||
|
23
node_modules/@types/node/inspector.d.ts
generated
vendored
23
node_modules/@types/node/inspector.d.ts
generated
vendored
@ -15,7 +15,7 @@
|
|||||||
* ```js
|
* ```js
|
||||||
* const inspector = require('inspector');
|
* const inspector = require('inspector');
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/inspector.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/inspector.js)
|
||||||
*/
|
*/
|
||||||
declare module 'inspector' {
|
declare module 'inspector' {
|
||||||
import EventEmitter = require('node:events');
|
import EventEmitter = require('node:events');
|
||||||
@ -1688,7 +1688,7 @@ declare module 'inspector' {
|
|||||||
/**
|
/**
|
||||||
* Controls how the trace buffer stores data.
|
* Controls how the trace buffer stores data.
|
||||||
*/
|
*/
|
||||||
recordMode?: string;
|
recordMode?: string | undefined;
|
||||||
/**
|
/**
|
||||||
* Included category filters.
|
* Included category filters.
|
||||||
*/
|
*/
|
||||||
@ -1778,12 +1778,6 @@ declare module 'inspector' {
|
|||||||
* @since v8.0.0
|
* @since v8.0.0
|
||||||
*/
|
*/
|
||||||
connect(): void;
|
connect(): void;
|
||||||
/**
|
|
||||||
* Connects a session to the main thread inspector back-end. An exception will
|
|
||||||
* be thrown if this API was not called on a Worker thread.
|
|
||||||
* @since v12.11.0
|
|
||||||
*/
|
|
||||||
connectToMainThread(): void;
|
|
||||||
/**
|
/**
|
||||||
* Immediately close the session. All pending message callbacks will be called
|
* Immediately close the session. All pending message callbacks will be called
|
||||||
* with an error. `session.connect()` will need to be called to be able to send
|
* with an error. `session.connect()` will need to be called to be able to send
|
||||||
@ -2695,7 +2689,7 @@ declare module 'inspector' {
|
|||||||
prependOnceListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this;
|
prependOnceListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Activate inspector on host and port. Equivalent to `node --inspect=[[host:]port]`, but can be done programmatically after node has
|
* Activate inspector on host and port. Equivalent to`node --inspect=[[host:]port]`, but can be done programmatically after node has
|
||||||
* started.
|
* started.
|
||||||
*
|
*
|
||||||
* If wait is `true`, will block until a client has connected to the inspect port
|
* If wait is `true`, will block until a client has connected to the inspect port
|
||||||
@ -2717,12 +2711,12 @@ declare module 'inspector' {
|
|||||||
* ```console
|
* ```console
|
||||||
* $ node --inspect -p 'inspector.url()'
|
* $ node --inspect -p 'inspector.url()'
|
||||||
* Debugger listening on ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34
|
* Debugger listening on ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34
|
||||||
* For help see https://nodejs.org/en/docs/inspector
|
* For help, see: https://nodejs.org/en/docs/inspector
|
||||||
* ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34
|
* ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34
|
||||||
*
|
*
|
||||||
* $ node --inspect=localhost:3000 -p 'inspector.url()'
|
* $ node --inspect=localhost:3000 -p 'inspector.url()'
|
||||||
* Debugger listening on ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a
|
* Debugger listening on ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a
|
||||||
* For help see https://nodejs.org/en/docs/inspector
|
* For help, see: https://nodejs.org/en/docs/inspector
|
||||||
* ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a
|
* ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a
|
||||||
*
|
*
|
||||||
* $ node -p 'inspector.url()'
|
* $ node -p 'inspector.url()'
|
||||||
@ -2738,7 +2732,10 @@ declare module 'inspector' {
|
|||||||
*/
|
*/
|
||||||
function waitForDebugger(): void;
|
function waitForDebugger(): void;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The inspector module provides an API for interacting with the V8 inspector.
|
||||||
|
*/
|
||||||
declare module 'node:inspector' {
|
declare module 'node:inspector' {
|
||||||
import EventEmitter = require('inspector');
|
import inspector = require('inspector');
|
||||||
export = EventEmitter;
|
export = inspector;
|
||||||
}
|
}
|
||||||
|
39
node_modules/@types/node/net.d.ts
generated
vendored
39
node_modules/@types/node/net.d.ts
generated
vendored
@ -10,7 +10,7 @@
|
|||||||
* ```js
|
* ```js
|
||||||
* const net = require('net');
|
* const net = require('net');
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/net.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/net.js)
|
||||||
*/
|
*/
|
||||||
declare module 'net' {
|
declare module 'net' {
|
||||||
import * as stream from 'node:stream';
|
import * as stream from 'node:stream';
|
||||||
@ -285,6 +285,11 @@ declare module 'net' {
|
|||||||
* @since v0.5.10
|
* @since v0.5.10
|
||||||
*/
|
*/
|
||||||
readonly remotePort?: number | undefined;
|
readonly remotePort?: number | undefined;
|
||||||
|
/**
|
||||||
|
* The socket timeout in milliseconds as set by socket.setTimeout(). It is undefined if a timeout has not been set.
|
||||||
|
* @since v10.7.0
|
||||||
|
*/
|
||||||
|
readonly timeout?: number | undefined;
|
||||||
/**
|
/**
|
||||||
* Half-closes the socket. i.e., it sends a FIN packet. It is possible the
|
* Half-closes the socket. i.e., it sends a FIN packet. It is possible the
|
||||||
* server will still send some data.
|
* server will still send some data.
|
||||||
@ -645,7 +650,7 @@ declare module 'net' {
|
|||||||
*
|
*
|
||||||
* The server can be a TCP server or an `IPC` server, depending on what it `listen()` to.
|
* The server can be a TCP server or an `IPC` server, depending on what it `listen()` to.
|
||||||
*
|
*
|
||||||
* Here is an example of an TCP echo server which listens for connections
|
* Here is an example of a TCP echo server which listens for connections
|
||||||
* on port 8124:
|
* on port 8124:
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
@ -724,19 +729,39 @@ declare module 'net' {
|
|||||||
function createConnection(port: number, host?: string, connectionListener?: () => void): Socket;
|
function createConnection(port: number, host?: string, connectionListener?: () => void): Socket;
|
||||||
function createConnection(path: string, connectionListener?: () => void): Socket;
|
function createConnection(path: string, connectionListener?: () => void): Socket;
|
||||||
/**
|
/**
|
||||||
* Tests if input is an IP address. Returns `0` for invalid strings,
|
* Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4
|
||||||
* returns `4` for IP version 4 addresses, and returns `6` for IP version 6
|
* address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no leading zeroes. Otherwise, returns`0`.
|
||||||
* addresses.
|
*
|
||||||
|
* ```js
|
||||||
|
* net.isIP('::1'); // returns 6
|
||||||
|
* net.isIP('127.0.0.1'); // returns 4
|
||||||
|
* net.isIP('127.000.000.001'); // returns 0
|
||||||
|
* net.isIP('127.0.0.1/24'); // returns 0
|
||||||
|
* net.isIP('fhqwhgads'); // returns 0
|
||||||
|
* ```
|
||||||
* @since v0.3.0
|
* @since v0.3.0
|
||||||
*/
|
*/
|
||||||
function isIP(input: string): number;
|
function isIP(input: string): number;
|
||||||
/**
|
/**
|
||||||
* Returns `true` if input is a version 4 IP address, otherwise returns `false`.
|
* Returns `true` if `input` is an IPv4 address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no
|
||||||
|
* leading zeroes. Otherwise, returns `false`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* net.isIPv4('127.0.0.1'); // returns true
|
||||||
|
* net.isIPv4('127.000.000.001'); // returns false
|
||||||
|
* net.isIPv4('127.0.0.1/24'); // returns false
|
||||||
|
* net.isIPv4('fhqwhgads'); // returns false
|
||||||
|
* ```
|
||||||
* @since v0.3.0
|
* @since v0.3.0
|
||||||
*/
|
*/
|
||||||
function isIPv4(input: string): boolean;
|
function isIPv4(input: string): boolean;
|
||||||
/**
|
/**
|
||||||
* Returns `true` if input is a version 6 IP address, otherwise returns `false`.
|
* Returns `true` if `input` is an IPv6 address. Otherwise, returns `false`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* net.isIPv6('::1'); // returns true
|
||||||
|
* net.isIPv6('fhqwhgads'); // returns false
|
||||||
|
* ```
|
||||||
* @since v0.3.0
|
* @since v0.3.0
|
||||||
*/
|
*/
|
||||||
function isIPv6(input: string): boolean;
|
function isIPv6(input: string): boolean;
|
||||||
|
9
node_modules/@types/node/os.d.ts
generated
vendored
9
node_modules/@types/node/os.d.ts
generated
vendored
@ -5,7 +5,7 @@
|
|||||||
* ```js
|
* ```js
|
||||||
* const os = require('os');
|
* const os = require('os');
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/os.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/os.js)
|
||||||
*/
|
*/
|
||||||
declare module 'os' {
|
declare module 'os' {
|
||||||
interface CpuInfo {
|
interface CpuInfo {
|
||||||
@ -387,7 +387,7 @@ declare module 'os' {
|
|||||||
const EOL: string;
|
const EOL: string;
|
||||||
/**
|
/**
|
||||||
* Returns the operating system CPU architecture for which the Node.js binary was
|
* Returns the operating system CPU architecture for which the Node.js binary was
|
||||||
* compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, `'x32'`, and `'x64'`.
|
* compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, and `'x64'`.
|
||||||
*
|
*
|
||||||
* The return value is equivalent to `process.arch`.
|
* The return value is equivalent to `process.arch`.
|
||||||
* @since v0.5.0
|
* @since v0.5.0
|
||||||
@ -402,8 +402,9 @@ declare module 'os' {
|
|||||||
*/
|
*/
|
||||||
function version(): string;
|
function version(): string;
|
||||||
/**
|
/**
|
||||||
* Returns a string identifying the operating system platform. The value is set
|
* Returns a string identifying the operating system platform for which
|
||||||
* at compile time. Possible values are `'aix'`, `'darwin'`, `'freebsd'`,`'linux'`, `'openbsd'`, `'sunos'`, and `'win32'`.
|
* the Node.js binary was compiled. The value is set at compile time.
|
||||||
|
* Possible values are `'aix'`, `'darwin'`, `'freebsd'`,`'linux'`,`'openbsd'`, `'sunos'`, and `'win32'`.
|
||||||
*
|
*
|
||||||
* The return value is equivalent to `process.platform`.
|
* The return value is equivalent to `process.platform`.
|
||||||
*
|
*
|
||||||
|
11
node_modules/@types/node/package.json
generated
vendored
11
node_modules/@types/node/package.json
generated
vendored
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@types/node",
|
"name": "@types/node",
|
||||||
"version": "17.0.26",
|
"version": "18.0.0",
|
||||||
"description": "TypeScript definitions for Node.js",
|
"description": "TypeScript definitions for Node.js",
|
||||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -204,6 +204,11 @@
|
|||||||
"name": "wafuwafu13",
|
"name": "wafuwafu13",
|
||||||
"url": "https://github.com/wafuwafu13",
|
"url": "https://github.com/wafuwafu13",
|
||||||
"githubUsername": "wafuwafu13"
|
"githubUsername": "wafuwafu13"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Matteo Collina",
|
||||||
|
"url": "https://github.com/mcollina",
|
||||||
|
"githubUsername": "mcollina"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"main": "",
|
"main": "",
|
||||||
@ -215,6 +220,6 @@
|
|||||||
},
|
},
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"typesPublisherContentHash": "532e2a9be1446f8b4aff478a81907e04d5c3f722dd7b24bdffa7da895c7f5a1c",
|
"typesPublisherContentHash": "7b0d8dcde4896c79ad74f0d57a24996d6812633e45ed2abd06201f1b078dd9db",
|
||||||
"typeScriptVersion": "3.9"
|
"typeScriptVersion": "4.0"
|
||||||
}
|
}
|
2
node_modules/@types/node/path.d.ts
generated
vendored
2
node_modules/@types/node/path.d.ts
generated
vendored
@ -13,7 +13,7 @@ declare module 'path/win32' {
|
|||||||
* ```js
|
* ```js
|
||||||
* const path = require('path');
|
* const path = require('path');
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/path.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/path.js)
|
||||||
*/
|
*/
|
||||||
declare module 'path' {
|
declare module 'path' {
|
||||||
namespace path {
|
namespace path {
|
||||||
|
12
node_modules/@types/node/perf_hooks.d.ts
generated
vendored
12
node_modules/@types/node/perf_hooks.d.ts
generated
vendored
@ -26,7 +26,7 @@
|
|||||||
* performance.measure('A to B', 'A', 'B');
|
* performance.measure('A to B', 'A', 'B');
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/perf_hooks.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/perf_hooks.js)
|
||||||
*/
|
*/
|
||||||
declare module 'perf_hooks' {
|
declare module 'perf_hooks' {
|
||||||
import { AsyncResource } from 'node:async_hooks';
|
import { AsyncResource } from 'node:async_hooks';
|
||||||
@ -270,6 +270,9 @@ declare module 'perf_hooks' {
|
|||||||
* * }
|
* * }
|
||||||
* * ]
|
* * ]
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* performance.clearMarks();
|
||||||
|
* performance.clearMeasures();
|
||||||
* observer.disconnect();
|
* observer.disconnect();
|
||||||
* });
|
* });
|
||||||
* obs.observe({ type: 'mark' });
|
* obs.observe({ type: 'mark' });
|
||||||
@ -317,6 +320,9 @@ declare module 'perf_hooks' {
|
|||||||
* * ]
|
* * ]
|
||||||
*
|
*
|
||||||
* console.log(perfObserverList.getEntriesByName('test', 'measure')); // []
|
* console.log(perfObserverList.getEntriesByName('test', 'measure')); // []
|
||||||
|
*
|
||||||
|
* performance.clearMarks();
|
||||||
|
* performance.clearMeasures();
|
||||||
* observer.disconnect();
|
* observer.disconnect();
|
||||||
* });
|
* });
|
||||||
* obs.observe({ entryTypes: ['mark', 'measure'] });
|
* obs.observe({ entryTypes: ['mark', 'measure'] });
|
||||||
@ -355,6 +361,8 @@ declare module 'perf_hooks' {
|
|||||||
* * }
|
* * }
|
||||||
* * ]
|
* * ]
|
||||||
*
|
*
|
||||||
|
* performance.clearMarks();
|
||||||
|
* performance.clearMeasures();
|
||||||
* observer.disconnect();
|
* observer.disconnect();
|
||||||
* });
|
* });
|
||||||
* obs.observe({ type: 'mark' });
|
* obs.observe({ type: 'mark' });
|
||||||
@ -384,7 +392,7 @@ declare module 'perf_hooks' {
|
|||||||
* } = require('perf_hooks');
|
* } = require('perf_hooks');
|
||||||
*
|
*
|
||||||
* const obs = new PerformanceObserver((list, observer) => {
|
* const obs = new PerformanceObserver((list, observer) => {
|
||||||
* // Called three times synchronously. `list` contains one item.
|
* // Called once asynchronously. `list` contains three items.
|
||||||
* });
|
* });
|
||||||
* obs.observe({ type: 'mark' });
|
* obs.observe({ type: 'mark' });
|
||||||
*
|
*
|
||||||
|
27
node_modules/@types/node/process.d.ts
generated
vendored
27
node_modules/@types/node/process.d.ts
generated
vendored
@ -49,6 +49,7 @@ declare module 'process' {
|
|||||||
openssl: string;
|
openssl: string;
|
||||||
}
|
}
|
||||||
type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';
|
type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';
|
||||||
|
type Architecture = 'arm' | 'arm64' | 'ia32' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 's390' | 's390x' | 'x64';
|
||||||
type Signals =
|
type Signals =
|
||||||
| 'SIGABRT'
|
| 'SIGABRT'
|
||||||
| 'SIGALRM'
|
| 'SIGALRM'
|
||||||
@ -641,7 +642,7 @@ declare module 'process' {
|
|||||||
* Android).
|
* Android).
|
||||||
* @since v0.1.31
|
* @since v0.1.31
|
||||||
*/
|
*/
|
||||||
getgid(): number;
|
getgid?: () => number;
|
||||||
/**
|
/**
|
||||||
* The `process.setgid()` method sets the group identity of the process. (See [`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a
|
* The `process.setgid()` method sets the group identity of the process. (See [`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a
|
||||||
* numeric ID or a group name
|
* numeric ID or a group name
|
||||||
@ -668,7 +669,7 @@ declare module 'process' {
|
|||||||
* @since v0.1.31
|
* @since v0.1.31
|
||||||
* @param id The group name or ID
|
* @param id The group name or ID
|
||||||
*/
|
*/
|
||||||
setgid(id: number | string): void;
|
setgid?: (id: number | string) => void;
|
||||||
/**
|
/**
|
||||||
* The `process.getuid()` method returns the numeric user identity of the process.
|
* The `process.getuid()` method returns the numeric user identity of the process.
|
||||||
* (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).)
|
* (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).)
|
||||||
@ -685,7 +686,7 @@ declare module 'process' {
|
|||||||
* Android).
|
* Android).
|
||||||
* @since v0.1.28
|
* @since v0.1.28
|
||||||
*/
|
*/
|
||||||
getuid(): number;
|
getuid?: () => number;
|
||||||
/**
|
/**
|
||||||
* The `process.setuid(id)` method sets the user identity of the process. (See [`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a
|
* The `process.setuid(id)` method sets the user identity of the process. (See [`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a
|
||||||
* numeric ID or a username string.
|
* numeric ID or a username string.
|
||||||
@ -711,7 +712,7 @@ declare module 'process' {
|
|||||||
* This feature is not available in `Worker` threads.
|
* This feature is not available in `Worker` threads.
|
||||||
* @since v0.1.28
|
* @since v0.1.28
|
||||||
*/
|
*/
|
||||||
setuid(id: number | string): void;
|
setuid?: (id: number | string) => void;
|
||||||
/**
|
/**
|
||||||
* The `process.geteuid()` method returns the numerical effective user identity of
|
* The `process.geteuid()` method returns the numerical effective user identity of
|
||||||
* the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).)
|
* the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).)
|
||||||
@ -728,7 +729,7 @@ declare module 'process' {
|
|||||||
* Android).
|
* Android).
|
||||||
* @since v2.0.0
|
* @since v2.0.0
|
||||||
*/
|
*/
|
||||||
geteuid(): number;
|
geteuid?: () => number;
|
||||||
/**
|
/**
|
||||||
* The `process.seteuid()` method sets the effective user identity of the process.
|
* The `process.seteuid()` method sets the effective user identity of the process.
|
||||||
* (See [`seteuid(2)`](http://man7.org/linux/man-pages/man2/seteuid.2.html).) The `id` can be passed as either a numeric ID or a username
|
* (See [`seteuid(2)`](http://man7.org/linux/man-pages/man2/seteuid.2.html).) The `id` can be passed as either a numeric ID or a username
|
||||||
@ -755,7 +756,7 @@ declare module 'process' {
|
|||||||
* @since v2.0.0
|
* @since v2.0.0
|
||||||
* @param id A user name or ID
|
* @param id A user name or ID
|
||||||
*/
|
*/
|
||||||
seteuid(id: number | string): void;
|
seteuid?: (id: number | string) => void;
|
||||||
/**
|
/**
|
||||||
* The `process.getegid()` method returns the numerical effective group identity
|
* The `process.getegid()` method returns the numerical effective group identity
|
||||||
* of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).)
|
* of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).)
|
||||||
@ -772,7 +773,7 @@ declare module 'process' {
|
|||||||
* Android).
|
* Android).
|
||||||
* @since v2.0.0
|
* @since v2.0.0
|
||||||
*/
|
*/
|
||||||
getegid(): number;
|
getegid?: () => number;
|
||||||
/**
|
/**
|
||||||
* The `process.setegid()` method sets the effective group identity of the process.
|
* The `process.setegid()` method sets the effective group identity of the process.
|
||||||
* (See [`setegid(2)`](http://man7.org/linux/man-pages/man2/setegid.2.html).) The `id` can be passed as either a numeric ID or a group
|
* (See [`setegid(2)`](http://man7.org/linux/man-pages/man2/setegid.2.html).) The `id` can be passed as either a numeric ID or a group
|
||||||
@ -799,7 +800,7 @@ declare module 'process' {
|
|||||||
* @since v2.0.0
|
* @since v2.0.0
|
||||||
* @param id A group name or ID
|
* @param id A group name or ID
|
||||||
*/
|
*/
|
||||||
setegid(id: number | string): void;
|
setegid?: (id: number | string) => void;
|
||||||
/**
|
/**
|
||||||
* The `process.getgroups()` method returns an array with the supplementary group
|
* The `process.getgroups()` method returns an array with the supplementary group
|
||||||
* IDs. POSIX leaves it unspecified if the effective group ID is included but
|
* IDs. POSIX leaves it unspecified if the effective group ID is included but
|
||||||
@ -817,7 +818,7 @@ declare module 'process' {
|
|||||||
* Android).
|
* Android).
|
||||||
* @since v0.9.4
|
* @since v0.9.4
|
||||||
*/
|
*/
|
||||||
getgroups(): number[];
|
getgroups?: () => number[];
|
||||||
/**
|
/**
|
||||||
* The `process.setgroups()` method sets the supplementary group IDs for the
|
* The `process.setgroups()` method sets the supplementary group IDs for the
|
||||||
* Node.js process. This is a privileged operation that requires the Node.js
|
* Node.js process. This is a privileged operation that requires the Node.js
|
||||||
@ -843,7 +844,7 @@ declare module 'process' {
|
|||||||
* This feature is not available in `Worker` threads.
|
* This feature is not available in `Worker` threads.
|
||||||
* @since v0.9.4
|
* @since v0.9.4
|
||||||
*/
|
*/
|
||||||
setgroups(groups: ReadonlyArray<string | number>): void;
|
setgroups?: (groups: ReadonlyArray<string | number>) => void;
|
||||||
/**
|
/**
|
||||||
* The `process.setUncaughtExceptionCaptureCallback()` function sets a function
|
* The `process.setUncaughtExceptionCaptureCallback()` function sets a function
|
||||||
* that will be invoked when an uncaught exception occurs, which will receive the
|
* that will be invoked when an uncaught exception occurs, which will receive the
|
||||||
@ -1040,7 +1041,7 @@ declare module 'process' {
|
|||||||
title: string;
|
title: string;
|
||||||
/**
|
/**
|
||||||
* The operating system CPU architecture for which the Node.js binary was compiled.
|
* The operating system CPU architecture for which the Node.js binary was compiled.
|
||||||
* Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`,`'ppc64'`, `'s390'`, `'s390x'`, `'x32'`, and `'x64'`.
|
* Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`,`'ppc64'`, `'s390'`, `'s390x'`, and `'x64'`.
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* import { arch } from 'process';
|
* import { arch } from 'process';
|
||||||
@ -1049,10 +1050,10 @@ declare module 'process' {
|
|||||||
* ```
|
* ```
|
||||||
* @since v0.5.0
|
* @since v0.5.0
|
||||||
*/
|
*/
|
||||||
readonly arch: string;
|
readonly arch: Architecture;
|
||||||
/**
|
/**
|
||||||
* The `process.platform` property returns a string identifying the operating
|
* The `process.platform` property returns a string identifying the operating
|
||||||
* system platform on which the Node.js process is running.
|
* system platform for which the Node.js binary was compiled.
|
||||||
*
|
*
|
||||||
* Currently possible values are:
|
* Currently possible values are:
|
||||||
*
|
*
|
||||||
|
2
node_modules/@types/node/punycode.d.ts
generated
vendored
2
node_modules/@types/node/punycode.d.ts
generated
vendored
@ -24,7 +24,7 @@
|
|||||||
* made available to developers as a convenience. Fixes or other modifications to
|
* made available to developers as a convenience. Fixes or other modifications to
|
||||||
* the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project.
|
* the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project.
|
||||||
* @deprecated Since v7.0.0 - Deprecated
|
* @deprecated Since v7.0.0 - Deprecated
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/punycode.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/punycode.js)
|
||||||
*/
|
*/
|
||||||
declare module 'punycode' {
|
declare module 'punycode' {
|
||||||
/**
|
/**
|
||||||
|
2
node_modules/@types/node/querystring.d.ts
generated
vendored
2
node_modules/@types/node/querystring.d.ts
generated
vendored
@ -9,7 +9,7 @@
|
|||||||
* The `querystring` API is considered Legacy. While it is still maintained,
|
* The `querystring` API is considered Legacy. While it is still maintained,
|
||||||
* new code should use the `URLSearchParams` API instead.
|
* new code should use the `URLSearchParams` API instead.
|
||||||
* @deprecated Legacy
|
* @deprecated Legacy
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/querystring.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/querystring.js)
|
||||||
*/
|
*/
|
||||||
declare module 'querystring' {
|
declare module 'querystring' {
|
||||||
interface StringifyOptions {
|
interface StringifyOptions {
|
||||||
|
4
node_modules/@types/node/readline.d.ts
generated
vendored
4
node_modules/@types/node/readline.d.ts
generated
vendored
@ -17,7 +17,7 @@
|
|||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* import * as readline from 'node:readline/promises';
|
* import * as readline from 'node:readline/promises';
|
||||||
* import { stdin as input, stdout as output } from 'process';
|
* import { stdin as input, stdout as output } from 'node:process';
|
||||||
*
|
*
|
||||||
* const rl = readline.createInterface({ input, output });
|
* const rl = readline.createInterface({ input, output });
|
||||||
*
|
*
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* Once this code is invoked, the Node.js application will not terminate until the`readline.Interface` is closed because the interface waits for data to be
|
* Once this code is invoked, the Node.js application will not terminate until the`readline.Interface` is closed because the interface waits for data to be
|
||||||
* received on the `input` stream.
|
* received on the `input` stream.
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/readline.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/readline.js)
|
||||||
*/
|
*/
|
||||||
declare module 'readline' {
|
declare module 'readline' {
|
||||||
import { Abortable, EventEmitter } from 'node:events';
|
import { Abortable, EventEmitter } from 'node:events';
|
||||||
|
4
node_modules/@types/node/repl.d.ts
generated
vendored
4
node_modules/@types/node/repl.d.ts
generated
vendored
@ -6,7 +6,7 @@
|
|||||||
* ```js
|
* ```js
|
||||||
* const repl = require('repl');
|
* const repl = require('repl');
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/repl.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/repl.js)
|
||||||
*/
|
*/
|
||||||
declare module 'repl' {
|
declare module 'repl' {
|
||||||
import { Interface, Completer, AsyncCompleter } from 'node:readline';
|
import { Interface, Completer, AsyncCompleter } from 'node:readline';
|
||||||
@ -277,7 +277,7 @@ declare module 'repl' {
|
|||||||
* Goodbye!
|
* Goodbye!
|
||||||
* ```
|
* ```
|
||||||
* @since v0.3.0
|
* @since v0.3.0
|
||||||
* @param keyword The command keyword (*without* a leading `.` character).
|
* @param keyword The command keyword (_without_ a leading `.` character).
|
||||||
* @param cmd The function to invoke when the command is processed.
|
* @param cmd The function to invoke when the command is processed.
|
||||||
*/
|
*/
|
||||||
defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void;
|
defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void;
|
||||||
|
80
node_modules/@types/node/stream.d.ts
generated
vendored
80
node_modules/@types/node/stream.d.ts
generated
vendored
@ -14,12 +14,13 @@
|
|||||||
*
|
*
|
||||||
* The `stream` module is useful for creating new types of stream instances. It is
|
* The `stream` module is useful for creating new types of stream instances. It is
|
||||||
* usually not necessary to use the `stream` module to consume streams.
|
* usually not necessary to use the `stream` module to consume streams.
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/stream.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/stream.js)
|
||||||
*/
|
*/
|
||||||
declare module 'stream' {
|
declare module 'stream' {
|
||||||
import { EventEmitter, Abortable } from 'node:events';
|
import { EventEmitter, Abortable } from 'node:events';
|
||||||
import * as streamPromises from 'node:stream/promises';
|
import * as streamPromises from 'node:stream/promises';
|
||||||
import * as streamConsumers from 'node:stream/consumers';
|
import * as streamConsumers from 'node:stream/consumers';
|
||||||
|
import * as streamWeb from 'node:stream/web';
|
||||||
class internal extends EventEmitter {
|
class internal extends EventEmitter {
|
||||||
pipe<T extends NodeJS.WritableStream>(
|
pipe<T extends NodeJS.WritableStream>(
|
||||||
destination: T,
|
destination: T,
|
||||||
@ -52,11 +53,23 @@ declare module 'stream' {
|
|||||||
* A utility method for creating Readable Streams out of iterators.
|
* A utility method for creating Readable Streams out of iterators.
|
||||||
*/
|
*/
|
||||||
static from(iterable: Iterable<any> | AsyncIterable<any>, options?: ReadableOptions): Readable;
|
static from(iterable: Iterable<any> | AsyncIterable<any>, options?: ReadableOptions): Readable;
|
||||||
|
/**
|
||||||
|
* A utility method for creating a `Readable` from a web `ReadableStream`.
|
||||||
|
* @since v17.0.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
static fromWeb(readableStream: streamWeb.ReadableStream, options?: Pick<ReadableOptions, 'encoding' | 'highWaterMark' | 'objectMode' | 'signal'>): Readable;
|
||||||
/**
|
/**
|
||||||
* Returns whether the stream has been read from or cancelled.
|
* Returns whether the stream has been read from or cancelled.
|
||||||
* @since v16.8.0
|
* @since v16.8.0
|
||||||
*/
|
*/
|
||||||
static isDisturbed(stream: Readable | NodeJS.ReadableStream): boolean;
|
static isDisturbed(stream: Readable | NodeJS.ReadableStream): boolean;
|
||||||
|
/**
|
||||||
|
* A utility method for creating a web `ReadableStream` from a `Readable`.
|
||||||
|
* @since v17.0.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
static toWeb(streamReadable: Readable): streamWeb.ReadableStream;
|
||||||
/**
|
/**
|
||||||
* Returns whether the stream was destroyed or errored before emitting `'end'`.
|
* Returns whether the stream was destroyed or errored before emitting `'end'`.
|
||||||
* @since v16.8.0
|
* @since v16.8.0
|
||||||
@ -110,16 +123,16 @@ declare module 'stream' {
|
|||||||
readonly readableObjectMode: boolean;
|
readonly readableObjectMode: boolean;
|
||||||
/**
|
/**
|
||||||
* Is `true` after `readable.destroy()` has been called.
|
* Is `true` after `readable.destroy()` has been called.
|
||||||
* @since v8.0.0
|
* @since v18.0.0
|
||||||
*/
|
*/
|
||||||
destroyed: boolean;
|
destroyed: boolean;
|
||||||
constructor(opts?: ReadableOptions);
|
constructor(opts?: ReadableOptions);
|
||||||
_construct?(callback: (error?: Error | null) => void): void;
|
_construct?(callback: (error?: Error | null) => void): void;
|
||||||
_read(size: number): void;
|
_read(size: number): void;
|
||||||
/**
|
/**
|
||||||
* The `readable.read()` method pulls some data out of the internal buffer and
|
* The `readable.read()` method reads data out of the internal buffer and
|
||||||
* returns it. If no data available to be read, `null` is returned. By default,
|
* returns it. If no data is available to be read, `null` is returned. By default,
|
||||||
* the data will be returned as a `Buffer` object unless an encoding has been
|
* the data is returned as a `Buffer` object unless an encoding has been
|
||||||
* specified using the `readable.setEncoding()` method or the stream is operating
|
* specified using the `readable.setEncoding()` method or the stream is operating
|
||||||
* in object mode.
|
* in object mode.
|
||||||
*
|
*
|
||||||
@ -334,7 +347,7 @@ declare module 'stream' {
|
|||||||
* let chunk;
|
* let chunk;
|
||||||
* while (null !== (chunk = stream.read())) {
|
* while (null !== (chunk = stream.read())) {
|
||||||
* const str = decoder.write(chunk);
|
* const str = decoder.write(chunk);
|
||||||
* if (str.match(/\n\n/)) {
|
* if (str.includes('\n\n')) {
|
||||||
* // Found the header boundary.
|
* // Found the header boundary.
|
||||||
* const split = str.split(/\n\n/);
|
* const split = str.split(/\n\n/);
|
||||||
* header += split.shift();
|
* header += split.shift();
|
||||||
@ -347,10 +360,10 @@ declare module 'stream' {
|
|||||||
* stream.unshift(buf);
|
* stream.unshift(buf);
|
||||||
* // Now the body of the message can be read from the stream.
|
* // Now the body of the message can be read from the stream.
|
||||||
* callback(null, header, stream);
|
* callback(null, header, stream);
|
||||||
* } else {
|
* return;
|
||||||
* // Still reading the header.
|
|
||||||
* header += str;
|
|
||||||
* }
|
* }
|
||||||
|
* // Still reading the header.
|
||||||
|
* header += str;
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
@ -567,7 +580,7 @@ declare module 'stream' {
|
|||||||
* While a stream is not draining, calls to `write()` will buffer `chunk`, and
|
* While a stream is not draining, calls to `write()` will buffer `chunk`, and
|
||||||
* return false. Once all currently buffered chunks are drained (accepted for
|
* return false. Once all currently buffered chunks are drained (accepted for
|
||||||
* delivery by the operating system), the `'drain'` event will be emitted.
|
* delivery by the operating system), the `'drain'` event will be emitted.
|
||||||
* It is recommended that once `write()` returns false, no more chunks be written
|
* Once `write()` returns false, do not write more chunks
|
||||||
* until the `'drain'` event is emitted. While calling `write()` on a stream that
|
* until the `'drain'` event is emitted. While calling `write()` on a stream that
|
||||||
* is not draining is allowed, Node.js will buffer all written chunks until
|
* is not draining is allowed, Node.js will buffer all written chunks until
|
||||||
* maximum memory usage occurs, at which point it will abort unconditionally.
|
* maximum memory usage occurs, at which point it will abort unconditionally.
|
||||||
@ -661,8 +674,8 @@ declare module 'stream' {
|
|||||||
* The `writable.uncork()` method flushes all data buffered since {@link cork} was called.
|
* The `writable.uncork()` method flushes all data buffered since {@link cork} was called.
|
||||||
*
|
*
|
||||||
* When using `writable.cork()` and `writable.uncork()` to manage the buffering
|
* When using `writable.cork()` and `writable.uncork()` to manage the buffering
|
||||||
* of writes to a stream, it is recommended that calls to `writable.uncork()` be
|
* of writes to a stream, defer calls to `writable.uncork()` using`process.nextTick()`. Doing so allows batching of all`writable.write()` calls that occur within a given Node.js event
|
||||||
* deferred using `process.nextTick()`. Doing so allows batching of all`writable.write()` calls that occur within a given Node.js event loop phase.
|
* loop phase.
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* stream.cork();
|
* stream.cork();
|
||||||
@ -1106,7 +1119,7 @@ declare module 'stream' {
|
|||||||
* async function run() {
|
* async function run() {
|
||||||
* await pipeline(
|
* await pipeline(
|
||||||
* fs.createReadStream('lowercase.txt'),
|
* fs.createReadStream('lowercase.txt'),
|
||||||
* async function* (source, signal) {
|
* async function* (source, { signal }) {
|
||||||
* source.setEncoding('utf8'); // Work with strings rather than `Buffer`s.
|
* source.setEncoding('utf8'); // Work with strings rather than `Buffer`s.
|
||||||
* for await (const chunk of source) {
|
* for await (const chunk of source) {
|
||||||
* yield await processChunk(chunk, { signal });
|
* yield await processChunk(chunk, { signal });
|
||||||
@ -1130,7 +1143,7 @@ declare module 'stream' {
|
|||||||
*
|
*
|
||||||
* async function run() {
|
* async function run() {
|
||||||
* await pipeline(
|
* await pipeline(
|
||||||
* async function * (signal) {
|
* async function* ({ signal }) {
|
||||||
* await someLongRunningfn({ signal });
|
* await someLongRunningfn({ signal });
|
||||||
* yield 'asd';
|
* yield 'asd';
|
||||||
* },
|
* },
|
||||||
@ -1149,7 +1162,31 @@ declare module 'stream' {
|
|||||||
*
|
*
|
||||||
* `stream.pipeline()` leaves dangling event listeners on the streams
|
* `stream.pipeline()` leaves dangling event listeners on the streams
|
||||||
* after the `callback` has been invoked. In the case of reuse of streams after
|
* after the `callback` has been invoked. In the case of reuse of streams after
|
||||||
* failure, this can cause event listener leaks and swallowed errors.
|
* failure, this can cause event listener leaks and swallowed errors. If the last
|
||||||
|
* stream is readable, dangling event listeners will be removed so that the last
|
||||||
|
* stream can be consumed later.
|
||||||
|
*
|
||||||
|
* `stream.pipeline()` closes all the streams when an error is raised.
|
||||||
|
* The `IncomingRequest` usage with `pipeline` could lead to an unexpected behavior
|
||||||
|
* once it would destroy the socket without sending the expected response.
|
||||||
|
* See the example below:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const fs = require('fs');
|
||||||
|
* const http = require('http');
|
||||||
|
* const { pipeline } = require('stream');
|
||||||
|
*
|
||||||
|
* const server = http.createServer((req, res) => {
|
||||||
|
* const fileStream = fs.createReadStream('./fileNotExist.txt');
|
||||||
|
* pipeline(fileStream, res, (err) => {
|
||||||
|
* if (err) {
|
||||||
|
* console.log(err); // No such file
|
||||||
|
* // this message can't be sent once `pipeline` already destroyed the socket
|
||||||
|
* return res.end('error!!!');
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
* @since v10.0.0
|
* @since v10.0.0
|
||||||
* @param callback Called when the pipeline is fully done.
|
* @param callback Called when the pipeline is fully done.
|
||||||
*/
|
*/
|
||||||
@ -1238,6 +1275,19 @@ declare module 'stream' {
|
|||||||
ref(): void;
|
ref(): void;
|
||||||
unref(): void;
|
unref(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the stream has encountered an error.
|
||||||
|
* @since v17.3.0
|
||||||
|
*/
|
||||||
|
function isErrored(stream: Readable | Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the stream is readable.
|
||||||
|
* @since v17.4.0
|
||||||
|
*/
|
||||||
|
function isReadable(stream: Readable | NodeJS.ReadableStream): boolean;
|
||||||
|
|
||||||
const promises: typeof streamPromises;
|
const promises: typeof streamPromises;
|
||||||
const consumers: typeof streamConsumers;
|
const consumers: typeof streamConsumers;
|
||||||
}
|
}
|
||||||
|
2
node_modules/@types/node/string_decoder.d.ts
generated
vendored
2
node_modules/@types/node/string_decoder.d.ts
generated
vendored
@ -36,7 +36,7 @@
|
|||||||
* decoder.write(Buffer.from([0x82]));
|
* decoder.write(Buffer.from([0x82]));
|
||||||
* console.log(decoder.end(Buffer.from([0xAC])));
|
* console.log(decoder.end(Buffer.from([0xAC])));
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/string_decoder.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/string_decoder.js)
|
||||||
*/
|
*/
|
||||||
declare module 'string_decoder' {
|
declare module 'string_decoder' {
|
||||||
class StringDecoder {
|
class StringDecoder {
|
||||||
|
142
node_modules/@types/node/test.d.ts
generated
vendored
Executable file
142
node_modules/@types/node/test.d.ts
generated
vendored
Executable file
@ -0,0 +1,142 @@
|
|||||||
|
/**
|
||||||
|
* The `node:test` module provides a standalone testing module.
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/test.js)
|
||||||
|
*/
|
||||||
|
declare module 'node:test' {
|
||||||
|
/**
|
||||||
|
* The `test()` function is the value imported from the test module. Each invocation of this
|
||||||
|
* function results in the creation of a test point in the TAP output.
|
||||||
|
*
|
||||||
|
* The {@link TestContext} object passed to the fn argument can be used to perform actions
|
||||||
|
* related to the current test. Examples include skipping the test, adding additional TAP
|
||||||
|
* diagnostic information, or creating subtests.
|
||||||
|
*
|
||||||
|
* `test()` returns a {@link Promise} that resolves once the test completes. The return value
|
||||||
|
* can usually be discarded for top level tests. However, the return value from subtests should
|
||||||
|
* be used to prevent the parent test from finishing first and cancelling the subtest as shown
|
||||||
|
* in the following example.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* test('top level test', async (t) => {
|
||||||
|
* // The setTimeout() in the following subtest would cause it to outlive its
|
||||||
|
* // parent test if 'await' is removed on the next line. Once the parent test
|
||||||
|
* // completes, it will cancel any outstanding subtests.
|
||||||
|
* await t.test('longer running subtest', async (t) => {
|
||||||
|
* return new Promise((resolve, reject) => {
|
||||||
|
* setTimeout(resolve, 1000);
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v18.0.0
|
||||||
|
* @param name The name of the test, which is displayed when reporting test results.
|
||||||
|
* Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
|
||||||
|
* @param options Configuration options for the test
|
||||||
|
* @param fn The function under test. This first argument to this function is a
|
||||||
|
* {@link TestContext} object. If the test uses callbacks, the callback function is
|
||||||
|
* passed as the second argument. Default: A no-op function.
|
||||||
|
* @returns A {@link Promise} resolved with `undefined` once the test completes.
|
||||||
|
*/
|
||||||
|
function test(name?: string, fn?: TestFn): Promise<void>;
|
||||||
|
function test(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
||||||
|
function test(options?: TestOptions, fn?: TestFn): Promise<void>;
|
||||||
|
function test(fn?: TestFn): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of a function under test. This first argument to this function is a
|
||||||
|
* {@link TestContext} object. If the test uses callbacks, the callback function is passed as
|
||||||
|
* the second argument.
|
||||||
|
*/
|
||||||
|
type TestFn = ((t: TestContext, done: (result?: any) => void) => any);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An instance of `TestContext` is passed to each test function in order to interact with the
|
||||||
|
* test runner. However, the `TestContext` constructor is not exposed as part of the API.
|
||||||
|
* @since v18.0.0
|
||||||
|
*/
|
||||||
|
interface TestContext {
|
||||||
|
/**
|
||||||
|
* This function is used to write TAP diagnostics to the output. Any diagnostic information is
|
||||||
|
* included at the end of the test's results. This function does not return a value.
|
||||||
|
* @param message Message to be displayed as a TAP diagnostic.
|
||||||
|
* @since v18.0.0
|
||||||
|
*/
|
||||||
|
diagnostic(message: string): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If `shouldRunOnlyTests` is truthy, the test context will only run tests that have the `only`
|
||||||
|
* option set. Otherwise, all tests are run. If Node.js was not started with the `--test-only`
|
||||||
|
* command-line option, this function is a no-op.
|
||||||
|
* @param shouldRunOnlyTests Whether or not to run `only` tests.
|
||||||
|
* @since v18.0.0
|
||||||
|
*/
|
||||||
|
runOnly(shouldRunOnlyTests: boolean): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function causes the test's output to indicate the test as skipped. If `message` is
|
||||||
|
* provided, it is included in the TAP output. Calling `skip()` does not terminate execution of
|
||||||
|
* the test function. This function does not return a value.
|
||||||
|
* @param message Optional skip message to be displayed in TAP output.
|
||||||
|
* @since v18.0.0
|
||||||
|
*/
|
||||||
|
skip(message?: string): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function adds a `TODO` directive to the test's output. If `message` is provided, it is
|
||||||
|
* included in the TAP output. Calling `todo()` does not terminate execution of the test
|
||||||
|
* function. This function does not return a value.
|
||||||
|
* @param message Optional `TODO` message to be displayed in TAP output.
|
||||||
|
* @since v18.0.0
|
||||||
|
*/
|
||||||
|
todo(message?: string): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is used to create subtests under the current test. This function behaves in
|
||||||
|
* the same fashion as the top level {@link test} function.
|
||||||
|
* @since v18.0.0
|
||||||
|
* @param name The name of the test, which is displayed when reporting test results.
|
||||||
|
* Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
|
||||||
|
* @param options Configuration options for the test
|
||||||
|
* @param fn The function under test. This first argument to this function is a
|
||||||
|
* {@link TestContext} object. If the test uses callbacks, the callback function is
|
||||||
|
* passed as the second argument. Default: A no-op function.
|
||||||
|
* @returns A {@link Promise} resolved with `undefined` once the test completes.
|
||||||
|
*/
|
||||||
|
test: typeof test;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TestOptions {
|
||||||
|
/**
|
||||||
|
* The number of tests that can be run at the same time. If unspecified, subtests inherit this
|
||||||
|
* value from their parent.
|
||||||
|
* @default 1
|
||||||
|
*/
|
||||||
|
concurrency?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If truthy, and the test context is configured to run `only` tests, then this test will be
|
||||||
|
* run. Otherwise, the test is skipped.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
only?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If truthy, the test is skipped. If a string is provided, that string is displayed in the
|
||||||
|
* test results as the reason for skipping the test.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
skip?: boolean | string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If truthy, the test marked as `TODO`. If a string is provided, that string is displayed in
|
||||||
|
* the test results as the reason why the test is `TODO`.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
todo?: boolean | string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
test as default,
|
||||||
|
test,
|
||||||
|
};
|
||||||
|
}
|
8
node_modules/@types/node/timers.d.ts
generated
vendored
8
node_modules/@types/node/timers.d.ts
generated
vendored
@ -6,7 +6,7 @@
|
|||||||
* The timer functions within Node.js implement a similar API as the timers API
|
* The timer functions within Node.js implement a similar API as the timers API
|
||||||
* provided by Web Browsers but use a different internal implementation that is
|
* provided by Web Browsers but use a different internal implementation that is
|
||||||
* built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
|
* built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/timers.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/timers.js)
|
||||||
*/
|
*/
|
||||||
declare module 'timers' {
|
declare module 'timers' {
|
||||||
import { Abortable } from 'node:events';
|
import { Abortable } from 'node:events';
|
||||||
@ -69,7 +69,7 @@ declare module 'timers' {
|
|||||||
namespace setTimeout {
|
namespace setTimeout {
|
||||||
const __promisify__: typeof setTimeoutPromise;
|
const __promisify__: typeof setTimeoutPromise;
|
||||||
}
|
}
|
||||||
function clearTimeout(timeoutId: NodeJS.Timeout): void;
|
function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void;
|
||||||
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
|
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
|
||||||
// util.promisify no rest args compability
|
// util.promisify no rest args compability
|
||||||
// tslint:disable-next-line void-return
|
// tslint:disable-next-line void-return
|
||||||
@ -77,7 +77,7 @@ declare module 'timers' {
|
|||||||
namespace setInterval {
|
namespace setInterval {
|
||||||
const __promisify__: typeof setIntervalPromise;
|
const __promisify__: typeof setIntervalPromise;
|
||||||
}
|
}
|
||||||
function clearInterval(intervalId: NodeJS.Timeout): void;
|
function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void;
|
||||||
function setImmediate<TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate;
|
function setImmediate<TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate;
|
||||||
// util.promisify no rest args compability
|
// util.promisify no rest args compability
|
||||||
// tslint:disable-next-line void-return
|
// tslint:disable-next-line void-return
|
||||||
@ -85,7 +85,7 @@ declare module 'timers' {
|
|||||||
namespace setImmediate {
|
namespace setImmediate {
|
||||||
const __promisify__: typeof setImmediatePromise;
|
const __promisify__: typeof setImmediatePromise;
|
||||||
}
|
}
|
||||||
function clearImmediate(immediateId: NodeJS.Immediate): void;
|
function clearImmediate(immediateId: NodeJS.Immediate | undefined): void;
|
||||||
function queueMicrotask(callback: () => void): void;
|
function queueMicrotask(callback: () => void): void;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
28
node_modules/@types/node/tls.d.ts
generated
vendored
28
node_modules/@types/node/tls.d.ts
generated
vendored
@ -6,7 +6,7 @@
|
|||||||
* ```js
|
* ```js
|
||||||
* const tls = require('tls');
|
* const tls = require('tls');
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/tls.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/tls.js)
|
||||||
*/
|
*/
|
||||||
declare module 'tls' {
|
declare module 'tls' {
|
||||||
import { X509Certificate } from 'node:crypto';
|
import { X509Certificate } from 'node:crypto';
|
||||||
@ -143,8 +143,8 @@ declare module 'tls' {
|
|||||||
*/
|
*/
|
||||||
constructor(socket: net.Socket, options?: TLSSocketOptions);
|
constructor(socket: net.Socket, options?: TLSSocketOptions);
|
||||||
/**
|
/**
|
||||||
* Returns `true` if the peer certificate was signed by one of the CAs specified
|
* This property is `true` if the peer certificate was signed by one of the CAs
|
||||||
* when creating the `tls.TLSSocket` instance, otherwise `false`.
|
* specified when creating the `tls.TLSSocket` instance, otherwise `false`.
|
||||||
* @since v0.11.4
|
* @since v0.11.4
|
||||||
*/
|
*/
|
||||||
authorized: boolean;
|
authorized: boolean;
|
||||||
@ -158,7 +158,7 @@ declare module 'tls' {
|
|||||||
* Always returns `true`. This may be used to distinguish TLS sockets from regular`net.Socket` instances.
|
* Always returns `true`. This may be used to distinguish TLS sockets from regular`net.Socket` instances.
|
||||||
* @since v0.11.4
|
* @since v0.11.4
|
||||||
*/
|
*/
|
||||||
encrypted: boolean;
|
encrypted: true;
|
||||||
/**
|
/**
|
||||||
* String containing the selected ALPN protocol.
|
* String containing the selected ALPN protocol.
|
||||||
* Before a handshake has completed, this value is always null.
|
* Before a handshake has completed, this value is always null.
|
||||||
@ -343,9 +343,9 @@ declare module 'tls' {
|
|||||||
* When enabled, TLS packet trace information is written to `stderr`. This can be
|
* When enabled, TLS packet trace information is written to `stderr`. This can be
|
||||||
* used to debug TLS connection problems.
|
* used to debug TLS connection problems.
|
||||||
*
|
*
|
||||||
* Note: The format of the output is identical to the output of `openssl s_client -trace` or `openssl s_server -trace`. While it is produced by OpenSSL's`SSL_trace()` function, the format is
|
* The format of the output is identical to the output of`openssl s_client -trace` or `openssl s_server -trace`. While it is produced by
|
||||||
* undocumented, can change without notice,
|
* OpenSSL's `SSL_trace()` function, the format is undocumented, can change
|
||||||
* and should not be relied on.
|
* without notice, and should not be relied on.
|
||||||
* @since v12.2.0
|
* @since v12.2.0
|
||||||
*/
|
*/
|
||||||
enableTrace(): void;
|
enableTrace(): void;
|
||||||
@ -374,7 +374,7 @@ declare module 'tls' {
|
|||||||
* 128,
|
* 128,
|
||||||
* 'client finished');
|
* 'client finished');
|
||||||
*
|
*
|
||||||
*
|
* /*
|
||||||
* Example return value of keyingMaterial:
|
* Example return value of keyingMaterial:
|
||||||
* <Buffer 76 26 af 99 c5 56 8e 42 09 91 ef 9f 93 cb ad 6c 7b 65 f8 53 f1 d8 d9
|
* <Buffer 76 26 af 99 c5 56 8e 42 09 91 ef 9f 93 cb ad 6c 7b 65 f8 53 f1 d8 d9
|
||||||
* 12 5a 33 b8 b5 25 df 7b 37 9f e0 e2 4f b8 67 83 a3 2f cd 5d 41 42 4c 91
|
* 12 5a 33 b8 b5 25 df 7b 37 9f e0 e2 4f b8 67 83 a3 2f cd 5d 41 42 4c 91
|
||||||
@ -814,13 +814,19 @@ declare module 'tls' {
|
|||||||
* Returns [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on
|
* Returns [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on
|
||||||
* failure. On success, returns [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type).
|
* failure. On success, returns [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type).
|
||||||
*
|
*
|
||||||
* This function can be overwritten by providing alternative function as part of
|
* This function is intended to be used in combination with the`checkServerIdentity` option that can be passed to {@link connect} and as
|
||||||
* the `options.checkServerIdentity` option passed to `tls.connect()`. The
|
* such operates on a `certificate object`. For other purposes, consider using `x509.checkHost()` instead.
|
||||||
|
*
|
||||||
|
* This function can be overwritten by providing an alternative function as the`options.checkServerIdentity` option that is passed to `tls.connect()`. The
|
||||||
* overwriting function can call `tls.checkServerIdentity()` of course, to augment
|
* overwriting function can call `tls.checkServerIdentity()` of course, to augment
|
||||||
* the checks done with additional verification.
|
* the checks done with additional verification.
|
||||||
*
|
*
|
||||||
* This function is only called if the certificate passed all other checks, such as
|
* This function is only called if the certificate passed all other checks, such as
|
||||||
* being issued by trusted CA (`options.ca`).
|
* being issued by trusted CA (`options.ca`).
|
||||||
|
*
|
||||||
|
* Earlier versions of Node.js incorrectly accepted certificates for a given`hostname` if a matching `uniformResourceIdentifier` subject alternative name
|
||||||
|
* was present (see [CVE-2021-44531](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44531)). Applications that wish to accept`uniformResourceIdentifier` subject alternative names can use
|
||||||
|
* a custom`options.checkServerIdentity` function that implements the desired behavior.
|
||||||
* @since v0.8.4
|
* @since v0.8.4
|
||||||
* @param hostname The host name or IP address to verify the certificate against.
|
* @param hostname The host name or IP address to verify the certificate against.
|
||||||
* @param cert A `certificate object` representing the peer's certificate.
|
* @param cert A `certificate object` representing the peer's certificate.
|
||||||
@ -973,6 +979,8 @@ declare module 'tls' {
|
|||||||
* lower-case for historical reasons, but must be uppercased to be used in
|
* lower-case for historical reasons, but must be uppercased to be used in
|
||||||
* the `ciphers` option of {@link createSecureContext}.
|
* the `ciphers` option of {@link createSecureContext}.
|
||||||
*
|
*
|
||||||
|
* Not all supported ciphers are enabled by default. See `Modifying the default TLS cipher suite`.
|
||||||
|
*
|
||||||
* Cipher names that start with `'tls_'` are for TLSv1.3, all the others are for
|
* Cipher names that start with `'tls_'` are for TLSv1.3, all the others are for
|
||||||
* TLSv1.2 and below.
|
* TLSv1.2 and below.
|
||||||
*
|
*
|
||||||
|
12
node_modules/@types/node/trace_events.d.ts
generated
vendored
12
node_modules/@types/node/trace_events.d.ts
generated
vendored
@ -66,6 +66,16 @@
|
|||||||
* node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js
|
* node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
|
* To guarantee that the log file is properly generated after signal events like`SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers
|
||||||
|
* in your code, such as:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* process.on('SIGINT', function onSigint() {
|
||||||
|
* console.info('Received SIGINT.');
|
||||||
|
* process.exit(130); // Or applicable exit code depending on OS and signal
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
* The tracing system uses the same time source
|
* The tracing system uses the same time source
|
||||||
* as the one used by `process.hrtime()`.
|
* as the one used by `process.hrtime()`.
|
||||||
* However the trace-event timestamps are expressed in microseconds,
|
* However the trace-event timestamps are expressed in microseconds,
|
||||||
@ -73,7 +83,7 @@
|
|||||||
*
|
*
|
||||||
* The features from this module are not available in `Worker` threads.
|
* The features from this module are not available in `Worker` threads.
|
||||||
* @experimental
|
* @experimental
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/trace_events.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/trace_events.js)
|
||||||
*/
|
*/
|
||||||
declare module 'trace_events' {
|
declare module 'trace_events' {
|
||||||
/**
|
/**
|
||||||
|
6
node_modules/@types/node/tty.d.ts
generated
vendored
6
node_modules/@types/node/tty.d.ts
generated
vendored
@ -22,7 +22,7 @@
|
|||||||
*
|
*
|
||||||
* In most cases, there should be little to no reason for an application to
|
* In most cases, there should be little to no reason for an application to
|
||||||
* manually create instances of the `tty.ReadStream` and `tty.WriteStream`classes.
|
* manually create instances of the `tty.ReadStream` and `tty.WriteStream`classes.
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/tty.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/tty.js)
|
||||||
*/
|
*/
|
||||||
declare module 'tty' {
|
declare module 'tty' {
|
||||||
import * as net from 'node:net';
|
import * as net from 'node:net';
|
||||||
@ -52,7 +52,9 @@ declare module 'tty' {
|
|||||||
*
|
*
|
||||||
* When in raw mode, input is always available character-by-character, not
|
* When in raw mode, input is always available character-by-character, not
|
||||||
* including modifiers. Additionally, all special processing of characters by the
|
* including modifiers. Additionally, all special processing of characters by the
|
||||||
* terminal is disabled, including echoing input characters.Ctrl+C will no longer cause a `SIGINT` when in this mode.
|
* terminal is disabled, including echoing input
|
||||||
|
* characters. Ctrl+C will no longer cause a `SIGINT` when
|
||||||
|
* in this mode.
|
||||||
* @since v0.7.7
|
* @since v0.7.7
|
||||||
* @param mode If `true`, configures the `tty.ReadStream` to operate as a raw device. If `false`, configures the `tty.ReadStream` to operate in its default mode. The `readStream.isRaw`
|
* @param mode If `true`, configures the `tty.ReadStream` to operate as a raw device. If `false`, configures the `tty.ReadStream` to operate in its default mode. The `readStream.isRaw`
|
||||||
* property will be set to the resulting mode.
|
* property will be set to the resulting mode.
|
||||||
|
44
node_modules/@types/node/url.d.ts
generated
vendored
44
node_modules/@types/node/url.d.ts
generated
vendored
@ -5,7 +5,7 @@
|
|||||||
* ```js
|
* ```js
|
||||||
* import url from 'url';
|
* import url from 'url';
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/url.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/url.js)
|
||||||
*/
|
*/
|
||||||
declare module 'url' {
|
declare module 'url' {
|
||||||
import { Blob } from 'node:buffer';
|
import { Blob } from 'node:buffer';
|
||||||
@ -59,8 +59,12 @@ declare module 'url' {
|
|||||||
* lenient, non-standard algorithm for parsing URL strings, security
|
* lenient, non-standard algorithm for parsing URL strings, security
|
||||||
* issues can be introduced. Specifically, issues with [host name spoofing](https://hackerone.com/reports/678487) and
|
* issues can be introduced. Specifically, issues with [host name spoofing](https://hackerone.com/reports/678487) and
|
||||||
* incorrect handling of usernames and passwords have been identified.
|
* incorrect handling of usernames and passwords have been identified.
|
||||||
|
*
|
||||||
|
* Deprecation of this API has been shelved for now primarily due to the the
|
||||||
|
* inability of the [WHATWG API to parse relative URLs](https://github.com/nodejs/node/issues/12682#issuecomment-1154492373).
|
||||||
|
* [Discussions are ongoing](https://github.com/whatwg/url/issues/531) for the best way to resolve this.
|
||||||
|
*
|
||||||
* @since v0.1.25
|
* @since v0.1.25
|
||||||
* @deprecated Legacy: Use the WHATWG URL API instead.
|
|
||||||
* @param urlString The URL string to parse.
|
* @param urlString The URL string to parse.
|
||||||
* @param [parseQueryString=false] If `true`, the `query` property will always be set to an object returned by the {@link querystring} module's `parse()` method. If `false`, the `query` property
|
* @param [parseQueryString=false] If `true`, the `query` property will always be set to an object returned by the {@link querystring} module's `parse()` method. If `false`, the `query` property
|
||||||
* on the returned URL object will be an unparsed, undecoded string.
|
* on the returned URL object will be an unparsed, undecoded string.
|
||||||
@ -201,7 +205,7 @@ declare module 'url' {
|
|||||||
function format(urlObject: UrlObject | string): string;
|
function format(urlObject: UrlObject | string): string;
|
||||||
/**
|
/**
|
||||||
* The `url.resolve()` method resolves a target URL relative to a base URL in a
|
* The `url.resolve()` method resolves a target URL relative to a base URL in a
|
||||||
* manner similar to that of a Web browser resolving an anchor tag HREF.
|
* manner similar to that of a web browser resolving an anchor tag.
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* const url = require('url');
|
* const url = require('url');
|
||||||
@ -210,7 +214,7 @@ declare module 'url' {
|
|||||||
* url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
|
* url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* You can achieve the same result using the WHATWG URL API:
|
* To achieve the same result using the WHATWG URL API:
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* function resolve(from, to) {
|
* function resolve(from, to) {
|
||||||
@ -229,8 +233,8 @@ declare module 'url' {
|
|||||||
* ```
|
* ```
|
||||||
* @since v0.1.25
|
* @since v0.1.25
|
||||||
* @deprecated Legacy: Use the WHATWG URL API instead.
|
* @deprecated Legacy: Use the WHATWG URL API instead.
|
||||||
* @param from The Base URL being resolved against.
|
* @param from The base URL to use if `to` is a relative URL.
|
||||||
* @param to The HREF URL being resolved.
|
* @param to The target URL to resolve.
|
||||||
*/
|
*/
|
||||||
function resolve(from: string, to: string): string;
|
function resolve(from: string, to: string): string;
|
||||||
/**
|
/**
|
||||||
@ -328,7 +332,7 @@ declare module 'url' {
|
|||||||
* const myURL = new URL('https://a:b@測試?abc#foo');
|
* const myURL = new URL('https://a:b@測試?abc#foo');
|
||||||
*
|
*
|
||||||
* console.log(urlToHttpOptions(myURL));
|
* console.log(urlToHttpOptions(myURL));
|
||||||
*
|
* /*
|
||||||
* {
|
* {
|
||||||
* protocol: 'https:',
|
* protocol: 'https:',
|
||||||
* hostname: 'xn--g6w251d',
|
* hostname: 'xn--g6w251d',
|
||||||
@ -393,7 +397,8 @@ declare module 'url' {
|
|||||||
*/
|
*/
|
||||||
static createObjectURL(blob: Blob): string;
|
static createObjectURL(blob: Blob): string;
|
||||||
/**
|
/**
|
||||||
* Removes the stored `Blob` identified by the given ID.
|
* Removes the stored `Blob` identified by the given ID. Attempting to revoke a
|
||||||
|
* ID that isn’t registered will silently fail.
|
||||||
* @since v16.7.0
|
* @since v16.7.0
|
||||||
* @experimental
|
* @experimental
|
||||||
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
||||||
@ -855,7 +860,6 @@ declare module 'url' {
|
|||||||
values(): IterableIterator<string>;
|
values(): IterableIterator<string>;
|
||||||
[Symbol.iterator](): IterableIterator<[string, string]>;
|
[Symbol.iterator](): IterableIterator<[string, string]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
import { URL as _URL, URLSearchParams as _URLSearchParams } from 'url';
|
import { URL as _URL, URLSearchParams as _URLSearchParams } from 'url';
|
||||||
global {
|
global {
|
||||||
interface URLSearchParams extends _URLSearchParams {}
|
interface URLSearchParams extends _URLSearchParams {}
|
||||||
@ -869,21 +873,23 @@ declare module 'url' {
|
|||||||
* https://nodejs.org/api/url.html#the-whatwg-url-api
|
* https://nodejs.org/api/url.html#the-whatwg-url-api
|
||||||
* @since v10.0.0
|
* @since v10.0.0
|
||||||
*/
|
*/
|
||||||
var URL:
|
var URL: typeof globalThis extends {
|
||||||
// For compatibility with "dom" and "webworker" URL declarations
|
onmessage: any;
|
||||||
typeof globalThis extends { onmessage: any, URL: infer URL }
|
URL: infer URL;
|
||||||
? URL
|
}
|
||||||
: typeof _URL;
|
? URL
|
||||||
|
: typeof _URL;
|
||||||
/**
|
/**
|
||||||
* `URLSearchParams` class is a global reference for `require('url').URLSearchParams`
|
* `URLSearchParams` class is a global reference for `require('url').URLSearchParams`
|
||||||
* https://nodejs.org/api/url.html#class-urlsearchparams
|
* https://nodejs.org/api/url.html#class-urlsearchparams
|
||||||
* @since v10.0.0
|
* @since v10.0.0
|
||||||
*/
|
*/
|
||||||
var URLSearchParams:
|
var URLSearchParams: typeof globalThis extends {
|
||||||
// For compatibility with "dom" and "webworker" URLSearchParams declarations
|
onmessage: any;
|
||||||
typeof globalThis extends { onmessage: any, URLSearchParams: infer URLSearchParams }
|
URLSearchParams: infer URLSearchParams;
|
||||||
? URLSearchParams
|
}
|
||||||
: typeof _URLSearchParams;
|
? URLSearchParams
|
||||||
|
: typeof _URLSearchParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare module 'node:url' {
|
declare module 'node:url' {
|
||||||
|
29
node_modules/@types/node/util.d.ts
generated
vendored
29
node_modules/@types/node/util.d.ts
generated
vendored
@ -6,7 +6,7 @@
|
|||||||
* ```js
|
* ```js
|
||||||
* const util = require('util');
|
* const util = require('util');
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/util.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/util.js)
|
||||||
*/
|
*/
|
||||||
declare module 'util' {
|
declare module 'util' {
|
||||||
import * as types from 'node:util/types';
|
import * as types from 'node:util/types';
|
||||||
@ -309,6 +309,21 @@ declare module 'util' {
|
|||||||
* );
|
* );
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
|
* The `numericSeparator` option adds an underscore every three digits to all
|
||||||
|
* numbers.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const { inspect } = require('util');
|
||||||
|
*
|
||||||
|
* const thousand = 1_000;
|
||||||
|
* const million = 1_000_000;
|
||||||
|
* const bigNumber = 123_456_789n;
|
||||||
|
* const bigDecimal = 1_234.123_45;
|
||||||
|
*
|
||||||
|
* console.log(thousand, million, bigNumber, bigDecimal);
|
||||||
|
* // 1_000 1_000_000 123_456_789n 1_234.123_45
|
||||||
|
* ```
|
||||||
|
*
|
||||||
* `util.inspect()` is a synchronous method intended for debugging. Its maximum
|
* `util.inspect()` is a synchronous method intended for debugging. Its maximum
|
||||||
* output length is approximately 128 MB. Inputs that result in longer output will
|
* output length is approximately 128 MB. Inputs that result in longer output will
|
||||||
* be truncated.
|
* be truncated.
|
||||||
@ -859,7 +874,7 @@ declare module 'util' {
|
|||||||
* callbackFunction((err, ret) => {
|
* callbackFunction((err, ret) => {
|
||||||
* // When the Promise was rejected with `null` it is wrapped with an Error and
|
* // When the Promise was rejected with `null` it is wrapped with an Error and
|
||||||
* // the original value is stored in `reason`.
|
* // the original value is stored in `reason`.
|
||||||
* err && err.hasOwnProperty('reason') && err.reason === null; // true
|
* err && Object.hasOwn(err, 'reason') && err.reason === null; // true
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
* @since v8.2.0
|
* @since v8.2.0
|
||||||
@ -998,13 +1013,9 @@ declare module 'util' {
|
|||||||
* An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API.
|
* An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API.
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* const decoder = new TextDecoder('shift_jis');
|
* const decoder = new TextDecoder();
|
||||||
* let string = '';
|
* const u8arr = new Uint8Array([72, 101, 108, 108, 111]);
|
||||||
* let buffer;
|
* console.log(decoder.decode(u8arr)); // Hello
|
||||||
* while (buffer = getNextChunkSomehow()) {
|
|
||||||
* string += decoder.decode(buffer, { stream: true });
|
|
||||||
* }
|
|
||||||
* string += decoder.decode(); // end-of-stream
|
|
||||||
* ```
|
* ```
|
||||||
* @since v8.3.0
|
* @since v8.3.0
|
||||||
*/
|
*/
|
||||||
|
20
node_modules/@types/node/v8.d.ts
generated
vendored
20
node_modules/@types/node/v8.d.ts
generated
vendored
@ -4,7 +4,7 @@
|
|||||||
* ```js
|
* ```js
|
||||||
* const v8 = require('v8');
|
* const v8 = require('v8');
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/v8.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/v8.js)
|
||||||
*/
|
*/
|
||||||
declare module 'v8' {
|
declare module 'v8' {
|
||||||
import { Readable } from 'node:stream';
|
import { Readable } from 'node:stream';
|
||||||
@ -163,6 +163,13 @@ declare module 'v8' {
|
|||||||
* Chrome DevTools. The JSON schema is undocumented and specific to the
|
* Chrome DevTools. The JSON schema is undocumented and specific to the
|
||||||
* V8 engine. Therefore, the schema may change from one version of V8 to the next.
|
* V8 engine. Therefore, the schema may change from one version of V8 to the next.
|
||||||
*
|
*
|
||||||
|
* Creating a heap snapshot requires memory about twice the size of the heap at
|
||||||
|
* the time the snapshot is created. This results in the risk of OOM killers
|
||||||
|
* terminating the process.
|
||||||
|
*
|
||||||
|
* Generating a snapshot is a synchronous operation which blocks the event loop
|
||||||
|
* for a duration depending on the heap size.
|
||||||
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* // Print heap snapshot to the console
|
* // Print heap snapshot to the console
|
||||||
* const v8 = require('v8');
|
* const v8 = require('v8');
|
||||||
@ -182,6 +189,13 @@ declare module 'v8' {
|
|||||||
* A heap snapshot is specific to a single V8 isolate. When using `worker threads`, a heap snapshot generated from the main thread will
|
* A heap snapshot is specific to a single V8 isolate. When using `worker threads`, a heap snapshot generated from the main thread will
|
||||||
* not contain any information about the workers, and vice versa.
|
* not contain any information about the workers, and vice versa.
|
||||||
*
|
*
|
||||||
|
* Creating a heap snapshot requires memory about twice the size of the heap at
|
||||||
|
* the time the snapshot is created. This results in the risk of OOM killers
|
||||||
|
* terminating the process.
|
||||||
|
*
|
||||||
|
* Generating a snapshot is a synchronous operation which blocks the event loop
|
||||||
|
* for a duration depending on the heap size.
|
||||||
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* const { writeHeapSnapshot } = require('v8');
|
* const { writeHeapSnapshot } = require('v8');
|
||||||
* const {
|
* const {
|
||||||
@ -344,6 +358,10 @@ declare module 'v8' {
|
|||||||
class DefaultDeserializer extends Deserializer {}
|
class DefaultDeserializer extends Deserializer {}
|
||||||
/**
|
/**
|
||||||
* Uses a `DefaultSerializer` to serialize `value` into a buffer.
|
* Uses a `DefaultSerializer` to serialize `value` into a buffer.
|
||||||
|
*
|
||||||
|
* `ERR_BUFFER_TOO_LARGE` will be thrown when trying to
|
||||||
|
* serialize a huge object which requires buffer
|
||||||
|
* larger than `buffer.constants.MAX_LENGTH`.
|
||||||
* @since v8.0.0
|
* @since v8.0.0
|
||||||
*/
|
*/
|
||||||
function serialize(value: any): Buffer;
|
function serialize(value: any): Buffer;
|
||||||
|
8
node_modules/@types/node/vm.d.ts
generated
vendored
8
node_modules/@types/node/vm.d.ts
generated
vendored
@ -1,7 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* The `vm` module enables compiling and running code within V8 Virtual
|
* The `vm` module enables compiling and running code within V8 Virtual
|
||||||
* Machine contexts. **The `vm` module is not a security mechanism. Do**
|
* Machine contexts.
|
||||||
* **not use it to run untrusted code.**
|
*
|
||||||
|
* **The `vm` module is not a security**
|
||||||
|
* **mechanism. Do not use it to run untrusted code.**
|
||||||
*
|
*
|
||||||
* JavaScript code can be compiled and run immediately or
|
* JavaScript code can be compiled and run immediately or
|
||||||
* compiled, saved, and run later.
|
* compiled, saved, and run later.
|
||||||
@ -32,7 +34,7 @@
|
|||||||
*
|
*
|
||||||
* console.log(x); // 1; y is not defined.
|
* console.log(x); // 1; y is not defined.
|
||||||
* ```
|
* ```
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/vm.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/vm.js)
|
||||||
*/
|
*/
|
||||||
declare module 'vm' {
|
declare module 'vm' {
|
||||||
interface Context extends NodeJS.Dict<any> {}
|
interface Context extends NodeJS.Dict<any> {}
|
||||||
|
2
node_modules/@types/node/wasi.d.ts
generated
vendored
2
node_modules/@types/node/wasi.d.ts
generated
vendored
@ -68,7 +68,7 @@
|
|||||||
* The `--experimental-wasi-unstable-preview1` CLI argument is needed for this
|
* The `--experimental-wasi-unstable-preview1` CLI argument is needed for this
|
||||||
* example to run.
|
* example to run.
|
||||||
* @experimental
|
* @experimental
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/wasi.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/wasi.js)
|
||||||
*/
|
*/
|
||||||
declare module 'wasi' {
|
declare module 'wasi' {
|
||||||
interface WASIOptions {
|
interface WASIOptions {
|
||||||
|
7
node_modules/@types/node/worker_threads.d.ts
generated
vendored
7
node_modules/@types/node/worker_threads.d.ts
generated
vendored
@ -39,7 +39,7 @@
|
|||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* The above example spawns a Worker thread for each `parse()` call. In actual
|
* The above example spawns a Worker thread for each `parseJSAsync()` call. In
|
||||||
* practice, use a pool of Workers for these kinds of tasks. Otherwise, the
|
* practice, use a pool of Workers for these kinds of tasks. Otherwise, the
|
||||||
* overhead of creating Workers would likely exceed their benefit.
|
* overhead of creating Workers would likely exceed their benefit.
|
||||||
*
|
*
|
||||||
@ -49,7 +49,7 @@
|
|||||||
*
|
*
|
||||||
* Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
|
* Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
|
||||||
* specifically `argv` and `execArgv` options.
|
* specifically `argv` and `execArgv` options.
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/worker_threads.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/worker_threads.js)
|
||||||
*/
|
*/
|
||||||
declare module 'worker_threads' {
|
declare module 'worker_threads' {
|
||||||
import { Blob } from 'node:buffer';
|
import { Blob } from 'node:buffer';
|
||||||
@ -507,7 +507,6 @@ declare module 'worker_threads' {
|
|||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
* @since v15.4.0
|
* @since v15.4.0
|
||||||
* @experimental
|
|
||||||
*/
|
*/
|
||||||
class BroadcastChannel {
|
class BroadcastChannel {
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
@ -630,14 +629,12 @@ declare module 'worker_threads' {
|
|||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
* @since v15.12.0, v14.18.0
|
* @since v15.12.0, v14.18.0
|
||||||
* @experimental
|
|
||||||
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
|
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
|
||||||
*/
|
*/
|
||||||
function getEnvironmentData(key: Serializable): Serializable;
|
function getEnvironmentData(key: Serializable): Serializable;
|
||||||
/**
|
/**
|
||||||
* The `worker.setEnvironmentData()` API sets the content of`worker.getEnvironmentData()` in the current thread and all new `Worker`instances spawned from the current context.
|
* The `worker.setEnvironmentData()` API sets the content of`worker.getEnvironmentData()` in the current thread and all new `Worker`instances spawned from the current context.
|
||||||
* @since v15.12.0, v14.18.0
|
* @since v15.12.0, v14.18.0
|
||||||
* @experimental
|
|
||||||
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
|
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
|
||||||
* @param value Any arbitrary, cloneable JavaScript value that will be cloned and passed automatically to all new `Worker` instances. If `value` is passed as `undefined`, any previously set value
|
* @param value Any arbitrary, cloneable JavaScript value that will be cloned and passed automatically to all new `Worker` instances. If `value` is passed as `undefined`, any previously set value
|
||||||
* for the `key` will be deleted.
|
* for the `key` will be deleted.
|
||||||
|
2
node_modules/@types/node/zlib.d.ts
generated
vendored
2
node_modules/@types/node/zlib.d.ts
generated
vendored
@ -88,7 +88,7 @@
|
|||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
* @since v0.5.8
|
* @since v0.5.8
|
||||||
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/zlib.js)
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/zlib.js)
|
||||||
*/
|
*/
|
||||||
declare module 'zlib' {
|
declare module 'zlib' {
|
||||||
import * as stream from 'node:stream';
|
import * as stream from 'node:stream';
|
||||||
|
Loading…
Reference in New Issue
Block a user