@palmares/schemas 0.0.1 → 0.1.0

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.
Files changed (174) hide show
  1. package/.turbo/turbo-build$colon$watch.log +12 -410
  2. package/CHANGELOG.md +17 -0
  3. package/__tests__/.drizzle/migrations/0000_skinny_harrier.sql +22 -0
  4. package/__tests__/.drizzle/migrations/meta/0000_snapshot.json +156 -0
  5. package/__tests__/.drizzle/migrations/meta/_journal.json +13 -0
  6. package/__tests__/.drizzle/schema.ts +35 -0
  7. package/__tests__/drizzle.config.ts +11 -0
  8. package/__tests__/eslint.config.js +10 -0
  9. package/__tests__/manage.ts +5 -0
  10. package/__tests__/node_modules/.bin/drizzle-kit +17 -0
  11. package/__tests__/node_modules/.bin/esbuild +14 -0
  12. package/__tests__/node_modules/.bin/tsc +17 -0
  13. package/__tests__/node_modules/.bin/tsserver +17 -0
  14. package/__tests__/node_modules/.bin/tsx +17 -0
  15. package/__tests__/package.json +36 -0
  16. package/__tests__/sqlite.db +0 -0
  17. package/__tests__/src/core/array.test.ts +130 -0
  18. package/__tests__/src/core/boolean.test.ts +66 -0
  19. package/__tests__/src/core/datetime.test.ts +102 -0
  20. package/__tests__/src/core/index.ts +35 -0
  21. package/__tests__/src/core/model.test.ts +260 -0
  22. package/__tests__/src/core/models.ts +50 -0
  23. package/__tests__/src/core/numbers.test.ts +177 -0
  24. package/__tests__/src/core/object.test.ts +198 -0
  25. package/__tests__/src/core/string.test.ts +222 -0
  26. package/__tests__/src/core/test.test.ts +59 -0
  27. package/__tests__/src/core/types.test.ts +97 -0
  28. package/__tests__/src/core/union.test.ts +99 -0
  29. package/__tests__/src/settings.ts +71 -0
  30. package/__tests__/tsconfig.json +11 -0
  31. package/dist/cjs/src/adapter/fields/index.js +2 -2
  32. package/dist/cjs/src/adapter/fields/object.js +9 -0
  33. package/dist/cjs/src/adapter/index.js +1 -0
  34. package/dist/cjs/src/constants.js +1 -7
  35. package/dist/cjs/src/domain.js +146 -1
  36. package/dist/cjs/src/index.js +69 -74
  37. package/dist/cjs/src/model.js +206 -206
  38. package/dist/cjs/src/schema/array.js +185 -58
  39. package/dist/cjs/src/schema/boolean.js +105 -44
  40. package/dist/cjs/src/schema/datetime.js +104 -38
  41. package/dist/cjs/src/schema/number.js +134 -114
  42. package/dist/cjs/src/schema/object.js +106 -43
  43. package/dist/cjs/src/schema/schema.js +123 -75
  44. package/dist/cjs/src/schema/string.js +152 -58
  45. package/dist/cjs/src/schema/union.js +412 -290
  46. package/dist/cjs/src/utils.js +42 -15
  47. package/dist/cjs/src/validators/array.js +6 -1
  48. package/dist/cjs/src/validators/boolean.js +2 -0
  49. package/dist/cjs/src/validators/datetime.js +4 -0
  50. package/dist/cjs/src/validators/number.js +12 -40
  51. package/dist/cjs/src/validators/object.js +1 -0
  52. package/dist/cjs/src/validators/schema.js +5 -1
  53. package/dist/cjs/src/validators/string.js +30 -2
  54. package/dist/cjs/src/validators/union.js +5 -4
  55. package/dist/cjs/src/validators/utils.js +99 -27
  56. package/dist/cjs/tsconfig.types.tsbuildinfo +1 -1
  57. package/dist/cjs/types/adapter/fields/array.d.ts +2 -2
  58. package/dist/cjs/types/adapter/fields/array.d.ts.map +1 -1
  59. package/dist/cjs/types/adapter/fields/boolean.d.ts.map +1 -1
  60. package/dist/cjs/types/adapter/fields/datetime.d.ts.map +1 -1
  61. package/dist/cjs/types/adapter/fields/index.d.ts +2 -2
  62. package/dist/cjs/types/adapter/fields/index.d.ts.map +1 -1
  63. package/dist/cjs/types/adapter/fields/number.d.ts.map +1 -1
  64. package/dist/cjs/types/adapter/fields/object.d.ts +2 -1
  65. package/dist/cjs/types/adapter/fields/object.d.ts.map +1 -1
  66. package/dist/cjs/types/adapter/fields/string.d.ts.map +1 -1
  67. package/dist/cjs/types/adapter/fields/union.d.ts.map +1 -1
  68. package/dist/cjs/types/adapter/index.d.ts +1 -0
  69. package/dist/cjs/types/adapter/index.d.ts.map +1 -1
  70. package/dist/cjs/types/adapter/types.d.ts +28 -18
  71. package/dist/cjs/types/adapter/types.d.ts.map +1 -1
  72. package/dist/cjs/types/constants.d.ts +0 -1
  73. package/dist/cjs/types/constants.d.ts.map +1 -1
  74. package/dist/cjs/types/domain.d.ts +5 -4
  75. package/dist/cjs/types/domain.d.ts.map +1 -1
  76. package/dist/cjs/types/index.d.ts +78 -55
  77. package/dist/cjs/types/index.d.ts.map +1 -1
  78. package/dist/cjs/types/model.d.ts +17 -17
  79. package/dist/cjs/types/model.d.ts.map +1 -1
  80. package/dist/cjs/types/schema/array.d.ts +168 -47
  81. package/dist/cjs/types/schema/array.d.ts.map +1 -1
  82. package/dist/cjs/types/schema/boolean.d.ts +103 -44
  83. package/dist/cjs/types/schema/boolean.d.ts.map +1 -1
  84. package/dist/cjs/types/schema/datetime.d.ts +90 -30
  85. package/dist/cjs/types/schema/datetime.d.ts.map +1 -1
  86. package/dist/cjs/types/schema/number.d.ts +133 -125
  87. package/dist/cjs/types/schema/number.d.ts.map +1 -1
  88. package/dist/cjs/types/schema/object.d.ts +104 -35
  89. package/dist/cjs/types/schema/object.d.ts.map +1 -1
  90. package/dist/cjs/types/schema/schema.d.ts +62 -44
  91. package/dist/cjs/types/schema/schema.d.ts.map +1 -1
  92. package/dist/cjs/types/schema/string.d.ts +152 -65
  93. package/dist/cjs/types/schema/string.d.ts.map +1 -1
  94. package/dist/cjs/types/schema/types.d.ts +11 -2
  95. package/dist/cjs/types/schema/types.d.ts.map +1 -1
  96. package/dist/cjs/types/schema/union.d.ts +133 -40
  97. package/dist/cjs/types/schema/union.d.ts.map +1 -1
  98. package/dist/cjs/types/types.d.ts +35 -0
  99. package/dist/cjs/types/types.d.ts.map +1 -1
  100. package/dist/cjs/types/utils.d.ts +41 -27
  101. package/dist/cjs/types/utils.d.ts.map +1 -1
  102. package/dist/cjs/types/validators/array.d.ts.map +1 -1
  103. package/dist/cjs/types/validators/boolean.d.ts.map +1 -1
  104. package/dist/cjs/types/validators/datetime.d.ts.map +1 -1
  105. package/dist/cjs/types/validators/number.d.ts +5 -6
  106. package/dist/cjs/types/validators/number.d.ts.map +1 -1
  107. package/dist/cjs/types/validators/object.d.ts.map +1 -1
  108. package/dist/cjs/types/validators/schema.d.ts +2 -2
  109. package/dist/cjs/types/validators/schema.d.ts.map +1 -1
  110. package/dist/cjs/types/validators/string.d.ts +9 -9
  111. package/dist/cjs/types/validators/string.d.ts.map +1 -1
  112. package/dist/cjs/types/validators/utils.d.ts +44 -27
  113. package/dist/cjs/types/validators/utils.d.ts.map +1 -1
  114. package/dist/esm/src/adapter/fields/index.js +2 -2
  115. package/dist/esm/src/adapter/fields/object.js +6 -0
  116. package/dist/esm/src/adapter/index.js +1 -0
  117. package/dist/esm/src/constants.js +1 -2
  118. package/dist/esm/src/domain.js +11 -1
  119. package/dist/esm/src/index.js +38 -73
  120. package/dist/esm/src/model.js +83 -78
  121. package/dist/esm/src/schema/array.js +136 -54
  122. package/dist/esm/src/schema/boolean.js +98 -44
  123. package/dist/esm/src/schema/datetime.js +91 -38
  124. package/dist/esm/src/schema/number.js +127 -110
  125. package/dist/esm/src/schema/object.js +98 -43
  126. package/dist/esm/src/schema/schema.js +102 -67
  127. package/dist/esm/src/schema/string.js +147 -59
  128. package/dist/esm/src/schema/union.js +119 -40
  129. package/dist/esm/src/types.js +14 -1
  130. package/dist/esm/src/utils.js +56 -27
  131. package/dist/esm/src/validators/array.js +6 -1
  132. package/dist/esm/src/validators/boolean.js +2 -0
  133. package/dist/esm/src/validators/datetime.js +4 -0
  134. package/dist/esm/src/validators/number.js +9 -23
  135. package/dist/esm/src/validators/object.js +1 -0
  136. package/dist/esm/src/validators/schema.js +5 -1
  137. package/dist/esm/src/validators/string.js +30 -2
  138. package/dist/esm/src/validators/union.js +5 -4
  139. package/dist/esm/src/validators/utils.js +62 -36
  140. package/package.json +3 -3
  141. package/src/adapter/fields/array.ts +2 -2
  142. package/src/adapter/fields/boolean.ts +3 -8
  143. package/src/adapter/fields/datetime.ts +3 -9
  144. package/src/adapter/fields/index.ts +11 -11
  145. package/src/adapter/fields/number.ts +3 -9
  146. package/src/adapter/fields/object.ts +13 -10
  147. package/src/adapter/fields/string.ts +3 -9
  148. package/src/adapter/fields/union.ts +3 -9
  149. package/src/adapter/index.ts +1 -0
  150. package/src/adapter/types.ts +60 -45
  151. package/src/constants.ts +1 -3
  152. package/src/domain.ts +15 -1
  153. package/src/index.ts +189 -211
  154. package/src/model.ts +119 -115
  155. package/src/schema/array.ts +274 -90
  156. package/src/schema/boolean.ts +145 -60
  157. package/src/schema/datetime.ts +133 -49
  158. package/src/schema/number.ts +210 -173
  159. package/src/schema/object.ts +167 -74
  160. package/src/schema/schema.ts +205 -126
  161. package/src/schema/string.ts +221 -94
  162. package/src/schema/types.ts +44 -16
  163. package/src/schema/union.ts +193 -68
  164. package/src/types.ts +53 -0
  165. package/src/utils.ts +115 -57
  166. package/src/validators/array.ts +46 -27
  167. package/src/validators/boolean.ts +13 -7
  168. package/src/validators/datetime.ts +24 -16
  169. package/src/validators/number.ts +53 -63
  170. package/src/validators/object.ts +6 -5
  171. package/src/validators/schema.ts +33 -25
  172. package/src/validators/string.ts +122 -59
  173. package/src/validators/union.ts +8 -8
  174. package/src/validators/utils.ts +67 -42
@@ -17,8 +17,8 @@ _export(exports, {
17
17
  }
18
18
  });
19
19
  var _schema = /*#__PURE__*/ _interop_require_default(require("./schema"));
20
- var _conf = require("../conf");
21
20
  var _utils = require("../utils");
21
+ var _schema1 = require("../validators/schema");
22
22
  var _string = require("../validators/string");
23
23
  function _assert_this_initialized(self) {
24
24
  if (self === void 0) {
@@ -287,6 +287,12 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
287
287
  _define_property(_assert_this_initialized(_this), "__endsWith", void 0);
288
288
  _define_property(_assert_this_initialized(_this), "__startsWith", void 0);
289
289
  _define_property(_assert_this_initialized(_this), "__includes", void 0);
290
+ _define_property(_assert_this_initialized(_this), "__type", {
291
+ message: 'Invalid type',
292
+ check: function(value) {
293
+ return typeof value === 'string';
294
+ }
295
+ });
290
296
  return _this;
291
297
  }
292
298
  _create_class(StringSchema, [
@@ -305,6 +311,10 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
305
311
  2,
306
312
  (0, _utils.defaultTransform)('string', _this, adapter, adapter.string, function() {
307
313
  return {
314
+ type: _this.__type,
315
+ is: _this.__is,
316
+ email: _this.__email,
317
+ uuid: _this.__uuid,
308
318
  minLength: _this.__minLength,
309
319
  maxLength: _this.__maxLength,
310
320
  regex: _this.__regex,
@@ -323,8 +333,13 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
323
333
  minLength: _string.minLength,
324
334
  endsWith: _string.endsWith,
325
335
  startsWith: _string.startsWith,
336
+ email: _string.email,
337
+ uuid: _string.uuid,
338
+ is: _schema1.is,
326
339
  regex: _string.regex,
327
- includes: _string.includes
340
+ includes: _string.includes,
341
+ nullable: _schema1.nullable,
342
+ optional: _schema1.optional
328
343
  }, {
329
344
  validatorsIfFallbackOrNotSupported: (0, _string.stringValidation)(),
330
345
  shouldAddStringVersion: options.shouldAddStringVersion,
@@ -344,7 +359,7 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
344
359
  return function(adapter) {
345
360
  return _ref.apply(this, arguments);
346
361
  };
347
- }(), _this.__transformedSchemas, options, 'number')
362
+ }(), _this, _this.__transformedSchemas, options, 'number')
348
363
  ];
349
364
  });
350
365
  })();
@@ -352,7 +367,8 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
352
367
  },
353
368
  {
354
369
  /**
355
- * This let's you refine the schema with custom validations. This is useful when you want to validate something that is not supported by default by the schema adapter.
370
+ * This let's you refine the schema with custom validations. This is useful when you want to validate something that
371
+ * is not supported by default by the schema adapter.
356
372
  *
357
373
  * @example
358
374
  * ```typescript
@@ -364,7 +380,8 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
364
380
  *
365
381
  * const { errors, parsed } = await numberSchema.parse(-1);
366
382
  *
367
- * console.log(errors); // [{ isValid: false, code: 'invalid_number', message: 'The number should be greater than 0', path: [] }]
383
+ * // [{ isValid: false, code: 'invalid_number', message: 'The number should be greater than 0', path: [] }]
384
+ * console.log(errors);
368
385
  * ```
369
386
  *
370
387
  * @param refinementCallback - The callback that will be called to validate the value.
@@ -400,14 +417,34 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
400
417
  *
401
418
  * @returns - The schema we are working with.
402
419
  */ key: "optional",
403
- value: function optional(options) {
404
- return _get(_get_prototype_of(StringSchema.prototype), "optional", this).call(this, options);
420
+ value: function optional() {
421
+ return _get(_get_prototype_of(StringSchema.prototype), "optional", this).call(this);
422
+ }
423
+ },
424
+ {
425
+ /**
426
+ * Just adds a message when the value is undefined. It's just a syntax sugar for
427
+ *
428
+ * ```typescript
429
+ * p.string().optional({ message: 'This value cannot be null', allow: false })
430
+ * ```
431
+ *
432
+ * @param options - The options of nonOptional function
433
+ * @param options.message - A custom message if the value is undefined.
434
+ *
435
+ * @returns - The schema.
436
+ */ key: "nonOptional",
437
+ value: function nonOptional(options) {
438
+ return _get(_get_prototype_of(StringSchema.prototype), "optional", this).call(this, {
439
+ message: options === null || options === void 0 ? void 0 : options.message,
440
+ allow: false
441
+ });
405
442
  }
406
443
  },
407
444
  {
408
445
  /**
409
- * Allows the value to be null and ONLY null. You can also use this function to set a custom message when the value is NULL by setting
410
- * the { message: 'Your custom message', allow: false } on the options.
446
+ * Allows the value to be null and ONLY null. You can also use this function to set a custom message when the value
447
+ * is NULL by setting the { message: 'Your custom message', allow: false } on the options.
411
448
  *
412
449
  * @example
413
450
  * ```typescript
@@ -436,14 +473,35 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
436
473
  },
437
474
  {
438
475
  /**
439
- * This method will remove the value from the representation of the schema. If the value is undefined it will keep that way
440
- * otherwise it will set the value to undefined after it's validated.
476
+ * Just adds a message when the value is null. It's just a syntax sugar for
477
+ *
478
+ * ```typescript
479
+ * p.string().nullable({ message: 'This value cannot be null', allow: false })
480
+ * ```
481
+ *
482
+ * @param options - The options of nonNullable function
483
+ * @param options.message - A custom message if the value is null.
484
+ *
485
+ * @returns - The schema.
486
+ */ key: "nonNullable",
487
+ value: function nonNullable(options) {
488
+ return _get(_get_prototype_of(StringSchema.prototype), "nullable", this).call(this, {
489
+ message: (options === null || options === void 0 ? void 0 : options.message) || '',
490
+ allow: false
491
+ });
492
+ }
493
+ },
494
+ {
495
+ /**
496
+ * This method will remove the value from the representation of the schema. If the value is undefined it will keep
497
+ * that way otherwise it will set the value to undefined after it's validated.
441
498
  * This is used in conjunction with the {@link data} function, the {@link parse} function or {@link validate}
442
499
  * function. This will remove the value from the representation of the schema.
443
500
  *
444
- * By default, the value will be removed just from the representation, in other words, when you call the {@link data} function.
445
- * But if you want to remove the value from the internal representation, you can pass the argument `toInternal` as true.
446
- * Then if you still want to remove the value from the representation, you will need to pass the argument `toRepresentation` as true as well.
501
+ * By default, the value will be removed just from the representation, in other words, when you call the {@link data}
502
+ * function. But if you want to remove the value from the internal representation, you can pass the argument
503
+ * `toInternal` as true. Then if you still want to remove the value from the representation, you will need to pass
504
+ * the argument `toRepresentation` as true as well.
447
505
  *
448
506
  * @example
449
507
  * ```typescript
@@ -465,9 +523,10 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
465
523
  * ```
466
524
  *
467
525
  *
468
- * @param args - By default, the value will be removed just from the representation, in other words, when you call the {@link data} function.
469
- * But if you want to remove the value from the internal representation, you can pass the argument `toInternal` as true.
470
- * Then if you still want to remove the value from the representation, you will need to pass the argument `toRepresentation` as true as well.
526
+ * @param args - By default, the value will be removed just from the representation, in other words, when you call
527
+ * the {@link data} function. But if you want to remove the value from the internal representation, you can pass the
528
+ * argument `toInternal` as true. Then if you still want to remove the value from the representation, you will need
529
+ * to pass the argument `toRepresentation` as true as well.
471
530
  *
472
531
  * @returns The schema.
473
532
  */ key: "omit",
@@ -477,9 +536,9 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
477
536
  },
478
537
  {
479
538
  /**
480
- * This function is used in conjunction with the {@link validate} function. It's used to save a value to an external source
481
- * like a database. You should always return the schema after you save the value, that way we will always have the correct type
482
- * of the schema after the save operation.
539
+ * This function is used in conjunction with the {@link validate} function. It's used to save a value to an external
540
+ * source like a database. You should always return the schema after you save the value, that way we will always have
541
+ * the correct type of the schema after the save operation.
483
542
  *
484
543
  * You can use the {@link toRepresentation} function to transform and clean the value it returns after the save.
485
544
  *
@@ -524,7 +583,8 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
524
583
  },
525
584
  {
526
585
  /**
527
- * This function is used to add a default value to the schema. If the value is either undefined or null, the default value will be used.
586
+ * This function is used to add a default value to the schema. If the value is either undefined or null, the default
587
+ * value will be used.
528
588
  *
529
589
  * @example
530
590
  * ```typescript
@@ -543,8 +603,9 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
543
603
  },
544
604
  {
545
605
  /**
546
- * This function let's you customize the schema your own way. After we translate the schema on the adapter we call this function to let you customize
547
- * the custom schema your own way. Our API does not support passthrough? No problem, you can use this function to customize the zod schema.
606
+ * This function let's you customize the schema your own way. After we translate the schema on the adapter we call
607
+ * this function to let you customize the custom schema your own way. Our API does not support passthrough?
608
+ * No problem, you can use this function to customize the zod schema.
548
609
  *
549
610
  * @example
550
611
  * ```typescript
@@ -555,13 +616,13 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
555
616
  * });
556
617
  *
557
618
  * const { errors, parsed } = await numberSchema.parse(-1);
558
- *
559
- * console.log(errors); // [{ isValid: false, code: 'nonnegative', message: 'The number should be nonnegative', path: [] }]
619
+ * // [{ isValid: false, code: 'nonnegative', message: 'The number should be nonnegative', path: [] }]
620
+ * console.log(errors);
560
621
  * ```
561
622
  *
562
623
  * @param callback - The callback that will be called to customize the schema.
563
- * @param toStringCallback - The callback that will be called to transform the schema to a string when you want to compile the underlying schema
564
- * to a string so you can save it for future runs.
624
+ * @param toStringCallback - The callback that will be called to transform the schema to a string when you want to
625
+ * compile the underlying schema to a string so you can save it for future runs.
565
626
  *
566
627
  * @returns The schema.
567
628
  */ key: "extends",
@@ -571,8 +632,9 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
571
632
  },
572
633
  {
573
634
  /**
574
- * This function is used to transform the value to the representation of the schema. When using the {@link data} function. With this function you have full
575
- * control to add data cleaning for example, transforming the data and whatever. Another use case is when you want to return deeply nested recursive data.
635
+ * This function is used to transform the value to the representation of the schema. When using the {@link data}
636
+ * function. With this function you have full control to add data cleaning for example, transforming the data and
637
+ * whatever. Another use case is when you want to return deeply nested recursive data.
576
638
  * The schema maps to itself.
577
639
  *
578
640
  * @example
@@ -619,8 +681,9 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
619
681
  },
620
682
  {
621
683
  /**
622
- * This function is used to transform the value to the internal representation of the schema. This is useful when you want to transform the value
623
- * to a type that the schema adapter can understand. For example, you might want to transform a string to a date. This is the function you use.
684
+ * This function is used to transform the value to the internal representation of the schema. This is useful when
685
+ * you want to transform the value to a type that the schema adapter can understand. For example, you might want
686
+ * to transform a string to a date. This is the function you use.
624
687
  *
625
688
  * @example
626
689
  * ```typescript
@@ -656,8 +719,9 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
656
719
  },
657
720
  {
658
721
  /**
659
- * Called before the validation of the schema. Let's say that you want to validate a date that might receive a string, you can convert that string to a date
660
- * here BEFORE the validation. This pretty much transforms the value to a type that the schema adapter can understand.
722
+ * Called before the validation of the schema. Let's say that you want to validate a date that might receive a string,
723
+ * you can convert that string to a date here BEFORE the validation. This pretty much transforms the value to a
724
+ * type that the schema adapter can understand.
661
725
  *
662
726
  * @example
663
727
  * ```typescript
@@ -681,7 +745,8 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
681
745
  },
682
746
  {
683
747
  /**
684
- * Defines a list of strings that are allowed, it's useful when you want to restrict the values that are allowed. Like a selector or a Choice field.
748
+ * Defines a list of strings that are allowed, it's useful when you want to restrict the values that are allowed.
749
+ * Like a selector or a Choice field.
685
750
  *
686
751
  * @example
687
752
  * ```typescript
@@ -690,17 +755,21 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
690
755
  * const schema = p.string().is(['Argentina', 'Brazil', 'Chile']);
691
756
  *
692
757
  * schema.parse('Argentina'); // { errors: [], parsed: 'Argentina' }
693
- * schema.parse('Uruguay'); // { errors: [{ code: 'invalid_value', message: 'The value should be equal to Argentina, Brazil, Chile', path: [] }], parsed: 'Uruguay' }
758
+ * // { errors: [{
759
+ * // code: 'invalid_value',
760
+ * // message: 'The value should be equal to Argentina, Brazil, Chile',
761
+ * // path: [] }], parsed: 'Uruguay' }
762
+ * schema.parse('Uruguay');
694
763
  * ```
695
764
  *
696
765
  * @param value - The list of numbers that are allowed
697
766
  *
698
767
  * @returns - The schema instance
699
768
  */ key: "is",
700
- value: function is(value) {
769
+ value: function is(value, options) {
701
770
  this.__is = {
702
771
  value: value,
703
- message: "The value should be equal to ".concat(value.join(', '))
772
+ message: typeof (options === null || options === void 0 ? void 0 : options.message) === 'string' ? options.message : "The value should be equal to ".concat(value.join(', '))
704
773
  };
705
774
  return this;
706
775
  }
@@ -716,7 +785,9 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
716
785
  * const schema = p.string().endsWith('.com');
717
786
  *
718
787
  * schema.parse('example.com'); // { errors: [], parsed: 'example.com' }
719
- * schema.parse('example.org'); // { errors: [{ code: 'endsWith', message: 'The value should end with .com', path: [] }], parsed: 'example.org' }
788
+ *
789
+ * // { errors: [{ code: 'endsWith', message: 'The value should end with .com', path: [] }], parsed: 'example.org' }
790
+ * schema.parse('example.org');
720
791
  * ```
721
792
  *
722
793
  * @param value - The value that the string should end with.
@@ -744,7 +815,11 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
744
815
  * const schema = p.string().startsWith('https://');
745
816
  *
746
817
  * schema.parse('https://example.com'); // { errors: [], parsed: 'https://example.com' }
747
- * schema.parse('http://example.com'); // { errors: [{ code: 'startsWith', message: 'The value should start with https://', path: [] }], parsed: 'http://example.com' }
818
+ * // {
819
+ * // errors: [{ code: 'startsWith', message: 'The value should start with https://', path: [] }],
820
+ * // parsed: 'http://example.com'
821
+ * // }
822
+ * schema.parse('http://example.com');
748
823
  * ```
749
824
  *
750
825
  * @param value - The value that the string should start with.
@@ -772,7 +847,13 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
772
847
  * const schema = p.string().includes('for babies');
773
848
  *
774
849
  * schema.parse('Computer graphics for babies'); // { errors: [], parsed: 'Computer graphics for babies' }
775
- * schema.parse('Learn javascript as you were 5'); // { errors: [{ code: 'includes', message: 'The string value should include the following substring 'for babies', path: [] }], parsed: 'example.org' }
850
+ * // {
851
+ * // errors: [{
852
+ * // code: 'includes',
853
+ * // message: 'The string value should include the following substring 'for babies',
854
+ * // path: []
855
+ * // }], parsed: 'example.org' }
856
+ * schema.parse('Learn javascript as you were 5');
776
857
  * ```
777
858
  *
778
859
  * @param value - The value that the string should include.
@@ -800,7 +881,15 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
800
881
  * const schema = p.string().regex(/^[a-z]+$/);
801
882
  *
802
883
  * schema.parse('abc'); // { errors: [], parsed: 'abc' }
803
- * schema.parse('123'); // { errors: [{ code: 'regex', message: 'The value should match the following regex /^[a-z]+$/', path: [] }], parsed: '123' }
884
+ * // {
885
+ * // errors: [{
886
+ * // code: 'regex',
887
+ * // message: 'The value should match the following regex /^[a-z]+$/',
888
+ * // path: []
889
+ * // }],
890
+ * // parsed: '123'
891
+ * // }
892
+ * schema.parse('123');
804
893
  * ```
805
894
  *
806
895
  * @param value - The regex that the string should match.
@@ -819,7 +908,8 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
819
908
  },
820
909
  {
821
910
  /**
822
- * Validates if the string has a maximum length. Use { inclusive: true } to allow the value to have the same length as the maximum length.
911
+ * Validates if the string has a maximum length. Use { inclusive: true } to allow the value to have the same length
912
+ * as the maximum length.
823
913
  *
824
914
  * @example
825
915
  * ```typescript
@@ -828,7 +918,11 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
828
918
  * const schema = p.string().maxLength(5);
829
919
  *
830
920
  * schema.parse('12345'); // { errors: [], parsed: '12345' }
831
- * schema.parse('123456'); // { errors: [{ code: 'maxLength', message: 'The value should have a maximum length of 5', path: [] }], parsed: '123
921
+ * // {
922
+ * // errors: [{ code: 'maxLength', message: 'The value should have a maximum length of 5', path: [] }],
923
+ * // parsed: '123
924
+ * // }
925
+ * schema.parse('123456');
832
926
  * ```
833
927
  *
834
928
  * @param value - The maximum length that the string should have.
@@ -841,15 +935,15 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
841
935
  value: function maxLength(value, options) {
842
936
  this.__maxLength = {
843
937
  value: value,
844
- message: (options === null || options === void 0 ? void 0 : options.message) || "The value should have a maximum length of ".concat(value),
845
- inclusive: typeof (options === null || options === void 0 ? void 0 : options.inclusive) === 'boolean' ? options.inclusive : false
938
+ message: (options === null || options === void 0 ? void 0 : options.message) || "The value should have a maximum length of ".concat(value)
846
939
  };
847
940
  return this;
848
941
  }
849
942
  },
850
943
  {
851
944
  /**
852
- * Validates if the string has a minimum length. Use { inclusive: true } to allow the value to have the same length as the minimum length.
945
+ * Validates if the string has a minimum length. Use { inclusive: true } to allow the value to have the same length
946
+ * as the minimum length.
853
947
  *
854
948
  * @example
855
949
  * ```typescript
@@ -858,7 +952,11 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
858
952
  * const schema = p.string().minLength(5);
859
953
  *
860
954
  * schema.parse('12345'); // { errors: [], parsed: '12345' }
861
- * schema.parse('1234'); // { errors: [{ code: 'minLength', message: 'The value should have a minimum length of 5', path: [] }], parsed: '1234' }
955
+ * // {
956
+ * // errors: [{ code: 'minLength', message: 'The value should have a minimum length of 5', path: [] }],
957
+ * // parsed: '1234'
958
+ * // }
959
+ * schema.parse('1234');
862
960
  * ```
863
961
  *
864
962
  * @param value - The minimum length that the string should have.
@@ -871,8 +969,7 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
871
969
  value: function minLength(value, options) {
872
970
  this.__minLength = {
873
971
  value: value,
874
- message: (options === null || options === void 0 ? void 0 : options.message) || "The value should have a minimum length of ".concat(value),
875
- inclusive: typeof (options === null || options === void 0 ? void 0 : options.inclusive) === 'boolean' ? options.inclusive : false
972
+ message: (options === null || options === void 0 ? void 0 : options.message) || "The value should have a minimum length of ".concat(value)
876
973
  };
877
974
  return this;
878
975
  }
@@ -887,11 +984,13 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
887
984
  *
888
985
  * const schema = p.string().uuid();
889
986
  *
890
- * schema.parse('550e8400-e29b-41d4-a716-446655440000'); // { errors: [], parsed: '550e8400-e29b-41d4-a716-446655440000' }
987
+ * // { errors: [], parsed: '550e8400-e29b-41d4-a716-446655440000' }
988
+ * schema.parse('550e8400-e29b-41d4-a716-446655440000');
891
989
  * ```
892
990
  *
893
991
  * @param options - The options for the uuid function.
894
- * @param options.message - The message to be shown when the value is not a valid UUID. Defaults to 'The value should be a valid UUID'.
992
+ * @param options.message - The message to be shown when the value is not a valid UUID. Defaults to
993
+ * 'The value should be a valid UUID'.
895
994
  *
896
995
  * @returns - The schema instance.
897
996
  */ key: "uuid",
@@ -917,7 +1016,8 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
917
1016
  * ```
918
1017
  *
919
1018
  * @param options - The options for the email function.
920
- * @param options.message - The message to be shown when the value is not a valid email. Defaults to 'The value should be a valid email'.
1019
+ * @param options.message - The message to be shown when the value is not a valid email.
1020
+ * Defaults to 'The value should be a valid email'.
921
1021
  *
922
1022
  * @returns - The schema instance.
923
1023
  */ key: "email",
@@ -933,12 +1033,6 @@ var StringSchema = /*#__PURE__*/ function(Schema) {
933
1033
  key: "new",
934
1034
  value: function _new() {
935
1035
  var returnValue = new StringSchema();
936
- var adapterInstance = (0, _conf.getDefaultAdapter)();
937
- returnValue.__transformedSchemas[adapterInstance.constructor.name] = {
938
- transformed: false,
939
- adapter: adapterInstance,
940
- schemas: []
941
- };
942
1036
  return returnValue;
943
1037
  }
944
1038
  }