This commit is contained in:
starified
2026-04-21 22:03:19 -04:00
parent 36e2d11f2e
commit 08bf320b57
4681 changed files with 566542 additions and 0 deletions

9
node_modules/@hapi/address/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,9 @@
Copyright (c) 2019-2022, Sideway, Inc. and Project contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* The names of any contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

14
node_modules/@hapi/address/README.md generated vendored Normal file
View File

@@ -0,0 +1,14 @@
# @hapi/address
#### Validate email address and domain.
**address** is part of the **joi** ecosystem.
### Visit the [joi.dev](https://joi.dev) Developer Portal for tutorials, documentation, and support
## Useful resources
- [Documentation and API](https://joi.dev/module/address/)
- [Versions status](https://joi.dev/resources/status/#address)
- [Changelog](https://joi.dev/module/address/changelog/)
- [Project policies](https://joi.dev/policies/)

8
node_modules/@hapi/address/dist/decode.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/**
* Faster version of decodeURIComponent() that does not throw.
*
* @param string - the URL string to decode.
*
* @returns the decoded string or null if invalid.
*/
export declare function uriDecode(string: string): string;

103
node_modules/@hapi/address/dist/decode.js generated vendored Normal file
View File

@@ -0,0 +1,103 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.uriDecode = void 0;
const HEX = {
'0': 0,
'1': 1,
'2': 2,
'3': 3,
'4': 4,
'5': 5,
'6': 6,
'7': 7,
'8': 8,
'9': 9,
a: 10,
A: 10,
b: 11,
B: 11,
c: 12,
C: 12,
d: 13,
D: 13,
e: 14,
E: 14,
f: 15,
F: 15
};
const UTF8 = {
accept: 12,
reject: 0,
data: [
// Maps bytes to character to a transition
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 7, 10, 9, 9, 9, 11, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
// Maps a state to a new state when adding a transition
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 24, 36, 48, 60, 72, 84, 96, 0, 12, 12, 12, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,
// Maps the current transition to a mask that needs to apply to the byte
0x7f, 0x3f, 0x3f, 0x3f, 0x00, 0x1f, 0x0f, 0x0f, 0x0f, 0x07, 0x07, 0x07
]
};
/**
* Faster version of decodeURIComponent() that does not throw.
*
* @param string - the URL string to decode.
*
* @returns the decoded string or null if invalid.
*/
function uriDecode(string) {
let percentPos = string.indexOf('%');
if (percentPos === -1) {
return string;
}
let decoded = '';
let last = 0;
let codepoint = 0;
let startOfOctets = percentPos;
let state = UTF8.accept;
while (percentPos > -1 && percentPos < string.length) {
const high = resolveHex(string[percentPos + 1], 4);
const low = resolveHex(string[percentPos + 2], 0);
const byte = high | low;
const type = UTF8.data[byte];
state = UTF8.data[256 + state + type];
codepoint = (codepoint << 6) | (byte & UTF8.data[364 + type]);
if (state === UTF8.accept) {
decoded += string.slice(last, startOfOctets);
decoded +=
codepoint <= 0xffff
? String.fromCharCode(codepoint)
: String.fromCharCode(0xd7c0 + (codepoint >> 10), 0xdc00 + (codepoint & 0x3ff));
codepoint = 0;
last = percentPos + 3;
percentPos = string.indexOf('%', last);
startOfOctets = percentPos;
continue;
}
if (state === UTF8.reject) {
return null;
}
percentPos += 3;
if (percentPos >= string.length || string[percentPos] !== '%') {
return null;
}
}
return decoded + string.slice(last);
}
exports.uriDecode = uriDecode;
function resolveHex(char, shift) {
const i = HEX[char];
return i === undefined ? 255 : i << shift;
}
// Adapted from:
// Copyright (c) 2017-2019 Justin Ridgewell, MIT Licensed, https://github.com/jridgewell/safe-decode-string-component
// Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>, MIT Licensed, http://bjoern.hoehrmann.de/utf-8/decoder/dfa/
//# sourceMappingURL=decode.js.map

1
node_modules/@hapi/address/dist/decode.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

74
node_modules/@hapi/address/dist/domain.d.ts generated vendored Normal file
View File

@@ -0,0 +1,74 @@
interface TldsAllow {
readonly allow: Set<string>;
}
interface TldsDeny {
readonly deny: Set<string>;
}
export interface DomainOptions {
/**
* Determines whether Unicode characters are allowed.
*
* @default true
*/
readonly allowUnicode?: boolean;
/**
* Determines whether underscore (_) characters are allowed.
*
* @default false
*/
readonly allowUnderscore?: boolean;
/**
* The maximum number of domain segments (e.g. `x.y.z` has 3 segments) allowed.
*
* @default Infinity
*/
readonly maxDomainSegments?: number;
/**
* The minimum number of domain segments (e.g. `x.y.z` has 3 segments) required.
*
* @default 2
*/
readonly minDomainSegments?: number;
/**
* Top-level-domain options
*
* @default true
*/
readonly tlds?: TldsAllow | TldsDeny;
/**
* Allows passing fully qualified domain (ends with a period)
*
* @default false
*/
readonly allowFullyQualified?: boolean;
}
export interface Analysis {
/**
* The reason validation failed.
*/
error: string;
/**
* The error code.
*/
code: string;
}
/**
* Analyzes a string to verify it is a valid domain name.
*
* @param domain - the domain name to validate.
* @param options - optional settings.
*
* @return - undefined when valid, otherwise an object with single error key with a string message value.
*/
export declare function analyzeDomain(domain: string, options?: DomainOptions): Analysis | null;
/**
* Analyzes a string to verify it is a valid domain name.
*
* @param domain - the domain name to validate.
* @param options - optional settings.
*
* @return - true when valid, otherwise false.
*/
export declare function isDomainValid(domain: string, options?: DomainOptions): boolean;
export declare function validateDomainOptions(options: DomainOptions): void;
export {};

147
node_modules/@hapi/address/dist/domain.js generated vendored Normal file
View File

@@ -0,0 +1,147 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateDomainOptions = exports.isDomainValid = exports.analyzeDomain = void 0;
const Url = require("url");
const errors_1 = require("./errors");
const MIN_DOMAIN_SEGMENTS = 2;
const NON_ASCII_RX = /[^\x00-\x7f]/;
const DOMAIN_CONTROL_RX = /[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/; // Control + space + separators
const TLD_SEGMENT_RX = /^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/;
const DOMAIN_SEGMENT_RX = /^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/;
const DOMAIN_UNDERSCORE_SEGMENT_RX = /^[a-zA-Z0-9_](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/;
const URL_IMPL = Url.URL || URL; // $lab:coverage:ignore$
function isTldsAllow(tlds) {
return !!tlds.allow;
}
/**
* Analyzes a string to verify it is a valid domain name.
*
* @param domain - the domain name to validate.
* @param options - optional settings.
*
* @return - undefined when valid, otherwise an object with single error key with a string message value.
*/
function analyzeDomain(domain, options = {}) {
if (!domain) {
// Catch null / undefined
return (0, errors_1.errorCode)('DOMAIN_NON_EMPTY_STRING');
}
if (typeof domain !== 'string') {
throw new Error('Invalid input: domain must be a string');
}
if (domain.length > 256) {
return (0, errors_1.errorCode)('DOMAIN_TOO_LONG');
}
const ascii = !NON_ASCII_RX.test(domain);
if (!ascii) {
if (options.allowUnicode === false) {
// Defaults to true
return (0, errors_1.errorCode)('DOMAIN_INVALID_UNICODE_CHARS');
}
domain = domain.normalize('NFC');
}
if (DOMAIN_CONTROL_RX.test(domain)) {
return (0, errors_1.errorCode)('DOMAIN_INVALID_CHARS');
}
domain = punycode(domain);
// https://tools.ietf.org/html/rfc1035 section 2.3.1
if (options.allowFullyQualified && domain[domain.length - 1] === '.') {
domain = domain.slice(0, -1);
}
const minDomainSegments = options.minDomainSegments || MIN_DOMAIN_SEGMENTS;
const segments = domain.split('.');
if (segments.length < minDomainSegments) {
return (0, errors_1.errorCode)('DOMAIN_SEGMENTS_COUNT');
}
if (options.maxDomainSegments) {
if (segments.length > options.maxDomainSegments) {
return (0, errors_1.errorCode)('DOMAIN_SEGMENTS_COUNT_MAX');
}
}
const tlds = options.tlds;
if (tlds) {
const tld = segments[segments.length - 1].toLowerCase();
if (isTldsAllow(tlds)) {
if (!tlds.allow.has(tld)) {
return (0, errors_1.errorCode)('DOMAIN_FORBIDDEN_TLDS');
}
}
else if (tlds.deny.has(tld)) {
return (0, errors_1.errorCode)('DOMAIN_FORBIDDEN_TLDS');
}
}
for (let i = 0; i < segments.length; ++i) {
const segment = segments[i];
if (!segment.length) {
return (0, errors_1.errorCode)('DOMAIN_EMPTY_SEGMENT');
}
if (segment.length > 63) {
return (0, errors_1.errorCode)('DOMAIN_LONG_SEGMENT');
}
if (i < segments.length - 1) {
if (options.allowUnderscore) {
if (!DOMAIN_UNDERSCORE_SEGMENT_RX.test(segment)) {
return (0, errors_1.errorCode)('DOMAIN_INVALID_CHARS');
}
}
else {
if (!DOMAIN_SEGMENT_RX.test(segment)) {
return (0, errors_1.errorCode)('DOMAIN_INVALID_CHARS');
}
}
}
else {
if (!TLD_SEGMENT_RX.test(segment)) {
return (0, errors_1.errorCode)('DOMAIN_INVALID_TLDS_CHARS');
}
}
}
return null;
}
exports.analyzeDomain = analyzeDomain;
/**
* Analyzes a string to verify it is a valid domain name.
*
* @param domain - the domain name to validate.
* @param options - optional settings.
*
* @return - true when valid, otherwise false.
*/
function isDomainValid(domain, options) {
return !analyzeDomain(domain, options);
}
exports.isDomainValid = isDomainValid;
function punycode(domain) {
if (domain.includes('%')) {
domain = domain.replace(/%/g, '%25');
}
try {
return new URL_IMPL(`http://${domain}`).host;
}
catch (err) {
return domain;
}
}
function validateDomainOptions(options) {
if (!options) {
return;
}
if (typeof options.tlds !== 'object') {
throw new Error('Invalid options: tlds must be a boolean or an object');
}
if (isTldsAllow(options.tlds)) {
if (options.tlds.allow instanceof Set === false) {
throw new Error('Invalid options: tlds.allow must be a Set object or true');
}
if (options.tlds.deny) {
throw new Error('Invalid options: cannot specify both tlds.allow and tlds.deny lists');
}
}
else {
if (options.tlds.deny instanceof Set === false) {
throw new Error('Invalid options: tlds.deny must be a Set object');
}
}
}
exports.validateDomainOptions = validateDomainOptions;
//# sourceMappingURL=domain.js.map

1
node_modules/@hapi/address/dist/domain.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../src/domain.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AAE3B,qCAAqC;AAErC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,MAAM,iBAAiB,GAAG,wCAAwC,CAAC,CAAC,+BAA+B;AACnG,MAAM,cAAc,GAAG,0CAA0C,CAAC;AAClE,MAAM,iBAAiB,GAAG,6CAA6C,CAAC;AACxE,MAAM,4BAA4B,GAAG,8CAA8C,CAAC;AACpF,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,wBAAwB;AAUzD,SAAS,WAAW,CAAC,IAAS;IAC1B,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;AACxB,CAAC;AA0DD;;;;;;;GAOG;AACH,SAAgB,aAAa,CAAC,MAAc,EAAE,UAAyB,EAAE;IACrE,IAAI,CAAC,MAAM,EAAE;QACT,yBAAyB;QACzB,OAAO,IAAA,kBAAS,EAAC,yBAAyB,CAAC,CAAC;KAC/C;IAED,IAAI,O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5C,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACtE;KACJ;AACL,CAAC;AAtBD,sDAsBC"}

27
node_modules/@hapi/address/dist/email.d.ts generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import { Analysis, DomainOptions } from './domain';
export interface EmailOptions extends DomainOptions {
/**
* Determines whether to ignore the standards maximum email length limit.
*
* @default false
*/
readonly ignoreLength?: boolean;
}
/**
* Analyzes a string to verify it is a valid email address.
*
* @param email - the email address to validate.
* @param options - optional settings.
*
* @return - undefined when valid, otherwise an object with single error key with a string message value.
*/
export declare function analyzeEmail(email: string, options?: EmailOptions): Analysis | null;
/**
* Analyzes a string to verify it is a valid email address.
*
* @param email - the email address to validate.
* @param options - optional settings.
*
* @return - true when valid, otherwise false.
*/
export declare function isEmailValid(email: string, options?: EmailOptions): boolean;

148
node_modules/@hapi/address/dist/email.js generated vendored Normal file
View File

@@ -0,0 +1,148 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isEmailValid = exports.analyzeEmail = void 0;
const Util = require("util");
const domain_1 = require("./domain");
const errors_1 = require("./errors");
const NON_ASCII_RX = /[^\x00-\x7f]/;
const ENCODER_IMPL = new (Util.TextEncoder || TextEncoder)(); // $lab:coverage:ignore$
/**
* Analyzes a string to verify it is a valid email address.
*
* @param email - the email address to validate.
* @param options - optional settings.
*
* @return - undefined when valid, otherwise an object with single error key with a string message value.
*/
function analyzeEmail(email, options) {
return validateEmail(email, options);
}
exports.analyzeEmail = analyzeEmail;
/**
* Analyzes a string to verify it is a valid email address.
*
* @param email - the email address to validate.
* @param options - optional settings.
*
* @return - true when valid, otherwise false.
*/
function isEmailValid(email, options) {
return !validateEmail(email, options);
}
exports.isEmailValid = isEmailValid;
function validateEmail(email, options = {}) {
if (typeof email !== 'string') {
throw new Error('Invalid input: email must be a string');
}
if (!email) {
return (0, errors_1.errorCode)('EMPTY_STRING');
}
// Unicode
const ascii = !NON_ASCII_RX.test(email);
if (!ascii) {
if (options.allowUnicode === false) {
// Defaults to true
return (0, errors_1.errorCode)('FORBIDDEN_UNICODE');
}
email = email.normalize('NFC');
}
// Basic structure
const parts = email.split('@');
if (parts.length !== 2) {
return parts.length > 2 ? (0, errors_1.errorCode)('MULTIPLE_AT_CHAR') : (0, errors_1.errorCode)('MISSING_AT_CHAR');
}
const [local, domain] = parts;
if (!local) {
return (0, errors_1.errorCode)('EMPTY_LOCAL');
}
if (!options.ignoreLength) {
if (email.length > 254) {
// http://tools.ietf.org/html/rfc5321#section-4.5.3.1.3
return (0, errors_1.errorCode)('ADDRESS_TOO_LONG');
}
if (ENCODER_IMPL.encode(local).length > 64) {
// http://tools.ietf.org/html/rfc5321#section-4.5.3.1.1
return (0, errors_1.errorCode)('LOCAL_TOO_LONG');
}
}
// Validate parts
return validateLocal(local, ascii) || (0, domain_1.analyzeDomain)(domain, options);
}
function validateLocal(local, ascii) {
const segments = local.split('.');
for (const segment of segments) {
if (!segment.length) {
return (0, errors_1.errorCode)('EMPTY_LOCAL_SEGMENT');
}
if (ascii) {
if (!ATEXT_RX.test(segment)) {
return (0, errors_1.errorCode)('INVALID_LOCAL_CHARS');
}
continue;
}
for (const char of segment) {
if (ATEXT_RX.test(char)) {
continue;
}
const binary = toBinary(char);
if (!ATOM_RX.test(binary)) {
return (0, errors_1.errorCode)('INVALID_LOCAL_CHARS');
}
}
}
return null;
}
function toBinary(char) {
return Array.from(ENCODER_IMPL.encode(char), (v) => String.fromCharCode(v)).join('');
}
/*
From RFC 5321:
Mailbox = Local-part "@" ( Domain / address-literal )
Local-part = Dot-string / Quoted-string
Dot-string = Atom *("." Atom)
Atom = 1*atext
atext = ALPHA / DIGIT / "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "/" / "=" / "?" / "^" / "_" / "`" / "{" / "|" / "}" / "~"
Domain = sub-domain *("." sub-domain)
sub-domain = Let-dig [Ldh-str]
Let-dig = ALPHA / DIGIT
Ldh-str = *( ALPHA / DIGIT / "-" ) Let-dig
ALPHA = %x41-5A / %x61-7A ; a-z, A-Z
DIGIT = %x30-39 ; 0-9
From RFC 6531:
sub-domain =/ U-label
atext =/ UTF8-non-ascii
UTF8-non-ascii = UTF8-2 / UTF8-3 / UTF8-4
UTF8-2 = %xC2-DF UTF8-tail
UTF8-3 = %xE0 %xA0-BF UTF8-tail /
%xE1-EC 2( UTF8-tail ) /
%xED %x80-9F UTF8-tail /
%xEE-EF 2( UTF8-tail )
UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) /
%xF1-F3 3( UTF8-tail ) /
%xF4 %x80-8F 2( UTF8-tail )
UTF8-tail = %x80-BF
Note: The following are not supported:
RFC 5321: address-literal, Quoted-string
RFC 5322: obs-*, CFWS
*/
const ATEXT_RX = /^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/; // _ included in \w
const ATOM_RX = new RegExp([
// %xC2-DF UTF8-tail
'(?:[\\xc2-\\xdf][\\x80-\\xbf])',
// %xE0 %xA0-BF UTF8-tail %xE1-EC 2( UTF8-tail ) %xED %x80-9F UTF8-tail %xEE-EF 2( UTF8-tail )
'(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})',
// %xF0 %x90-BF 2( UTF8-tail ) %xF1-F3 3( UTF8-tail ) %xF4 %x80-8F 2( UTF8-tail )
'(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})'
].join('|'));
//# sourceMappingURL=email.js.map

1
node_modules/@hapi/address/dist/email.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"email.js","sourceRoot":"","sources":["../src/email.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAE7B,qCAAkE;AAClE,qCAAqC;AAErC,MAA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AC,EAAE;gBACvB,OAAO,IAAA,kBAAS,EAAC,qBAAqB,CAAC,CAAC;aAC3C;SACJ;KACJ;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY;IAC1B,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACzF,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCE;AAEF,MAAM,QAAQ,GAAG,oCAAoC,CAAC,CAAC,mBAAmB;AAE1E,MAAM,OAAO,GAAG,IAAI,MAAM,CACtB;IACI,qBAAqB;IACrB,gCAAgC;IAEhC,oIAAoI;IACpI,6IAA6I;IAE7I,wGAAwG;IACxG,iHAAiH;CACpH,CAAC,IAAI,CAAC,GAAG,CAAC,CACd,CAAC"}

45
node_modules/@hapi/address/dist/errors.d.ts generated vendored Normal file
View File

@@ -0,0 +1,45 @@
export declare const errorCodes: {
EMPTY_STRING: string;
FORBIDDEN_UNICODE: string;
MULTIPLE_AT_CHAR: string;
MISSING_AT_CHAR: string;
EMPTY_LOCAL: string;
ADDRESS_TOO_LONG: string;
LOCAL_TOO_LONG: string;
EMPTY_LOCAL_SEGMENT: string;
INVALID_LOCAL_CHARS: string;
DOMAIN_NON_EMPTY_STRING: string;
DOMAIN_TOO_LONG: string;
DOMAIN_INVALID_UNICODE_CHARS: string;
DOMAIN_INVALID_CHARS: string;
DOMAIN_INVALID_TLDS_CHARS: string;
DOMAIN_SEGMENTS_COUNT: string;
DOMAIN_SEGMENTS_COUNT_MAX: string;
DOMAIN_FORBIDDEN_TLDS: string;
DOMAIN_EMPTY_SEGMENT: string;
DOMAIN_LONG_SEGMENT: string;
};
export declare function errorCode<TCode extends keyof typeof errorCodes>(code: TCode): {
code: TCode;
error: {
EMPTY_STRING: string;
FORBIDDEN_UNICODE: string;
MULTIPLE_AT_CHAR: string;
MISSING_AT_CHAR: string;
EMPTY_LOCAL: string;
ADDRESS_TOO_LONG: string;
LOCAL_TOO_LONG: string;
EMPTY_LOCAL_SEGMENT: string;
INVALID_LOCAL_CHARS: string;
DOMAIN_NON_EMPTY_STRING: string;
DOMAIN_TOO_LONG: string;
DOMAIN_INVALID_UNICODE_CHARS: string;
DOMAIN_INVALID_CHARS: string;
DOMAIN_INVALID_TLDS_CHARS: string;
DOMAIN_SEGMENTS_COUNT: string;
DOMAIN_SEGMENTS_COUNT_MAX: string;
DOMAIN_FORBIDDEN_TLDS: string;
DOMAIN_EMPTY_SEGMENT: string;
DOMAIN_LONG_SEGMENT: string;
}[TCode];
};

29
node_modules/@hapi/address/dist/errors.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.errorCode = exports.errorCodes = void 0;
exports.errorCodes = {
EMPTY_STRING: 'Address must be a non-empty string',
FORBIDDEN_UNICODE: 'Address contains forbidden Unicode characters',
MULTIPLE_AT_CHAR: 'Address cannot contain more than one @ character',
MISSING_AT_CHAR: 'Address must contain one @ character',
EMPTY_LOCAL: 'Address local part cannot be empty',
ADDRESS_TOO_LONG: 'Address too long',
LOCAL_TOO_LONG: 'Address local part too long',
EMPTY_LOCAL_SEGMENT: 'Address local part contains empty dot-separated segment',
INVALID_LOCAL_CHARS: 'Address local part contains invalid character',
DOMAIN_NON_EMPTY_STRING: 'Domain must be a non-empty string',
DOMAIN_TOO_LONG: 'Domain too long',
DOMAIN_INVALID_UNICODE_CHARS: 'Domain contains forbidden Unicode characters',
DOMAIN_INVALID_CHARS: 'Domain contains invalid character',
DOMAIN_INVALID_TLDS_CHARS: 'Domain contains invalid tld character',
DOMAIN_SEGMENTS_COUNT: 'Domain lacks the minimum required number of segments',
DOMAIN_SEGMENTS_COUNT_MAX: 'Domain contains too many segments',
DOMAIN_FORBIDDEN_TLDS: 'Domain uses forbidden TLD',
DOMAIN_EMPTY_SEGMENT: 'Domain contains empty dot-separated segment',
DOMAIN_LONG_SEGMENT: 'Domain contains dot-separated segment that is too long'
};
function errorCode(code) {
return { code, error: exports.errorCodes[code] };
}
exports.errorCode = errorCode;
//# sourceMappingURL=errors.js.map

1
node_modules/@hapi/address/dist/errors.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACtB,YAAY,EAAE,oCAAoC;IAClD,iBAAiB,EAAE,+CAA+C;IAClE,gBAAgB,EAAE,kDAAkD;IACpE,eAAe,EAAE,sCAAsC;IACvD,WAAW,EAAE,oCAAoC;IACjD,gBAAgB,EAAE,kBAAkB;IACpC,cAAc,EAAE,6BAA6B;IAC7C,mBAAmB,EAAE,yDAAyD;IAC9E,mBAAmB,EAAE,+CAA+C;IACpE,uBAAuB,EAAE,mCAAmC;IAC5D,eAAe,EAAE,iBAAiB;IAClC,4BAA4B,EAAE,8CAA8C;IAC5E,oBAAoB,EAAE,mCAAmC;IACzD,yBAAyB,EAAE,uCAAuC;IAClE,qBAAqB,EAAE,sDAAsD;IAC7E,yBAAyB,EAAE,mCAAmC;IAC9D,qBAAqB,EAAE,2BAA2B;IAClD,oBAAoB,EAAE,6CAA6C;IACnE,mBAAmB,EAAE,wDAAwD;CAChF,CAAC;AAEF,SAAgB,SAAS,CAAwC,IAAW;IACxE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,kBAAU,CAAC,IAAI,CAAC,EAAE,CAAC;AAC7C,CAAC;AAFD,8BAEC"}

6
node_modules/@hapi/address/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
export * from './domain';
export * from './email';
export { errorCodes } from './errors';
export { ipRegex } from './ip';
export { uriRegex } from './uri';
export { uriDecode } from './decode';

28
node_modules/@hapi/address/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.uriDecode = exports.uriRegex = exports.ipRegex = exports.errorCodes = void 0;
__exportStar(require("./domain"), exports);
__exportStar(require("./email"), exports);
var errors_1 = require("./errors");
Object.defineProperty(exports, "errorCodes", { enumerable: true, get: function () { return errors_1.errorCodes; } });
var ip_1 = require("./ip");
Object.defineProperty(exports, "ipRegex", { enumerable: true, get: function () { return ip_1.ipRegex; } });
var uri_1 = require("./uri");
Object.defineProperty(exports, "uriRegex", { enumerable: true, get: function () { return uri_1.uriRegex; } });
var decode_1 = require("./decode");
Object.defineProperty(exports, "uriDecode", { enumerable: true, get: function () { return decode_1.uriDecode; } });
//# sourceMappingURL=index.js.map

1
node_modules/@hapi/address/dist/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB;AACxB,mCAAsC;AAA7B,oGAAA,UAAU,OAAA;AACnB,2BAA+B;AAAtB,6FAAA,OAAO,OAAA;AAChB,6BAAiC;AAAxB,+FAAA,QAAQ,OAAA;AACjB,mCAAqC;AAA5B,mGAAA,SAAS,OAAA"}

35
node_modules/@hapi/address/dist/ip.d.ts generated vendored Normal file
View File

@@ -0,0 +1,35 @@
interface Options {
/**
* The required CIDR mode.
*
* @default 'optional'
*/
readonly cidr?: Cidr;
/**
* The allowed versions.
*
* @default ['ipv4', 'ipv6', 'ipvfuture']
*/
readonly version?: Version | Version[];
}
type Cidr = 'optional' | 'required' | 'forbidden';
type Version = 'ipv4' | 'ipv6' | 'ipvfuture';
interface Expression {
/** The CIDR mode. */
cidr: Cidr;
/** The raw regular expression string. */
raw: string;
/** The regular expression. */
regex: RegExp;
/** The array of versions allowed. */
versions: Version[];
}
/**
* Generates a regular expression used to validate IP addresses.
*
* @param options - optional settings.
*
* @returns an object with the regular expression and meta data.
*/
export declare function ipRegex(options?: Options): Expression;
export {};

48
node_modules/@hapi/address/dist/ip.js generated vendored Normal file
View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ipRegex = void 0;
const hoek_1 = require("@hapi/hoek");
const uri_1 = require("./uri");
/**
* Generates a regular expression used to validate IP addresses.
*
* @param options - optional settings.
*
* @returns an object with the regular expression and meta data.
*/
function ipRegex(options = {}) {
// CIDR
const cidr = options.cidr || 'optional';
(0, hoek_1.assert)(['required', 'optional', 'forbidden'].includes(cidr), 'options.cidr must be one of required, optional, forbidden');
// Versions
(0, hoek_1.assert)(options.version === undefined || typeof options.version === 'string' || Array.isArray(options.version), 'options.version must be a string or an array of string');
let versions = options.version || ['ipv4', 'ipv6', 'ipvfuture'];
if (!Array.isArray(versions)) {
versions = [versions];
}
(0, hoek_1.assert)(versions.length >= 1, 'options.version must have at least 1 version specified');
for (const version of versions) {
(0, hoek_1.assert)(typeof version === 'string' && version === version.toLowerCase(), 'Invalid options.version value');
(0, hoek_1.assert)(['ipv4', 'ipv6', 'ipvfuture'].includes(version), 'options.version contains unknown version ' + version + ' - must be one of ipv4, ipv6, ipvfuture');
}
versions = Array.from(new Set(versions));
// Regex
const parts = versions.map((version) => {
// Forbidden
if (cidr === 'forbidden') {
return uri_1.ipVersions[version];
}
// Required
const cidrpart = `\\/${version === 'ipv4' ? uri_1.ipVersions.v4Cidr : uri_1.ipVersions.v6Cidr}`;
if (cidr === 'required') {
return `${uri_1.ipVersions[version]}${cidrpart}`;
}
// Optional
return `${uri_1.ipVersions[version]}(?:${cidrpart})?`;
});
const raw = `(?:${parts.join('|')})`;
const regex = new RegExp(`^${raw}$`);
return { cidr, versions, regex, raw };
}
exports.ipRegex = ipRegex;
//# sourceMappingURL=ip.js.map

1
node_modules/@hapi/address/dist/ip.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"ip.js","sourceRoot":"","sources":["../src/ip.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAEpC,+BAAmC;AAmCnC;;;;;;GAMG;AACH,SAAgB,OAAO,CAAC,UAAmB,EAAE;IACzC,OAAO;IAEP,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,UAAU,CAAC;IACxC,IAAA,aAAM,EACF,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EACpD,2DAA2D,CAC9D,CAAC;IAEF,WAAW;IAEX,IAAA,aAAM,EACF,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EACtG,wDAAwD,CAC3D,CAAC;IAEF,IAAI,QAAQ,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IAChE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAC1B,QAAQ,GAAG,CAAC,QAAQ,CAAC,CAAC;KACzB;IAED,IAAA,aAAM,EAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,EAAE,wDAAwD,CAAC,CAAC;IAEvF,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC5B,IAAA,aAAM,EAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO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ture: string;
};
interface Expression {
/** The raw regular expression string. */
raw: string;
/** The regular expression. */
regex: RegExp;
/** The specified URI scheme */
scheme: string | null;
}
/**
* Generates a regular expression used to validate URI addresses.
*
* @param options - optional settings.
*
* @returns an object with the regular expression and meta data.
*/
export declare function uriRegex(options?: Options): Expression;
type Scheme = string | RegExp;
interface Options {
/**
* Allow the use of [] in query parameters.
*
* @default false
*/
readonly allowQuerySquareBrackets?: boolean;
/**
* Allow relative URIs.
*
* @default false
*/
readonly allowRelative?: boolean;
/**
* Requires the URI to be relative.
*
* @default false
*/
readonly relativeOnly?: boolean;
/**
* Capture domain segment ($1).
*
* @default false
*/
readonly domain?: boolean;
/**
* The allowed URI schemes.
*/
readonly scheme?: Scheme | Scheme[];
}
export {};

216
node_modules/@hapi/address/dist/uri.js generated vendored Normal file
View File

@@ -0,0 +1,216 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.uriRegex = exports.ipVersions = void 0;
const hoek_1 = require("@hapi/hoek");
function generate() {
const rfc3986 = {};
const hexDigit = '\\dA-Fa-f'; // HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
const hexDigitOnly = '[' + hexDigit + ']';
const unreserved = '\\w-\\.~'; // unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
const subDelims = "!\\$&'\\(\\)\\*\\+,;="; // sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
const pctEncoded = '%' + hexDigit; // pct-encoded = "%" HEXDIG HEXDIG
const pchar = unreserved + pctEncoded + subDelims + ':@'; // pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
const pcharOnly = '[' + pchar + ']';
const decOctect = '(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])'; // dec-octet = DIGIT / %x31-39 DIGIT / "1" 2DIGIT / "2" %x30-34 DIGIT / "25" %x30-35 ; 0-9 / 10-99 / 100-199 / 200-249 / 250-255
rfc3986.ipv4address = '(?:' + decOctect + '\\.){3}' + decOctect; // IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
/*
h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal
ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address
IPv6address = 6( h16 ":" ) ls32
/ "::" 5( h16 ":" ) ls32
/ [ h16 ] "::" 4( h16 ":" ) ls32
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
/ [ *4( h16 ":" ) h16 ] "::" ls32
/ [ *5( h16 ":" ) h16 ] "::" h16
/ [ *6( h16 ":" ) h16 ] "::"
*/
const h16 = hexDigitOnly + '{1,4}';
const ls32 = '(?:' + h16 + ':' + h16 + '|' + rfc3986.ipv4address + ')';
const IPv6SixHex = '(?:' + h16 + ':){6}' + ls32;
const IPv6FiveHex = '::(?:' + h16 + ':){5}' + ls32;
const IPv6FourHex = '(?:' + h16 + ')?::(?:' + h16 + ':){4}' + ls32;
const IPv6ThreeHex = '(?:(?:' + h16 + ':){0,1}' + h16 + ')?::(?:' + h16 + ':){3}' + ls32;
const IPv6TwoHex = '(?:(?:' + h16 + ':){0,2}' + h16 + ')?::(?:' + h16 + ':){2}' + ls32;
const IPv6OneHex = '(?:(?:' + h16 + ':){0,3}' + h16 + ')?::' + h16 + ':' + ls32;
const IPv6NoneHex = '(?:(?:' + h16 + ':){0,4}' + h16 + ')?::' + ls32;
const IPv6NoneHex2 = '(?:(?:' + h16 + ':){0,5}' + h16 + ')?::' + h16;
const IPv6NoneHex3 = '(?:(?:' + h16 + ':){0,6}' + h16 + ')?::';
rfc3986.ipv4Cidr = '(?:\\d|[1-2]\\d|3[0-2])'; // IPv4 cidr = DIGIT / %x31-32 DIGIT / "3" %x30-32 ; 0-9 / 10-29 / 30-32
rfc3986.ipv6Cidr = '(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])'; // IPv6 cidr = DIGIT / %x31-39 DIGIT / "1" %x0-1 DIGIT / "12" %x0-8; 0-9 / 10-99 / 100-119 / 120-128
rfc3986.ipv6address =
'(?:' +
IPv6SixHex +
'|' +
IPv6FiveHex +
'|' +
IPv6FourHex +
'|' +
IPv6ThreeHex +
'|' +
IPv6TwoHex +
'|' +
IPv6OneHex +
'|' +
IPv6NoneHex +
'|' +
IPv6NoneHex2 +
'|' +
IPv6NoneHex3 +
')';
rfc3986.ipvFuture = 'v' + hexDigitOnly + '+\\.[' + unreserved + subDelims + ':]+'; // IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
rfc3986.scheme = '[a-zA-Z][a-zA-Z\\d+-\\.]*'; // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
rfc3986.schemeRegex = new RegExp(rfc3986.scheme);
const userinfo = '[' + unreserved + pctEncoded + subDelims + ':]*'; // userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
const IPLiteral = '\\[(?:' + rfc3986.ipv6address + '|' + rfc3986.ipvFuture + ')\\]'; // IP-literal = "[" ( IPv6address / IPvFuture ) "]"
const regName = '[' + unreserved + pctEncoded + subDelims + ']{1,255}'; // reg-name = *( unreserved / pct-encoded / sub-delims )
const host = '(?:' + IPLiteral + '|' + rfc3986.ipv4address + '|' + regName + ')'; // host = IP-literal / IPv4address / reg-name
const port = '\\d*'; // port = *DIGIT
const authority = '(?:' + userinfo + '@)?' + host + '(?::' + port + ')?'; // authority = [ userinfo "@" ] host [ ":" port ]
const authorityCapture = '(?:' + userinfo + '@)?(' + host + ')(?::' + port + ')?';
/*
segment = *pchar
segment-nz = 1*pchar
path = path-abempty ; begins with "/" '|' is empty
/ path-absolute ; begins with "/" but not "//"
/ path-noscheme ; begins with a non-colon segment
/ path-rootless ; begins with a segment
/ path-empty ; zero characters
path-abempty = *( "/" segment )
path-absolute = "/" [ segment-nz *( "/" segment ) ]
path-rootless = segment-nz *( "/" segment )
*/
const segment = pcharOnly + '*';
const segmentNz = pcharOnly + '+';
const segmentNzNc = '[' + unreserved + pctEncoded + subDelims + '@' + ']+';
const pathEmpty = '';
const pathAbEmpty = '(?:\\/' + segment + ')*';
const pathAbsolute = '\\/(?:' + segmentNz + pathAbEmpty + ')?';
const pathRootless = segmentNz + pathAbEmpty;
const pathNoScheme = segmentNzNc + pathAbEmpty;
const pathAbNoAuthority = '(?:\\/\\/\\/' + segment + pathAbEmpty + ')'; // Used by file:///
// hier-part = "//" authority path
rfc3986.hierPart =
'(?:' +
'(?:\\/\\/' +
authority +
pathAbEmpty +
')' +
'|' +
pathAbsolute +
'|' +
pathRootless +
'|' +
pathAbNoAuthority +
')';
rfc3986.hierPartCapture =
'(?:' + '(?:\\/\\/' + authorityCapture + pathAbEmpty + ')' + '|' + pathAbsolute + '|' + pathRootless + ')';
// relative-part = "//" authority path-abempty / path-absolute / path-noscheme / path-empty
rfc3986.relativeRef =
'(?:' +
'(?:\\/\\/' +
authority +
pathAbEmpty +
')' +
'|' +
pathAbsolute +
'|' +
pathNoScheme +
'|' +
pathEmpty +
')';
rfc3986.relativeRefCapture =
'(?:' +
'(?:\\/\\/' +
authorityCapture +
pathAbEmpty +
')' +
'|' +
pathAbsolute +
'|' +
pathNoScheme +
'|' +
pathEmpty +
')';
// query = *( pchar / "/" / "?" )
// query = *( pchar / "[" / "]" / "/" / "?" )
rfc3986.query = '[' + pchar + '\\/\\?]*(?=#|$)'; //Finish matching either at the fragment part '|' end of the line.
rfc3986.queryWithSquareBrackets = '[' + pchar + '\\[\\]\\/\\?]*(?=#|$)';
// fragment = *( pchar / "/" / "?" )
rfc3986.fragment = '[' + pchar + '\\/\\?]*';
return rfc3986;
}
const rfc3986 = generate();
exports.ipVersions = {
v4Cidr: rfc3986.ipv4Cidr,
v6Cidr: rfc3986.ipv6Cidr,
ipv4: rfc3986.ipv4address,
ipv6: rfc3986.ipv6address,
ipvfuture: rfc3986.ipvFuture
};
function createRegex(options) {
const rfc = rfc3986;
// Construct expression
const query = options.allowQuerySquareBrackets ? rfc.queryWithSquareBrackets : rfc.query;
const suffix = '(?:\\?' + query + ')?' + '(?:#' + rfc.fragment + ')?';
// relative-ref = relative-part [ "?" query ] [ "#" fragment ]
const relative = options.domain ? rfc.relativeRefCapture : rfc.relativeRef;
if (options.relativeOnly) {
return wrap(relative + suffix);
}
// Custom schemes
let customScheme = '';
if (options.scheme) {
(0, hoek_1.assert)(options.scheme instanceof RegExp || typeof options.scheme === 'string' || Array.isArray(options.scheme), 'scheme must be a RegExp, String, or Array');
const schemes = [].concat(options.scheme);
(0, hoek_1.assert)(schemes.length >= 1, 'scheme must have at least 1 scheme specified');
// Flatten the array into a string to be used to match the schemes
const selections = [];
for (let i = 0; i < schemes.length; ++i) {
const scheme = schemes[i];
(0, hoek_1.assert)(scheme instanceof RegExp || typeof scheme === 'string', 'scheme at position ' + i + ' must be a RegExp or String');
if (scheme instanceof RegExp) {
selections.push(scheme.source.toString());
}
else {
(0, hoek_1.assert)(rfc.schemeRegex.test(scheme), 'scheme at position ' + i + ' must be a valid scheme');
selections.push((0, hoek_1.escapeRegex)(scheme));
}
}
customScheme = selections.join('|');
}
// URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
const scheme = customScheme ? '(?:' + customScheme + ')' : rfc.scheme;
const absolute = '(?:' + scheme + ':' + (options.domain ? rfc.hierPartCapture : rfc.hierPart) + ')';
const prefix = options.allowRelative ? '(?:' + absolute + '|' + relative + ')' : absolute;
return wrap(prefix + suffix, customScheme);
}
function wrap(raw, scheme = null) {
raw = `(?=.)(?!https?\:/(?:$|[^/]))(?!https?\:///)(?!https?\:[^/])${raw}`; // Require at least one character and explicitly forbid 'http:/' or HTTP with empty domain
return {
raw,
regex: new RegExp(`^${raw}$`),
scheme
};
}
const genericUriRegex = createRegex({});
/**
* Generates a regular expression used to validate URI addresses.
*
* @param options - optional settings.
*
* @returns an object with the regular expression and meta data.
*/
function uriRegex(options = {}) {
if (options.scheme ||
options.allowRelative ||
options.relativeOnly ||
options.allowQuerySquareBrackets ||
options.domain) {
return createRegex(options);
}
return genericUriRegex;
}
exports.uriRegex = uriRegex;
//# sourceMappingURL=uri.js.map

1
node_modules/@hapi/address/dist/uri.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

8
node_modules/@hapi/address/esm/decode.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/**
* Faster version of decodeURIComponent() that does not throw.
*
* @param string - the URL string to decode.
*
* @returns the decoded string or null if invalid.
*/
export declare function uriDecode(string: string): string;

99
node_modules/@hapi/address/esm/decode.js generated vendored Normal file
View File

@@ -0,0 +1,99 @@
const HEX = {
'0': 0,
'1': 1,
'2': 2,
'3': 3,
'4': 4,
'5': 5,
'6': 6,
'7': 7,
'8': 8,
'9': 9,
a: 10,
A: 10,
b: 11,
B: 11,
c: 12,
C: 12,
d: 13,
D: 13,
e: 14,
E: 14,
f: 15,
F: 15
};
const UTF8 = {
accept: 12,
reject: 0,
data: [
// Maps bytes to character to a transition
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 7, 10, 9, 9, 9, 11, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
// Maps a state to a new state when adding a transition
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 24, 36, 48, 60, 72, 84, 96, 0, 12, 12, 12, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,
// Maps the current transition to a mask that needs to apply to the byte
0x7f, 0x3f, 0x3f, 0x3f, 0x00, 0x1f, 0x0f, 0x0f, 0x0f, 0x07, 0x07, 0x07
]
};
/**
* Faster version of decodeURIComponent() that does not throw.
*
* @param string - the URL string to decode.
*
* @returns the decoded string or null if invalid.
*/
export function uriDecode(string) {
let percentPos = string.indexOf('%');
if (percentPos === -1) {
return string;
}
let decoded = '';
let last = 0;
let codepoint = 0;
let startOfOctets = percentPos;
let state = UTF8.accept;
while (percentPos > -1 && percentPos < string.length) {
const high = resolveHex(string[percentPos + 1], 4);
const low = resolveHex(string[percentPos + 2], 0);
const byte = high | low;
const type = UTF8.data[byte];
state = UTF8.data[256 + state + type];
codepoint = (codepoint << 6) | (byte & UTF8.data[364 + type]);
if (state === UTF8.accept) {
decoded += string.slice(last, startOfOctets);
decoded +=
codepoint <= 0xffff
? String.fromCharCode(codepoint)
: String.fromCharCode(0xd7c0 + (codepoint >> 10), 0xdc00 + (codepoint & 0x3ff));
codepoint = 0;
last = percentPos + 3;
percentPos = string.indexOf('%', last);
startOfOctets = percentPos;
continue;
}
if (state === UTF8.reject) {
return null;
}
percentPos += 3;
if (percentPos >= string.length || string[percentPos] !== '%') {
return null;
}
}
return decoded + string.slice(last);
}
function resolveHex(char, shift) {
const i = HEX[char];
return i === undefined ? 255 : i << shift;
}
// Adapted from:
// Copyright (c) 2017-2019 Justin Ridgewell, MIT Licensed, https://github.com/jridgewell/safe-decode-string-component
// Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>, MIT Licensed, http://bjoern.hoehrmann.de/utf-8/decoder/dfa/
//# sourceMappingURL=decode.js.map

1
node_modules/@hapi/address/esm/decode.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

74
node_modules/@hapi/address/esm/domain.d.ts generated vendored Normal file
View File

@@ -0,0 +1,74 @@
interface TldsAllow {
readonly allow: Set<string>;
}
interface TldsDeny {
readonly deny: Set<string>;
}
export interface DomainOptions {
/**
* Determines whether Unicode characters are allowed.
*
* @default true
*/
readonly allowUnicode?: boolean;
/**
* Determines whether underscore (_) characters are allowed.
*
* @default false
*/
readonly allowUnderscore?: boolean;
/**
* The maximum number of domain segments (e.g. `x.y.z` has 3 segments) allowed.
*
* @default Infinity
*/
readonly maxDomainSegments?: number;
/**
* The minimum number of domain segments (e.g. `x.y.z` has 3 segments) required.
*
* @default 2
*/
readonly minDomainSegments?: number;
/**
* Top-level-domain options
*
* @default true
*/
readonly tlds?: TldsAllow | TldsDeny;
/**
* Allows passing fully qualified domain (ends with a period)
*
* @default false
*/
readonly allowFullyQualified?: boolean;
}
export interface Analysis {
/**
* The reason validation failed.
*/
error: string;
/**
* The error code.
*/
code: string;
}
/**
* Analyzes a string to verify it is a valid domain name.
*
* @param domain - the domain name to validate.
* @param options - optional settings.
*
* @return - undefined when valid, otherwise an object with single error key with a string message value.
*/
export declare function analyzeDomain(domain: string, options?: DomainOptions): Analysis | null;
/**
* Analyzes a string to verify it is a valid domain name.
*
* @param domain - the domain name to validate.
* @param options - optional settings.
*
* @return - true when valid, otherwise false.
*/
export declare function isDomainValid(domain: string, options?: DomainOptions): boolean;
export declare function validateDomainOptions(options: DomainOptions): void;
export {};

141
node_modules/@hapi/address/esm/domain.js generated vendored Normal file
View File

@@ -0,0 +1,141 @@
import * as Url from 'url';
import { errorCode } from './errors';
const MIN_DOMAIN_SEGMENTS = 2;
const NON_ASCII_RX = /[^\x00-\x7f]/;
const DOMAIN_CONTROL_RX = /[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/; // Control + space + separators
const TLD_SEGMENT_RX = /^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/;
const DOMAIN_SEGMENT_RX = /^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/;
const DOMAIN_UNDERSCORE_SEGMENT_RX = /^[a-zA-Z0-9_](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/;
const URL_IMPL = Url.URL || URL; // $lab:coverage:ignore$
function isTldsAllow(tlds) {
return !!tlds.allow;
}
/**
* Analyzes a string to verify it is a valid domain name.
*
* @param domain - the domain name to validate.
* @param options - optional settings.
*
* @return - undefined when valid, otherwise an object with single error key with a string message value.
*/
export function analyzeDomain(domain, options = {}) {
if (!domain) {
// Catch null / undefined
return errorCode('DOMAIN_NON_EMPTY_STRING');
}
if (typeof domain !== 'string') {
throw new Error('Invalid input: domain must be a string');
}
if (domain.length > 256) {
return errorCode('DOMAIN_TOO_LONG');
}
const ascii = !NON_ASCII_RX.test(domain);
if (!ascii) {
if (options.allowUnicode === false) {
// Defaults to true
return errorCode('DOMAIN_INVALID_UNICODE_CHARS');
}
domain = domain.normalize('NFC');
}
if (DOMAIN_CONTROL_RX.test(domain)) {
return errorCode('DOMAIN_INVALID_CHARS');
}
domain = punycode(domain);
// https://tools.ietf.org/html/rfc1035 section 2.3.1
if (options.allowFullyQualified && domain[domain.length - 1] === '.') {
domain = domain.slice(0, -1);
}
const minDomainSegments = options.minDomainSegments || MIN_DOMAIN_SEGMENTS;
const segments = domain.split('.');
if (segments.length < minDomainSegments) {
return errorCode('DOMAIN_SEGMENTS_COUNT');
}
if (options.maxDomainSegments) {
if (segments.length > options.maxDomainSegments) {
return errorCode('DOMAIN_SEGMENTS_COUNT_MAX');
}
}
const tlds = options.tlds;
if (tlds) {
const tld = segments[segments.length - 1].toLowerCase();
if (isTldsAllow(tlds)) {
if (!tlds.allow.has(tld)) {
return errorCode('DOMAIN_FORBIDDEN_TLDS');
}
}
else if (tlds.deny.has(tld)) {
return errorCode('DOMAIN_FORBIDDEN_TLDS');
}
}
for (let i = 0; i < segments.length; ++i) {
const segment = segments[i];
if (!segment.length) {
return errorCode('DOMAIN_EMPTY_SEGMENT');
}
if (segment.length > 63) {
return errorCode('DOMAIN_LONG_SEGMENT');
}
if (i < segments.length - 1) {
if (options.allowUnderscore) {
if (!DOMAIN_UNDERSCORE_SEGMENT_RX.test(segment)) {
return errorCode('DOMAIN_INVALID_CHARS');
}
}
else {
if (!DOMAIN_SEGMENT_RX.test(segment)) {
return errorCode('DOMAIN_INVALID_CHARS');
}
}
}
else {
if (!TLD_SEGMENT_RX.test(segment)) {
return errorCode('DOMAIN_INVALID_TLDS_CHARS');
}
}
}
return null;
}
/**
* Analyzes a string to verify it is a valid domain name.
*
* @param domain - the domain name to validate.
* @param options - optional settings.
*
* @return - true when valid, otherwise false.
*/
export function isDomainValid(domain, options) {
return !analyzeDomain(domain, options);
}
function punycode(domain) {
if (domain.includes('%')) {
domain = domain.replace(/%/g, '%25');
}
try {
return new URL_IMPL(`http://${domain}`).host;
}
catch (err) {
return domain;
}
}
export function validateDomainOptions(options) {
if (!options) {
return;
}
if (typeof options.tlds !== 'object') {
throw new Error('Invalid options: tlds must be a boolean or an object');
}
if (isTldsAllow(options.tlds)) {
if (options.tlds.allow instanceof Set === false) {
throw new Error('Invalid options: tlds.allow must be a Set object or true');
}
if (options.tlds.deny) {
throw new Error('Invalid options: cannot specify both tlds.allow and tlds.deny lists');
}
}
else {
if (options.tlds.deny instanceof Set === false) {
throw new Error('Invalid options: tlds.deny must be a Set object');
}
}
}
//# sourceMappingURL=domain.js.map

1
node_modules/@hapi/address/esm/domain.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../src/domain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAE3B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,MAAM,iBAAiB,GAAG,wCAAwC,CAAC,CAAC,+BAA+B;AACnG,MAAM,cAAc,GAAG,0CAA0C,CAAC;AAClE,MAAM,iBAAiB,GAAG,6CAA6C,CAAC;AACxE,MAAM,4BAA4B,GAAG,8CAA8C,CAAC;AACpF,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,wBAAwB;AAUzD,SAAS,WAAW,CAAC,IAAS;IAC1B,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;AACxB,CAAC;AA0DD;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,UAAyB,EAAE;IACrE,IAAI,CAAC,MAAM,EAAE;QACT,yBAAyB;QACzB,OAAO,SAAS,CAAC,yBAAyB,CAAC,CAAC;KAC/C;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;KAC7D;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE;QACrB,OAAO,SAAS,CAAC,iBAAiB,CAAC,CAAC;KACvC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CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,QAAQ,CAAC,MAAc;IAC5B,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACtB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;KACxC;IAED,IAAI;QACA,OAAO,IAAI,QAAQ,CAAC,UAAU,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC;KAChD;IAAC,OAAO,GAAG,EAAE;QACV,OAAO,MAAM,CAAC;KACjB;AACL,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAsB;IACxD,IAAI,CAAC,OAAO,EAAE;QACV,OAAO;KACV;IAED,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE;QAClC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;KAC3E;IAED,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC3B,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,YAAY,GAAG,KAAK,KAAK,EAAE;YAC7C,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;SAC/E;QAED,IAAK,OAAO,CAAC,IAAY,CAAC,IAAI,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;SAC1F;KACJ;SAAM;QACH,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,YAAY,GAAG,KAAK,KAAK,EAAE;YAC5C,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACtE;KACJ;AACL,CAAC"}

27
node_modules/@hapi/address/esm/email.d.ts generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import { Analysis, DomainOptions } from './domain';
export interface EmailOptions extends DomainOptions {
/**
* Determines whether to ignore the standards maximum email length limit.
*
* @default false
*/
readonly ignoreLength?: boolean;
}
/**
* Analyzes a string to verify it is a valid email address.
*
* @param email - the email address to validate.
* @param options - optional settings.
*
* @return - undefined when valid, otherwise an object with single error key with a string message value.
*/
export declare function analyzeEmail(email: string, options?: EmailOptions): Analysis | null;
/**
* Analyzes a string to verify it is a valid email address.
*
* @param email - the email address to validate.
* @param options - optional settings.
*
* @return - true when valid, otherwise false.
*/
export declare function isEmailValid(email: string, options?: EmailOptions): boolean;

143
node_modules/@hapi/address/esm/email.js generated vendored Normal file
View File

@@ -0,0 +1,143 @@
import * as Util from 'util';
import { analyzeDomain } from './domain';
import { errorCode } from './errors';
const NON_ASCII_RX = /[^\x00-\x7f]/;
const ENCODER_IMPL = new (Util.TextEncoder || TextEncoder)(); // $lab:coverage:ignore$
/**
* Analyzes a string to verify it is a valid email address.
*
* @param email - the email address to validate.
* @param options - optional settings.
*
* @return - undefined when valid, otherwise an object with single error key with a string message value.
*/
export function analyzeEmail(email, options) {
return validateEmail(email, options);
}
/**
* Analyzes a string to verify it is a valid email address.
*
* @param email - the email address to validate.
* @param options - optional settings.
*
* @return - true when valid, otherwise false.
*/
export function isEmailValid(email, options) {
return !validateEmail(email, options);
}
function validateEmail(email, options = {}) {
if (typeof email !== 'string') {
throw new Error('Invalid input: email must be a string');
}
if (!email) {
return errorCode('EMPTY_STRING');
}
// Unicode
const ascii = !NON_ASCII_RX.test(email);
if (!ascii) {
if (options.allowUnicode === false) {
// Defaults to true
return errorCode('FORBIDDEN_UNICODE');
}
email = email.normalize('NFC');
}
// Basic structure
const parts = email.split('@');
if (parts.length !== 2) {
return parts.length > 2 ? errorCode('MULTIPLE_AT_CHAR') : errorCode('MISSING_AT_CHAR');
}
const [local, domain] = parts;
if (!local) {
return errorCode('EMPTY_LOCAL');
}
if (!options.ignoreLength) {
if (email.length > 254) {
// http://tools.ietf.org/html/rfc5321#section-4.5.3.1.3
return errorCode('ADDRESS_TOO_LONG');
}
if (ENCODER_IMPL.encode(local).length > 64) {
// http://tools.ietf.org/html/rfc5321#section-4.5.3.1.1
return errorCode('LOCAL_TOO_LONG');
}
}
// Validate parts
return validateLocal(local, ascii) || analyzeDomain(domain, options);
}
function validateLocal(local, ascii) {
const segments = local.split('.');
for (const segment of segments) {
if (!segment.length) {
return errorCode('EMPTY_LOCAL_SEGMENT');
}
if (ascii) {
if (!ATEXT_RX.test(segment)) {
return errorCode('INVALID_LOCAL_CHARS');
}
continue;
}
for (const char of segment) {
if (ATEXT_RX.test(char)) {
continue;
}
const binary = toBinary(char);
if (!ATOM_RX.test(binary)) {
return errorCode('INVALID_LOCAL_CHARS');
}
}
}
return null;
}
function toBinary(char) {
return Array.from(ENCODER_IMPL.encode(char), (v) => String.fromCharCode(v)).join('');
}
/*
From RFC 5321:
Mailbox = Local-part "@" ( Domain / address-literal )
Local-part = Dot-string / Quoted-string
Dot-string = Atom *("." Atom)
Atom = 1*atext
atext = ALPHA / DIGIT / "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "/" / "=" / "?" / "^" / "_" / "`" / "{" / "|" / "}" / "~"
Domain = sub-domain *("." sub-domain)
sub-domain = Let-dig [Ldh-str]
Let-dig = ALPHA / DIGIT
Ldh-str = *( ALPHA / DIGIT / "-" ) Let-dig
ALPHA = %x41-5A / %x61-7A ; a-z, A-Z
DIGIT = %x30-39 ; 0-9
From RFC 6531:
sub-domain =/ U-label
atext =/ UTF8-non-ascii
UTF8-non-ascii = UTF8-2 / UTF8-3 / UTF8-4
UTF8-2 = %xC2-DF UTF8-tail
UTF8-3 = %xE0 %xA0-BF UTF8-tail /
%xE1-EC 2( UTF8-tail ) /
%xED %x80-9F UTF8-tail /
%xEE-EF 2( UTF8-tail )
UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) /
%xF1-F3 3( UTF8-tail ) /
%xF4 %x80-8F 2( UTF8-tail )
UTF8-tail = %x80-BF
Note: The following are not supported:
RFC 5321: address-literal, Quoted-string
RFC 5322: obs-*, CFWS
*/
const ATEXT_RX = /^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/; // _ included in \w
const ATOM_RX = new RegExp([
// %xC2-DF UTF8-tail
'(?:[\\xc2-\\xdf][\\x80-\\xbf])',
// %xE0 %xA0-BF UTF8-tail %xE1-EC 2( UTF8-tail ) %xED %x80-9F UTF8-tail %xEE-EF 2( UTF8-tail )
'(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})',
// %xF0 %x90-BF 2( UTF8-tail ) %xF1-F3 3( UTF8-tail ) %xF4 %x80-8F 2( UTF8-tail )
'(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})'
].join('|'));
//# sourceMappingURL=email.js.map

1
node_modules/@hapi/address/esm/email.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"email.js","sourceRoot":"","sources":["../src/email.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,aAAa,EAA2B,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,EAAE,CAAC,CAAC,wBAAwB;AAWtF;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,OAAsB;IAC9D,OAAO,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,OAAsB;IAC9D,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,aAAa,CAAC,KAAa,EAAE,UA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C,oIAAoI;IACpI,6IAA6I;IAE7I,wGAAwG;IACxG,iHAAiH;CACpH,CAAC,IAAI,CAAC,GAAG,CAAC,CACd,CAAC"}

45
node_modules/@hapi/address/esm/errors.d.ts generated vendored Normal file
View File

@@ -0,0 +1,45 @@
export declare const errorCodes: {
EMPTY_STRING: string;
FORBIDDEN_UNICODE: string;
MULTIPLE_AT_CHAR: string;
MISSING_AT_CHAR: string;
EMPTY_LOCAL: string;
ADDRESS_TOO_LONG: string;
LOCAL_TOO_LONG: string;
EMPTY_LOCAL_SEGMENT: string;
INVALID_LOCAL_CHARS: string;
DOMAIN_NON_EMPTY_STRING: string;
DOMAIN_TOO_LONG: string;
DOMAIN_INVALID_UNICODE_CHARS: string;
DOMAIN_INVALID_CHARS: string;
DOMAIN_INVALID_TLDS_CHARS: string;
DOMAIN_SEGMENTS_COUNT: string;
DOMAIN_SEGMENTS_COUNT_MAX: string;
DOMAIN_FORBIDDEN_TLDS: string;
DOMAIN_EMPTY_SEGMENT: string;
DOMAIN_LONG_SEGMENT: string;
};
export declare function errorCode<TCode extends keyof typeof errorCodes>(code: TCode): {
code: TCode;
error: {
EMPTY_STRING: string;
FORBIDDEN_UNICODE: string;
MULTIPLE_AT_CHAR: string;
MISSING_AT_CHAR: string;
EMPTY_LOCAL: string;
ADDRESS_TOO_LONG: string;
LOCAL_TOO_LONG: string;
EMPTY_LOCAL_SEGMENT: string;
INVALID_LOCAL_CHARS: string;
DOMAIN_NON_EMPTY_STRING: string;
DOMAIN_TOO_LONG: string;
DOMAIN_INVALID_UNICODE_CHARS: string;
DOMAIN_INVALID_CHARS: string;
DOMAIN_INVALID_TLDS_CHARS: string;
DOMAIN_SEGMENTS_COUNT: string;
DOMAIN_SEGMENTS_COUNT_MAX: string;
DOMAIN_FORBIDDEN_TLDS: string;
DOMAIN_EMPTY_SEGMENT: string;
DOMAIN_LONG_SEGMENT: string;
}[TCode];
};

25
node_modules/@hapi/address/esm/errors.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
export const errorCodes = {
EMPTY_STRING: 'Address must be a non-empty string',
FORBIDDEN_UNICODE: 'Address contains forbidden Unicode characters',
MULTIPLE_AT_CHAR: 'Address cannot contain more than one @ character',
MISSING_AT_CHAR: 'Address must contain one @ character',
EMPTY_LOCAL: 'Address local part cannot be empty',
ADDRESS_TOO_LONG: 'Address too long',
LOCAL_TOO_LONG: 'Address local part too long',
EMPTY_LOCAL_SEGMENT: 'Address local part contains empty dot-separated segment',
INVALID_LOCAL_CHARS: 'Address local part contains invalid character',
DOMAIN_NON_EMPTY_STRING: 'Domain must be a non-empty string',
DOMAIN_TOO_LONG: 'Domain too long',
DOMAIN_INVALID_UNICODE_CHARS: 'Domain contains forbidden Unicode characters',
DOMAIN_INVALID_CHARS: 'Domain contains invalid character',
DOMAIN_INVALID_TLDS_CHARS: 'Domain contains invalid tld character',
DOMAIN_SEGMENTS_COUNT: 'Domain lacks the minimum required number of segments',
DOMAIN_SEGMENTS_COUNT_MAX: 'Domain contains too many segments',
DOMAIN_FORBIDDEN_TLDS: 'Domain uses forbidden TLD',
DOMAIN_EMPTY_SEGMENT: 'Domain contains empty dot-separated segment',
DOMAIN_LONG_SEGMENT: 'Domain contains dot-separated segment that is too long'
};
export function errorCode(code) {
return { code, error: errorCodes[code] };
}
//# sourceMappingURL=errors.js.map

1
node_modules/@hapi/address/esm/errors.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB,YAAY,EAAE,oCAAoC;IAClD,iBAAiB,EAAE,+CAA+C;IAClE,gBAAgB,EAAE,kDAAkD;IACpE,eAAe,EAAE,sCAAsC;IACvD,WAAW,EAAE,oCAAoC;IACjD,gBAAgB,EAAE,kBAAkB;IACpC,cAAc,EAAE,6BAA6B;IAC7C,mBAAmB,EAAE,yDAAyD;IAC9E,mBAAmB,EAAE,+CAA+C;IACpE,uBAAuB,EAAE,mCAAmC;IAC5D,eAAe,EAAE,iBAAiB;IAClC,4BAA4B,EAAE,8CAA8C;IAC5E,oBAAoB,EAAE,mCAAmC;IACzD,yBAAyB,EAAE,uCAAuC;IAClE,qBAAqB,EAAE,sDAAsD;IAC7E,yBAAyB,EAAE,mCAAmC;IAC9D,qBAAqB,EAAE,2BAA2B;IAClD,oBAAoB,EAAE,6CAA6C;IACnE,mBAAmB,EAAE,wDAAwD;CAChF,CAAC;AAEF,MAAM,UAAU,SAAS,CAAwC,IAAW;IACxE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;AAC7C,CAAC"}

6
node_modules/@hapi/address/esm/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
export * from './domain';
export * from './email';
export { errorCodes } from './errors';
export { ipRegex } from './ip';
export { uriRegex } from './uri';
export { uriDecode } from './decode';

7
node_modules/@hapi/address/esm/index.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
export * from './domain';
export * from './email';
export { errorCodes } from './errors';
export { ipRegex } from './ip';
export { uriRegex } from './uri';
export { uriDecode } from './decode';
//# sourceMappingURL=index.js.map

1
node_modules/@hapi/address/esm/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC"}

35
node_modules/@hapi/address/esm/ip.d.ts generated vendored Normal file
View File

@@ -0,0 +1,35 @@
interface Options {
/**
* The required CIDR mode.
*
* @default 'optional'
*/
readonly cidr?: Cidr;
/**
* The allowed versions.
*
* @default ['ipv4', 'ipv6', 'ipvfuture']
*/
readonly version?: Version | Version[];
}
type Cidr = 'optional' | 'required' | 'forbidden';
type Version = 'ipv4' | 'ipv6' | 'ipvfuture';
interface Expression {
/** The CIDR mode. */
cidr: Cidr;
/** The raw regular expression string. */
raw: string;
/** The regular expression. */
regex: RegExp;
/** The array of versions allowed. */
versions: Version[];
}
/**
* Generates a regular expression used to validate IP addresses.
*
* @param options - optional settings.
*
* @returns an object with the regular expression and meta data.
*/
export declare function ipRegex(options?: Options): Expression;
export {};

44
node_modules/@hapi/address/esm/ip.js generated vendored Normal file
View File

@@ -0,0 +1,44 @@
import { assert } from '@hapi/hoek';
import { ipVersions } from './uri';
/**
* Generates a regular expression used to validate IP addresses.
*
* @param options - optional settings.
*
* @returns an object with the regular expression and meta data.
*/
export function ipRegex(options = {}) {
// CIDR
const cidr = options.cidr || 'optional';
assert(['required', 'optional', 'forbidden'].includes(cidr), 'options.cidr must be one of required, optional, forbidden');
// Versions
assert(options.version === undefined || typeof options.version === 'string' || Array.isArray(options.version), 'options.version must be a string or an array of string');
let versions = options.version || ['ipv4', 'ipv6', 'ipvfuture'];
if (!Array.isArray(versions)) {
versions = [versions];
}
assert(versions.length >= 1, 'options.version must have at least 1 version specified');
for (const version of versions) {
assert(typeof version === 'string' && version === version.toLowerCase(), 'Invalid options.version value');
assert(['ipv4', 'ipv6', 'ipvfuture'].includes(version), 'options.version contains unknown version ' + version + ' - must be one of ipv4, ipv6, ipvfuture');
}
versions = Array.from(new Set(versions));
// Regex
const parts = versions.map((version) => {
// Forbidden
if (cidr === 'forbidden') {
return ipVersions[version];
}
// Required
const cidrpart = `\\/${version === 'ipv4' ? ipVersions.v4Cidr : ipVersions.v6Cidr}`;
if (cidr === 'required') {
return `${ipVersions[version]}${cidrpart}`;
}
// Optional
return `${ipVersions[version]}(?:${cidrpart})?`;
});
const raw = `(?:${parts.join('|')})`;
const regex = new RegExp(`^${raw}$`);
return { cidr, versions, regex, raw };
}
//# sourceMappingURL=ip.js.map

1
node_modules/@hapi/address/esm/ip.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"ip.js","sourceRoot":"","sources":["../src/ip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAmCnC;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,UAAmB,EAAE;IACzC,OAAO;IAEP,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,UAAU,CAAC;IACxC,MAAM,CACF,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EACpD,2DAA2D,CAC9D,CAAC;IAEF,WAAW;IAEX,MAAM,CACF,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EACtG,wDAAwD,CAC3D,CAAC;IAEF,IAAI,QAAQ,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IAChE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAC1B,QAAQ,GAAG,CAAC,QAAQ,CAAC,CAAC;KACzB;IAED,MAAM,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,EAAE,wDAAwD,CAAC,CAAC;IAEvF,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC5B,MAAM,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,OAAO,CAAC,WAAW,EAAE,EAAE,+BAA+B,CAAC,CAAC;QAE1G,MAAM,CACF,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAC/C,2CAA2C,GAAG,OAAO,GAAG,yCAAyC,CACpG,CAAC;KACL;IAED,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEzC,QAAQ;IAER,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACnC,YAAY;QAEZ,IAAI,IAAI,KAAK,WAAW,EAAE;YACtB,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC;SAC9B;QAED,WAAW;QAEX,MAAM,QAAQ,GAAG,MAAM,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;QAEpF,IAAI,IAAI,KAAK,UAAU,EAAE;YACrB,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,QAAQ,EAAE,CAAC;SAC9C;QAED,WAAW;QAEX,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,QAAQ,IAAI,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACrC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;IACrC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AAC1C,CAAC"}

55
node_modules/@hapi/address/esm/uri.d.ts generated vendored Normal file
View File

@@ -0,0 +1,55 @@
export declare const ipVersions: {
v4Cidr: string;
v6Cidr: string;
ipv4: string;
ipv6: string;
ipvfuture: string;
};
interface Expression {
/** The raw regular expression string. */
raw: string;
/** The regular expression. */
regex: RegExp;
/** The specified URI scheme */
scheme: string | null;
}
/**
* Generates a regular expression used to validate URI addresses.
*
* @param options - optional settings.
*
* @returns an object with the regular expression and meta data.
*/
export declare function uriRegex(options?: Options): Expression;
type Scheme = string | RegExp;
interface Options {
/**
* Allow the use of [] in query parameters.
*
* @default false
*/
readonly allowQuerySquareBrackets?: boolean;
/**
* Allow relative URIs.
*
* @default false
*/
readonly allowRelative?: boolean;
/**
* Requires the URI to be relative.
*
* @default false
*/
readonly relativeOnly?: boolean;
/**
* Capture domain segment ($1).
*
* @default false
*/
readonly domain?: boolean;
/**
* The allowed URI schemes.
*/
readonly scheme?: Scheme | Scheme[];
}
export {};

212
node_modules/@hapi/address/esm/uri.js generated vendored Normal file
View File

@@ -0,0 +1,212 @@
import { assert, escapeRegex } from '@hapi/hoek';
function generate() {
const rfc3986 = {};
const hexDigit = '\\dA-Fa-f'; // HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
const hexDigitOnly = '[' + hexDigit + ']';
const unreserved = '\\w-\\.~'; // unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
const subDelims = "!\\$&'\\(\\)\\*\\+,;="; // sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
const pctEncoded = '%' + hexDigit; // pct-encoded = "%" HEXDIG HEXDIG
const pchar = unreserved + pctEncoded + subDelims + ':@'; // pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
const pcharOnly = '[' + pchar + ']';
const decOctect = '(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])'; // dec-octet = DIGIT / %x31-39 DIGIT / "1" 2DIGIT / "2" %x30-34 DIGIT / "25" %x30-35 ; 0-9 / 10-99 / 100-199 / 200-249 / 250-255
rfc3986.ipv4address = '(?:' + decOctect + '\\.){3}' + decOctect; // IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
/*
h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal
ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address
IPv6address = 6( h16 ":" ) ls32
/ "::" 5( h16 ":" ) ls32
/ [ h16 ] "::" 4( h16 ":" ) ls32
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
/ [ *4( h16 ":" ) h16 ] "::" ls32
/ [ *5( h16 ":" ) h16 ] "::" h16
/ [ *6( h16 ":" ) h16 ] "::"
*/
const h16 = hexDigitOnly + '{1,4}';
const ls32 = '(?:' + h16 + ':' + h16 + '|' + rfc3986.ipv4address + ')';
const IPv6SixHex = '(?:' + h16 + ':){6}' + ls32;
const IPv6FiveHex = '::(?:' + h16 + ':){5}' + ls32;
const IPv6FourHex = '(?:' + h16 + ')?::(?:' + h16 + ':){4}' + ls32;
const IPv6ThreeHex = '(?:(?:' + h16 + ':){0,1}' + h16 + ')?::(?:' + h16 + ':){3}' + ls32;
const IPv6TwoHex = '(?:(?:' + h16 + ':){0,2}' + h16 + ')?::(?:' + h16 + ':){2}' + ls32;
const IPv6OneHex = '(?:(?:' + h16 + ':){0,3}' + h16 + ')?::' + h16 + ':' + ls32;
const IPv6NoneHex = '(?:(?:' + h16 + ':){0,4}' + h16 + ')?::' + ls32;
const IPv6NoneHex2 = '(?:(?:' + h16 + ':){0,5}' + h16 + ')?::' + h16;
const IPv6NoneHex3 = '(?:(?:' + h16 + ':){0,6}' + h16 + ')?::';
rfc3986.ipv4Cidr = '(?:\\d|[1-2]\\d|3[0-2])'; // IPv4 cidr = DIGIT / %x31-32 DIGIT / "3" %x30-32 ; 0-9 / 10-29 / 30-32
rfc3986.ipv6Cidr = '(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])'; // IPv6 cidr = DIGIT / %x31-39 DIGIT / "1" %x0-1 DIGIT / "12" %x0-8; 0-9 / 10-99 / 100-119 / 120-128
rfc3986.ipv6address =
'(?:' +
IPv6SixHex +
'|' +
IPv6FiveHex +
'|' +
IPv6FourHex +
'|' +
IPv6ThreeHex +
'|' +
IPv6TwoHex +
'|' +
IPv6OneHex +
'|' +
IPv6NoneHex +
'|' +
IPv6NoneHex2 +
'|' +
IPv6NoneHex3 +
')';
rfc3986.ipvFuture = 'v' + hexDigitOnly + '+\\.[' + unreserved + subDelims + ':]+'; // IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
rfc3986.scheme = '[a-zA-Z][a-zA-Z\\d+-\\.]*'; // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
rfc3986.schemeRegex = new RegExp(rfc3986.scheme);
const userinfo = '[' + unreserved + pctEncoded + subDelims + ':]*'; // userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
const IPLiteral = '\\[(?:' + rfc3986.ipv6address + '|' + rfc3986.ipvFuture + ')\\]'; // IP-literal = "[" ( IPv6address / IPvFuture ) "]"
const regName = '[' + unreserved + pctEncoded + subDelims + ']{1,255}'; // reg-name = *( unreserved / pct-encoded / sub-delims )
const host = '(?:' + IPLiteral + '|' + rfc3986.ipv4address + '|' + regName + ')'; // host = IP-literal / IPv4address / reg-name
const port = '\\d*'; // port = *DIGIT
const authority = '(?:' + userinfo + '@)?' + host + '(?::' + port + ')?'; // authority = [ userinfo "@" ] host [ ":" port ]
const authorityCapture = '(?:' + userinfo + '@)?(' + host + ')(?::' + port + ')?';
/*
segment = *pchar
segment-nz = 1*pchar
path = path-abempty ; begins with "/" '|' is empty
/ path-absolute ; begins with "/" but not "//"
/ path-noscheme ; begins with a non-colon segment
/ path-rootless ; begins with a segment
/ path-empty ; zero characters
path-abempty = *( "/" segment )
path-absolute = "/" [ segment-nz *( "/" segment ) ]
path-rootless = segment-nz *( "/" segment )
*/
const segment = pcharOnly + '*';
const segmentNz = pcharOnly + '+';
const segmentNzNc = '[' + unreserved + pctEncoded + subDelims + '@' + ']+';
const pathEmpty = '';
const pathAbEmpty = '(?:\\/' + segment + ')*';
const pathAbsolute = '\\/(?:' + segmentNz + pathAbEmpty + ')?';
const pathRootless = segmentNz + pathAbEmpty;
const pathNoScheme = segmentNzNc + pathAbEmpty;
const pathAbNoAuthority = '(?:\\/\\/\\/' + segment + pathAbEmpty + ')'; // Used by file:///
// hier-part = "//" authority path
rfc3986.hierPart =
'(?:' +
'(?:\\/\\/' +
authority +
pathAbEmpty +
')' +
'|' +
pathAbsolute +
'|' +
pathRootless +
'|' +
pathAbNoAuthority +
')';
rfc3986.hierPartCapture =
'(?:' + '(?:\\/\\/' + authorityCapture + pathAbEmpty + ')' + '|' + pathAbsolute + '|' + pathRootless + ')';
// relative-part = "//" authority path-abempty / path-absolute / path-noscheme / path-empty
rfc3986.relativeRef =
'(?:' +
'(?:\\/\\/' +
authority +
pathAbEmpty +
')' +
'|' +
pathAbsolute +
'|' +
pathNoScheme +
'|' +
pathEmpty +
')';
rfc3986.relativeRefCapture =
'(?:' +
'(?:\\/\\/' +
authorityCapture +
pathAbEmpty +
')' +
'|' +
pathAbsolute +
'|' +
pathNoScheme +
'|' +
pathEmpty +
')';
// query = *( pchar / "/" / "?" )
// query = *( pchar / "[" / "]" / "/" / "?" )
rfc3986.query = '[' + pchar + '\\/\\?]*(?=#|$)'; //Finish matching either at the fragment part '|' end of the line.
rfc3986.queryWithSquareBrackets = '[' + pchar + '\\[\\]\\/\\?]*(?=#|$)';
// fragment = *( pchar / "/" / "?" )
rfc3986.fragment = '[' + pchar + '\\/\\?]*';
return rfc3986;
}
const rfc3986 = generate();
export const ipVersions = {
v4Cidr: rfc3986.ipv4Cidr,
v6Cidr: rfc3986.ipv6Cidr,
ipv4: rfc3986.ipv4address,
ipv6: rfc3986.ipv6address,
ipvfuture: rfc3986.ipvFuture
};
function createRegex(options) {
const rfc = rfc3986;
// Construct expression
const query = options.allowQuerySquareBrackets ? rfc.queryWithSquareBrackets : rfc.query;
const suffix = '(?:\\?' + query + ')?' + '(?:#' + rfc.fragment + ')?';
// relative-ref = relative-part [ "?" query ] [ "#" fragment ]
const relative = options.domain ? rfc.relativeRefCapture : rfc.relativeRef;
if (options.relativeOnly) {
return wrap(relative + suffix);
}
// Custom schemes
let customScheme = '';
if (options.scheme) {
assert(options.scheme instanceof RegExp || typeof options.scheme === 'string' || Array.isArray(options.scheme), 'scheme must be a RegExp, String, or Array');
const schemes = [].concat(options.scheme);
assert(schemes.length >= 1, 'scheme must have at least 1 scheme specified');
// Flatten the array into a string to be used to match the schemes
const selections = [];
for (let i = 0; i < schemes.length; ++i) {
const scheme = schemes[i];
assert(scheme instanceof RegExp || typeof scheme === 'string', 'scheme at position ' + i + ' must be a RegExp or String');
if (scheme instanceof RegExp) {
selections.push(scheme.source.toString());
}
else {
assert(rfc.schemeRegex.test(scheme), 'scheme at position ' + i + ' must be a valid scheme');
selections.push(escapeRegex(scheme));
}
}
customScheme = selections.join('|');
}
// URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
const scheme = customScheme ? '(?:' + customScheme + ')' : rfc.scheme;
const absolute = '(?:' + scheme + ':' + (options.domain ? rfc.hierPartCapture : rfc.hierPart) + ')';
const prefix = options.allowRelative ? '(?:' + absolute + '|' + relative + ')' : absolute;
return wrap(prefix + suffix, customScheme);
}
function wrap(raw, scheme = null) {
raw = `(?=.)(?!https?\:/(?:$|[^/]))(?!https?\:///)(?!https?\:[^/])${raw}`; // Require at least one character and explicitly forbid 'http:/' or HTTP with empty domain
return {
raw,
regex: new RegExp(`^${raw}$`),
scheme
};
}
const genericUriRegex = createRegex({});
/**
* Generates a regular expression used to validate URI addresses.
*
* @param options - optional settings.
*
* @returns an object with the regular expression and meta data.
*/
export function uriRegex(options = {}) {
if (options.scheme ||
options.allowRelative ||
options.relativeOnly ||
options.allowQuerySquareBrackets ||
options.domain) {
return createRegex(options);
}
return genericUriRegex;
}
//# sourceMappingURL=uri.js.map

1
node_modules/@hapi/address/esm/uri.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

44
node_modules/@hapi/address/package.json generated vendored Normal file
View File

@@ -0,0 +1,44 @@
{
"name": "@hapi/address",
"description": "Email address and domain validation",
"version": "5.1.1",
"repository": "git://github.com/hapijs/address",
"main": "./dist/index.js",
"module": "./esm/index.js",
"typings": "./dist/index.d.ts",
"files": [
"dist",
"src",
"esm"
],
"keywords": [
"email",
"domain",
"address",
"validation"
],
"engines": {
"node": ">=14.0.0"
},
"dependencies": {
"@hapi/hoek": "^11.0.2"
},
"devDependencies": {
"@hapi/code": "^9.0.3",
"@hapi/lab": "^25.1.2",
"@types/node": "^14.18.36",
"@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/parser": "^5.52.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.8.4",
"typescript": "4.9.x"
},
"scripts": {
"test": "lab -t 100 -L",
"test-cov-html": "lab -t 100 -L -r html -o coverage.html",
"dist": "rm -rf dist/* && rm -rf esm/* && tsc --module commonjs --outdir dist && tsc --module es6 --outdir esm",
"format": "prettier --write '**/*.ts'"
},
"license": "BSD-3-Clause"
}

115
node_modules/@hapi/address/src/decode.ts generated vendored Normal file
View File

@@ -0,0 +1,115 @@
const HEX: Record<string, number> = {
'0': 0,
'1': 1,
'2': 2,
'3': 3,
'4': 4,
'5': 5,
'6': 6,
'7': 7,
'8': 8,
'9': 9,
a: 10,
A: 10,
b: 11,
B: 11,
c: 12,
C: 12,
d: 13,
D: 13,
e: 14,
E: 14,
f: 15,
F: 15
};
const UTF8 = {
accept: 12,
reject: 0,
data: [
// Maps bytes to character to a transition
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 7, 10, 9, 9, 9, 11, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
// Maps a state to a new state when adding a transition
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 24, 36, 48, 60, 72, 84, 96, 0, 12, 12, 12, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,
// Maps the current transition to a mask that needs to apply to the byte
0x7f, 0x3f, 0x3f, 0x3f, 0x00, 0x1f, 0x0f, 0x0f, 0x0f, 0x07, 0x07, 0x07
]
};
/**
* Faster version of decodeURIComponent() that does not throw.
*
* @param string - the URL string to decode.
*
* @returns the decoded string or null if invalid.
*/
export function uriDecode(string: string) {
let percentPos = string.indexOf('%');
if (percentPos === -1) {
return string;
}
let decoded = '';
let last = 0;
let codepoint = 0;
let startOfOctets = percentPos;
let state = UTF8.accept;
while (percentPos > -1 && percentPos < string.length) {
const high = resolveHex(string[percentPos + 1], 4);
const low = resolveHex(string[percentPos + 2], 0);
const byte = high | low;
const type = UTF8.data[byte];
state = UTF8.data[256 + state + type];
codepoint = (codepoint << 6) | (byte & UTF8.data[364 + type]);
if (state === UTF8.accept) {
decoded += string.slice(last, startOfOctets);
decoded +=
codepoint <= 0xffff
? String.fromCharCode(codepoint)
: String.fromCharCode(0xd7c0 + (codepoint >> 10), 0xdc00 + (codepoint & 0x3ff));
codepoint = 0;
last = percentPos + 3;
percentPos = string.indexOf('%', last);
startOfOctets = percentPos;
continue;
}
if (state === UTF8.reject) {
return null;
}
percentPos += 3;
if (percentPos >= string.length || string[percentPos] !== '%') {
return null;
}
}
return decoded + string.slice(last);
}
function resolveHex(char: string, shift: number) {
const i = HEX[char];
return i === undefined ? 255 : i << shift;
}
// Adapted from:
// Copyright (c) 2017-2019 Justin Ridgewell, MIT Licensed, https://github.com/jridgewell/safe-decode-string-component
// Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>, MIT Licensed, http://bjoern.hoehrmann.de/utf-8/decoder/dfa/

227
node_modules/@hapi/address/src/domain.ts generated vendored Normal file
View File

@@ -0,0 +1,227 @@
import * as Url from 'url';
import { errorCode } from './errors';
const MIN_DOMAIN_SEGMENTS = 2;
const NON_ASCII_RX = /[^\x00-\x7f]/;
const DOMAIN_CONTROL_RX = /[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/; // Control + space + separators
const TLD_SEGMENT_RX = /^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/;
const DOMAIN_SEGMENT_RX = /^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/;
const DOMAIN_UNDERSCORE_SEGMENT_RX = /^[a-zA-Z0-9_](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/;
const URL_IMPL = Url.URL || URL; // $lab:coverage:ignore$
interface TldsAllow {
readonly allow: Set<string>;
}
interface TldsDeny {
readonly deny: Set<string>;
}
function isTldsAllow(tlds: any): tlds is TldsAllow {
return !!tlds.allow;
}
export interface DomainOptions {
/**
* Determines whether Unicode characters are allowed.
*
* @default true
*/
readonly allowUnicode?: boolean;
/**
* Determines whether underscore (_) characters are allowed.
*
* @default false
*/
readonly allowUnderscore?: boolean;
/**
* The maximum number of domain segments (e.g. `x.y.z` has 3 segments) allowed.
*
* @default Infinity
*/
readonly maxDomainSegments?: number;
/**
* The minimum number of domain segments (e.g. `x.y.z` has 3 segments) required.
*
* @default 2
*/
readonly minDomainSegments?: number;
/**
* Top-level-domain options
*
* @default true
*/
readonly tlds?: TldsAllow | TldsDeny;
/**
* Allows passing fully qualified domain (ends with a period)
*
* @default false
*/
readonly allowFullyQualified?: boolean;
}
export interface Analysis {
/**
* The reason validation failed.
*/
error: string;
/**
* The error code.
*/
code: string;
}
/**
* Analyzes a string to verify it is a valid domain name.
*
* @param domain - the domain name to validate.
* @param options - optional settings.
*
* @return - undefined when valid, otherwise an object with single error key with a string message value.
*/
export function analyzeDomain(domain: string, options: DomainOptions = {}): Analysis | null {
if (!domain) {
// Catch null / undefined
return errorCode('DOMAIN_NON_EMPTY_STRING');
}
if (typeof domain !== 'string') {
throw new Error('Invalid input: domain must be a string');
}
if (domain.length > 256) {
return errorCode('DOMAIN_TOO_LONG');
}
const ascii = !NON_ASCII_RX.test(domain);
if (!ascii) {
if (options.allowUnicode === false) {
// Defaults to true
return errorCode('DOMAIN_INVALID_UNICODE_CHARS');
}
domain = domain.normalize('NFC');
}
if (DOMAIN_CONTROL_RX.test(domain)) {
return errorCode('DOMAIN_INVALID_CHARS');
}
domain = punycode(domain);
// https://tools.ietf.org/html/rfc1035 section 2.3.1
if (options.allowFullyQualified && domain[domain.length - 1] === '.') {
domain = domain.slice(0, -1);
}
const minDomainSegments = options.minDomainSegments || MIN_DOMAIN_SEGMENTS;
const segments = domain.split('.');
if (segments.length < minDomainSegments) {
return errorCode('DOMAIN_SEGMENTS_COUNT');
}
if (options.maxDomainSegments) {
if (segments.length > options.maxDomainSegments) {
return errorCode('DOMAIN_SEGMENTS_COUNT_MAX');
}
}
const tlds = options.tlds;
if (tlds) {
const tld = segments[segments.length - 1].toLowerCase();
if (isTldsAllow(tlds)) {
if (!tlds.allow.has(tld)) {
return errorCode('DOMAIN_FORBIDDEN_TLDS');
}
} else if (tlds.deny.has(tld)) {
return errorCode('DOMAIN_FORBIDDEN_TLDS');
}
}
for (let i = 0; i < segments.length; ++i) {
const segment = segments[i];
if (!segment.length) {
return errorCode('DOMAIN_EMPTY_SEGMENT');
}
if (segment.length > 63) {
return errorCode('DOMAIN_LONG_SEGMENT');
}
if (i < segments.length - 1) {
if (options.allowUnderscore) {
if (!DOMAIN_UNDERSCORE_SEGMENT_RX.test(segment)) {
return errorCode('DOMAIN_INVALID_CHARS');
}
} else {
if (!DOMAIN_SEGMENT_RX.test(segment)) {
return errorCode('DOMAIN_INVALID_CHARS');
}
}
} else {
if (!TLD_SEGMENT_RX.test(segment)) {
return errorCode('DOMAIN_INVALID_TLDS_CHARS');
}
}
}
return null;
}
/**
* Analyzes a string to verify it is a valid domain name.
*
* @param domain - the domain name to validate.
* @param options - optional settings.
*
* @return - true when valid, otherwise false.
*/
export function isDomainValid(domain: string, options?: DomainOptions) {
return !analyzeDomain(domain, options);
}
function punycode(domain: string) {
if (domain.includes('%')) {
domain = domain.replace(/%/g, '%25');
}
try {
return new URL_IMPL(`http://${domain}`).host;
} catch (err) {
return domain;
}
}
export function validateDomainOptions(options: DomainOptions) {
if (!options) {
return;
}
if (typeof options.tlds !== 'object') {
throw new Error('Invalid options: tlds must be a boolean or an object');
}
if (isTldsAllow(options.tlds)) {
if (options.tlds.allow instanceof Set === false) {
throw new Error('Invalid options: tlds.allow must be a Set object or true');
}
if ((options.tlds as any).deny) {
throw new Error('Invalid options: cannot specify both tlds.allow and tlds.deny lists');
}
} else {
if (options.tlds.deny instanceof Set === false) {
throw new Error('Invalid options: tlds.deny must be a Set object');
}
}
}

182
node_modules/@hapi/address/src/email.ts generated vendored Normal file
View File

@@ -0,0 +1,182 @@
import * as Util from 'util';
import { analyzeDomain, Analysis, DomainOptions } from './domain';
import { errorCode } from './errors';
const NON_ASCII_RX = /[^\x00-\x7f]/;
const ENCODER_IMPL = new (Util.TextEncoder || TextEncoder)(); // $lab:coverage:ignore$
export interface EmailOptions extends DomainOptions {
/**
* Determines whether to ignore the standards maximum email length limit.
*
* @default false
*/
readonly ignoreLength?: boolean;
}
/**
* Analyzes a string to verify it is a valid email address.
*
* @param email - the email address to validate.
* @param options - optional settings.
*
* @return - undefined when valid, otherwise an object with single error key with a string message value.
*/
export function analyzeEmail(email: string, options?: EmailOptions): Analysis | null {
return validateEmail(email, options);
}
/**
* Analyzes a string to verify it is a valid email address.
*
* @param email - the email address to validate.
* @param options - optional settings.
*
* @return - true when valid, otherwise false.
*/
export function isEmailValid(email: string, options?: EmailOptions) {
return !validateEmail(email, options);
}
function validateEmail(email: string, options: EmailOptions = {}) {
if (typeof email !== 'string') {
throw new Error('Invalid input: email must be a string');
}
if (!email) {
return errorCode('EMPTY_STRING');
}
// Unicode
const ascii = !NON_ASCII_RX.test(email);
if (!ascii) {
if (options.allowUnicode === false) {
// Defaults to true
return errorCode('FORBIDDEN_UNICODE');
}
email = email.normalize('NFC');
}
// Basic structure
const parts = email.split('@');
if (parts.length !== 2) {
return parts.length > 2 ? errorCode('MULTIPLE_AT_CHAR') : errorCode('MISSING_AT_CHAR');
}
const [local, domain] = parts;
if (!local) {
return errorCode('EMPTY_LOCAL');
}
if (!options.ignoreLength) {
if (email.length > 254) {
// http://tools.ietf.org/html/rfc5321#section-4.5.3.1.3
return errorCode('ADDRESS_TOO_LONG');
}
if (ENCODER_IMPL.encode(local).length > 64) {
// http://tools.ietf.org/html/rfc5321#section-4.5.3.1.1
return errorCode('LOCAL_TOO_LONG');
}
}
// Validate parts
return validateLocal(local, ascii) || analyzeDomain(domain, options);
}
function validateLocal(local: string, ascii: boolean) {
const segments = local.split('.');
for (const segment of segments) {
if (!segment.length) {
return errorCode('EMPTY_LOCAL_SEGMENT');
}
if (ascii) {
if (!ATEXT_RX.test(segment)) {
return errorCode('INVALID_LOCAL_CHARS');
}
continue;
}
for (const char of segment) {
if (ATEXT_RX.test(char)) {
continue;
}
const binary = toBinary(char);
if (!ATOM_RX.test(binary)) {
return errorCode('INVALID_LOCAL_CHARS');
}
}
}
return null;
}
function toBinary(char: string) {
return Array.from(ENCODER_IMPL.encode(char), (v) => String.fromCharCode(v)).join('');
}
/*
From RFC 5321:
Mailbox = Local-part "@" ( Domain / address-literal )
Local-part = Dot-string / Quoted-string
Dot-string = Atom *("." Atom)
Atom = 1*atext
atext = ALPHA / DIGIT / "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "/" / "=" / "?" / "^" / "_" / "`" / "{" / "|" / "}" / "~"
Domain = sub-domain *("." sub-domain)
sub-domain = Let-dig [Ldh-str]
Let-dig = ALPHA / DIGIT
Ldh-str = *( ALPHA / DIGIT / "-" ) Let-dig
ALPHA = %x41-5A / %x61-7A ; a-z, A-Z
DIGIT = %x30-39 ; 0-9
From RFC 6531:
sub-domain =/ U-label
atext =/ UTF8-non-ascii
UTF8-non-ascii = UTF8-2 / UTF8-3 / UTF8-4
UTF8-2 = %xC2-DF UTF8-tail
UTF8-3 = %xE0 %xA0-BF UTF8-tail /
%xE1-EC 2( UTF8-tail ) /
%xED %x80-9F UTF8-tail /
%xEE-EF 2( UTF8-tail )
UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) /
%xF1-F3 3( UTF8-tail ) /
%xF4 %x80-8F 2( UTF8-tail )
UTF8-tail = %x80-BF
Note: The following are not supported:
RFC 5321: address-literal, Quoted-string
RFC 5322: obs-*, CFWS
*/
const ATEXT_RX = /^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/; // _ included in \w
const ATOM_RX = new RegExp(
[
// %xC2-DF UTF8-tail
'(?:[\\xc2-\\xdf][\\x80-\\xbf])',
// %xE0 %xA0-BF UTF8-tail %xE1-EC 2( UTF8-tail ) %xED %x80-9F UTF8-tail %xEE-EF 2( UTF8-tail )
'(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})',
// %xF0 %x90-BF 2( UTF8-tail ) %xF1-F3 3( UTF8-tail ) %xF4 %x80-8F 2( UTF8-tail )
'(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})'
].join('|')
);

25
node_modules/@hapi/address/src/errors.ts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
export const errorCodes = {
EMPTY_STRING: 'Address must be a non-empty string',
FORBIDDEN_UNICODE: 'Address contains forbidden Unicode characters',
MULTIPLE_AT_CHAR: 'Address cannot contain more than one @ character',
MISSING_AT_CHAR: 'Address must contain one @ character',
EMPTY_LOCAL: 'Address local part cannot be empty',
ADDRESS_TOO_LONG: 'Address too long',
LOCAL_TOO_LONG: 'Address local part too long',
EMPTY_LOCAL_SEGMENT: 'Address local part contains empty dot-separated segment',
INVALID_LOCAL_CHARS: 'Address local part contains invalid character',
DOMAIN_NON_EMPTY_STRING: 'Domain must be a non-empty string',
DOMAIN_TOO_LONG: 'Domain too long',
DOMAIN_INVALID_UNICODE_CHARS: 'Domain contains forbidden Unicode characters',
DOMAIN_INVALID_CHARS: 'Domain contains invalid character',
DOMAIN_INVALID_TLDS_CHARS: 'Domain contains invalid tld character',
DOMAIN_SEGMENTS_COUNT: 'Domain lacks the minimum required number of segments',
DOMAIN_SEGMENTS_COUNT_MAX: 'Domain contains too many segments',
DOMAIN_FORBIDDEN_TLDS: 'Domain uses forbidden TLD',
DOMAIN_EMPTY_SEGMENT: 'Domain contains empty dot-separated segment',
DOMAIN_LONG_SEGMENT: 'Domain contains dot-separated segment that is too long'
};
export function errorCode<TCode extends keyof typeof errorCodes>(code: TCode) {
return { code, error: errorCodes[code] };
}

6
node_modules/@hapi/address/src/index.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
export * from './domain';
export * from './email';
export { errorCodes } from './errors';
export { ipRegex } from './ip';
export { uriRegex } from './uri';
export { uriDecode } from './decode';

104
node_modules/@hapi/address/src/ip.ts generated vendored Normal file
View File

@@ -0,0 +1,104 @@
import { assert } from '@hapi/hoek';
import { ipVersions } from './uri';
interface Options {
/**
* The required CIDR mode.
*
* @default 'optional'
*/
readonly cidr?: Cidr;
/**
* The allowed versions.
*
* @default ['ipv4', 'ipv6', 'ipvfuture']
*/
readonly version?: Version | Version[];
}
type Cidr = 'optional' | 'required' | 'forbidden';
type Version = 'ipv4' | 'ipv6' | 'ipvfuture';
interface Expression {
/** The CIDR mode. */
cidr: Cidr;
/** The raw regular expression string. */
raw: string;
/** The regular expression. */
regex: RegExp;
/** The array of versions allowed. */
versions: Version[];
}
/**
* Generates a regular expression used to validate IP addresses.
*
* @param options - optional settings.
*
* @returns an object with the regular expression and meta data.
*/
export function ipRegex(options: Options = {}): Expression {
// CIDR
const cidr = options.cidr || 'optional';
assert(
['required', 'optional', 'forbidden'].includes(cidr),
'options.cidr must be one of required, optional, forbidden'
);
// Versions
assert(
options.version === undefined || typeof options.version === 'string' || Array.isArray(options.version),
'options.version must be a string or an array of string'
);
let versions = options.version || ['ipv4', 'ipv6', 'ipvfuture'];
if (!Array.isArray(versions)) {
versions = [versions];
}
assert(versions.length >= 1, 'options.version must have at least 1 version specified');
for (const version of versions) {
assert(typeof version === 'string' && version === version.toLowerCase(), 'Invalid options.version value');
assert(
['ipv4', 'ipv6', 'ipvfuture'].includes(version),
'options.version contains unknown version ' + version + ' - must be one of ipv4, ipv6, ipvfuture'
);
}
versions = Array.from(new Set(versions));
// Regex
const parts = versions.map((version) => {
// Forbidden
if (cidr === 'forbidden') {
return ipVersions[version];
}
// Required
const cidrpart = `\\/${version === 'ipv4' ? ipVersions.v4Cidr : ipVersions.v6Cidr}`;
if (cidr === 'required') {
return `${ipVersions[version]}${cidrpart}`;
}
// Optional
return `${ipVersions[version]}(?:${cidrpart})?`;
});
const raw = `(?:${parts.join('|')})`;
const regex = new RegExp(`^${raw}$`);
return { cidr, versions, regex, raw };
}

325
node_modules/@hapi/address/src/uri.ts generated vendored Normal file
View File

@@ -0,0 +1,325 @@
import { assert, escapeRegex } from '@hapi/hoek';
interface RFC3986 {
ipv4address: string;
ipv4Cidr: string;
ipv6Cidr: string;
ipv6address: string;
ipvFuture: string;
scheme: string;
schemeRegex: RegExp;
hierPart: string;
hierPartCapture: string;
relativeRef: string;
relativeRefCapture: string;
query: string;
queryWithSquareBrackets: string;
fragment: string;
}
function generate() {
const rfc3986 = {} as RFC3986;
const hexDigit = '\\dA-Fa-f'; // HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
const hexDigitOnly = '[' + hexDigit + ']';
const unreserved = '\\w-\\.~'; // unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
const subDelims = "!\\$&'\\(\\)\\*\\+,;="; // sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
const pctEncoded = '%' + hexDigit; // pct-encoded = "%" HEXDIG HEXDIG
const pchar = unreserved + pctEncoded + subDelims + ':@'; // pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
const pcharOnly = '[' + pchar + ']';
const decOctect = '(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])'; // dec-octet = DIGIT / %x31-39 DIGIT / "1" 2DIGIT / "2" %x30-34 DIGIT / "25" %x30-35 ; 0-9 / 10-99 / 100-199 / 200-249 / 250-255
rfc3986.ipv4address = '(?:' + decOctect + '\\.){3}' + decOctect; // IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
/*
h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal
ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address
IPv6address = 6( h16 ":" ) ls32
/ "::" 5( h16 ":" ) ls32
/ [ h16 ] "::" 4( h16 ":" ) ls32
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
/ [ *4( h16 ":" ) h16 ] "::" ls32
/ [ *5( h16 ":" ) h16 ] "::" h16
/ [ *6( h16 ":" ) h16 ] "::"
*/
const h16 = hexDigitOnly + '{1,4}';
const ls32 = '(?:' + h16 + ':' + h16 + '|' + rfc3986.ipv4address + ')';
const IPv6SixHex = '(?:' + h16 + ':){6}' + ls32;
const IPv6FiveHex = '::(?:' + h16 + ':){5}' + ls32;
const IPv6FourHex = '(?:' + h16 + ')?::(?:' + h16 + ':){4}' + ls32;
const IPv6ThreeHex = '(?:(?:' + h16 + ':){0,1}' + h16 + ')?::(?:' + h16 + ':){3}' + ls32;
const IPv6TwoHex = '(?:(?:' + h16 + ':){0,2}' + h16 + ')?::(?:' + h16 + ':){2}' + ls32;
const IPv6OneHex = '(?:(?:' + h16 + ':){0,3}' + h16 + ')?::' + h16 + ':' + ls32;
const IPv6NoneHex = '(?:(?:' + h16 + ':){0,4}' + h16 + ')?::' + ls32;
const IPv6NoneHex2 = '(?:(?:' + h16 + ':){0,5}' + h16 + ')?::' + h16;
const IPv6NoneHex3 = '(?:(?:' + h16 + ':){0,6}' + h16 + ')?::';
rfc3986.ipv4Cidr = '(?:\\d|[1-2]\\d|3[0-2])'; // IPv4 cidr = DIGIT / %x31-32 DIGIT / "3" %x30-32 ; 0-9 / 10-29 / 30-32
rfc3986.ipv6Cidr = '(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])'; // IPv6 cidr = DIGIT / %x31-39 DIGIT / "1" %x0-1 DIGIT / "12" %x0-8; 0-9 / 10-99 / 100-119 / 120-128
rfc3986.ipv6address =
'(?:' +
IPv6SixHex +
'|' +
IPv6FiveHex +
'|' +
IPv6FourHex +
'|' +
IPv6ThreeHex +
'|' +
IPv6TwoHex +
'|' +
IPv6OneHex +
'|' +
IPv6NoneHex +
'|' +
IPv6NoneHex2 +
'|' +
IPv6NoneHex3 +
')';
rfc3986.ipvFuture = 'v' + hexDigitOnly + '+\\.[' + unreserved + subDelims + ':]+'; // IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
rfc3986.scheme = '[a-zA-Z][a-zA-Z\\d+-\\.]*'; // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
rfc3986.schemeRegex = new RegExp(rfc3986.scheme);
const userinfo = '[' + unreserved + pctEncoded + subDelims + ':]*'; // userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
const IPLiteral = '\\[(?:' + rfc3986.ipv6address + '|' + rfc3986.ipvFuture + ')\\]'; // IP-literal = "[" ( IPv6address / IPvFuture ) "]"
const regName = '[' + unreserved + pctEncoded + subDelims + ']{1,255}'; // reg-name = *( unreserved / pct-encoded / sub-delims )
const host = '(?:' + IPLiteral + '|' + rfc3986.ipv4address + '|' + regName + ')'; // host = IP-literal / IPv4address / reg-name
const port = '\\d*'; // port = *DIGIT
const authority = '(?:' + userinfo + '@)?' + host + '(?::' + port + ')?'; // authority = [ userinfo "@" ] host [ ":" port ]
const authorityCapture = '(?:' + userinfo + '@)?(' + host + ')(?::' + port + ')?';
/*
segment = *pchar
segment-nz = 1*pchar
path = path-abempty ; begins with "/" '|' is empty
/ path-absolute ; begins with "/" but not "//"
/ path-noscheme ; begins with a non-colon segment
/ path-rootless ; begins with a segment
/ path-empty ; zero characters
path-abempty = *( "/" segment )
path-absolute = "/" [ segment-nz *( "/" segment ) ]
path-rootless = segment-nz *( "/" segment )
*/
const segment = pcharOnly + '*';
const segmentNz = pcharOnly + '+';
const segmentNzNc = '[' + unreserved + pctEncoded + subDelims + '@' + ']+';
const pathEmpty = '';
const pathAbEmpty = '(?:\\/' + segment + ')*';
const pathAbsolute = '\\/(?:' + segmentNz + pathAbEmpty + ')?';
const pathRootless = segmentNz + pathAbEmpty;
const pathNoScheme = segmentNzNc + pathAbEmpty;
const pathAbNoAuthority = '(?:\\/\\/\\/' + segment + pathAbEmpty + ')'; // Used by file:///
// hier-part = "//" authority path
rfc3986.hierPart =
'(?:' +
'(?:\\/\\/' +
authority +
pathAbEmpty +
')' +
'|' +
pathAbsolute +
'|' +
pathRootless +
'|' +
pathAbNoAuthority +
')';
rfc3986.hierPartCapture =
'(?:' + '(?:\\/\\/' + authorityCapture + pathAbEmpty + ')' + '|' + pathAbsolute + '|' + pathRootless + ')';
// relative-part = "//" authority path-abempty / path-absolute / path-noscheme / path-empty
rfc3986.relativeRef =
'(?:' +
'(?:\\/\\/' +
authority +
pathAbEmpty +
')' +
'|' +
pathAbsolute +
'|' +
pathNoScheme +
'|' +
pathEmpty +
')';
rfc3986.relativeRefCapture =
'(?:' +
'(?:\\/\\/' +
authorityCapture +
pathAbEmpty +
')' +
'|' +
pathAbsolute +
'|' +
pathNoScheme +
'|' +
pathEmpty +
')';
// query = *( pchar / "/" / "?" )
// query = *( pchar / "[" / "]" / "/" / "?" )
rfc3986.query = '[' + pchar + '\\/\\?]*(?=#|$)'; //Finish matching either at the fragment part '|' end of the line.
rfc3986.queryWithSquareBrackets = '[' + pchar + '\\[\\]\\/\\?]*(?=#|$)';
// fragment = *( pchar / "/" / "?" )
rfc3986.fragment = '[' + pchar + '\\/\\?]*';
return rfc3986;
}
const rfc3986 = generate();
export const ipVersions = {
v4Cidr: rfc3986.ipv4Cidr,
v6Cidr: rfc3986.ipv6Cidr,
ipv4: rfc3986.ipv4address,
ipv6: rfc3986.ipv6address,
ipvfuture: rfc3986.ipvFuture
};
function createRegex(options: Options) {
const rfc = rfc3986;
// Construct expression
const query = options.allowQuerySquareBrackets ? rfc.queryWithSquareBrackets : rfc.query;
const suffix = '(?:\\?' + query + ')?' + '(?:#' + rfc.fragment + ')?';
// relative-ref = relative-part [ "?" query ] [ "#" fragment ]
const relative = options.domain ? rfc.relativeRefCapture : rfc.relativeRef;
if (options.relativeOnly) {
return wrap(relative + suffix);
}
// Custom schemes
let customScheme = '';
if (options.scheme) {
assert(
options.scheme instanceof RegExp || typeof options.scheme === 'string' || Array.isArray(options.scheme),
'scheme must be a RegExp, String, or Array'
);
const schemes = [].concat(options.scheme);
assert(schemes.length >= 1, 'scheme must have at least 1 scheme specified');
// Flatten the array into a string to be used to match the schemes
const selections = [];
for (let i = 0; i < schemes.length; ++i) {
const scheme = schemes[i];
assert(
scheme instanceof RegExp || typeof scheme === 'string',
'scheme at position ' + i + ' must be a RegExp or String'
);
if (scheme instanceof RegExp) {
selections.push(scheme.source.toString());
} else {
assert(rfc.schemeRegex.test(scheme), 'scheme at position ' + i + ' must be a valid scheme');
selections.push(escapeRegex(scheme));
}
}
customScheme = selections.join('|');
}
// URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
const scheme = customScheme ? '(?:' + customScheme + ')' : rfc.scheme;
const absolute = '(?:' + scheme + ':' + (options.domain ? rfc.hierPartCapture : rfc.hierPart) + ')';
const prefix = options.allowRelative ? '(?:' + absolute + '|' + relative + ')' : absolute;
return wrap(prefix + suffix, customScheme);
}
interface Expression {
/** The raw regular expression string. */
raw: string;
/** The regular expression. */
regex: RegExp;
/** The specified URI scheme */
scheme: string | null;
}
function wrap(raw: string, scheme: string = null): Expression {
raw = `(?=.)(?!https?\:/(?:$|[^/]))(?!https?\:///)(?!https?\:[^/])${raw}`; // Require at least one character and explicitly forbid 'http:/' or HTTP with empty domain
return {
raw,
regex: new RegExp(`^${raw}$`),
scheme
};
}
const genericUriRegex = createRegex({});
/**
* Generates a regular expression used to validate URI addresses.
*
* @param options - optional settings.
*
* @returns an object with the regular expression and meta data.
*/
export function uriRegex(options: Options = {}) {
if (
options.scheme ||
options.allowRelative ||
options.relativeOnly ||
options.allowQuerySquareBrackets ||
options.domain
) {
return createRegex(options);
}
return genericUriRegex;
}
type Scheme = string | RegExp;
interface Options {
/**
* Allow the use of [] in query parameters.
*
* @default false
*/
readonly allowQuerySquareBrackets?: boolean;
/**
* Allow relative URIs.
*
* @default false
*/
readonly allowRelative?: boolean;
/**
* Requires the URI to be relative.
*
* @default false
*/
readonly relativeOnly?: boolean;
/**
* Capture domain segment ($1).
*
* @default false
*/
readonly domain?: boolean;
/**
* The allowed URI schemes.
*/
readonly scheme?: Scheme | Scheme[];
}

9
node_modules/@hapi/formula/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,9 @@
Copyright (c) 2019-2020, Sideway. Inc, and project contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* The names of any contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

18
node_modules/@hapi/formula/README.md generated vendored Normal file
View File

@@ -0,0 +1,18 @@
# @sideway/formula
#### Math and string formula parser.
**formula** is part of the **joi** ecosystem.
### Visit the [joi.dev](https://joi.dev) Developer Portal for tutorials, documentation, and support
## Useful resources
- [Documentation and API](https://joi.dev/module/formula/)
- [Version status](https://joi.dev/resources/status/#formula) (builds, dependencies, node versions, licenses, eol)
- [Changelog](https://joi.dev/module/formula/changelog/)
- [Project policies](https://joi.dev/policies/)
## Acknowledgements
Inspired by [**fparse**](https://github.com/bylexus/fparse), copyright 2012-2018 Alexander Schenkel <alex@alexi.ch>

52
node_modules/@hapi/formula/lib/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,52 @@
/**
* Formula parser
*/
export class Parser<T extends (string | number)> {
/**
* Create a new formula parser.
*
* @param formula - the formula string to parse.
* @param options - optional settings.
*/
constructor(formula: string, options?: Options);
/**
* Evaluate the formula.
*
* @param context - optional object with runtime formula context used to resolve variables.
*
* @returns the string or number outcome of the resolved formula.
*/
evaluate(context?: any): T;
}
export interface Options {
/**
* A hash of key - value pairs used to convert constants to values.
*/
readonly constants?: Record<string, any>;
/**
* A regular expression used to validate token variables.
*/
readonly tokenRx?: RegExp;
/**
* A variable resolver factory function.
*/
readonly reference?: Options.Reference;
/**
* A hash of key-value pairs used to resolve formula functions.
*/
readonly functions?: Record<string, Function>;
}
export namespace Options {
type Reference = (name: string) => (context: any) => any;
}

456
node_modules/@hapi/formula/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,456 @@
'use strict';
const internals = {
operators: ['!', '^', '*', '/', '%', '+', '-', '<', '<=', '>', '>=', '==', '!=', '&&', '||', '??'],
operatorCharacters: ['!', '^', '*', '/', '%', '+', '-', '<', '=', '>', '&', '|', '?'],
operatorsOrder: [['^'], ['*', '/', '%'], ['+', '-'], ['<', '<=', '>', '>='], ['==', '!='], ['&&'], ['||', '??']],
operatorsPrefix: ['!', 'n'],
literals: {
'"': '"',
'`': '`',
'\'': '\'',
'[': ']'
},
numberRx: /^(?:[0-9]*(\.[0-9]*)?){1}$/,
tokenRx: /^[\w\$\#\.\@\:\{\}]+$/,
symbol: Symbol('formula'),
settings: Symbol('settings')
};
exports.Parser = class {
constructor(string, options = {}) {
if (!options[internals.settings] &&
options.constants) {
for (const constant in options.constants) {
const value = options.constants[constant];
if (value !== null &&
!['boolean', 'number', 'string'].includes(typeof value)) {
throw new Error(`Formula constant ${constant} contains invalid ${typeof value} value type`);
}
}
}
this.settings = options[internals.settings] ? options : Object.assign({ [internals.settings]: true, constants: {}, functions: {} }, options);
this.single = null;
this._parts = null;
this._parse(string);
}
_parse(string) {
let parts = [];
let current = '';
let parenthesis = 0;
let literal = false;
const flush = (inner) => {
if (parenthesis) {
throw new Error('Formula missing closing parenthesis');
}
const last = parts.length ? parts[parts.length - 1] : null;
if (!literal &&
!current &&
!inner) {
return;
}
if (last &&
last.type === 'reference' &&
inner === ')') { // Function
last.type = 'function';
last.value = this._subFormula(current, last.value);
current = '';
return;
}
if (inner === ')') { // Segment
const sub = new exports.Parser(current, this.settings);
parts.push({ type: 'segment', value: sub });
}
else if (literal) {
if (literal === ']') { // Reference
parts.push({ type: 'reference', value: current });
current = '';
return;
}
parts.push({ type: 'literal', value: current }); // Literal
}
else if (internals.operatorCharacters.includes(current)) { // Operator
if (last &&
last.type === 'operator' &&
internals.operators.includes(last.value + current)) { // 2 characters operator
last.value += current;
}
else {
parts.push({ type: 'operator', value: current });
}
}
else if (current.match(internals.numberRx)) { // Number
parts.push({ type: 'constant', value: parseFloat(current) });
}
else if (this.settings.constants[current] !== undefined) { // Constant
parts.push({ type: 'constant', value: this.settings.constants[current] });
}
else { // Reference
if (!current.match(internals.tokenRx)) {
throw new Error(`Formula contains invalid token: ${current}`);
}
parts.push({ type: 'reference', value: current });
}
current = '';
};
for (const c of string) {
if (literal) {
if (c === literal) {
flush();
literal = false;
}
else {
current += c;
}
}
else if (parenthesis) {
if (c === '(') {
current += c;
++parenthesis;
}
else if (c === ')') {
--parenthesis;
if (!parenthesis) {
flush(c);
}
else {
current += c;
}
}
else {
current += c;
}
}
else if (c in internals.literals) {
literal = internals.literals[c];
}
else if (c === '(') {
flush();
++parenthesis;
}
else if (internals.operatorCharacters.includes(c)) {
flush();
current = c;
flush();
}
else if (c !== ' ') {
current += c;
}
else {
flush();
}
}
flush();
// Replace prefix - to internal negative operator
parts = parts.map((part, i) => {
if (part.type !== 'operator' ||
part.value !== '-' ||
i && parts[i - 1].type !== 'operator') {
return part;
}
return { type: 'operator', value: 'n' };
});
// Validate tokens order
let operator = false;
for (const part of parts) {
if (part.type === 'operator') {
if (internals.operatorsPrefix.includes(part.value)) {
continue;
}
if (!operator) {
throw new Error('Formula contains an operator in invalid position');
}
if (!internals.operators.includes(part.value)) {
throw new Error(`Formula contains an unknown operator ${part.value}`);
}
}
else if (operator) {
throw new Error('Formula missing expected operator');
}
operator = !operator;
}
if (!operator) {
throw new Error('Formula contains invalid trailing operator');
}
// Identify single part
if (parts.length === 1 &&
['reference', 'literal', 'constant'].includes(parts[0].type)) {
this.single = { type: parts[0].type === 'reference' ? 'reference' : 'value', value: parts[0].value };
}
// Process parts
this._parts = parts.map((part) => {
// Operators
if (part.type === 'operator') {
return internals.operatorsPrefix.includes(part.value) ? part : part.value;
}
// Literals, constants, segments
if (part.type !== 'reference') {
return part.value;
}
// References
if (this.settings.tokenRx &&
!this.settings.tokenRx.test(part.value)) {
throw new Error(`Formula contains invalid reference ${part.value}`);
}
if (this.settings.reference) {
return this.settings.reference(part.value);
}
return internals.reference(part.value);
});
}
_subFormula(string, name) {
const method = this.settings.functions[name];
if (typeof method !== 'function') {
throw new Error(`Formula contains unknown function ${name}`);
}
let args = [];
if (string) {
let current = '';
let parenthesis = 0;
let literal = false;
const flush = () => {
if (!current) {
throw new Error(`Formula contains function ${name} with invalid arguments ${string}`);
}
args.push(current);
current = '';
};
for (let i = 0; i < string.length; ++i) {
const c = string[i];
if (literal) {
current += c;
if (c === literal) {
literal = false;
}
}
else if (c in internals.literals &&
!parenthesis) {
current += c;
literal = internals.literals[c];
}
else if (c === ',' &&
!parenthesis) {
flush();
}
else {
current += c;
if (c === '(') {
++parenthesis;
}
else if (c === ')') {
--parenthesis;
}
}
}
flush();
}
args = args.map((arg) => new exports.Parser(arg, this.settings));
return function (context) {
const innerValues = [];
for (const arg of args) {
innerValues.push(arg.evaluate(context));
}
return method.call(context, ...innerValues);
};
}
evaluate(context) {
const parts = this._parts.slice();
// Prefix operators
for (let i = parts.length - 2; i >= 0; --i) {
const part = parts[i];
if (part &&
part.type === 'operator') {
const current = parts[i + 1];
parts.splice(i + 1, 1);
const value = internals.evaluate(current, context);
parts[i] = internals.single(part.value, value);
}
}
// Left-right operators
internals.operatorsOrder.forEach((set) => {
for (let i = 1; i < parts.length - 1;) {
if (set.includes(parts[i])) {
const operator = parts[i];
const left = internals.evaluate(parts[i - 1], context);
const right = internals.evaluate(parts[i + 1], context);
parts.splice(i, 2);
const result = internals.calculate(operator, left, right);
parts[i - 1] = result === 0 ? 0 : result; // Convert -0
}
else {
i += 2;
}
}
});
return internals.evaluate(parts[0], context);
}
};
exports.Parser.prototype[internals.symbol] = true;
internals.reference = function (name) {
return function (context) {
return context && context[name] !== undefined ? context[name] : null;
};
};
internals.evaluate = function (part, context) {
if (part === null) {
return null;
}
if (typeof part === 'function') {
return part(context);
}
if (part[internals.symbol]) {
return part.evaluate(context);
}
return part;
};
internals.single = function (operator, value) {
if (operator === '!') {
return value ? false : true;
}
// operator === 'n'
const negative = -value;
if (negative === 0) { // Override -0
return 0;
}
return negative;
};
internals.calculate = function (operator, left, right) {
if (operator === '??') {
return internals.exists(left) ? left : right;
}
if (typeof left === 'string' ||
typeof right === 'string') {
if (operator === '+') {
left = internals.exists(left) ? left : '';
right = internals.exists(right) ? right : '';
return left + right;
}
}
else {
switch (operator) {
case '^': return Math.pow(left, right);
case '*': return left * right;
case '/': return left / right;
case '%': return left % right;
case '+': return left + right;
case '-': return left - right;
}
}
switch (operator) {
case '<': return left < right;
case '<=': return left <= right;
case '>': return left > right;
case '>=': return left >= right;
case '==': return left === right;
case '!=': return left !== right;
case '&&': return left && right;
case '||': return left || right;
}
return null;
};
internals.exists = function (value) {
return value !== null && value !== undefined;
};

29
node_modules/@hapi/formula/package.json generated vendored Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "@hapi/formula",
"description": "Math and string formula parser.",
"version": "3.0.2",
"repository": "git://github.com/hapijs/formula",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"keywords": [
"formula",
"parser",
"math",
"string"
],
"files": [
"lib"
],
"dependencies": {},
"devDependencies": {
"@hapi/code": "^9.0.3",
"@hapi/lab": "^25.1.2",
"@types/node": "^14.18.36",
"typescript": "4.0.x"
},
"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"
},
"license": "BSD-3-Clause"
}

13
node_modules/@hapi/hoek/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,13 @@
Copyright (c) 2011-2022, Project contributors
Copyright (c) 2011-2020, Sideway Inc
Copyright (c) 2011-2014, Walmart
Copyright (c) 2011, Yahoo Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* The names of any contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS OFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

19
node_modules/@hapi/hoek/README.md generated vendored Normal file
View File

@@ -0,0 +1,19 @@
<a href="https://hapi.dev"><img src="https://raw.githubusercontent.com/hapijs/assets/master/images/family.png" width="180px" align="right" /></a>
# @hapi/hoek
#### Utility methods for the hapi ecosystem.
**hoek** is part of the **hapi** ecosystem and was designed to work seamlessly with the [hapi web framework](https://hapi.dev) and its other components (but works great on its own or with other frameworks). If you are using a different web framework and find this module useful, check out [hapi](https://hapi.dev) they work even better together.
This module is not intended to solve every problem for everyone, but rather as a central place to store hapi-specific methods. If you're looking for a general purpose utility module, check out [lodash](https://github.com/lodash/lodash).
### Visit the [hapi.dev](https://hapi.dev) Developer Portal for tutorials, documentation, and support
## Useful resources
- [Documentation and API](https://hapi.dev/family/hoek/)
- [Version status](https://hapi.dev/resources/status/#hoek) (builds, dependencies, node versions, licenses, eol)
- [Changelog](https://hapi.dev/family/hoek/changelog/)
- [Project policies](https://hapi.dev/policies/)
- [Free and commercial support options](https://hapi.dev/support/)

3
node_modules/@hapi/hoek/lib/applyToDefaults.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { applyToDefaults } from "./index";
export = applyToDefaults;

102
node_modules/@hapi/hoek/lib/applyToDefaults.js generated vendored Normal file
View File

@@ -0,0 +1,102 @@
'use strict';
const Assert = require('./assert');
const Clone = require('./clone');
const Merge = require('./merge');
const Reach = require('./reach');
const internals = {};
module.exports = function (defaults, source, options = {}) {
Assert(defaults && typeof defaults === 'object', 'Invalid defaults value: must be an object');
Assert(!source || source === true || typeof source === 'object', 'Invalid source value: must be true, falsy or an object');
Assert(typeof options === 'object', 'Invalid options: must be an object');
if (!source) { // If no source, return null
return null;
}
if (options.shallow) {
return internals.applyToDefaultsWithShallow(defaults, source, options);
}
const copy = Clone(defaults);
if (source === true) { // If source is set to true, use defaults
return copy;
}
const nullOverride = options.nullOverride !== undefined ? options.nullOverride : false;
return Merge(copy, source, { nullOverride, mergeArrays: false });
};
internals.applyToDefaultsWithShallow = function (defaults, source, options) {
const keys = options.shallow;
Assert(Array.isArray(keys), 'Invalid keys');
const seen = new Map();
const merge = source === true ? null : new Set();
for (let key of keys) {
key = Array.isArray(key) ? key : key.split('.'); // Pre-split optimization
const ref = Reach(defaults, key);
if (ref &&
typeof ref === 'object') {
seen.set(ref, merge && Reach(source, key) || ref);
}
else if (merge) {
merge.add(key);
}
}
const copy = Clone(defaults, {}, seen);
if (!merge) {
return copy;
}
for (const key of merge) {
internals.reachCopy(copy, source, key);
}
const nullOverride = options.nullOverride !== undefined ? options.nullOverride : false;
return Merge(copy, source, { nullOverride, mergeArrays: false });
};
internals.reachCopy = function (dst, src, path) {
for (const segment of path) {
if (!(segment in src)) {
return;
}
const val = src[segment];
if (typeof val !== 'object' || val === null) {
return;
}
src = val;
}
const value = src;
let ref = dst;
for (let i = 0; i < path.length - 1; ++i) {
const segment = path[i];
if (typeof ref[segment] !== 'object') {
ref[segment] = {};
}
ref = ref[segment];
}
ref[path[path.length - 1]] = value;
};

3
node_modules/@hapi/hoek/lib/assert.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { assert } from "./index";
export = assert;

30
node_modules/@hapi/hoek/lib/assert.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
'use strict';
const AssertError = require('./assertError');
const Stringify = require('./stringify');
const internals = {};
const assert = module.exports = function (condition, ...args) {
if (condition) {
return;
}
if (args.length === 1 &&
args[0] instanceof Error) {
throw args[0];
}
const msgs = args
.filter((arg) => arg !== '')
.map((arg) => {
return typeof arg === 'string' ? arg : arg instanceof Error ? arg.message : Stringify(arg);
});
throw new AssertError(msgs.join(' '), assert);
};

3
node_modules/@hapi/hoek/lib/assertError.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { AssertError } from "./index";
export = AssertError;

18
node_modules/@hapi/hoek/lib/assertError.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
'use strict';
const internals = {};
module.exports = class AssertError extends Error {
name = 'AssertError';
constructor(message, ctor) {
super(message || 'Unknown error');
if (typeof Error.captureStackTrace === 'function') { // $lab:coverage:ignore$
Error.captureStackTrace(this, ctor);
}
}
};

3
node_modules/@hapi/hoek/lib/bench.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { Bench } from "./index";
export = Bench;

29
node_modules/@hapi/hoek/lib/bench.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
'use strict';
const internals = {};
module.exports = internals.Bench = class {
constructor() {
this.ts = 0;
this.reset();
}
reset() {
this.ts = internals.Bench.now();
}
elapsed() {
return internals.Bench.now() - this.ts;
}
static now() {
const ts = process.hrtime();
return (ts[0] * 1e3) + (ts[1] / 1e6);
}
};

3
node_modules/@hapi/hoek/lib/block.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { block } from "./index";
export = block;

12
node_modules/@hapi/hoek/lib/block.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
'use strict';
const Ignore = require('./ignore');
const internals = {};
module.exports = function () {
return new Promise(Ignore);
};

3
node_modules/@hapi/hoek/lib/clone.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { clone } from "./index";
export = clone;

198
node_modules/@hapi/hoek/lib/clone.js generated vendored Normal file
View File

@@ -0,0 +1,198 @@
'use strict';
const Reach = require('./reach');
const Types = require('./types');
const Utils = require('./utils');
const internals = {
needsProtoHack: new Set([Types.set, Types.map, Types.weakSet, Types.weakMap]),
structuredCloneExists: typeof structuredClone === 'function'
};
module.exports = internals.clone = function (obj, options = {}, _seen = null) {
if (typeof obj !== 'object' ||
obj === null) {
return obj;
}
let clone = internals.clone;
let seen = _seen;
if (options.shallow) {
if (options.shallow !== true) {
return internals.cloneWithShallow(obj, options);
}
clone = (value) => value;
}
else if (seen) {
const lookup = seen.get(obj);
if (lookup) {
return lookup;
}
}
else {
seen = new Map();
}
// Built-in object types
const baseProto = Types.getInternalProto(obj);
switch (baseProto) {
case Types.buffer:
return Buffer?.from(obj);
case Types.date:
return new Date(obj.getTime());
case Types.regex:
case Types.url:
return new baseProto.constructor(obj);
}
// Generic objects
const newObj = internals.base(obj, baseProto, options);
if (newObj === obj) {
return obj;
}
if (seen) {
seen.set(obj, newObj); // Set seen, since obj could recurse
}
if (baseProto === Types.set) {
for (const value of obj) {
newObj.add(clone(value, options, seen));
}
}
else if (baseProto === Types.map) {
for (const [key, value] of obj) {
newObj.set(key, clone(value, options, seen));
}
}
const keys = Utils.keys(obj, options);
for (const key of keys) {
if (key === '__proto__') {
continue;
}
if (baseProto === Types.array &&
key === 'length') {
newObj.length = obj.length;
continue;
}
// Can only be covered in node 21+
/* $lab:coverage:off$ */
if (internals.structuredCloneExists &&
baseProto === Types.error &&
key === 'stack') {
continue; // Already a part of the base object
}
/* $lab:coverage:on$ */
const descriptor = Object.getOwnPropertyDescriptor(obj, key);
if (descriptor) {
if (descriptor.get ||
descriptor.set) {
Object.defineProperty(newObj, key, descriptor);
}
else if (descriptor.enumerable) {
newObj[key] = clone(obj[key], options, seen);
}
else {
Object.defineProperty(newObj, key, { enumerable: false, writable: true, configurable: true, value: clone(obj[key], options, seen) });
}
}
else {
Object.defineProperty(newObj, key, {
enumerable: true,
writable: true,
configurable: true,
value: clone(obj[key], options, seen)
});
}
}
return newObj;
};
internals.cloneWithShallow = function (source, options) {
const keys = options.shallow;
options = Object.assign({}, options);
options.shallow = false;
const seen = new Map();
for (const key of keys) {
const ref = Reach(source, key);
if (typeof ref === 'object' ||
typeof ref === 'function') {
seen.set(ref, ref);
}
}
return internals.clone(source, options, seen);
};
internals.base = function (obj, baseProto, options) {
if (options.prototype === false) { // Defaults to true
if (internals.needsProtoHack.has(baseProto)) {
return new baseProto.constructor();
}
return baseProto === Types.array ? [] : {};
}
const proto = Object.getPrototypeOf(obj);
if (proto &&
proto.isImmutable) {
return obj;
}
if (baseProto === Types.array) {
const newObj = [];
if (proto !== baseProto) {
Object.setPrototypeOf(newObj, proto);
}
return newObj;
}
// Can only be covered in node 21+
/* $lab:coverage:off$ */
else if (baseProto === Types.error && internals.structuredCloneExists &&
(proto === baseProto || Error.isPrototypeOf(proto.constructor))) { // Don't match Util.inherit() subclassed errors
const err = structuredClone(obj); // Needed to copy internal stack state
if (Object.getPrototypeOf(err) !== proto) {
Object.setPrototypeOf(err, proto); // Fix prototype
}
return err;
}
/* $lab:coverage:on$ */
if (internals.needsProtoHack.has(baseProto)) {
const newObj = new proto.constructor();
if (proto !== baseProto) {
Object.setPrototypeOf(newObj, proto);
}
return newObj;
}
return Object.create(proto);
};

3
node_modules/@hapi/hoek/lib/contain.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { contain } from "./index";
export = contain;

307
node_modules/@hapi/hoek/lib/contain.js generated vendored Normal file
View File

@@ -0,0 +1,307 @@
'use strict';
const Assert = require('./assert');
const DeepEqual = require('./deepEqual');
const EscapeRegex = require('./escapeRegex');
const Utils = require('./utils');
const internals = {};
module.exports = function (ref, values, options = {}) { // options: { deep, once, only, part, symbols }
/*
string -> string(s)
array -> item(s)
object -> key(s)
object -> object (key:value)
*/
if (typeof values !== 'object') {
values = [values];
}
Assert(!Array.isArray(values) || values.length, 'Values array cannot be empty');
// String
if (typeof ref === 'string') {
return internals.string(ref, values, options);
}
// Array
if (Array.isArray(ref)) {
return internals.array(ref, values, options);
}
// Object
Assert(typeof ref === 'object', 'Reference must be string or an object');
return internals.object(ref, values, options);
};
internals.array = function (ref, values, options) {
if (!Array.isArray(values)) {
values = [values];
}
if (!ref.length) {
return false;
}
if (options.only &&
options.once &&
ref.length !== values.length) {
return false;
}
let compare;
// Map values
const map = new Map();
for (const value of values) {
if (!options.deep ||
!value ||
typeof value !== 'object') {
const existing = map.get(value);
if (existing) {
++existing.allowed;
}
else {
map.set(value, { allowed: 1, hits: 0 });
}
}
else {
compare = compare ?? internals.compare(options);
let found = false;
for (const [key, existing] of map.entries()) {
if (compare(key, value)) {
++existing.allowed;
found = true;
break;
}
}
if (!found) {
map.set(value, { allowed: 1, hits: 0 });
}
}
}
// Lookup values
let hits = 0;
for (const item of ref) {
let match;
if (!options.deep ||
!item ||
typeof item !== 'object') {
match = map.get(item);
}
else {
compare = compare ?? internals.compare(options);
for (const [key, existing] of map.entries()) {
if (compare(key, item)) {
match = existing;
break;
}
}
}
if (match) {
++match.hits;
++hits;
if (options.once &&
match.hits > match.allowed) {
return false;
}
}
}
// Validate results
if (options.only &&
hits !== ref.length) {
return false;
}
for (const match of map.values()) {
if (match.hits === match.allowed) {
continue;
}
if (match.hits < match.allowed &&
!options.part) {
return false;
}
}
return !!hits;
};
internals.object = function (ref, values, options) {
Assert(options.once === undefined, 'Cannot use option once with object');
const keys = Utils.keys(ref, options);
if (!keys.length) {
return false;
}
// Keys list
if (Array.isArray(values)) {
return internals.array(keys, values, options);
}
// Key value pairs
const symbols = Object.getOwnPropertySymbols(values).filter((sym) => values.propertyIsEnumerable(sym));
const targets = [...Object.keys(values), ...symbols];
const compare = internals.compare(options);
const set = new Set(targets);
for (const key of keys) {
if (!set.has(key)) {
if (options.only) {
return false;
}
continue;
}
if (!compare(values[key], ref[key])) {
return false;
}
set.delete(key);
}
if (set.size) {
return options.part ? set.size < targets.length : false;
}
return true;
};
internals.string = function (ref, values, options) {
// Empty string
if (ref === '') {
return values.length === 1 && values[0] === '' || // '' contains ''
!options.once && !values.some((v) => v !== ''); // '' contains multiple '' if !once
}
// Map values
const map = new Map();
const patterns = [];
for (const value of values) {
Assert(typeof value === 'string', 'Cannot compare string reference to non-string value');
if (value) {
const existing = map.get(value);
if (existing) {
++existing.allowed;
}
else {
map.set(value, { allowed: 1, hits: 0 });
patterns.push(EscapeRegex(value));
}
}
else if (options.once ||
options.only) {
return false;
}
}
if (!patterns.length) { // Non-empty string contains unlimited empty string
return true;
}
// Match patterns
const regex = new RegExp(`(${patterns.join('|')})`, 'g');
const leftovers = ref.replace(regex, ($0, $1) => {
++map.get($1).hits;
return ''; // Remove from string
});
// Validate results
if (options.only &&
leftovers) {
return false;
}
let any = false;
for (const match of map.values()) {
if (match.hits) {
any = true;
}
if (match.hits === match.allowed) {
continue;
}
if (match.hits < match.allowed &&
!options.part) {
return false;
}
// match.hits > match.allowed
if (options.once) {
return false;
}
}
return !!any;
};
internals.compare = function (options) {
if (!options.deep) {
return internals.shallow;
}
const hasOnly = options.only !== undefined;
const hasPart = options.part !== undefined;
const flags = {
prototype: hasOnly ? options.only : hasPart ? !options.part : false,
part: hasOnly ? !options.only : hasPart ? options.part : false
};
return (a, b) => DeepEqual(a, b, flags);
};
internals.shallow = function (a, b) {
return a === b;
};

3
node_modules/@hapi/hoek/lib/deepEqual.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { deepEqual } from "./index";
export = deepEqual;

317
node_modules/@hapi/hoek/lib/deepEqual.js generated vendored Normal file
View File

@@ -0,0 +1,317 @@
'use strict';
const Types = require('./types');
const internals = {
mismatched: null
};
module.exports = function (obj, ref, options) {
options = Object.assign({ prototype: true }, options);
return !!internals.isDeepEqual(obj, ref, options, []);
};
internals.isDeepEqual = function (obj, ref, options, seen) {
if (obj === ref) { // Copied from Deep-eql, copyright(c) 2013 Jake Luer, jake@alogicalparadox.com, MIT Licensed, https://github.com/chaijs/deep-eql
return obj !== 0 || 1 / obj === 1 / ref;
}
const type = typeof obj;
if (type !== typeof ref) {
return false;
}
if (obj === null ||
ref === null) {
return false;
}
if (type === 'function') {
if (!options.deepFunction ||
obj.toString() !== ref.toString()) {
return false;
}
// Continue as object
}
else if (type !== 'object') {
return obj !== obj && ref !== ref; // NaN
}
const instanceType = internals.getSharedType(obj, ref, !!options.prototype);
switch (instanceType) {
case Types.buffer:
return Buffer && Buffer.prototype.equals.call(obj, ref); // $lab:coverage:ignore$
case Types.promise:
return obj === ref;
case Types.regex:
case Types.url:
return obj.toString() === ref.toString();
case internals.mismatched:
return false;
}
for (let i = seen.length - 1; i >= 0; --i) {
if (seen[i].isSame(obj, ref)) {
return true; // If previous comparison failed, it would have stopped execution
}
}
seen.push(new internals.SeenEntry(obj, ref));
try {
return !!internals.isDeepEqualObj(instanceType, obj, ref, options, seen);
}
finally {
seen.pop();
}
};
internals.getSharedType = function (obj, ref, checkPrototype) {
if (checkPrototype) {
if (Object.getPrototypeOf(obj) !== Object.getPrototypeOf(ref)) {
return internals.mismatched;
}
return Types.getInternalProto(obj);
}
const type = Types.getInternalProto(obj);
if (type !== Types.getInternalProto(ref)) {
return internals.mismatched;
}
return type;
};
internals.valueOf = function (obj) {
const objValueOf = obj.valueOf;
if (objValueOf === undefined) {
return obj;
}
try {
return objValueOf.call(obj);
}
catch (err) {
return err;
}
};
internals.hasOwnEnumerableProperty = function (obj, key) {
return Object.prototype.propertyIsEnumerable.call(obj, key);
};
internals.isSetSimpleEqual = function (obj, ref) {
for (const entry of Set.prototype.values.call(obj)) {
if (!Set.prototype.has.call(ref, entry)) {
return false;
}
}
return true;
};
internals.isDeepEqualObj = function (instanceType, obj, ref, options, seen) {
const { isDeepEqual, valueOf, hasOwnEnumerableProperty } = internals;
const { keys, getOwnPropertySymbols } = Object;
if (instanceType === Types.array) {
if (options.part) {
// Check if any index match any other index
for (const objValue of obj) {
for (const refValue of ref) {
if (isDeepEqual(objValue, refValue, options, seen)) {
return true;
}
}
}
}
else {
if (obj.length !== ref.length) {
return false;
}
for (let i = 0; i < obj.length; ++i) {
if (!isDeepEqual(obj[i], ref[i], options, seen)) {
return false;
}
}
return true;
}
}
else if (instanceType === Types.set) {
if (obj.size !== ref.size) {
return false;
}
if (!internals.isSetSimpleEqual(obj, ref)) {
// Check for deep equality
const ref2 = new Set(Set.prototype.values.call(ref));
for (const objEntry of Set.prototype.values.call(obj)) {
if (ref2.delete(objEntry)) {
continue;
}
let found = false;
for (const refEntry of ref2) {
if (isDeepEqual(objEntry, refEntry, options, seen)) {
ref2.delete(refEntry);
found = true;
break;
}
}
if (!found) {
return false;
}
}
}
}
else if (instanceType === Types.map) {
if (obj.size !== ref.size) {
return false;
}
for (const [key, value] of Map.prototype.entries.call(obj)) {
if (value === undefined && !Map.prototype.has.call(ref, key)) {
return false;
}
if (!isDeepEqual(value, Map.prototype.get.call(ref, key), options, seen)) {
return false;
}
}
}
else if (instanceType === Types.error) {
// Always check name and message
if (obj.name !== ref.name ||
obj.message !== ref.message) {
return false;
}
}
// Check .valueOf()
const valueOfObj = valueOf(obj);
const valueOfRef = valueOf(ref);
if ((obj !== valueOfObj || ref !== valueOfRef) &&
!isDeepEqual(valueOfObj, valueOfRef, options, seen)) {
return false;
}
// Check properties
const objKeys = keys(obj);
if (!options.part &&
objKeys.length !== keys(ref).length &&
!options.skip) {
return false;
}
let skipped = 0;
for (const key of objKeys) {
if (options.skip &&
options.skip.includes(key)) {
if (ref[key] === undefined) {
++skipped;
}
continue;
}
if (!hasOwnEnumerableProperty(ref, key)) {
return false;
}
if (!isDeepEqual(obj[key], ref[key], options, seen)) {
return false;
}
}
if (!options.part &&
objKeys.length - skipped !== keys(ref).length) {
return false;
}
// Check symbols
if (options.symbols !== false) { // Defaults to true
const objSymbols = getOwnPropertySymbols(obj);
const refSymbols = new Set(getOwnPropertySymbols(ref));
for (const key of objSymbols) {
if (!options.skip?.includes(key)) {
if (hasOwnEnumerableProperty(obj, key)) {
if (!hasOwnEnumerableProperty(ref, key)) {
return false;
}
if (!isDeepEqual(obj[key], ref[key], options, seen)) {
return false;
}
}
else if (hasOwnEnumerableProperty(ref, key)) {
return false;
}
}
refSymbols.delete(key);
}
for (const key of refSymbols) {
if (hasOwnEnumerableProperty(ref, key)) {
return false;
}
}
}
return true;
};
internals.SeenEntry = class {
constructor(obj, ref) {
this.obj = obj;
this.ref = ref;
}
isSame(obj, ref) {
return this.obj === obj && this.ref === ref;
}
};

View File

@@ -0,0 +1,3 @@
import { escapeHeaderAttribute } from "./index";
export = escapeHeaderAttribute;

16
node_modules/@hapi/hoek/lib/escapeHeaderAttribute.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
'use strict';
const Assert = require('./assert');
const internals = {};
module.exports = function (attribute) {
// Allowed value characters: !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9, \, "
Assert(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(attribute), 'Bad attribute value (' + attribute + ')');
return attribute.replace(/\\/g, '\\\\').replace(/\"/g, '\\"'); // Escape quotes and slash
};

3
node_modules/@hapi/hoek/lib/escapeHtml.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { escapeHtml } from "./index";
export = escapeHtml;

87
node_modules/@hapi/hoek/lib/escapeHtml.js generated vendored Normal file
View File

@@ -0,0 +1,87 @@
'use strict';
const internals = {};
module.exports = function (input) {
if (!input) {
return '';
}
let escaped = '';
for (let i = 0; i < input.length; ++i) {
const charCode = input.charCodeAt(i);
if (internals.isSafe(charCode)) {
escaped += input[i];
}
else {
escaped += internals.escapeHtmlChar(charCode);
}
}
return escaped;
};
internals.escapeHtmlChar = function (charCode) {
const namedEscape = internals.namedHtml.get(charCode);
if (namedEscape) {
return namedEscape;
}
if (charCode >= 256) {
return '&#' + charCode + ';';
}
const hexValue = charCode.toString(16).padStart(2, '0');
return `&#x${hexValue};`;
};
internals.isSafe = function (charCode) {
return internals.safeCharCodes.has(charCode);
};
internals.namedHtml = new Map([
[38, '&amp;'],
[60, '&lt;'],
[62, '&gt;'],
[34, '&quot;'],
[160, '&nbsp;'],
[162, '&cent;'],
[163, '&pound;'],
[164, '&curren;'],
[169, '&copy;'],
[174, '&reg;']
]);
internals.safeCharCodes = (function () {
const safe = new Set();
for (let i = 32; i < 123; ++i) {
if ((i >= 97) || // a-z
(i >= 65 && i <= 90) || // A-Z
(i >= 48 && i <= 57) || // 0-9
i === 32 || // space
i === 46 || // .
i === 44 || // ,
i === 45 || // -
i === 58 || // :
i === 95) { // _
safe.add(i);
}
}
return safe;
}());

3
node_modules/@hapi/hoek/lib/escapeJson.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { escapeJson } from "./index";
export = escapeJson;

28
node_modules/@hapi/hoek/lib/escapeJson.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
'use strict';
const internals = {};
module.exports = function (input) {
if (!input) {
return '';
}
return input.replace(/[<>&\u2028\u2029]/g, internals.escape);
};
internals.escape = function (char) {
return internals.replacements.get(char);
};
internals.replacements = new Map([
['<', '\\u003c'],
['>', '\\u003e'],
['&', '\\u0026'],
['\u2028', '\\u2028'],
['\u2029', '\\u2029']
]);

3
node_modules/@hapi/hoek/lib/escapeRegex.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { escapeRegex } from "./index";
export = escapeRegex;

11
node_modules/@hapi/hoek/lib/escapeRegex.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
'use strict';
const internals = {};
module.exports = function (string) {
// Escape ^$.*+-?=!:|\/()[]{},
return string.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g, '\\$&');
};

3
node_modules/@hapi/hoek/lib/flatten.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { flatten } from "./index";
export = flatten;

20
node_modules/@hapi/hoek/lib/flatten.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
'use strict';
const internals = {};
module.exports = internals.flatten = function (array, target) {
const result = target || [];
for (const entry of array) {
if (Array.isArray(entry)) {
internals.flatten(entry, result);
}
else {
result.push(entry);
}
}
return result;
};

3
node_modules/@hapi/hoek/lib/ignore.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { ignore } from "./index";
export = ignore;

6
node_modules/@hapi/hoek/lib/ignore.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
'use strict';
const internals = {};
module.exports = function () { };

480
node_modules/@hapi/hoek/lib/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,480 @@
/// <reference types="node" />
/**
* Performs a deep comparison of the two values including support for circular dependencies, prototype, and enumerable properties.
*
* @param obj - The value being compared.
* @param ref - The reference value used for comparison.
*
* @return true when the two values are equal, otherwise false.
*/
export function deepEqual(obj: any, ref: any, options?: deepEqual.Options): boolean;
export namespace deepEqual {
interface Options {
/**
* Compare functions with difference references by comparing their internal code and properties.
*
* @default false
*/
readonly deepFunction?: boolean;
/**
* Allow partial match.
*
* @default false
*/
readonly part?: boolean;
/**
* Compare the objects' prototypes.
*
* @default true
*/
readonly prototype?: boolean;
/**
* List of object keys to ignore different values of.
*
* @default null
*/
readonly skip?: (string | symbol)[];
/**
* Compare symbol properties.
*
* @default true
*/
readonly symbols?: boolean;
}
}
/**
* Clone any value, object, or array.
*
* @param obj - The value being cloned.
* @param options - Optional settings.
*
* @returns A deep clone of `obj`.
*/
export function clone<T>(obj: T, options?: clone.Options): T;
export namespace clone {
interface Options {
/**
* Clone the object's prototype.
*
* @default true
*/
readonly prototype?: boolean;
/**
* Include symbol properties.
*
* @default true
*/
readonly symbols?: boolean;
/**
* Shallow clone the specified keys.
*
* @default undefined
*/
readonly shallow?: string[] | string[][] | boolean;
}
}
/**
* Merge all the properties of source into target.
*
* @param target - The object being modified.
* @param source - The object used to copy properties from.
* @param options - Optional settings.
*
* @returns The `target` object.
*/
export function merge<T1 extends object, T2 extends object>(target: T1, source: T2, options?: merge.Options): T1 & T2;
export namespace merge {
interface Options {
/**
* When true, null value from `source` overrides existing value in `target`.
*
* @default true
*/
readonly nullOverride?: boolean;
/**
* When true, array value from `source` is merged with the existing value in `target`.
*
* @default true
*/
readonly mergeArrays?: boolean;
/**
* Compare symbol properties.
*
* @default undefined
*/
readonly symbols?: boolean;
}
}
/**
* Apply source to a copy of the defaults.
*
* @param defaults - An object with the default values to use of `options` does not contain the same keys.
* @param source - The source used to override the `defaults`.
* @param options - Optional settings.
*
* @returns A copy of `defaults` with `source` keys overriding any conflicts.
*/
export function applyToDefaults<T extends object>(defaults: Partial<T>, source: Partial<T> | boolean | null, options?: applyToDefaults.Options): Partial<T>;
export namespace applyToDefaults {
interface Options {
/**
* When true, null value from `source` overrides existing value in `target`.
*
* @default true
*/
readonly nullOverride?: boolean;
/**
* Shallow clone the specified keys.
*
* @default undefined
*/
readonly shallow?: string[] | string[][];
}
}
/**
* Find the common unique items in two arrays.
*
* @param array1 - The first array to compare.
* @param array2 - The second array to compare.
* @param options - Optional settings.
*
* @return - An array of the common items. If `justFirst` is true, returns the first common item.
*/
export function intersect<T1, T2>(array1: intersect.Array<T1>, array2: intersect.Array<T2>, options?: intersect.Options): Array<T1 | T2>;
export function intersect<T1, T2>(array1: intersect.Array<T1>, array2: intersect.Array<T2>, options?: intersect.Options): T1 | T2;
export namespace intersect {
type Array<T> = ArrayLike<T> | Set<T> | null;
interface Options {
/**
* When true, return the first overlapping value.
*
* @default false
*/
readonly first?: boolean;
}
}
/**
* Checks if the reference value contains the provided values.
*
* @param ref - The reference string, array, or object.
* @param values - A single or array of values to find within `ref`. If `ref` is an object, `values` can be a key name, an array of key names, or an object with key-value pairs to compare.
*
* @return true if the value contains the provided values, otherwise false.
*/
export function contain(ref: string, values: string | string[], options?: contain.Options): boolean;
export function contain(ref: any[], values: any, options?: contain.Options): boolean;
export function contain(ref: object, values: string | string[] | object, options?: Omit<contain.Options, 'once'>): boolean;
export namespace contain {
interface Options {
/**
* Perform a deep comparison.
*
* @default false
*/
readonly deep?: boolean;
/**
* Allow only one occurrence of each value.
*
* @default false
*/
readonly once?: boolean;
/**
* Allow only values explicitly listed.
*
* @default false
*/
readonly only?: boolean;
/**
* Allow partial match.
*
* @default false
*/
readonly part?: boolean;
/**
* Include symbol properties.
*
* @default true
*/
readonly symbols?: boolean;
}
}
/**
* Flatten an array with sub arrays
*
* @param array - an array of items or other arrays to flatten.
* @param target - if provided, an array to shallow copy the flattened `array` items to
*
* @return a flat array of the provided values (appended to `target` is provided).
*/
export function flatten<T>(array: ArrayLike<T | ReadonlyArray<T>>, target?: ArrayLike<T | ReadonlyArray<T>>): T[];
/**
* Convert an object key chain string to reference.
*
* @param obj - the object from which to look up the value.
* @param chain - the string path of the requested value. The chain string is split into key names using `options.separator`, or an array containing each individual key name. A chain including negative numbers will work like a negative index on an array.
*
* @return The value referenced by the chain if found, otherwise undefined. If chain is null, undefined, or false, the object itself will be returned.
*/
export function reach(obj: object | null, chain: string | (string | number)[] | false | null | undefined, options?: reach.Options): any;
export namespace reach {
interface Options {
/**
* String to split chain path on. Defaults to '.'.
*
* @default false
*/
readonly separator?: string;
/**
* Value to return if the path or value is not present. No default value.
*
* @default false
*/
readonly default?: any;
/**
* If true, will throw an error on missing member in the chain. Default to false.
*
* @default false
*/
readonly strict?: boolean;
/**
* If true, allows traversing functions for properties. false will throw an error if a function is part of the chain.
*
* @default true
*/
readonly functions?: boolean;
/**
* If true, allows traversing Set and Map objects for properties. false will return undefined regardless of the Set or Map passed.
*
* @default false
*/
readonly iterables?: boolean;
}
}
/**
* Replace string parameters (using format "{path.to.key}") with their corresponding object key values using `Hoek.reach()`.
*
* @param obj - the object from which to look up the value.
* @param template - the string containing {} enclosed key paths to be replaced.
*
* @return The template string with the {} enclosed keys replaced with looked-up values.
*/
export function reachTemplate(obj: object | null, template: string, options?: reach.Options): string;
/**
* Throw an error if condition is falsy.
*
* @param condition - If `condition` is not truthy, an exception is thrown.
* @param error - The error thrown if the condition fails.
*
* @return Does not return a value but throws if the `condition` is falsy.
*/
export function assert(condition: any, error: Error): asserts condition;
/**
* Throw an error if condition is falsy.
*
* @param condition - If `condition` is not truthy, an exception is thrown.
* @param args - Any number of values, concatenated together (space separated) to create the error message.
*
* @return Does not return a value but throws if the `condition` is falsy.
*/
export function assert(condition: any, ...args: any): asserts condition;
/**
* Assertion Error as thrown from Hoek.assert().
*/
export class AssertError extends Error {
name: 'AssertError';
}
/**
* A benchmarking timer, using the internal node clock for maximum accuracy.
*/
export class Bench {
constructor();
/** The starting timestamp expressed in the number of milliseconds since the epoch. */
ts: number;
/** The time in milliseconds since the object was created. */
elapsed(): number;
/** Reset the `ts` value to now. */
reset(): void;
/** The current time in milliseconds since the epoch. */
static now(): number;
}
/**
* Escape string for Regex construction by prefixing all reserved characters with a backslash.
*
* @param string - The string to be escaped.
*
* @return The escaped string.
*/
export function escapeRegex(string: string): string;
/**
* Escape string for usage as an attribute value in HTTP headers.
*
* @param attribute - The string to be escaped.
*
* @return The escaped string. Will throw on invalid characters that are not supported to be escaped.
*/
export function escapeHeaderAttribute(attribute: string): string;
/**
* Escape string for usage in HTML.
*
* @param string - The string to be escaped.
*
* @return The escaped string.
*/
export function escapeHtml(string: string): string;
/**
* Escape string for usage in JSON.
*
* @param string - The string to be escaped.
*
* @return The escaped string.
*/
export function escapeJson(string: string): string;
/**
* Wraps a function to ensure it can only execute once.
*
* @param method - The function to be wrapped.
*
* @return The wrapped function.
*/
export function once<T extends Function>(method: T): T;
/**
* A reusable no-op function.
*/
export function ignore(...ignore: any): void;
/**
* Converts a JavaScript value to a JavaScript Object Notation (JSON) string with protection against thrown errors.
*
* @param value A JavaScript value, usually an object or array, to be converted.
* @param replacer The JSON.stringify() `replacer` argument.
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
*
* @return The JSON string. If the operation fails, an error string value is returned (no exception thrown).
*/
export function stringify(value: any, replacer?: any, space?: string | number): string;
/**
* Returns a Promise that resolves after the requested timeout.
*
* @param timeout - The number of milliseconds to wait before resolving the Promise.
* @param returnValue - The value that the Promise will resolve to.
*
* @return A Promise that resolves with `returnValue`.
*/
export function wait<T>(timeout?: number, returnValue?: T): Promise<T>;
/**
* Returns a Promise that never resolves.
*/
export function block(): Promise<void>;
/**
* Determines if an object is a promise.
*
* @param promise - the object tested.
*
* @returns true if the object is a promise, otherwise false.
*/
export function isPromise(promise: any): boolean;
export namespace ts {
/**
* Defines a type that can must be one of T or U but not both.
*/
type XOR<T, U> = (T | U) extends object ? (internals.Without<T, U> & U) | (internals.Without<U, T> & T) : T | U;
}
declare namespace internals {
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
}

45
node_modules/@hapi/hoek/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,45 @@
'use strict';
exports.applyToDefaults = require('./applyToDefaults');
exports.assert = require('./assert');
exports.AssertError = require('./assertError');
exports.Bench = require('./bench');
exports.block = require('./block');
exports.clone = require('./clone');
exports.contain = require('./contain');
exports.deepEqual = require('./deepEqual');
exports.escapeHeaderAttribute = require('./escapeHeaderAttribute');
exports.escapeHtml = require('./escapeHtml');
exports.escapeJson = require('./escapeJson');
exports.escapeRegex = require('./escapeRegex');
exports.flatten = require('./flatten');
exports.ignore = require('./ignore');
exports.intersect = require('./intersect');
exports.isPromise = require('./isPromise');
exports.merge = require('./merge');
exports.once = require('./once');
exports.reach = require('./reach');
exports.reachTemplate = require('./reachTemplate');
exports.stringify = require('./stringify');
exports.wait = require('./wait');

43
node_modules/@hapi/hoek/lib/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,43 @@
export { default as applyToDefaults } from './applyToDefaults.js';
export { default as assert } from './assert.js';
export { default as Bench } from './bench.js';
export { default as block } from './block.js';
export { default as clone } from './clone.js';
export { default as contain } from './contain.js';
export { default as deepEqual } from './deepEqual.js';
export { default as AssertError } from './assertError.js';
export { default as escapeHeaderAttribute } from './escapeHeaderAttribute.js';
export { default as escapeHtml } from './escapeHtml.js';
export { default as escapeJson } from './escapeJson.js';
export { default as escapeRegex } from './escapeRegex.js';
export { default as flatten } from './flatten.js';
export { default as ignore } from './ignore.js';
export { default as intersect } from './intersect.js';
export { default as isPromise } from './isPromise.js';
export { default as merge } from './merge.js';
export { default as once } from './once.js';
export { default as reach } from './reach.js';
export { default as reachTemplate } from './reachTemplate.js';
export { default as stringify } from './stringify.js';
export { default as wait } from './wait.js';

3
node_modules/@hapi/hoek/lib/intersect.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { intersect } from "./index";
export = intersect;

41
node_modules/@hapi/hoek/lib/intersect.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
'use strict';
const internals = {};
module.exports = function (array1, array2, options = {}) {
if (!array1 ||
!array2) {
return (options.first ? null : []);
}
const common = [];
const hash = (Array.isArray(array1) ? new Set(array1) : array1);
const found = new Set();
for (const value of array2) {
if (internals.has(hash, value) &&
!found.has(value)) {
if (options.first) {
return value;
}
common.push(value);
found.add(value);
}
}
return (options.first ? null : common);
};
internals.has = function (ref, key) {
if (typeof ref.has === 'function') {
return ref.has(key);
}
return ref[key] !== undefined;
};

3
node_modules/@hapi/hoek/lib/isPromise.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { isPromise } from "./index";
export = isPromise;

9
node_modules/@hapi/hoek/lib/isPromise.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
'use strict';
const internals = {};
module.exports = function (promise) {
return typeof promise?.then === 'function';
};

3
node_modules/@hapi/hoek/lib/merge.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { merge } from "./index";
export = merge;

78
node_modules/@hapi/hoek/lib/merge.js generated vendored Normal file
View File

@@ -0,0 +1,78 @@
'use strict';
const Assert = require('./assert');
const Clone = require('./clone');
const Utils = require('./utils');
const internals = {};
module.exports = internals.merge = function (target, source, options) {
Assert(target && typeof target === 'object', 'Invalid target value: must be an object');
Assert(source === null || source === undefined || typeof source === 'object', 'Invalid source value: must be null, undefined, or an object');
if (!source) {
return target;
}
options = Object.assign({ nullOverride: true, mergeArrays: true }, options);
if (Array.isArray(source)) {
Assert(Array.isArray(target), 'Cannot merge array onto an object');
if (!options.mergeArrays) {
target.length = 0; // Must not change target assignment
}
for (let i = 0; i < source.length; ++i) {
target.push(Clone(source[i], { symbols: options.symbols }));
}
return target;
}
const keys = Utils.keys(source, options);
for (let i = 0; i < keys.length; ++i) {
const key = keys[i];
if (key === '__proto__' ||
!Object.prototype.propertyIsEnumerable.call(source, key)) {
continue;
}
const value = source[key];
if (value &&
typeof value === 'object') {
if (target[key] === value) {
continue; // Can occur for shallow merges
}
if (!target[key] ||
typeof target[key] !== 'object' ||
(Array.isArray(target[key]) !== Array.isArray(value)) ||
value instanceof Date ||
(Buffer && Buffer.isBuffer(value)) || // $lab:coverage:ignore$
value instanceof RegExp) {
target[key] = Clone(value, { symbols: options.symbols });
}
else {
internals.merge(target[key], value, options);
}
}
else {
if (value !== null &&
value !== undefined) { // Explicit to preserve empty strings
target[key] = value;
}
else if (options.nullOverride) {
target[key] = value;
}
}
}
return target;
};

3
node_modules/@hapi/hoek/lib/once.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { once } from "./index";
export = once;

25
node_modules/@hapi/hoek/lib/once.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
'use strict';
const internals = {
wrapped: Symbol('wrapped')
};
module.exports = function (method) {
if (method[internals.wrapped]) {
return method;
}
let once = false;
const wrappedFn = function (...args) {
if (!once) {
once = true;
method(...args);
}
};
wrappedFn[internals.wrapped] = true;
return wrappedFn;
};

3
node_modules/@hapi/hoek/lib/reach.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { reach } from "./index";
export = reach;

76
node_modules/@hapi/hoek/lib/reach.js generated vendored Normal file
View File

@@ -0,0 +1,76 @@
'use strict';
const Assert = require('./assert');
const internals = {};
module.exports = function (obj, chain, options) {
if (chain === false ||
chain === null ||
chain === undefined) {
return obj;
}
options = options || {};
if (typeof options === 'string') {
options = { separator: options };
}
const isChainArray = Array.isArray(chain);
Assert(!isChainArray || !options.separator, 'Separator option is not valid for array-based chain');
const path = isChainArray ? chain : chain.split(options.separator || '.');
let ref = obj;
for (let i = 0; i < path.length; ++i) {
let key = path[i];
const type = options.iterables && internals.iterables(ref);
if (Array.isArray(ref) ||
type === 'set') {
const number = Number(key);
if (Number.isInteger(number)) {
key = number < 0 ? ref.length + number : number;
}
}
if (!ref ||
typeof ref === 'function' && options.functions === false || // Defaults to true
!type && ref[key] === undefined) {
Assert(!options.strict || i + 1 === path.length, 'Missing segment', key, 'in reach path ', chain);
Assert(typeof ref === 'object' || options.functions === true || typeof ref !== 'function', 'Invalid segment', key, 'in reach path ', chain);
ref = options.default;
break;
}
if (!type) {
ref = ref[key];
}
else if (type === 'set') {
ref = [...ref][key];
}
else { // type === 'map'
ref = ref.get(key);
}
}
return ref;
};
internals.iterables = function (ref) {
if (ref instanceof Set) {
return 'set';
}
if (ref instanceof Map) {
return 'map';
}
};

Some files were not shown because too many files have changed in this diff Show More