mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-06 12:00:06 +02:00
Moving to node_modules folder to make easier to upgrade
trying to move from Bootstrap 3 to Bootstrap 5
This commit is contained in:
parent
047e363a16
commit
d4d042e041
8460 changed files with 1355889 additions and 547977 deletions
10
node_modules/@hapi/boom/LICENSE.md
generated
vendored
Normal file
10
node_modules/@hapi/boom/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
Copyright (c) 2012-2020, Sideway Inc, and project contributors
|
||||
Copyright (c) 2012-2014, Walmart.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* The names of any contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS OFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
17
node_modules/@hapi/boom/README.md
generated
vendored
Normal file
17
node_modules/@hapi/boom/README.md
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
<a href="https://hapi.dev"><img src="https://raw.githubusercontent.com/hapijs/assets/master/images/family.png" width="180px" align="right" /></a>
|
||||
|
||||
# @hapi/boom
|
||||
|
||||
#### HTTP-friendly error objects.
|
||||
|
||||
**boom** is part of the **hapi** ecosystem and was designed to work seamlessly with the [hapi web framework](https://hapi.dev) and its other components (but works great on its own or with other frameworks). If you are using a different web framework and find this module useful, check out [hapi](https://hapi.dev) – they work even better together.
|
||||
|
||||
### Visit the [hapi.dev](https://hapi.dev) Developer Portal for tutorials, documentation, and support
|
||||
|
||||
## Useful resources
|
||||
|
||||
- [Documentation and API](https://hapi.dev/family/boom/)
|
||||
- [Version status](https://hapi.dev/resources/status/#boom) (builds, dependencies, node versions, licenses, eol)
|
||||
- [Changelog](https://hapi.dev/family/boom/changelog/)
|
||||
- [Project policies](https://hapi.dev/policies/)
|
||||
- [Free and commercial support options](https://hapi.dev/support/)
|
549
node_modules/@hapi/boom/lib/index.d.ts
generated
vendored
Normal file
549
node_modules/@hapi/boom/lib/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,549 @@
|
|||
/**
|
||||
* An Error object used to return an HTTP response error (4xx, 5xx)
|
||||
*/
|
||||
export class Boom<Data = any> extends Error {
|
||||
|
||||
/**
|
||||
* Creates a new Boom object using the provided message
|
||||
*/
|
||||
constructor(message?: string | Error, options?: Options<Data>);
|
||||
|
||||
/**
|
||||
* Custom error data with additional information specific to the error type
|
||||
*/
|
||||
data?: Data;
|
||||
|
||||
/**
|
||||
* isBoom - if true, indicates this is a Boom object instance.
|
||||
*/
|
||||
isBoom: boolean;
|
||||
|
||||
/**
|
||||
* Convenience boolean indicating status code >= 500
|
||||
*/
|
||||
isServer: boolean;
|
||||
|
||||
/**
|
||||
* The error message
|
||||
*/
|
||||
message: string;
|
||||
|
||||
/**
|
||||
* The formatted response
|
||||
*/
|
||||
output: Output;
|
||||
|
||||
/**
|
||||
* The constructor used to create the error
|
||||
*/
|
||||
typeof: Function;
|
||||
|
||||
/**
|
||||
* Specifies if an error object is a valid boom object
|
||||
*
|
||||
* @param debug - A boolean that, when true, does not hide the original 500 error message. Defaults to false.
|
||||
*/
|
||||
reformat(debug?: boolean): string;
|
||||
}
|
||||
|
||||
|
||||
export interface Options<Data> {
|
||||
/**
|
||||
* The HTTP status code
|
||||
*
|
||||
* @default 500
|
||||
*/
|
||||
statusCode?: number;
|
||||
|
||||
/**
|
||||
* Additional error information
|
||||
*/
|
||||
data?: Data;
|
||||
|
||||
/**
|
||||
* Constructor reference used to crop the exception call stack output
|
||||
*/
|
||||
ctor?: Function;
|
||||
|
||||
/**
|
||||
* Error message string
|
||||
*
|
||||
* @default none
|
||||
*/
|
||||
message?: string;
|
||||
|
||||
/**
|
||||
* If false, the err provided is a Boom object, and a statusCode or message are provided, the values are ignored
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
override?: boolean;
|
||||
}
|
||||
|
||||
|
||||
export interface Decorate<Decoration> {
|
||||
|
||||
/**
|
||||
* An option with extra properties to set on the error object
|
||||
*/
|
||||
decorate?: Decoration;
|
||||
}
|
||||
|
||||
|
||||
export interface Payload {
|
||||
/**
|
||||
* The HTTP status code derived from error.output.statusCode
|
||||
*/
|
||||
statusCode: number;
|
||||
|
||||
/**
|
||||
* The HTTP status message derived from statusCode
|
||||
*/
|
||||
error: string;
|
||||
|
||||
/**
|
||||
* The error message derived from error.message
|
||||
*/
|
||||
message: string;
|
||||
|
||||
/**
|
||||
* Custom properties
|
||||
*/
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
|
||||
export interface Output {
|
||||
/**
|
||||
* The HTTP status code
|
||||
*/
|
||||
statusCode: number;
|
||||
|
||||
/**
|
||||
* An object containing any HTTP headers where each key is a header name and value is the header content
|
||||
*/
|
||||
headers: { [header: string]: string | string[] | number | undefined };
|
||||
|
||||
/**
|
||||
* The formatted object used as the response payload (stringified)
|
||||
*/
|
||||
payload: Payload;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specifies if an object is a valid boom object
|
||||
*
|
||||
* @param obj - The object to assess
|
||||
* @param statusCode - Optional status code
|
||||
*
|
||||
* @returns Returns a boolean stating if the error object is a valid boom object and it has the provided statusCode (if present)
|
||||
*/
|
||||
export function isBoom(obj: unknown, statusCode?: number): obj is Boom;
|
||||
|
||||
|
||||
/**
|
||||
* Specifies if an error object is a valid boom object
|
||||
*
|
||||
* @param err - The error object to decorate
|
||||
* @param options - Options object
|
||||
*
|
||||
* @returns A decorated boom object
|
||||
*/
|
||||
export function boomify<Data, Decoration>(err: Error, options?: Options<Data> & Decorate<Decoration>): Boom<Data> & Decoration;
|
||||
|
||||
|
||||
// 4xx Errors
|
||||
|
||||
/**
|
||||
* Returns a 400 Bad Request error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 400 bad request error
|
||||
*/
|
||||
export function badRequest<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 401 Unauthorized error
|
||||
*
|
||||
* @param message - Optional message
|
||||
*
|
||||
* @returns A 401 Unauthorized error
|
||||
*/
|
||||
export function unauthorized<Data>(message?: string | null): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 401 Unauthorized error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param scheme - the authentication scheme name
|
||||
* @param attributes - an object of values used to construct the 'WWW-Authenticate' header
|
||||
*
|
||||
* @returns A 401 Unauthorized error
|
||||
*/
|
||||
export function unauthorized<Data>(message: '' | null, scheme: string, attributes?: string | unauthorized.Attributes): Boom<Data> & unauthorized.MissingAuth;
|
||||
export function unauthorized<Data>(message: string | null, scheme: string, attributes?: string | unauthorized.Attributes): Boom<Data>;
|
||||
|
||||
|
||||
export namespace unauthorized {
|
||||
|
||||
interface Attributes {
|
||||
[index: string]: number | string | null | undefined;
|
||||
}
|
||||
|
||||
interface MissingAuth {
|
||||
|
||||
/**
|
||||
* Indicate whether the 401 unauthorized error is due to missing credentials (vs. invalid)
|
||||
*/
|
||||
isMissing: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 401 Unauthorized error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param wwwAuthenticate - array of string values used to construct the wwwAuthenticate header
|
||||
*
|
||||
* @returns A 401 Unauthorized error
|
||||
*/
|
||||
export function unauthorized<Data>(message: string | null, wwwAuthenticate: string[]): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 402 Payment Required error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 402 Payment Required error
|
||||
*/
|
||||
export function paymentRequired<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 403 Forbidden error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 403 Forbidden error
|
||||
*/
|
||||
export function forbidden<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 404 Not Found error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 404 Not Found error
|
||||
*/
|
||||
export function notFound<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 405 Method Not Allowed error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
* @param allow - Optional string or array of strings which is used to set the 'Allow' header
|
||||
*
|
||||
* @returns A 405 Method Not Allowed error
|
||||
*/
|
||||
export function methodNotAllowed<Data>(message?: string, data?: Data, allow?: string | string[]): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 406 Not Acceptable error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 406 Not Acceptable error
|
||||
*/
|
||||
export function notAcceptable<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 407 Proxy Authentication error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 407 Proxy Authentication error
|
||||
*/
|
||||
export function proxyAuthRequired<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 408 Request Time-out error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 408 Request Time-out error
|
||||
*/
|
||||
export function clientTimeout<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 409 Conflict error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 409 Conflict error
|
||||
*/
|
||||
export function conflict<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 410 Gone error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 410 gone error
|
||||
*/
|
||||
export function resourceGone<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 411 Length Required error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 411 Length Required error
|
||||
*/
|
||||
export function lengthRequired<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 412 Precondition Failed error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 412 Precondition Failed error
|
||||
*/
|
||||
export function preconditionFailed<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 413 Request Entity Too Large error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 413 Request Entity Too Large error
|
||||
*/
|
||||
export function entityTooLarge<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 414 Request-URI Too Large error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 414 Request-URI Too Large error
|
||||
*/
|
||||
export function uriTooLong<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 415 Unsupported Media Type error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 415 Unsupported Media Type error
|
||||
*/
|
||||
export function unsupportedMediaType<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 416 Request Range Not Satisfiable error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 416 Request Range Not Satisfiable error
|
||||
*/
|
||||
export function rangeNotSatisfiable<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 417 Expectation Failed error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 417 Expectation Failed error
|
||||
*/
|
||||
export function expectationFailed<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 418 I'm a Teapot error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 418 I'm a Teapot error
|
||||
*/
|
||||
export function teapot<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 422 Unprocessable Entity error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 422 Unprocessable Entity error
|
||||
*/
|
||||
export function badData<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 423 Locked error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 423 Locked error
|
||||
*/
|
||||
export function locked<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 424 Failed Dependency error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 424 Failed Dependency error
|
||||
*/
|
||||
export function failedDependency<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 425 Too Early error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 425 Too Early error
|
||||
*/
|
||||
export function tooEarly<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 428 Precondition Required error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 428 Precondition Required error
|
||||
*/
|
||||
export function preconditionRequired<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 429 Too Many Requests error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 429 Too Many Requests error
|
||||
*/
|
||||
export function tooManyRequests<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 451 Unavailable For Legal Reasons error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 451 Unavailable for Legal Reasons error
|
||||
*/
|
||||
export function illegal<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
// 5xx Errors
|
||||
|
||||
/**
|
||||
* Returns a internal error (defaults to 500)
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
* @param statusCode - Optional status code override. Defaults to 500.
|
||||
*
|
||||
* @returns A 500 Internal Server error
|
||||
*/
|
||||
export function internal<Data>(message?: string, data?: Data, statusCode?: number): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 500 Internal Server Error error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 500 Internal Server error
|
||||
*/
|
||||
export function badImplementation<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 501 Not Implemented error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 501 Not Implemented error
|
||||
*/
|
||||
export function notImplemented<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 502 Bad Gateway error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 502 Bad Gateway error
|
||||
*/
|
||||
export function badGateway<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 503 Service Unavailable error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 503 Service Unavailable error
|
||||
*/
|
||||
export function serverUnavailable<Data>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a 504 Gateway Time-out error
|
||||
*
|
||||
* @param message - Optional message
|
||||
* @param data - Optional additional error data
|
||||
*
|
||||
* @returns A 504 Gateway Time-out error
|
||||
*/
|
||||
export function gatewayTimeout<Data>(message?: string, data?: Data): Boom<Data>;
|
469
node_modules/@hapi/boom/lib/index.js
generated
vendored
Normal file
469
node_modules/@hapi/boom/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1,469 @@
|
|||
'use strict';
|
||||
|
||||
const Hoek = require('@hapi/hoek');
|
||||
|
||||
|
||||
const internals = {
|
||||
codes: new Map([
|
||||
[100, 'Continue'],
|
||||
[101, 'Switching Protocols'],
|
||||
[102, 'Processing'],
|
||||
[200, 'OK'],
|
||||
[201, 'Created'],
|
||||
[202, 'Accepted'],
|
||||
[203, 'Non-Authoritative Information'],
|
||||
[204, 'No Content'],
|
||||
[205, 'Reset Content'],
|
||||
[206, 'Partial Content'],
|
||||
[207, 'Multi-Status'],
|
||||
[300, 'Multiple Choices'],
|
||||
[301, 'Moved Permanently'],
|
||||
[302, 'Moved Temporarily'],
|
||||
[303, 'See Other'],
|
||||
[304, 'Not Modified'],
|
||||
[305, 'Use Proxy'],
|
||||
[307, 'Temporary Redirect'],
|
||||
[400, 'Bad Request'],
|
||||
[401, 'Unauthorized'],
|
||||
[402, 'Payment Required'],
|
||||
[403, 'Forbidden'],
|
||||
[404, 'Not Found'],
|
||||
[405, 'Method Not Allowed'],
|
||||
[406, 'Not Acceptable'],
|
||||
[407, 'Proxy Authentication Required'],
|
||||
[408, 'Request Time-out'],
|
||||
[409, 'Conflict'],
|
||||
[410, 'Gone'],
|
||||
[411, 'Length Required'],
|
||||
[412, 'Precondition Failed'],
|
||||
[413, 'Request Entity Too Large'],
|
||||
[414, 'Request-URI Too Large'],
|
||||
[415, 'Unsupported Media Type'],
|
||||
[416, 'Requested Range Not Satisfiable'],
|
||||
[417, 'Expectation Failed'],
|
||||
[418, 'I\'m a teapot'],
|
||||
[422, 'Unprocessable Entity'],
|
||||
[423, 'Locked'],
|
||||
[424, 'Failed Dependency'],
|
||||
[425, 'Too Early'],
|
||||
[426, 'Upgrade Required'],
|
||||
[428, 'Precondition Required'],
|
||||
[429, 'Too Many Requests'],
|
||||
[431, 'Request Header Fields Too Large'],
|
||||
[451, 'Unavailable For Legal Reasons'],
|
||||
[500, 'Internal Server Error'],
|
||||
[501, 'Not Implemented'],
|
||||
[502, 'Bad Gateway'],
|
||||
[503, 'Service Unavailable'],
|
||||
[504, 'Gateway Time-out'],
|
||||
[505, 'HTTP Version Not Supported'],
|
||||
[506, 'Variant Also Negotiates'],
|
||||
[507, 'Insufficient Storage'],
|
||||
[509, 'Bandwidth Limit Exceeded'],
|
||||
[510, 'Not Extended'],
|
||||
[511, 'Network Authentication Required']
|
||||
])
|
||||
};
|
||||
|
||||
|
||||
exports.Boom = class extends Error {
|
||||
|
||||
constructor(message, options = {}) {
|
||||
|
||||
if (message instanceof Error) {
|
||||
return exports.boomify(Hoek.clone(message), options);
|
||||
}
|
||||
|
||||
const { statusCode = 500, data = null, ctor = exports.Boom } = options;
|
||||
const error = new Error(message ? message : undefined); // Avoids settings null message
|
||||
Error.captureStackTrace(error, ctor); // Filter the stack to our external API
|
||||
error.data = data;
|
||||
const boom = internals.initialize(error, statusCode);
|
||||
|
||||
Object.defineProperty(boom, 'typeof', { value: ctor });
|
||||
|
||||
if (options.decorate) {
|
||||
Object.assign(boom, options.decorate);
|
||||
}
|
||||
|
||||
return boom;
|
||||
}
|
||||
|
||||
static [Symbol.hasInstance](instance) {
|
||||
|
||||
if (this === exports.Boom) {
|
||||
return exports.isBoom(instance);
|
||||
}
|
||||
|
||||
// Cannot use 'instanceof' as it creates infinite recursion
|
||||
|
||||
return this.prototype.isPrototypeOf(instance);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
exports.isBoom = function (err, statusCode) {
|
||||
|
||||
return err instanceof Error && !!err.isBoom && (!statusCode || err.output.statusCode === statusCode);
|
||||
};
|
||||
|
||||
|
||||
exports.boomify = function (err, options) {
|
||||
|
||||
Hoek.assert(err instanceof Error, 'Cannot wrap non-Error object');
|
||||
|
||||
options = options || {};
|
||||
|
||||
if (options.data !== undefined) {
|
||||
err.data = options.data;
|
||||
}
|
||||
|
||||
if (options.decorate) {
|
||||
Object.assign(err, options.decorate);
|
||||
}
|
||||
|
||||
if (!err.isBoom) {
|
||||
return internals.initialize(err, options.statusCode || 500, options.message);
|
||||
}
|
||||
|
||||
if (options.override === false || // Defaults to true
|
||||
!options.statusCode && !options.message) {
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
return internals.initialize(err, options.statusCode || err.output.statusCode, options.message);
|
||||
};
|
||||
|
||||
|
||||
// 4xx Client Errors
|
||||
|
||||
exports.badRequest = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 400, data, ctor: exports.badRequest });
|
||||
};
|
||||
|
||||
|
||||
exports.unauthorized = function (message, scheme, attributes) { // Or (message, wwwAuthenticate[])
|
||||
|
||||
const err = new exports.Boom(message, { statusCode: 401, ctor: exports.unauthorized });
|
||||
|
||||
// function (message)
|
||||
|
||||
if (!scheme) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// function (message, wwwAuthenticate[])
|
||||
|
||||
if (typeof scheme !== 'string') {
|
||||
err.output.headers['WWW-Authenticate'] = scheme.join(', ');
|
||||
return err;
|
||||
}
|
||||
|
||||
// function (message, scheme, attributes)
|
||||
|
||||
let wwwAuthenticate = `${scheme}`;
|
||||
|
||||
if (attributes ||
|
||||
message) {
|
||||
|
||||
err.output.payload.attributes = {};
|
||||
}
|
||||
|
||||
if (attributes) {
|
||||
if (typeof attributes === 'string') {
|
||||
wwwAuthenticate += ' ' + Hoek.escapeHeaderAttribute(attributes);
|
||||
err.output.payload.attributes = attributes;
|
||||
}
|
||||
else {
|
||||
wwwAuthenticate += ' ' + Object.keys(attributes).map((name) => {
|
||||
|
||||
let value = attributes[name];
|
||||
if (value === null ||
|
||||
value === undefined) {
|
||||
|
||||
value = '';
|
||||
}
|
||||
|
||||
err.output.payload.attributes[name] = value;
|
||||
return `${name}="${Hoek.escapeHeaderAttribute(value.toString())}"`;
|
||||
})
|
||||
.join(', ');
|
||||
}
|
||||
}
|
||||
|
||||
if (message) {
|
||||
if (attributes) {
|
||||
wwwAuthenticate += ',';
|
||||
}
|
||||
|
||||
wwwAuthenticate += ` error="${Hoek.escapeHeaderAttribute(message)}"`;
|
||||
err.output.payload.attributes.error = message;
|
||||
}
|
||||
else {
|
||||
err.isMissing = true;
|
||||
}
|
||||
|
||||
err.output.headers['WWW-Authenticate'] = wwwAuthenticate;
|
||||
return err;
|
||||
};
|
||||
|
||||
|
||||
exports.paymentRequired = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 402, data, ctor: exports.paymentRequired });
|
||||
};
|
||||
|
||||
|
||||
exports.forbidden = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 403, data, ctor: exports.forbidden });
|
||||
};
|
||||
|
||||
|
||||
exports.notFound = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 404, data, ctor: exports.notFound });
|
||||
};
|
||||
|
||||
|
||||
exports.methodNotAllowed = function (message, data, allow) {
|
||||
|
||||
const err = new exports.Boom(message, { statusCode: 405, data, ctor: exports.methodNotAllowed });
|
||||
|
||||
if (typeof allow === 'string') {
|
||||
allow = [allow];
|
||||
}
|
||||
|
||||
if (Array.isArray(allow)) {
|
||||
err.output.headers.Allow = allow.join(', ');
|
||||
}
|
||||
|
||||
return err;
|
||||
};
|
||||
|
||||
|
||||
exports.notAcceptable = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 406, data, ctor: exports.notAcceptable });
|
||||
};
|
||||
|
||||
|
||||
exports.proxyAuthRequired = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 407, data, ctor: exports.proxyAuthRequired });
|
||||
};
|
||||
|
||||
|
||||
exports.clientTimeout = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 408, data, ctor: exports.clientTimeout });
|
||||
};
|
||||
|
||||
|
||||
exports.conflict = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 409, data, ctor: exports.conflict });
|
||||
};
|
||||
|
||||
|
||||
exports.resourceGone = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 410, data, ctor: exports.resourceGone });
|
||||
};
|
||||
|
||||
|
||||
exports.lengthRequired = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 411, data, ctor: exports.lengthRequired });
|
||||
};
|
||||
|
||||
|
||||
exports.preconditionFailed = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 412, data, ctor: exports.preconditionFailed });
|
||||
};
|
||||
|
||||
|
||||
exports.entityTooLarge = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 413, data, ctor: exports.entityTooLarge });
|
||||
};
|
||||
|
||||
|
||||
exports.uriTooLong = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 414, data, ctor: exports.uriTooLong });
|
||||
};
|
||||
|
||||
|
||||
exports.unsupportedMediaType = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 415, data, ctor: exports.unsupportedMediaType });
|
||||
};
|
||||
|
||||
|
||||
exports.rangeNotSatisfiable = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 416, data, ctor: exports.rangeNotSatisfiable });
|
||||
};
|
||||
|
||||
|
||||
exports.expectationFailed = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 417, data, ctor: exports.expectationFailed });
|
||||
};
|
||||
|
||||
|
||||
exports.teapot = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 418, data, ctor: exports.teapot });
|
||||
};
|
||||
|
||||
|
||||
exports.badData = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 422, data, ctor: exports.badData });
|
||||
};
|
||||
|
||||
|
||||
exports.locked = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 423, data, ctor: exports.locked });
|
||||
};
|
||||
|
||||
|
||||
exports.failedDependency = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 424, data, ctor: exports.failedDependency });
|
||||
};
|
||||
|
||||
exports.tooEarly = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 425, data, ctor: exports.tooEarly });
|
||||
};
|
||||
|
||||
|
||||
exports.preconditionRequired = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 428, data, ctor: exports.preconditionRequired });
|
||||
};
|
||||
|
||||
|
||||
exports.tooManyRequests = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 429, data, ctor: exports.tooManyRequests });
|
||||
};
|
||||
|
||||
|
||||
exports.illegal = function (message, data) {
|
||||
|
||||
return new exports.Boom(message, { statusCode: 451, data, ctor: exports.illegal });
|
||||
};
|
||||
|
||||
|
||||
// 5xx Server Errors
|
||||
|
||||
exports.internal = function (message, data, statusCode = 500) {
|
||||
|
||||
return internals.serverError(message, data, statusCode, exports.internal);
|
||||
};
|
||||
|
||||
|
||||
exports.notImplemented = function (message, data) {
|
||||
|
||||
return internals.serverError(message, data, 501, exports.notImplemented);
|
||||
};
|
||||
|
||||
|
||||
exports.badGateway = function (message, data) {
|
||||
|
||||
return internals.serverError(message, data, 502, exports.badGateway);
|
||||
};
|
||||
|
||||
|
||||
exports.serverUnavailable = function (message, data) {
|
||||
|
||||
return internals.serverError(message, data, 503, exports.serverUnavailable);
|
||||
};
|
||||
|
||||
|
||||
exports.gatewayTimeout = function (message, data) {
|
||||
|
||||
return internals.serverError(message, data, 504, exports.gatewayTimeout);
|
||||
};
|
||||
|
||||
|
||||
exports.badImplementation = function (message, data) {
|
||||
|
||||
const err = internals.serverError(message, data, 500, exports.badImplementation);
|
||||
err.isDeveloperError = true;
|
||||
return err;
|
||||
};
|
||||
|
||||
|
||||
internals.initialize = function (err, statusCode, message) {
|
||||
|
||||
const numberCode = parseInt(statusCode, 10);
|
||||
Hoek.assert(!isNaN(numberCode) && numberCode >= 400, 'First argument must be a number (400+):', statusCode);
|
||||
|
||||
err.isBoom = true;
|
||||
err.isServer = numberCode >= 500;
|
||||
|
||||
if (!err.hasOwnProperty('data')) {
|
||||
err.data = null;
|
||||
}
|
||||
|
||||
err.output = {
|
||||
statusCode: numberCode,
|
||||
payload: {},
|
||||
headers: {}
|
||||
};
|
||||
|
||||
Object.defineProperty(err, 'reformat', { value: internals.reformat, configurable: true });
|
||||
|
||||
if (!message &&
|
||||
!err.message) {
|
||||
|
||||
err.reformat();
|
||||
message = err.output.payload.error;
|
||||
}
|
||||
|
||||
if (message) {
|
||||
const props = Object.getOwnPropertyDescriptor(err, 'message') || Object.getOwnPropertyDescriptor(Object.getPrototypeOf(err), 'message');
|
||||
Hoek.assert(!props || props.configurable && !props.get, 'The error is not compatible with boom');
|
||||
|
||||
err.message = message + (err.message ? ': ' + err.message : '');
|
||||
err.output.payload.message = err.message;
|
||||
}
|
||||
|
||||
err.reformat();
|
||||
return err;
|
||||
};
|
||||
|
||||
|
||||
internals.reformat = function (debug = false) {
|
||||
|
||||
this.output.payload.statusCode = this.output.statusCode;
|
||||
this.output.payload.error = internals.codes.get(this.output.statusCode) || 'Unknown';
|
||||
|
||||
if (this.output.statusCode === 500 && debug !== true) {
|
||||
this.output.payload.message = 'An internal server error occurred'; // Hide actual error from user
|
||||
}
|
||||
else if (this.message) {
|
||||
this.output.payload.message = this.message;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
internals.serverError = function (message, data, statusCode, ctor) {
|
||||
|
||||
if (data instanceof Error &&
|
||||
!data.isBoom) {
|
||||
|
||||
return exports.boomify(data, { statusCode, message });
|
||||
}
|
||||
|
||||
return new exports.Boom(message, { statusCode, data, ctor });
|
||||
};
|
61
node_modules/@hapi/boom/package.json
generated
vendored
Normal file
61
node_modules/@hapi/boom/package.json
generated
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"_from": "@hapi/boom@9.x.x",
|
||||
"_id": "@hapi/boom@9.1.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-Ls1oH8jaN1vNsqcaHVYJrKmgMcKsC1wcp8bujvXrHaAqD2iDYq3HoOwsxwo09Cuda5R5nC0o0IxlrlTuvPuzSw==",
|
||||
"_location": "/@hapi/boom",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@hapi/boom@9.x.x",
|
||||
"name": "@hapi/boom",
|
||||
"escapedName": "@hapi%2fboom",
|
||||
"scope": "@hapi",
|
||||
"rawSpec": "9.x.x",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "9.x.x"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@hapi/cryptiles"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@hapi/boom/-/boom-9.1.4.tgz",
|
||||
"_shasum": "1f9dad367c6a7da9f8def24b4a986fc5a7bd9db6",
|
||||
"_spec": "@hapi/boom@9.x.x",
|
||||
"_where": "G:\\GDrive\\htdocs\\YouPHPTube\\node_modules\\@hapi\\cryptiles",
|
||||
"bugs": {
|
||||
"url": "https://github.com/hapijs/boom/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@hapi/hoek": "9.x.x"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "HTTP-friendly error objects",
|
||||
"devDependencies": {
|
||||
"@hapi/code": "8.x.x",
|
||||
"@hapi/lab": "24.x.x",
|
||||
"typescript": "~4.0.2"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/hapijs/boom#readme",
|
||||
"keywords": [
|
||||
"error",
|
||||
"http"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "lib/index.js",
|
||||
"name": "@hapi/boom",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/hapijs/boom.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "lab -a @hapi/code -t 100 -L -Y",
|
||||
"test-cov-html": "lab -a @hapi/code -t 100 -L -r html -o coverage.html"
|
||||
},
|
||||
"types": "lib/index.d.ts",
|
||||
"version": "9.1.4"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue