@palmares/schemas 0.0.1 → 0.1.1

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 (175) hide show
  1. package/.turbo/turbo-build$colon$watch.log +12 -410
  2. package/.turbo/turbo-build.log +13 -4
  3. package/CHANGELOG.md +26 -0
  4. package/__tests__/.drizzle/migrations/0000_skinny_harrier.sql +22 -0
  5. package/__tests__/.drizzle/migrations/meta/0000_snapshot.json +156 -0
  6. package/__tests__/.drizzle/migrations/meta/_journal.json +13 -0
  7. package/__tests__/.drizzle/schema.ts +35 -0
  8. package/__tests__/drizzle.config.ts +11 -0
  9. package/__tests__/eslint.config.js +10 -0
  10. package/__tests__/manage.ts +5 -0
  11. package/__tests__/node_modules/.bin/drizzle-kit +17 -0
  12. package/__tests__/node_modules/.bin/esbuild +14 -0
  13. package/__tests__/node_modules/.bin/tsc +17 -0
  14. package/__tests__/node_modules/.bin/tsserver +17 -0
  15. package/__tests__/node_modules/.bin/tsx +17 -0
  16. package/__tests__/package.json +36 -0
  17. package/__tests__/sqlite.db +0 -0
  18. package/__tests__/src/core/array.test.ts +130 -0
  19. package/__tests__/src/core/boolean.test.ts +66 -0
  20. package/__tests__/src/core/datetime.test.ts +102 -0
  21. package/__tests__/src/core/index.ts +35 -0
  22. package/__tests__/src/core/model.test.ts +260 -0
  23. package/__tests__/src/core/models.ts +50 -0
  24. package/__tests__/src/core/numbers.test.ts +177 -0
  25. package/__tests__/src/core/object.test.ts +198 -0
  26. package/__tests__/src/core/string.test.ts +222 -0
  27. package/__tests__/src/core/test.test.ts +59 -0
  28. package/__tests__/src/core/types.test.ts +97 -0
  29. package/__tests__/src/core/union.test.ts +99 -0
  30. package/__tests__/src/settings.ts +71 -0
  31. package/__tests__/tsconfig.json +11 -0
  32. package/dist/cjs/src/adapter/fields/index.js +2 -2
  33. package/dist/cjs/src/adapter/fields/object.js +9 -0
  34. package/dist/cjs/src/adapter/index.js +1 -0
  35. package/dist/cjs/src/constants.js +1 -7
  36. package/dist/cjs/src/domain.js +146 -1
  37. package/dist/cjs/src/index.js +69 -74
  38. package/dist/cjs/src/model.js +206 -206
  39. package/dist/cjs/src/schema/array.js +185 -58
  40. package/dist/cjs/src/schema/boolean.js +105 -44
  41. package/dist/cjs/src/schema/datetime.js +104 -38
  42. package/dist/cjs/src/schema/number.js +134 -114
  43. package/dist/cjs/src/schema/object.js +106 -43
  44. package/dist/cjs/src/schema/schema.js +123 -75
  45. package/dist/cjs/src/schema/string.js +152 -58
  46. package/dist/cjs/src/schema/union.js +412 -290
  47. package/dist/cjs/src/utils.js +42 -15
  48. package/dist/cjs/src/validators/array.js +6 -1
  49. package/dist/cjs/src/validators/boolean.js +2 -0
  50. package/dist/cjs/src/validators/datetime.js +4 -0
  51. package/dist/cjs/src/validators/number.js +12 -40
  52. package/dist/cjs/src/validators/object.js +1 -0
  53. package/dist/cjs/src/validators/schema.js +5 -1
  54. package/dist/cjs/src/validators/string.js +30 -2
  55. package/dist/cjs/src/validators/union.js +5 -4
  56. package/dist/cjs/src/validators/utils.js +99 -27
  57. package/dist/cjs/tsconfig.types.tsbuildinfo +1 -1
  58. package/dist/cjs/types/adapter/fields/array.d.ts +2 -2
  59. package/dist/cjs/types/adapter/fields/array.d.ts.map +1 -1
  60. package/dist/cjs/types/adapter/fields/boolean.d.ts.map +1 -1
  61. package/dist/cjs/types/adapter/fields/datetime.d.ts.map +1 -1
  62. package/dist/cjs/types/adapter/fields/index.d.ts +2 -2
  63. package/dist/cjs/types/adapter/fields/index.d.ts.map +1 -1
  64. package/dist/cjs/types/adapter/fields/number.d.ts.map +1 -1
  65. package/dist/cjs/types/adapter/fields/object.d.ts +2 -1
  66. package/dist/cjs/types/adapter/fields/object.d.ts.map +1 -1
  67. package/dist/cjs/types/adapter/fields/string.d.ts.map +1 -1
  68. package/dist/cjs/types/adapter/fields/union.d.ts.map +1 -1
  69. package/dist/cjs/types/adapter/index.d.ts +1 -0
  70. package/dist/cjs/types/adapter/index.d.ts.map +1 -1
  71. package/dist/cjs/types/adapter/types.d.ts +28 -18
  72. package/dist/cjs/types/adapter/types.d.ts.map +1 -1
  73. package/dist/cjs/types/constants.d.ts +0 -1
  74. package/dist/cjs/types/constants.d.ts.map +1 -1
  75. package/dist/cjs/types/domain.d.ts +5 -4
  76. package/dist/cjs/types/domain.d.ts.map +1 -1
  77. package/dist/cjs/types/index.d.ts +78 -55
  78. package/dist/cjs/types/index.d.ts.map +1 -1
  79. package/dist/cjs/types/model.d.ts +17 -17
  80. package/dist/cjs/types/model.d.ts.map +1 -1
  81. package/dist/cjs/types/schema/array.d.ts +168 -47
  82. package/dist/cjs/types/schema/array.d.ts.map +1 -1
  83. package/dist/cjs/types/schema/boolean.d.ts +103 -44
  84. package/dist/cjs/types/schema/boolean.d.ts.map +1 -1
  85. package/dist/cjs/types/schema/datetime.d.ts +90 -30
  86. package/dist/cjs/types/schema/datetime.d.ts.map +1 -1
  87. package/dist/cjs/types/schema/number.d.ts +133 -125
  88. package/dist/cjs/types/schema/number.d.ts.map +1 -1
  89. package/dist/cjs/types/schema/object.d.ts +104 -35
  90. package/dist/cjs/types/schema/object.d.ts.map +1 -1
  91. package/dist/cjs/types/schema/schema.d.ts +62 -44
  92. package/dist/cjs/types/schema/schema.d.ts.map +1 -1
  93. package/dist/cjs/types/schema/string.d.ts +152 -65
  94. package/dist/cjs/types/schema/string.d.ts.map +1 -1
  95. package/dist/cjs/types/schema/types.d.ts +11 -2
  96. package/dist/cjs/types/schema/types.d.ts.map +1 -1
  97. package/dist/cjs/types/schema/union.d.ts +133 -40
  98. package/dist/cjs/types/schema/union.d.ts.map +1 -1
  99. package/dist/cjs/types/types.d.ts +35 -0
  100. package/dist/cjs/types/types.d.ts.map +1 -1
  101. package/dist/cjs/types/utils.d.ts +41 -27
  102. package/dist/cjs/types/utils.d.ts.map +1 -1
  103. package/dist/cjs/types/validators/array.d.ts.map +1 -1
  104. package/dist/cjs/types/validators/boolean.d.ts.map +1 -1
  105. package/dist/cjs/types/validators/datetime.d.ts.map +1 -1
  106. package/dist/cjs/types/validators/number.d.ts +5 -6
  107. package/dist/cjs/types/validators/number.d.ts.map +1 -1
  108. package/dist/cjs/types/validators/object.d.ts.map +1 -1
  109. package/dist/cjs/types/validators/schema.d.ts +2 -2
  110. package/dist/cjs/types/validators/schema.d.ts.map +1 -1
  111. package/dist/cjs/types/validators/string.d.ts +9 -9
  112. package/dist/cjs/types/validators/string.d.ts.map +1 -1
  113. package/dist/cjs/types/validators/utils.d.ts +44 -27
  114. package/dist/cjs/types/validators/utils.d.ts.map +1 -1
  115. package/dist/esm/src/adapter/fields/index.js +2 -2
  116. package/dist/esm/src/adapter/fields/object.js +6 -0
  117. package/dist/esm/src/adapter/index.js +1 -0
  118. package/dist/esm/src/constants.js +1 -2
  119. package/dist/esm/src/domain.js +11 -1
  120. package/dist/esm/src/index.js +38 -73
  121. package/dist/esm/src/model.js +83 -78
  122. package/dist/esm/src/schema/array.js +136 -54
  123. package/dist/esm/src/schema/boolean.js +98 -44
  124. package/dist/esm/src/schema/datetime.js +91 -38
  125. package/dist/esm/src/schema/number.js +127 -110
  126. package/dist/esm/src/schema/object.js +98 -43
  127. package/dist/esm/src/schema/schema.js +102 -67
  128. package/dist/esm/src/schema/string.js +147 -59
  129. package/dist/esm/src/schema/union.js +119 -40
  130. package/dist/esm/src/types.js +14 -1
  131. package/dist/esm/src/utils.js +56 -27
  132. package/dist/esm/src/validators/array.js +6 -1
  133. package/dist/esm/src/validators/boolean.js +2 -0
  134. package/dist/esm/src/validators/datetime.js +4 -0
  135. package/dist/esm/src/validators/number.js +9 -23
  136. package/dist/esm/src/validators/object.js +1 -0
  137. package/dist/esm/src/validators/schema.js +5 -1
  138. package/dist/esm/src/validators/string.js +30 -2
  139. package/dist/esm/src/validators/union.js +5 -4
  140. package/dist/esm/src/validators/utils.js +62 -36
  141. package/package.json +3 -3
  142. package/src/adapter/fields/array.ts +2 -2
  143. package/src/adapter/fields/boolean.ts +3 -8
  144. package/src/adapter/fields/datetime.ts +3 -9
  145. package/src/adapter/fields/index.ts +11 -11
  146. package/src/adapter/fields/number.ts +3 -9
  147. package/src/adapter/fields/object.ts +13 -10
  148. package/src/adapter/fields/string.ts +3 -9
  149. package/src/adapter/fields/union.ts +3 -9
  150. package/src/adapter/index.ts +1 -0
  151. package/src/adapter/types.ts +60 -45
  152. package/src/constants.ts +1 -3
  153. package/src/domain.ts +15 -1
  154. package/src/index.ts +189 -211
  155. package/src/model.ts +119 -115
  156. package/src/schema/array.ts +274 -90
  157. package/src/schema/boolean.ts +145 -60
  158. package/src/schema/datetime.ts +133 -49
  159. package/src/schema/number.ts +210 -173
  160. package/src/schema/object.ts +167 -74
  161. package/src/schema/schema.ts +205 -126
  162. package/src/schema/string.ts +221 -94
  163. package/src/schema/types.ts +44 -16
  164. package/src/schema/union.ts +193 -68
  165. package/src/types.ts +53 -0
  166. package/src/utils.ts +115 -57
  167. package/src/validators/array.ts +46 -27
  168. package/src/validators/boolean.ts +13 -7
  169. package/src/validators/datetime.ts +24 -16
  170. package/src/validators/number.ts +53 -63
  171. package/src/validators/object.ts +6 -5
  172. package/src/validators/schema.ts +33 -25
  173. package/src/validators/string.ts +122 -59
  174. package/src/validators/union.ts +8 -8
  175. package/src/validators/utils.ts +67 -42
@@ -17,7 +17,6 @@ _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");
22
21
  var _object = require("../validators/object");
23
22
  var _utils1 = /*#__PURE__*/ _interop_require_default(require("../validators/utils"));
@@ -349,6 +348,12 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
349
348
  _this = _super.call(this);
350
349
  _define_property(_assert_this_initialized(_this), "__data", void 0);
351
350
  _define_property(_assert_this_initialized(_this), "__cachedDataAsEntries", void 0);
351
+ _define_property(_assert_this_initialized(_this), "__type", {
352
+ message: 'Invalid type',
353
+ check: function(value) {
354
+ return (typeof value === "undefined" ? "undefined" : _type_of(value)) === 'object' && value !== null;
355
+ }
356
+ });
352
357
  _this.__data = data;
353
358
  return _this;
354
359
  }
@@ -468,6 +473,7 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
468
473
  data: isStringVersion ? asString : transformed,
469
474
  nullable: _this.__nullable,
470
475
  optional: _this.__optional,
476
+ type: _this.__type,
471
477
  parsers: {
472
478
  nullable: _this.__nullable.allow,
473
479
  optional: _this.__optional.allow
@@ -489,7 +495,7 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
489
495
  return function(adapter) {
490
496
  return _ref.apply(this, arguments);
491
497
  };
492
- }(), _this.__transformedSchemas, options, 'object')
498
+ }(), _this, _this.__transformedSchemas, options, 'object')
493
499
  ];
494
500
  });
495
501
  })();
@@ -498,8 +504,10 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
498
504
  {
499
505
  key: "data",
500
506
  value: /**
501
- * Transform the data to the representation without validating it. This is useful when you want to return a data from a query directly to the user. The core idea of this is that you can join the data
502
- * from the database "by hand". In other words, you can do the joins by yourself directly on code. For more complex cases, this can be really helpful.
507
+ * Transform the data to the representation without validating it. This is useful when you want to return a data
508
+ * from a query directly to the user. The core idea of this is that you can join the data from the database "by hand".
509
+ * In other words, you can do the joins by yourself directly on code. For more complex cases, this can be really
510
+ * helpful.
503
511
  *
504
512
  * @param value - The value to be transformed.
505
513
  *
@@ -575,7 +583,8 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
575
583
  },
576
584
  {
577
585
  /**
578
- * 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.
586
+ * This let's you refine the schema with custom validations. This is useful when you want to validate something
587
+ * that is not supported by default by the schema adapter.
579
588
  *
580
589
  * @example
581
590
  * ```typescript
@@ -587,7 +596,8 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
587
596
  *
588
597
  * const { errors, parsed } = await numberSchema.parse(-1);
589
598
  *
590
- * console.log(errors); // [{ isValid: false, code: 'invalid_number', message: 'The number should be greater than 0', path: [] }]
599
+ * // [{ isValid: false, code: 'invalid_number', message: 'The number should be greater than 0', path: [] }]
600
+ * console.log(errors);
591
601
  * ```
592
602
  *
593
603
  * @param refinementCallback - The callback that will be called to validate the value.
@@ -600,9 +610,10 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
600
610
  },
601
611
  {
602
612
  /**
603
- * Allows the value to be either undefined or null. Different from the `optional` method on other schemas, You can pass `outputOnly` as `true` to this method.
604
- * This will allow you to pass `null` or `undefined` as a value on the {@link Schema.data} method, but it will not allow the value to be `null` or `undefined`.
605
- * This is useful for typing purposes
613
+ * Allows the value to be either undefined or null. Different from the `optional` method on other schemas, You can
614
+ * pass `outputOnly` as `true` to this method. This will allow you to pass `null` or `undefined` as a value on the
615
+ * {@link Schema.data} method, but it will not allow the value to be `null` or `undefined`. This is useful for
616
+ * typing purposes
606
617
  *
607
618
  * @example
608
619
  * ```typescript
@@ -630,8 +641,11 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
630
641
  * company: companySchema.optional({ outputOnly: true })
631
642
  * });
632
643
  *
633
- * const { errors, parsed } = await userSchema.data({ id: 1, name: 'John Doe' }); // Will not allow the company to be null or undefined on a typing level.
634
- * const value = await userSchema.data({ id: 1, name: 'John Doe' }); // Will allow the company to be null or undefined on a typing level
644
+ * // Will not allow the company to be null or undefined on a typing level.
645
+ * const { errors, parsed } = await userSchema.data({ id: 1, name: 'John Doe' });
646
+ *
647
+ * // Will allow the company to be null or undefined on a typing level
648
+ * const value = await userSchema.data({ id: 1, name: 'John Doe' });
635
649
  * ```
636
650
  *
637
651
  * @returns - The schema we are working with.
@@ -642,7 +656,28 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
642
656
  },
643
657
  {
644
658
  /**
645
- * 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
659
+ * Just adds a message when the value is undefined. It's just a syntax sugar for
660
+ *
661
+ * ```typescript
662
+ * p.datetime().optional({ message: 'This value should be defined', allow: false })
663
+ * ```
664
+ *
665
+ * @param options - The options of nonOptional function
666
+ * @param options.message - A custom message if the value is undefined.
667
+ *
668
+ * @returns - The schema.
669
+ */ key: "nonOptional",
670
+ value: function nonOptional(options) {
671
+ return _get(_get_prototype_of(ObjectSchema.prototype), "optional", this).call(this, {
672
+ message: options === null || options === void 0 ? void 0 : options.message,
673
+ allow: false
674
+ });
675
+ }
676
+ },
677
+ {
678
+ /**
679
+ * Allows the value to be null and ONLY null. You can also use this function to set a custom message when the value
680
+ * is NULL by setting
646
681
  * the { message: 'Your custom message', allow: false } on the options.
647
682
  *
648
683
  * @example
@@ -672,14 +707,37 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
672
707
  },
673
708
  {
674
709
  /**
675
- * This method will remove the value from the representation of the schema. If the value is undefined it will keep that way
676
- * otherwise it will set the value to undefined after it's validated.
710
+ * Just adds a message when the value is null. It's just a syntax sugar for
711
+ *
712
+ * ```typescript
713
+ * p.datetime().nullable({ message: 'This value cannot be null', allow: false })
714
+ * ```
715
+ *
716
+ * @param options - The options of nonNullable function
717
+ * @param options.message - A custom message if the value is null.
718
+ *
719
+ * @returns - The schema.
720
+ */ key: "nonNullable",
721
+ value: function nonNullable(options) {
722
+ return _get(_get_prototype_of(ObjectSchema.prototype), "nullable", this).call(this, {
723
+ message: (options === null || options === void 0 ? void 0 : options.message) || '',
724
+ allow: false
725
+ });
726
+ }
727
+ },
728
+ {
729
+ /**
730
+ * This method will remove the value from the representation of the schema. If the value is undefined it will keep
731
+ * that way otherwise it will set the value to undefined after it's validated.
677
732
  * This is used in conjunction with the {@link data} function, the {@link parse} function or {@link validate}
678
733
  * function. This will remove the value from the representation of the schema.
679
734
  *
680
- * By default, the value will be removed just from the representation, in other words, when you call the {@link data} function.
681
- * But if you want to remove the value from the internal representation, you can pass the argument `toInternal` as true.
682
- * Then if you still want to remove the value from the representation, you will need to pass the argument `toRepresentation` as true as well.
735
+ * By default, the value will be removed just from the representation, in other words, when you call the {@link data}
736
+ * function.
737
+ * But if you want to remove the value from the internal representation, you can pass the argument `toInternal`
738
+ * as true.
739
+ * Then if you still want to remove the value from the representation, you will need to pass the argument
740
+ * `toRepresentation` as true as well.
683
741
  *
684
742
  * @example
685
743
  * ```typescript
@@ -701,9 +759,12 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
701
759
  * ```
702
760
  *
703
761
  *
704
- * @param args - By default, the value will be removed just from the representation, in other words, when you call the {@link data} function.
705
- * But if you want to remove the value from the internal representation, you can pass the argument `toInternal` as true.
706
- * Then if you still want to remove the value from the representation, you will need to pass the argument `toRepresentation` as true as well.
762
+ * @param args - By default, the value will be removed just from the representation, in other words, when you call
763
+ * the {@link data} function.
764
+ * But if you want to remove the value from the internal representation, you can pass the argument `toInternal`
765
+ * as true.
766
+ * Then if you still want to remove the value from the representation, you will need to pass the argument
767
+ * `toRepresentation` as true as well.
707
768
  *
708
769
  * @returns The schema.
709
770
  */ key: "omit",
@@ -713,9 +774,9 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
713
774
  },
714
775
  {
715
776
  /**
716
- * This function is used in conjunction with the {@link validate} function. It's used to save a value to an external source
717
- * like a database. You should always return the schema after you save the value, that way we will always have the correct type
718
- * of the schema after the save operation.
777
+ * This function is used in conjunction with the {@link validate} function. It's used to save a value to an external
778
+ * source like a database. You should always return the schema after you save the value, that way we will always have
779
+ * the correct type of the schema after the save operation.
719
780
  *
720
781
  * You can use the {@link toRepresentation} function to transform and clean the value it returns after the save.
721
782
  *
@@ -760,7 +821,8 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
760
821
  },
761
822
  {
762
823
  /**
763
- * 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.
824
+ * This function is used to add a default value to the schema. If the value is either undefined or null, the default
825
+ * value will be used.
764
826
  *
765
827
  * @example
766
828
  * ```typescript
@@ -779,8 +841,9 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
779
841
  },
780
842
  {
781
843
  /**
782
- * 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
783
- * the custom schema your own way. Our API does not support passthrough? No problem, you can use this function to customize the zod schema.
844
+ * This function let's you customize the schema your own way. After we translate the schema on the adapter we call
845
+ * this function to let you customize the custom schema your own way. Our API does not support passthrough?
846
+ * No problem, you can use this function to customize the zod schema.
784
847
  *
785
848
  * @example
786
849
  * ```typescript
@@ -792,12 +855,13 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
792
855
  *
793
856
  * const { errors, parsed } = await numberSchema.parse(-1);
794
857
  *
795
- * console.log(errors); // [{ isValid: false, code: 'nonnegative', message: 'The number should be nonnegative', path: [] }]
858
+ * // [{ isValid: false, code: 'nonnegative', message: 'The number should be nonnegative', path: [] }]
859
+ * console.log(errors);
796
860
  * ```
797
861
  *
798
862
  * @param callback - The callback that will be called to customize the schema.
799
- * @param toStringCallback - The callback that will be called to transform the schema to a string when you want to compile the underlying schema
800
- * to a string so you can save it for future runs.
863
+ * @param toStringCallback - The callback that will be called to transform the schema to a string when you want to
864
+ * compile the underlying schema to a string so you can save it for future runs.
801
865
  *
802
866
  * @returns The schema.
803
867
  */ key: "extends",
@@ -807,8 +871,9 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
807
871
  },
808
872
  {
809
873
  /**
810
- * 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
811
- * 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.
874
+ * This function is used to transform the value to the representation of the schema. When using the {@link data}
875
+ * function. With this function you have full control to add data cleaning for example, transforming the data and
876
+ * whatever. Another use case is when you want to return deeply nested recursive data.
812
877
  * The schema maps to itself.
813
878
  *
814
879
  * @example
@@ -847,8 +912,10 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
847
912
  * ```
848
913
  * @param toRepresentationCallback - The callback that will be called to transform the value to the representation.
849
914
  * @param options - Options for the toRepresentation function.
850
- * @param options.after - Whether the toRepresentationCallback should be called after the existing toRepresentationCallback. Defaults to true.
851
- * @param options.before - Whether the toRepresentationCallback should be called before the existing toRepresentationCallback. Defaults to true.
915
+ * @param options.after - Whether the toRepresentationCallback should be called after the existing
916
+ * toRepresentationCallback. Defaults to true.
917
+ * @param options.before - Whether the toRepresentationCallback should be called before the existing
918
+ * toRepresentationCallback. Defaults to true.
852
919
  *
853
920
  * @returns The schema with a new return type
854
921
  */ key: "toRepresentation",
@@ -858,8 +925,9 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
858
925
  },
859
926
  {
860
927
  /**
861
- * 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
862
- * 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.
928
+ * This function is used to transform the value to the internal representation of the schema. This is useful when
929
+ * you want to transform the value to a type that the schema adapter can understand. For example, you might want
930
+ * to transform a string to a date. This is the function you use.
863
931
  *
864
932
  * @example
865
933
  * ```typescript
@@ -895,8 +963,9 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
895
963
  },
896
964
  {
897
965
  /**
898
- * 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
899
- * here BEFORE the validation. This pretty much transforms the value to a type that the schema adapter can understand.
966
+ * Called before the validation of the schema. Let's say that you want to validate a date that might receive a string,
967
+ * you can convert that string to a date here BEFORE the validation. This pretty much transforms the value to a type
968
+ * that the schema adapter can understand.
900
969
  *
901
970
  * @example
902
971
  * ```
@@ -984,12 +1053,6 @@ var ObjectSchema = /*#__PURE__*/ function(Schema) {
984
1053
  key: "new",
985
1054
  value: function _new(data) {
986
1055
  var returnValue = new ObjectSchema(data);
987
- var adapterInstance = (0, _conf.getDefaultAdapter)();
988
- returnValue.__transformedSchemas[adapterInstance.constructor.name] = {
989
- transformed: false,
990
- adapter: adapterInstance,
991
- schemas: []
992
- };
993
1056
  return returnValue;
994
1057
  }
995
1058
  }