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.
- package/build/compile/validator.d.mts +2 -7
- package/build/compile/validator.mjs +6 -36
- package/build/error/errors.d.mts +1 -7
- package/build/guard/emit.d.mts +0 -4
- package/build/guard/emit.mjs +0 -8
- package/build/guard/guard.d.mts +0 -4
- package/build/guard/guard.mjs +0 -8
- package/build/schema/engine/index.d.mts +0 -1
- package/build/schema/engine/index.mjs +0 -1
- package/build/schema/engine/schema.mjs +0 -5
- package/build/schema/engine/type.mjs +14 -18
- package/build/schema/types/index.d.mts +0 -1
- package/build/schema/types/index.mjs +0 -1
- package/build/system/locale/ar_001.mjs +0 -1
- package/build/system/locale/bn_BD.mjs +0 -1
- package/build/system/locale/cs_CZ.mjs +0 -1
- package/build/system/locale/de_DE.mjs +0 -1
- package/build/system/locale/el_GR.mjs +0 -1
- package/build/system/locale/en_US.mjs +0 -1
- package/build/system/locale/es_419.mjs +0 -1
- package/build/system/locale/es_AR.mjs +0 -1
- package/build/system/locale/es_ES.mjs +0 -1
- package/build/system/locale/es_MX.mjs +0 -1
- package/build/system/locale/fa_IR.mjs +0 -1
- package/build/system/locale/fil_PH.mjs +0 -1
- package/build/system/locale/fr_CA.mjs +0 -1
- package/build/system/locale/fr_FR.mjs +0 -1
- package/build/system/locale/ha_NG.mjs +0 -1
- package/build/system/locale/hi_IN.mjs +0 -1
- package/build/system/locale/hu_HU.mjs +0 -1
- package/build/system/locale/id_ID.mjs +0 -1
- package/build/system/locale/it_IT.mjs +0 -1
- package/build/system/locale/ja_JP.mjs +0 -1
- package/build/system/locale/ko_KR.mjs +0 -1
- package/build/system/locale/ms_MY.mjs +0 -1
- package/build/system/locale/nl_NL.mjs +0 -1
- package/build/system/locale/pl_PL.mjs +0 -1
- package/build/system/locale/pt_BR.mjs +0 -1
- package/build/system/locale/pt_PT.mjs +0 -1
- package/build/system/locale/ro_RO.mjs +0 -1
- package/build/system/locale/ru_RU.mjs +0 -1
- package/build/system/locale/sv_SE.mjs +0 -1
- package/build/system/locale/sw_TZ.mjs +0 -1
- package/build/system/locale/th_TH.mjs +0 -1
- package/build/system/locale/tr_TR.mjs +0 -1
- package/build/system/locale/uk_UA.mjs +0 -1
- package/build/system/locale/ur_PK.mjs +0 -1
- package/build/system/locale/vi_VN.mjs +0 -1
- package/build/system/locale/yo_NG.mjs +0 -1
- package/build/system/locale/zh_Hans.mjs +0 -1
- package/build/system/locale/zh_Hant.mjs +0 -1
- package/build/system/memory/clone.d.mts +2 -3
- package/build/system/memory/clone.mjs +72 -26
- package/build/type/action/index.d.mts +0 -1
- package/build/type/action/index.mjs +0 -1
- package/build/type/action/readonly_object.d.mts +0 -5
- package/build/type/action/readonly_object.mjs +0 -5
- package/build/type/action/with.d.mts +0 -10
- package/build/type/action/with.mjs +0 -8
- package/build/type/engine/cyclic/check.d.mts +1 -4
- package/build/type/engine/cyclic/check.mjs +9 -15
- package/build/type/engine/cyclic/dependencies.d.mts +1 -4
- package/build/type/engine/cyclic/dependencies.mjs +9 -15
- package/build/type/engine/cyclic/extends.d.mts +1 -4
- package/build/type/engine/cyclic/extends.mjs +8 -14
- package/build/type/engine/index.d.mts +0 -1
- package/build/type/engine/index.mjs +0 -1
- package/build/type/engine/indexed/instantiate.d.mts +1 -1
- package/build/type/engine/indexed/instantiate.mjs +4 -2
- package/build/type/engine/instantiate.d.mts +7 -12
- package/build/type/engine/instantiate.mjs +60 -66
- package/build/type/engine/keyof/instantiate.d.mts +1 -1
- package/build/type/engine/keyof/instantiate.mjs +4 -1
- package/build/type/engine/this/expand_this.d.mts +1 -4
- package/build/type/engine/this/expand_this.mjs +7 -13
- package/build/type/extends/extends_left.d.mts +1 -7
- package/build/type/extends/extends_left.mjs +23 -32
- package/build/type/script/mapping.d.mts +0 -12
- package/build/type/script/mapping.mjs +21 -25
- package/build/type/types/_refine.d.mts +0 -2
- package/build/type/types/_refine.mjs +1 -2
- package/build/type/types/index.d.mts +0 -4
- package/build/type/types/index.mjs +0 -4
- package/build/type/types/static.d.mts +1 -5
- package/build/typebox.d.mts +2 -7
- package/build/typebox.mjs +2 -7
- package/build/value/clean/from_type.mjs +8 -10
- package/build/value/clone/clone.mjs +1 -86
- package/build/value/convert/from_type.mjs +19 -21
- package/build/value/create/from_type.mjs +23 -31
- package/build/value/default/from_type.mjs +8 -10
- package/build/value/index.d.mts +0 -1
- package/build/value/index.mjs +0 -1
- package/build/value/repair/from_type.mjs +2 -12
- package/build/value/value.d.mts +0 -1
- package/build/value/value.mjs +0 -1
- package/package.json +1 -1
- package/readme.md +1 -1
- package/build/schema/engine/_guard.d.mts +0 -6
- package/build/schema/engine/_guard.mjs +0 -26
- package/build/schema/types/_guard.d.mts +0 -10
- package/build/schema/types/_guard.mjs +0 -16
- package/build/type/action/awaited.d.mts +0 -15
- package/build/type/action/awaited.mjs +0 -15
- package/build/type/engine/awaited/index.d.mts +0 -1
- package/build/type/engine/awaited/index.mjs +0 -1
- package/build/type/engine/awaited/instantiate.d.mts +0 -11
- package/build/type/engine/awaited/instantiate.mjs +0 -20
- package/build/type/extends/async_iterator.d.mts +0 -7
- package/build/type/extends/async_iterator.mjs +0 -9
- package/build/type/extends/iterator.d.mts +0 -7
- package/build/type/extends/iterator.mjs +0 -9
- package/build/type/extends/promise.d.mts +0 -7
- package/build/type/extends/promise.mjs +0 -9
- package/build/type/types/async_iterator.d.mts +0 -20
- package/build/type/types/async_iterator.mjs +0 -28
- package/build/type/types/base.d.mts +0 -50
- package/build/type/types/base.mjs +0 -84
- package/build/type/types/iterator.d.mts +0 -20
- package/build/type/types/iterator.mjs +0 -28
- package/build/type/types/promise.d.mts +0 -21
- package/build/type/types/promise.mjs +0 -29
- package/build/value/clean/from_base.d.mts +0 -2
- package/build/value/clean/from_base.mjs +0 -4
- package/build/value/convert/from_base.d.mts +0 -2
- package/build/value/convert/from_base.mjs +0 -4
- package/build/value/create/from_async_iterator.d.mts +0 -2
- package/build/value/create/from_async_iterator.mjs +0 -5
- package/build/value/create/from_base.d.mts +0 -2
- package/build/value/create/from_base.mjs +0 -4
- package/build/value/create/from_iterator.d.mts +0 -2
- package/build/value/create/from_iterator.mjs +0 -5
- package/build/value/create/from_promise.d.mts +0 -2
- package/build/value/create/from_promise.mjs +0 -5
- package/build/value/default/from_base.d.mts +0 -2
- package/build/value/default/from_base.mjs +0 -5
- package/build/value/mutate/error.d.mts +0 -3
- package/build/value/mutate/error.mjs +0 -6
- package/build/value/mutate/from_array.d.mts +0 -2
- package/build/value/mutate/from_array.mjs +0 -16
- package/build/value/mutate/from_object.d.mts +0 -2
- package/build/value/mutate/from_object.mjs +0 -40
- package/build/value/mutate/from_unknown.d.mts +0 -2
- package/build/value/mutate/from_unknown.mjs +0 -7
- package/build/value/mutate/from_value.d.mts +0 -2
- package/build/value/mutate/from_value.mjs +0 -12
- package/build/value/mutate/index.d.mts +0 -1
- package/build/value/mutate/index.mjs +0 -1
- package/build/value/mutate/mutate.d.mts +0 -11
- package/build/value/mutate/mutate.mjs +0 -41
- package/build/value/repair/from_base.d.mts +0 -2
- 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,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
|
-
}
|