joi 17.8.2 → 17.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/annotate.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const Clone = require('@hapi/hoek/clone');
3
+ const Clone = require('@hapi/hoek/lib/clone');
4
4
 
5
5
  const Common = require('./common');
6
6
 
package/lib/base.js CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
4
- const Clone = require('@hapi/hoek/clone');
5
- const DeepEqual = require('@hapi/hoek/deepEqual');
6
- const Merge = require('@hapi/hoek/merge');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
+ const Clone = require('@hapi/hoek/lib/clone');
5
+ const DeepEqual = require('@hapi/hoek/lib/deepEqual');
6
+ const Merge = require('@hapi/hoek/lib/merge');
7
7
 
8
8
  const Cache = require('./cache');
9
9
  const Common = require('./common');
package/lib/cache.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
4
- const Clone = require('@hapi/hoek/clone');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
+ const Clone = require('@hapi/hoek/lib/clone');
5
5
 
6
6
  const Common = require('./common');
7
7
 
package/lib/common.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
4
- const AssertError = require('@hapi/hoek/assertError');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
+ const AssertError = require('@hapi/hoek/lib/error');
5
5
 
6
6
  const Pkg = require('../package.json');
7
7
 
package/lib/compile.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
4
 
5
5
  const Common = require('./common');
6
6
  const Ref = require('./ref');
package/lib/extend.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
4
- const Clone = require('@hapi/hoek/clone');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
+ const Clone = require('@hapi/hoek/lib/clone');
5
5
 
6
6
  const Common = require('./common');
7
7
  const Messages = require('./messages');
package/lib/index.d.ts CHANGED
@@ -290,12 +290,6 @@ declare namespace Joi {
290
290
  * @default true
291
291
  */
292
292
  allowUnicode?: boolean;
293
- /**
294
- * If `true`, underscores (`_`) are allowed in the domain name
295
- *
296
- * @default false
297
- */
298
- allowUnderscore?: boolean;
299
293
  /**
300
294
  * if `true`, ignore invalid email length errors.
301
295
  *
@@ -347,12 +341,7 @@ declare namespace Joi {
347
341
  * @default true
348
342
  */
349
343
  allowUnicode?: boolean;
350
- /**
351
- * If `true`, underscores (`_`) are allowed in the domain name
352
- *
353
- * @default false
354
- */
355
- allowUnderscore?: boolean;
344
+
356
345
  /**
357
346
  * 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)
358
347
  *
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
4
- const Clone = require('@hapi/hoek/clone');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
+ const Clone = require('@hapi/hoek/lib/clone');
5
5
 
6
6
  const Cache = require('./cache');
7
7
  const Common = require('./common');
package/lib/manifest.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
4
- const Clone = require('@hapi/hoek/clone');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
+ const Clone = require('@hapi/hoek/lib/clone');
5
5
 
6
6
  const Common = require('./common');
7
7
  const Messages = require('./messages');
package/lib/messages.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
4
- const Clone = require('@hapi/hoek/clone');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
+ const Clone = require('@hapi/hoek/lib/clone');
5
5
 
6
6
  const Template = require('./template');
7
7
 
package/lib/modify.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
4
 
5
5
  const Common = require('./common');
6
6
  const Ref = require('./ref');
package/lib/ref.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
4
- const Clone = require('@hapi/hoek/clone');
5
- const Reach = require('@hapi/hoek/reach');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
+ const Clone = require('@hapi/hoek/lib/clone');
5
+ const Reach = require('@hapi/hoek/lib/reach');
6
6
 
7
7
  const Common = require('./common');
8
8
 
package/lib/state.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const Clone = require('@hapi/hoek/clone');
4
- const Reach = require('@hapi/hoek/reach');
3
+ const Clone = require('@hapi/hoek/lib/clone');
4
+ const Reach = require('@hapi/hoek/lib/reach');
5
5
 
6
6
  const Common = require('./common');
7
7
 
package/lib/template.js CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
4
- const Clone = require('@hapi/hoek/clone');
5
- const EscapeHtml = require('@hapi/hoek/escapeHtml');
6
- const Formula = require('@hapi/formula');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
+ const Clone = require('@hapi/hoek/lib/clone');
5
+ const EscapeHtml = require('@hapi/hoek/lib/escapeHtml');
6
+ const Formula = require('@sideway/formula');
7
7
 
8
8
  const Common = require('./common');
9
9
  const Errors = require('./errors');
package/lib/trace.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const DeepEqual = require('@hapi/hoek/deepEqual');
4
- const Pinpoint = require('@hapi/pinpoint');
3
+ const DeepEqual = require('@hapi/hoek/lib/deepEqual');
4
+ const Pinpoint = require('@sideway/pinpoint');
5
5
 
6
6
  const Errors = require('./errors');
7
7
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
4
- const Merge = require('@hapi/hoek/merge');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
+ const Merge = require('@hapi/hoek/lib/merge');
5
5
 
6
6
  const Any = require('./any');
7
7
  const Common = require('../common');
package/lib/types/any.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
4
 
5
5
  const Base = require('../base');
6
6
  const Common = require('../common');
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
4
- const DeepEqual = require('@hapi/hoek/deepEqual');
5
- const Reach = require('@hapi/hoek/reach');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
+ const DeepEqual = require('@hapi/hoek/lib/deepEqual');
5
+ const Reach = require('@hapi/hoek/lib/reach');
6
6
 
7
7
  const Any = require('./any');
8
8
  const Common = require('../common');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
4
 
5
5
  const Any = require('./any');
6
6
  const Common = require('../common');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
4
 
5
5
  const Any = require('./any');
6
6
  const Common = require('../common');
package/lib/types/date.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
4
 
5
5
  const Any = require('./any');
6
6
  const Common = require('../common');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
4
 
5
5
  const Keys = require('./keys');
6
6
 
package/lib/types/keys.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const ApplyToDefaults = require('@hapi/hoek/applyToDefaults');
4
- const Assert = require('@hapi/hoek/assert');
5
- const Clone = require('@hapi/hoek/clone');
3
+ const ApplyToDefaults = require('@hapi/hoek/lib/applyToDefaults');
4
+ const Assert = require('@hapi/hoek/lib/assert');
5
+ const Clone = require('@hapi/hoek/lib/clone');
6
6
  const Topo = require('@hapi/topo');
7
7
 
8
8
  const Any = require('./any');
package/lib/types/link.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
4
 
5
5
  const Any = require('./any');
6
6
  const Common = require('../common');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
4
 
5
5
  const Any = require('./any');
6
6
  const Common = require('../common');
@@ -1,16 +1,19 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
4
- const { isDomainValid, isEmailValid, ipRegex, uriRegex } = require('@hapi/address');
5
- const EscapeRegex = require('@hapi/hoek/escapeRegex');
6
- const Tlds = require('@hapi/tlds');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
+ const Domain = require('@sideway/address/lib/domain');
5
+ const Email = require('@sideway/address/lib/email');
6
+ const Ip = require('@sideway/address/lib/ip');
7
+ const EscapeRegex = require('@hapi/hoek/lib/escapeRegex');
8
+ const Tlds = require('@sideway/address/lib/tlds');
9
+ const Uri = require('@sideway/address/lib/uri');
7
10
 
8
11
  const Any = require('./any');
9
12
  const Common = require('../common');
10
13
 
11
14
 
12
15
  const internals = {
13
- tlds: Tlds.tlds instanceof Set ? { tlds: { allow: Tlds.tlds, deny: null } } : false, // $lab:coverage:ignore$
16
+ tlds: Tlds instanceof Set ? { tlds: { allow: Tlds, deny: null } } : false, // $lab:coverage:ignore$
14
17
  base64Regex: {
15
18
  // paddingRequired
16
19
  true: {
@@ -25,7 +28,7 @@ const internals = {
25
28
  },
26
29
  dataUriRegex: /^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,
27
30
  hexRegex: /^[a-f0-9]+$/i,
28
- ipRegex: ipRegex({ cidr: 'forbidden' }).regex,
31
+ ipRegex: Ip.regex({ cidr: 'forbidden' }).regex,
29
32
  isoDurationRegex: /^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,
30
33
 
31
34
  guidBrackets: {
@@ -261,7 +264,7 @@ module.exports = Any.extend({
261
264
  method(options) {
262
265
 
263
266
  if (options) {
264
- Common.assertOptions(options, ['allowFullyQualified', 'allowUnicode', 'allowUnderscore', 'maxDomainSegments', 'minDomainSegments', 'tlds']);
267
+ Common.assertOptions(options, ['allowFullyQualified', 'allowUnicode', 'maxDomainSegments', 'minDomainSegments', 'tlds']);
265
268
  }
266
269
 
267
270
  const address = internals.addressOptions(options);
@@ -269,7 +272,7 @@ module.exports = Any.extend({
269
272
  },
270
273
  validate(value, helpers, args, { address }) {
271
274
 
272
- if (isDomainValid(value, address)) {
275
+ if (Domain.isValid(value, address)) {
273
276
  return value;
274
277
  }
275
278
 
@@ -293,7 +296,7 @@ module.exports = Any.extend({
293
296
  const emails = options.multiple ? value.split(regex) : [value];
294
297
  const invalids = [];
295
298
  for (const email of emails) {
296
- if (!isEmailValid(email, address)) {
299
+ if (!Email.isValid(email, address)) {
297
300
  invalids.push(email);
298
301
  }
299
302
  }
@@ -392,7 +395,7 @@ module.exports = Any.extend({
392
395
  },
393
396
  validate(value, helpers) {
394
397
 
395
- if (isDomainValid(value, { minDomainSegments: 1 }) ||
398
+ if (Domain.isValid(value, { minDomainSegments: 1 }) ||
396
399
  internals.ipRegex.test(value)) {
397
400
 
398
401
  return value;
@@ -414,7 +417,7 @@ module.exports = Any.extend({
414
417
 
415
418
  Common.assertOptions(options, ['cidr', 'version']);
416
419
 
417
- const { cidr, versions, regex } = ipRegex(options);
420
+ const { cidr, versions, regex } = Ip.regex(options);
418
421
  const version = options.version ? versions : undefined;
419
422
  return this.$_addRule({ name: 'ip', args: { options: { cidr, version } }, regex });
420
423
  },
@@ -639,7 +642,7 @@ module.exports = Any.extend({
639
642
  Common.assertOptions(options.domain, ['allowFullyQualified', 'allowUnicode', 'maxDomainSegments', 'minDomainSegments', 'tlds']);
640
643
  }
641
644
 
642
- const { regex, scheme } = uriRegex(options);
645
+ const { regex, scheme } = Uri.regex(options);
643
646
  const domain = options.domain ? internals.addressOptions(options.domain) : null;
644
647
  return this.$_addRule({ name: 'uri', args: { options }, regex, domain, scheme });
645
648
  },
@@ -654,7 +657,7 @@ module.exports = Any.extend({
654
657
  const matched = match[1] || match[2];
655
658
  if (domain &&
656
659
  (!options.allowRelative || matched) &&
657
- !isDomainValid(matched, domain)) {
660
+ !Domain.isValid(matched, domain)) {
658
661
 
659
662
  return helpers.error('string.domain', { value: matched });
660
663
  }
@@ -772,7 +775,7 @@ internals.addressOptions = function (options) {
772
775
 
773
776
  const allow = options.tlds.allow;
774
777
  if (!allow) {
775
- return { ...options, tlds: false };
778
+ return options;
776
779
  }
777
780
 
778
781
  if (allow === true) {
@@ -793,7 +796,7 @@ internals.addressOptions = function (options) {
793
796
  internals.validateTlds = function (set, source) {
794
797
 
795
798
  for (const tld of set) {
796
- Assert(isDomainValid(tld, { minDomainSegments: 1, maxDomainSegments: 1 }), `${source} must contain valid top level domain names`);
799
+ Assert(Domain.isValid(tld, { minDomainSegments: 1, maxDomainSegments: 1 }), `${source} must contain valid top level domain names`);
797
800
  }
798
801
  };
799
802
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
4
 
5
5
  const Any = require('./any');
6
6
 
package/lib/validator.js CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
4
- const Clone = require('@hapi/hoek/clone');
5
- const Ignore = require('@hapi/hoek/ignore');
6
- const Reach = require('@hapi/hoek/reach');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
+ const Clone = require('@hapi/hoek/lib/clone');
5
+ const Ignore = require('@hapi/hoek/lib/ignore');
6
+ const Reach = require('@hapi/hoek/lib/reach');
7
7
 
8
8
  const Common = require('./common');
9
9
  const Errors = require('./errors');
package/lib/values.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const Assert = require('@hapi/hoek/assert');
4
- const DeepEqual = require('@hapi/hoek/deepEqual');
3
+ const Assert = require('@hapi/hoek/lib/assert');
4
+ const DeepEqual = require('@hapi/hoek/lib/deepEqual');
5
5
 
6
6
  const Common = require('./common');
7
7
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "joi",
3
3
  "description": "Object schema validation",
4
- "version": "17.8.2",
4
+ "version": "17.8.3",
5
5
  "repository": "git://github.com/hapijs/joi",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -15,18 +15,17 @@
15
15
  "validation"
16
16
  ],
17
17
  "dependencies": {
18
- "@hapi/hoek": "^11.0.2",
19
- "@hapi/tlds": "^1.0.1",
20
- "@hapi/topo": "^6.0.1",
21
- "@hapi/address": "^5.1.0",
22
- "@hapi/pinpoint": "^2.0.1",
23
- "@hapi/formula": "^3.0.2"
18
+ "@hapi/hoek": "^9.0.0",
19
+ "@hapi/topo": "^5.0.0",
20
+ "@sideway/address": "^4.1.3",
21
+ "@sideway/formula": "^3.0.1",
22
+ "@sideway/pinpoint": "^2.0.0"
24
23
  },
25
24
  "devDependencies": {
26
- "@hapi/bourne": "^3.0.0",
27
- "@hapi/code": "^9.0.3",
25
+ "@hapi/bourne": "2.x.x",
26
+ "@hapi/code": "8.x.x",
28
27
  "@hapi/joi-legacy-test": "npm:@hapi/joi@15.x.x",
29
- "@hapi/lab": "^25.1.2",
28
+ "@hapi/lab": "^25.0.1",
30
29
  "@types/node": "^14.18.24",
31
30
  "typescript": "4.3.x"
32
31
  },