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
@@ -33,7 +33,6 @@ export function ur_PK(error) {
33
33
  case 'unevaluatedItems': return 'غیر تشخیص شدہ آئٹمز نہیں ہونے چاہئیں';
34
34
  case 'unevaluatedProperties': return 'غیر تشخیص شدہ خصوصیات نہیں ہونی چاہئیں';
35
35
  case 'uniqueItems': return `ڈپلیکیٹ آئٹمز نہیں ہونے چاہئیں`;
36
- case '~guard': return `چیک فنکشن سے مطابقت ہونی چاہیے`;
37
36
  case '~refine': return error.params.message;
38
37
  default: return 'تصدیق میں ایک نامعلوم خرابی پیش آئی';
39
38
  }
@@ -33,7 +33,6 @@ export function vi_VN(error) {
33
33
  case 'unevaluatedItems': return 'không được có các mục chưa được đánh giá';
34
34
  case 'unevaluatedProperties': return 'không được có các thuộc tính chưa được đánh giá';
35
35
  case 'uniqueItems': return `không được có các mục trùng lặp`;
36
- case '~guard': return `phải khớp với hàm kiểm tra`;
37
36
  case '~refine': return error.params.message;
38
37
  default: return 'đã xảy ra lỗi xác thực không xác định';
39
38
  }
@@ -33,7 +33,6 @@ export function yo_NG(error) {
33
33
  case 'unevaluatedItems': return 'ko gbọdọ ni awọn ohun ti ko ṣe iṣiro';
34
34
  case 'unevaluatedProperties': return 'ko gbọdọ ni awọn ohun-ini ti ko ṣe iṣiro';
35
35
  case 'uniqueItems': return `ko gbọdọ ni awọn ohun elo ẹda`;
36
- case '~guard': return `gbogbo yẹ ki o ba iṣẹ́ ṣàyẹ̀wò mu`;
37
36
  case '~refine': return error.params.message;
38
37
  default: return 'aṣiṣe ijẹrisi aimọ waye';
39
38
  }
@@ -33,7 +33,6 @@ export function zh_Hans(error) {
33
33
  case 'unevaluatedItems': return '不得有未评估的项';
34
34
  case 'unevaluatedProperties': return '不得有未评估的属性';
35
35
  case 'uniqueItems': return `不得有重复项`;
36
- case '~guard': return `必须与检查函数匹配`;
37
36
  case '~refine': return error.params.message;
38
37
  default: return '发生未知验证错误';
39
38
  }
@@ -33,7 +33,6 @@ export function zh_Hant(error) {
33
33
  case 'unevaluatedItems': return '不得有未評估的項目';
34
34
  case 'unevaluatedProperties': return '不得有未評估的屬性';
35
35
  case 'uniqueItems': return `不得有重複項目`;
36
- case '~guard': return `必須與檢查函數匹配`;
37
36
  case '~refine': return error.params.message;
38
37
  default: return '發生未知驗證錯誤';
39
38
  }
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Clones a value using the TypeBox type cloning strategy. This function preserves non-enumerable
3
- * properties from the source value. This is to ensure cloned types retain discriminable
4
- * hidden properties.
2
+ * Returns a Clone of the given value. This function is similar to structuredClone()
3
+ * but also supports deep cloning instances of Map, Set and TypeArray.
5
4
  */
6
5
  export declare function Clone<Value extends unknown = unknown>(value: Value): Value;
@@ -1,28 +1,32 @@
1
1
  // deno-fmt-ignore-file
2
- import { Guard } from '../../guard/index.mjs';
2
+ import { Guard, GlobalsGuard } from '../../guard/index.mjs';
3
3
  import { Metrics } from './metrics.mjs';
4
4
  // ------------------------------------------------------------------
5
- // Guard
5
+ // ClassInstance
6
+ //
7
+ // TypeBox does not clone arbitrary class instances. Class instances
8
+ // cannot be safely cloned without potentially breaking private
9
+ // members of the instance.
10
+ //
6
11
  // ------------------------------------------------------------------
7
- function IsGuard(value) {
8
- return Guard.IsObject(value) && Guard.HasPropertyKey(value, '~guard');
9
- }
10
- function FromGuard(value) {
11
- return value; // non-clonable
12
+ function FromClassInstance(value) {
13
+ return value; // atomic
12
14
  }
13
15
  // ------------------------------------------------------------------
14
- // Array
16
+ // KindedObject
17
+ //
18
+ // Types have non-enumerable properties that MUST be preserved on Clone.
19
+ // The following is the optimal path for TypeBox types.
15
20
  // ------------------------------------------------------------------
16
- function FromArray(value) {
17
- return value.map((value) => FromValue(value));
21
+ function IsKindedObject(value) {
22
+ return Guard.HasPropertyKey(value, '~kind');
18
23
  }
19
- // ------------------------------------------------------------------
20
- // Object
21
- // ------------------------------------------------------------------
22
- function FromObject(value) {
24
+ function FromKindedObject(value) {
23
25
  const result = {};
24
26
  const descriptors = Object.getOwnPropertyDescriptors(value);
25
27
  for (const key of Object.keys(descriptors)) {
28
+ if (Guard.IsUnsafePropertyKey(key))
29
+ continue; // (ignore: prototype-pollution)
26
30
  const descriptor = descriptors[key];
27
31
  if (Guard.HasPropertyKey(descriptor, 'value')) {
28
32
  Object.defineProperty(result, key, { ...descriptor, value: FromValue(descriptor.value) });
@@ -31,31 +35,73 @@ function FromObject(value) {
31
35
  return result;
32
36
  }
33
37
  // ------------------------------------------------------------------
38
+ // PlainObject
39
+ // ------------------------------------------------------------------
40
+ function FromPlainObject(value) {
41
+ const result = {};
42
+ for (const key of Guard.Keys(value)) {
43
+ if (Guard.IsUnsafePropertyKey(key))
44
+ continue; // (ignore: prototype-pollution)
45
+ result[key] = FromValue(value[key]);
46
+ }
47
+ for (const key of Guard.Symbols(value)) {
48
+ result[key] = FromValue(value[key]);
49
+ }
50
+ return result;
51
+ }
52
+ // ------------------------------------------------------------------
53
+ // Object
54
+ // ------------------------------------------------------------------
55
+ function FromObject(value) {
56
+ return (Guard.IsClassInstance(value) ? FromClassInstance(value) :
57
+ IsKindedObject(value) ? FromKindedObject(value) :
58
+ FromPlainObject(value));
59
+ }
60
+ // ------------------------------------------------------------------
61
+ // Array
62
+ // ------------------------------------------------------------------
63
+ function FromArray(value) {
64
+ return value.map((element) => FromValue(element));
65
+ }
66
+ // ------------------------------------------------------------------
67
+ // TypeArray
68
+ // ------------------------------------------------------------------
69
+ function FromTypedArray(value) {
70
+ return value.slice();
71
+ }
72
+ // ------------------------------------------------------------------
34
73
  // RegExp
35
74
  // ------------------------------------------------------------------
36
75
  function FromRegExp(value) {
37
76
  return new RegExp(value.source, value.flags);
38
77
  }
39
78
  // ------------------------------------------------------------------
40
- // RegExp
79
+ // Map
41
80
  // ------------------------------------------------------------------
42
- function FromUnknown(value) {
43
- return value;
81
+ function FromMap(value) {
82
+ return new Map(FromValue([...value.entries()]));
44
83
  }
45
84
  // ------------------------------------------------------------------
46
- // Value
85
+ // Set
47
86
  // ------------------------------------------------------------------
87
+ function FromSet(value) {
88
+ return new Set(FromValue([...value.values()]));
89
+ }
48
90
  function FromValue(value) {
49
- return (value instanceof RegExp ? FromRegExp(value) :
50
- IsGuard(value) ? FromGuard(value) :
51
- Guard.IsArray(value) ? FromArray(value) :
52
- Guard.IsObject(value) ? FromObject(value) :
53
- FromUnknown(value));
91
+ return (GlobalsGuard.IsTypeArray(value) ? FromTypedArray(value) :
92
+ GlobalsGuard.IsRegExp(value) ? FromRegExp(value) :
93
+ GlobalsGuard.IsMap(value) ? FromMap(value) :
94
+ GlobalsGuard.IsSet(value) ? FromSet(value) :
95
+ Guard.IsArray(value) ? FromArray(value) :
96
+ Guard.IsObject(value) ? FromObject(value) :
97
+ value);
54
98
  }
99
+ // ------------------------------------------------------------------
100
+ // Clone
101
+ // ------------------------------------------------------------------
55
102
  /**
56
- * Clones a value using the TypeBox type cloning strategy. This function preserves non-enumerable
57
- * properties from the source value. This is to ensure cloned types retain discriminable
58
- * hidden properties.
103
+ * Returns a Clone of the given value. This function is similar to structuredClone()
104
+ * but also supports deep cloning instances of Map, Set and TypeArray.
59
105
  */
60
106
  export function Clone(value) {
61
107
  Metrics.clone += 1;
@@ -4,7 +4,6 @@ export * from './_add_optional.mjs';
4
4
  export * from './_remove_immutable.mjs';
5
5
  export * from './_remove_readonly.mjs';
6
6
  export * from './_remove_optional.mjs';
7
- export * from './awaited.mjs';
8
7
  export * from './capitalize.mjs';
9
8
  export * from './conditional.mjs';
10
9
  export * from './constructor_parameters.mjs';
@@ -4,7 +4,6 @@ export * from './_add_optional.mjs';
4
4
  export * from './_remove_immutable.mjs';
5
5
  export * from './_remove_readonly.mjs';
6
6
  export * from './_remove_optional.mjs';
7
- export * from './awaited.mjs';
8
7
  export * from './capitalize.mjs';
9
8
  export * from './conditional.mjs';
10
9
  export * from './constructor_parameters.mjs';
@@ -9,8 +9,3 @@ export declare function ReadonlyObjectDeferred<Type extends TSchema>(type: Type,
9
9
  export type TReadonlyObject<Type extends TSchema> = (TReadonlyObjectAction<Type>);
10
10
  /** This type is an alias for TypeScript's `Readonly<T>` utility type. It will make all properties of a TObject readonly or marks an TArray or TTuple as immutable `readonly T[]`. */
11
11
  export declare function ReadonlyObject<Type extends TSchema>(type: Type, options?: TSchemaOptions): TReadonlyObject<Type>;
12
- /**
13
- * This type has been renamed to ReadonlyObject.
14
- * @deprecated
15
- */
16
- export declare const ReadonlyType: typeof ReadonlyObject;
@@ -9,8 +9,3 @@ export function ReadonlyObjectDeferred(type, options = {}) {
9
9
  export function ReadonlyObject(type, options = {}) {
10
10
  return ReadonlyObjectAction(type, options);
11
11
  }
12
- /**
13
- * This type has been renamed to ReadonlyObject.
14
- * @deprecated
15
- */
16
- export const ReadonlyType = ReadonlyObject;
@@ -9,13 +9,3 @@ export declare function WithDeferred<Type extends TSchema, Options extends TSche
9
9
  export type TWith<Type extends TSchema, Options extends TSchema> = (Type & Options);
10
10
  /** Applies annotation options to the given type. */
11
11
  export declare function With<Type extends TSchema, const Options extends TSchema>(type: Type, options: Options): TWithAction<Type, Options>;
12
- /**
13
- * @deprecated Type.TOptions\<T\> has been renamed to Type.TWith\<T\>. This type will be removed in the
14
- * next version of TypeBox.
15
- */
16
- export type TOptions<Type extends TSchema, Options extends TSchema> = TWith<Type, Options>;
17
- /**
18
- * @deprecated Type.Options\<T\> has been renamed to Type.With\<T\>. This type will be removed in the
19
- * next version of TypeBox.
20
- */
21
- export declare function Options<Type extends TSchema, const Options extends TSchema>(type: Type, options: Options): TOptions<Type, Options>;
@@ -9,11 +9,3 @@ export function WithDeferred(type, options) {
9
9
  export function With(type, options) {
10
10
  return WithAction(type, options);
11
11
  }
12
- /**
13
- * @deprecated Type.Options\<T\> has been renamed to Type.With\<T\>. This type will be removed in the
14
- * next version of TypeBox.
15
- */
16
- export function Options(type, options) {
17
- return With(type, options);
18
- }
19
- // deno-coverage-ignore-stop
@@ -1,12 +1,9 @@
1
1
  import { type TSchema } from '../../types/schema.mjs';
2
2
  import { type TArray } from '../../types/array.mjs';
3
- import { type TAsyncIterator } from '../../types/async_iterator.mjs';
4
3
  import { type TConstructor } from '../../types/constructor.mjs';
5
4
  import { type TFunction } from '../../types/function.mjs';
6
5
  import { type TIntersect } from '../../types/intersect.mjs';
7
- import { type TIterator } from '../../types/iterator.mjs';
8
6
  import { type TObject } from '../../types/object.mjs';
9
- import { type TPromise } from '../../types/promise.mjs';
10
7
  import { type TProperties, type TPropertyValues } from '../../types/properties.mjs';
11
8
  import { type TRecord } from '../../types/record.mjs';
12
9
  import { type TTuple } from '../../types/tuple.mjs';
@@ -16,7 +13,7 @@ import { type TInterfaceDeferred } from '../../action/interface.mjs';
16
13
  type TFromRef<Stack extends (keyof Context)[], Context extends TProperties, Ref extends (keyof Context)> = Ref extends Stack[number] ? true : TFromType<[...Stack, Ref], Context, Context[Ref]>;
17
14
  type TFromProperties<Stack extends (keyof Context)[], Context extends TProperties, Properties extends TProperties, Types extends TSchema[] = TPropertyValues<Properties>> = TFromTypes<Stack, Context, Types>;
18
15
  type TFromTypes<Stack extends (keyof Context)[], Context extends TProperties, Types extends TSchema[]> = Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromType<Stack, Context, Left> extends true ? true : TFromTypes<Stack, Context, Right> : false;
19
- type TFromType<Stack extends (keyof Context)[], Context extends TProperties, Type extends TSchema> = (Type extends TRef<infer Ref extends string> ? TFromRef<Stack, Context, Ref> : Type extends TArray<infer Type extends TSchema> ? TFromType<Stack, Context, Type> : Type extends TAsyncIterator<infer Type extends TSchema> ? TFromType<Stack, Context, Type> : Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TFromTypes<Stack, Context, [...Parameters, InstanceType]> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TFromTypes<Stack, Context, [...Parameters, ReturnType]> : Type extends TInterfaceDeferred<TSchema[], infer Properties extends TProperties> ? TFromProperties<Stack, Context, Properties> : Type extends TIntersect<infer Types extends TSchema[]> ? TFromTypes<Stack, Context, Types> : Type extends TIterator<infer Type extends TSchema> ? TFromType<Stack, Context, Type> : Type extends TObject<infer Properties extends TProperties> ? TFromProperties<Stack, Context, Properties> : Type extends TPromise<infer Type extends TSchema> ? TFromType<Stack, Context, Type> : Type extends TUnion<infer Types extends TSchema[]> ? TFromTypes<Stack, Context, Types> : Type extends TTuple<infer Types extends TSchema[]> ? TFromTypes<Stack, Context, Types> : Type extends TRecord<string, infer Type extends TSchema> ? TFromType<Stack, Context, Type> : false);
16
+ type TFromType<Stack extends (keyof Context)[], Context extends TProperties, Type extends TSchema> = (Type extends TRef<infer Ref extends string> ? TFromRef<Stack, Context, Ref> : Type extends TArray<infer Type extends TSchema> ? TFromType<Stack, Context, Type> : Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TFromTypes<Stack, Context, [...Parameters, InstanceType]> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TFromTypes<Stack, Context, [...Parameters, ReturnType]> : Type extends TInterfaceDeferred<TSchema[], infer Properties extends TProperties> ? TFromProperties<Stack, Context, Properties> : Type extends TIntersect<infer Types extends TSchema[]> ? TFromTypes<Stack, Context, Types> : Type extends TObject<infer Properties extends TProperties> ? TFromProperties<Stack, Context, Properties> : Type extends TUnion<infer Types extends TSchema[]> ? TFromTypes<Stack, Context, Types> : Type extends TTuple<infer Types extends TSchema[]> ? TFromTypes<Stack, Context, Types> : Type extends TRecord<string, infer Type extends TSchema> ? TFromType<Stack, Context, Type> : false);
20
17
  /** Performs a cyclic check on the given type. Initial key stack can be empty, but faster if specified */
21
18
  export type TCyclicCheck<Stack extends (keyof Context)[], Context extends TProperties, Type extends TSchema, Result extends boolean = TFromType<Stack, Context, Type>> = Result;
22
19
  /** Performs a cyclic check on the given type. Initial key stack can be empty, but faster if specified */
@@ -1,13 +1,10 @@
1
1
  // deno-fmt-ignore-file
2
2
  import { Guard } from '../../../guard/index.mjs';
3
3
  import { IsArray } from '../../types/array.mjs';
4
- import { IsAsyncIterator } from '../../types/async_iterator.mjs';
5
4
  import { IsConstructor } from '../../types/constructor.mjs';
6
5
  import { IsFunction } from '../../types/function.mjs';
7
6
  import { IsIntersect } from '../../types/intersect.mjs';
8
- import { IsIterator } from '../../types/iterator.mjs';
9
7
  import { IsObject } from '../../types/object.mjs';
10
- import { IsPromise } from '../../types/promise.mjs';
11
8
  import { PropertyValues } from '../../types/properties.mjs';
12
9
  import { IsRecord, RecordValue } from '../../types/record.mjs';
13
10
  import { IsTuple } from '../../types/tuple.mjs';
@@ -31,18 +28,15 @@ function FromTypes(stack, context, types) {
31
28
  function FromType(stack, context, type) {
32
29
  return (IsRef(type) ? FromRef(stack, context, type.$ref) :
33
30
  IsArray(type) ? FromType(stack, context, type.items) :
34
- IsAsyncIterator(type) ? FromType(stack, context, type.iteratorItems) :
35
- IsConstructor(type) ? FromTypes(stack, context, [...type.parameters, type.instanceType]) :
36
- IsFunction(type) ? FromTypes(stack, context, [...type.parameters, type.returnType]) :
37
- IsInterfaceDeferred(type) ? FromProperties(stack, context, type.parameters[1]) :
38
- IsIntersect(type) ? FromTypes(stack, context, type.allOf) :
39
- IsIterator(type) ? FromType(stack, context, type.iteratorItems) :
40
- IsObject(type) ? FromProperties(stack, context, type.properties) :
41
- IsPromise(type) ? FromType(stack, context, type.item) :
42
- IsUnion(type) ? FromTypes(stack, context, type.anyOf) :
43
- IsTuple(type) ? FromTypes(stack, context, type.items) :
44
- IsRecord(type) ? FromType(stack, context, RecordValue(type)) :
45
- false);
31
+ IsConstructor(type) ? FromTypes(stack, context, [...type.parameters, type.instanceType]) :
32
+ IsFunction(type) ? FromTypes(stack, context, [...type.parameters, type.returnType]) :
33
+ IsInterfaceDeferred(type) ? FromProperties(stack, context, type.parameters[1]) :
34
+ IsIntersect(type) ? FromTypes(stack, context, type.allOf) :
35
+ IsObject(type) ? FromProperties(stack, context, type.properties) :
36
+ IsUnion(type) ? FromTypes(stack, context, type.anyOf) :
37
+ IsTuple(type) ? FromTypes(stack, context, type.items) :
38
+ IsRecord(type) ? FromType(stack, context, RecordValue(type)) :
39
+ false);
46
40
  }
47
41
  /** Performs a cyclic check on the given type. Initial key stack can be empty, but faster if specified */
48
42
  export function CyclicCheck(stack, context, type) {
@@ -1,13 +1,10 @@
1
1
  import { type TUnreachable } from '../../../system/unreachable/index.mjs';
2
2
  import { type TSchema } from '../../types/schema.mjs';
3
3
  import { type TArray } from '../../types/array.mjs';
4
- import { type TAsyncIterator } from '../../types/async_iterator.mjs';
5
4
  import { type TConstructor } from '../../types/constructor.mjs';
6
5
  import { type TFunction } from '../../types/function.mjs';
7
6
  import { type TIntersect } from '../../types/intersect.mjs';
8
- import { type TIterator } from '../../types/iterator.mjs';
9
7
  import { type TObject } from '../../types/object.mjs';
10
- import { type TPromise } from '../../types/promise.mjs';
11
8
  import { type TProperties, type TPropertyValues } from '../../types/properties.mjs';
12
9
  import { type TRecord } from '../../types/record.mjs';
13
10
  import { type TTuple } from '../../types/tuple.mjs';
@@ -17,7 +14,7 @@ import { type TInterfaceDeferred } from '../../action/interface.mjs';
17
14
  type TFromRef<Context extends TProperties, Ref extends string, Dependencies extends string[]> = Ref extends Dependencies[number] ? Dependencies : Ref extends keyof Context ? TFromType<Context, Context[Ref], [...Dependencies, Ref]> : TUnreachable;
18
15
  type TFromProperties<Context extends TProperties, Properties extends TProperties, Dependencies extends string[], Types extends TSchema[] = TPropertyValues<Properties>> = TFromTypes<Context, Types, Dependencies>;
19
16
  type TFromTypes<Context extends TProperties, Types extends TSchema[], Dependencies extends string[]> = Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromTypes<Context, Right, TFromType<Context, Left, Dependencies>> : Dependencies;
20
- type TFromType<Context extends TProperties, Type extends TSchema, Result extends string[]> = (Type extends TRef<infer Ref extends string> ? TFromRef<Context, Ref, Result> : Type extends TArray<infer Type extends TSchema> ? TFromType<Context, Type, Result> : Type extends TAsyncIterator<infer Type extends TSchema> ? TFromType<Context, Type, Result> : Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TFromTypes<Context, [...Parameters, InstanceType], Result> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TFromTypes<Context, [...Parameters, ReturnType], Result> : Type extends TInterfaceDeferred<TSchema[], infer Properties extends TProperties> ? TFromProperties<Context, Properties, Result> : Type extends TIntersect<infer Types extends TSchema[]> ? TFromTypes<Context, Types, Result> : Type extends TIterator<infer Type extends TSchema> ? TFromType<Context, Type, Result> : Type extends TObject<infer Properties extends TProperties> ? TFromProperties<Context, Properties, Result> : Type extends TPromise<infer Type extends TSchema> ? TFromType<Context, Type, Result> : Type extends TUnion<infer Types extends TSchema[]> ? TFromTypes<Context, Types, Result> : Type extends TTuple<infer Types extends TSchema[]> ? TFromTypes<Context, Types, Result> : Type extends TRecord<string, infer Type extends TSchema> ? TFromType<Context, Type, Result> : Result);
17
+ type TFromType<Context extends TProperties, Type extends TSchema, Result extends string[]> = (Type extends TRef<infer Ref extends string> ? TFromRef<Context, Ref, Result> : Type extends TArray<infer Type extends TSchema> ? TFromType<Context, Type, Result> : Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TFromTypes<Context, [...Parameters, InstanceType], Result> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TFromTypes<Context, [...Parameters, ReturnType], Result> : Type extends TInterfaceDeferred<TSchema[], infer Properties extends TProperties> ? TFromProperties<Context, Properties, Result> : Type extends TIntersect<infer Types extends TSchema[]> ? TFromTypes<Context, Types, Result> : Type extends TObject<infer Properties extends TProperties> ? TFromProperties<Context, Properties, Result> : Type extends TUnion<infer Types extends TSchema[]> ? TFromTypes<Context, Types, Result> : Type extends TTuple<infer Types extends TSchema[]> ? TFromTypes<Context, Types, Result> : Type extends TRecord<string, infer Type extends TSchema> ? TFromType<Context, Type, Result> : Result);
21
18
  /** Returns dependent cyclic keys for the given type. This function is used to dead-type-eliminate (DTE) for initializing TCyclic types. */
22
19
  export type TCyclicDependencies<Context extends TProperties, Key extends string, Type extends TSchema, Result extends string[] = TFromType<Context, Type, [Key]>> = Result;
23
20
  /** Returns dependent cyclic keys for the given type. This function is used to dead-type-eliminate (DTE) for initializing TCyclic types. */
@@ -1,13 +1,10 @@
1
1
  // deno-fmt-ignore-file
2
2
  import { Unreachable } from '../../../system/unreachable/index.mjs';
3
3
  import { IsArray } from '../../types/array.mjs';
4
- import { IsAsyncIterator } from '../../types/async_iterator.mjs';
5
4
  import { IsConstructor } from '../../types/constructor.mjs';
6
5
  import { IsFunction } from '../../types/function.mjs';
7
6
  import { IsIntersect } from '../../types/intersect.mjs';
8
- import { IsIterator } from '../../types/iterator.mjs';
9
7
  import { IsObject } from '../../types/object.mjs';
10
- import { IsPromise } from '../../types/promise.mjs';
11
8
  import { PropertyValues } from '../../types/properties.mjs';
12
9
  import { IsRecord, RecordValue } from '../../types/record.mjs';
13
10
  import { IsTuple } from '../../types/tuple.mjs';
@@ -33,18 +30,15 @@ function FromTypes(context, types, result) {
33
30
  function FromType(context, type, result) {
34
31
  return (IsRef(type) ? FromRef(context, type.$ref, result) :
35
32
  IsArray(type) ? FromType(context, type.items, result) :
36
- IsAsyncIterator(type) ? FromType(context, type.iteratorItems, result) :
37
- IsConstructor(type) ? FromTypes(context, [...type.parameters, type.instanceType], result) :
38
- IsFunction(type) ? FromTypes(context, [...type.parameters, type.returnType], result) :
39
- IsInterfaceDeferred(type) ? FromProperties(context, type.parameters[1], result) :
40
- IsIntersect(type) ? FromTypes(context, type.allOf, result) :
41
- IsIterator(type) ? FromType(context, type.iteratorItems, result) :
42
- IsObject(type) ? FromProperties(context, type.properties, result) :
43
- IsPromise(type) ? FromType(context, type.item, result) :
44
- IsUnion(type) ? FromTypes(context, type.anyOf, result) :
45
- IsTuple(type) ? FromTypes(context, type.items, result) :
46
- IsRecord(type) ? FromType(context, RecordValue(type), result) :
47
- result);
33
+ IsConstructor(type) ? FromTypes(context, [...type.parameters, type.instanceType], result) :
34
+ IsFunction(type) ? FromTypes(context, [...type.parameters, type.returnType], result) :
35
+ IsInterfaceDeferred(type) ? FromProperties(context, type.parameters[1], result) :
36
+ IsIntersect(type) ? FromTypes(context, type.allOf, result) :
37
+ IsObject(type) ? FromProperties(context, type.properties, result) :
38
+ IsUnion(type) ? FromTypes(context, type.anyOf, result) :
39
+ IsTuple(type) ? FromTypes(context, type.items, result) :
40
+ IsRecord(type) ? FromType(context, RecordValue(type), result) :
41
+ result);
48
42
  }
49
43
  /** Returns dependent cyclic keys for the given type. This function is used to dead-type-eliminate (DTE) for initializing TCyclic types. */
50
44
  export function CyclicDependencies(context, key, type) {
@@ -1,14 +1,11 @@
1
1
  import { type TSchema } from '../../types/schema.mjs';
2
2
  import { type TAny } from '../../types/any.mjs';
3
3
  import { type TArray } from '../../types/array.mjs';
4
- import { type TAsyncIterator } from '../../types/async_iterator.mjs';
5
4
  import { type TConstructor } from '../../types/constructor.mjs';
6
5
  import { type TCyclic } from '../../types/cyclic.mjs';
7
6
  import { type TFunction } from '../../types/function.mjs';
8
7
  import { type TIntersect } from '../../types/intersect.mjs';
9
- import { type TIterator } from '../../types/iterator.mjs';
10
8
  import { type TObject } from '../../types/object.mjs';
11
- import { type TPromise } from '../../types/promise.mjs';
12
9
  import { type TProperties } from '../../types/properties.mjs';
13
10
  import { type TRecord } from '../../types/record.mjs';
14
11
  import { type TRef } from '../../types/ref.mjs';
@@ -22,7 +19,7 @@ type TFromProperties<Properties extends TProperties, Result extends TProperties
22
19
  [Key in keyof Result]: Result[Key];
23
20
  };
24
21
  type TFromTypes<Types extends TSchema[], Result extends TSchema[] = []> = Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromTypes<Right, [...Result, TFromType<Left>]> : Result;
25
- type TFromType<Type extends TSchema> = (Type extends TRef<infer Ref extends string> ? TFromRef<Ref> : Type extends TArray<infer Type extends TSchema> ? TArray<TFromType<Type>> : Type extends TAsyncIterator<infer Type extends TSchema> ? TAsyncIterator<TFromType<Type>> : Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TFunction<TFromTypes<Parameters>, TFromType<InstanceType>> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TFunction<TFromTypes<Parameters>, TFromType<ReturnType>> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromTypes<Types>> : Type extends TIterator<infer Type extends TSchema> ? TIterator<TFromType<Type>> : Type extends TObject<infer Properties extends TProperties> ? TObject<TFromProperties<Properties>> : Type extends TPromise<infer Type extends TSchema> ? TPromise<TFromType<Type>> : Type extends TRecord<infer Pattern extends string, infer Value extends TSchema> ? TRecord<Pattern, TFromType<Value>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromTypes<Types>> : Type extends TTuple<infer Types extends TSchema[]> ? TTuple<TFromTypes<Types>> : Type);
22
+ type TFromType<Type extends TSchema> = (Type extends TRef<infer Ref extends string> ? TFromRef<Ref> : Type extends TArray<infer Type extends TSchema> ? TArray<TFromType<Type>> : Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TFunction<TFromTypes<Parameters>, TFromType<InstanceType>> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TFunction<TFromTypes<Parameters>, TFromType<ReturnType>> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromTypes<Types>> : Type extends TObject<infer Properties extends TProperties> ? TObject<TFromProperties<Properties>> : Type extends TRecord<infer Pattern extends string, infer Value extends TSchema> ? TRecord<Pattern, TFromType<Value>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromTypes<Types>> : Type extends TTuple<infer Types extends TSchema[]> ? TTuple<TFromTypes<Types>> : Type);
26
23
  type TCyclicAnyFromParameters<Defs extends TProperties, Ref extends string> = (Ref extends keyof Defs ? TFromType<Defs[Ref]> : TUnknown);
27
24
  /** Transforms TCyclic TRef's into TAny's. This function is used prior to TExtends checks to enable cyclics to be structurally checked and terminated (with TAny) at first point of recursion, what would otherwise be a recursive TRef.*/
28
25
  export type TCyclicExtends<Type extends TCyclic, Result extends TSchema = TCyclicAnyFromParameters<Type['$defs'], Type['$ref']>> = Result;
@@ -2,13 +2,10 @@
2
2
  import { Guard } from '../../../guard/index.mjs';
3
3
  import { Any } from '../../types/any.mjs';
4
4
  import { Array as _Array_, IsArray, ArrayOptions } from '../../types/array.mjs';
5
- import { AsyncIterator, IsAsyncIterator } from '../../types/async_iterator.mjs';
6
5
  import { Constructor, IsConstructor } from '../../types/constructor.mjs';
7
6
  import { Function as _Function_, IsFunction } from '../../types/function.mjs';
8
7
  import { Intersect, IsIntersect } from '../../types/intersect.mjs';
9
- import { Iterator, IsIterator } from '../../types/iterator.mjs';
10
8
  import { Object, IsObject } from '../../types/object.mjs';
11
- import { Promise, IsPromise } from '../../types/promise.mjs';
12
9
  import { IsRecord, Record, RecordKey, RecordValue } from '../../types/record.mjs';
13
10
  import { IsRef } from '../../types/ref.mjs';
14
11
  import { Tuple, IsTuple } from '../../types/tuple.mjs';
@@ -30,17 +27,14 @@ function FromTypes(types) {
30
27
  function FromType(type) {
31
28
  return (IsRef(type) ? FromRef(type.$ref) :
32
29
  IsArray(type) ? _Array_(FromType(type.items), ArrayOptions(type)) :
33
- IsAsyncIterator(type) ? AsyncIterator(FromType(type.iteratorItems)) :
34
- IsConstructor(type) ? Constructor(FromTypes(type.parameters), FromType(type.instanceType)) :
35
- IsFunction(type) ? _Function_(FromTypes(type.parameters), FromType(type.returnType)) :
36
- IsIntersect(type) ? Intersect(FromTypes(type.allOf)) :
37
- IsIterator(type) ? Iterator(FromType(type.iteratorItems)) :
38
- IsObject(type) ? Object(FromProperties(type.properties)) :
39
- IsPromise(type) ? Promise(FromType(type.item)) :
40
- IsRecord(type) ? Record(RecordKey(type), FromType(RecordValue(type))) :
41
- IsUnion(type) ? Union(FromTypes(type.anyOf)) :
42
- IsTuple(type) ? Tuple(FromTypes(type.items)) :
43
- type);
30
+ IsConstructor(type) ? Constructor(FromTypes(type.parameters), FromType(type.instanceType)) :
31
+ IsFunction(type) ? _Function_(FromTypes(type.parameters), FromType(type.returnType)) :
32
+ IsIntersect(type) ? Intersect(FromTypes(type.allOf)) :
33
+ IsObject(type) ? Object(FromProperties(type.properties)) :
34
+ IsRecord(type) ? Record(RecordKey(type), FromType(RecordValue(type))) :
35
+ IsUnion(type) ? Union(FromTypes(type.anyOf)) :
36
+ IsTuple(type) ? Tuple(FromTypes(type.items)) :
37
+ type);
44
38
  }
45
39
  function CyclicAnyFromParameters(defs, ref) {
46
40
  return (ref in defs
@@ -1,5 +1,4 @@
1
1
  export { Instantiate, type TInstantiate } from './instantiate.mjs';
2
- export * from './awaited/index.mjs';
3
2
  export * from './conditional/index.mjs';
4
3
  export * from './constructor_parameters/index.mjs';
5
4
  export * from './cyclic/index.mjs';
@@ -5,7 +5,6 @@ export { Instantiate } from './instantiate.mjs';
5
5
  // ------------------------------------------------------------------
6
6
  // Engine: Internals
7
7
  // ------------------------------------------------------------------
8
- export * from './awaited/index.mjs';
9
8
  export * from './conditional/index.mjs';
10
9
  export * from './constructor_parameters/index.mjs';
11
10
  export * from './cyclic/index.mjs';
@@ -8,7 +8,7 @@ import { type TState, type TInstantiateType, type TCanInstantiate } from '../ins
8
8
  import { type TIndexDeferred } from '../../action/indexed.mjs';
9
9
  import { type TCollapseToObject } from '../object/index.mjs';
10
10
  import { type TFromType } from './from_type.mjs';
11
- type TNormalizeType<Type extends TSchema, Result extends TSchema = (Type extends TCyclic | TDependent | TIntersect | TUnion ? TCollapseToObject<Type> : Type)> = Result;
11
+ type TNormalizeType<Type extends TSchema, Result extends TSchema = (Type extends TCyclic ? TCollapseToObject<Type> : Type extends TDependent ? TCollapseToObject<Type> : Type extends TIntersect ? TCollapseToObject<Type> : Type extends TUnion ? TCollapseToObject<Type> : Type)> = Result;
12
12
  export type TIndexAction<Type extends TSchema, Indexer extends TSchema, Result extends TSchema = TCanInstantiate<[Type, Indexer]> extends true ? TFromType<TNormalizeType<Type>, Indexer> : TIndexDeferred<Type, Indexer>> = Result;
13
13
  export declare function IndexAction<Type extends TSchema, Indexer extends TSchema>(type: Type, indexer: Indexer, options: TSchemaOptions): TIndexAction<Type, Indexer>;
14
14
  export type TIndexInstantiate<Context extends TProperties, State extends TState, Type extends TSchema, Indexer extends TSchema, InstantiatedType extends TSchema = TInstantiateType<Context, State, Type>, InstantiatedIndexer extends TSchema = TInstantiateType<Context, State, Indexer>> = TIndexAction<InstantiatedType, InstantiatedIndexer>;
@@ -9,8 +9,10 @@ import { IndexDeferred } from '../../action/indexed.mjs';
9
9
  import { CollapseToObject } from '../object/index.mjs';
10
10
  import { FromType } from './from_type.mjs';
11
11
  function NormalizeType(type) {
12
- const result = (IsCyclic(type) || IsDependent(type) || IsIntersect(type) || IsUnion(type) ? CollapseToObject(type) :
13
- type);
12
+ const result = (IsCyclic(type) ||
13
+ IsDependent(type) ||
14
+ IsIntersect(type) ||
15
+ IsUnion(type)) ? CollapseToObject(type) : type;
14
16
  return result;
15
17
  }
16
18
  export function IndexAction(type, indexer, options) {
@@ -1,6 +1,8 @@
1
+ import { type TAddImmutableAction } from './immutable/instantiate_add.mjs';
2
+ import { type TAddReadonlyAction } from './readonly/instantiate_add.mjs';
3
+ import { type TAddOptionalAction } from './optional/instantiate_add.mjs';
1
4
  import { type TSchema } from '../types/schema.mjs';
2
5
  import { type TArray } from '../types/array.mjs';
3
- import { type TAsyncIterator } from '../types/async_iterator.mjs';
4
6
  import { type TConstructor } from '../types/constructor.mjs';
5
7
  import { type TDeferred } from '../types/deferred.mjs';
6
8
  import { type TFunction } from '../types/function.mjs';
@@ -8,9 +10,7 @@ import { type TCall } from '../types/call.mjs';
8
10
  import { type TIdentifier } from '../types/identifier.mjs';
9
11
  import { type TDependent } from '../types/dependent.mjs';
10
12
  import { type TIntersect } from '../types/intersect.mjs';
11
- import { type TIterator } from '../types/iterator.mjs';
12
13
  import { type TObject } from '../types/object.mjs';
13
- import { type TPromise } from '../types/promise.mjs';
14
14
  import { type TProperties } from '../types/properties.mjs';
15
15
  import { type TRecord } from '../types/record.mjs';
16
16
  import { type TTuple } from '../types/tuple.mjs';
@@ -26,7 +26,6 @@ import { type TRemoveOptionalInstantiate } from './optional/instantiate_remove.m
26
26
  import { type TOptional } from '../types/_optional.mjs';
27
27
  import { type TImmutable } from '../types/_immutable.mjs';
28
28
  import { type TReadonly } from '../types/_readonly.mjs';
29
- import { type TAwaitedInstantiate } from './awaited/instantiate.mjs';
30
29
  import { type TCallInstantiate } from './call/instantiate.mjs';
31
30
  import { type TCapitalizeInstantiate } from './intrinsics/instantiate.mjs';
32
31
  import { type TConditionalInstantiate } from './conditional/index.mjs';
@@ -71,6 +70,7 @@ export type TInstantiateElements<Context extends TProperties, State extends TSta
71
70
  export declare function InstantiateElements<Context extends TProperties, State extends TState, Types extends TSchema[]>(context: Context, state: State, types: [...Types]): TInstantiateElements<Context, State, Types>;
72
71
  export type TInstantiateTypes<Context extends TProperties, State extends TState, Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TInstantiateTypes<Context, State, Right, [...Result, TInstantiateType<Context, State, Left>]> : Result);
73
72
  export declare function InstantiateTypes<Context extends TProperties, State extends TState, Types extends TSchema[]>(context: Context, state: State, types: [...Types]): TInstantiateTypes<Context, State, Types>;
73
+ type TWithModifiers<Type extends TSchema, InstantiatedType extends TSchema, WithOptional extends TSchema = Type extends TOptional ? TAddOptionalAction<InstantiatedType> : InstantiatedType, WithReadonly extends TSchema = Type extends TReadonly ? TAddReadonlyAction<WithOptional> : WithOptional, WithImmutable extends TSchema = Type extends TImmutable ? TAddImmutableAction<WithReadonly> : WithReadonly> = WithImmutable;
74
74
  type TInstantiateDeferred<Context extends TProperties, State extends TState, Action extends string, Parameters extends TSchema[]> = ([
75
75
  Action,
76
76
  Parameters
@@ -92,9 +92,6 @@ type TInstantiateDeferred<Context extends TProperties, State extends TState, Act
92
92
  ] extends ['RemoveOptional', [infer Type extends TSchema]] ? TRemoveOptionalInstantiate<Context, State, Type> : [
93
93
  Action,
94
94
  Parameters
95
- ] extends ['Awaited', [infer Type extends TSchema]] ? TAwaitedInstantiate<Context, State, Type> : [
96
- Action,
97
- Parameters
98
95
  ] extends ['Capitalize', [infer Type extends TSchema]] ? TCapitalizeInstantiate<Context, State, Type> : [
99
96
  Action,
100
97
  Parameters
@@ -171,11 +168,9 @@ type TInstantiateDeferred<Context extends TProperties, State extends TState, Act
171
168
  Action,
172
169
  Parameters
173
170
  ] extends ['With', [infer Type extends TSchema, infer Options extends TSchema]] ? TWithInstantiate<Context, State, Type, Options> : TDeferred<Action, Parameters>);
174
- export type TInstantiateImmediate<Context extends TProperties, State extends TState, Type extends TSchema, Result extends TSchema = (Type extends TRef<infer Ref extends string> ? TRefInstantiate<Context, State, Type, Ref> : Type extends TArray<infer Type extends TSchema> ? TArray<TInstantiateType<Context, State, Type>> : Type extends TAsyncIterator<infer Type extends TSchema> ? TAsyncIterator<TInstantiateType<Context, State, Type>> : Type extends TCall<infer Target extends TSchema, infer Parameters extends TSchema[]> ? TCallInstantiate<Context, State, Target, Parameters> : Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TConstructor<TInstantiateTypes<Context, State, Parameters>, TInstantiateType<Context, State, InstanceType>> : Type extends TDeferred<infer Action extends string, infer Types extends TSchema[]> ? TInstantiateDeferred<Context, State, Action, Types> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TFunction<TInstantiateTypes<Context, State, Parameters>, TInstantiateType<Context, State, ReturnType>> : Type extends TDependent<infer If extends TSchema, infer Then extends TSchema, infer Else extends TSchema> ? TDependent<TInstantiateType<Context, State, If>, TInstantiateType<Context, State, Then>, TInstantiateType<Context, State, Else>> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TInstantiateTypes<Context, State, Types>> : Type extends TIterator<infer Type extends TSchema> ? TIterator<TInstantiateType<Context, State, Type>> : Type extends TObject<infer Properties extends TProperties> ? TObject<TInstantiateProperties<Context, State, Properties>> : Type extends TPromise<infer Type extends TSchema> ? TPromise<TInstantiateType<Context, State, Type>> : Type extends TRecord<infer Key extends string, infer Type extends TSchema> ? TRecord<Key, TInstantiateType<Context, State, Type>> : Type extends TRest<infer Type extends TSchema> ? TRest<TInstantiateType<Context, State, Type>> : Type extends TTuple<infer Types extends TSchema[]> ? TTuple<TInstantiateElements<Context, State, Types>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TInstantiateTypes<Context, State, Types>> : Type)> = Result;
175
- export declare function InstantiateImmediate<Context extends TProperties, State extends TState, Type extends TSchema>(context: Context, state: State, type: Type): TInstantiateImmediate<Context, State, Type>;
176
- type TWithModifiers<Type extends TSchema, InstantiatedType extends TSchema, WithImmutable extends TSchema = Type extends TImmutable ? TImmutable<InstantiatedType> : InstantiatedType, WithReadonly extends TSchema = Type extends TReadonly ? TReadonly<WithImmutable> : WithImmutable, WithOptional extends TSchema = Type extends TOptional ? TOptional<WithReadonly> : WithReadonly> = WithOptional;
177
- export type TInstantiateType<Context extends TProperties, State extends TState, Type extends TSchema, InstantiatedType extends TSchema = TInstantiateImmediate<Context, State, Type>, WithModifiers extends TSchema = Type extends TDeferred ? InstantiatedType : TWithModifiers<Type, InstantiatedType>> = WithModifiers;
178
- export declare function InstantiateType<Context extends TProperties, State extends TState, Type extends TSchema>(context: TProperties, state: TState, type: Type): TInstantiateType<Context, State, Type>;
171
+ type TInstantiateImmediate<Context extends TProperties, State extends TState, Type extends TSchema, InstantiatedType extends TSchema = (Type extends TRef<infer Ref extends string> ? TRefInstantiate<Context, State, Type, Ref> : Type extends TArray<infer Type extends TSchema> ? TArray<TInstantiateType<Context, State, Type>> : Type extends TCall<infer Target extends TSchema, infer Parameters extends TSchema[]> ? TCallInstantiate<Context, State, Target, Parameters> : Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TConstructor<TInstantiateTypes<Context, State, Parameters>, TInstantiateType<Context, State, InstanceType>> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TFunction<TInstantiateTypes<Context, State, Parameters>, TInstantiateType<Context, State, ReturnType>> : Type extends TDependent<infer If extends TSchema, infer Then extends TSchema, infer Else extends TSchema> ? TDependent<TInstantiateType<Context, State, If>, TInstantiateType<Context, State, Then>, TInstantiateType<Context, State, Else>> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TInstantiateTypes<Context, State, Types>> : Type extends TObject<infer Properties extends TProperties> ? TObject<TInstantiateProperties<Context, State, Properties>> : Type extends TRecord<infer Key extends string, infer Type extends TSchema> ? TRecord<Key, TInstantiateType<Context, State, Type>> : Type extends TRest<infer Type extends TSchema> ? TRest<TInstantiateType<Context, State, Type>> : Type extends TTuple<infer Types extends TSchema[]> ? TTuple<TInstantiateElements<Context, State, Types>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TInstantiateTypes<Context, State, Types>> : Type), WithModifiers extends TSchema = TWithModifiers<Type, InstantiatedType>> = WithModifiers;
172
+ export type TInstantiateType<Context extends TProperties, State extends TState, Type extends TSchema, Result extends TSchema = Type extends TDeferred<infer Action extends string, infer Types extends TSchema[]> ? TInstantiateDeferred<Context, State, Action, Types> : TInstantiateImmediate<Context, State, Type>> = Result;
173
+ export declare function InstantiateType<Context extends TProperties, State extends TState, Type extends TSchema>(context: Context, state: State, type: Type): TInstantiateImmediate<Context, State, Type>;
179
174
  /** Instantiates computed schematics using the given context and type. */
180
175
  export type TInstantiate<Context extends TProperties, Type extends TSchema> = (TInstantiateType<Context, TState<[], []>, Type>);
181
176
  /** Instantiates computed schematics using the given context and type. */