diff --git a/API.md b/API.md index 355d16738..3a4c641f0 100755 --- a/API.md +++ b/API.md @@ -2727,7 +2727,6 @@ Requires the string value to be a valid domain name. - `options` - optional settings: - `allowFullyQualified` - if `true`, domains ending with a `.` character are permitted. Defaults to `false`. - `allowUnicode` - if `true`, Unicode characters are permitted. Defaults to `true`. - - `allowUnderscore` - if `true`, underscores (`_`) are allowed in the domain name. Defaults to `false`. - `minDomainSegments` - number of segments required for the domain. Defaults to `2`. - `maxDomainSegments` - maximum number of allowed domain segments. Default to no limit. - `tlds` - options for TLD (top level domain) validation. By default, the TLD must be a valid @@ -2755,7 +2754,6 @@ Requires the string value to be a valid email address. - `options` - optional settings: - `allowFullyQualified` - if `true`, domains ending with a `.` character are permitted. Defaults to `false`. - `allowUnicode` - if `true`, Unicode characters are permitted. Defaults to `true`. - - `allowUnderscore` - if `true`, underscores (`_`) are allowed in the domain name. Defaults to `false`. - `ignoreLength` - if `true`, ignore invalid email length errors. Defaults to `false`. - `minDomainSegments` - number of segments required for the domain. The default setting excludes single segment domains such as `example@io` which is a valid email but very uncommon. Defaults diff --git a/benchmarks/bench.js b/benchmarks/bench.js index df36c55c0..bf46c449f 100755 --- a/benchmarks/bench.js +++ b/benchmarks/bench.js @@ -2,7 +2,7 @@ const Fs = require('fs'); -const Assert = require('@hapi/hoek/assert'); +const Assert = require('@hapi/hoek/lib/assert'); const Benchmark = require('benchmark'); const Bossy = require('@hapi/bossy'); const Chalk = require('chalk'); diff --git a/benchmarks/package.json b/benchmarks/package.json index 7d195472e..62b506095 100644 --- a/benchmarks/package.json +++ b/benchmarks/package.json @@ -7,13 +7,13 @@ "full-bench": "npm run bench-update -- --joi @hapi/joi && npm test" }, "dependencies": { - "@hapi/bossy": "^6.0.1", - "@hapi/hoek": "^11.0.2", + "@hapi/bossy": "^4.0.3", + "@hapi/hoek": "^6.2.4", "@hapi/joi": "^15.1.0", "benchmark": "^2.1.4", "chalk": "^2.4.1", - "cli-table": "^0.3.11", + "cli-table": "^0.3.1", "d3-format": "^1.3.2", - "joi": "^17.8.1" + "joi": "^17.6.4" } } diff --git a/browser/package.json b/browser/package.json index 92d1d7715..0af7b4616 100755 --- a/browser/package.json +++ b/browser/package.json @@ -7,12 +7,11 @@ "test": "karma start" }, "devDependencies": { - "@babel/core": "^7.20.12", - "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/preset-env": "^7.20.2", - "@mixer/webpack-bundle-compare": "^0.1.1", + "@babel/core": "^7.4.5", + "@babel/plugin-proposal-class-properties": "^7.7.4", + "@babel/preset-env": "^7.4.5", "assert": "^2.0.0", - "babel-loader": "^9.1.2", + "babel-loader": "^8.0.6", "karma": "^4.2.0", "karma-chrome-launcher": "^3.0.0", "karma-mocha": "^1.3.0", @@ -20,9 +19,9 @@ "karma-webpack": "^5.0.0", "mocha": "^6.2.0", "mocha-loader": "^2.0.1", - "util": "^0.12.5", - "webpack": "^5.75.0", + "util": "^0.12.4", + "webpack": "^5.40.0", "webpack-bundle-analyzer": "^3.4.1", - "webpack-cli": "^4.10.0" + "webpack-cli": "^4.7.2" } } diff --git a/browser/tests/index.js b/browser/tests/index.js index d59403719..6d9aaf725 100755 --- a/browser/tests/index.js +++ b/browser/tests/index.js @@ -7,12 +7,7 @@ describe('Joi', () => { it('should be able to create schemas', () => { - Joi.boolean().truthy('true'); - Joi.number().min(5).max(10).multiple(2); - Joi.array().items(Joi.number().required()); - Joi.object({ - key: Joi.string().required() - }); + Joi.string().min(5); }); it('should be able to validate data', () => { @@ -34,23 +29,5 @@ describe('Joi', () => { Assert.ok(!schema.validate('test@example.com').error); Assert.ok(schema.validate('test@example.com ').error); Assert.ok(!schema.validate('伊昭傑@郵件.商務').error); - - const schema2 = Joi.string().email({ tlds: { allow: false } }).required(); - Assert.ok(!schema2.validate('test@example.com').error); - Assert.ok(schema2.validate('test@example.com ').error); - Assert.ok(!schema2.validate('伊昭傑@郵件.商務').error); - }); - - it('validates domain', () => { - - const schema = Joi.string().domain().required(); - Assert.ok(!schema.validate('example.com').error); - Assert.ok(schema.validate('example.com ').error); - Assert.ok(!schema.validate('example.商務').error); - - const schema2 = Joi.string().domain({ tlds: { allow: false } }).required(); - Assert.ok(!schema2.validate('example.com').error); - Assert.ok(schema2.validate('example.com ').error); - Assert.ok(!schema2.validate('example.商務').error); }); }); diff --git a/browser/webpack.config.js b/browser/webpack.config.js index 60ce44a76..266b24c73 100755 --- a/browser/webpack.config.js +++ b/browser/webpack.config.js @@ -3,7 +3,6 @@ const Path = require('path'); const Webpack = require('webpack'); -const { BundleComparisonPlugin } = require('@mixer/webpack-bundle-compare'); module.exports = { @@ -17,11 +16,6 @@ module.exports = { plugins: [ new Webpack.DefinePlugin({ Buffer: false - }), - new BundleComparisonPlugin({ - file: '../stats.msp.gz', - format: 'msgpack', - gzip: true, }) ], module: { @@ -46,16 +40,10 @@ module.exports = { ] ], plugins: [ - '@babel/plugin-proposal-class-properties', - '@babel/plugin-proposal-optional-chaining', - '@babel/plugin-proposal-nullish-coalescing-operator', + '@babel/plugin-proposal-class-properties' ] } } - }, - { - test: /@(hapi|sideway)\//, - sideEffects: false } ] }, @@ -66,8 +54,7 @@ module.exports = { [Path.join(__dirname, '../lib/manifest.js')]: false, [Path.join(__dirname, '../lib/trace.js')]: false, [Path.join(__dirname, '../lib/types/binary.js')]: false, - [Path.join(__dirname, '../node_modules/@hapi/tlds/esm/index.js')]: false, - [Path.join(__dirname, '../node_modules/@hapi/address/esm/decode.js')]: false, + [Path.join(__dirname, '../node_modules/@sideway/address/lib/tlds.js')]: false, }, fallback: { url: false, diff --git a/lib/annotate.js b/lib/annotate.js index dba6d410d..42798fc3e 100755 --- a/lib/annotate.js +++ b/lib/annotate.js @@ -1,6 +1,6 @@ 'use strict'; -const Clone = require('@hapi/hoek/clone'); +const Clone = require('@hapi/hoek/lib/clone'); const Common = require('./common'); diff --git a/lib/base.js b/lib/base.js index 927daac7a..9bd2fd73b 100755 --- a/lib/base.js +++ b/lib/base.js @@ -1,9 +1,9 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); -const Clone = require('@hapi/hoek/clone'); -const DeepEqual = require('@hapi/hoek/deepEqual'); -const Merge = require('@hapi/hoek/merge'); +const Assert = require('@hapi/hoek/lib/assert'); +const Clone = require('@hapi/hoek/lib/clone'); +const DeepEqual = require('@hapi/hoek/lib/deepEqual'); +const Merge = require('@hapi/hoek/lib/merge'); const Cache = require('./cache'); const Common = require('./common'); diff --git a/lib/cache.js b/lib/cache.js index 42790a4e4..32c61e0e4 100755 --- a/lib/cache.js +++ b/lib/cache.js @@ -1,7 +1,7 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); -const Clone = require('@hapi/hoek/clone'); +const Assert = require('@hapi/hoek/lib/assert'); +const Clone = require('@hapi/hoek/lib/clone'); const Common = require('./common'); diff --git a/lib/common.js b/lib/common.js index 5bb54f637..7d572c139 100755 --- a/lib/common.js +++ b/lib/common.js @@ -1,7 +1,7 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); -const AssertError = require('@hapi/hoek/assertError'); +const Assert = require('@hapi/hoek/lib/assert'); +const AssertError = require('@hapi/hoek/lib/error'); const Pkg = require('../package.json'); diff --git a/lib/compile.js b/lib/compile.js index fb891e9e4..5593b7c90 100755 --- a/lib/compile.js +++ b/lib/compile.js @@ -1,6 +1,6 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); +const Assert = require('@hapi/hoek/lib/assert'); const Common = require('./common'); const Ref = require('./ref'); diff --git a/lib/extend.js b/lib/extend.js index cc85ffcd1..2a5acf7b4 100755 --- a/lib/extend.js +++ b/lib/extend.js @@ -1,7 +1,7 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); -const Clone = require('@hapi/hoek/clone'); +const Assert = require('@hapi/hoek/lib/assert'); +const Clone = require('@hapi/hoek/lib/clone'); const Common = require('./common'); const Messages = require('./messages'); diff --git a/lib/index.d.ts b/lib/index.d.ts index 2d99da396..8d0f415b4 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -290,12 +290,6 @@ declare namespace Joi { * @default true */ allowUnicode?: boolean; - /** - * If `true`, underscores (`_`) are allowed in the domain name - * - * @default false - */ - allowUnderscore?: boolean; /** * if `true`, ignore invalid email length errors. * @@ -347,12 +341,7 @@ declare namespace Joi { * @default true */ allowUnicode?: boolean; - /** - * If `true`, underscores (`_`) are allowed in the domain name - * - * @default false - */ - allowUnderscore?: boolean; + /** * Options for TLD (top level domain) validation. By default, the TLD must be a valid name listed on the [IANA registry](http://data.iana.org/TLD/tlds-alpha-by-domain.txt) * diff --git a/lib/index.js b/lib/index.js index bb6e64701..784aef4b1 100755 --- a/lib/index.js +++ b/lib/index.js @@ -1,7 +1,7 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); -const Clone = require('@hapi/hoek/clone'); +const Assert = require('@hapi/hoek/lib/assert'); +const Clone = require('@hapi/hoek/lib/clone'); const Cache = require('./cache'); const Common = require('./common'); diff --git a/lib/manifest.js b/lib/manifest.js index ac74c64a6..8fed3c923 100755 --- a/lib/manifest.js +++ b/lib/manifest.js @@ -1,7 +1,7 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); -const Clone = require('@hapi/hoek/clone'); +const Assert = require('@hapi/hoek/lib/assert'); +const Clone = require('@hapi/hoek/lib/clone'); const Common = require('./common'); const Messages = require('./messages'); diff --git a/lib/messages.js b/lib/messages.js index 3435fc210..5eef308cd 100755 --- a/lib/messages.js +++ b/lib/messages.js @@ -1,7 +1,7 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); -const Clone = require('@hapi/hoek/clone'); +const Assert = require('@hapi/hoek/lib/assert'); +const Clone = require('@hapi/hoek/lib/clone'); const Template = require('./template'); diff --git a/lib/modify.js b/lib/modify.js index 367185bb8..6f1484847 100755 --- a/lib/modify.js +++ b/lib/modify.js @@ -1,6 +1,6 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); +const Assert = require('@hapi/hoek/lib/assert'); const Common = require('./common'); const Ref = require('./ref'); diff --git a/lib/ref.js b/lib/ref.js index 9d870badd..9f84a7b6d 100755 --- a/lib/ref.js +++ b/lib/ref.js @@ -1,8 +1,8 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); -const Clone = require('@hapi/hoek/clone'); -const Reach = require('@hapi/hoek/reach'); +const Assert = require('@hapi/hoek/lib/assert'); +const Clone = require('@hapi/hoek/lib/clone'); +const Reach = require('@hapi/hoek/lib/reach'); const Common = require('./common'); diff --git a/lib/state.js b/lib/state.js index c2508e0a2..8db251b76 100755 --- a/lib/state.js +++ b/lib/state.js @@ -1,7 +1,7 @@ 'use strict'; -const Clone = require('@hapi/hoek/clone'); -const Reach = require('@hapi/hoek/reach'); +const Clone = require('@hapi/hoek/lib/clone'); +const Reach = require('@hapi/hoek/lib/reach'); const Common = require('./common'); diff --git a/lib/template.js b/lib/template.js index fc4b21c20..3858ad17f 100755 --- a/lib/template.js +++ b/lib/template.js @@ -1,9 +1,9 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); -const Clone = require('@hapi/hoek/clone'); -const EscapeHtml = require('@hapi/hoek/escapeHtml'); -const Formula = require('@hapi/formula'); +const Assert = require('@hapi/hoek/lib/assert'); +const Clone = require('@hapi/hoek/lib/clone'); +const EscapeHtml = require('@hapi/hoek/lib/escapeHtml'); +const Formula = require('@sideway/formula'); const Common = require('./common'); const Errors = require('./errors'); diff --git a/lib/trace.js b/lib/trace.js index 4a7370e64..ded4d7e76 100755 --- a/lib/trace.js +++ b/lib/trace.js @@ -1,7 +1,7 @@ 'use strict'; -const DeepEqual = require('@hapi/hoek/deepEqual'); -const Pinpoint = require('@hapi/pinpoint'); +const DeepEqual = require('@hapi/hoek/lib/deepEqual'); +const Pinpoint = require('@sideway/pinpoint'); const Errors = require('./errors'); diff --git a/lib/types/alternatives.js b/lib/types/alternatives.js index cb0a81cf5..e4024959c 100755 --- a/lib/types/alternatives.js +++ b/lib/types/alternatives.js @@ -1,7 +1,7 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); -const Merge = require('@hapi/hoek/merge'); +const Assert = require('@hapi/hoek/lib/assert'); +const Merge = require('@hapi/hoek/lib/merge'); const Any = require('./any'); const Common = require('../common'); diff --git a/lib/types/any.js b/lib/types/any.js index a30cc3b94..2b1ad58b8 100755 --- a/lib/types/any.js +++ b/lib/types/any.js @@ -1,6 +1,6 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); +const Assert = require('@hapi/hoek/lib/assert'); const Base = require('../base'); const Common = require('../common'); diff --git a/lib/types/array.js b/lib/types/array.js index 605381a44..7682e8293 100755 --- a/lib/types/array.js +++ b/lib/types/array.js @@ -1,8 +1,8 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); -const DeepEqual = require('@hapi/hoek/deepEqual'); -const Reach = require('@hapi/hoek/reach'); +const Assert = require('@hapi/hoek/lib/assert'); +const DeepEqual = require('@hapi/hoek/lib/deepEqual'); +const Reach = require('@hapi/hoek/lib/reach'); const Any = require('./any'); const Common = require('../common'); diff --git a/lib/types/binary.js b/lib/types/binary.js index 28e1bc2c2..9147166ab 100755 --- a/lib/types/binary.js +++ b/lib/types/binary.js @@ -1,6 +1,6 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); +const Assert = require('@hapi/hoek/lib/assert'); const Any = require('./any'); const Common = require('../common'); diff --git a/lib/types/boolean.js b/lib/types/boolean.js index 85fc087a2..686586648 100755 --- a/lib/types/boolean.js +++ b/lib/types/boolean.js @@ -1,6 +1,6 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); +const Assert = require('@hapi/hoek/lib/assert'); const Any = require('./any'); const Common = require('../common'); diff --git a/lib/types/date.js b/lib/types/date.js index bab8e1610..b8206c6f8 100755 --- a/lib/types/date.js +++ b/lib/types/date.js @@ -1,6 +1,6 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); +const Assert = require('@hapi/hoek/lib/assert'); const Any = require('./any'); const Common = require('../common'); diff --git a/lib/types/function.js b/lib/types/function.js index 09bdaab78..eb8792e43 100755 --- a/lib/types/function.js +++ b/lib/types/function.js @@ -1,6 +1,6 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); +const Assert = require('@hapi/hoek/lib/assert'); const Keys = require('./keys'); diff --git a/lib/types/keys.js b/lib/types/keys.js index 37251e654..a907c4d00 100755 --- a/lib/types/keys.js +++ b/lib/types/keys.js @@ -1,8 +1,8 @@ 'use strict'; -const ApplyToDefaults = require('@hapi/hoek/applyToDefaults'); -const Assert = require('@hapi/hoek/assert'); -const Clone = require('@hapi/hoek/clone'); +const ApplyToDefaults = require('@hapi/hoek/lib/applyToDefaults'); +const Assert = require('@hapi/hoek/lib/assert'); +const Clone = require('@hapi/hoek/lib/clone'); const Topo = require('@hapi/topo'); const Any = require('./any'); diff --git a/lib/types/link.js b/lib/types/link.js index 3b86bc807..d99d0025c 100755 --- a/lib/types/link.js +++ b/lib/types/link.js @@ -1,6 +1,6 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); +const Assert = require('@hapi/hoek/lib/assert'); const Any = require('./any'); const Common = require('../common'); diff --git a/lib/types/number.js b/lib/types/number.js index 6070e408a..2031bb3e0 100755 --- a/lib/types/number.js +++ b/lib/types/number.js @@ -1,6 +1,6 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); +const Assert = require('@hapi/hoek/lib/assert'); const Any = require('./any'); const Common = require('../common'); diff --git a/lib/types/string.js b/lib/types/string.js index 81b3f946f..cdaffc409 100755 --- a/lib/types/string.js +++ b/lib/types/string.js @@ -1,16 +1,19 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); -const { isDomainValid, isEmailValid, ipRegex, uriRegex } = require('@hapi/address'); -const EscapeRegex = require('@hapi/hoek/escapeRegex'); -const Tlds = require('@hapi/tlds'); +const Assert = require('@hapi/hoek/lib/assert'); +const Domain = require('@sideway/address/lib/domain'); +const Email = require('@sideway/address/lib/email'); +const Ip = require('@sideway/address/lib/ip'); +const EscapeRegex = require('@hapi/hoek/lib/escapeRegex'); +const Tlds = require('@sideway/address/lib/tlds'); +const Uri = require('@sideway/address/lib/uri'); const Any = require('./any'); const Common = require('../common'); const internals = { - tlds: Tlds.tlds instanceof Set ? { tlds: { allow: Tlds.tlds, deny: null } } : false, // $lab:coverage:ignore$ + tlds: Tlds instanceof Set ? { tlds: { allow: Tlds, deny: null } } : false, // $lab:coverage:ignore$ base64Regex: { // paddingRequired true: { @@ -25,7 +28,7 @@ const internals = { }, dataUriRegex: /^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/, hexRegex: /^[a-f0-9]+$/i, - ipRegex: ipRegex({ cidr: 'forbidden' }).regex, + ipRegex: Ip.regex({ cidr: 'forbidden' }).regex, isoDurationRegex: /^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/, guidBrackets: { @@ -261,7 +264,7 @@ module.exports = Any.extend({ method(options) { if (options) { - Common.assertOptions(options, ['allowFullyQualified', 'allowUnicode', 'allowUnderscore', 'maxDomainSegments', 'minDomainSegments', 'tlds']); + Common.assertOptions(options, ['allowFullyQualified', 'allowUnicode', 'maxDomainSegments', 'minDomainSegments', 'tlds']); } const address = internals.addressOptions(options); @@ -269,7 +272,7 @@ module.exports = Any.extend({ }, validate(value, helpers, args, { address }) { - if (isDomainValid(value, address)) { + if (Domain.isValid(value, address)) { return value; } @@ -293,7 +296,7 @@ module.exports = Any.extend({ const emails = options.multiple ? value.split(regex) : [value]; const invalids = []; for (const email of emails) { - if (!isEmailValid(email, address)) { + if (!Email.isValid(email, address)) { invalids.push(email); } } @@ -392,7 +395,7 @@ module.exports = Any.extend({ }, validate(value, helpers) { - if (isDomainValid(value, { minDomainSegments: 1 }) || + if (Domain.isValid(value, { minDomainSegments: 1 }) || internals.ipRegex.test(value)) { return value; @@ -414,7 +417,7 @@ module.exports = Any.extend({ Common.assertOptions(options, ['cidr', 'version']); - const { cidr, versions, regex } = ipRegex(options); + const { cidr, versions, regex } = Ip.regex(options); const version = options.version ? versions : undefined; return this.$_addRule({ name: 'ip', args: { options: { cidr, version } }, regex }); }, @@ -639,7 +642,7 @@ module.exports = Any.extend({ Common.assertOptions(options.domain, ['allowFullyQualified', 'allowUnicode', 'maxDomainSegments', 'minDomainSegments', 'tlds']); } - const { regex, scheme } = uriRegex(options); + const { regex, scheme } = Uri.regex(options); const domain = options.domain ? internals.addressOptions(options.domain) : null; return this.$_addRule({ name: 'uri', args: { options }, regex, domain, scheme }); }, @@ -654,7 +657,7 @@ module.exports = Any.extend({ const matched = match[1] || match[2]; if (domain && (!options.allowRelative || matched) && - !isDomainValid(matched, domain)) { + !Domain.isValid(matched, domain)) { return helpers.error('string.domain', { value: matched }); } @@ -772,7 +775,7 @@ internals.addressOptions = function (options) { const allow = options.tlds.allow; if (!allow) { - return { ...options, tlds: false }; + return options; } if (allow === true) { @@ -793,7 +796,7 @@ internals.addressOptions = function (options) { internals.validateTlds = function (set, source) { for (const tld of set) { - Assert(isDomainValid(tld, { minDomainSegments: 1, maxDomainSegments: 1 }), `${source} must contain valid top level domain names`); + Assert(Domain.isValid(tld, { minDomainSegments: 1, maxDomainSegments: 1 }), `${source} must contain valid top level domain names`); } }; diff --git a/lib/types/symbol.js b/lib/types/symbol.js index a7b685811..eafe9ae53 100755 --- a/lib/types/symbol.js +++ b/lib/types/symbol.js @@ -1,6 +1,6 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); +const Assert = require('@hapi/hoek/lib/assert'); const Any = require('./any'); diff --git a/lib/validator.js b/lib/validator.js index 1aa626c29..cd29ed832 100755 --- a/lib/validator.js +++ b/lib/validator.js @@ -1,9 +1,9 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); -const Clone = require('@hapi/hoek/clone'); -const Ignore = require('@hapi/hoek/ignore'); -const Reach = require('@hapi/hoek/reach'); +const Assert = require('@hapi/hoek/lib/assert'); +const Clone = require('@hapi/hoek/lib/clone'); +const Ignore = require('@hapi/hoek/lib/ignore'); +const Reach = require('@hapi/hoek/lib/reach'); const Common = require('./common'); const Errors = require('./errors'); diff --git a/lib/values.js b/lib/values.js index 8a36f2a7b..bfdb90b41 100755 --- a/lib/values.js +++ b/lib/values.js @@ -1,7 +1,7 @@ 'use strict'; -const Assert = require('@hapi/hoek/assert'); -const DeepEqual = require('@hapi/hoek/deepEqual'); +const Assert = require('@hapi/hoek/lib/assert'); +const DeepEqual = require('@hapi/hoek/lib/deepEqual'); const Common = require('./common'); diff --git a/package.json b/package.json index 5cc882b00..3133a8607 100755 --- a/package.json +++ b/package.json @@ -15,18 +15,17 @@ "validation" ], "dependencies": { - "@hapi/hoek": "^11.0.2", - "@hapi/tlds": "^1.0.1", - "@hapi/topo": "^6.0.1", - "@hapi/address": "^5.1.0", - "@hapi/pinpoint": "^2.0.1", - "@hapi/formula": "^3.0.2" + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.3", + "@sideway/formula": "^3.0.1", + "@sideway/pinpoint": "^2.0.0" }, "devDependencies": { - "@hapi/bourne": "^3.0.0", - "@hapi/code": "^9.0.3", + "@hapi/bourne": "2.x.x", + "@hapi/code": "8.x.x", "@hapi/joi-legacy-test": "npm:@hapi/joi@15.x.x", - "@hapi/lab": "^25.1.2", + "@hapi/lab": "^25.0.1", "@types/node": "^14.18.24", "typescript": "4.3.x" }, diff --git a/test/trace.js b/test/trace.js index dadc9e7f8..360dbb76c 100755 --- a/test/trace.js +++ b/test/trace.js @@ -3,7 +3,7 @@ const Code = require('@hapi/code'); const Lab = require('@hapi/lab'); const Joi = require('..'); -const Pinpoint = require('@hapi/pinpoint'); +const Pinpoint = require('@sideway/pinpoint'); const internals = {}; diff --git a/test/types/string.js b/test/types/string.js index 9b3c40592..fdc34744a 100755 --- a/test/types/string.js +++ b/test/types/string.js @@ -1334,37 +1334,6 @@ describe('string', () => { context: { value: 'something', label: 'item', key: 'item' } }]]); }); - - it('validates domain with underscores', () => { - - const validSchema = Joi.string().domain({ allowUnderscore: true }); - Helper.validate(validSchema, [ - ['_acme-challenge.example.com', true], - ['_abc.example.com', true] - ]); - - const invalidSchema = Joi.string().domain(); - Helper.validate(invalidSchema, [ - ['_acme-challenge.example.com', false, { - context: { - label: 'value', - value: '_acme-challenge.example.com' - }, - message: '"value" must contain a valid domain name', - path: [], - type: 'string.domain' - }], - ['_abc.example.com', false, { - context: { - label: 'value', - value: '_abc.example.com' - }, - message: '"value" must contain a valid domain name', - path: [], - type: 'string.domain' - }] - ]); - }); }); describe('email()', () => { @@ -4620,7 +4589,7 @@ describe('string', () => { it('throws when options.cidr is not a string', () => { - expect(() => Joi.string().ip({ cidr: 42 })).to.throw('options.cidr must be one of required, optional, forbidden'); + expect(() => Joi.string().ip({ cidr: 42 })).to.throw('options.cidr must be a string'); }); it('throws when options.cidr is not a valid value', () => {