typebox 1.2.18 → 1.3.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 (152) hide show
  1. package/build/compile/validator.d.mts +2 -7
  2. package/build/compile/validator.mjs +6 -36
  3. package/build/error/errors.d.mts +1 -7
  4. package/build/guard/emit.d.mts +0 -4
  5. package/build/guard/emit.mjs +0 -8
  6. package/build/guard/guard.d.mts +0 -4
  7. package/build/guard/guard.mjs +0 -8
  8. package/build/schema/engine/index.d.mts +0 -1
  9. package/build/schema/engine/index.mjs +0 -1
  10. package/build/schema/engine/schema.mjs +0 -5
  11. package/build/schema/engine/type.mjs +14 -18
  12. package/build/schema/types/index.d.mts +0 -1
  13. package/build/schema/types/index.mjs +0 -1
  14. package/build/system/locale/ar_001.mjs +0 -1
  15. package/build/system/locale/bn_BD.mjs +0 -1
  16. package/build/system/locale/cs_CZ.mjs +0 -1
  17. package/build/system/locale/de_DE.mjs +0 -1
  18. package/build/system/locale/el_GR.mjs +0 -1
  19. package/build/system/locale/en_US.mjs +0 -1
  20. package/build/system/locale/es_419.mjs +0 -1
  21. package/build/system/locale/es_AR.mjs +0 -1
  22. package/build/system/locale/es_ES.mjs +0 -1
  23. package/build/system/locale/es_MX.mjs +0 -1
  24. package/build/system/locale/fa_IR.mjs +0 -1
  25. package/build/system/locale/fil_PH.mjs +0 -1
  26. package/build/system/locale/fr_CA.mjs +0 -1
  27. package/build/system/locale/fr_FR.mjs +0 -1
  28. package/build/system/locale/ha_NG.mjs +0 -1
  29. package/build/system/locale/hi_IN.mjs +0 -1
  30. package/build/system/locale/hu_HU.mjs +0 -1
  31. package/build/system/locale/id_ID.mjs +0 -1
  32. package/build/system/locale/it_IT.mjs +0 -1
  33. package/build/system/locale/ja_JP.mjs +0 -1
  34. package/build/system/locale/ko_KR.mjs +0 -1
  35. package/build/system/locale/ms_MY.mjs +0 -1
  36. package/build/system/locale/nl_NL.mjs +0 -1
  37. package/build/system/locale/pl_PL.mjs +0 -1
  38. package/build/system/locale/pt_BR.mjs +0 -1
  39. package/build/system/locale/pt_PT.mjs +0 -1
  40. package/build/system/locale/ro_RO.mjs +0 -1
  41. package/build/system/locale/ru_RU.mjs +0 -1
  42. package/build/system/locale/sv_SE.mjs +0 -1
  43. package/build/system/locale/sw_TZ.mjs +0 -1
  44. package/build/system/locale/th_TH.mjs +0 -1
  45. package/build/system/locale/tr_TR.mjs +0 -1
  46. package/build/system/locale/uk_UA.mjs +0 -1
  47. package/build/system/locale/ur_PK.mjs +0 -1
  48. package/build/system/locale/vi_VN.mjs +0 -1
  49. package/build/system/locale/yo_NG.mjs +0 -1
  50. package/build/system/locale/zh_Hans.mjs +0 -1
  51. package/build/system/locale/zh_Hant.mjs +0 -1
  52. package/build/system/memory/clone.d.mts +2 -3
  53. package/build/system/memory/clone.mjs +72 -26
  54. package/build/type/action/index.d.mts +0 -1
  55. package/build/type/action/index.mjs +0 -1
  56. package/build/type/action/readonly_object.d.mts +0 -5
  57. package/build/type/action/readonly_object.mjs +0 -5
  58. package/build/type/action/with.d.mts +0 -10
  59. package/build/type/action/with.mjs +0 -8
  60. package/build/type/engine/cyclic/check.d.mts +1 -4
  61. package/build/type/engine/cyclic/check.mjs +9 -15
  62. package/build/type/engine/cyclic/dependencies.d.mts +1 -4
  63. package/build/type/engine/cyclic/dependencies.mjs +9 -15
  64. package/build/type/engine/cyclic/extends.d.mts +1 -4
  65. package/build/type/engine/cyclic/extends.mjs +8 -14
  66. package/build/type/engine/index.d.mts +0 -1
  67. package/build/type/engine/index.mjs +0 -1
  68. package/build/type/engine/indexed/instantiate.d.mts +1 -1
  69. package/build/type/engine/indexed/instantiate.mjs +4 -2
  70. package/build/type/engine/instantiate.d.mts +7 -12
  71. package/build/type/engine/instantiate.mjs +60 -66
  72. package/build/type/engine/keyof/instantiate.d.mts +1 -1
  73. package/build/type/engine/keyof/instantiate.mjs +4 -1
  74. package/build/type/engine/this/expand_this.d.mts +1 -4
  75. package/build/type/engine/this/expand_this.mjs +7 -13
  76. package/build/type/extends/extends_left.d.mts +1 -7
  77. package/build/type/extends/extends_left.mjs +23 -32
  78. package/build/type/script/mapping.d.mts +0 -12
  79. package/build/type/script/mapping.mjs +21 -25
  80. package/build/type/types/_refine.d.mts +0 -2
  81. package/build/type/types/_refine.mjs +1 -2
  82. package/build/type/types/index.d.mts +0 -4
  83. package/build/type/types/index.mjs +0 -4
  84. package/build/type/types/static.d.mts +1 -5
  85. package/build/typebox.d.mts +2 -7
  86. package/build/typebox.mjs +2 -7
  87. package/build/value/clean/from_type.mjs +8 -10
  88. package/build/value/clone/clone.mjs +1 -86
  89. package/build/value/convert/from_type.mjs +19 -21
  90. package/build/value/create/from_type.mjs +23 -31
  91. package/build/value/default/from_type.mjs +8 -10
  92. package/build/value/index.d.mts +0 -1
  93. package/build/value/index.mjs +0 -1
  94. package/build/value/repair/from_type.mjs +2 -12
  95. package/build/value/value.d.mts +0 -1
  96. package/build/value/value.mjs +0 -1
  97. package/package.json +1 -1
  98. package/readme.md +1 -1
  99. package/build/schema/engine/_guard.d.mts +0 -6
  100. package/build/schema/engine/_guard.mjs +0 -26
  101. package/build/schema/types/_guard.d.mts +0 -10
  102. package/build/schema/types/_guard.mjs +0 -16
  103. package/build/type/action/awaited.d.mts +0 -15
  104. package/build/type/action/awaited.mjs +0 -15
  105. package/build/type/engine/awaited/index.d.mts +0 -1
  106. package/build/type/engine/awaited/index.mjs +0 -1
  107. package/build/type/engine/awaited/instantiate.d.mts +0 -11
  108. package/build/type/engine/awaited/instantiate.mjs +0 -20
  109. package/build/type/extends/async_iterator.d.mts +0 -7
  110. package/build/type/extends/async_iterator.mjs +0 -9
  111. package/build/type/extends/iterator.d.mts +0 -7
  112. package/build/type/extends/iterator.mjs +0 -9
  113. package/build/type/extends/promise.d.mts +0 -7
  114. package/build/type/extends/promise.mjs +0 -9
  115. package/build/type/types/async_iterator.d.mts +0 -20
  116. package/build/type/types/async_iterator.mjs +0 -28
  117. package/build/type/types/base.d.mts +0 -50
  118. package/build/type/types/base.mjs +0 -84
  119. package/build/type/types/iterator.d.mts +0 -20
  120. package/build/type/types/iterator.mjs +0 -28
  121. package/build/type/types/promise.d.mts +0 -21
  122. package/build/type/types/promise.mjs +0 -29
  123. package/build/value/clean/from_base.d.mts +0 -2
  124. package/build/value/clean/from_base.mjs +0 -4
  125. package/build/value/convert/from_base.d.mts +0 -2
  126. package/build/value/convert/from_base.mjs +0 -4
  127. package/build/value/create/from_async_iterator.d.mts +0 -2
  128. package/build/value/create/from_async_iterator.mjs +0 -5
  129. package/build/value/create/from_base.d.mts +0 -2
  130. package/build/value/create/from_base.mjs +0 -4
  131. package/build/value/create/from_iterator.d.mts +0 -2
  132. package/build/value/create/from_iterator.mjs +0 -5
  133. package/build/value/create/from_promise.d.mts +0 -2
  134. package/build/value/create/from_promise.mjs +0 -5
  135. package/build/value/default/from_base.d.mts +0 -2
  136. package/build/value/default/from_base.mjs +0 -5
  137. package/build/value/mutate/error.d.mts +0 -3
  138. package/build/value/mutate/error.mjs +0 -6
  139. package/build/value/mutate/from_array.d.mts +0 -2
  140. package/build/value/mutate/from_array.mjs +0 -16
  141. package/build/value/mutate/from_object.d.mts +0 -2
  142. package/build/value/mutate/from_object.mjs +0 -40
  143. package/build/value/mutate/from_unknown.d.mts +0 -2
  144. package/build/value/mutate/from_unknown.mjs +0 -7
  145. package/build/value/mutate/from_value.d.mts +0 -2
  146. package/build/value/mutate/from_value.mjs +0 -12
  147. package/build/value/mutate/index.d.mts +0 -1
  148. package/build/value/mutate/index.mjs +0 -1
  149. package/build/value/mutate/mutate.d.mts +0 -11
  150. package/build/value/mutate/mutate.mjs +0 -41
  151. package/build/value/repair/from_base.d.mts +0 -2
  152. package/build/value/repair/from_base.mjs +0 -8
@@ -1,41 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { Guard, GlobalsGuard } from '../../guard/index.mjs';
3
- import { MutateError } from './error.mjs';
4
- import { FromValue } from './from_value.mjs';
5
- // ------------------------------------------------------------------
6
- // IsNonMutableValue
7
- // ------------------------------------------------------------------
8
- function IsNonMutableValue(value) {
9
- return GlobalsGuard.IsTypeArray(value)
10
- || GlobalsGuard.IsDate(value)
11
- || GlobalsGuard.IsMap(value)
12
- || GlobalsGuard.IsSet(value)
13
- || Guard.IsNumber(value)
14
- || Guard.IsString(value)
15
- || Guard.IsBoolean(value)
16
- || Guard.IsSymbol(value);
17
- }
18
- // ------------------------------------------------------------------
19
- // IsTrueObject
20
- // ------------------------------------------------------------------
21
- function IsMismatchedValue(left, right) {
22
- return ((Guard.IsObjectNotArray(left) && Guard.IsArray(right)) ||
23
- (Guard.IsArray(left) && Guard.IsObjectNotArray(right)));
24
- }
25
- // ------------------------------------------------------------------
26
- // Mutate
27
- // ------------------------------------------------------------------
28
- /**
29
- * Performs a deep structural assignment, applying values from next to current while retaining internal references. This function
30
- * is written for use in infrastructure that interprets reference changes as a signal to perform some action (i.e. React redraw), this
31
- * function can mitigate this by applying mutable updates deep within a value, ensuring parent references are retained.
32
- *
33
- * @deprecated This function is being removed in the next version but will be retained as a reference under examples.
34
- */
35
- export function Mutate(current, next) {
36
- if (IsNonMutableValue(current) || IsNonMutableValue(next))
37
- throw new MutateError('Only object and array types can be mutated at the root level');
38
- if (IsMismatchedValue(current, next))
39
- throw new MutateError('Cannot assign due type mismatch of assignable values');
40
- FromValue(current, '', current, next);
41
- }
@@ -1,2 +0,0 @@
1
- import type { TProperties, Base } from '../../type/index.mjs';
2
- export declare function FromBase(context: TProperties, type: Base, value: unknown): unknown;
@@ -1,8 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { FromUnknown } from './from_unknown.mjs';
3
- // ------------------------------------------------------------------
4
- // FromBase
5
- // ------------------------------------------------------------------
6
- export function FromBase(context, type, value) {
7
- return FromUnknown(context, type, value);
8
- }