mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
make config a own module, detect db version automatic
This commit is contained in:
parent
c8dffddb43
commit
169b18731f
@ -7,6 +7,7 @@ import IconsResolve from 'unplugin-icons/resolver'
|
||||
import { BootstrapVueNextResolver } from 'bootstrap-vue-next'
|
||||
import EnvironmentPlugin from 'vite-plugin-environment'
|
||||
import schema from './src/config/schema'
|
||||
import { validate } from '../config'
|
||||
|
||||
import dotenv from 'dotenv'
|
||||
|
||||
@ -35,24 +36,7 @@ export default defineConfig(({ command }) => {
|
||||
],
|
||||
}
|
||||
|
||||
const { error } = schema.validate(configDataForValidation, { stack: true })
|
||||
const schemaJson = schema.describe()
|
||||
if (error) {
|
||||
error.details.forEach((err) => {
|
||||
const key = err.context.key
|
||||
const value = err.context.value
|
||||
const description = schemaJson.keys[key]
|
||||
? schema.describe().keys[key].flags.description
|
||||
: 'No description available'
|
||||
if (configDataForValidation[key] === undefined) {
|
||||
throw new Error(`Environment Variable '${key}' is missing. ${description}`)
|
||||
} else {
|
||||
throw new Error(
|
||||
`Error on Environment Variable ${key} with value = ${value}: ${err.message}. ${description}`,
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
validate(schema, configDataForValidation)
|
||||
|
||||
return {
|
||||
base: '/admin/',
|
||||
|
||||
@ -3,7 +3,7 @@ PORT=4000
|
||||
JWT_SECRET=secret123
|
||||
JWT_EXPIRES_IN=10m
|
||||
GRAPHIQL=false
|
||||
GDT_API_URL=https://gdt.gradido.net
|
||||
GDT_ACTIVE=false
|
||||
|
||||
# Database
|
||||
DB_HOST=localhost
|
||||
@ -45,7 +45,7 @@ EMAIL_TEST_RECEIVER=stage1@gradido.net
|
||||
EMAIL_USERNAME=gradido_email
|
||||
EMAIL_SENDER=info@gradido.net
|
||||
EMAIL_PASSWORD=xxx
|
||||
EMAIL_SMTP_URL=gmail.com
|
||||
EMAIL_SMTP_HOST=gmail.com
|
||||
EMAIL_SMTP_PORT=587
|
||||
EMAIL_LINK_VERIFICATION_PATH=/checkEmail/{optin}{code}
|
||||
EMAIL_LINK_SETPASSWORD_PATH=/reset-password/{optin}
|
||||
|
||||
@ -45,7 +45,7 @@ EMAIL_TEST_RECEIVER=stage1@gradido.net
|
||||
EMAIL_USERNAME=gradido_email
|
||||
EMAIL_SENDER=info@gradido.net
|
||||
EMAIL_PASSWORD=xxx
|
||||
EMAIL_SMTP_URL=gmail.com
|
||||
EMAIL_SMTP_HOST=gmail.com
|
||||
EMAIL_SMTP_PORT=587
|
||||
EMAIL_LINK_VERIFICATION_PATH=/checkEmail/{optin}{code}
|
||||
EMAIL_LINK_SETPASSWORD_PATH=/reset-password/{optin}
|
||||
|
||||
@ -49,7 +49,7 @@ EMAIL_TEST_RECEIVER=$EMAIL_TEST_RECEIVER
|
||||
EMAIL_USERNAME=$EMAIL_USERNAME
|
||||
EMAIL_SENDER=$EMAIL_SENDER
|
||||
EMAIL_PASSWORD=$EMAIL_PASSWORD
|
||||
EMAIL_SMTP_URL=$EMAIL_SMTP_URL
|
||||
EMAIL_SMTP_HOST=$EMAIL_SMTP_HOST
|
||||
EMAIL_SMTP_PORT=$EMAIL_SMTP_PORT
|
||||
EMAIL_LINK_VERIFICATION_PATH=$EMAIL_LINK_VERIFICATION_PATH
|
||||
EMAIL_LINK_SETPASSWORD_PATH=$EMAIL_LINK_SETPASSWORD_PATH
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
# Server
|
||||
JWT_EXPIRES_IN=2m
|
||||
|
||||
GDT_ACTIVE=false
|
||||
|
||||
# Email
|
||||
EMAIL=true
|
||||
EMAIL_TEST_MODUS=false
|
||||
|
||||
@ -33,12 +33,14 @@
|
||||
"email-templates": "^10.0.1",
|
||||
"express": "^4.17.1",
|
||||
"express-slow-down": "^2.0.1",
|
||||
"gradido-database": "file:../database",
|
||||
"gradido-config": "../config",
|
||||
"gradido-database": "../database",
|
||||
"graphql": "^15.5.1",
|
||||
"graphql-request": "5.0.0",
|
||||
"graphql-type-json": "0.3.2",
|
||||
"helmet": "^5.1.1",
|
||||
"i18n": "^0.15.1",
|
||||
"joi": "^17.13.3",
|
||||
"jose": "^4.14.4",
|
||||
"lodash.clonedeep": "^4.5.0",
|
||||
"log4js": "^6.4.6",
|
||||
@ -51,8 +53,8 @@
|
||||
"type-graphql": "^1.1.1",
|
||||
"typed-rest-client": "^1.8.11",
|
||||
"uuid": "^8.3.2",
|
||||
"xregexp": "^5.1.1",
|
||||
"workerpool": "^9.2.0"
|
||||
"workerpool": "^9.2.0",
|
||||
"xregexp": "^5.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint-community/eslint-plugin-eslint-comments": "^3.2.1",
|
||||
@ -61,6 +63,7 @@
|
||||
"@types/faker": "^5.5.9",
|
||||
"@types/i18n": "^0.13.4",
|
||||
"@types/jest": "^27.0.2",
|
||||
"@types/joi": "^17.2.3",
|
||||
"@types/lodash.clonedeep": "^4.5.6",
|
||||
"@types/node": "^16.10.3",
|
||||
"@types/nodemailer": "^6.4.4",
|
||||
|
||||
@ -1,8 +1,13 @@
|
||||
// ATTENTION: DO NOT PUT ANY SECRETS IN HERE (or the .env)
|
||||
/* eslint-disable n/no-process-env */
|
||||
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
import { latestDbVersion } from '@dbTools/config/detectLastDBVersion'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import dotenv from 'dotenv'
|
||||
import { validate } from 'gradido-config'
|
||||
|
||||
import { schema } from './schema'
|
||||
|
||||
dotenv.config()
|
||||
|
||||
@ -12,7 +17,8 @@ Decimal.set({
|
||||
})
|
||||
|
||||
const constants = {
|
||||
DB_VERSION: '0087-add_index_on_user_roles',
|
||||
// DB_VERSION: '0087-add_index_on_user_roles',
|
||||
DB_VERSION: latestDbVersion,
|
||||
DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0
|
||||
LOG4JS_CONFIG: 'log4js-config.json',
|
||||
}
|
||||
@ -22,6 +28,7 @@ const server = {
|
||||
JWT_SECRET: process.env.JWT_SECRET ?? 'secret123',
|
||||
JWT_EXPIRES_IN: process.env.JWT_EXPIRES_IN ?? '10m',
|
||||
GRAPHIQL: process.env.GRAPHIQL === 'true' || false,
|
||||
GDT_ACTIVE: process.env.GDT_ACTIVE === 'true' || false,
|
||||
GDT_API_URL: process.env.GDT_API_URL ?? 'https://gdt.gradido.net',
|
||||
PRODUCTION: process.env.NODE_ENV === 'production' || false,
|
||||
// default log level on production should be info
|
||||
@ -59,9 +66,9 @@ const dltConnector = {
|
||||
const community = {
|
||||
COMMUNITY_NAME: process.env.COMMUNITY_NAME ?? 'Gradido Entwicklung',
|
||||
COMMUNITY_URL,
|
||||
COMMUNITY_REDEEM_URL: COMMUNITY_URL + (process.env.COMMUNITY_REDEEM_PATH ?? '/redeem/{code}'),
|
||||
COMMUNITY_REDEEM_URL: COMMUNITY_URL + (process.env.COMMUNITY_REDEEM_PATH ?? '/redeem/'),
|
||||
COMMUNITY_REDEEM_CONTRIBUTION_URL:
|
||||
COMMUNITY_URL + (process.env.COMMUNITY_REDEEM_CONTRIBUTION_PATH ?? '/redeem/CL-{code}'),
|
||||
COMMUNITY_URL + (process.env.COMMUNITY_REDEEM_CONTRIBUTION_PATH ?? '/redeem/CL-'),
|
||||
COMMUNITY_DESCRIPTION:
|
||||
process.env.COMMUNITY_DESCRIPTION ?? 'Die lokale Entwicklungsumgebung von Gradido.',
|
||||
COMMUNITY_SUPPORT_MAIL: process.env.COMMUNITY_SUPPORT_MAIL ?? 'support@supportmail.com',
|
||||
@ -80,14 +87,14 @@ const email = {
|
||||
EMAIL_USERNAME: process.env.EMAIL_USERNAME ?? '',
|
||||
EMAIL_SENDER: process.env.EMAIL_SENDER ?? 'info@gradido.net',
|
||||
EMAIL_PASSWORD: process.env.EMAIL_PASSWORD ?? '',
|
||||
EMAIL_SMTP_URL: process.env.EMAIL_SMTP_URL ?? 'mailserver',
|
||||
EMAIL_SMTP_HOST: process.env.EMAIL_SMTP_HOST ?? 'mailserver',
|
||||
EMAIL_SMTP_PORT: Number(process.env.EMAIL_SMTP_PORT) || 1025,
|
||||
// eslint-disable-next-line no-unneeded-ternary
|
||||
EMAIL_TLS: process.env.EMAIL_TLS === 'false' ? false : true,
|
||||
EMAIL_LINK_VERIFICATION:
|
||||
COMMUNITY_URL + (process.env.EMAIL_LINK_VERIFICATION_PATH ?? '/checkEmail/{optin}{code}'),
|
||||
COMMUNITY_URL + (process.env.EMAIL_LINK_VERIFICATION_PATH ?? '/checkEmail/'),
|
||||
EMAIL_LINK_SETPASSWORD:
|
||||
COMMUNITY_URL + (process.env.EMAIL_LINK_SETPASSWORD_PATH ?? '/reset-password/{optin}'),
|
||||
COMMUNITY_URL + (process.env.EMAIL_LINK_SETPASSWORD_PATH ?? '/reset-password/'),
|
||||
EMAIL_LINK_FORGOTPASSWORD:
|
||||
COMMUNITY_URL + (process.env.EMAIL_LINK_FORGOTPASSWORD_PATH ?? '/forgot-password'),
|
||||
EMAIL_LINK_OVERVIEW: COMMUNITY_URL + (process.env.EMAIL_LINK_OVERVIEW_PATH ?? '/overview'),
|
||||
@ -154,3 +161,5 @@ export const CONFIG = {
|
||||
...gms,
|
||||
...humhub,
|
||||
}
|
||||
|
||||
validate(schema, CONFIG)
|
||||
|
||||
@ -1,30 +1,267 @@
|
||||
const commonSchema = require('../../../config/common.schema')
|
||||
const Joi = require('joi')
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
import {
|
||||
COMMUNITY_NAME,
|
||||
COMMUNITY_URL,
|
||||
COMMUNITY_DESCRIPTION,
|
||||
COMMUNITY_SUPPORT_MAIL,
|
||||
DB_HOST,
|
||||
DB_PASSWORD,
|
||||
DB_PORT,
|
||||
DB_USER,
|
||||
DB_VERSION,
|
||||
DB_DATABASE,
|
||||
DECAY_START_TIME,
|
||||
GDT_API_URL,
|
||||
GDT_ACTIVE,
|
||||
GRAPHIQL,
|
||||
LOG4JS_CONFIG,
|
||||
LOG_LEVEL,
|
||||
NODE_ENV,
|
||||
PRODUCTION,
|
||||
TYPEORM_LOGGING_RELATIVE_PATH,
|
||||
} from 'gradido-config'
|
||||
import Joi from 'joi'
|
||||
|
||||
export const schema = Joi.object({
|
||||
COMMUNITY_NAME,
|
||||
COMMUNITY_URL,
|
||||
COMMUNITY_DESCRIPTION,
|
||||
COMMUNITY_SUPPORT_MAIL,
|
||||
DB_HOST,
|
||||
DB_PASSWORD,
|
||||
DB_PORT,
|
||||
DB_USER,
|
||||
DB_VERSION,
|
||||
DB_DATABASE,
|
||||
DECAY_START_TIME,
|
||||
GDT_API_URL,
|
||||
GDT_ACTIVE,
|
||||
GRAPHIQL,
|
||||
LOG4JS_CONFIG,
|
||||
LOG_LEVEL,
|
||||
NODE_ENV,
|
||||
PRODUCTION,
|
||||
TYPEORM_LOGGING_RELATIVE_PATH,
|
||||
|
||||
COMMUNITY_REDEEM_URL: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.description('The url for redeeming link transactions, must start with frontend base url')
|
||||
.default('http://0.0.0.0/redeem/')
|
||||
.custom((value: string, helpers: Joi.CustomHelpers<string>): string | Joi.ErrorReport => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
||||
if (!value.startsWith(helpers.state.ancestors[0].COMMUNITY_URL)) {
|
||||
return helpers.error('string.pattern.base', { value, communityUrl: COMMUNITY_URL })
|
||||
}
|
||||
return value
|
||||
})
|
||||
.required(),
|
||||
|
||||
COMMUNITY_REDEEM_CONTRIBUTION_URL: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.custom((value: string, helpers: Joi.CustomHelpers<string>): string | Joi.ErrorReport => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
||||
if (!value.startsWith(helpers.state.ancestors[0].COMMUNITY_URL)) {
|
||||
return helpers.error('string.pattern.base', { value, communityUrl: COMMUNITY_URL })
|
||||
}
|
||||
return value
|
||||
})
|
||||
.description(
|
||||
'The url for redeeming contribution link transactions, must start with frontend base url.',
|
||||
)
|
||||
.default('http://0.0.0.0/redeem/CL-')
|
||||
.required(),
|
||||
|
||||
DLT_CONNECTOR: Joi.boolean()
|
||||
.description('Flag to indicate if DLT-Connector is used. (Still in development)')
|
||||
.default(false)
|
||||
.required(),
|
||||
|
||||
DLT_CONNECTOR_URL: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.default('http://localhost:6010')
|
||||
.when('DLT_CONNECTOR', { is: true, then: Joi.required() })
|
||||
.description('The URL for GDT API endpoint'),
|
||||
|
||||
EMAIL: Joi.boolean()
|
||||
.default(false)
|
||||
.description('Enable or disable email functionality')
|
||||
.required(),
|
||||
|
||||
EMAIL_TEST_MODUS: Joi.boolean()
|
||||
.default(false)
|
||||
.description('When enabled, all emails are sended to EMAIL_TEST_RECEIVER')
|
||||
.optional(),
|
||||
|
||||
EMAIL_TEST_RECEIVER: Joi.string()
|
||||
.email()
|
||||
.default('stage1@gradido.net')
|
||||
.when('EMAIL_TEST_MODUS', { is: true, then: Joi.required() })
|
||||
.description('Email address used in test mode'),
|
||||
|
||||
EMAIL_USERNAME: Joi.alternatives().conditional(Joi.ref('EMAIL'), {
|
||||
is: true,
|
||||
then: Joi.alternatives().conditional(Joi.ref('NODE_ENV'), {
|
||||
is: 'development',
|
||||
then: Joi.string()
|
||||
.allow('')
|
||||
.description('Username for SMTP authentication (optional in development)'),
|
||||
otherwise: Joi.string()
|
||||
.pattern(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/)
|
||||
.description('Valid SMTP username required in production')
|
||||
.required(),
|
||||
}),
|
||||
otherwise: Joi.string().allow('').optional(),
|
||||
}),
|
||||
|
||||
EMAIL_SENDER: Joi.string()
|
||||
.email()
|
||||
.when('EMAIL', { is: true, then: Joi.required() })
|
||||
.default('info@gradido.net')
|
||||
.description('Email address used as sender'),
|
||||
|
||||
EMAIL_PASSWORD: Joi.alternatives().conditional(Joi.ref('EMAIL'), {
|
||||
is: true,
|
||||
then: Joi.alternatives().conditional(Joi.ref('NODE_ENV'), {
|
||||
is: 'development',
|
||||
then: Joi.string()
|
||||
.allow('')
|
||||
.description('Password for SMTP authentication (optional in development)'),
|
||||
otherwise: Joi.string()
|
||||
.min(8)
|
||||
.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&#]).{8,}$/)
|
||||
.description(
|
||||
'Password must be at least 8 characters long, include uppercase and lowercase letters, a number, and a special character',
|
||||
)
|
||||
.required(),
|
||||
}),
|
||||
otherwise: Joi.string().allow('').optional(),
|
||||
}),
|
||||
|
||||
EMAIL_SMTP_HOST: Joi.string()
|
||||
.hostname()
|
||||
.when('EMAIL', { is: true, then: Joi.required() })
|
||||
.default('mailserver')
|
||||
.description('SMTP server hostname'),
|
||||
|
||||
EMAIL_SMTP_PORT: Joi.number()
|
||||
.integer()
|
||||
.positive()
|
||||
.when('EMAIL', { is: true, then: Joi.required() })
|
||||
.default(1025)
|
||||
.description('SMTP server port'),
|
||||
|
||||
EMAIL_TLS: Joi.boolean().default(true).description('Enable or disable TLS for SMTP').optional(),
|
||||
|
||||
EMAIL_LINK_VERIFICATION: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.custom((value: string, helpers: Joi.CustomHelpers<string>): string | Joi.ErrorReport => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
||||
if (!value.startsWith(helpers.state.ancestors[0].COMMUNITY_URL)) {
|
||||
return helpers.error('string.pattern.base', { value, communityUrl: COMMUNITY_URL })
|
||||
}
|
||||
return value
|
||||
})
|
||||
.description('Email Verification link for activate Email.')
|
||||
.required(),
|
||||
|
||||
EMAIL_LINK_SETPASSWORD: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.custom((value: string, helpers: Joi.CustomHelpers<string>): string | Joi.ErrorReport => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
||||
if (!value.startsWith(helpers.state.ancestors[0].COMMUNITY_URL)) {
|
||||
return helpers.error('string.pattern.base', { value, communityUrl: COMMUNITY_URL })
|
||||
}
|
||||
return value
|
||||
})
|
||||
.description('Email Verification link for set initial Password.')
|
||||
.required(),
|
||||
|
||||
EMAIL_LINK_FORGOTPASSWORD: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.custom((value: string, helpers: Joi.CustomHelpers<string>): string | Joi.ErrorReport => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
||||
if (!value.startsWith(helpers.state.ancestors[0].COMMUNITY_URL)) {
|
||||
return helpers.error('string.pattern.base', { value, communityUrl: COMMUNITY_URL })
|
||||
}
|
||||
return value
|
||||
})
|
||||
.description('Email Verification link for set new Password, when old Password was forgotten.')
|
||||
.required(),
|
||||
|
||||
EMAIL_LINK_OVERVIEW: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.custom((value: string, helpers: Joi.CustomHelpers<string>): string | Joi.ErrorReport => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
||||
if (!value.startsWith(helpers.state.ancestors[0].COMMUNITY_URL)) {
|
||||
return helpers.error('string.pattern.base', { value, communityUrl: COMMUNITY_URL })
|
||||
}
|
||||
return value
|
||||
})
|
||||
.description('Link to Wallet Overview')
|
||||
.required(),
|
||||
|
||||
EMAIL_CODE_VALID_TIME: Joi.number()
|
||||
.integer()
|
||||
.positive()
|
||||
.max(43200) // max at 30 days
|
||||
.default(1440)
|
||||
.description('Time in minutes a code is valid'),
|
||||
|
||||
EMAIL_CODE_REQUEST_TIME: Joi.number()
|
||||
.integer()
|
||||
.positive()
|
||||
.max(43200) // max at 30 days
|
||||
.default(10)
|
||||
.description('Time in minutes before a new code can be requested'),
|
||||
|
||||
module.exports = commonSchema.keys({
|
||||
PORT: Joi.number()
|
||||
.integer()
|
||||
.min(1024)
|
||||
.max(49151)
|
||||
.description('Port for hosting backend, default: 4000')
|
||||
.default(4000)
|
||||
.required(),
|
||||
.required(),
|
||||
|
||||
// TODO: check format
|
||||
KLICKTIPP: Joi.boolean()
|
||||
.default(false)
|
||||
.description("Indicates whether Klicktipp integration is enabled, 'true' or 'false'"),
|
||||
|
||||
KLICKTTIPP_API_URL: Joi.string()
|
||||
.uri({ scheme: ['https'] }) // Sicherstellen, dass es eine gültige HTTPS-URL ist
|
||||
.default('https://api.klicktipp.com')
|
||||
.description("The API URL for Klicktipp, must be a valid URL starting with 'https'"),
|
||||
|
||||
KLICKTIPP_USER: Joi.string().default('gradido_test').description('The username for Klicktipp'),
|
||||
|
||||
KLICKTIPP_PASSWORD: Joi.string()
|
||||
.min(6)
|
||||
.default('secret321')
|
||||
.description('The password for Klicktipp, should be at least 6 characters'),
|
||||
|
||||
KLICKTIPP_APIKEY_DE: Joi.string()
|
||||
.default('SomeFakeKeyDE')
|
||||
.description('The API key for Klicktipp (German version)'),
|
||||
|
||||
KLICKTIPP_APIKEY_EN: Joi.string()
|
||||
.default('SomeFakeKeyEN')
|
||||
.description('The API key for Klicktipp (English version)'),
|
||||
|
||||
// TODO: check format
|
||||
JWT_SECRET: Joi.string()
|
||||
.default('secret123')
|
||||
.description('jwt secret for jwt tokens used for login')
|
||||
.required(),
|
||||
|
||||
// TODO: check format
|
||||
JWT_EXPIRES_IN: Joi.string()
|
||||
.default('10m')
|
||||
.description('time for jwt token expire, auto logout')
|
||||
.required(),
|
||||
|
||||
GDT_API_URL: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.default('https://gdt.gradido.net')
|
||||
.required(), // TODO: only required if gdt is active
|
||||
|
||||
})
|
||||
JWT_EXPIRES_IN: Joi.alternatives()
|
||||
.try(
|
||||
Joi.string()
|
||||
.pattern(/^\d+[smhdw]$/) // Time specification such as “10m”, “1h”, “2d”, etc.
|
||||
.description('Expiration time for JWT login token, in format like "10m", "1h", "1d"')
|
||||
.default('10m'),
|
||||
Joi.number()
|
||||
.positive() // positive number to accept seconds
|
||||
.description('Expiration time for JWT login token in seconds'),
|
||||
)
|
||||
.required()
|
||||
.description('Time for JWT token to expire, auto logout'),
|
||||
})
|
||||
|
||||
@ -8,7 +8,7 @@ import { CONFIG } from '@/config'
|
||||
import { sendEmailTranslated } from './sendEmailTranslated'
|
||||
|
||||
CONFIG.EMAIL = false
|
||||
CONFIG.EMAIL_SMTP_URL = 'EMAIL_SMTP_URL'
|
||||
CONFIG.EMAIL_SMTP_HOST = 'EMAIL_SMTP_HOST'
|
||||
CONFIG.EMAIL_SMTP_PORT = 1234
|
||||
CONFIG.EMAIL_SENDER = 'info@gradido.net'
|
||||
CONFIG.EMAIL_USERNAME = 'user'
|
||||
@ -73,7 +73,7 @@ describe('sendEmailTranslated', () => {
|
||||
|
||||
it('calls the transporter', () => {
|
||||
expect(createTransport).toBeCalledWith({
|
||||
host: 'EMAIL_SMTP_URL',
|
||||
host: 'EMAIL_SMTP_HOST',
|
||||
port: 1234,
|
||||
secure: false,
|
||||
requireTLS: true,
|
||||
|
||||
@ -45,7 +45,7 @@ export const sendEmailTranslated = async ({
|
||||
receiver.to = CONFIG.EMAIL_TEST_RECEIVER
|
||||
}
|
||||
const transport = createTransport({
|
||||
host: CONFIG.EMAIL_SMTP_URL,
|
||||
host: CONFIG.EMAIL_SMTP_HOST,
|
||||
port: CONFIG.EMAIL_SMTP_PORT,
|
||||
secure: false, // true for 465, false for other ports
|
||||
requireTLS: CONFIG.EMAIL_TLS,
|
||||
|
||||
@ -20,7 +20,7 @@ export class TransactionLink {
|
||||
this.deletedAt = transactionLink.deletedAt
|
||||
this.redeemedAt = transactionLink.redeemedAt
|
||||
this.redeemedBy = redeemedBy
|
||||
this.link = CONFIG.COMMUNITY_REDEEM_URL.replace(/{code}/g, this.code)
|
||||
this.link = CONFIG.COMMUNITY_REDEEM_URL + this.code
|
||||
}
|
||||
|
||||
@Field(() => Int)
|
||||
|
||||
@ -24,6 +24,16 @@ export class GdtResolver {
|
||||
{ currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated,
|
||||
@Ctx() context: Context,
|
||||
): Promise<GdtEntryList> {
|
||||
if (!CONFIG.GDT_ACTIVE) {
|
||||
return new GdtEntryList(
|
||||
'disabled',
|
||||
0,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-explicit-any
|
||||
[],
|
||||
0,
|
||||
0,
|
||||
)
|
||||
}
|
||||
const userEntity = getUser(context)
|
||||
|
||||
try {
|
||||
@ -51,6 +61,9 @@ export class GdtResolver {
|
||||
@Authorized([RIGHTS.GDT_BALANCE])
|
||||
@Query(() => Float, { nullable: true })
|
||||
async gdtBalance(@Ctx() context: Context): Promise<number | null> {
|
||||
if (!CONFIG.GDT_ACTIVE) {
|
||||
return null
|
||||
}
|
||||
const user = getUser(context)
|
||||
try {
|
||||
const resultGDTSum = await apiPost(`${CONFIG.GDT_API_URL}/GdtEntries/sumPerEmailApi`, {
|
||||
@ -71,6 +84,9 @@ export class GdtResolver {
|
||||
@Query(() => Int)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async existPid(@Arg('pid', () => Int) pid: number): Promise<number> {
|
||||
if (!CONFIG.GDT_ACTIVE) {
|
||||
return 0
|
||||
}
|
||||
// load user
|
||||
const resultPID = await apiGet(`${CONFIG.GDT_API_URL}/publishers/checkPidApi/${pid}`)
|
||||
if (!resultPID.success) {
|
||||
|
||||
@ -230,8 +230,11 @@ export class TransactionResolver {
|
||||
logger.addContext('user', user.id)
|
||||
logger.info(`transactionList(user=${user.firstName}.${user.lastName}, ${user.emailId})`)
|
||||
|
||||
const gdtResolver = new GdtResolver()
|
||||
const balanceGDTPromise = gdtResolver.gdtBalance(context)
|
||||
let balanceGDTPromise: Promise<number | null> = Promise.resolve(null)
|
||||
if (CONFIG.GDT_ACTIVE) {
|
||||
const gdtResolver = new GdtResolver()
|
||||
balanceGDTPromise = gdtResolver.gdtBalance(context)
|
||||
}
|
||||
|
||||
// find current balance
|
||||
const lastTransaction = await getLastTransaction(user.id)
|
||||
@ -418,8 +421,10 @@ export class TransactionResolver {
|
||||
).toDecimalPlaces(2, Decimal.ROUND_HALF_UP)
|
||||
}
|
||||
})
|
||||
const balanceGDT = await balanceGDTPromise
|
||||
context.balanceGDT = balanceGDT
|
||||
if (CONFIG.GDT_ACTIVE) {
|
||||
const balanceGDT = await balanceGDTPromise
|
||||
context.balanceGDT = balanceGDT
|
||||
}
|
||||
|
||||
// Construct Result
|
||||
return new TransactionList(await balanceResolver.balance(context), transactions)
|
||||
|
||||
@ -244,10 +244,10 @@ describe('UserResolver', () => {
|
||||
|
||||
describe('account activation email', () => {
|
||||
it('sends an account activation email', () => {
|
||||
const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace(
|
||||
/{optin}/g,
|
||||
emailVerificationCode,
|
||||
).replace(/{code}/g, '')
|
||||
const activationLink = `${
|
||||
CONFIG.EMAIL_LINK_VERIFICATION
|
||||
}${emailVerificationCode.toString()}`
|
||||
|
||||
expect(sendAccountActivationEmail).toBeCalledWith({
|
||||
firstName: 'Peter',
|
||||
lastName: 'Lustig',
|
||||
@ -2230,14 +2230,13 @@ describe('UserResolver', () => {
|
||||
})
|
||||
|
||||
it('sends an account activation email', async () => {
|
||||
const userConatct = await UserContact.findOneOrFail({
|
||||
const userContact = await UserContact.findOneOrFail({
|
||||
where: { email: 'bibi@bloxberg.de' },
|
||||
relations: ['user'],
|
||||
})
|
||||
const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace(
|
||||
/{optin}/g,
|
||||
userConatct.emailVerificationCode.toString(),
|
||||
).replace(/{code}/g, '')
|
||||
const activationLink = `${
|
||||
CONFIG.EMAIL_LINK_VERIFICATION
|
||||
}${userContact.emailVerificationCode.toString()}`
|
||||
expect(sendAccountActivationEmail).toBeCalledWith({
|
||||
firstName: 'Bibi',
|
||||
lastName: 'Bloxberg',
|
||||
@ -2252,14 +2251,14 @@ describe('UserResolver', () => {
|
||||
})
|
||||
|
||||
it('stores the EMAIL_ADMIN_CONFIRMATION event in the database', async () => {
|
||||
const userConatct = await UserContact.findOneOrFail({
|
||||
const userContact = await UserContact.findOneOrFail({
|
||||
where: { email: 'bibi@bloxberg.de' },
|
||||
relations: ['user'],
|
||||
})
|
||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||
expect.objectContaining({
|
||||
type: EventType.EMAIL_ADMIN_CONFIRMATION,
|
||||
affectedUserId: userConatct.user.id,
|
||||
affectedUserId: userContact.user.id,
|
||||
actingUserId: admin.id,
|
||||
}),
|
||||
)
|
||||
|
||||
@ -109,7 +109,7 @@ const newEmailContact = (email: string, userId: number): DbUserContact => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export const activationLink = (verificationCode: string): string => {
|
||||
logger.debug(`activationLink(${verificationCode})...`)
|
||||
return CONFIG.EMAIL_LINK_SETPASSWORD.replace(/{optin}/g, verificationCode.toString())
|
||||
return CONFIG.EMAIL_LINK_SETPASSWORD + verificationCode.toString()
|
||||
}
|
||||
|
||||
const newGradidoID = async (): Promise<string> => {
|
||||
@ -371,10 +371,9 @@ export class UserResolver {
|
||||
throw new LogError('Error while updating dbUser', error)
|
||||
})
|
||||
|
||||
const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace(
|
||||
/{optin}/g,
|
||||
emailContact.emailVerificationCode.toString(),
|
||||
).replace(/{code}/g, redeemCode ? '/' + redeemCode : '')
|
||||
const activationLink = `${
|
||||
CONFIG.EMAIL_LINK_VERIFICATION
|
||||
}${emailContact.emailVerificationCode.toString()}${redeemCode ? `/${redeemCode}` : ''}`
|
||||
|
||||
void sendAccountActivationEmail({
|
||||
firstName,
|
||||
|
||||
@ -332,13 +332,6 @@
|
||||
core-js-pure "^3.30.2"
|
||||
regenerator-runtime "^0.14.0"
|
||||
|
||||
"@babel/runtime@^7.21.0":
|
||||
version "7.22.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.5.tgz#8564dd588182ce0047d55d7a75e93921107b57ec"
|
||||
integrity sha512-ecjvYlnAaZ/KVneE/OdKYBYfgXV3Ptu6zQWmgEF7vwKhQnvVS6bjMD2XYgj+SNvQ1GfK/pjgokfPkC/2CO8CuA==
|
||||
dependencies:
|
||||
regenerator-runtime "^0.13.11"
|
||||
|
||||
"@babel/template@^7.15.4", "@babel/template@^7.3.3":
|
||||
version "7.15.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.15.4.tgz#51898d35dcf3faa670c4ee6afcfd517ee139f194"
|
||||
@ -454,6 +447,18 @@
|
||||
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-10.0.1.tgz#ee9da297fabc557e1c040a0f44ee89c266ccc306"
|
||||
integrity sha512-CvlW7jmOhWzuqOqiJQ3rQVLMcREh0eel4IBnxDx2FAcK8g7qoJRQK4L1CPBASoCY6y8e6zuCy3f2g+HWdkzcMw==
|
||||
|
||||
"@hapi/hoek@^9.0.0", "@hapi/hoek@^9.3.0":
|
||||
version "9.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb"
|
||||
integrity sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==
|
||||
|
||||
"@hapi/topo@^5.1.0":
|
||||
version "5.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012"
|
||||
integrity sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==
|
||||
dependencies:
|
||||
"@hapi/hoek" "^9.0.0"
|
||||
|
||||
"@humanwhocodes/config-array@^0.11.8":
|
||||
version "0.11.8"
|
||||
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.8.tgz#03595ac2075a4dc0f191cc2131de14fbd7d410b9"
|
||||
@ -473,6 +478,18 @@
|
||||
resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45"
|
||||
integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==
|
||||
|
||||
"@isaacs/cliui@^8.0.2":
|
||||
version "8.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550"
|
||||
integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==
|
||||
dependencies:
|
||||
string-width "^5.1.2"
|
||||
string-width-cjs "npm:string-width@^4.2.0"
|
||||
strip-ansi "^7.0.1"
|
||||
strip-ansi-cjs "npm:strip-ansi@^6.0.1"
|
||||
wrap-ansi "^8.1.0"
|
||||
wrap-ansi-cjs "npm:wrap-ansi@^7.0.0"
|
||||
|
||||
"@istanbuljs/load-nyc-config@^1.0.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced"
|
||||
@ -750,6 +767,11 @@
|
||||
"@nodelib/fs.scandir" "2.1.5"
|
||||
fastq "^1.6.0"
|
||||
|
||||
"@pkgjs/parseargs@^0.11.0":
|
||||
version "0.11.0"
|
||||
resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
|
||||
integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==
|
||||
|
||||
"@pkgr/utils@^2.3.1":
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/@pkgr/utils/-/utils-2.3.1.tgz#0a9b06ffddee364d6642b3cd562ca76f55b34a03"
|
||||
@ -823,6 +845,23 @@
|
||||
domhandler "^4.2.0"
|
||||
selderee "^0.6.0"
|
||||
|
||||
"@sideway/address@^4.1.5":
|
||||
version "4.1.5"
|
||||
resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.5.tgz#4bc149a0076623ced99ca8208ba780d65a99b9d5"
|
||||
integrity sha512-IqO/DUQHUkPeixNQ8n0JA6102hT9CmaljNTPmQ1u8MEhBo/R4Q8eKLN/vGZxuebwOroDB4cbpjheD4+/sKFK4Q==
|
||||
dependencies:
|
||||
"@hapi/hoek" "^9.0.0"
|
||||
|
||||
"@sideway/formula@^3.0.1":
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.1.tgz#80fcbcbaf7ce031e0ef2dd29b1bfc7c3f583611f"
|
||||
integrity sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==
|
||||
|
||||
"@sideway/pinpoint@^2.0.0":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df"
|
||||
integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==
|
||||
|
||||
"@sindresorhus/is@^0.14.0":
|
||||
version "0.14.0"
|
||||
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea"
|
||||
@ -1064,6 +1103,13 @@
|
||||
jest-diff "^27.0.0"
|
||||
pretty-format "^27.0.0"
|
||||
|
||||
"@types/joi@^17.2.3":
|
||||
version "17.2.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/joi/-/joi-17.2.3.tgz#b7768ed9d84f1ebd393328b9f97c1cf3d2b94798"
|
||||
integrity sha512-dGjs/lhrWOa+eO0HwgxCSnDm5eMGCsXuvLglMghJq32F6q5LyyNuXb41DHzrg501CKNOSSAHmfB7FDGeUnDmzw==
|
||||
dependencies:
|
||||
joi "*"
|
||||
|
||||
"@types/json-schema@^7.0.9":
|
||||
version "7.0.11"
|
||||
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3"
|
||||
@ -1128,9 +1174,9 @@
|
||||
integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==
|
||||
|
||||
"@types/mysql@^2.15.8":
|
||||
version "2.15.21"
|
||||
resolved "https://registry.yarnpkg.com/@types/mysql/-/mysql-2.15.21.tgz#7516cba7f9d077f980100c85fd500c8210bd5e45"
|
||||
integrity sha512-NPotx5CVful7yB+qZbWtXL2fA4e7aEHkihHLjklc6ID8aq7bhguHgeIoC1EmSNTAuCgI6ZXrjt2ZSaXnYX0EUg==
|
||||
version "2.15.26"
|
||||
resolved "https://registry.yarnpkg.com/@types/mysql/-/mysql-2.15.26.tgz#f0de1484b9e2354d587e7d2bd17a873cc8300836"
|
||||
integrity sha512-DSLCOXhkvfS5WNNPbfn2KdICAmk8lLc+/PNvnPnF7gOdMZCxopXduqv0OQ13y/yA/zXTSikZZqVgybUxOEg6YQ==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
@ -1528,6 +1574,11 @@ ansi-regex@^5.0.1:
|
||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
|
||||
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
|
||||
|
||||
ansi-regex@^6.0.1:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.1.0.tgz#95ec409c69619d6cb1b8b34f14b660ef28ebd654"
|
||||
integrity sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==
|
||||
|
||||
ansi-styles@^3.2.1:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
|
||||
@ -1547,6 +1598,11 @@ ansi-styles@^5.0.0:
|
||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b"
|
||||
integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==
|
||||
|
||||
ansi-styles@^6.1.0:
|
||||
version "6.2.1"
|
||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5"
|
||||
integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==
|
||||
|
||||
any-promise@^1.0.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f"
|
||||
@ -2396,6 +2452,15 @@ cross-spawn@^6.0.0:
|
||||
shebang-command "^1.2.0"
|
||||
which "^1.2.9"
|
||||
|
||||
cross-spawn@^7.0.0:
|
||||
version "7.0.6"
|
||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f"
|
||||
integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==
|
||||
dependencies:
|
||||
path-key "^3.1.0"
|
||||
shebang-command "^2.0.0"
|
||||
which "^2.0.1"
|
||||
|
||||
cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
|
||||
version "7.0.3"
|
||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
|
||||
@ -2469,18 +2534,16 @@ data-urls@^2.0.0:
|
||||
whatwg-mimetype "^2.3.0"
|
||||
whatwg-url "^8.0.0"
|
||||
|
||||
date-fns@^2.29.3:
|
||||
version "2.30.0"
|
||||
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.30.0.tgz#f367e644839ff57894ec6ac480de40cae4b0f4d0"
|
||||
integrity sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.21.0"
|
||||
|
||||
date-format@^4.0.9:
|
||||
version "4.0.9"
|
||||
resolved "https://registry.yarnpkg.com/date-format/-/date-format-4.0.9.tgz#4788015ac56dedebe83b03bc361f00c1ddcf1923"
|
||||
integrity sha512-+8J+BOUpSrlKLQLeF8xJJVTxS8QfRSuJgwxSVvslzgO3E6khbI0F5mMEPf5mTYhCCm4h99knYP6H3W9n3BQFrg==
|
||||
|
||||
dayjs@^1.11.9:
|
||||
version "1.11.13"
|
||||
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.13.tgz#92430b0139055c3ebb60150aa13e860a4b5a366c"
|
||||
integrity sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==
|
||||
|
||||
debug@2.6.9, debug@^2.2.0:
|
||||
version "2.6.9"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||
@ -2714,15 +2777,20 @@ dotenv@^10.0.0:
|
||||
integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==
|
||||
|
||||
dotenv@^16.0.3:
|
||||
version "16.3.1"
|
||||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e"
|
||||
integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==
|
||||
version "16.4.7"
|
||||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.7.tgz#0e20c5b82950140aa99be360a8a5f52335f53c26"
|
||||
integrity sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==
|
||||
|
||||
duplexer3@^0.1.4:
|
||||
version "0.1.4"
|
||||
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
|
||||
integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=
|
||||
|
||||
eastasianwidth@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb"
|
||||
integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==
|
||||
|
||||
ee-first@1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
|
||||
@ -2757,6 +2825,11 @@ emoji-regex@^8.0.0:
|
||||
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
|
||||
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
|
||||
|
||||
emoji-regex@^9.2.2:
|
||||
version "9.2.2"
|
||||
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72"
|
||||
integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==
|
||||
|
||||
encodeurl@~1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
|
||||
@ -3421,6 +3494,14 @@ for-each@^0.3.3:
|
||||
dependencies:
|
||||
is-callable "^1.1.3"
|
||||
|
||||
foreground-child@^3.1.0:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.0.tgz#0ac8644c06e431439f8561db8ecf29a7b5519c77"
|
||||
integrity sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==
|
||||
dependencies:
|
||||
cross-spawn "^7.0.0"
|
||||
signal-exit "^4.0.1"
|
||||
|
||||
form-data@^3.0.0:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f"
|
||||
@ -3592,6 +3673,18 @@ glob-parent@^6.0.2:
|
||||
dependencies:
|
||||
is-glob "^4.0.3"
|
||||
|
||||
glob@^10.3.10:
|
||||
version "10.4.5"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-10.4.5.tgz#f4d9f0b90ffdbab09c9d77f5f29b4262517b0956"
|
||||
integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==
|
||||
dependencies:
|
||||
foreground-child "^3.1.0"
|
||||
jackspeak "^3.1.2"
|
||||
minimatch "^9.0.4"
|
||||
minipass "^7.1.2"
|
||||
package-json-from-dist "^1.0.0"
|
||||
path-scurry "^1.11.1"
|
||||
|
||||
glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6:
|
||||
version "7.2.0"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023"
|
||||
@ -3604,17 +3697,6 @@ glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6:
|
||||
once "^1.3.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
|
||||
glob@^8.1.0:
|
||||
version "8.1.0"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e"
|
||||
integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==
|
||||
dependencies:
|
||||
fs.realpath "^1.0.0"
|
||||
inflight "^1.0.4"
|
||||
inherits "2"
|
||||
minimatch "^5.0.1"
|
||||
once "^1.3.0"
|
||||
|
||||
global-dirs@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-3.0.0.tgz#70a76fe84ea315ab37b1f5576cbde7d48ef72686"
|
||||
@ -3708,7 +3790,12 @@ graceful-fs@^4.1.6, graceful-fs@^4.2.0:
|
||||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c"
|
||||
integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==
|
||||
|
||||
"gradido-database@file:../database":
|
||||
gradido-config@../config:
|
||||
version "1.0.0"
|
||||
dependencies:
|
||||
joi "^17.13.3"
|
||||
|
||||
gradido-database@../database:
|
||||
version "2.4.1"
|
||||
dependencies:
|
||||
"@types/uuid" "^8.3.4"
|
||||
@ -4451,6 +4538,15 @@ iterall@^1.1.3, iterall@^1.2.1, iterall@^1.3.0:
|
||||
resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.3.0.tgz#afcb08492e2915cbd8a0884eb93a8c94d0d72fea"
|
||||
integrity sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg==
|
||||
|
||||
jackspeak@^3.1.2:
|
||||
version "3.4.3"
|
||||
resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a"
|
||||
integrity sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==
|
||||
dependencies:
|
||||
"@isaacs/cliui" "^8.0.2"
|
||||
optionalDependencies:
|
||||
"@pkgjs/parseargs" "^0.11.0"
|
||||
|
||||
jest-changed-files@^27.2.5:
|
||||
version "27.2.5"
|
||||
resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-27.2.5.tgz#9dfd550d158260bcb6fa80aff491f5647f7daeca"
|
||||
@ -4862,6 +4958,17 @@ jest@^27.2.4:
|
||||
import-local "^3.0.2"
|
||||
jest-cli "^27.2.5"
|
||||
|
||||
joi@*, joi@^17.13.3:
|
||||
version "17.13.3"
|
||||
resolved "https://registry.yarnpkg.com/joi/-/joi-17.13.3.tgz#0f5cc1169c999b30d344366d384b12d92558bcec"
|
||||
integrity sha512-otDA4ldcIx+ZXsKHWmp0YizCweVRZG96J10b0FevjfuncLO1oX59THoAmHkNubYJ+9gWsYsp5k8v4ib6oDv1fA==
|
||||
dependencies:
|
||||
"@hapi/hoek" "^9.3.0"
|
||||
"@hapi/topo" "^5.1.0"
|
||||
"@sideway/address" "^4.1.5"
|
||||
"@sideway/formula" "^3.0.1"
|
||||
"@sideway/pinpoint" "^2.0.0"
|
||||
|
||||
jose@^4.14.4:
|
||||
version "4.14.4"
|
||||
resolved "https://registry.yarnpkg.com/jose/-/jose-4.14.4.tgz#59e09204e2670c3164ee24cbfe7115c6f8bff9ca"
|
||||
@ -5148,6 +5255,11 @@ lowercase-keys@^2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479"
|
||||
integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==
|
||||
|
||||
lru-cache@^10.2.0:
|
||||
version "10.4.3"
|
||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119"
|
||||
integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==
|
||||
|
||||
lru-cache@^4.1.3:
|
||||
version "4.1.5"
|
||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd"
|
||||
@ -5300,10 +5412,10 @@ minimatch@^3.0.5, minimatch@^3.1.2:
|
||||
dependencies:
|
||||
brace-expansion "^1.1.7"
|
||||
|
||||
minimatch@^5.0.1:
|
||||
version "5.1.6"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96"
|
||||
integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==
|
||||
minimatch@^9.0.4:
|
||||
version "9.0.5"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5"
|
||||
integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==
|
||||
dependencies:
|
||||
brace-expansion "^2.0.1"
|
||||
|
||||
@ -5317,6 +5429,11 @@ minimist@^1.2.6:
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
|
||||
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
|
||||
|
||||
"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2:
|
||||
version "7.1.2"
|
||||
resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707"
|
||||
integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==
|
||||
|
||||
mkdirp@^2.1.3:
|
||||
version "2.1.6"
|
||||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-2.1.6.tgz#964fbcb12b2d8c5d6fbc62a963ac95a273e2cc19"
|
||||
@ -5740,6 +5857,11 @@ p-wait-for@3.2.0:
|
||||
dependencies:
|
||||
p-timeout "^3.0.0"
|
||||
|
||||
package-json-from-dist@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505"
|
||||
integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==
|
||||
|
||||
package-json@^6.3.0:
|
||||
version "6.5.0"
|
||||
resolved "https://registry.yarnpkg.com/package-json/-/package-json-6.5.0.tgz#6feedaca35e75725876d0b0e64974697fed145b0"
|
||||
@ -5812,6 +5934,14 @@ path-parse@^1.0.6, path-parse@^1.0.7:
|
||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
|
||||
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
|
||||
|
||||
path-scurry@^1.11.1:
|
||||
version "1.11.1"
|
||||
resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.1.tgz#7960a668888594a0720b12a911d1a742ab9f11d2"
|
||||
integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==
|
||||
dependencies:
|
||||
lru-cache "^10.2.0"
|
||||
minipass "^5.0.0 || ^6.0.2 || ^7.0.0"
|
||||
|
||||
path-to-regexp@0.1.7:
|
||||
version "0.1.7"
|
||||
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"
|
||||
@ -6173,10 +6303,10 @@ reflect-metadata@^0.1.13:
|
||||
resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08"
|
||||
integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==
|
||||
|
||||
regenerator-runtime@^0.13.11:
|
||||
version "0.13.11"
|
||||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9"
|
||||
integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==
|
||||
reflect-metadata@^0.2.1:
|
||||
version "0.2.2"
|
||||
resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.2.2.tgz#400c845b6cba87a21f2c65c4aeb158f4fa4d9c5b"
|
||||
integrity sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==
|
||||
|
||||
regenerator-runtime@^0.14.0:
|
||||
version "0.14.1"
|
||||
@ -6479,6 +6609,11 @@ signal-exit@^3.0.2, signal-exit@^3.0.3:
|
||||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.5.tgz#9e3e8cc0c75a99472b44321033a7702e7738252f"
|
||||
integrity sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==
|
||||
|
||||
signal-exit@^4.0.1:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04"
|
||||
integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==
|
||||
|
||||
sisteransi@^1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"
|
||||
@ -6578,6 +6713,15 @@ string-length@^4.0.1:
|
||||
char-regex "^1.0.2"
|
||||
strip-ansi "^6.0.0"
|
||||
|
||||
"string-width-cjs@npm:string-width@^4.2.0":
|
||||
version "4.2.3"
|
||||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
||||
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
||||
dependencies:
|
||||
emoji-regex "^8.0.0"
|
||||
is-fullwidth-code-point "^3.0.0"
|
||||
strip-ansi "^6.0.1"
|
||||
|
||||
string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3:
|
||||
version "4.2.3"
|
||||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
||||
@ -6587,6 +6731,15 @@ string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2
|
||||
is-fullwidth-code-point "^3.0.0"
|
||||
strip-ansi "^6.0.1"
|
||||
|
||||
string-width@^5.0.1, string-width@^5.1.2:
|
||||
version "5.1.2"
|
||||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794"
|
||||
integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==
|
||||
dependencies:
|
||||
eastasianwidth "^0.2.0"
|
||||
emoji-regex "^9.2.2"
|
||||
strip-ansi "^7.0.1"
|
||||
|
||||
string.prototype.trimend@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80"
|
||||
@ -6628,6 +6781,13 @@ string_decoder@~1.1.1:
|
||||
dependencies:
|
||||
safe-buffer "~5.1.0"
|
||||
|
||||
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
||||
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
||||
dependencies:
|
||||
ansi-regex "^5.0.1"
|
||||
|
||||
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
||||
@ -6635,6 +6795,13 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
||||
dependencies:
|
||||
ansi-regex "^5.0.1"
|
||||
|
||||
strip-ansi@^7.0.1:
|
||||
version "7.1.0"
|
||||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
|
||||
integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==
|
||||
dependencies:
|
||||
ansi-regex "^6.0.1"
|
||||
|
||||
strip-bom@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"
|
||||
@ -6874,9 +7041,9 @@ ts-jest@^27.0.5:
|
||||
yargs-parser "20.x"
|
||||
|
||||
ts-mysql-migrate@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/ts-mysql-migrate/-/ts-mysql-migrate-1.0.2.tgz#736d37c3aa3fef92f226b869098e939950d0e18c"
|
||||
integrity sha512-zDW6iQsfPCJfQ3JMhfUGjhy8aK+VNTvPrXmJH66PB2EGEvyn4m7x2nBdhDNhKuwYU9LMxW1p+l39Ei+btXNpxA==
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/ts-mysql-migrate/-/ts-mysql-migrate-1.1.2.tgz#6f280f4684cb95440ffa7254b926b494badb8cf3"
|
||||
integrity sha512-jwhVaMrYBNNhAoZ5XISxzqbnXTHqwazqu/r1UQ6kUaGNPGL43ZFnBiXVj4Gm3pfe3xtCGIaNInehDfdDuigPgw==
|
||||
dependencies:
|
||||
"@types/mysql" "^2.15.8"
|
||||
mysql "^2.18.1"
|
||||
@ -7033,21 +7200,21 @@ typedarray-to-buffer@^3.1.5:
|
||||
is-typedarray "^1.0.0"
|
||||
|
||||
typeorm@^0.3.16:
|
||||
version "0.3.17"
|
||||
resolved "https://registry.yarnpkg.com/typeorm/-/typeorm-0.3.17.tgz#a73c121a52e4fbe419b596b244777be4e4b57949"
|
||||
integrity sha512-UDjUEwIQalO9tWw9O2A4GU+sT3oyoUXheHJy4ft+RFdnRdQctdQ34L9SqE2p7LdwzafHx1maxT+bqXON+Qnmig==
|
||||
version "0.3.20"
|
||||
resolved "https://registry.yarnpkg.com/typeorm/-/typeorm-0.3.20.tgz#4b61d737c6fed4e9f63006f88d58a5e54816b7ab"
|
||||
integrity sha512-sJ0T08dV5eoZroaq9uPKBoNcGslHBR4E4y+EBHs//SiGbblGe7IeduP/IH4ddCcj0qp3PHwDwGnuvqEAnKlq/Q==
|
||||
dependencies:
|
||||
"@sqltools/formatter" "^1.2.5"
|
||||
app-root-path "^3.1.0"
|
||||
buffer "^6.0.3"
|
||||
chalk "^4.1.2"
|
||||
cli-highlight "^2.1.11"
|
||||
date-fns "^2.29.3"
|
||||
dayjs "^1.11.9"
|
||||
debug "^4.3.4"
|
||||
dotenv "^16.0.3"
|
||||
glob "^8.1.0"
|
||||
glob "^10.3.10"
|
||||
mkdirp "^2.1.3"
|
||||
reflect-metadata "^0.1.13"
|
||||
reflect-metadata "^0.2.1"
|
||||
sha.js "^2.4.11"
|
||||
tslib "^2.5.0"
|
||||
uuid "^9.0.0"
|
||||
@ -7193,9 +7360,9 @@ uuid@^8.0.0, uuid@^8.3.2:
|
||||
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
||||
|
||||
uuid@^9.0.0:
|
||||
version "9.0.0"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
|
||||
integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==
|
||||
version "9.0.1"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30"
|
||||
integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==
|
||||
|
||||
v8-to-istanbul@^8.1.0:
|
||||
version "8.1.0"
|
||||
@ -7374,6 +7541,15 @@ workerpool@^9.2.0:
|
||||
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-9.2.0.tgz#f74427cbb61234708332ed8ab9cbf56dcb1c4371"
|
||||
integrity sha512-PKZqBOCo6CYkVOwAxWxQaSF2Fvb5Iv2fCeTP7buyWI2GiynWr46NcXSgK/idoV6e60dgCBfgYc+Un3HMvmqP8w==
|
||||
|
||||
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
|
||||
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
|
||||
dependencies:
|
||||
ansi-styles "^4.0.0"
|
||||
string-width "^4.1.0"
|
||||
strip-ansi "^6.0.0"
|
||||
|
||||
wrap-ansi@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
|
||||
@ -7383,6 +7559,15 @@ wrap-ansi@^7.0.0:
|
||||
string-width "^4.1.0"
|
||||
strip-ansi "^6.0.0"
|
||||
|
||||
wrap-ansi@^8.1.0:
|
||||
version "8.1.0"
|
||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
|
||||
integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==
|
||||
dependencies:
|
||||
ansi-styles "^6.1.0"
|
||||
string-width "^5.0.1"
|
||||
strip-ansi "^7.0.1"
|
||||
|
||||
wrappy@1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
||||
|
||||
@ -1,185 +0,0 @@
|
||||
const Joi = require('joi')
|
||||
|
||||
module.exports = {
|
||||
browserUrls: Joi.array()
|
||||
.items(Joi.string().uri())
|
||||
.custom((value, helpers) => {
|
||||
const protocol = new URL(value[0]).protocol
|
||||
for (const url of value) {
|
||||
if (new URL(url).protocol !== protocol) {
|
||||
return helpers.error('any.invalid')
|
||||
}
|
||||
}
|
||||
return value;
|
||||
})
|
||||
.required()
|
||||
.description('All URLs need to have same protocol to prevent mixed block errors'),
|
||||
|
||||
DECAY_START_TIME: Joi.date()
|
||||
.iso() // ISO 8601 format for date validation
|
||||
.description('The start time for decay, expected in ISO 8601 format (e.g. 2021-05-13T17:46:31Z)')
|
||||
.default(new Date('2021-05-13T17:46:31Z')) // default to the specified date if not provided
|
||||
.required(),
|
||||
|
||||
COMMUNITY_URL: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.custom((value, helpers) => {
|
||||
if (value.endsWith('/')) {
|
||||
return helpers.error('any.invalid', { message: 'URL should not end with a slash (/)' })
|
||||
}
|
||||
return value;
|
||||
})
|
||||
.description('The base URL of the community, should have the same protocol as frontend, admin and backend api to prevent mixed contend issues.')
|
||||
.default('http://0.0.0.0')
|
||||
.required(),
|
||||
|
||||
GRAPHQL_URI: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.description(
|
||||
`
|
||||
The external URL of the backend service,
|
||||
accessible from outside the server (e.g., via Nginx or the server's public URL),
|
||||
should have the same protocol as frontend and admin to prevent mixed contend issues.
|
||||
`,
|
||||
)
|
||||
.default('http://0.0.0.0/graphql')
|
||||
.required(),
|
||||
|
||||
COMMUNITY_NAME: Joi.string()
|
||||
.min(3)
|
||||
.max(100)
|
||||
.description('The name of the community')
|
||||
.default('Gradido Entwicklung')
|
||||
.required(),
|
||||
|
||||
COMMUNITY_DESCRIPTION: Joi.string()
|
||||
.min(10)
|
||||
.max(300)
|
||||
.description('A short description of the community')
|
||||
.default('Die lokale Entwicklungsumgebung von Gradido.')
|
||||
.required(),
|
||||
|
||||
COMMUNITY_SUPPORT_MAIL: Joi.string()
|
||||
.email()
|
||||
.description('The support email address for the community will be used in frontend and E-Mails')
|
||||
.default('support@supportmail.com')
|
||||
.required(),
|
||||
|
||||
COMMUNITY_LOCATION: Joi.string()
|
||||
.pattern(/^[-+]?[0-9]{1,2}(\.[0-9]+)?,\s?[-+]?[0-9]{1,3}(\.[0-9]+)?$/)
|
||||
.when('GMS_ACTIVE', {
|
||||
is: true,
|
||||
then: Joi.string().required(),
|
||||
otherwise: Joi.string().optional()
|
||||
})
|
||||
.description('Geographical location of the community in "latitude, longitude" format')
|
||||
.default('49.280377, 9.690151'),
|
||||
|
||||
GRAPHIQL: Joi.boolean()
|
||||
.description('Flag for enabling GraphQL playground for debugging.')
|
||||
.default(false)
|
||||
.when('NODE_ENV', {
|
||||
is: 'development',
|
||||
then: Joi.boolean().valid(true).required(), // only allow true in development mode
|
||||
otherwise: Joi.boolean().valid(false).required() // false in any other mode
|
||||
}),
|
||||
|
||||
GMS_ACTIVE: Joi.boolean()
|
||||
.description('Flag to indicate if the GMS (Geographic Member Search) service is used.')
|
||||
.default(false)
|
||||
.required(),
|
||||
|
||||
HUMHUB_ACTIVE: Joi.boolean()
|
||||
.description('Flag to indicate if the HumHub based Community Server is used.')
|
||||
.default(false)
|
||||
.required(),
|
||||
|
||||
LOG_LEVEL: Joi.string()
|
||||
.valid('all', 'mark', 'trace', 'debug', 'info', 'warn', 'error', 'fatal', 'off')
|
||||
.description('set log level')
|
||||
.default('info')
|
||||
.required(),
|
||||
|
||||
DB_HOST: Joi.string()
|
||||
.uri({ scheme: ['http'] })
|
||||
.description("database host like 'localhost' or 'mariadb' in docker setup")
|
||||
.default('localhost')
|
||||
.required(),
|
||||
|
||||
DB_PORT: Joi.number()
|
||||
.integer()
|
||||
.min(1024)
|
||||
.max(49151)
|
||||
.description('database port, default: 3306')
|
||||
.default(3306)
|
||||
.required(),
|
||||
|
||||
|
||||
DB_USER: Joi.string()
|
||||
.pattern(/^[A-Za-z0-9]([A-Za-z0-9-_\.]*[A-Za-z0-9])?$/) // Validates MariaDB username rules
|
||||
.min(1) // Minimum length 1
|
||||
.max(16) // Maximum length 16
|
||||
.message(
|
||||
'Valid database username (letters, numbers, hyphens, underscores, dots allowed; no spaces, must not start or end with hyphen, dot, or underscore)'
|
||||
)
|
||||
.description('database username for mariadb')
|
||||
.default('root')
|
||||
.required(),
|
||||
|
||||
DB_PASSWORD: Joi.string()
|
||||
.when(Joi.ref('NODE_ENV'), {
|
||||
is: 'development',
|
||||
then: Joi.string().allow(''),
|
||||
otherwise: Joi.string()
|
||||
.min(8)
|
||||
.max(32)
|
||||
.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*(),.?":{}|<>]).+$/)
|
||||
.message(
|
||||
'Password must be between 8 and 32 characters long, and contain at least one uppercase letter, one lowercase letter, one number, and one special character (e.g., !@#$%^&*).'
|
||||
)
|
||||
})
|
||||
.description(
|
||||
'Password for the database user. In development mode, an empty password is allowed. In other environments, a complex password is required.'
|
||||
)
|
||||
.default('')
|
||||
.required(),
|
||||
|
||||
DB_DATABASE: Joi.string()
|
||||
.pattern(/^[a-zA-Z][a-zA-Z0-9_-]{1,63}$/)
|
||||
.description('Database name like gradido_community (must start with a letter, and can only contain letters, numbers, underscores, or dashes)')
|
||||
.default('gradido_community')
|
||||
.required(),
|
||||
|
||||
APP_VERSION: Joi.string()
|
||||
.pattern(/^\d+\.\d+\.\d+$/)
|
||||
.message('Version must be in the format "major.minor.patch" (e.g., "2.4.1")')
|
||||
.description('App Version from package.json, alle modules share one version')
|
||||
.required(),
|
||||
|
||||
BUILD_COMMIT: Joi.string()
|
||||
.pattern(/^[0-9a-f]{40}$/)
|
||||
.message('The commit hash must be a 40-character hexadecimal string.')
|
||||
.description('The full git commit hash.')
|
||||
.optional(),
|
||||
|
||||
BUILD_COMMIT_SHORT: Joi.string()
|
||||
.pattern(/^[0-9a-f]{7}$/)
|
||||
.message('The first 7 hexadecimal character from git commit hash.')
|
||||
.description('A short version from the git commit hash.')
|
||||
.required(),
|
||||
|
||||
NODE_ENV: Joi.string()
|
||||
.valid('production', 'development', 'test')
|
||||
.default('development')
|
||||
.description('Specifies the environment in which the application is running.'),
|
||||
|
||||
DEBUG: Joi.boolean()
|
||||
.description('Indicates whether the application is in debugging mode. Set to true when NODE_ENV is not "production".')
|
||||
.default(false)
|
||||
.required(),
|
||||
|
||||
PRODUCTION: Joi.boolean()
|
||||
.default(false)
|
||||
.description('Indicates whether the application is running in production mode. Set to true when NODE_ENV is "production".')
|
||||
.required(),
|
||||
}
|
||||
184
config/dist/commonSchema.js
vendored
Normal file
184
config/dist/commonSchema.js
vendored
Normal file
@ -0,0 +1,184 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.PRODUCTION = exports.DEBUG = exports.NODE_ENV = exports.BUILD_COMMIT_SHORT = exports.BUILD_COMMIT = exports.APP_VERSION = exports.DB_DATABASE = exports.DB_PASSWORD = exports.DB_USER = exports.DB_PORT = exports.DB_HOST = exports.TYPEORM_LOGGING_RELATIVE_PATH = exports.LOG4JS_CONFIG = exports.LOG_LEVEL = exports.HUMHUB_ACTIVE = exports.GDT_API_URL = exports.GDT_ACTIVE = exports.GMS_ACTIVE = exports.GRAPHIQL = exports.COMMUNITY_LOCATION = exports.COMMUNITY_SUPPORT_MAIL = exports.COMMUNITY_DESCRIPTION = exports.COMMUNITY_NAME = exports.GRAPHQL_URI = exports.COMMUNITY_URL = exports.DB_VERSION = exports.DECAY_START_TIME = exports.browserUrls = void 0;
|
||||
const joi_1 = __importDefault(require("joi"));
|
||||
exports.browserUrls = joi_1.default.array()
|
||||
.items(joi_1.default.string().uri())
|
||||
.custom((value, helpers) => {
|
||||
const protocol = new URL(value[0]).protocol;
|
||||
for (const url of value) {
|
||||
if (new URL(url).protocol !== protocol) {
|
||||
return helpers.error('any.invalid');
|
||||
}
|
||||
}
|
||||
return value;
|
||||
})
|
||||
.required()
|
||||
.description('All URLs need to have same protocol to prevent mixed block errors');
|
||||
exports.DECAY_START_TIME = joi_1.default.date()
|
||||
.iso() // ISO 8601 format for date validation
|
||||
.description('The start time for decay, expected in ISO 8601 format (e.g. 2021-05-13T17:46:31Z)')
|
||||
.default(new Date('2021-05-13T17:46:31Z')) // default to the specified date if not provided
|
||||
.required();
|
||||
exports.DB_VERSION = joi_1.default.string()
|
||||
.pattern(/^\d{4}-[a-z0-9-_]+$/)
|
||||
.message('DB_VERSION must be in the format: YYYY-description, e.g. "0087-add_index_on_user_roles".')
|
||||
.description('db version string, last migration file name without ending or last folder in entity')
|
||||
.required();
|
||||
exports.COMMUNITY_URL = joi_1.default.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.custom((value, helpers) => {
|
||||
if (value.endsWith('/')) {
|
||||
return helpers.error('any.invalid', { message: 'URL should not end with a slash (/)' });
|
||||
}
|
||||
return value;
|
||||
})
|
||||
.description('The base URL of the community, should have the same protocol as frontend, admin and backend api to prevent mixed contend issues.')
|
||||
.default('http://0.0.0.0')
|
||||
.required();
|
||||
exports.GRAPHQL_URI = joi_1.default.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.description(`
|
||||
The external URL of the backend service,
|
||||
accessible from outside the server (e.g., via Nginx or the server's public URL),
|
||||
should have the same protocol as frontend and admin to prevent mixed contend issues.
|
||||
`)
|
||||
.default('http://0.0.0.0/graphql')
|
||||
.required();
|
||||
exports.COMMUNITY_NAME = joi_1.default.string()
|
||||
.min(3)
|
||||
.max(100)
|
||||
.description('The name of the community')
|
||||
.default('Gradido Entwicklung')
|
||||
.required();
|
||||
exports.COMMUNITY_DESCRIPTION = joi_1.default.string()
|
||||
.min(10)
|
||||
.max(300)
|
||||
.description('A short description of the community')
|
||||
.default('Die lokale Entwicklungsumgebung von Gradido.')
|
||||
.required();
|
||||
exports.COMMUNITY_SUPPORT_MAIL = joi_1.default.string()
|
||||
.email()
|
||||
.description('The support email address for the community will be used in frontend and E-Mails')
|
||||
.default('support@supportmail.com')
|
||||
.required();
|
||||
exports.COMMUNITY_LOCATION = joi_1.default.string()
|
||||
.pattern(/^[-+]?[0-9]{1,2}(\.[0-9]+)?,\s?[-+]?[0-9]{1,3}(\.[0-9]+)?$/)
|
||||
.when('GMS_ACTIVE', {
|
||||
is: true,
|
||||
then: joi_1.default.string().required(),
|
||||
otherwise: joi_1.default.string().optional()
|
||||
})
|
||||
.description('Geographical location of the community in "latitude, longitude" format')
|
||||
.default('49.280377, 9.690151');
|
||||
exports.GRAPHIQL = joi_1.default.boolean()
|
||||
.description('Flag for enabling GraphQL playground for debugging.')
|
||||
.default(false)
|
||||
.when('NODE_ENV', {
|
||||
is: 'development',
|
||||
then: joi_1.default.boolean().valid(true, false).required(), // only allow true in development mode
|
||||
otherwise: joi_1.default.boolean().valid(false).required() // false in any other mode
|
||||
});
|
||||
exports.GMS_ACTIVE = joi_1.default.boolean()
|
||||
.description('Flag to indicate if the GMS (Geographic Member Search) service is used.')
|
||||
.default(false)
|
||||
.required();
|
||||
exports.GDT_ACTIVE = joi_1.default.boolean()
|
||||
.description('Flag to indicate if the GMS (Geographic Member Search) service is used.')
|
||||
.default(false)
|
||||
.required();
|
||||
exports.GDT_API_URL = joi_1.default.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.default('https://gdt.gradido.net')
|
||||
.when('GDT_ACTIVE', { is: true, then: joi_1.default.required() })
|
||||
.description('The URL for GDT API endpoint');
|
||||
exports.HUMHUB_ACTIVE = joi_1.default.boolean()
|
||||
.description('Flag to indicate if the HumHub based Community Server is used.')
|
||||
.default(false)
|
||||
.required();
|
||||
exports.LOG_LEVEL = joi_1.default.string()
|
||||
.valid('all', 'mark', 'trace', 'debug', 'info', 'warn', 'error', 'fatal', 'off')
|
||||
.description('set log level')
|
||||
.default('info')
|
||||
.required();
|
||||
exports.LOG4JS_CONFIG = joi_1.default.string()
|
||||
.pattern(/^[a-zA-Z0-9-_]+\.json$/)
|
||||
.message('LOG4JS_CONFIG must be a valid filename ending with .json')
|
||||
.description('config file name for log4js config file')
|
||||
.default('log4js-config.json')
|
||||
.required();
|
||||
exports.TYPEORM_LOGGING_RELATIVE_PATH = joi_1.default.string()
|
||||
.pattern(/^[a-zA-Z0-9-_\.]+\.log$/)
|
||||
.message('TYPEORM_LOGGING_RELATIVE_PATH must be a valid filename ending with .log')
|
||||
.description('log file name for logging typeorm activities')
|
||||
.default('typeorm.log')
|
||||
.required();
|
||||
exports.DB_HOST = joi_1.default.string()
|
||||
.pattern(/^[a-zA-Z0-9.-]+$/)
|
||||
.message('must be a valid host with alphanumeric characters, numbers, points and -')
|
||||
.description("database host like 'localhost' or 'mariadb' in docker setup")
|
||||
.default('localhost')
|
||||
.required();
|
||||
exports.DB_PORT = joi_1.default.number()
|
||||
.integer()
|
||||
.min(1024)
|
||||
.max(49151)
|
||||
.description('database port, default: 3306')
|
||||
.default(3306)
|
||||
.required();
|
||||
exports.DB_USER = joi_1.default.string()
|
||||
.pattern(/^[A-Za-z0-9]([A-Za-z0-9-_\.]*[A-Za-z0-9])?$/) // Validates MariaDB username rules
|
||||
.min(1) // Minimum length 1
|
||||
.max(16) // Maximum length 16
|
||||
.message('Valid database username (letters, numbers, hyphens, underscores, dots allowed; no spaces, must not start or end with hyphen, dot, or underscore)')
|
||||
.description('database username for mariadb')
|
||||
.default('root')
|
||||
.required();
|
||||
exports.DB_PASSWORD = joi_1.default.string()
|
||||
.when(joi_1.default.ref('NODE_ENV'), {
|
||||
is: 'development',
|
||||
then: joi_1.default.string().allow(''),
|
||||
otherwise: joi_1.default.string()
|
||||
.min(8)
|
||||
.max(32)
|
||||
.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*(),.?":{}|<>]).+$/)
|
||||
.message('Password must be between 8 and 32 characters long, and contain at least one uppercase letter, one lowercase letter, one number, and one special character (e.g., !@#$%^&*).')
|
||||
})
|
||||
.description('Password for the database user. In development mode, an empty password is allowed. In other environments, a complex password is required.')
|
||||
.default('')
|
||||
.required();
|
||||
exports.DB_DATABASE = joi_1.default.string()
|
||||
.pattern(/^[a-zA-Z][a-zA-Z0-9_-]{1,63}$/)
|
||||
.description('Database name like gradido_community (must start with a letter, and can only contain letters, numbers, underscores, or dashes)')
|
||||
.default('gradido_community')
|
||||
.required();
|
||||
exports.APP_VERSION = joi_1.default.string()
|
||||
.pattern(/^\d+\.\d+\.\d+$/)
|
||||
.message('Version must be in the format "major.minor.patch" (e.g., "2.4.1")')
|
||||
.description('App Version from package.json, alle modules share one version')
|
||||
.required();
|
||||
exports.BUILD_COMMIT = joi_1.default.string()
|
||||
.pattern(/^[0-9a-f]{40}$/)
|
||||
.message('The commit hash must be a 40-character hexadecimal string.')
|
||||
.description('The full git commit hash.')
|
||||
.optional();
|
||||
exports.BUILD_COMMIT_SHORT = joi_1.default.string()
|
||||
.pattern(/^[0-9a-f]{7}$/)
|
||||
.message('The first 7 hexadecimal character from git commit hash.')
|
||||
.description('A short version from the git commit hash.')
|
||||
.required();
|
||||
exports.NODE_ENV = joi_1.default.string()
|
||||
.valid('production', 'development', 'test')
|
||||
.default('development')
|
||||
.description('Specifies the environment in which the application is running.');
|
||||
exports.DEBUG = joi_1.default.boolean()
|
||||
.description('Indicates whether the application is in debugging mode. Set to true when NODE_ENV is not "production".')
|
||||
.default(false)
|
||||
.required();
|
||||
exports.PRODUCTION = joi_1.default.boolean()
|
||||
.default(false)
|
||||
.description('Indicates whether the application is running in production mode. Set to true when NODE_ENV is "production".')
|
||||
.required();
|
||||
43
config/dist/index.js
vendored
Normal file
43
config/dist/index.js
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
"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.validate = validate;
|
||||
__exportStar(require("./commonSchema"), exports);
|
||||
function validate(schema, data) {
|
||||
const { error } = schema.validate(data);
|
||||
const schemaJson = schema.describe();
|
||||
if (error) {
|
||||
error.details.forEach((err) => {
|
||||
if (!err.context) {
|
||||
throw new Error('missing context in config validation with joi');
|
||||
}
|
||||
const key = err.context.key;
|
||||
if (!key) {
|
||||
throw new Error('missing key in config validation with joi');
|
||||
}
|
||||
const value = err.context.value;
|
||||
const description = schemaJson.keys[key]
|
||||
? schema.describe().keys[key].flags.description
|
||||
: 'No description available';
|
||||
if (data[key] === undefined) {
|
||||
throw new Error(`Environment Variable '${key}' is missing. ${description}`);
|
||||
}
|
||||
else {
|
||||
throw new Error(`Error on Environment Variable ${key} with value = ${value}: ${err.message}. ${description}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
29
config/dist/types/commonSchema.d.ts
vendored
Normal file
29
config/dist/types/commonSchema.d.ts
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
import Joi from 'joi';
|
||||
export declare const browserUrls: Joi.ArraySchema<any[]>;
|
||||
export declare const DECAY_START_TIME: Joi.DateSchema<Date>;
|
||||
export declare const DB_VERSION: Joi.StringSchema<string>;
|
||||
export declare const COMMUNITY_URL: Joi.StringSchema<string>;
|
||||
export declare const GRAPHQL_URI: Joi.StringSchema<string>;
|
||||
export declare const COMMUNITY_NAME: Joi.StringSchema<string>;
|
||||
export declare const COMMUNITY_DESCRIPTION: Joi.StringSchema<string>;
|
||||
export declare const COMMUNITY_SUPPORT_MAIL: Joi.StringSchema<string>;
|
||||
export declare const COMMUNITY_LOCATION: Joi.StringSchema<string>;
|
||||
export declare const GRAPHIQL: Joi.BooleanSchema<boolean>;
|
||||
export declare const GMS_ACTIVE: Joi.BooleanSchema<boolean>;
|
||||
export declare const GDT_ACTIVE: Joi.BooleanSchema<boolean>;
|
||||
export declare const GDT_API_URL: Joi.StringSchema<string>;
|
||||
export declare const HUMHUB_ACTIVE: Joi.BooleanSchema<boolean>;
|
||||
export declare const LOG_LEVEL: Joi.StringSchema<string>;
|
||||
export declare const LOG4JS_CONFIG: Joi.StringSchema<string>;
|
||||
export declare const TYPEORM_LOGGING_RELATIVE_PATH: Joi.StringSchema<string>;
|
||||
export declare const DB_HOST: Joi.StringSchema<string>;
|
||||
export declare const DB_PORT: Joi.NumberSchema<number>;
|
||||
export declare const DB_USER: Joi.StringSchema<string>;
|
||||
export declare const DB_PASSWORD: Joi.StringSchema<string>;
|
||||
export declare const DB_DATABASE: Joi.StringSchema<string>;
|
||||
export declare const APP_VERSION: Joi.StringSchema<string>;
|
||||
export declare const BUILD_COMMIT: Joi.StringSchema<string>;
|
||||
export declare const BUILD_COMMIT_SHORT: Joi.StringSchema<string>;
|
||||
export declare const NODE_ENV: Joi.StringSchema<string>;
|
||||
export declare const DEBUG: Joi.BooleanSchema<boolean>;
|
||||
export declare const PRODUCTION: Joi.BooleanSchema<boolean>;
|
||||
3
config/dist/types/index.d.ts
vendored
Normal file
3
config/dist/types/index.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import { ObjectSchema } from 'joi';
|
||||
export * from './commonSchema';
|
||||
export declare function validate(schema: ObjectSchema, data: any): void;
|
||||
@ -1,78 +0,0 @@
|
||||
const joi = require('joi')
|
||||
const pkg = require('../package')
|
||||
|
||||
// Function to map and transform environment variables to match the schema
|
||||
function mapEnvVariablesToSchema(schema) {
|
||||
const mappedEnvVariables = {}
|
||||
|
||||
// Iterate over all schema keys
|
||||
for (const [key, value] of Object.entries(schema.describe().keys)) {
|
||||
const lowerKey = key.toLowerCase() // Convert key to lowercase to match environment variable keys
|
||||
|
||||
// Check if the environment variable exists and map it
|
||||
const envValue = process.env[lowerKey]
|
||||
if (envValue) {
|
||||
// If the value is 'true' or 'false', convert it to a boolean
|
||||
if (envValue === 'true' || envValue === 'false') {
|
||||
mappedEnvVariables[lowerKey] = envValue === 'true'
|
||||
}
|
||||
// If the value is a number (check if it's a valid number), convert it
|
||||
else if (!isNaN(envValue)) {
|
||||
mappedEnvVariables[lowerKey] = Number(envValue) // Convert string to number
|
||||
}
|
||||
// For all other cases, keep the value as it is
|
||||
else {
|
||||
mappedEnvVariables[lowerKey] = envValue
|
||||
}
|
||||
} else {
|
||||
// If no environment variable exists, use the default from the schema (if defined)
|
||||
if (value.flags) {
|
||||
let defaultValue = null
|
||||
if (typeof value.flags.default === 'function') {
|
||||
defaultValue = value.flags.default(schema)
|
||||
} else {
|
||||
defaultValue = value.flags.default
|
||||
}
|
||||
mappedEnvVariables[lowerKey] = defaultValue !== undefined ? defaultValue : null
|
||||
// console.log({ key, value: mappedEnvVariables[lowerKey] })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mappedEnvVariables
|
||||
}
|
||||
|
||||
const constants = {
|
||||
DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0
|
||||
}
|
||||
|
||||
const version = {
|
||||
APP_VERSION: pkg.version,
|
||||
BUILD_COMMIT: process.env.BUILD_COMMIT ?? null,
|
||||
// self reference of `version.BUILD_COMMIT` is not possible at this point, hence the duplicate code
|
||||
BUILD_COMMIT_SHORT: (process.env.BUILD_COMMIT ?? '0000000').slice(0, 7),
|
||||
}
|
||||
|
||||
const environment = {
|
||||
NODE_ENV: process.env.NODE_ENV,
|
||||
DEBUG: process.env.NODE_ENV !== 'production' ?? false,
|
||||
PRODUCTION: process.env.NODE_ENV === 'production' ?? false,
|
||||
DEFAULT_PUBLISHER_ID: process.env.DEFAULT_PUBLISHER_ID ?? 2896,
|
||||
}
|
||||
|
||||
export function validateAndExport(schema) {
|
||||
const envMappedToSchema = mapEnvVariablesToSchema(schema)
|
||||
// validate env against schema
|
||||
joi.attempt(envMappedToSchema, schema)
|
||||
const finalEnvVariables = {}
|
||||
for (const [key, value] of Object.entries(envMappedToSchema)) {
|
||||
const upperKey = key.toUpperCase() // Convert key back to uppercase
|
||||
finalEnvVariables[upperKey] = value
|
||||
}
|
||||
return {
|
||||
...constants,
|
||||
...version,
|
||||
...environment,
|
||||
...finalEnvVariables
|
||||
}
|
||||
}
|
||||
1
config/node_modules/.bin/tsc
generated
vendored
Symbolic link
1
config/node_modules/.bin/tsc
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../typescript/bin/tsc
|
||||
1
config/node_modules/.bin/tsserver
generated
vendored
Symbolic link
1
config/node_modules/.bin/tsserver
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../typescript/bin/tsserver
|
||||
30
config/node_modules/.yarn-integrity
generated
vendored
Normal file
30
config/node_modules/.yarn-integrity
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"systemParams": "linux-x64-93",
|
||||
"modulesFolders": [
|
||||
"node_modules"
|
||||
],
|
||||
"flags": [],
|
||||
"linkedModules": [],
|
||||
"topLevelPatterns": [
|
||||
"@types/joi@^17.2.3",
|
||||
"@types/node@^22.10.7",
|
||||
"joi@^17.13.3",
|
||||
"typescript@^5.7.3"
|
||||
],
|
||||
"lockfileEntries": {
|
||||
"@hapi/hoek@^9.0.0": "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb",
|
||||
"@hapi/hoek@^9.3.0": "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb",
|
||||
"@hapi/topo@^5.1.0": "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012",
|
||||
"@sideway/address@^4.1.5": "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.5.tgz#4bc149a0076623ced99ca8208ba780d65a99b9d5",
|
||||
"@sideway/formula@^3.0.1": "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.1.tgz#80fcbcbaf7ce031e0ef2dd29b1bfc7c3f583611f",
|
||||
"@sideway/pinpoint@^2.0.0": "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df",
|
||||
"@types/joi@^17.2.3": "https://registry.yarnpkg.com/@types/joi/-/joi-17.2.3.tgz#b7768ed9d84f1ebd393328b9f97c1cf3d2b94798",
|
||||
"@types/node@^22.10.7": "https://registry.yarnpkg.com/@types/node/-/node-22.10.7.tgz#14a1ca33fd0ebdd9d63593ed8d3fbc882a6d28d7",
|
||||
"joi@*": "https://registry.yarnpkg.com/joi/-/joi-17.13.3.tgz#0f5cc1169c999b30d344366d384b12d92558bcec",
|
||||
"joi@^17.13.3": "https://registry.yarnpkg.com/joi/-/joi-17.13.3.tgz#0f5cc1169c999b30d344366d384b12d92558bcec",
|
||||
"typescript@^5.7.3": "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e",
|
||||
"undici-types@~6.20.0": "https://registry.yarnpkg.com/undici-types/-/undici-types-6.20.0.tgz#8171bf22c1f588d1554d55bf204bc624af388433"
|
||||
},
|
||||
"files": [],
|
||||
"artifacts": {}
|
||||
}
|
||||
12
config/node_modules/@hapi/hoek/LICENSE.md
generated
vendored
Executable file
12
config/node_modules/@hapi/hoek/LICENSE.md
generated
vendored
Executable file
@ -0,0 +1,12 @@
|
||||
Copyright (c) 2011-2020, Sideway Inc, and project contributors
|
||||
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
config/node_modules/@hapi/hoek/README.md
generated
vendored
Executable file
19
config/node_modules/@hapi/hoek/README.md
generated
vendored
Executable 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/)
|
||||
102
config/node_modules/@hapi/hoek/lib/applyToDefaults.js
generated
vendored
Executable file
102
config/node_modules/@hapi/hoek/lib/applyToDefaults.js
generated
vendored
Executable 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;
|
||||
};
|
||||
22
config/node_modules/@hapi/hoek/lib/assert.js
generated
vendored
Executable file
22
config/node_modules/@hapi/hoek/lib/assert.js
generated
vendored
Executable file
@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
const AssertError = require('./error');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (condition, ...args) {
|
||||
|
||||
if (condition) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length === 1 &&
|
||||
args[0] instanceof Error) {
|
||||
|
||||
throw args[0];
|
||||
}
|
||||
|
||||
throw new AssertError(args);
|
||||
};
|
||||
29
config/node_modules/@hapi/hoek/lib/bench.js
generated
vendored
Executable file
29
config/node_modules/@hapi/hoek/lib/bench.js
generated
vendored
Executable 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);
|
||||
}
|
||||
};
|
||||
12
config/node_modules/@hapi/hoek/lib/block.js
generated
vendored
Executable file
12
config/node_modules/@hapi/hoek/lib/block.js
generated
vendored
Executable file
@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
const Ignore = require('./ignore');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function () {
|
||||
|
||||
return new Promise(Ignore);
|
||||
};
|
||||
176
config/node_modules/@hapi/hoek/lib/clone.js
generated
vendored
Executable file
176
config/node_modules/@hapi/hoek/lib/clone.js
generated
vendored
Executable file
@ -0,0 +1,176 @@
|
||||
'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])
|
||||
};
|
||||
|
||||
|
||||
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);
|
||||
if (baseProto === Types.buffer) {
|
||||
return Buffer && Buffer.from(obj); // $lab:coverage:ignore$
|
||||
}
|
||||
|
||||
if (baseProto === Types.date) {
|
||||
return new Date(obj.getTime());
|
||||
}
|
||||
|
||||
if (baseProto === Types.regex) {
|
||||
return new RegExp(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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (internals.needsProtoHack.has(baseProto)) {
|
||||
const newObj = new proto.constructor();
|
||||
if (proto !== baseProto) {
|
||||
Object.setPrototypeOf(newObj, proto);
|
||||
}
|
||||
|
||||
return newObj;
|
||||
}
|
||||
|
||||
return Object.create(proto);
|
||||
};
|
||||
307
config/node_modules/@hapi/hoek/lib/contain.js
generated
vendored
Executable file
307
config/node_modules/@hapi/hoek/lib/contain.js
generated
vendored
Executable 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;
|
||||
};
|
||||
317
config/node_modules/@hapi/hoek/lib/deepEqual.js
generated
vendored
Executable file
317
config/node_modules/@hapi/hoek/lib/deepEqual.js
generated
vendored
Executable 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:
|
||||
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 ||
|
||||
!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;
|
||||
}
|
||||
};
|
||||
26
config/node_modules/@hapi/hoek/lib/error.js
generated
vendored
Executable file
26
config/node_modules/@hapi/hoek/lib/error.js
generated
vendored
Executable file
@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
const Stringify = require('./stringify');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = class extends Error {
|
||||
|
||||
constructor(args) {
|
||||
|
||||
const msgs = args
|
||||
.filter((arg) => arg !== '')
|
||||
.map((arg) => {
|
||||
|
||||
return typeof arg === 'string' ? arg : arg instanceof Error ? arg.message : Stringify(arg);
|
||||
});
|
||||
|
||||
super(msgs.join(' ') || 'Unknown error');
|
||||
|
||||
if (typeof Error.captureStackTrace === 'function') { // $lab:coverage:ignore$
|
||||
Error.captureStackTrace(this, exports.assert);
|
||||
}
|
||||
}
|
||||
};
|
||||
16
config/node_modules/@hapi/hoek/lib/escapeHeaderAttribute.js
generated
vendored
Executable file
16
config/node_modules/@hapi/hoek/lib/escapeHeaderAttribute.js
generated
vendored
Executable 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
|
||||
};
|
||||
87
config/node_modules/@hapi/hoek/lib/escapeHtml.js
generated
vendored
Executable file
87
config/node_modules/@hapi/hoek/lib/escapeHtml.js
generated
vendored
Executable 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, '&'],
|
||||
[60, '<'],
|
||||
[62, '>'],
|
||||
[34, '"'],
|
||||
[160, ' '],
|
||||
[162, '¢'],
|
||||
[163, '£'],
|
||||
[164, '¤'],
|
||||
[169, '©'],
|
||||
[174, '®']
|
||||
]);
|
||||
|
||||
|
||||
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;
|
||||
}());
|
||||
28
config/node_modules/@hapi/hoek/lib/escapeJson.js
generated
vendored
Executable file
28
config/node_modules/@hapi/hoek/lib/escapeJson.js
generated
vendored
Executable 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']
|
||||
]);
|
||||
11
config/node_modules/@hapi/hoek/lib/escapeRegex.js
generated
vendored
Executable file
11
config/node_modules/@hapi/hoek/lib/escapeRegex.js
generated
vendored
Executable file
@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (string) {
|
||||
|
||||
// Escape ^$.*+-?=!:|\/()[]{},
|
||||
|
||||
return string.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g, '\\$&');
|
||||
};
|
||||
20
config/node_modules/@hapi/hoek/lib/flatten.js
generated
vendored
Executable file
20
config/node_modules/@hapi/hoek/lib/flatten.js
generated
vendored
Executable 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;
|
||||
};
|
||||
6
config/node_modules/@hapi/hoek/lib/ignore.js
generated
vendored
Executable file
6
config/node_modules/@hapi/hoek/lib/ignore.js
generated
vendored
Executable file
@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function () { };
|
||||
471
config/node_modules/@hapi/hoek/lib/index.d.ts
generated
vendored
Executable file
471
config/node_modules/@hapi/hoek/lib/index.d.ts
generated
vendored
Executable file
@ -0,0 +1,471 @@
|
||||
/// <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 false
|
||||
*/
|
||||
readonly mergeArrays?: boolean;
|
||||
|
||||
/**
|
||||
* Compare symbol properties.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
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): void;
|
||||
|
||||
|
||||
/**
|
||||
* 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): void;
|
||||
|
||||
|
||||
/**
|
||||
* 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
config/node_modules/@hapi/hoek/lib/index.js
generated
vendored
Executable file
45
config/node_modules/@hapi/hoek/lib/index.js
generated
vendored
Executable file
@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
exports.applyToDefaults = require('./applyToDefaults');
|
||||
|
||||
exports.assert = require('./assert');
|
||||
|
||||
exports.Bench = require('./bench');
|
||||
|
||||
exports.block = require('./block');
|
||||
|
||||
exports.clone = require('./clone');
|
||||
|
||||
exports.contain = require('./contain');
|
||||
|
||||
exports.deepEqual = require('./deepEqual');
|
||||
|
||||
exports.Error = require('./error');
|
||||
|
||||
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');
|
||||
41
config/node_modules/@hapi/hoek/lib/intersect.js
generated
vendored
Executable file
41
config/node_modules/@hapi/hoek/lib/intersect.js
generated
vendored
Executable 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;
|
||||
};
|
||||
9
config/node_modules/@hapi/hoek/lib/isPromise.js
generated
vendored
Executable file
9
config/node_modules/@hapi/hoek/lib/isPromise.js
generated
vendored
Executable file
@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (promise) {
|
||||
|
||||
return !!promise && typeof promise.then === 'function';
|
||||
};
|
||||
78
config/node_modules/@hapi/hoek/lib/merge.js
generated
vendored
Executable file
78
config/node_modules/@hapi/hoek/lib/merge.js
generated
vendored
Executable 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;
|
||||
};
|
||||
25
config/node_modules/@hapi/hoek/lib/once.js
generated
vendored
Executable file
25
config/node_modules/@hapi/hoek/lib/once.js
generated
vendored
Executable 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;
|
||||
};
|
||||
76
config/node_modules/@hapi/hoek/lib/reach.js
generated
vendored
Executable file
76
config/node_modules/@hapi/hoek/lib/reach.js
generated
vendored
Executable 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';
|
||||
}
|
||||
};
|
||||
16
config/node_modules/@hapi/hoek/lib/reachTemplate.js
generated
vendored
Executable file
16
config/node_modules/@hapi/hoek/lib/reachTemplate.js
generated
vendored
Executable file
@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
const Reach = require('./reach');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (obj, template, options) {
|
||||
|
||||
return template.replace(/{([^{}]+)}/g, ($0, chain) => {
|
||||
|
||||
const value = Reach(obj, chain, options);
|
||||
return (value === undefined || value === null ? '' : value);
|
||||
});
|
||||
};
|
||||
14
config/node_modules/@hapi/hoek/lib/stringify.js
generated
vendored
Executable file
14
config/node_modules/@hapi/hoek/lib/stringify.js
generated
vendored
Executable file
@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
module.exports = function (...args) {
|
||||
|
||||
try {
|
||||
return JSON.stringify(...args);
|
||||
}
|
||||
catch (err) {
|
||||
return '[Cannot display object: ' + err.message + ']';
|
||||
}
|
||||
};
|
||||
55
config/node_modules/@hapi/hoek/lib/types.js
generated
vendored
Executable file
55
config/node_modules/@hapi/hoek/lib/types.js
generated
vendored
Executable file
@ -0,0 +1,55 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
exports = module.exports = {
|
||||
array: Array.prototype,
|
||||
buffer: Buffer && Buffer.prototype, // $lab:coverage:ignore$
|
||||
date: Date.prototype,
|
||||
error: Error.prototype,
|
||||
generic: Object.prototype,
|
||||
map: Map.prototype,
|
||||
promise: Promise.prototype,
|
||||
regex: RegExp.prototype,
|
||||
set: Set.prototype,
|
||||
weakMap: WeakMap.prototype,
|
||||
weakSet: WeakSet.prototype
|
||||
};
|
||||
|
||||
|
||||
internals.typeMap = new Map([
|
||||
['[object Error]', exports.error],
|
||||
['[object Map]', exports.map],
|
||||
['[object Promise]', exports.promise],
|
||||
['[object Set]', exports.set],
|
||||
['[object WeakMap]', exports.weakMap],
|
||||
['[object WeakSet]', exports.weakSet]
|
||||
]);
|
||||
|
||||
|
||||
exports.getInternalProto = function (obj) {
|
||||
|
||||
if (Array.isArray(obj)) {
|
||||
return exports.array;
|
||||
}
|
||||
|
||||
if (Buffer && obj instanceof Buffer) { // $lab:coverage:ignore$
|
||||
return exports.buffer;
|
||||
}
|
||||
|
||||
if (obj instanceof Date) {
|
||||
return exports.date;
|
||||
}
|
||||
|
||||
if (obj instanceof RegExp) {
|
||||
return exports.regex;
|
||||
}
|
||||
|
||||
if (obj instanceof Error) {
|
||||
return exports.error;
|
||||
}
|
||||
|
||||
const objName = Object.prototype.toString.call(obj);
|
||||
return internals.typeMap.get(objName) || exports.generic;
|
||||
};
|
||||
9
config/node_modules/@hapi/hoek/lib/utils.js
generated
vendored
Executable file
9
config/node_modules/@hapi/hoek/lib/utils.js
generated
vendored
Executable file
@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
exports.keys = function (obj, options = {}) {
|
||||
|
||||
return options.symbols !== false ? Reflect.ownKeys(obj) : Object.getOwnPropertyNames(obj); // Defaults to true
|
||||
};
|
||||
37
config/node_modules/@hapi/hoek/lib/wait.js
generated
vendored
Executable file
37
config/node_modules/@hapi/hoek/lib/wait.js
generated
vendored
Executable file
@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {
|
||||
maxTimer: 2 ** 31 - 1 // ~25 days
|
||||
};
|
||||
|
||||
|
||||
module.exports = function (timeout, returnValue, options) {
|
||||
|
||||
if (typeof timeout === 'bigint') {
|
||||
timeout = Number(timeout);
|
||||
}
|
||||
|
||||
if (timeout >= Number.MAX_SAFE_INTEGER) { // Thousands of years
|
||||
timeout = Infinity;
|
||||
}
|
||||
|
||||
if (typeof timeout !== 'number' && timeout !== undefined) {
|
||||
throw new TypeError('Timeout must be a number or bigint');
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
|
||||
const _setTimeout = options ? options.setTimeout : setTimeout;
|
||||
|
||||
const activate = () => {
|
||||
|
||||
const time = Math.min(timeout, internals.maxTimer);
|
||||
timeout -= time;
|
||||
_setTimeout(() => (timeout > 0 ? activate() : resolve(returnValue)), time);
|
||||
};
|
||||
|
||||
if (timeout !== Infinity) {
|
||||
activate();
|
||||
}
|
||||
});
|
||||
};
|
||||
31
config/node_modules/@hapi/hoek/package.json
generated
vendored
Executable file
31
config/node_modules/@hapi/hoek/package.json
generated
vendored
Executable file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "@hapi/hoek",
|
||||
"description": "General purpose node utilities",
|
||||
"version": "9.3.0",
|
||||
"repository": "git://github.com/hapijs/hoek",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"keywords": [
|
||||
"utilities"
|
||||
],
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"plugin:@hapi/module"
|
||||
]
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@hapi/code": "8.x.x",
|
||||
"@hapi/eslint-plugin": "*",
|
||||
"@hapi/lab": "^24.0.0",
|
||||
"typescript": "~4.0.2"
|
||||
},
|
||||
"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"
|
||||
}
|
||||
10
config/node_modules/@hapi/topo/LICENSE.md
generated
vendored
Executable file
10
config/node_modules/@hapi/topo/LICENSE.md
generated
vendored
Executable file
@ -0,0 +1,10 @@
|
||||
Copyright (c) 2012-2020, Sideway Inc, and project contributors
|
||||
Copyright (c) 2012-2014, Walmart.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* The names of any contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS OFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
17
config/node_modules/@hapi/topo/README.md
generated
vendored
Executable file
17
config/node_modules/@hapi/topo/README.md
generated
vendored
Executable file
@ -0,0 +1,17 @@
|
||||
<a href="https://hapi.dev"><img src="https://raw.githubusercontent.com/hapijs/assets/master/images/family.png" width="180px" align="right" /></a>
|
||||
|
||||
# @hapi/topo
|
||||
|
||||
#### Topological sorting with grouping support.
|
||||
|
||||
**topo** is part of the **hapi** ecosystem and was designed to work seamlessly with the [hapi web framework](https://hapi.dev) and its other components (but works great on its own or with other frameworks). If you are using a different web framework and find this module useful, check out [hapi](https://hapi.dev) – they work even better together.
|
||||
|
||||
### Visit the [hapi.dev](https://hapi.dev) Developer Portal for tutorials, documentation, and support
|
||||
|
||||
## Useful resources
|
||||
|
||||
- [Documentation and API](https://hapi.dev/family/topo/)
|
||||
- [Version status](https://hapi.dev/resources/status/#topo) (builds, dependencies, node versions, licenses, eol)
|
||||
- [Changelog](https://hapi.dev/family/topo/changelog/)
|
||||
- [Project policies](https://hapi.dev/policies/)
|
||||
- [Free and commercial support options](https://hapi.dev/support/)
|
||||
60
config/node_modules/@hapi/topo/lib/index.d.ts
generated
vendored
Executable file
60
config/node_modules/@hapi/topo/lib/index.d.ts
generated
vendored
Executable file
@ -0,0 +1,60 @@
|
||||
export class Sorter<T> {
|
||||
|
||||
/**
|
||||
* An array of the topologically sorted nodes. This list is renewed upon each call to topo.add().
|
||||
*/
|
||||
nodes: T[];
|
||||
|
||||
/**
|
||||
* Adds a node or list of nodes to be added and topologically sorted
|
||||
*
|
||||
* @param nodes - A mixed value or array of mixed values to be added as nodes to the topologically sorted list.
|
||||
* @param options - Optional sorting information about the nodes.
|
||||
*
|
||||
* @returns Returns an array of the topologically sorted nodes.
|
||||
*/
|
||||
add(nodes: T | T[], options?: Options): T[];
|
||||
|
||||
/**
|
||||
* Merges another Sorter object into the current object.
|
||||
*
|
||||
* @param others - The other object or array of objects to be merged into the current one.
|
||||
*
|
||||
* @returns Returns an array of the topologically sorted nodes.
|
||||
*/
|
||||
merge(others: Sorter<T> | Sorter<T>[]): T[];
|
||||
|
||||
/**
|
||||
* Sorts the nodes array (only required if the manual option is used when adding items)
|
||||
*/
|
||||
sort(): T[];
|
||||
}
|
||||
|
||||
|
||||
export interface Options {
|
||||
|
||||
/**
|
||||
* The sorting group the added items belong to
|
||||
*/
|
||||
readonly group?: string;
|
||||
|
||||
/**
|
||||
* The group or groups the added items must come before
|
||||
*/
|
||||
readonly before?: string | string[];
|
||||
|
||||
/**
|
||||
* The group or groups the added items must come after
|
||||
*/
|
||||
readonly after?: string | string[];
|
||||
|
||||
/**
|
||||
* A number used to sort items with equal before/after requirements
|
||||
*/
|
||||
readonly sort?: number;
|
||||
|
||||
/**
|
||||
* If true, the array is not sorted automatically until sort() is called
|
||||
*/
|
||||
readonly manual?: boolean;
|
||||
}
|
||||
225
config/node_modules/@hapi/topo/lib/index.js
generated
vendored
Executable file
225
config/node_modules/@hapi/topo/lib/index.js
generated
vendored
Executable file
@ -0,0 +1,225 @@
|
||||
'use strict';
|
||||
|
||||
const Assert = require('@hapi/hoek/lib/assert');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
exports.Sorter = class {
|
||||
|
||||
constructor() {
|
||||
|
||||
this._items = [];
|
||||
this.nodes = [];
|
||||
}
|
||||
|
||||
add(nodes, options) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
// Validate rules
|
||||
|
||||
const before = [].concat(options.before || []);
|
||||
const after = [].concat(options.after || []);
|
||||
const group = options.group || '?';
|
||||
const sort = options.sort || 0; // Used for merging only
|
||||
|
||||
Assert(!before.includes(group), `Item cannot come before itself: ${group}`);
|
||||
Assert(!before.includes('?'), 'Item cannot come before unassociated items');
|
||||
Assert(!after.includes(group), `Item cannot come after itself: ${group}`);
|
||||
Assert(!after.includes('?'), 'Item cannot come after unassociated items');
|
||||
|
||||
if (!Array.isArray(nodes)) {
|
||||
nodes = [nodes];
|
||||
}
|
||||
|
||||
for (const node of nodes) {
|
||||
const item = {
|
||||
seq: this._items.length,
|
||||
sort,
|
||||
before,
|
||||
after,
|
||||
group,
|
||||
node
|
||||
};
|
||||
|
||||
this._items.push(item);
|
||||
}
|
||||
|
||||
// Insert event
|
||||
|
||||
if (!options.manual) {
|
||||
const valid = this._sort();
|
||||
Assert(valid, 'item', group !== '?' ? `added into group ${group}` : '', 'created a dependencies error');
|
||||
}
|
||||
|
||||
return this.nodes;
|
||||
}
|
||||
|
||||
merge(others) {
|
||||
|
||||
if (!Array.isArray(others)) {
|
||||
others = [others];
|
||||
}
|
||||
|
||||
for (const other of others) {
|
||||
if (other) {
|
||||
for (const item of other._items) {
|
||||
this._items.push(Object.assign({}, item)); // Shallow cloned
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sort items
|
||||
|
||||
this._items.sort(internals.mergeSort);
|
||||
for (let i = 0; i < this._items.length; ++i) {
|
||||
this._items[i].seq = i;
|
||||
}
|
||||
|
||||
const valid = this._sort();
|
||||
Assert(valid, 'merge created a dependencies error');
|
||||
|
||||
return this.nodes;
|
||||
}
|
||||
|
||||
sort() {
|
||||
|
||||
const valid = this._sort();
|
||||
Assert(valid, 'sort created a dependencies error');
|
||||
|
||||
return this.nodes;
|
||||
}
|
||||
|
||||
_sort() {
|
||||
|
||||
// Construct graph
|
||||
|
||||
const graph = {};
|
||||
const graphAfters = Object.create(null); // A prototype can bungle lookups w/ false positives
|
||||
const groups = Object.create(null);
|
||||
|
||||
for (const item of this._items) {
|
||||
const seq = item.seq; // Unique across all items
|
||||
const group = item.group;
|
||||
|
||||
// Determine Groups
|
||||
|
||||
groups[group] = groups[group] || [];
|
||||
groups[group].push(seq);
|
||||
|
||||
// Build intermediary graph using 'before'
|
||||
|
||||
graph[seq] = item.before;
|
||||
|
||||
// Build second intermediary graph with 'after'
|
||||
|
||||
for (const after of item.after) {
|
||||
graphAfters[after] = graphAfters[after] || [];
|
||||
graphAfters[after].push(seq);
|
||||
}
|
||||
}
|
||||
|
||||
// Expand intermediary graph
|
||||
|
||||
for (const node in graph) {
|
||||
const expandedGroups = [];
|
||||
|
||||
for (const graphNodeItem in graph[node]) {
|
||||
const group = graph[node][graphNodeItem];
|
||||
groups[group] = groups[group] || [];
|
||||
expandedGroups.push(...groups[group]);
|
||||
}
|
||||
|
||||
graph[node] = expandedGroups;
|
||||
}
|
||||
|
||||
// Merge intermediary graph using graphAfters into final graph
|
||||
|
||||
for (const group in graphAfters) {
|
||||
if (groups[group]) {
|
||||
for (const node of groups[group]) {
|
||||
graph[node].push(...graphAfters[group]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Compile ancestors
|
||||
|
||||
const ancestors = {};
|
||||
for (const node in graph) {
|
||||
const children = graph[node];
|
||||
for (const child of children) {
|
||||
ancestors[child] = ancestors[child] || [];
|
||||
ancestors[child].push(node);
|
||||
}
|
||||
}
|
||||
|
||||
// Topo sort
|
||||
|
||||
const visited = {};
|
||||
const sorted = [];
|
||||
|
||||
for (let i = 0; i < this._items.length; ++i) { // Looping through item.seq values out of order
|
||||
let next = i;
|
||||
|
||||
if (ancestors[i]) {
|
||||
next = null;
|
||||
for (let j = 0; j < this._items.length; ++j) { // As above, these are item.seq values
|
||||
if (visited[j] === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ancestors[j]) {
|
||||
ancestors[j] = [];
|
||||
}
|
||||
|
||||
const shouldSeeCount = ancestors[j].length;
|
||||
let seenCount = 0;
|
||||
for (let k = 0; k < shouldSeeCount; ++k) {
|
||||
if (visited[ancestors[j][k]]) {
|
||||
++seenCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (seenCount === shouldSeeCount) {
|
||||
next = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (next !== null) {
|
||||
visited[next] = true;
|
||||
sorted.push(next);
|
||||
}
|
||||
}
|
||||
|
||||
if (sorted.length !== this._items.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const seqIndex = {};
|
||||
for (const item of this._items) {
|
||||
seqIndex[item.seq] = item;
|
||||
}
|
||||
|
||||
this._items = [];
|
||||
this.nodes = [];
|
||||
|
||||
for (const value of sorted) {
|
||||
const sortedItem = seqIndex[value];
|
||||
this.nodes.push(sortedItem.node);
|
||||
this._items.push(sortedItem);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
internals.mergeSort = (a, b) => {
|
||||
|
||||
return a.sort === b.sort ? 0 : (a.sort < b.sort ? -1 : 1);
|
||||
};
|
||||
30
config/node_modules/@hapi/topo/package.json
generated
vendored
Executable file
30
config/node_modules/@hapi/topo/package.json
generated
vendored
Executable file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "@hapi/topo",
|
||||
"description": "Topological sorting with grouping support",
|
||||
"version": "5.1.0",
|
||||
"repository": "git://github.com/hapijs/topo",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"keywords": [
|
||||
"topological",
|
||||
"sort",
|
||||
"toposort",
|
||||
"topsort"
|
||||
],
|
||||
"dependencies": {
|
||||
"@hapi/hoek": "^9.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@hapi/code": "8.x.x",
|
||||
"@hapi/lab": "24.x.x",
|
||||
"typescript": "~4.0.2"
|
||||
},
|
||||
"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"
|
||||
}
|
||||
9
config/node_modules/@sideway/address/LICENSE.md
generated
vendored
Normal file
9
config/node_modules/@sideway/address/LICENSE.md
generated
vendored
Normal 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.
|
||||
14
config/node_modules/@sideway/address/README.md
generated
vendored
Executable file
14
config/node_modules/@sideway/address/README.md
generated
vendored
Executable file
@ -0,0 +1,14 @@
|
||||
# @sideway/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/)
|
||||
120
config/node_modules/@sideway/address/lib/decode.js
generated
vendored
Executable file
120
config/node_modules/@sideway/address/lib/decode.js
generated
vendored
Executable file
@ -0,0 +1,120 @@
|
||||
'use strict';
|
||||
|
||||
// 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/
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
exports.decode = function (string) {
|
||||
|
||||
let percentPos = string.indexOf('%');
|
||||
if (percentPos === -1) {
|
||||
return string;
|
||||
}
|
||||
|
||||
let decoded = '';
|
||||
let last = 0;
|
||||
let codepoint = 0;
|
||||
let startOfOctets = percentPos;
|
||||
let state = internals.utf8.accept;
|
||||
|
||||
while (percentPos > -1 &&
|
||||
percentPos < string.length) {
|
||||
|
||||
const high = internals.resolveHex(string[percentPos + 1], 4);
|
||||
const low = internals.resolveHex(string[percentPos + 2], 0);
|
||||
const byte = high | low;
|
||||
const type = internals.utf8.data[byte];
|
||||
state = internals.utf8.data[256 + state + type];
|
||||
codepoint = (codepoint << 6) | (byte & internals.utf8.data[364 + type]);
|
||||
|
||||
if (state === internals.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 === internals.utf8.reject) {
|
||||
return null;
|
||||
}
|
||||
|
||||
percentPos += 3;
|
||||
|
||||
if (percentPos >= string.length ||
|
||||
string[percentPos] !== '%') {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return decoded + string.slice(last);
|
||||
};
|
||||
|
||||
|
||||
internals.resolveHex = function (char, shift) {
|
||||
|
||||
const i = internals.hex[char];
|
||||
return i === undefined ? 255 : i << shift;
|
||||
};
|
||||
|
||||
|
||||
internals.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
|
||||
};
|
||||
|
||||
|
||||
internals.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
|
||||
]
|
||||
};
|
||||
123
config/node_modules/@sideway/address/lib/domain.js
generated
vendored
Executable file
123
config/node_modules/@sideway/address/lib/domain.js
generated
vendored
Executable file
@ -0,0 +1,123 @@
|
||||
'use strict';
|
||||
|
||||
const Url = require('url');
|
||||
|
||||
const Errors = require('./errors');
|
||||
|
||||
|
||||
const internals = {
|
||||
minDomainSegments: 2,
|
||||
nonAsciiRx: /[^\x00-\x7f]/,
|
||||
domainControlRx: /[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/, // Control + space + separators
|
||||
tldSegmentRx: /^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,
|
||||
domainSegmentRx: /^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,
|
||||
URL: Url.URL || URL // $lab:coverage:ignore$
|
||||
};
|
||||
|
||||
|
||||
exports.analyze = function (domain, options = {}) {
|
||||
|
||||
if (!domain) { // Catch null / undefined
|
||||
return Errors.code('DOMAIN_NON_EMPTY_STRING');
|
||||
}
|
||||
|
||||
if (typeof domain !== 'string') {
|
||||
throw new Error('Invalid input: domain must be a string');
|
||||
}
|
||||
|
||||
if (domain.length > 256) {
|
||||
return Errors.code('DOMAIN_TOO_LONG');
|
||||
}
|
||||
|
||||
const ascii = !internals.nonAsciiRx.test(domain);
|
||||
if (!ascii) {
|
||||
if (options.allowUnicode === false) { // Defaults to true
|
||||
return Errors.code('DOMAIN_INVALID_UNICODE_CHARS');
|
||||
}
|
||||
|
||||
domain = domain.normalize('NFC');
|
||||
}
|
||||
|
||||
if (internals.domainControlRx.test(domain)) {
|
||||
return Errors.code('DOMAIN_INVALID_CHARS');
|
||||
}
|
||||
|
||||
domain = internals.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 || internals.minDomainSegments;
|
||||
|
||||
const segments = domain.split('.');
|
||||
if (segments.length < minDomainSegments) {
|
||||
return Errors.code('DOMAIN_SEGMENTS_COUNT');
|
||||
}
|
||||
|
||||
if (options.maxDomainSegments) {
|
||||
if (segments.length > options.maxDomainSegments) {
|
||||
return Errors.code('DOMAIN_SEGMENTS_COUNT_MAX');
|
||||
}
|
||||
}
|
||||
|
||||
const tlds = options.tlds;
|
||||
if (tlds) {
|
||||
const tld = segments[segments.length - 1].toLowerCase();
|
||||
if (tlds.deny && tlds.deny.has(tld) ||
|
||||
tlds.allow && !tlds.allow.has(tld)) {
|
||||
|
||||
return Errors.code('DOMAIN_FORBIDDEN_TLDS');
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < segments.length; ++i) {
|
||||
const segment = segments[i];
|
||||
|
||||
if (!segment.length) {
|
||||
return Errors.code('DOMAIN_EMPTY_SEGMENT');
|
||||
}
|
||||
|
||||
if (segment.length > 63) {
|
||||
return Errors.code('DOMAIN_LONG_SEGMENT');
|
||||
}
|
||||
|
||||
if (i < segments.length - 1) {
|
||||
if (!internals.domainSegmentRx.test(segment)) {
|
||||
return Errors.code('DOMAIN_INVALID_CHARS');
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!internals.tldSegmentRx.test(segment)) {
|
||||
return Errors.code('DOMAIN_INVALID_TLDS_CHARS');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
exports.isValid = function (domain, options) {
|
||||
|
||||
return !exports.analyze(domain, options);
|
||||
};
|
||||
|
||||
|
||||
internals.punycode = function (domain) {
|
||||
|
||||
if (domain.includes('%')) {
|
||||
domain = domain.replace(/%/g, '%25');
|
||||
}
|
||||
|
||||
try {
|
||||
return new internals.URL(`http://${domain}`).host;
|
||||
}
|
||||
catch (err) {
|
||||
return domain;
|
||||
}
|
||||
};
|
||||
170
config/node_modules/@sideway/address/lib/email.js
generated
vendored
Executable file
170
config/node_modules/@sideway/address/lib/email.js
generated
vendored
Executable file
@ -0,0 +1,170 @@
|
||||
'use strict';
|
||||
|
||||
const Util = require('util');
|
||||
|
||||
const Domain = require('./domain');
|
||||
const Errors = require('./errors');
|
||||
|
||||
|
||||
const internals = {
|
||||
nonAsciiRx: /[^\x00-\x7f]/,
|
||||
encoder: new (Util.TextEncoder || TextEncoder)() // $lab:coverage:ignore$
|
||||
};
|
||||
|
||||
|
||||
exports.analyze = function (email, options) {
|
||||
|
||||
return internals.email(email, options);
|
||||
};
|
||||
|
||||
|
||||
exports.isValid = function (email, options) {
|
||||
|
||||
return !internals.email(email, options);
|
||||
};
|
||||
|
||||
|
||||
internals.email = function (email, options = {}) {
|
||||
|
||||
if (typeof email !== 'string') {
|
||||
throw new Error('Invalid input: email must be a string');
|
||||
}
|
||||
|
||||
if (!email) {
|
||||
return Errors.code('EMPTY_STRING');
|
||||
}
|
||||
|
||||
// Unicode
|
||||
|
||||
const ascii = !internals.nonAsciiRx.test(email);
|
||||
if (!ascii) {
|
||||
if (options.allowUnicode === false) { // Defaults to true
|
||||
return Errors.code('FORBIDDEN_UNICODE');
|
||||
}
|
||||
|
||||
email = email.normalize('NFC');
|
||||
}
|
||||
|
||||
// Basic structure
|
||||
|
||||
const parts = email.split('@');
|
||||
if (parts.length !== 2) {
|
||||
return parts.length > 2 ? Errors.code('MULTIPLE_AT_CHAR') : Errors.code('MISSING_AT_CHAR');
|
||||
}
|
||||
|
||||
const [local, domain] = parts;
|
||||
|
||||
if (!local) {
|
||||
return Errors.code('EMPTY_LOCAL');
|
||||
}
|
||||
|
||||
if (!options.ignoreLength) {
|
||||
if (email.length > 254) { // http://tools.ietf.org/html/rfc5321#section-4.5.3.1.3
|
||||
return Errors.code('ADDRESS_TOO_LONG');
|
||||
}
|
||||
|
||||
if (internals.encoder.encode(local).length > 64) { // http://tools.ietf.org/html/rfc5321#section-4.5.3.1.1
|
||||
return Errors.code('LOCAL_TOO_LONG');
|
||||
}
|
||||
}
|
||||
|
||||
// Validate parts
|
||||
|
||||
return internals.local(local, ascii) || Domain.analyze(domain, options);
|
||||
};
|
||||
|
||||
|
||||
internals.local = function (local, ascii) {
|
||||
|
||||
const segments = local.split('.');
|
||||
for (const segment of segments) {
|
||||
if (!segment.length) {
|
||||
return Errors.code('EMPTY_LOCAL_SEGMENT');
|
||||
}
|
||||
|
||||
if (ascii) {
|
||||
if (!internals.atextRx.test(segment)) {
|
||||
return Errors.code('INVALID_LOCAL_CHARS');
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const char of segment) {
|
||||
if (internals.atextRx.test(char)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const binary = internals.binary(char);
|
||||
if (!internals.atomRx.test(binary)) {
|
||||
return Errors.code('INVALID_LOCAL_CHARS');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
internals.binary = function (char) {
|
||||
|
||||
return Array.from(internals.encoder.encode(char)).map((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
|
||||
*/
|
||||
|
||||
|
||||
internals.atextRx = /^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/; // _ included in \w
|
||||
|
||||
|
||||
internals.atomRx = 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('|'));
|
||||
29
config/node_modules/@sideway/address/lib/errors.js
generated
vendored
Executable file
29
config/node_modules/@sideway/address/lib/errors.js
generated
vendored
Executable file
@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
exports.codes = {
|
||||
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'
|
||||
};
|
||||
|
||||
|
||||
exports.code = function (code) {
|
||||
|
||||
return { code, error: exports.codes[code] };
|
||||
};
|
||||
255
config/node_modules/@sideway/address/lib/index.d.ts
generated
vendored
Executable file
255
config/node_modules/@sideway/address/lib/index.d.ts
generated
vendored
Executable file
@ -0,0 +1,255 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as Hoek from '@hapi/hoek';
|
||||
|
||||
|
||||
export namespace domain {
|
||||
|
||||
/**
|
||||
* 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 analyze(domain: string, options?: Options): 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.
|
||||
*/
|
||||
function isValid(domain: string, options?: Options): boolean;
|
||||
|
||||
interface Options {
|
||||
|
||||
/**
|
||||
* Determines whether Unicode characters are allowed.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
readonly allowUnicode?: boolean;
|
||||
|
||||
/**
|
||||
* 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?: Tlds.Allow | Tlds.Deny | boolean;
|
||||
}
|
||||
|
||||
namespace Tlds {
|
||||
|
||||
interface Allow {
|
||||
|
||||
readonly allow: Set<string> | true;
|
||||
}
|
||||
|
||||
interface Deny {
|
||||
|
||||
readonly deny: Set<string>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export namespace email {
|
||||
|
||||
/**
|
||||
* 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 analyze(email: string, options?: Options): 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.
|
||||
*/
|
||||
function isValid(email: string, options?: Options): boolean;
|
||||
|
||||
interface Options extends domain.Options {
|
||||
|
||||
/**
|
||||
* Determines whether to ignore the standards maximum email length limit.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly ignoreLength?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export interface Analysis {
|
||||
|
||||
/**
|
||||
* The reason validation failed.
|
||||
*/
|
||||
error: string;
|
||||
|
||||
/**
|
||||
* The error code.
|
||||
*/
|
||||
code: string;
|
||||
}
|
||||
|
||||
|
||||
export const errors: Record<string, string>;
|
||||
|
||||
|
||||
export namespace ip {
|
||||
|
||||
/**
|
||||
* Generates a regular expression used to validate IP addresses.
|
||||
*
|
||||
* @param options - optional settings.
|
||||
*
|
||||
* @returns an object with the regular expression and meta data.
|
||||
*/
|
||||
function regex(options?: Options): Expression;
|
||||
|
||||
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[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export namespace uri {
|
||||
|
||||
/**
|
||||
* Faster version of decodeURIComponent() that does not throw.
|
||||
*
|
||||
* @param string - the URL string to decode.
|
||||
*
|
||||
* @returns the decoded string or null if invalid.
|
||||
*/
|
||||
function decode(string: string): 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.
|
||||
*/
|
||||
function regex(options?: Options): Expression;
|
||||
|
||||
type Options = Hoek.ts.XOR<Options.Options, Options.Relative>;
|
||||
|
||||
namespace Options {
|
||||
|
||||
interface Query {
|
||||
|
||||
/**
|
||||
* Allow the use of [] in query parameters.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly allowQuerySquareBrackets?: boolean;
|
||||
}
|
||||
|
||||
interface Relative extends Query {
|
||||
|
||||
/**
|
||||
* Requires the URI to be relative.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly relativeOnly?: boolean;
|
||||
}
|
||||
|
||||
interface Options extends Query {
|
||||
|
||||
/**
|
||||
* Allow relative URIs.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly allowRelative?: boolean;
|
||||
|
||||
/**
|
||||
* Capture domain segment ($1).
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly domain?: boolean;
|
||||
|
||||
/**
|
||||
* The allowed URI schemes.
|
||||
*/
|
||||
readonly scheme?: Scheme | Scheme[];
|
||||
}
|
||||
|
||||
type Scheme = string | RegExp;
|
||||
}
|
||||
|
||||
interface Expression {
|
||||
|
||||
/**
|
||||
* The raw regular expression string.
|
||||
*/
|
||||
raw: string;
|
||||
|
||||
/**
|
||||
* The regular expression.
|
||||
*/
|
||||
regex: RegExp;
|
||||
}
|
||||
}
|
||||
97
config/node_modules/@sideway/address/lib/index.js
generated
vendored
Executable file
97
config/node_modules/@sideway/address/lib/index.js
generated
vendored
Executable file
@ -0,0 +1,97 @@
|
||||
'use strict';
|
||||
|
||||
const Decode = require('./decode');
|
||||
const Domain = require('./domain');
|
||||
const Email = require('./email');
|
||||
const Errors = require('./errors');
|
||||
const Ip = require('./ip');
|
||||
const Tlds = require('./tlds');
|
||||
const Uri = require('./uri');
|
||||
|
||||
|
||||
const internals = {
|
||||
defaultTlds: { allow: Tlds, deny: null }
|
||||
};
|
||||
|
||||
|
||||
module.exports = {
|
||||
errors: Errors.codes,
|
||||
|
||||
domain: {
|
||||
analyze(domain, options) {
|
||||
|
||||
options = internals.options(options);
|
||||
return Domain.analyze(domain, options);
|
||||
},
|
||||
|
||||
isValid(domain, options) {
|
||||
|
||||
options = internals.options(options);
|
||||
return Domain.isValid(domain, options);
|
||||
}
|
||||
},
|
||||
email: {
|
||||
analyze(email, options) {
|
||||
|
||||
options = internals.options(options);
|
||||
return Email.analyze(email, options);
|
||||
},
|
||||
|
||||
isValid(email, options) {
|
||||
|
||||
options = internals.options(options);
|
||||
return Email.isValid(email, options);
|
||||
}
|
||||
},
|
||||
ip: {
|
||||
regex: Ip.regex
|
||||
},
|
||||
uri: {
|
||||
decode: Decode.decode,
|
||||
regex: Uri.regex
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
internals.options = function (options) {
|
||||
|
||||
if (!options) {
|
||||
return { tlds: internals.defaultTlds };
|
||||
}
|
||||
|
||||
if (options.tlds === false) { // Defaults to true
|
||||
return options;
|
||||
}
|
||||
|
||||
if (!options.tlds ||
|
||||
options.tlds === true) {
|
||||
|
||||
return Object.assign({}, options, { tlds: internals.defaultTlds });
|
||||
}
|
||||
|
||||
if (typeof options.tlds !== 'object') {
|
||||
throw new Error('Invalid options: tlds must be a boolean or an object');
|
||||
}
|
||||
|
||||
if (options.tlds.deny) {
|
||||
if (options.tlds.deny instanceof Set === false) {
|
||||
throw new Error('Invalid options: tlds.deny must be a Set object');
|
||||
}
|
||||
|
||||
if (options.tlds.allow) {
|
||||
throw new Error('Invalid options: cannot specify both tlds.allow and tlds.deny lists');
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
if (options.tlds.allow === true) {
|
||||
return Object.assign({}, options, { tlds: internals.defaultTlds });
|
||||
}
|
||||
|
||||
if (options.tlds.allow instanceof Set === false) {
|
||||
throw new Error('Invalid options: tlds.allow must be a Set object or true');
|
||||
}
|
||||
|
||||
return options;
|
||||
};
|
||||
63
config/node_modules/@sideway/address/lib/ip.js
generated
vendored
Executable file
63
config/node_modules/@sideway/address/lib/ip.js
generated
vendored
Executable file
@ -0,0 +1,63 @@
|
||||
'use strict';
|
||||
|
||||
const Assert = require('@hapi/hoek/lib/assert');
|
||||
|
||||
const Uri = require('./uri');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
exports.regex = function (options = {}) {
|
||||
|
||||
// CIDR
|
||||
|
||||
Assert(options.cidr === undefined || typeof options.cidr === 'string', 'options.cidr must be a string');
|
||||
const cidr = options.cidr ? options.cidr.toLowerCase() : '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 (let i = 0; i < versions.length; ++i) {
|
||||
Assert(typeof versions[i] === 'string', 'options.version must only contain strings');
|
||||
versions[i] = versions[i].toLowerCase();
|
||||
Assert(['ipv4', 'ipv6', 'ipvfuture'].includes(versions[i]), 'options.version contains unknown version ' + versions[i] + ' - 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.ip[version];
|
||||
}
|
||||
|
||||
// Required
|
||||
|
||||
const cidrpart = `\\/${version === 'ipv4' ? Uri.ip.v4Cidr : Uri.ip.v6Cidr}`;
|
||||
|
||||
if (cidr === 'required') {
|
||||
return `${Uri.ip[version]}${cidrpart}`;
|
||||
}
|
||||
|
||||
// Optional
|
||||
|
||||
return `${Uri.ip[version]}(?:${cidrpart})?`;
|
||||
});
|
||||
|
||||
const raw = `(?:${parts.join('|')})`;
|
||||
const regex = new RegExp(`^${raw}$`);
|
||||
return { cidr, versions, regex, raw };
|
||||
};
|
||||
1468
config/node_modules/@sideway/address/lib/tlds.js
generated
vendored
Executable file
1468
config/node_modules/@sideway/address/lib/tlds.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load Diff
207
config/node_modules/@sideway/address/lib/uri.js
generated
vendored
Executable file
207
config/node_modules/@sideway/address/lib/uri.js
generated
vendored
Executable file
@ -0,0 +1,207 @@
|
||||
'use strict';
|
||||
|
||||
const Assert = require('@hapi/hoek/lib/assert');
|
||||
const EscapeRegex = require('@hapi/hoek/lib/escapeRegex');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
internals.generate = function () {
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
internals.rfc3986 = internals.generate();
|
||||
|
||||
|
||||
exports.ip = {
|
||||
v4Cidr: internals.rfc3986.ipv4Cidr,
|
||||
v6Cidr: internals.rfc3986.ipv6Cidr,
|
||||
ipv4: internals.rfc3986.ipv4address,
|
||||
ipv6: internals.rfc3986.ipv6address,
|
||||
ipvfuture: internals.rfc3986.ipvFuture
|
||||
};
|
||||
|
||||
|
||||
internals.createRegex = function (options) {
|
||||
|
||||
const rfc = internals.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 internals.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 internals.wrap(prefix + suffix, customScheme);
|
||||
};
|
||||
|
||||
|
||||
internals.wrap = function (raw, scheme) {
|
||||
|
||||
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
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
internals.uriRegex = internals.createRegex({});
|
||||
|
||||
|
||||
exports.regex = function (options = {}) {
|
||||
|
||||
if (options.scheme ||
|
||||
options.allowRelative ||
|
||||
options.relativeOnly ||
|
||||
options.allowQuerySquareBrackets ||
|
||||
options.domain) {
|
||||
|
||||
return internals.createRegex(options);
|
||||
}
|
||||
|
||||
return internals.uriRegex;
|
||||
};
|
||||
30
config/node_modules/@sideway/address/package.json
generated
vendored
Executable file
30
config/node_modules/@sideway/address/package.json
generated
vendored
Executable file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "@sideway/address",
|
||||
"description": "Email address and domain validation",
|
||||
"version": "4.1.5",
|
||||
"repository": "git://github.com/sideway/address",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"keywords": [
|
||||
"email",
|
||||
"domain",
|
||||
"address",
|
||||
"validation"
|
||||
],
|
||||
"dependencies": {
|
||||
"@hapi/hoek": "^9.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "4.0.x",
|
||||
"@hapi/code": "8.x.x",
|
||||
"@hapi/lab": "24.x.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"
|
||||
}
|
||||
9
config/node_modules/@sideway/formula/LICENSE.md
generated
vendored
Normal file
9
config/node_modules/@sideway/formula/LICENSE.md
generated
vendored
Normal 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
config/node_modules/@sideway/formula/README.md
generated
vendored
Executable file
18
config/node_modules/@sideway/formula/README.md
generated
vendored
Executable 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
config/node_modules/@sideway/formula/lib/index.d.ts
generated
vendored
Executable file
52
config/node_modules/@sideway/formula/lib/index.d.ts
generated
vendored
Executable 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
config/node_modules/@sideway/formula/lib/index.js
generated
vendored
Executable file
456
config/node_modules/@sideway/formula/lib/index.js
generated
vendored
Executable 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;
|
||||
};
|
||||
28
config/node_modules/@sideway/formula/package.json
generated
vendored
Executable file
28
config/node_modules/@sideway/formula/package.json
generated
vendored
Executable file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "@sideway/formula",
|
||||
"description": "Math and string formula parser.",
|
||||
"version": "3.0.1",
|
||||
"repository": "git://github.com/sideway/formula",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"keywords": [
|
||||
"formula",
|
||||
"parser",
|
||||
"math",
|
||||
"string"
|
||||
],
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"typescript": "4.0.x",
|
||||
"@hapi/code": "8.x.x",
|
||||
"@hapi/lab": "24.x.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"
|
||||
}
|
||||
10
config/node_modules/@sideway/pinpoint/LICENSE.md
generated
vendored
Executable file
10
config/node_modules/@sideway/pinpoint/LICENSE.md
generated
vendored
Executable file
@ -0,0 +1,10 @@
|
||||
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 OFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
14
config/node_modules/@sideway/pinpoint/README.md
generated
vendored
Executable file
14
config/node_modules/@sideway/pinpoint/README.md
generated
vendored
Executable file
@ -0,0 +1,14 @@
|
||||
# @sideway/pinpoint
|
||||
|
||||
#### Return the filename and line number of the calling function.
|
||||
|
||||
**pinpoint** 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/pinpoint/)
|
||||
- [Version status](https://joi.dev/resources/status/#pinpoint) (builds, dependencies, node versions, licenses, eol)
|
||||
- [Changelog](https://joi.dev/module/pinpoint/changelog/)
|
||||
- [Project policies](https://joi.dev/policies/)
|
||||
24
config/node_modules/@sideway/pinpoint/lib/index.d.ts
generated
vendored
Executable file
24
config/node_modules/@sideway/pinpoint/lib/index.d.ts
generated
vendored
Executable file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
Returns the filename and line number of the caller in the call stack
|
||||
|
||||
@param depth - The distance from the location function in the call stack. Defaults to 1 (caller).
|
||||
|
||||
@return an object with the filename and line number.
|
||||
*/
|
||||
export function location(depth?: number): location.Location;
|
||||
|
||||
declare namespace location {
|
||||
|
||||
interface Location {
|
||||
|
||||
/**
|
||||
The fully qualified filename.
|
||||
*/
|
||||
readonly filename: string;
|
||||
|
||||
/**
|
||||
The file line number.
|
||||
*/
|
||||
readonly line: number;
|
||||
}
|
||||
}
|
||||
21
config/node_modules/@sideway/pinpoint/lib/index.js
generated
vendored
Executable file
21
config/node_modules/@sideway/pinpoint/lib/index.js
generated
vendored
Executable file
@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
exports.location = function (depth = 0) {
|
||||
|
||||
const orig = Error.prepareStackTrace;
|
||||
Error.prepareStackTrace = (ignore, stack) => stack;
|
||||
|
||||
const capture = {};
|
||||
Error.captureStackTrace(capture, this);
|
||||
const line = capture.stack[depth + 1];
|
||||
|
||||
Error.prepareStackTrace = orig;
|
||||
|
||||
return {
|
||||
filename: line.getFileName(),
|
||||
line: line.getLineNumber()
|
||||
};
|
||||
};
|
||||
25
config/node_modules/@sideway/pinpoint/package.json
generated
vendored
Executable file
25
config/node_modules/@sideway/pinpoint/package.json
generated
vendored
Executable file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "@sideway/pinpoint",
|
||||
"description": "Return the filename and line number of the calling function",
|
||||
"version": "2.0.0",
|
||||
"repository": "git://github.com/sideway/pinpoint",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"keywords": [
|
||||
"utilities"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"typescript": "4.0.x",
|
||||
"@hapi/code": "8.x.x",
|
||||
"@hapi/lab": "24.x.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"
|
||||
}
|
||||
21
config/node_modules/@types/joi/LICENSE
generated
vendored
Normal file
21
config/node_modules/@types/joi/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
||||
3
config/node_modules/@types/joi/README.md
generated
vendored
Normal file
3
config/node_modules/@types/joi/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
This is a stub types definition for @types/joi (https://github.com/sideway/joi#readme).
|
||||
|
||||
joi provides its own type definitions, so you don't need @types/joi installed!
|
||||
13
config/node_modules/@types/joi/package.json
generated
vendored
Normal file
13
config/node_modules/@types/joi/package.json
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "@types/joi",
|
||||
"version": "17.2.3",
|
||||
"typings": null,
|
||||
"description": "Stub TypeScript definitions entry for joi, which provides its own types definitions",
|
||||
"main": "",
|
||||
"scripts": {},
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"joi": "*"
|
||||
}
|
||||
}
|
||||
21
config/node_modules/@types/node/LICENSE
generated
vendored
Normal file
21
config/node_modules/@types/node/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
||||
15
config/node_modules/@types/node/README.md
generated
vendored
Normal file
15
config/node_modules/@types/node/README.md
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
# Installation
|
||||
> `npm install --save @types/node`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for node (https://nodejs.org/).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Thu, 16 Jan 2025 00:46:49 GMT
|
||||
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky).
|
||||
1040
config/node_modules/@types/node/assert.d.ts
generated
vendored
Normal file
1040
config/node_modules/@types/node/assert.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8
config/node_modules/@types/node/assert/strict.d.ts
generated
vendored
Normal file
8
config/node_modules/@types/node/assert/strict.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
declare module "assert/strict" {
|
||||
import { strict } from "node:assert";
|
||||
export = strict;
|
||||
}
|
||||
declare module "node:assert/strict" {
|
||||
import { strict } from "node:assert";
|
||||
export = strict;
|
||||
}
|
||||
541
config/node_modules/@types/node/async_hooks.d.ts
generated
vendored
Normal file
541
config/node_modules/@types/node/async_hooks.d.ts
generated
vendored
Normal file
@ -0,0 +1,541 @@
|
||||
/**
|
||||
* We strongly discourage the use of the `async_hooks` API.
|
||||
* Other APIs that can cover most of its use cases include:
|
||||
*
|
||||
* * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v22.x/api/async_context.html#class-asynclocalstorage) tracks async context
|
||||
* * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v22.x/api/process.html#processgetactiveresourcesinfo) tracks active resources
|
||||
*
|
||||
* The `node:async_hooks` module provides an API to track asynchronous resources.
|
||||
* It can be accessed using:
|
||||
*
|
||||
* ```js
|
||||
* import async_hooks from 'node:async_hooks';
|
||||
* ```
|
||||
* @experimental
|
||||
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/async_hooks.js)
|
||||
*/
|
||||
declare module "async_hooks" {
|
||||
/**
|
||||
* ```js
|
||||
* import { executionAsyncId } from 'node:async_hooks';
|
||||
* import fs from 'node:fs';
|
||||
*
|
||||
* console.log(executionAsyncId()); // 1 - bootstrap
|
||||
* const path = '.';
|
||||
* fs.open(path, 'r', (err, fd) => {
|
||||
* console.log(executionAsyncId()); // 6 - open()
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* The ID returned from `executionAsyncId()` is related to execution timing, not
|
||||
* causality (which is covered by `triggerAsyncId()`):
|
||||
*
|
||||
* ```js
|
||||
* const server = net.createServer((conn) => {
|
||||
* // Returns the ID of the server, not of the new connection, because the
|
||||
* // callback runs in the execution scope of the server's MakeCallback().
|
||||
* async_hooks.executionAsyncId();
|
||||
*
|
||||
* }).listen(port, () => {
|
||||
* // Returns the ID of a TickObject (process.nextTick()) because all
|
||||
* // callbacks passed to .listen() are wrapped in a nextTick().
|
||||
* async_hooks.executionAsyncId();
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Promise contexts may not get precise `executionAsyncIds` by default.
|
||||
* See the section on [promise execution tracking](https://nodejs.org/docs/latest-v22.x/api/async_hooks.html#promise-execution-tracking).
|
||||
* @since v8.1.0
|
||||
* @return The `asyncId` of the current execution context. Useful to track when something calls.
|
||||
*/
|
||||
function executionAsyncId(): number;
|
||||
/**
|
||||
* Resource objects returned by `executionAsyncResource()` are most often internal
|
||||
* Node.js handle objects with undocumented APIs. Using any functions or properties
|
||||
* on the object is likely to crash your application and should be avoided.
|
||||
*
|
||||
* Using `executionAsyncResource()` in the top-level execution context will
|
||||
* return an empty object as there is no handle or request object to use,
|
||||
* but having an object representing the top-level can be helpful.
|
||||
*
|
||||
* ```js
|
||||
* import { open } from 'node:fs';
|
||||
* import { executionAsyncId, executionAsyncResource } from 'node:async_hooks';
|
||||
*
|
||||
* console.log(executionAsyncId(), executionAsyncResource()); // 1 {}
|
||||
* open(new URL(import.meta.url), 'r', (err, fd) => {
|
||||
* console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* This can be used to implement continuation local storage without the
|
||||
* use of a tracking `Map` to store the metadata:
|
||||
*
|
||||
* ```js
|
||||
* import { createServer } from 'node:http';
|
||||
* import {
|
||||
* executionAsyncId,
|
||||
* executionAsyncResource,
|
||||
* createHook,
|
||||
* } from 'node:async_hooks';
|
||||
* const sym = Symbol('state'); // Private symbol to avoid pollution
|
||||
*
|
||||
* createHook({
|
||||
* init(asyncId, type, triggerAsyncId, resource) {
|
||||
* const cr = executionAsyncResource();
|
||||
* if (cr) {
|
||||
* resource[sym] = cr[sym];
|
||||
* }
|
||||
* },
|
||||
* }).enable();
|
||||
*
|
||||
* const server = createServer((req, res) => {
|
||||
* executionAsyncResource()[sym] = { state: req.url };
|
||||
* setTimeout(function() {
|
||||
* res.end(JSON.stringify(executionAsyncResource()[sym]));
|
||||
* }, 100);
|
||||
* }).listen(3000);
|
||||
* ```
|
||||
* @since v13.9.0, v12.17.0
|
||||
* @return The resource representing the current execution. Useful to store data within the resource.
|
||||
*/
|
||||
function executionAsyncResource(): object;
|
||||
/**
|
||||
* ```js
|
||||
* const server = net.createServer((conn) => {
|
||||
* // The resource that caused (or triggered) this callback to be called
|
||||
* // was that of the new connection. Thus the return value of triggerAsyncId()
|
||||
* // is the asyncId of "conn".
|
||||
* async_hooks.triggerAsyncId();
|
||||
*
|
||||
* }).listen(port, () => {
|
||||
* // Even though all callbacks passed to .listen() are wrapped in a nextTick()
|
||||
* // the callback itself exists because the call to the server's .listen()
|
||||
* // was made. So the return value would be the ID of the server.
|
||||
* async_hooks.triggerAsyncId();
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Promise contexts may not get valid `triggerAsyncId`s by default. See
|
||||
* the section on [promise execution tracking](https://nodejs.org/docs/latest-v22.x/api/async_hooks.html#promise-execution-tracking).
|
||||
* @return The ID of the resource responsible for calling the callback that is currently being executed.
|
||||
*/
|
||||
function triggerAsyncId(): number;
|
||||
interface HookCallbacks {
|
||||
/**
|
||||
* Called when a class is constructed that has the possibility to emit an asynchronous event.
|
||||
* @param asyncId A unique ID for the async resource
|
||||
* @param type The type of the async resource
|
||||
* @param triggerAsyncId The unique ID of the async resource in whose execution context this async resource was created
|
||||
* @param resource Reference to the resource representing the async operation, needs to be released during destroy
|
||||
*/
|
||||
init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
|
||||
/**
|
||||
* When an asynchronous operation is initiated or completes a callback is called to notify the user.
|
||||
* The before callback is called just before said callback is executed.
|
||||
* @param asyncId the unique identifier assigned to the resource about to execute the callback.
|
||||
*/
|
||||
before?(asyncId: number): void;
|
||||
/**
|
||||
* Called immediately after the callback specified in `before` is completed.
|
||||
*
|
||||
* If an uncaught exception occurs during execution of the callback, then `after` will run after the `'uncaughtException'` event is emitted or a `domain`'s handler runs.
|
||||
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
|
||||
*/
|
||||
after?(asyncId: number): void;
|
||||
/**
|
||||
* Called when a promise has resolve() called. This may not be in the same execution id
|
||||
* as the promise itself.
|
||||
* @param asyncId the unique id for the promise that was resolve()d.
|
||||
*/
|
||||
promiseResolve?(asyncId: number): void;
|
||||
/**
|
||||
* Called after the resource corresponding to asyncId is destroyed
|
||||
* @param asyncId a unique ID for the async resource
|
||||
*/
|
||||
destroy?(asyncId: number): void;
|
||||
}
|
||||
interface AsyncHook {
|
||||
/**
|
||||
* Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
|
||||
*/
|
||||
enable(): this;
|
||||
/**
|
||||
* Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
|
||||
*/
|
||||
disable(): this;
|
||||
}
|
||||
/**
|
||||
* Registers functions to be called for different lifetime events of each async
|
||||
* operation.
|
||||
*
|
||||
* The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the
|
||||
* respective asynchronous event during a resource's lifetime.
|
||||
*
|
||||
* All callbacks are optional. For example, if only resource cleanup needs to
|
||||
* be tracked, then only the `destroy` callback needs to be passed. The
|
||||
* specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
|
||||
*
|
||||
* ```js
|
||||
* import { createHook } from 'node:async_hooks';
|
||||
*
|
||||
* const asyncHook = createHook({
|
||||
* init(asyncId, type, triggerAsyncId, resource) { },
|
||||
* destroy(asyncId) { },
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* The callbacks will be inherited via the prototype chain:
|
||||
*
|
||||
* ```js
|
||||
* class MyAsyncCallbacks {
|
||||
* init(asyncId, type, triggerAsyncId, resource) { }
|
||||
* destroy(asyncId) {}
|
||||
* }
|
||||
*
|
||||
* class MyAddedCallbacks extends MyAsyncCallbacks {
|
||||
* before(asyncId) { }
|
||||
* after(asyncId) { }
|
||||
* }
|
||||
*
|
||||
* const asyncHook = async_hooks.createHook(new MyAddedCallbacks());
|
||||
* ```
|
||||
*
|
||||
* Because promises are asynchronous resources whose lifecycle is tracked
|
||||
* via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises.
|
||||
* @since v8.1.0
|
||||
* @param callbacks The `Hook Callbacks` to register
|
||||
* @return Instance used for disabling and enabling hooks
|
||||
*/
|
||||
function createHook(callbacks: HookCallbacks): AsyncHook;
|
||||
interface AsyncResourceOptions {
|
||||
/**
|
||||
* The ID of the execution context that created this async event.
|
||||
* @default executionAsyncId()
|
||||
*/
|
||||
triggerAsyncId?: number | undefined;
|
||||
/**
|
||||
* Disables automatic `emitDestroy` when the object is garbage collected.
|
||||
* This usually does not need to be set (even if `emitDestroy` is called
|
||||
* manually), unless the resource's `asyncId` is retrieved and the
|
||||
* sensitive API's `emitDestroy` is called with it.
|
||||
* @default false
|
||||
*/
|
||||
requireManualDestroy?: boolean | undefined;
|
||||
}
|
||||
/**
|
||||
* The class `AsyncResource` is designed to be extended by the embedder's async
|
||||
* resources. Using this, users can easily trigger the lifetime events of their
|
||||
* own resources.
|
||||
*
|
||||
* The `init` hook will trigger when an `AsyncResource` is instantiated.
|
||||
*
|
||||
* The following is an overview of the `AsyncResource` API.
|
||||
*
|
||||
* ```js
|
||||
* import { AsyncResource, executionAsyncId } from 'node:async_hooks';
|
||||
*
|
||||
* // AsyncResource() is meant to be extended. Instantiating a
|
||||
* // new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
||||
* // async_hook.executionAsyncId() is used.
|
||||
* const asyncResource = new AsyncResource(
|
||||
* type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false },
|
||||
* );
|
||||
*
|
||||
* // Run a function in the execution context of the resource. This will
|
||||
* // * establish the context of the resource
|
||||
* // * trigger the AsyncHooks before callbacks
|
||||
* // * call the provided function `fn` with the supplied arguments
|
||||
* // * trigger the AsyncHooks after callbacks
|
||||
* // * restore the original execution context
|
||||
* asyncResource.runInAsyncScope(fn, thisArg, ...args);
|
||||
*
|
||||
* // Call AsyncHooks destroy callbacks.
|
||||
* asyncResource.emitDestroy();
|
||||
*
|
||||
* // Return the unique ID assigned to the AsyncResource instance.
|
||||
* asyncResource.asyncId();
|
||||
*
|
||||
* // Return the trigger ID for the AsyncResource instance.
|
||||
* asyncResource.triggerAsyncId();
|
||||
* ```
|
||||
*/
|
||||
class AsyncResource {
|
||||
/**
|
||||
* AsyncResource() is meant to be extended. Instantiating a
|
||||
* new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
||||
* async_hook.executionAsyncId() is used.
|
||||
* @param type The type of async event.
|
||||
* @param triggerAsyncId The ID of the execution context that created
|
||||
* this async event (default: `executionAsyncId()`), or an
|
||||
* AsyncResourceOptions object (since v9.3.0)
|
||||
*/
|
||||
constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions);
|
||||
/**
|
||||
* Binds the given function to the current execution context.
|
||||
* @since v14.8.0, v12.19.0
|
||||
* @param fn The function to bind to the current execution context.
|
||||
* @param type An optional name to associate with the underlying `AsyncResource`.
|
||||
*/
|
||||
static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>(
|
||||
fn: Func,
|
||||
type?: string,
|
||||
thisArg?: ThisArg,
|
||||
): Func;
|
||||
/**
|
||||
* Binds the given function to execute to this `AsyncResource`'s scope.
|
||||
* @since v14.8.0, v12.19.0
|
||||
* @param fn The function to bind to the current `AsyncResource`.
|
||||
*/
|
||||
bind<Func extends (...args: any[]) => any>(fn: Func): Func;
|
||||
/**
|
||||
* Call the provided function with the provided arguments in the execution context
|
||||
* of the async resource. This will establish the context, trigger the AsyncHooks
|
||||
* before callbacks, call the function, trigger the AsyncHooks after callbacks, and
|
||||
* then restore the original execution context.
|
||||
* @since v9.6.0
|
||||
* @param fn The function to call in the execution context of this async resource.
|
||||
* @param thisArg The receiver to be used for the function call.
|
||||
* @param args Optional arguments to pass to the function.
|
||||
*/
|
||||
runInAsyncScope<This, Result>(
|
||||
fn: (this: This, ...args: any[]) => Result,
|
||||
thisArg?: This,
|
||||
...args: any[]
|
||||
): Result;
|
||||
/**
|
||||
* Call all `destroy` hooks. This should only ever be called once. An error will
|
||||
* be thrown if it is called more than once. This **must** be manually called. If
|
||||
* the resource is left to be collected by the GC then the `destroy` hooks will
|
||||
* never be called.
|
||||
* @return A reference to `asyncResource`.
|
||||
*/
|
||||
emitDestroy(): this;
|
||||
/**
|
||||
* @return The unique `asyncId` assigned to the resource.
|
||||
*/
|
||||
asyncId(): number;
|
||||
/**
|
||||
* @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor.
|
||||
*/
|
||||
triggerAsyncId(): number;
|
||||
}
|
||||
/**
|
||||
* This class creates stores that stay coherent through asynchronous operations.
|
||||
*
|
||||
* While you can create your own implementation on top of the `node:async_hooks` module, `AsyncLocalStorage` should be preferred as it is a performant and memory
|
||||
* safe implementation that involves significant optimizations that are non-obvious
|
||||
* to implement.
|
||||
*
|
||||
* The following example uses `AsyncLocalStorage` to build a simple logger
|
||||
* that assigns IDs to incoming HTTP requests and includes them in messages
|
||||
* logged within each request.
|
||||
*
|
||||
* ```js
|
||||
* import http from 'node:http';
|
||||
* import { AsyncLocalStorage } from 'node:async_hooks';
|
||||
*
|
||||
* const asyncLocalStorage = new AsyncLocalStorage();
|
||||
*
|
||||
* function logWithId(msg) {
|
||||
* const id = asyncLocalStorage.getStore();
|
||||
* console.log(`${id !== undefined ? id : '-'}:`, msg);
|
||||
* }
|
||||
*
|
||||
* let idSeq = 0;
|
||||
* http.createServer((req, res) => {
|
||||
* asyncLocalStorage.run(idSeq++, () => {
|
||||
* logWithId('start');
|
||||
* // Imagine any chain of async operations here
|
||||
* setImmediate(() => {
|
||||
* logWithId('finish');
|
||||
* res.end();
|
||||
* });
|
||||
* });
|
||||
* }).listen(8080);
|
||||
*
|
||||
* http.get('http://localhost:8080');
|
||||
* http.get('http://localhost:8080');
|
||||
* // Prints:
|
||||
* // 0: start
|
||||
* // 1: start
|
||||
* // 0: finish
|
||||
* // 1: finish
|
||||
* ```
|
||||
*
|
||||
* Each instance of `AsyncLocalStorage` maintains an independent storage context.
|
||||
* Multiple instances can safely exist simultaneously without risk of interfering
|
||||
* with each other's data.
|
||||
* @since v13.10.0, v12.17.0
|
||||
*/
|
||||
class AsyncLocalStorage<T> {
|
||||
/**
|
||||
* Binds the given function to the current execution context.
|
||||
* @since v19.8.0
|
||||
* @experimental
|
||||
* @param fn The function to bind to the current execution context.
|
||||
* @return A new function that calls `fn` within the captured execution context.
|
||||
*/
|
||||
static bind<Func extends (...args: any[]) => any>(fn: Func): Func;
|
||||
/**
|
||||
* Captures the current execution context and returns a function that accepts a
|
||||
* function as an argument. Whenever the returned function is called, it
|
||||
* calls the function passed to it within the captured context.
|
||||
*
|
||||
* ```js
|
||||
* const asyncLocalStorage = new AsyncLocalStorage();
|
||||
* const runInAsyncScope = asyncLocalStorage.run(123, () => AsyncLocalStorage.snapshot());
|
||||
* const result = asyncLocalStorage.run(321, () => runInAsyncScope(() => asyncLocalStorage.getStore()));
|
||||
* console.log(result); // returns 123
|
||||
* ```
|
||||
*
|
||||
* AsyncLocalStorage.snapshot() can replace the use of AsyncResource for simple
|
||||
* async context tracking purposes, for example:
|
||||
*
|
||||
* ```js
|
||||
* class Foo {
|
||||
* #runInAsyncScope = AsyncLocalStorage.snapshot();
|
||||
*
|
||||
* get() { return this.#runInAsyncScope(() => asyncLocalStorage.getStore()); }
|
||||
* }
|
||||
*
|
||||
* const foo = asyncLocalStorage.run(123, () => new Foo());
|
||||
* console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123
|
||||
* ```
|
||||
* @since v19.8.0
|
||||
* @experimental
|
||||
* @return A new function with the signature `(fn: (...args) : R, ...args) : R`.
|
||||
*/
|
||||
static snapshot(): <R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R;
|
||||
/**
|
||||
* Disables the instance of `AsyncLocalStorage`. All subsequent calls
|
||||
* to `asyncLocalStorage.getStore()` will return `undefined` until `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
|
||||
*
|
||||
* When calling `asyncLocalStorage.disable()`, all current contexts linked to the
|
||||
* instance will be exited.
|
||||
*
|
||||
* Calling `asyncLocalStorage.disable()` is required before the `asyncLocalStorage` can be garbage collected. This does not apply to stores
|
||||
* provided by the `asyncLocalStorage`, as those objects are garbage collected
|
||||
* along with the corresponding async resources.
|
||||
*
|
||||
* Use this method when the `asyncLocalStorage` is not in use anymore
|
||||
* in the current process.
|
||||
* @since v13.10.0, v12.17.0
|
||||
* @experimental
|
||||
*/
|
||||
disable(): void;
|
||||
/**
|
||||
* Returns the current store.
|
||||
* If called outside of an asynchronous context initialized by
|
||||
* calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it
|
||||
* returns `undefined`.
|
||||
* @since v13.10.0, v12.17.0
|
||||
*/
|
||||
getStore(): T | undefined;
|
||||
/**
|
||||
* Runs a function synchronously within a context and returns its
|
||||
* return value. The store is not accessible outside of the callback function.
|
||||
* The store is accessible to any asynchronous operations created within the
|
||||
* callback.
|
||||
*
|
||||
* The optional `args` are passed to the callback function.
|
||||
*
|
||||
* If the callback function throws an error, the error is thrown by `run()` too.
|
||||
* The stacktrace is not impacted by this call and the context is exited.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* const store = { id: 2 };
|
||||
* try {
|
||||
* asyncLocalStorage.run(store, () => {
|
||||
* asyncLocalStorage.getStore(); // Returns the store object
|
||||
* setTimeout(() => {
|
||||
* asyncLocalStorage.getStore(); // Returns the store object
|
||||
* }, 200);
|
||||
* throw new Error();
|
||||
* });
|
||||
* } catch (e) {
|
||||
* asyncLocalStorage.getStore(); // Returns undefined
|
||||
* // The error will be caught here
|
||||
* }
|
||||
* ```
|
||||
* @since v13.10.0, v12.17.0
|
||||
*/
|
||||
run<R>(store: T, callback: () => R): R;
|
||||
run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
|
||||
/**
|
||||
* Runs a function synchronously outside of a context and returns its
|
||||
* return value. The store is not accessible within the callback function or
|
||||
* the asynchronous operations created within the callback. Any `getStore()` call done within the callback function will always return `undefined`.
|
||||
*
|
||||
* The optional `args` are passed to the callback function.
|
||||
*
|
||||
* If the callback function throws an error, the error is thrown by `exit()` too.
|
||||
* The stacktrace is not impacted by this call and the context is re-entered.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* // Within a call to run
|
||||
* try {
|
||||
* asyncLocalStorage.getStore(); // Returns the store object or value
|
||||
* asyncLocalStorage.exit(() => {
|
||||
* asyncLocalStorage.getStore(); // Returns undefined
|
||||
* throw new Error();
|
||||
* });
|
||||
* } catch (e) {
|
||||
* asyncLocalStorage.getStore(); // Returns the same object or value
|
||||
* // The error will be caught here
|
||||
* }
|
||||
* ```
|
||||
* @since v13.10.0, v12.17.0
|
||||
* @experimental
|
||||
*/
|
||||
exit<R, TArgs extends any[]>(callback: (...args: TArgs) => R, ...args: TArgs): R;
|
||||
/**
|
||||
* Transitions into the context for the remainder of the current
|
||||
* synchronous execution and then persists the store through any following
|
||||
* asynchronous calls.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* const store = { id: 1 };
|
||||
* // Replaces previous store with the given store object
|
||||
* asyncLocalStorage.enterWith(store);
|
||||
* asyncLocalStorage.getStore(); // Returns the store object
|
||||
* someAsyncOperation(() => {
|
||||
* asyncLocalStorage.getStore(); // Returns the same object
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* This transition will continue for the _entire_ synchronous execution.
|
||||
* This means that if, for example, the context is entered within an event
|
||||
* handler subsequent event handlers will also run within that context unless
|
||||
* specifically bound to another context with an `AsyncResource`. That is why `run()` should be preferred over `enterWith()` unless there are strong reasons
|
||||
* to use the latter method.
|
||||
*
|
||||
* ```js
|
||||
* const store = { id: 1 };
|
||||
*
|
||||
* emitter.on('my-event', () => {
|
||||
* asyncLocalStorage.enterWith(store);
|
||||
* });
|
||||
* emitter.on('my-event', () => {
|
||||
* asyncLocalStorage.getStore(); // Returns the same object
|
||||
* });
|
||||
*
|
||||
* asyncLocalStorage.getStore(); // Returns undefined
|
||||
* emitter.emit('my-event');
|
||||
* asyncLocalStorage.getStore(); // Returns the same object
|
||||
* ```
|
||||
* @since v13.11.0, v12.17.0
|
||||
* @experimental
|
||||
*/
|
||||
enterWith(store: T): void;
|
||||
}
|
||||
}
|
||||
declare module "node:async_hooks" {
|
||||
export * from "async_hooks";
|
||||
}
|
||||
385
config/node_modules/@types/node/buffer.buffer.d.ts
generated
vendored
Normal file
385
config/node_modules/@types/node/buffer.buffer.d.ts
generated
vendored
Normal file
@ -0,0 +1,385 @@
|
||||
declare module "buffer" {
|
||||
global {
|
||||
interface BufferConstructor {
|
||||
// see buffer.d.ts for implementation shared with all TypeScript versions
|
||||
|
||||
/**
|
||||
* Allocates a new buffer containing the given {str}.
|
||||
*
|
||||
* @param str String to store in buffer.
|
||||
* @param encoding encoding to use, optional. Default is 'utf8'
|
||||
* @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
|
||||
*/
|
||||
new(str: string, encoding?: BufferEncoding): Buffer<ArrayBuffer>;
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets.
|
||||
*
|
||||
* @param size count of octets to allocate.
|
||||
* @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
|
||||
*/
|
||||
new(size: number): Buffer<ArrayBuffer>;
|
||||
/**
|
||||
* Allocates a new buffer containing the given {array} of octets.
|
||||
*
|
||||
* @param array The octets to store.
|
||||
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
||||
*/
|
||||
new(array: Uint8Array): Buffer<ArrayBuffer>;
|
||||
/**
|
||||
* Produces a Buffer backed by the same allocated memory as
|
||||
* the given {ArrayBuffer}/{SharedArrayBuffer}.
|
||||
*
|
||||
* @param arrayBuffer The ArrayBuffer with which to share memory.
|
||||
* @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
|
||||
*/
|
||||
new<TArrayBuffer extends ArrayBufferLike = ArrayBuffer>(arrayBuffer: TArrayBuffer): Buffer<TArrayBuffer>;
|
||||
/**
|
||||
* Allocates a new buffer containing the given {array} of octets.
|
||||
*
|
||||
* @param array The octets to store.
|
||||
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
||||
*/
|
||||
new(array: readonly any[]): Buffer<ArrayBuffer>;
|
||||
/**
|
||||
* Copies the passed {buffer} data onto a new {Buffer} instance.
|
||||
*
|
||||
* @param buffer The buffer to copy.
|
||||
* @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
|
||||
*/
|
||||
new(buffer: Buffer): Buffer<ArrayBuffer>;
|
||||
/**
|
||||
* Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`.
|
||||
* Array entries outside that range will be truncated to fit into it.
|
||||
*
|
||||
* ```js
|
||||
* import { Buffer } from 'node:buffer';
|
||||
*
|
||||
* // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.
|
||||
* const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
|
||||
* ```
|
||||
*
|
||||
* If `array` is an `Array`\-like object (that is, one with a `length` property of
|
||||
* type `number`), it is treated as if it is an array, unless it is a `Buffer` or
|
||||
* a `Uint8Array`. This means all other `TypedArray` variants get treated as an `Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use `Buffer.copyBytesFrom()`.
|
||||
*
|
||||
* A `TypeError` will be thrown if `array` is not an `Array` or another type
|
||||
* appropriate for `Buffer.from()` variants.
|
||||
*
|
||||
* `Buffer.from(array)` and `Buffer.from(string)` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
|
||||
* @since v5.10.0
|
||||
*/
|
||||
from<TArrayBuffer extends ArrayBufferLike>(
|
||||
arrayBuffer: WithImplicitCoercion<TArrayBuffer>,
|
||||
byteOffset?: number,
|
||||
length?: number,
|
||||
): Buffer<TArrayBuffer>;
|
||||
/**
|
||||
* Creates a new Buffer using the passed {data}
|
||||
* @param data data to create a new Buffer
|
||||
*/
|
||||
from(data: Uint8Array | readonly number[]): Buffer<ArrayBuffer>;
|
||||
from(data: WithImplicitCoercion<Uint8Array | readonly number[] | string>): Buffer<ArrayBuffer>;
|
||||
/**
|
||||
* Creates a new Buffer containing the given JavaScript string {str}.
|
||||
* If provided, the {encoding} parameter identifies the character encoding.
|
||||
* If not provided, {encoding} defaults to 'utf8'.
|
||||
*/
|
||||
from(
|
||||
str:
|
||||
| WithImplicitCoercion<string>
|
||||
| {
|
||||
[Symbol.toPrimitive](hint: "string"): string;
|
||||
},
|
||||
encoding?: BufferEncoding,
|
||||
): Buffer<ArrayBuffer>;
|
||||
/**
|
||||
* Creates a new Buffer using the passed {data}
|
||||
* @param values to create a new Buffer
|
||||
*/
|
||||
of(...items: number[]): Buffer<ArrayBuffer>;
|
||||
/**
|
||||
* Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together.
|
||||
*
|
||||
* If the list has no items, or if the `totalLength` is 0, then a new zero-length `Buffer` is returned.
|
||||
*
|
||||
* If `totalLength` is not provided, it is calculated from the `Buffer` instances
|
||||
* in `list` by adding their lengths.
|
||||
*
|
||||
* If `totalLength` is provided, it is coerced to an unsigned integer. If the
|
||||
* combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
|
||||
* truncated to `totalLength`.
|
||||
*
|
||||
* ```js
|
||||
* import { Buffer } from 'node:buffer';
|
||||
*
|
||||
* // Create a single `Buffer` from a list of three `Buffer` instances.
|
||||
*
|
||||
* const buf1 = Buffer.alloc(10);
|
||||
* const buf2 = Buffer.alloc(14);
|
||||
* const buf3 = Buffer.alloc(18);
|
||||
* const totalLength = buf1.length + buf2.length + buf3.length;
|
||||
*
|
||||
* console.log(totalLength);
|
||||
* // Prints: 42
|
||||
*
|
||||
* const bufA = Buffer.concat([buf1, buf2, buf3], totalLength);
|
||||
*
|
||||
* console.log(bufA);
|
||||
* // Prints: <Buffer 00 00 00 00 ...>
|
||||
* console.log(bufA.length);
|
||||
* // Prints: 42
|
||||
* ```
|
||||
*
|
||||
* `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
|
||||
* @since v0.7.11
|
||||
* @param list List of `Buffer` or {@link Uint8Array} instances to concatenate.
|
||||
* @param totalLength Total length of the `Buffer` instances in `list` when concatenated.
|
||||
*/
|
||||
concat(list: readonly Uint8Array[], totalLength?: number): Buffer<ArrayBuffer>;
|
||||
/**
|
||||
* Copies the underlying memory of `view` into a new `Buffer`.
|
||||
*
|
||||
* ```js
|
||||
* const u16 = new Uint16Array([0, 0xffff]);
|
||||
* const buf = Buffer.copyBytesFrom(u16, 1, 1);
|
||||
* u16[1] = 0;
|
||||
* console.log(buf.length); // 2
|
||||
* console.log(buf[0]); // 255
|
||||
* console.log(buf[1]); // 255
|
||||
* ```
|
||||
* @since v19.8.0
|
||||
* @param view The {TypedArray} to copy.
|
||||
* @param [offset=0] The starting offset within `view`.
|
||||
* @param [length=view.length - offset] The number of elements from `view` to copy.
|
||||
*/
|
||||
copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer<ArrayBuffer>;
|
||||
/**
|
||||
* Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled.
|
||||
*
|
||||
* ```js
|
||||
* import { Buffer } from 'node:buffer';
|
||||
*
|
||||
* const buf = Buffer.alloc(5);
|
||||
*
|
||||
* console.log(buf);
|
||||
* // Prints: <Buffer 00 00 00 00 00>
|
||||
* ```
|
||||
*
|
||||
* If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
|
||||
*
|
||||
* If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`.
|
||||
*
|
||||
* ```js
|
||||
* import { Buffer } from 'node:buffer';
|
||||
*
|
||||
* const buf = Buffer.alloc(5, 'a');
|
||||
*
|
||||
* console.log(buf);
|
||||
* // Prints: <Buffer 61 61 61 61 61>
|
||||
* ```
|
||||
*
|
||||
* If both `fill` and `encoding` are specified, the allocated `Buffer` will be
|
||||
* initialized by calling `buf.fill(fill, encoding)`.
|
||||
*
|
||||
* ```js
|
||||
* import { Buffer } from 'node:buffer';
|
||||
*
|
||||
* const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
|
||||
*
|
||||
* console.log(buf);
|
||||
* // Prints: <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
|
||||
* ```
|
||||
*
|
||||
* Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance
|
||||
* contents will never contain sensitive data from previous allocations, including
|
||||
* data that might not have been allocated for `Buffer`s.
|
||||
*
|
||||
* A `TypeError` will be thrown if `size` is not a number.
|
||||
* @since v5.10.0
|
||||
* @param size The desired length of the new `Buffer`.
|
||||
* @param [fill=0] A value to pre-fill the new `Buffer` with.
|
||||
* @param [encoding='utf8'] If `fill` is a string, this is its encoding.
|
||||
*/
|
||||
alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer<ArrayBuffer>;
|
||||
/**
|
||||
* Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
|
||||
*
|
||||
* The underlying memory for `Buffer` instances created in this way is _not_
|
||||
* _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes.
|
||||
*
|
||||
* ```js
|
||||
* import { Buffer } from 'node:buffer';
|
||||
*
|
||||
* const buf = Buffer.allocUnsafe(10);
|
||||
*
|
||||
* console.log(buf);
|
||||
* // Prints (contents may vary): <Buffer a0 8b 28 3f 01 00 00 00 50 32>
|
||||
*
|
||||
* buf.fill(0);
|
||||
*
|
||||
* console.log(buf);
|
||||
* // Prints: <Buffer 00 00 00 00 00 00 00 00 00 00>
|
||||
* ```
|
||||
*
|
||||
* A `TypeError` will be thrown if `size` is not a number.
|
||||
*
|
||||
* The `Buffer` module pre-allocates an internal `Buffer` instance of
|
||||
* size `Buffer.poolSize` that is used as a pool for the fast allocation of new `Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`,
|
||||
* and `Buffer.concat()` only when `size` is less than `Buffer.poolSize >>> 1` (floor of `Buffer.poolSize` divided by two).
|
||||
*
|
||||
* Use of this pre-allocated internal memory pool is a key difference between
|
||||
* calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
|
||||
* Specifically, `Buffer.alloc(size, fill)` will _never_ use the internal `Buffer`pool, while `Buffer.allocUnsafe(size).fill(fill)`_will_ use the internal`Buffer` pool if `size` is less
|
||||
* than or equal to half `Buffer.poolSize`. The
|
||||
* difference is subtle but can be important when an application requires the
|
||||
* additional performance that `Buffer.allocUnsafe()` provides.
|
||||
* @since v5.10.0
|
||||
* @param size The desired length of the new `Buffer`.
|
||||
*/
|
||||
allocUnsafe(size: number): Buffer<ArrayBuffer>;
|
||||
/**
|
||||
* Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. A zero-length `Buffer` is created if
|
||||
* `size` is 0.
|
||||
*
|
||||
* The underlying memory for `Buffer` instances created in this way is _not_
|
||||
* _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize
|
||||
* such `Buffer` instances with zeroes.
|
||||
*
|
||||
* When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
|
||||
* allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This
|
||||
* allows applications to avoid the garbage collection overhead of creating many
|
||||
* individually allocated `Buffer` instances. This approach improves both
|
||||
* performance and memory usage by eliminating the need to track and clean up as
|
||||
* many individual `ArrayBuffer` objects.
|
||||
*
|
||||
* However, in the case where a developer may need to retain a small chunk of
|
||||
* memory from a pool for an indeterminate amount of time, it may be appropriate
|
||||
* to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and
|
||||
* then copying out the relevant bits.
|
||||
*
|
||||
* ```js
|
||||
* import { Buffer } from 'node:buffer';
|
||||
*
|
||||
* // Need to keep around a few small chunks of memory.
|
||||
* const store = [];
|
||||
*
|
||||
* socket.on('readable', () => {
|
||||
* let data;
|
||||
* while (null !== (data = readable.read())) {
|
||||
* // Allocate for retained data.
|
||||
* const sb = Buffer.allocUnsafeSlow(10);
|
||||
*
|
||||
* // Copy the data into the new allocation.
|
||||
* data.copy(sb, 0, 0, 10);
|
||||
*
|
||||
* store.push(sb);
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* A `TypeError` will be thrown if `size` is not a number.
|
||||
* @since v5.12.0
|
||||
* @param size The desired length of the new `Buffer`.
|
||||
*/
|
||||
allocUnsafeSlow(size: number): Buffer<ArrayBuffer>;
|
||||
}
|
||||
interface Buffer<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> extends Uint8Array<TArrayBuffer> {
|
||||
// see buffer.d.ts for implementation shared with all TypeScript versions
|
||||
|
||||
/**
|
||||
* Returns a new `Buffer` that references the same memory as the original, but
|
||||
* offset and cropped by the `start` and `end` indices.
|
||||
*
|
||||
* This method is not compatible with the `Uint8Array.prototype.slice()`,
|
||||
* which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`.
|
||||
*
|
||||
* ```js
|
||||
* import { Buffer } from 'node:buffer';
|
||||
*
|
||||
* const buf = Buffer.from('buffer');
|
||||
*
|
||||
* const copiedBuf = Uint8Array.prototype.slice.call(buf);
|
||||
* copiedBuf[0]++;
|
||||
* console.log(copiedBuf.toString());
|
||||
* // Prints: cuffer
|
||||
*
|
||||
* console.log(buf.toString());
|
||||
* // Prints: buffer
|
||||
*
|
||||
* // With buf.slice(), the original buffer is modified.
|
||||
* const notReallyCopiedBuf = buf.slice();
|
||||
* notReallyCopiedBuf[0]++;
|
||||
* console.log(notReallyCopiedBuf.toString());
|
||||
* // Prints: cuffer
|
||||
* console.log(buf.toString());
|
||||
* // Also prints: cuffer (!)
|
||||
* ```
|
||||
* @since v0.3.0
|
||||
* @deprecated Use `subarray` instead.
|
||||
* @param [start=0] Where the new `Buffer` will start.
|
||||
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
||||
*/
|
||||
slice(start?: number, end?: number): Buffer<ArrayBuffer>;
|
||||
/**
|
||||
* Returns a new `Buffer` that references the same memory as the original, but
|
||||
* offset and cropped by the `start` and `end` indices.
|
||||
*
|
||||
* Specifying `end` greater than `buf.length` will return the same result as
|
||||
* that of `end` equal to `buf.length`.
|
||||
*
|
||||
* This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray).
|
||||
*
|
||||
* Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap.
|
||||
*
|
||||
* ```js
|
||||
* import { Buffer } from 'node:buffer';
|
||||
*
|
||||
* // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte
|
||||
* // from the original `Buffer`.
|
||||
*
|
||||
* const buf1 = Buffer.allocUnsafe(26);
|
||||
*
|
||||
* for (let i = 0; i < 26; i++) {
|
||||
* // 97 is the decimal ASCII value for 'a'.
|
||||
* buf1[i] = i + 97;
|
||||
* }
|
||||
*
|
||||
* const buf2 = buf1.subarray(0, 3);
|
||||
*
|
||||
* console.log(buf2.toString('ascii', 0, buf2.length));
|
||||
* // Prints: abc
|
||||
*
|
||||
* buf1[0] = 33;
|
||||
*
|
||||
* console.log(buf2.toString('ascii', 0, buf2.length));
|
||||
* // Prints: !bc
|
||||
* ```
|
||||
*
|
||||
* Specifying negative indexes causes the slice to be generated relative to the
|
||||
* end of `buf` rather than the beginning.
|
||||
*
|
||||
* ```js
|
||||
* import { Buffer } from 'node:buffer';
|
||||
*
|
||||
* const buf = Buffer.from('buffer');
|
||||
*
|
||||
* console.log(buf.subarray(-6, -1).toString());
|
||||
* // Prints: buffe
|
||||
* // (Equivalent to buf.subarray(0, 5).)
|
||||
*
|
||||
* console.log(buf.subarray(-6, -2).toString());
|
||||
* // Prints: buff
|
||||
* // (Equivalent to buf.subarray(0, 4).)
|
||||
*
|
||||
* console.log(buf.subarray(-5, -2).toString());
|
||||
* // Prints: uff
|
||||
* // (Equivalent to buf.subarray(1, 4).)
|
||||
* ```
|
||||
* @since v3.0.0
|
||||
* @param [start=0] Where the new `Buffer` will start.
|
||||
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
||||
*/
|
||||
subarray(start?: number, end?: number): Buffer<TArrayBuffer>;
|
||||
}
|
||||
}
|
||||
}
|
||||
1933
config/node_modules/@types/node/buffer.d.ts
generated
vendored
Normal file
1933
config/node_modules/@types/node/buffer.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1549
config/node_modules/@types/node/child_process.d.ts
generated
vendored
Normal file
1549
config/node_modules/@types/node/child_process.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
579
config/node_modules/@types/node/cluster.d.ts
generated
vendored
Normal file
579
config/node_modules/@types/node/cluster.d.ts
generated
vendored
Normal file
@ -0,0 +1,579 @@
|
||||
/**
|
||||
* Clusters of Node.js processes can be used to run multiple instances of Node.js
|
||||
* that can distribute workloads among their application threads. When process isolation
|
||||
* is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html)
|
||||
* module instead, which allows running multiple application threads within a single Node.js instance.
|
||||
*
|
||||
* The cluster module allows easy creation of child processes that all share
|
||||
* server ports.
|
||||
*
|
||||
* ```js
|
||||
* import cluster from 'node:cluster';
|
||||
* import http from 'node:http';
|
||||
* import { availableParallelism } from 'node:os';
|
||||
* import process from 'node:process';
|
||||
*
|
||||
* const numCPUs = availableParallelism();
|
||||
*
|
||||
* if (cluster.isPrimary) {
|
||||
* console.log(`Primary ${process.pid} is running`);
|
||||
*
|
||||
* // Fork workers.
|
||||
* for (let i = 0; i < numCPUs; i++) {
|
||||
* cluster.fork();
|
||||
* }
|
||||
*
|
||||
* cluster.on('exit', (worker, code, signal) => {
|
||||
* console.log(`worker ${worker.process.pid} died`);
|
||||
* });
|
||||
* } else {
|
||||
* // Workers can share any TCP connection
|
||||
* // In this case it is an HTTP server
|
||||
* http.createServer((req, res) => {
|
||||
* res.writeHead(200);
|
||||
* res.end('hello world\n');
|
||||
* }).listen(8000);
|
||||
*
|
||||
* console.log(`Worker ${process.pid} started`);
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Running Node.js will now share port 8000 between the workers:
|
||||
*
|
||||
* ```console
|
||||
* $ node server.js
|
||||
* Primary 3596 is running
|
||||
* Worker 4324 started
|
||||
* Worker 4520 started
|
||||
* Worker 6056 started
|
||||
* Worker 5644 started
|
||||
* ```
|
||||
*
|
||||
* On Windows, it is not yet possible to set up a named pipe server in a worker.
|
||||
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/cluster.js)
|
||||
*/
|
||||
declare module "cluster" {
|
||||
import * as child from "node:child_process";
|
||||
import EventEmitter = require("node:events");
|
||||
import * as net from "node:net";
|
||||
type SerializationType = "json" | "advanced";
|
||||
export interface ClusterSettings {
|
||||
/**
|
||||
* List of string arguments passed to the Node.js executable.
|
||||
* @default process.execArgv
|
||||
*/
|
||||
execArgv?: string[] | undefined;
|
||||
/**
|
||||
* File path to worker file.
|
||||
* @default process.argv[1]
|
||||
*/
|
||||
exec?: string | undefined;
|
||||
/**
|
||||
* String arguments passed to worker.
|
||||
* @default process.argv.slice(2)
|
||||
*/
|
||||
args?: string[] | undefined;
|
||||
/**
|
||||
* Whether or not to send output to parent's stdio.
|
||||
* @default false
|
||||
*/
|
||||
silent?: boolean | undefined;
|
||||
/**
|
||||
* Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must
|
||||
* contain an `'ipc'` entry. When this option is provided, it overrides `silent`. See [`child_prcess.spawn()`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#child_processspawncommand-args-options)'s
|
||||
* [`stdio`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#optionsstdio).
|
||||
*/
|
||||
stdio?: any[] | undefined;
|
||||
/**
|
||||
* Sets the user identity of the process. (See [`setuid(2)`](https://man7.org/linux/man-pages/man2/setuid.2.html).)
|
||||
*/
|
||||
uid?: number | undefined;
|
||||
/**
|
||||
* Sets the group identity of the process. (See [`setgid(2)`](https://man7.org/linux/man-pages/man2/setgid.2.html).)
|
||||
*/
|
||||
gid?: number | undefined;
|
||||
/**
|
||||
* Sets inspector port of worker. This can be a number, or a function that takes no arguments and returns a number.
|
||||
* By default each worker gets its own port, incremented from the primary's `process.debugPort`.
|
||||
*/
|
||||
inspectPort?: number | (() => number) | undefined;
|
||||
/**
|
||||
* Specify the kind of serialization used for sending messages between processes. Possible values are `'json'` and `'advanced'`.
|
||||
* See [Advanced serialization for `child_process`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#advanced-serialization) for more details.
|
||||
* @default false
|
||||
*/
|
||||
serialization?: SerializationType | undefined;
|
||||
/**
|
||||
* Current working directory of the worker process.
|
||||
* @default undefined (inherits from parent process)
|
||||
*/
|
||||
cwd?: string | undefined;
|
||||
/**
|
||||
* Hide the forked processes console window that would normally be created on Windows systems.
|
||||
* @default false
|
||||
*/
|
||||
windowsHide?: boolean | undefined;
|
||||
}
|
||||
export interface Address {
|
||||
address: string;
|
||||
port: number;
|
||||
/**
|
||||
* The `addressType` is one of:
|
||||
*
|
||||
* * `4` (TCPv4)
|
||||
* * `6` (TCPv6)
|
||||
* * `-1` (Unix domain socket)
|
||||
* * `'udp4'` or `'udp6'` (UDPv4 or UDPv6)
|
||||
*/
|
||||
addressType: 4 | 6 | -1 | "udp4" | "udp6";
|
||||
}
|
||||
/**
|
||||
* A `Worker` object contains all public information and method about a worker.
|
||||
* In the primary it can be obtained using `cluster.workers`. In a worker
|
||||
* it can be obtained using `cluster.worker`.
|
||||
* @since v0.7.0
|
||||
*/
|
||||
export class Worker extends EventEmitter {
|
||||
/**
|
||||
* Each new worker is given its own unique id, this id is stored in the `id`.
|
||||
*
|
||||
* While a worker is alive, this is the key that indexes it in `cluster.workers`.
|
||||
* @since v0.8.0
|
||||
*/
|
||||
id: number;
|
||||
/**
|
||||
* All workers are created using [`child_process.fork()`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#child_processforkmodulepath-args-options), the returned object
|
||||
* from this function is stored as `.process`. In a worker, the global `process` is stored.
|
||||
*
|
||||
* See: [Child Process module](https://nodejs.org/docs/latest-v22.x/api/child_process.html#child_processforkmodulepath-args-options).
|
||||
*
|
||||
* Workers will call `process.exit(0)` if the `'disconnect'` event occurs
|
||||
* on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
|
||||
* accidental disconnection.
|
||||
* @since v0.7.0
|
||||
*/
|
||||
process: child.ChildProcess;
|
||||
/**
|
||||
* Send a message to a worker or primary, optionally with a handle.
|
||||
*
|
||||
* In the primary, this sends a message to a specific worker. It is identical to [`ChildProcess.send()`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#subprocesssendmessage-sendhandle-options-callback).
|
||||
*
|
||||
* In a worker, this sends a message to the primary. It is identical to `process.send()`.
|
||||
*
|
||||
* This example will echo back all messages from the primary:
|
||||
*
|
||||
* ```js
|
||||
* if (cluster.isPrimary) {
|
||||
* const worker = cluster.fork();
|
||||
* worker.send('hi there');
|
||||
*
|
||||
* } else if (cluster.isWorker) {
|
||||
* process.on('message', (msg) => {
|
||||
* process.send(msg);
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
* @since v0.7.0
|
||||
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles.
|
||||
*/
|
||||
send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
|
||||
send(
|
||||
message: child.Serializable,
|
||||
sendHandle: child.SendHandle,
|
||||
callback?: (error: Error | null) => void,
|
||||
): boolean;
|
||||
send(
|
||||
message: child.Serializable,
|
||||
sendHandle: child.SendHandle,
|
||||
options?: child.MessageOptions,
|
||||
callback?: (error: Error | null) => void,
|
||||
): boolean;
|
||||
/**
|
||||
* This function will kill the worker. In the primary worker, it does this by
|
||||
* disconnecting the `worker.process`, and once disconnected, killing with `signal`. In the worker, it does it by killing the process with `signal`.
|
||||
*
|
||||
* The `kill()` function kills the worker process without waiting for a graceful
|
||||
* disconnect, it has the same behavior as `worker.process.kill()`.
|
||||
*
|
||||
* This method is aliased as `worker.destroy()` for backwards compatibility.
|
||||
*
|
||||
* In a worker, `process.kill()` exists, but it is not this function;
|
||||
* it is [`kill()`](https://nodejs.org/docs/latest-v22.x/api/process.html#processkillpid-signal).
|
||||
* @since v0.9.12
|
||||
* @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
|
||||
*/
|
||||
kill(signal?: string): void;
|
||||
destroy(signal?: string): void;
|
||||
/**
|
||||
* In a worker, this function will close all servers, wait for the `'close'` event
|
||||
* on those servers, and then disconnect the IPC channel.
|
||||
*
|
||||
* In the primary, an internal message is sent to the worker causing it to call `.disconnect()` on itself.
|
||||
*
|
||||
* Causes `.exitedAfterDisconnect` to be set.
|
||||
*
|
||||
* After a server is closed, it will no longer accept new connections,
|
||||
* but connections may be accepted by any other listening worker. Existing
|
||||
* connections will be allowed to close as usual. When no more connections exist,
|
||||
* see `server.close()`, the IPC channel to the worker will close allowing it
|
||||
* to die gracefully.
|
||||
*
|
||||
* The above applies _only_ to server connections, client connections are not
|
||||
* automatically closed by workers, and disconnect does not wait for them to close
|
||||
* before exiting.
|
||||
*
|
||||
* In a worker, `process.disconnect` exists, but it is not this function;
|
||||
* it is `disconnect()`.
|
||||
*
|
||||
* Because long living server connections may block workers from disconnecting, it
|
||||
* may be useful to send a message, so application specific actions may be taken to
|
||||
* close them. It also may be useful to implement a timeout, killing a worker if
|
||||
* the `'disconnect'` event has not been emitted after some time.
|
||||
*
|
||||
* ```js
|
||||
* import net from 'node:net';
|
||||
*
|
||||
* if (cluster.isPrimary) {
|
||||
* const worker = cluster.fork();
|
||||
* let timeout;
|
||||
*
|
||||
* worker.on('listening', (address) => {
|
||||
* worker.send('shutdown');
|
||||
* worker.disconnect();
|
||||
* timeout = setTimeout(() => {
|
||||
* worker.kill();
|
||||
* }, 2000);
|
||||
* });
|
||||
*
|
||||
* worker.on('disconnect', () => {
|
||||
* clearTimeout(timeout);
|
||||
* });
|
||||
*
|
||||
* } else if (cluster.isWorker) {
|
||||
* const server = net.createServer((socket) => {
|
||||
* // Connections never end
|
||||
* });
|
||||
*
|
||||
* server.listen(8000);
|
||||
*
|
||||
* process.on('message', (msg) => {
|
||||
* if (msg === 'shutdown') {
|
||||
* // Initiate graceful close of any connections to server
|
||||
* }
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
* @since v0.7.7
|
||||
* @return A reference to `worker`.
|
||||
*/
|
||||
disconnect(): void;
|
||||
/**
|
||||
* This function returns `true` if the worker is connected to its primary via its
|
||||
* IPC channel, `false` otherwise. A worker is connected to its primary after it
|
||||
* has been created. It is disconnected after the `'disconnect'` event is emitted.
|
||||
* @since v0.11.14
|
||||
*/
|
||||
isConnected(): boolean;
|
||||
/**
|
||||
* This function returns `true` if the worker's process has terminated (either
|
||||
* because of exiting or being signaled). Otherwise, it returns `false`.
|
||||
*
|
||||
* ```js
|
||||
* import cluster from 'node:cluster';
|
||||
* import http from 'node:http';
|
||||
* import { availableParallelism } from 'node:os';
|
||||
* import process from 'node:process';
|
||||
*
|
||||
* const numCPUs = availableParallelism();
|
||||
*
|
||||
* if (cluster.isPrimary) {
|
||||
* console.log(`Primary ${process.pid} is running`);
|
||||
*
|
||||
* // Fork workers.
|
||||
* for (let i = 0; i < numCPUs; i++) {
|
||||
* cluster.fork();
|
||||
* }
|
||||
*
|
||||
* cluster.on('fork', (worker) => {
|
||||
* console.log('worker is dead:', worker.isDead());
|
||||
* });
|
||||
*
|
||||
* cluster.on('exit', (worker, code, signal) => {
|
||||
* console.log('worker is dead:', worker.isDead());
|
||||
* });
|
||||
* } else {
|
||||
* // Workers can share any TCP connection. In this case, it is an HTTP server.
|
||||
* http.createServer((req, res) => {
|
||||
* res.writeHead(200);
|
||||
* res.end(`Current process\n ${process.pid}`);
|
||||
* process.kill(process.pid);
|
||||
* }).listen(8000);
|
||||
* }
|
||||
* ```
|
||||
* @since v0.11.14
|
||||
*/
|
||||
isDead(): boolean;
|
||||
/**
|
||||
* This property is `true` if the worker exited due to `.disconnect()`.
|
||||
* If the worker exited any other way, it is `false`. If the
|
||||
* worker has not exited, it is `undefined`.
|
||||
*
|
||||
* The boolean `worker.exitedAfterDisconnect` allows distinguishing between
|
||||
* voluntary and accidental exit, the primary may choose not to respawn a worker
|
||||
* based on this value.
|
||||
*
|
||||
* ```js
|
||||
* cluster.on('exit', (worker, code, signal) => {
|
||||
* if (worker.exitedAfterDisconnect === true) {
|
||||
* console.log('Oh, it was just voluntary – no need to worry');
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* // kill worker
|
||||
* worker.kill();
|
||||
* ```
|
||||
* @since v6.0.0
|
||||
*/
|
||||
exitedAfterDisconnect: boolean;
|
||||
/**
|
||||
* events.EventEmitter
|
||||
* 1. disconnect
|
||||
* 2. error
|
||||
* 3. exit
|
||||
* 4. listening
|
||||
* 5. message
|
||||
* 6. online
|
||||
*/
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
addListener(event: "disconnect", listener: () => void): this;
|
||||
addListener(event: "error", listener: (error: Error) => void): this;
|
||||
addListener(event: "exit", listener: (code: number, signal: string) => void): this;
|
||||
addListener(event: "listening", listener: (address: Address) => void): this;
|
||||
addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
addListener(event: "online", listener: () => void): this;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "disconnect"): boolean;
|
||||
emit(event: "error", error: Error): boolean;
|
||||
emit(event: "exit", code: number, signal: string): boolean;
|
||||
emit(event: "listening", address: Address): boolean;
|
||||
emit(event: "message", message: any, handle: net.Socket | net.Server): boolean;
|
||||
emit(event: "online"): boolean;
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "disconnect", listener: () => void): this;
|
||||
on(event: "error", listener: (error: Error) => void): this;
|
||||
on(event: "exit", listener: (code: number, signal: string) => void): this;
|
||||
on(event: "listening", listener: (address: Address) => void): this;
|
||||
on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
on(event: "online", listener: () => void): this;
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "disconnect", listener: () => void): this;
|
||||
once(event: "error", listener: (error: Error) => void): this;
|
||||
once(event: "exit", listener: (code: number, signal: string) => void): this;
|
||||
once(event: "listening", listener: (address: Address) => void): this;
|
||||
once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
once(event: "online", listener: () => void): this;
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "disconnect", listener: () => void): this;
|
||||
prependListener(event: "error", listener: (error: Error) => void): this;
|
||||
prependListener(event: "exit", listener: (code: number, signal: string) => void): this;
|
||||
prependListener(event: "listening", listener: (address: Address) => void): this;
|
||||
prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
prependListener(event: "online", listener: () => void): this;
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "disconnect", listener: () => void): this;
|
||||
prependOnceListener(event: "error", listener: (error: Error) => void): this;
|
||||
prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this;
|
||||
prependOnceListener(event: "listening", listener: (address: Address) => void): this;
|
||||
prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
prependOnceListener(event: "online", listener: () => void): this;
|
||||
}
|
||||
export interface Cluster extends EventEmitter {
|
||||
disconnect(callback?: () => void): void;
|
||||
/**
|
||||
* Spawn a new worker process.
|
||||
*
|
||||
* This can only be called from the primary process.
|
||||
* @param env Key/value pairs to add to worker process environment.
|
||||
* @since v0.6.0
|
||||
*/
|
||||
fork(env?: any): Worker;
|
||||
/** @deprecated since v16.0.0 - use isPrimary. */
|
||||
readonly isMaster: boolean;
|
||||
/**
|
||||
* True if the process is a primary. This is determined by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID`
|
||||
* is undefined, then `isPrimary` is `true`.
|
||||
* @since v16.0.0
|
||||
*/
|
||||
readonly isPrimary: boolean;
|
||||
/**
|
||||
* True if the process is not a primary (it is the negation of `cluster.isPrimary`).
|
||||
* @since v0.6.0
|
||||
*/
|
||||
readonly isWorker: boolean;
|
||||
/**
|
||||
* The scheduling policy, either `cluster.SCHED_RR` for round-robin or `cluster.SCHED_NONE` to leave it to the operating system. This is a
|
||||
* global setting and effectively frozen once either the first worker is spawned, or [`.setupPrimary()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clustersetupprimarysettings)
|
||||
* is called, whichever comes first.
|
||||
*
|
||||
* `SCHED_RR` is the default on all operating systems except Windows. Windows will change to `SCHED_RR` once libuv is able to effectively distribute
|
||||
* IOCP handles without incurring a large performance hit.
|
||||
*
|
||||
* `cluster.schedulingPolicy` can also be set through the `NODE_CLUSTER_SCHED_POLICY` environment variable. Valid values are `'rr'` and `'none'`.
|
||||
* @since v0.11.2
|
||||
*/
|
||||
schedulingPolicy: number;
|
||||
/**
|
||||
* After calling [`.setupPrimary()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clustersetupprimarysettings)
|
||||
* (or [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv)) this settings object will contain
|
||||
* the settings, including the default values.
|
||||
*
|
||||
* This object is not intended to be changed or set manually.
|
||||
* @since v0.7.1
|
||||
*/
|
||||
readonly settings: ClusterSettings;
|
||||
/** @deprecated since v16.0.0 - use [`.setupPrimary()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clustersetupprimarysettings) instead. */
|
||||
setupMaster(settings?: ClusterSettings): void;
|
||||
/**
|
||||
* `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in `cluster.settings`.
|
||||
*
|
||||
* Any settings changes only affect future calls to [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv)
|
||||
* and have no effect on workers that are already running.
|
||||
*
|
||||
* The only attribute of a worker that cannot be set via `.setupPrimary()` is the `env` passed to
|
||||
* [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv).
|
||||
*
|
||||
* The defaults above apply to the first call only; the defaults for later calls are the current values at the time of
|
||||
* `cluster.setupPrimary()` is called.
|
||||
*
|
||||
* ```js
|
||||
* import cluster from 'node:cluster';
|
||||
*
|
||||
* cluster.setupPrimary({
|
||||
* exec: 'worker.js',
|
||||
* args: ['--use', 'https'],
|
||||
* silent: true,
|
||||
* });
|
||||
* cluster.fork(); // https worker
|
||||
* cluster.setupPrimary({
|
||||
* exec: 'worker.js',
|
||||
* args: ['--use', 'http'],
|
||||
* });
|
||||
* cluster.fork(); // http worker
|
||||
* ```
|
||||
*
|
||||
* This can only be called from the primary process.
|
||||
* @since v16.0.0
|
||||
*/
|
||||
setupPrimary(settings?: ClusterSettings): void;
|
||||
/**
|
||||
* A reference to the current worker object. Not available in the primary process.
|
||||
*
|
||||
* ```js
|
||||
* import cluster from 'node:cluster';
|
||||
*
|
||||
* if (cluster.isPrimary) {
|
||||
* console.log('I am primary');
|
||||
* cluster.fork();
|
||||
* cluster.fork();
|
||||
* } else if (cluster.isWorker) {
|
||||
* console.log(`I am worker #${cluster.worker.id}`);
|
||||
* }
|
||||
* ```
|
||||
* @since v0.7.0
|
||||
*/
|
||||
readonly worker?: Worker | undefined;
|
||||
/**
|
||||
* A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process.
|
||||
*
|
||||
* A worker is removed from `cluster.workers` after the worker has disconnected _and_ exited. The order between these two events cannot be determined in advance. However, it
|
||||
* is guaranteed that the removal from the `cluster.workers` list happens before the last `'disconnect'` or `'exit'` event is emitted.
|
||||
*
|
||||
* ```js
|
||||
* import cluster from 'node:cluster';
|
||||
*
|
||||
* for (const worker of Object.values(cluster.workers)) {
|
||||
* worker.send('big announcement to all workers');
|
||||
* }
|
||||
* ```
|
||||
* @since v0.7.0
|
||||
*/
|
||||
readonly workers?: NodeJS.Dict<Worker> | undefined;
|
||||
readonly SCHED_NONE: number;
|
||||
readonly SCHED_RR: number;
|
||||
/**
|
||||
* events.EventEmitter
|
||||
* 1. disconnect
|
||||
* 2. exit
|
||||
* 3. fork
|
||||
* 4. listening
|
||||
* 5. message
|
||||
* 6. online
|
||||
* 7. setup
|
||||
*/
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
addListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
||||
addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||
addListener(event: "fork", listener: (worker: Worker) => void): this;
|
||||
addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
||||
addListener(
|
||||
event: "message",
|
||||
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
|
||||
): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
addListener(event: "online", listener: (worker: Worker) => void): this;
|
||||
addListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "disconnect", worker: Worker): boolean;
|
||||
emit(event: "exit", worker: Worker, code: number, signal: string): boolean;
|
||||
emit(event: "fork", worker: Worker): boolean;
|
||||
emit(event: "listening", worker: Worker, address: Address): boolean;
|
||||
emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
|
||||
emit(event: "online", worker: Worker): boolean;
|
||||
emit(event: "setup", settings: ClusterSettings): boolean;
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "disconnect", listener: (worker: Worker) => void): this;
|
||||
on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||
on(event: "fork", listener: (worker: Worker) => void): this;
|
||||
on(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
||||
on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
on(event: "online", listener: (worker: Worker) => void): this;
|
||||
on(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "disconnect", listener: (worker: Worker) => void): this;
|
||||
once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||
once(event: "fork", listener: (worker: Worker) => void): this;
|
||||
once(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
||||
once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
once(event: "online", listener: (worker: Worker) => void): this;
|
||||
once(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
||||
prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||
prependListener(event: "fork", listener: (worker: Worker) => void): this;
|
||||
prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
||||
// the handle is a net.Socket or net.Server object, or undefined.
|
||||
prependListener(
|
||||
event: "message",
|
||||
listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void,
|
||||
): this;
|
||||
prependListener(event: "online", listener: (worker: Worker) => void): this;
|
||||
prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
||||
prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||
prependOnceListener(event: "fork", listener: (worker: Worker) => void): this;
|
||||
prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
||||
// the handle is a net.Socket or net.Server object, or undefined.
|
||||
prependOnceListener(
|
||||
event: "message",
|
||||
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
|
||||
): this;
|
||||
prependOnceListener(event: "online", listener: (worker: Worker) => void): this;
|
||||
prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
||||
}
|
||||
const cluster: Cluster;
|
||||
export default cluster;
|
||||
}
|
||||
declare module "node:cluster" {
|
||||
export * from "cluster";
|
||||
export { default as default } from "cluster";
|
||||
}
|
||||
16
config/node_modules/@types/node/compatibility/disposable.d.ts
generated
vendored
Normal file
16
config/node_modules/@types/node/compatibility/disposable.d.ts
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// Polyfills for the explicit resource management types added in TypeScript 5.2.
|
||||
// TODO: remove once this package no longer supports TS 5.1, and replace with a
|
||||
// <reference> to TypeScript's disposable library in index.d.ts.
|
||||
|
||||
interface SymbolConstructor {
|
||||
readonly dispose: unique symbol;
|
||||
readonly asyncDispose: unique symbol;
|
||||
}
|
||||
|
||||
interface Disposable {
|
||||
[Symbol.dispose](): void;
|
||||
}
|
||||
|
||||
interface AsyncDisposable {
|
||||
[Symbol.asyncDispose](): PromiseLike<void>;
|
||||
}
|
||||
9
config/node_modules/@types/node/compatibility/index.d.ts
generated
vendored
Normal file
9
config/node_modules/@types/node/compatibility/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
// Declaration files in this directory contain types relating to TypeScript library features
|
||||
// that are not included in all TypeScript versions supported by DefinitelyTyped, but
|
||||
// which can be made backwards-compatible without needing `typesVersions`.
|
||||
// If adding declarations to this directory, please specify which versions of TypeScript require them,
|
||||
// so that they can be removed when no longer needed.
|
||||
|
||||
/// <reference path="disposable.d.ts" />
|
||||
/// <reference path="indexable.d.ts" />
|
||||
/// <reference path="iterators.d.ts" />
|
||||
23
config/node_modules/@types/node/compatibility/indexable.d.ts
generated
vendored
Normal file
23
config/node_modules/@types/node/compatibility/indexable.d.ts
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
// Polyfill for ES2022's .at() method on string/array prototypes, added to TypeScript in 4.6.
|
||||
// TODO: these methods are not used within @types/node, and should be removed at the next
|
||||
// major @types/node version; users should include the es2022 TypeScript libraries
|
||||
// if they need these features.
|
||||
|
||||
interface RelativeIndexable<T> {
|
||||
at(index: number): T | undefined;
|
||||
}
|
||||
|
||||
interface String extends RelativeIndexable<string> {}
|
||||
interface Array<T> extends RelativeIndexable<T> {}
|
||||
interface ReadonlyArray<T> extends RelativeIndexable<T> {}
|
||||
interface Int8Array extends RelativeIndexable<number> {}
|
||||
interface Uint8Array extends RelativeIndexable<number> {}
|
||||
interface Uint8ClampedArray extends RelativeIndexable<number> {}
|
||||
interface Int16Array extends RelativeIndexable<number> {}
|
||||
interface Uint16Array extends RelativeIndexable<number> {}
|
||||
interface Int32Array extends RelativeIndexable<number> {}
|
||||
interface Uint32Array extends RelativeIndexable<number> {}
|
||||
interface Float32Array extends RelativeIndexable<number> {}
|
||||
interface Float64Array extends RelativeIndexable<number> {}
|
||||
interface BigInt64Array extends RelativeIndexable<bigint> {}
|
||||
interface BigUint64Array extends RelativeIndexable<bigint> {}
|
||||
21
config/node_modules/@types/node/compatibility/iterators.d.ts
generated
vendored
Normal file
21
config/node_modules/@types/node/compatibility/iterators.d.ts
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Backwards-compatible iterator interfaces, augmented with iterator helper methods by lib.esnext.iterator in TypeScript 5.6.
|
||||
// The IterableIterator interface does not contain these methods, which creates assignability issues in places where IteratorObjects
|
||||
// are expected (eg. DOM-compatible APIs) if lib.esnext.iterator is loaded.
|
||||
// Also ensures that iterators returned by the Node API, which inherit from Iterator.prototype, correctly expose the iterator helper methods
|
||||
// if lib.esnext.iterator is loaded.
|
||||
// TODO: remove once this package no longer supports TS 5.5, and replace NodeJS.BuiltinIteratorReturn with BuiltinIteratorReturn.
|
||||
|
||||
// Placeholders for TS <5.6
|
||||
interface IteratorObject<T, TReturn, TNext> {}
|
||||
interface AsyncIteratorObject<T, TReturn, TNext> {}
|
||||
|
||||
declare namespace NodeJS {
|
||||
// Populate iterator methods for TS <5.6
|
||||
interface Iterator<T, TReturn, TNext> extends globalThis.Iterator<T, TReturn, TNext> {}
|
||||
interface AsyncIterator<T, TReturn, TNext> extends globalThis.AsyncIterator<T, TReturn, TNext> {}
|
||||
|
||||
// Polyfill for TS 5.6's instrinsic BuiltinIteratorReturn type, required for DOM-compatible iterators
|
||||
type BuiltinIteratorReturn = ReturnType<any[][typeof Symbol.iterator]> extends
|
||||
globalThis.Iterator<any, infer TReturn> ? TReturn
|
||||
: any;
|
||||
}
|
||||
452
config/node_modules/@types/node/console.d.ts
generated
vendored
Normal file
452
config/node_modules/@types/node/console.d.ts
generated
vendored
Normal file
@ -0,0 +1,452 @@
|
||||
/**
|
||||
* The `node:console` module provides a simple debugging console that is similar to
|
||||
* the JavaScript console mechanism provided by web browsers.
|
||||
*
|
||||
* The module exports two specific components:
|
||||
*
|
||||
* * A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream.
|
||||
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and
|
||||
* [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module.
|
||||
*
|
||||
* _**Warning**_: The global console object's methods are neither consistently
|
||||
* synchronous like the browser APIs they resemble, nor are they consistently
|
||||
* asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for
|
||||
* more information.
|
||||
*
|
||||
* Example using the global `console`:
|
||||
*
|
||||
* ```js
|
||||
* console.log('hello world');
|
||||
* // Prints: hello world, to stdout
|
||||
* console.log('hello %s', 'world');
|
||||
* // Prints: hello world, to stdout
|
||||
* console.error(new Error('Whoops, something bad happened'));
|
||||
* // Prints error message and stack trace to stderr:
|
||||
* // Error: Whoops, something bad happened
|
||||
* // at [eval]:5:15
|
||||
* // at Script.runInThisContext (node:vm:132:18)
|
||||
* // at Object.runInThisContext (node:vm:309:38)
|
||||
* // at node:internal/process/execution:77:19
|
||||
* // at [eval]-wrapper:6:22
|
||||
* // at evalScript (node:internal/process/execution:76:60)
|
||||
* // at node:internal/main/eval_string:23:3
|
||||
*
|
||||
* const name = 'Will Robinson';
|
||||
* console.warn(`Danger ${name}! Danger!`);
|
||||
* // Prints: Danger Will Robinson! Danger!, to stderr
|
||||
* ```
|
||||
*
|
||||
* Example using the `Console` class:
|
||||
*
|
||||
* ```js
|
||||
* const out = getStreamSomehow();
|
||||
* const err = getStreamSomehow();
|
||||
* const myConsole = new console.Console(out, err);
|
||||
*
|
||||
* myConsole.log('hello world');
|
||||
* // Prints: hello world, to out
|
||||
* myConsole.log('hello %s', 'world');
|
||||
* // Prints: hello world, to out
|
||||
* myConsole.error(new Error('Whoops, something bad happened'));
|
||||
* // Prints: [Error: Whoops, something bad happened], to err
|
||||
*
|
||||
* const name = 'Will Robinson';
|
||||
* myConsole.warn(`Danger ${name}! Danger!`);
|
||||
* // Prints: Danger Will Robinson! Danger!, to err
|
||||
* ```
|
||||
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/console.js)
|
||||
*/
|
||||
declare module "console" {
|
||||
import console = require("node:console");
|
||||
export = console;
|
||||
}
|
||||
declare module "node:console" {
|
||||
import { InspectOptions } from "node:util";
|
||||
global {
|
||||
// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
|
||||
interface Console {
|
||||
Console: console.ConsoleConstructor;
|
||||
/**
|
||||
* `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only
|
||||
* writes a message and does not otherwise affect execution. The output always
|
||||
* starts with `"Assertion failed"`. If provided, `message` is formatted using
|
||||
* [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args).
|
||||
*
|
||||
* If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens.
|
||||
*
|
||||
* ```js
|
||||
* console.assert(true, 'does nothing');
|
||||
*
|
||||
* console.assert(false, 'Whoops %s work', 'didn\'t');
|
||||
* // Assertion failed: Whoops didn't work
|
||||
*
|
||||
* console.assert();
|
||||
* // Assertion failed
|
||||
* ```
|
||||
* @since v0.1.101
|
||||
* @param value The value tested for being truthy.
|
||||
* @param message All arguments besides `value` are used as error message.
|
||||
*/
|
||||
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
||||
/**
|
||||
* When `stdout` is a TTY, calling `console.clear()` will attempt to clear the
|
||||
* TTY. When `stdout` is not a TTY, this method does nothing.
|
||||
*
|
||||
* The specific operation of `console.clear()` can vary across operating systems
|
||||
* and terminal types. For most Linux operating systems, `console.clear()` operates similarly to the `clear` shell command. On Windows, `console.clear()` will clear only the output in the
|
||||
* current terminal viewport for the Node.js
|
||||
* binary.
|
||||
* @since v8.3.0
|
||||
*/
|
||||
clear(): void;
|
||||
/**
|
||||
* Maintains an internal counter specific to `label` and outputs to `stdout` the
|
||||
* number of times `console.count()` has been called with the given `label`.
|
||||
*
|
||||
* ```js
|
||||
* > console.count()
|
||||
* default: 1
|
||||
* undefined
|
||||
* > console.count('default')
|
||||
* default: 2
|
||||
* undefined
|
||||
* > console.count('abc')
|
||||
* abc: 1
|
||||
* undefined
|
||||
* > console.count('xyz')
|
||||
* xyz: 1
|
||||
* undefined
|
||||
* > console.count('abc')
|
||||
* abc: 2
|
||||
* undefined
|
||||
* > console.count()
|
||||
* default: 3
|
||||
* undefined
|
||||
* >
|
||||
* ```
|
||||
* @since v8.3.0
|
||||
* @param [label='default'] The display label for the counter.
|
||||
*/
|
||||
count(label?: string): void;
|
||||
/**
|
||||
* Resets the internal counter specific to `label`.
|
||||
*
|
||||
* ```js
|
||||
* > console.count('abc');
|
||||
* abc: 1
|
||||
* undefined
|
||||
* > console.countReset('abc');
|
||||
* undefined
|
||||
* > console.count('abc');
|
||||
* abc: 1
|
||||
* undefined
|
||||
* >
|
||||
* ```
|
||||
* @since v8.3.0
|
||||
* @param [label='default'] The display label for the counter.
|
||||
*/
|
||||
countReset(label?: string): void;
|
||||
/**
|
||||
* The `console.debug()` function is an alias for {@link log}.
|
||||
* @since v8.0.0
|
||||
*/
|
||||
debug(message?: any, ...optionalParams: any[]): void;
|
||||
/**
|
||||
* Uses [`util.inspect()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilinspectobject-options) on `obj` and prints the resulting string to `stdout`.
|
||||
* This function bypasses any custom `inspect()` function defined on `obj`.
|
||||
* @since v0.1.101
|
||||
*/
|
||||
dir(obj: any, options?: InspectOptions): void;
|
||||
/**
|
||||
* This method calls `console.log()` passing it the arguments received.
|
||||
* This method does not produce any XML formatting.
|
||||
* @since v8.0.0
|
||||
*/
|
||||
dirxml(...data: any[]): void;
|
||||
/**
|
||||
* Prints to `stderr` with newline. Multiple arguments can be passed, with the
|
||||
* first used as the primary message and all additional used as substitution
|
||||
* values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html)
|
||||
* (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)).
|
||||
*
|
||||
* ```js
|
||||
* const code = 5;
|
||||
* console.error('error #%d', code);
|
||||
* // Prints: error #5, to stderr
|
||||
* console.error('error', code);
|
||||
* // Prints: error 5, to stderr
|
||||
* ```
|
||||
*
|
||||
* If formatting elements (e.g. `%d`) are not found in the first string then
|
||||
* [`util.inspect()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilinspectobject-options) is called on each argument and the
|
||||
* resulting string values are concatenated. See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)
|
||||
* for more information.
|
||||
* @since v0.1.100
|
||||
*/
|
||||
error(message?: any, ...optionalParams: any[]): void;
|
||||
/**
|
||||
* Increases indentation of subsequent lines by spaces for `groupIndentation` length.
|
||||
*
|
||||
* If one or more `label`s are provided, those are printed first without the
|
||||
* additional indentation.
|
||||
* @since v8.5.0
|
||||
*/
|
||||
group(...label: any[]): void;
|
||||
/**
|
||||
* An alias for {@link group}.
|
||||
* @since v8.5.0
|
||||
*/
|
||||
groupCollapsed(...label: any[]): void;
|
||||
/**
|
||||
* Decreases indentation of subsequent lines by spaces for `groupIndentation` length.
|
||||
* @since v8.5.0
|
||||
*/
|
||||
groupEnd(): void;
|
||||
/**
|
||||
* The `console.info()` function is an alias for {@link log}.
|
||||
* @since v0.1.100
|
||||
*/
|
||||
info(message?: any, ...optionalParams: any[]): void;
|
||||
/**
|
||||
* Prints to `stdout` with newline. Multiple arguments can be passed, with the
|
||||
* first used as the primary message and all additional used as substitution
|
||||
* values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html)
|
||||
* (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)).
|
||||
*
|
||||
* ```js
|
||||
* const count = 5;
|
||||
* console.log('count: %d', count);
|
||||
* // Prints: count: 5, to stdout
|
||||
* console.log('count:', count);
|
||||
* // Prints: count: 5, to stdout
|
||||
* ```
|
||||
*
|
||||
* See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information.
|
||||
* @since v0.1.100
|
||||
*/
|
||||
log(message?: any, ...optionalParams: any[]): void;
|
||||
/**
|
||||
* Try to construct a table with the columns of the properties of `tabularData` (or use `properties`) and rows of `tabularData` and log it. Falls back to just
|
||||
* logging the argument if it can't be parsed as tabular.
|
||||
*
|
||||
* ```js
|
||||
* // These can't be parsed as tabular data
|
||||
* console.table(Symbol());
|
||||
* // Symbol()
|
||||
*
|
||||
* console.table(undefined);
|
||||
* // undefined
|
||||
*
|
||||
* console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]);
|
||||
* // ┌─────────┬─────┬─────┐
|
||||
* // │ (index) │ a │ b │
|
||||
* // ├─────────┼─────┼─────┤
|
||||
* // │ 0 │ 1 │ 'Y' │
|
||||
* // │ 1 │ 'Z' │ 2 │
|
||||
* // └─────────┴─────┴─────┘
|
||||
*
|
||||
* console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']);
|
||||
* // ┌─────────┬─────┐
|
||||
* // │ (index) │ a │
|
||||
* // ├─────────┼─────┤
|
||||
* // │ 0 │ 1 │
|
||||
* // │ 1 │ 'Z' │
|
||||
* // └─────────┴─────┘
|
||||
* ```
|
||||
* @since v10.0.0
|
||||
* @param properties Alternate properties for constructing the table.
|
||||
*/
|
||||
table(tabularData: any, properties?: readonly string[]): void;
|
||||
/**
|
||||
* Starts a timer that can be used to compute the duration of an operation. Timers
|
||||
* are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in
|
||||
* suitable time units to `stdout`. For example, if the elapsed
|
||||
* time is 3869ms, `console.timeEnd()` displays "3.869s".
|
||||
* @since v0.1.104
|
||||
* @param [label='default']
|
||||
*/
|
||||
time(label?: string): void;
|
||||
/**
|
||||
* Stops a timer that was previously started by calling {@link time} and
|
||||
* prints the result to `stdout`:
|
||||
*
|
||||
* ```js
|
||||
* console.time('bunch-of-stuff');
|
||||
* // Do a bunch of stuff.
|
||||
* console.timeEnd('bunch-of-stuff');
|
||||
* // Prints: bunch-of-stuff: 225.438ms
|
||||
* ```
|
||||
* @since v0.1.104
|
||||
* @param [label='default']
|
||||
*/
|
||||
timeEnd(label?: string): void;
|
||||
/**
|
||||
* For a timer that was previously started by calling {@link time}, prints
|
||||
* the elapsed time and other `data` arguments to `stdout`:
|
||||
*
|
||||
* ```js
|
||||
* console.time('process');
|
||||
* const value = expensiveProcess1(); // Returns 42
|
||||
* console.timeLog('process', value);
|
||||
* // Prints "process: 365.227ms 42".
|
||||
* doExpensiveProcess2(value);
|
||||
* console.timeEnd('process');
|
||||
* ```
|
||||
* @since v10.7.0
|
||||
* @param [label='default']
|
||||
*/
|
||||
timeLog(label?: string, ...data: any[]): void;
|
||||
/**
|
||||
* Prints to `stderr` the string `'Trace: '`, followed by the [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)
|
||||
* formatted message and stack trace to the current position in the code.
|
||||
*
|
||||
* ```js
|
||||
* console.trace('Show me');
|
||||
* // Prints: (stack trace will vary based on where trace is called)
|
||||
* // Trace: Show me
|
||||
* // at repl:2:9
|
||||
* // at REPLServer.defaultEval (repl.js:248:27)
|
||||
* // at bound (domain.js:287:14)
|
||||
* // at REPLServer.runBound [as eval] (domain.js:300:12)
|
||||
* // at REPLServer.<anonymous> (repl.js:412:12)
|
||||
* // at emitOne (events.js:82:20)
|
||||
* // at REPLServer.emit (events.js:169:7)
|
||||
* // at REPLServer.Interface._onLine (readline.js:210:10)
|
||||
* // at REPLServer.Interface._line (readline.js:549:8)
|
||||
* // at REPLServer.Interface._ttyWrite (readline.js:826:14)
|
||||
* ```
|
||||
* @since v0.1.104
|
||||
*/
|
||||
trace(message?: any, ...optionalParams: any[]): void;
|
||||
/**
|
||||
* The `console.warn()` function is an alias for {@link error}.
|
||||
* @since v0.1.100
|
||||
*/
|
||||
warn(message?: any, ...optionalParams: any[]): void;
|
||||
// --- Inspector mode only ---
|
||||
/**
|
||||
* This method does not display anything unless used in the inspector. The `console.profile()`
|
||||
* method starts a JavaScript CPU profile with an optional label until {@link profileEnd}
|
||||
* is called. The profile is then added to the Profile panel of the inspector.
|
||||
*
|
||||
* ```js
|
||||
* console.profile('MyLabel');
|
||||
* // Some code
|
||||
* console.profileEnd('MyLabel');
|
||||
* // Adds the profile 'MyLabel' to the Profiles panel of the inspector.
|
||||
* ```
|
||||
* @since v8.0.0
|
||||
*/
|
||||
profile(label?: string): void;
|
||||
/**
|
||||
* This method does not display anything unless used in the inspector. Stops the current
|
||||
* JavaScript CPU profiling session if one has been started and prints the report to the
|
||||
* Profiles panel of the inspector. See {@link profile} for an example.
|
||||
*
|
||||
* If this method is called without a label, the most recently started profile is stopped.
|
||||
* @since v8.0.0
|
||||
*/
|
||||
profileEnd(label?: string): void;
|
||||
/**
|
||||
* This method does not display anything unless used in the inspector. The `console.timeStamp()`
|
||||
* method adds an event with the label `'label'` to the Timeline panel of the inspector.
|
||||
* @since v8.0.0
|
||||
*/
|
||||
timeStamp(label?: string): void;
|
||||
}
|
||||
/**
|
||||
* The `console` module provides a simple debugging console that is similar to the
|
||||
* JavaScript console mechanism provided by web browsers.
|
||||
*
|
||||
* The module exports two specific components:
|
||||
*
|
||||
* * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream.
|
||||
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and
|
||||
* [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module.
|
||||
*
|
||||
* _**Warning**_: The global console object's methods are neither consistently
|
||||
* synchronous like the browser APIs they resemble, nor are they consistently
|
||||
* asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for
|
||||
* more information.
|
||||
*
|
||||
* Example using the global `console`:
|
||||
*
|
||||
* ```js
|
||||
* console.log('hello world');
|
||||
* // Prints: hello world, to stdout
|
||||
* console.log('hello %s', 'world');
|
||||
* // Prints: hello world, to stdout
|
||||
* console.error(new Error('Whoops, something bad happened'));
|
||||
* // Prints error message and stack trace to stderr:
|
||||
* // Error: Whoops, something bad happened
|
||||
* // at [eval]:5:15
|
||||
* // at Script.runInThisContext (node:vm:132:18)
|
||||
* // at Object.runInThisContext (node:vm:309:38)
|
||||
* // at node:internal/process/execution:77:19
|
||||
* // at [eval]-wrapper:6:22
|
||||
* // at evalScript (node:internal/process/execution:76:60)
|
||||
* // at node:internal/main/eval_string:23:3
|
||||
*
|
||||
* const name = 'Will Robinson';
|
||||
* console.warn(`Danger ${name}! Danger!`);
|
||||
* // Prints: Danger Will Robinson! Danger!, to stderr
|
||||
* ```
|
||||
*
|
||||
* Example using the `Console` class:
|
||||
*
|
||||
* ```js
|
||||
* const out = getStreamSomehow();
|
||||
* const err = getStreamSomehow();
|
||||
* const myConsole = new console.Console(out, err);
|
||||
*
|
||||
* myConsole.log('hello world');
|
||||
* // Prints: hello world, to out
|
||||
* myConsole.log('hello %s', 'world');
|
||||
* // Prints: hello world, to out
|
||||
* myConsole.error(new Error('Whoops, something bad happened'));
|
||||
* // Prints: [Error: Whoops, something bad happened], to err
|
||||
*
|
||||
* const name = 'Will Robinson';
|
||||
* myConsole.warn(`Danger ${name}! Danger!`);
|
||||
* // Prints: Danger Will Robinson! Danger!, to err
|
||||
* ```
|
||||
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/console.js)
|
||||
*/
|
||||
namespace console {
|
||||
interface ConsoleConstructorOptions {
|
||||
stdout: NodeJS.WritableStream;
|
||||
stderr?: NodeJS.WritableStream | undefined;
|
||||
/**
|
||||
* Ignore errors when writing to the underlying streams.
|
||||
* @default true
|
||||
*/
|
||||
ignoreErrors?: boolean | undefined;
|
||||
/**
|
||||
* Set color support for this `Console` instance. Setting to true enables coloring while inspecting
|
||||
* values. Setting to `false` disables coloring while inspecting values. Setting to `'auto'` makes color
|
||||
* support depend on the value of the `isTTY` property and the value returned by `getColorDepth()` on the
|
||||
* respective stream. This option can not be used, if `inspectOptions.colors` is set as well.
|
||||
* @default auto
|
||||
*/
|
||||
colorMode?: boolean | "auto" | undefined;
|
||||
/**
|
||||
* Specifies options that are passed along to
|
||||
* [`util.inspect()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilinspectobject-options).
|
||||
*/
|
||||
inspectOptions?: InspectOptions | undefined;
|
||||
/**
|
||||
* Set group indentation.
|
||||
* @default 2
|
||||
*/
|
||||
groupIndentation?: number | undefined;
|
||||
}
|
||||
interface ConsoleConstructor {
|
||||
prototype: Console;
|
||||
new(stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
|
||||
new(options: ConsoleConstructorOptions): Console;
|
||||
}
|
||||
}
|
||||
var console: Console;
|
||||
}
|
||||
export = globalThis.console;
|
||||
}
|
||||
19
config/node_modules/@types/node/constants.d.ts
generated
vendored
Normal file
19
config/node_modules/@types/node/constants.d.ts
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
|
||||
declare module "constants" {
|
||||
import { constants as osConstants, SignalConstants } from "node:os";
|
||||
import { constants as cryptoConstants } from "node:crypto";
|
||||
import { constants as fsConstants } from "node:fs";
|
||||
|
||||
const exp:
|
||||
& typeof osConstants.errno
|
||||
& typeof osConstants.priority
|
||||
& SignalConstants
|
||||
& typeof cryptoConstants
|
||||
& typeof fsConstants;
|
||||
export = exp;
|
||||
}
|
||||
|
||||
declare module "node:constants" {
|
||||
import constants = require("constants");
|
||||
export = constants;
|
||||
}
|
||||
4475
config/node_modules/@types/node/crypto.d.ts
generated
vendored
Normal file
4475
config/node_modules/@types/node/crypto.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user