typebox 1.1.27 → 1.1.28
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/type/action/awaited.d.mts +2 -2
- package/build/type/action/awaited.mjs +2 -3
- package/build/type/action/capitalize.d.mts +2 -2
- package/build/type/action/capitalize.mjs +2 -3
- package/build/type/action/conditional.d.mts +4 -2
- package/build/type/action/conditional.mjs +2 -2
- package/build/type/action/constructor-parameters.d.mts +2 -2
- package/build/type/action/constructor-parameters.mjs +2 -3
- package/build/type/action/evaluate.d.mts +2 -2
- package/build/type/action/evaluate.mjs +2 -3
- package/build/type/action/exclude.d.mts +2 -2
- package/build/type/action/exclude.mjs +2 -3
- package/build/type/action/extract.d.mts +2 -2
- package/build/type/action/extract.mjs +2 -3
- package/build/type/action/index.d.mts +1 -1
- package/build/type/action/index.mjs +1 -1
- package/build/type/action/indexed.d.mts +2 -2
- package/build/type/action/indexed.mjs +2 -3
- package/build/type/action/instance-type.d.mts +2 -2
- package/build/type/action/instance-type.mjs +2 -3
- package/build/type/action/interface.d.mts +2 -2
- package/build/type/action/interface.mjs +5 -3
- package/build/type/action/keyof.d.mts +2 -2
- package/build/type/action/keyof.mjs +2 -3
- package/build/type/action/lowercase.d.mts +2 -2
- package/build/type/action/lowercase.mjs +2 -3
- package/build/type/action/mapped.d.mts +4 -2
- package/build/type/action/mapped.mjs +2 -2
- package/build/type/action/non-nullable.d.mts +2 -2
- package/build/type/action/non-nullable.mjs +2 -3
- package/build/type/action/omit.d.mts +2 -2
- package/build/type/action/omit.mjs +2 -3
- package/build/type/action/options.d.mts +4 -5
- package/build/type/action/options.mjs +3 -4
- package/build/type/action/parameters.d.mts +2 -2
- package/build/type/action/parameters.mjs +2 -3
- package/build/type/action/partial.d.mts +3 -3
- package/build/type/action/partial.mjs +2 -3
- package/build/type/action/pick.d.mts +2 -2
- package/build/type/action/pick.mjs +2 -3
- package/build/type/action/readonly-object.d.mts +16 -0
- package/build/type/action/readonly-object.mjs +16 -0
- package/build/type/action/required.d.mts +2 -2
- package/build/type/action/required.mjs +2 -3
- package/build/type/action/return-type.d.mts +2 -2
- package/build/type/action/return-type.mjs +2 -3
- package/build/type/action/uncapitalize.d.mts +2 -2
- package/build/type/action/uncapitalize.mjs +2 -3
- package/build/type/action/uppercase.d.mts +2 -2
- package/build/type/action/uppercase.mjs +2 -3
- package/build/type/engine/awaited/instantiate.d.mts +4 -3
- package/build/type/engine/awaited/instantiate.mjs +9 -8
- package/build/type/engine/conditional/instantiate.d.mts +4 -2
- package/build/type/engine/conditional/instantiate.mjs +13 -9
- package/build/type/engine/constructor-parameters/instantiate.d.mts +6 -5
- package/build/type/engine/constructor-parameters/instantiate.mjs +13 -11
- package/build/type/engine/evaluate/instantiate.d.mts +3 -3
- package/build/type/engine/evaluate/instantiate.mjs +5 -10
- package/build/type/engine/exclude/instantiate.d.mts +4 -11
- package/build/type/engine/exclude/instantiate.mjs +7 -28
- package/build/type/engine/exclude/operation.d.mts +11 -0
- package/build/type/engine/exclude/operation.mjs +24 -0
- package/build/type/engine/extract/instantiate.d.mts +4 -11
- package/build/type/engine/extract/instantiate.mjs +7 -28
- package/build/type/engine/extract/operation.d.mts +11 -0
- package/build/type/engine/extract/operation.mjs +24 -0
- package/build/type/engine/index.d.mts +1 -1
- package/build/type/engine/index.mjs +1 -1
- package/build/type/engine/indexed/from-type.d.mts +11 -0
- package/build/type/engine/indexed/from-type.mjs +14 -0
- package/build/type/engine/indexed/instantiate.d.mts +5 -11
- package/build/type/engine/indexed/instantiate.mjs +8 -20
- package/build/type/engine/instance-type/instantiate.d.mts +4 -4
- package/build/type/engine/instance-type/instantiate.mjs +9 -8
- package/build/type/engine/instantiate.d.mts +4 -6
- package/build/type/engine/instantiate.mjs +9 -18
- package/build/type/engine/interface/instantiate.d.mts +6 -4
- package/build/type/engine/interface/instantiate.mjs +12 -8
- package/build/type/engine/intrinsics/instantiate.d.mts +12 -8
- package/build/type/engine/intrinsics/instantiate.mjs +28 -24
- package/build/type/engine/keyof/from-type.d.mts +15 -0
- package/build/type/engine/keyof/from-type.mjs +23 -0
- package/build/type/engine/keyof/instantiate.d.mts +4 -16
- package/build/type/engine/keyof/instantiate.mjs +8 -28
- package/build/type/engine/mapped/instantiate.d.mts +4 -19
- package/build/type/engine/mapped/instantiate.mjs +7 -42
- package/build/type/engine/mapped/mapped-operation.d.mts +22 -0
- package/build/type/engine/mapped/mapped-operation.mjs +42 -0
- package/build/type/engine/non-nullable/instantiate.d.mts +5 -6
- package/build/type/engine/non-nullable/instantiate.mjs +10 -10
- package/build/type/engine/omit/from-type.d.mts +12 -0
- package/build/type/engine/omit/from-type.mjs +18 -0
- package/build/type/engine/omit/instantiate.d.mts +4 -11
- package/build/type/engine/omit/instantiate.mjs +7 -22
- package/build/type/engine/options/instantiate.d.mts +4 -4
- package/build/type/engine/options/instantiate.mjs +8 -7
- package/build/type/engine/parameters/instantiate.d.mts +6 -5
- package/build/type/engine/parameters/instantiate.mjs +13 -11
- package/build/type/engine/partial/instantiate.d.mts +3 -3
- package/build/type/engine/partial/instantiate.mjs +7 -6
- package/build/type/engine/pick/from-type.d.mts +13 -0
- package/build/type/engine/pick/from-type.mjs +20 -0
- package/build/type/engine/pick/instantiate.d.mts +4 -12
- package/build/type/engine/pick/instantiate.mjs +7 -23
- package/build/type/engine/readonly-object/instantiate.d.mts +9 -0
- package/build/type/engine/readonly-object/instantiate.mjs +15 -0
- package/build/type/engine/record/instantiate.d.mts +3 -3
- package/build/type/engine/record/instantiate.mjs +8 -7
- package/build/type/engine/required/instantiate.d.mts +3 -3
- package/build/type/engine/required/instantiate.mjs +7 -6
- package/build/type/engine/return-type/instantiate.d.mts +5 -4
- package/build/type/engine/return-type/instantiate.mjs +12 -9
- package/build/type/engine/template-literal/encode.d.mts +4 -2
- package/build/type/engine/template-literal/encode.mjs +10 -3
- package/build/type/engine/template-literal/instantiate.d.mts +3 -3
- package/build/type/engine/template-literal/instantiate.mjs +7 -6
- package/build/type/script/mapping.d.mts +1 -1
- package/build/type/script/mapping.mjs +1 -1
- package/build/type/types/promise.d.mts +2 -1
- package/build/type/types/promise.mjs +2 -1
- package/build/type/types/record.d.mts +5 -5
- package/build/type/types/record.mjs +11 -6
- package/build/type/types/template-literal.d.mts +5 -3
- package/build/type/types/template-literal.mjs +10 -4
- package/build/typebox.d.mts +3 -3
- package/build/typebox.mjs +2 -2
- package/package.json +1 -1
- package/build/type/action/readonly-type.d.mts +0 -11
- package/build/type/action/readonly-type.mjs +0 -12
- package/build/type/engine/readonly-type/instantiate.d.mts +0 -9
- package/build/type/engine/readonly-type/instantiate.mjs +0 -14
- /package/build/type/engine/{readonly-type → readonly-object}/from-array.d.mts +0 -0
- /package/build/type/engine/{readonly-type → readonly-object}/from-array.mjs +0 -0
- /package/build/type/engine/{readonly-type → readonly-object}/from-cyclic.d.mts +0 -0
- /package/build/type/engine/{readonly-type → readonly-object}/from-cyclic.mjs +0 -0
- /package/build/type/engine/{readonly-type → readonly-object}/from-intersect.d.mts +0 -0
- /package/build/type/engine/{readonly-type → readonly-object}/from-intersect.mjs +0 -0
- /package/build/type/engine/{readonly-type → readonly-object}/from-object.d.mts +0 -0
- /package/build/type/engine/{readonly-type → readonly-object}/from-object.mjs +0 -0
- /package/build/type/engine/{readonly-type → readonly-object}/from-tuple.d.mts +0 -0
- /package/build/type/engine/{readonly-type → readonly-object}/from-tuple.mjs +0 -0
- /package/build/type/engine/{readonly-type → readonly-object}/from-type.d.mts +0 -0
- /package/build/type/engine/{readonly-type → readonly-object}/from-type.mjs +0 -0
- /package/build/type/engine/{readonly-type → readonly-object}/from-union.d.mts +0 -0
- /package/build/type/engine/{readonly-type → readonly-object}/from-union.mjs +0 -0
- /package/build/type/engine/{readonly-type → readonly-object}/index.d.mts +0 -0
- /package/build/type/engine/{readonly-type → readonly-object}/index.mjs +0 -0
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
// deno-lint-ignore-file ban-types
|
|
2
1
|
// deno-fmt-ignore-file
|
|
3
2
|
import { Deferred } from '../types/deferred.mjs';
|
|
4
|
-
import {
|
|
3
|
+
import { PartialAction } from '../engine/partial/instantiate.mjs';
|
|
5
4
|
/** Creates a deferred Partial action. */
|
|
6
5
|
export function PartialDeferred(type, options = {}) {
|
|
7
6
|
return Deferred('Partial', [type], options);
|
|
8
7
|
}
|
|
9
8
|
/** Applies a Partial action to the given type. */
|
|
10
9
|
export function Partial(type, options = {}) {
|
|
11
|
-
return
|
|
10
|
+
return PartialAction(type, options);
|
|
12
11
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type TSchema, type TSchemaOptions } from '../types/schema.mjs';
|
|
2
2
|
import { type TDeferred } from '../types/deferred.mjs';
|
|
3
3
|
import { type TKeysToIndexer } from '../engine/helpers/keys-to-indexer.mjs';
|
|
4
|
-
import { type
|
|
4
|
+
import { type TPickAction } from '../engine/pick/instantiate.mjs';
|
|
5
5
|
/** Creates a deferred Pick action. */
|
|
6
6
|
export type TPickDeferred<Type extends TSchema, Indexer extends TSchema> = (TDeferred<'Pick', [Type, Indexer]>);
|
|
7
7
|
/** Creates a deferred Pick action. */
|
|
8
8
|
export declare function PickDeferred<Type extends TSchema, Indexer extends TSchema>(type: Type, indexer: Indexer, options?: TSchemaOptions): TPickDeferred<Type, Indexer>;
|
|
9
9
|
/** Applies a Pick action using the given types. */
|
|
10
|
-
export type TPick<Type extends TSchema, Indexer extends TSchema> = (
|
|
10
|
+
export type TPick<Type extends TSchema, Indexer extends TSchema> = (TPickAction<Type, Indexer>);
|
|
11
11
|
/** Applies a Pick action using the given types. */
|
|
12
12
|
export declare function Pick<Type extends TSchema, Indexer extends PropertyKey[]>(type: Type, indexer: readonly [...Indexer], options?: TSchemaOptions): TPick<Type, TKeysToIndexer<Indexer>>;
|
|
13
13
|
/** Applies a Pick action using the given types. */
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
// deno-lint-ignore-file ban-types
|
|
2
1
|
// deno-fmt-ignore-file
|
|
3
2
|
import { Guard } from '../../guard/index.mjs';
|
|
4
3
|
import { Deferred } from '../types/deferred.mjs';
|
|
5
4
|
import { KeysToIndexer } from '../engine/helpers/keys-to-indexer.mjs';
|
|
6
|
-
import {
|
|
5
|
+
import { PickAction } from '../engine/pick/instantiate.mjs';
|
|
7
6
|
/** Creates a deferred Pick action. */
|
|
8
7
|
export function PickDeferred(type, indexer, options = {}) {
|
|
9
8
|
return Deferred('Pick', [type, indexer], options);
|
|
@@ -11,5 +10,5 @@ export function PickDeferred(type, indexer, options = {}) {
|
|
|
11
10
|
/** Applies a Pick action using the given types. */
|
|
12
11
|
export function Pick(type, indexer_or_keys, options = {}) {
|
|
13
12
|
const indexer = Guard.IsArray(indexer_or_keys) ? KeysToIndexer(indexer_or_keys) : indexer_or_keys;
|
|
14
|
-
return
|
|
13
|
+
return PickAction(type, indexer, options);
|
|
15
14
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type TSchema, type TSchemaOptions } from '../types/schema.mjs';
|
|
2
|
+
import { type TDeferred } from '../types/deferred.mjs';
|
|
3
|
+
import { type TReadonlyObjectAction } from '../engine/readonly-object/instantiate.mjs';
|
|
4
|
+
/** Creates a deferred ReadonlyType action. */
|
|
5
|
+
export type TReadonlyObjectDeferred<Type extends TSchema> = (TDeferred<'ReadonlyObject', [Type]>);
|
|
6
|
+
/** Creates a deferred ReadonlyType action. */
|
|
7
|
+
export declare function ReadonlyObjectDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TDeferred<"ReadonlyObject", [Type]>;
|
|
8
|
+
/** 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[]`. */
|
|
9
|
+
export type TReadonlyObject<Type extends TSchema> = (TReadonlyObjectAction<Type>);
|
|
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
|
+
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;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// deno-fmt-ignore-file
|
|
2
|
+
import { Deferred } from '../types/deferred.mjs';
|
|
3
|
+
import { ReadonlyObjectAction } from '../engine/readonly-object/instantiate.mjs';
|
|
4
|
+
/** Creates a deferred ReadonlyType action. */
|
|
5
|
+
export function ReadonlyObjectDeferred(type, options = {}) {
|
|
6
|
+
return Deferred('ReadonlyObject', [type], options);
|
|
7
|
+
}
|
|
8
|
+
/** 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[]`. */
|
|
9
|
+
export function ReadonlyObject(type, options = {}) {
|
|
10
|
+
return ReadonlyObjectAction(type, options);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* This type has been renamed to ReadonlyObject.
|
|
14
|
+
* @deprecated
|
|
15
|
+
*/
|
|
16
|
+
export const ReadonlyType = ReadonlyObject;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type TSchema, type TSchemaOptions } from '../types/schema.mjs';
|
|
2
2
|
import { type TDeferred } from '../types/deferred.mjs';
|
|
3
|
-
import { type
|
|
3
|
+
import { type TRequiredAction } from '../engine/required/instantiate.mjs';
|
|
4
4
|
/** Creates a deferred Required action. */
|
|
5
5
|
export type TRequiredDeferred<Type extends TSchema> = (TDeferred<'Required', [Type]>);
|
|
6
6
|
/** Creates a deferred Required action. */
|
|
7
7
|
export declare function RequiredDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TDeferred<"Required", [Type]>;
|
|
8
8
|
/** Applies a Required action to the given type. */
|
|
9
|
-
export type TRequired<Type extends TSchema> = (
|
|
9
|
+
export type TRequired<Type extends TSchema> = (TRequiredAction<Type>);
|
|
10
10
|
/** Applies a Required action to the given type. */
|
|
11
11
|
export declare function Required<Type extends TSchema>(type: Type, options?: TSchemaOptions): TRequired<Type>;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
// deno-lint-ignore-file ban-types
|
|
2
1
|
// deno-fmt-ignore-file
|
|
3
2
|
import { Deferred } from '../types/deferred.mjs';
|
|
4
|
-
import {
|
|
3
|
+
import { RequiredAction } from '../engine/required/instantiate.mjs';
|
|
5
4
|
/** Creates a deferred Required action. */
|
|
6
5
|
export function RequiredDeferred(type, options = {}) {
|
|
7
6
|
return Deferred('Required', [type], options);
|
|
8
7
|
}
|
|
9
8
|
/** Applies a Required action to the given type. */
|
|
10
9
|
export function Required(type, options = {}) {
|
|
11
|
-
return
|
|
10
|
+
return RequiredAction(type, options);
|
|
12
11
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type TSchema, type TSchemaOptions } from '../types/schema.mjs';
|
|
2
2
|
import { type TDeferred } from '../types/deferred.mjs';
|
|
3
|
-
import { type
|
|
3
|
+
import { type TReturnTypeAction } from '../engine/return-type/instantiate.mjs';
|
|
4
4
|
/** Creates a deferred ReturnType action. */
|
|
5
5
|
export type TReturnTypeDeferred<Type extends TSchema> = (TDeferred<'ReturnType', [Type]>);
|
|
6
6
|
/** Creates a deferred ReturnType action. */
|
|
7
7
|
export declare function ReturnTypeDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TReturnTypeDeferred<Type>;
|
|
8
8
|
/** Applies a ReturnType action to the given type. */
|
|
9
|
-
export type TReturnType<Type extends TSchema> = (
|
|
9
|
+
export type TReturnType<Type extends TSchema> = (TReturnTypeAction<Type>);
|
|
10
10
|
/** Applies a ReturnType action to the given type. */
|
|
11
11
|
export declare function ReturnType<Type extends TSchema>(type: Type, options?: TSchemaOptions): TReturnType<Type>;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
// deno-lint-ignore-file ban-types
|
|
2
1
|
// deno-fmt-ignore-file
|
|
3
2
|
import { Deferred } from '../types/deferred.mjs';
|
|
4
|
-
import {
|
|
3
|
+
import { ReturnTypeAction } from '../engine/return-type/instantiate.mjs';
|
|
5
4
|
/** Creates a deferred ReturnType action. */
|
|
6
5
|
export function ReturnTypeDeferred(type, options = {}) {
|
|
7
6
|
return Deferred('ReturnType', [type], options);
|
|
8
7
|
}
|
|
9
8
|
/** Applies a ReturnType action to the given type. */
|
|
10
9
|
export function ReturnType(type, options = {}) {
|
|
11
|
-
return
|
|
10
|
+
return ReturnTypeAction(type, options);
|
|
12
11
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type TSchema, type TSchemaOptions } from '../types/schema.mjs';
|
|
2
2
|
import { type TDeferred } from '../types/deferred.mjs';
|
|
3
|
-
import { type
|
|
3
|
+
import { type TUncapitalizeAction } from '../engine/intrinsics/instantiate.mjs';
|
|
4
4
|
/** Creates a deferred Uncapitalize action. */
|
|
5
5
|
export type TUncapitalizeDeferred<Type extends TSchema> = (TDeferred<'Uncapitalize', [Type]>);
|
|
6
6
|
/** Creates a deferred Uncapitalize action. */
|
|
7
7
|
export declare function UncapitalizeDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TUncapitalizeDeferred<Type>;
|
|
8
8
|
/** Applies a Uncapitalize action to the given type. */
|
|
9
|
-
export type TUncapitalize<Type extends TSchema> = (
|
|
9
|
+
export type TUncapitalize<Type extends TSchema> = (TUncapitalizeAction<Type>);
|
|
10
10
|
/** Applies a Uncapitalize action to the given type. */
|
|
11
11
|
export declare function Uncapitalize<Type extends TSchema>(type: Type, options?: TSchemaOptions): TUncapitalize<Type>;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
// deno-lint-ignore-file ban-types
|
|
2
1
|
// deno-fmt-ignore-file
|
|
3
2
|
import { Deferred } from '../types/deferred.mjs';
|
|
4
|
-
import {
|
|
3
|
+
import { UncapitalizeAction } from '../engine/intrinsics/instantiate.mjs';
|
|
5
4
|
/** Creates a deferred Uncapitalize action. */
|
|
6
5
|
export function UncapitalizeDeferred(type, options = {}) {
|
|
7
6
|
return Deferred('Uncapitalize', [type], options);
|
|
8
7
|
}
|
|
9
8
|
/** Applies a Uncapitalize action to the given type. */
|
|
10
9
|
export function Uncapitalize(type, options = {}) {
|
|
11
|
-
return
|
|
10
|
+
return UncapitalizeAction(type, options);
|
|
12
11
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type TSchema, type TSchemaOptions } from '../types/schema.mjs';
|
|
2
2
|
import { type TDeferred } from '../types/deferred.mjs';
|
|
3
|
-
import { type
|
|
3
|
+
import { type TUppercaseAction } from '../engine/intrinsics/instantiate.mjs';
|
|
4
4
|
/** Creates a deferred Uppercase action. */
|
|
5
5
|
export type TUppercaseDeferred<Type extends TSchema> = (TDeferred<'Uppercase', [Type]>);
|
|
6
6
|
/** Creates a deferred Uppercase action. */
|
|
7
7
|
export declare function UppercaseDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TUppercaseDeferred<Type>;
|
|
8
8
|
/** Applies a Uppercase action to the given type. */
|
|
9
|
-
export type TUppercase<Type extends TSchema> = (
|
|
9
|
+
export type TUppercase<Type extends TSchema> = (TUppercaseAction<Type>);
|
|
10
10
|
/** Applies a Uppercase action to the given type. */
|
|
11
11
|
export declare function Uppercase<Type extends TSchema>(type: Type, options?: TSchemaOptions): TUppercase<Type>;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
// deno-lint-ignore-file ban-types
|
|
2
1
|
// deno-fmt-ignore-file
|
|
3
2
|
import { Deferred } from '../types/deferred.mjs';
|
|
4
|
-
import {
|
|
3
|
+
import { UppercaseAction } from '../engine/intrinsics/instantiate.mjs';
|
|
5
4
|
/** Creates a deferred Uppercase action. */
|
|
6
5
|
export function UppercaseDeferred(type, options = {}) {
|
|
7
6
|
return Deferred('Uppercase', [type], options);
|
|
8
7
|
}
|
|
9
8
|
/** Applies a Uppercase action to the given type. */
|
|
10
9
|
export function Uppercase(type, options = {}) {
|
|
11
|
-
return
|
|
10
|
+
return UppercaseAction(type, options);
|
|
12
11
|
}
|
|
@@ -3,8 +3,9 @@ import { type TProperties } from '../../types/properties.mjs';
|
|
|
3
3
|
import { type TPromise } from '../../types/promise.mjs';
|
|
4
4
|
import { type TAwaitedDeferred } from '../../action/awaited.mjs';
|
|
5
5
|
import { type TState, type TInstantiateType, type TCanInstantiate } from '../instantiate.mjs';
|
|
6
|
-
type
|
|
7
|
-
type
|
|
8
|
-
export
|
|
6
|
+
type TAwaitedOperation<Type extends TSchema> = (Type extends TPromise<infer Type extends TSchema> ? TAwaitedOperation<Type> : Type);
|
|
7
|
+
export type TAwaitedAction<Type extends TSchema, Result extends TSchema = TCanInstantiate<[Type]> extends true ? TAwaitedOperation<Type> : TAwaitedDeferred<Type>> = Result;
|
|
8
|
+
export declare function AwaitedAction<Type extends TSchema>(type: Type, options: TSchemaOptions): TAwaitedAction<Type>;
|
|
9
|
+
export type TAwaitedInstantiate<Context extends TProperties, State extends TState, Type extends TSchema, InstantiateType extends TSchema = TInstantiateType<Context, State, Type>> = TAwaitedAction<InstantiateType>;
|
|
9
10
|
export declare function AwaitedInstantiate<Context extends TProperties, State extends TState, Type extends TSchema>(context: Context, state: State, type: Type, options: TSchemaOptions): TAwaitedInstantiate<Context, State, Type>;
|
|
10
11
|
export {};
|
|
@@ -3,17 +3,18 @@ import { Memory } from '../../../system/memory/index.mjs';
|
|
|
3
3
|
import { IsPromise } from '../../types/promise.mjs';
|
|
4
4
|
import { AwaitedDeferred } from '../../action/awaited.mjs';
|
|
5
5
|
import { InstantiateType, CanInstantiate } from '../instantiate.mjs';
|
|
6
|
-
function
|
|
6
|
+
function AwaitedOperation(type) {
|
|
7
7
|
return (IsPromise(type)
|
|
8
|
-
?
|
|
8
|
+
? AwaitedOperation(type.item)
|
|
9
9
|
: type);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
const
|
|
13
|
-
|
|
11
|
+
export function AwaitedAction(type, options) {
|
|
12
|
+
const result = CanInstantiate([type])
|
|
13
|
+
? Memory.Update(AwaitedOperation(type), {}, options)
|
|
14
|
+
: AwaitedDeferred(type, options);
|
|
15
|
+
return result;
|
|
14
16
|
}
|
|
15
17
|
export function AwaitedInstantiate(context, state, type, options) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
: AwaitedDeferred(type, options));
|
|
18
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
19
|
+
return AwaitedAction(instantiatedType, options);
|
|
19
20
|
}
|
|
@@ -4,7 +4,9 @@ import { type TProperties } from '../../types/properties.mjs';
|
|
|
4
4
|
import { type TExtends, ExtendsResult } from '../../extends/index.mjs';
|
|
5
5
|
import { type TState, type TInstantiateType, type TCanInstantiate } from '../instantiate.mjs';
|
|
6
6
|
import { type TConditionalDeferred } from '../../action/conditional.mjs';
|
|
7
|
-
type
|
|
8
|
-
export type
|
|
7
|
+
type TConditionalOperation<Context extends TProperties, State extends TState, Left extends TSchema, Right extends TSchema, True extends TSchema, False extends TSchema, ExtendsResult extends ExtendsResult.TResult = TExtends<Context, Left, Right>> = (ExtendsResult extends ExtendsResult.TExtendsUnion<infer InferredContext extends TProperties> ? TUnion<[TInstantiateType<InferredContext, State, True>, TInstantiateType<Context, State, False>]> : ExtendsResult extends ExtendsResult.TExtendsTrue<infer InferredContext extends TProperties> ? TInstantiateType<InferredContext, State, True> : TInstantiateType<Context, State, False>);
|
|
8
|
+
export type TConditionalAction<Context extends TProperties, State extends TState, Left extends TSchema, Right extends TSchema, True extends TSchema, False extends TSchema, Result extends TSchema = TCanInstantiate<[Left, Right]> extends true ? TConditionalOperation<Context, State, Left, Right, True, False> : TConditionalDeferred<Left, Right, True, False>> = Result;
|
|
9
|
+
export declare function ConditionalAction<Context extends TProperties, State extends TState, Left extends TSchema, Right extends TSchema, True extends TSchema, False extends TSchema>(context: Context, state: State, left: Left, right: Right, true_: True, false_: False, options: TSchemaOptions): TConditionalAction<Context, State, Left, Right, True, False>;
|
|
10
|
+
export type TConditionalInstantiate<Context extends TProperties, State extends TState, Left extends TSchema, Right extends TSchema, True extends TSchema, False extends TSchema, InstaniatedLeft extends TSchema = TInstantiateType<Context, State, Left>, InstaniatedRight extends TSchema = TInstantiateType<Context, State, Right>> = TConditionalAction<Context, State, InstaniatedLeft, InstaniatedRight, True, False>;
|
|
9
11
|
export declare function ConditionalInstantiate<Context extends TProperties, State extends TState, Left extends TSchema, Right extends TSchema, True extends TSchema, False extends TSchema>(context: Context, state: State, left: Left, right: Right, true_: True, false_: False, options: TSchemaOptions): TConditionalInstantiate<Context, State, Left, Right, True, False>;
|
|
10
12
|
export {};
|
|
@@ -4,16 +4,20 @@ import { Union } from '../../types/union.mjs';
|
|
|
4
4
|
import { Extends, ExtendsResult } from '../../extends/index.mjs';
|
|
5
5
|
import { InstantiateType, CanInstantiate } from '../instantiate.mjs';
|
|
6
6
|
import { ConditionalDeferred } from '../../action/conditional.mjs';
|
|
7
|
-
function
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const extendsResult = Extends(context, instantiatedLeft, instantiatedRight);
|
|
11
|
-
return Memory.Update((ExtendsResult.IsExtendsUnion(extendsResult) ? Union([InstantiateType(extendsResult.inferred, state, true_), InstantiateType(context, state, false_)]) :
|
|
7
|
+
function ConditionalOperation(context, state, left, right, true_, false_) {
|
|
8
|
+
const extendsResult = Extends(context, left, right);
|
|
9
|
+
return (ExtendsResult.IsExtendsUnion(extendsResult) ? Union([InstantiateType(extendsResult.inferred, state, true_), InstantiateType(context, state, false_)]) :
|
|
12
10
|
ExtendsResult.IsExtendsTrue(extendsResult) ? InstantiateType(extendsResult.inferred, state, true_) :
|
|
13
|
-
InstantiateType(context, state, false_))
|
|
11
|
+
InstantiateType(context, state, false_));
|
|
12
|
+
}
|
|
13
|
+
export function ConditionalAction(context, state, left, right, true_, false_, options) {
|
|
14
|
+
const result = CanInstantiate([left, right])
|
|
15
|
+
? Memory.Update(ConditionalOperation(context, state, left, right, true_, false_), {}, options)
|
|
16
|
+
: ConditionalDeferred(left, right, true_, false_, options);
|
|
17
|
+
return result;
|
|
14
18
|
}
|
|
15
19
|
export function ConditionalInstantiate(context, state, left, right, true_, false_, options) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
const instantiatedLeft = InstantiateType(context, state, left);
|
|
21
|
+
const instantiatedRight = InstantiateType(context, state, right);
|
|
22
|
+
return ConditionalAction(context, state, instantiatedLeft, instantiatedRight, true_, false_, options);
|
|
19
23
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { type TSchema, type TSchemaOptions } from '../../types/schema.mjs';
|
|
2
2
|
import { type TProperties } from '../../types/properties.mjs';
|
|
3
3
|
import { type TConstructor } from '../../types/constructor.mjs';
|
|
4
|
-
import { type TNever } from '../../types/never.mjs';
|
|
5
4
|
import { type TTuple } from '../../types/tuple.mjs';
|
|
6
5
|
import { type TConstructorParametersDeferred } from '../../action/constructor-parameters.mjs';
|
|
7
6
|
import { type TState, type TInstantiateType, type TCanInstantiate } from '../instantiate.mjs';
|
|
8
|
-
|
|
7
|
+
import { type TInstantiateElements } from '../instantiate.mjs';
|
|
8
|
+
type TConstructorParametersOperation<Type extends TSchema, Parameters extends TSchema[] = Type extends TConstructor ? Type['parameters'] : [], InstantiatedParameters extends TSchema[] = TInstantiateElements<{}, {
|
|
9
9
|
callstack: [];
|
|
10
|
-
}, TTuple<
|
|
11
|
-
type
|
|
12
|
-
export
|
|
10
|
+
}, Parameters>, Result extends TSchema = TTuple<InstantiatedParameters>> = Result;
|
|
11
|
+
export type TConstructorParametersAction<Type extends TSchema, Result extends TSchema = TCanInstantiate<[Type]> extends true ? TConstructorParametersOperation<Type> : TConstructorParametersDeferred<Type>> = Result;
|
|
12
|
+
export declare function ConstructorParametersAction<Type extends TSchema>(type: Type, options: TSchemaOptions): TConstructorParametersAction<Type>;
|
|
13
|
+
export type TConstructorParametersInstantiate<Context extends TProperties, State extends TState, Type extends TSchema, InstantiatedType extends TSchema = TInstantiateType<Context, State, Type>> = TConstructorParametersAction<InstantiatedType>;
|
|
13
14
|
export declare function ConstructorParametersInstantiate<Context extends TProperties, State extends TState, Type extends TSchema>(context: Context, state: State, type: Type, options: TSchemaOptions): TConstructorParametersInstantiate<Context, State, Type>;
|
|
14
15
|
export {};
|
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
// deno-fmt-ignore-file
|
|
3
3
|
import { Memory } from '../../../system/memory/index.mjs';
|
|
4
4
|
import { IsConstructor } from '../../types/constructor.mjs';
|
|
5
|
-
import { Never } from '../../types/never.mjs';
|
|
6
5
|
import { Tuple } from '../../types/tuple.mjs';
|
|
7
6
|
import { ConstructorParametersDeferred } from '../../action/constructor-parameters.mjs';
|
|
8
7
|
import { InstantiateType, CanInstantiate } from '../instantiate.mjs';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
import { InstantiateElements } from '../instantiate.mjs';
|
|
9
|
+
function ConstructorParametersOperation(type) {
|
|
10
|
+
const parameters = IsConstructor(type) ? type['parameters'] : [];
|
|
11
|
+
const instantiatedParameters = InstantiateElements({}, { callstack: [] }, parameters);
|
|
12
|
+
const result = Tuple(instantiatedParameters);
|
|
13
|
+
return result;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
const
|
|
16
|
-
|
|
15
|
+
export function ConstructorParametersAction(type, options) {
|
|
16
|
+
const result = CanInstantiate([type])
|
|
17
|
+
? Memory.Update(ConstructorParametersOperation(type), {}, options)
|
|
18
|
+
: ConstructorParametersDeferred(type, options);
|
|
19
|
+
return result;
|
|
17
20
|
}
|
|
18
21
|
export function ConstructorParametersInstantiate(context, state, type, options) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
: ConstructorParametersDeferred(type, options));
|
|
22
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
23
|
+
return ConstructorParametersAction(instantiatedType, options);
|
|
22
24
|
}
|
|
@@ -2,7 +2,7 @@ import { type TSchema, type TSchemaOptions } from '../../types/schema.mjs';
|
|
|
2
2
|
import { type TProperties } from '../../types/properties.mjs';
|
|
3
3
|
import { type TState, type TInstantiateType } from '../instantiate.mjs';
|
|
4
4
|
import { type TEvaluateType } from './evaluate.mjs';
|
|
5
|
-
type
|
|
6
|
-
export
|
|
5
|
+
export type TEvaluateAction<Type extends TSchema, Result extends TSchema = TEvaluateType<Type>> = Result;
|
|
6
|
+
export declare function EvaluateAction<Type extends TSchema>(type: Type, options: TSchemaOptions): TEvaluateAction<Type>;
|
|
7
|
+
export type TEvaluateInstantiate<Context extends TProperties, State extends TState, Type extends TSchema, InstantiatedType extends TSchema = TInstantiateType<Context, State, Type>> = TEvaluateAction<InstantiatedType>;
|
|
7
8
|
export declare function EvaluateInstantiate<Context extends TProperties, State extends TState, Type extends TSchema>(context: Context, state: State, type: Type, options: TSchemaOptions): TEvaluateInstantiate<Context, State, Type>;
|
|
8
|
-
export {};
|
|
@@ -2,16 +2,11 @@
|
|
|
2
2
|
import { Memory } from '../../../system/memory/index.mjs';
|
|
3
3
|
import { InstantiateType } from '../instantiate.mjs';
|
|
4
4
|
import { EvaluateType } from './evaluate.mjs';
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
return
|
|
5
|
+
export function EvaluateAction(type, options) {
|
|
6
|
+
const result = Memory.Update(EvaluateType(type), {}, options);
|
|
7
|
+
return result;
|
|
8
8
|
}
|
|
9
9
|
export function EvaluateInstantiate(context, state, type, options) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
//
|
|
13
|
-
// Evaluate instantiation should never defer on instantiate as the caller is specifically
|
|
14
|
-
// requesting that the type be evaluated in whatever context is available. However, actions
|
|
15
|
-
// embedded in the Evaluate call may defer local to themselves.
|
|
16
|
-
EvaluateImmediate(context, state, type, options));
|
|
10
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
11
|
+
return EvaluateAction(instantiatedType, options);
|
|
17
12
|
}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { type TSchema, type TSchemaOptions } from '../../types/schema.mjs';
|
|
2
2
|
import { type TProperties } from '../../types/properties.mjs';
|
|
3
|
-
import { type TEnum, type TEnumValue } from '../../types/enum.mjs';
|
|
4
|
-
import { type TUnion } from '../../types/union.mjs';
|
|
5
|
-
import { type TExtends, ExtendsResult } from '../../extends/index.mjs';
|
|
6
|
-
import { type TEnumValuesToVariants } from '../enum/index.mjs';
|
|
7
|
-
import { type TEvaluateUnion, type TFlatten } from '../evaluate/index.mjs';
|
|
8
3
|
import { type TState, type TInstantiateType, type TCanInstantiate } from '../instantiate.mjs';
|
|
9
4
|
import { type TExcludeDeferred } from '../../action/exclude.mjs';
|
|
10
|
-
|
|
11
|
-
type
|
|
12
|
-
|
|
13
|
-
type
|
|
14
|
-
export type TExcludeInstantiate<Context extends TProperties, State extends TState, Left extends TSchema, Right extends TSchema> = TCanInstantiate<Context, [Left, Right]> extends true ? TExcludeImmediate<Context, State, Left, Right> : TExcludeDeferred<Left, Right>;
|
|
5
|
+
import { type TExcludeOperation } from './operation.mjs';
|
|
6
|
+
export type TExcludeAction<Left extends TSchema, Right extends TSchema, Result extends TSchema = TCanInstantiate<[Left, Right]> extends true ? TExcludeOperation<Left, Right> : TExcludeDeferred<Left, Right>> = Result;
|
|
7
|
+
export declare function ExcludeAction<Left extends TSchema, Right extends TSchema>(left: Left, right: Right, options: TSchemaOptions): TExcludeAction<Left, Right>;
|
|
8
|
+
export type TExcludeInstantiate<Context extends TProperties, State extends TState, Left extends TSchema, Right extends TSchema, InstantiatedLeft extends TSchema = TInstantiateType<Context, State, Left>, InstantiatedRight extends TSchema = TInstantiateType<Context, State, Right>> = TExcludeAction<InstantiatedLeft, InstantiatedRight>;
|
|
15
9
|
export declare function ExcludeInstantiate<Context extends TProperties, State extends TState, Left extends TSchema, Right extends TSchema>(context: Context, state: State, left: Left, right: Right, options: TSchemaOptions): TExcludeInstantiate<Context, State, Left, Right>;
|
|
16
|
-
export {};
|
|
@@ -1,37 +1,16 @@
|
|
|
1
|
-
// deno-lint-ignore-file ban-types
|
|
2
1
|
// deno-fmt-ignore-file
|
|
3
2
|
import { Memory } from '../../../system/memory/index.mjs';
|
|
4
|
-
import { IsEnum } from '../../types/enum.mjs';
|
|
5
|
-
import { IsUnion } from '../../types/union.mjs';
|
|
6
|
-
import { Extends, ExtendsResult } from '../../extends/index.mjs';
|
|
7
|
-
import { EnumValuesToVariants } from '../enum/index.mjs';
|
|
8
|
-
import { EvaluateUnion, Flatten } from '../evaluate/index.mjs';
|
|
9
3
|
import { InstantiateType, CanInstantiate } from '../instantiate.mjs';
|
|
10
4
|
import { ExcludeDeferred } from '../../action/exclude.mjs';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function ExcludeType(left, right) {
|
|
17
|
-
const check = Extends({}, left, right);
|
|
18
|
-
const result = ExtendsResult.IsExtendsTrueLike(check) ? [] : [left];
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
function ExcludeAction(left, right) {
|
|
22
|
-
const remaining = (IsEnum(left) ? ExcludeUnion(EnumValuesToVariants(left.enum), right) :
|
|
23
|
-
IsUnion(left) ? ExcludeUnion(Flatten(left.anyOf), right) :
|
|
24
|
-
ExcludeType(left, right));
|
|
25
|
-
const result = EvaluateUnion(remaining);
|
|
5
|
+
import { ExcludeOperation } from './operation.mjs';
|
|
6
|
+
export function ExcludeAction(left, right, options) {
|
|
7
|
+
const result = CanInstantiate([left, right])
|
|
8
|
+
? Memory.Update(ExcludeOperation(left, right), {}, options)
|
|
9
|
+
: ExcludeDeferred(left, right, options);
|
|
26
10
|
return result;
|
|
27
11
|
}
|
|
28
|
-
function
|
|
12
|
+
export function ExcludeInstantiate(context, state, left, right, options) {
|
|
29
13
|
const instantiatedLeft = InstantiateType(context, state, left);
|
|
30
14
|
const instantiatedRight = InstantiateType(context, state, right);
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
export function ExcludeInstantiate(context, state, left, right, options) {
|
|
34
|
-
return (CanInstantiate(context, [left, right])
|
|
35
|
-
? ExcludeImmediate(context, state, left, right, options)
|
|
36
|
-
: ExcludeDeferred(left, right, options));
|
|
15
|
+
return ExcludeAction(instantiatedLeft, instantiatedRight, options);
|
|
37
16
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type TSchema } from '../../types/schema.mjs';
|
|
2
|
+
import { type TEnum, type TEnumValue } from '../../types/enum.mjs';
|
|
3
|
+
import { type TUnion } from '../../types/union.mjs';
|
|
4
|
+
import { type TExtends, ExtendsResult } from '../../extends/index.mjs';
|
|
5
|
+
import { type TEnumValuesToVariants } from '../enum/index.mjs';
|
|
6
|
+
import { type TEvaluateUnion, type TFlatten } from '../evaluate/index.mjs';
|
|
7
|
+
type TExcludeUnionLeft<Types extends TSchema[], Right extends TSchema, Result extends TSchema[] = []> = (Types extends [infer Head extends TSchema, ...infer Tail extends TSchema[]] ? TExcludeUnionLeft<Tail, Right, [...Result, ...TExcludeTypeLeft<Head, Right>]> : Result);
|
|
8
|
+
type TExcludeTypeLeft<Left extends TSchema, Right extends TSchema, Check extends ExtendsResult.TResult = TExtends<{}, Left, Right>, Result extends TSchema[] = Check extends ExtendsResult.TExtendsTrueLike<infer _> ? [] : [Left]> = Result;
|
|
9
|
+
export type TExcludeOperation<Left extends TSchema, Right extends TSchema, Remaining extends TSchema[] = (Left extends TEnum<infer Values extends TEnumValue[]> ? TExcludeUnionLeft<TEnumValuesToVariants<Values>, Right> : Left extends TUnion<infer Types extends TSchema[]> ? TExcludeUnionLeft<TFlatten<Types>, Right> : TExcludeTypeLeft<Left, Right>), Result extends TSchema = TEvaluateUnion<Remaining>> = Result;
|
|
10
|
+
export declare function ExcludeOperation<Left extends TSchema, Right extends TSchema>(left: Left, right: Right): TExcludeOperation<Left, Right>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// deno-lint-ignore-file ban-types
|
|
2
|
+
// deno-fmt-ignore-file
|
|
3
|
+
import { IsEnum } from '../../types/enum.mjs';
|
|
4
|
+
import { IsUnion } from '../../types/union.mjs';
|
|
5
|
+
import { Extends, ExtendsResult } from '../../extends/index.mjs';
|
|
6
|
+
import { EnumValuesToVariants } from '../enum/index.mjs';
|
|
7
|
+
import { EvaluateUnion, Flatten } from '../evaluate/index.mjs';
|
|
8
|
+
function ExcludeUnionLeft(types, right) {
|
|
9
|
+
return types.reduce((result, head) => {
|
|
10
|
+
return [...result, ...ExcludeTypeLeft(head, right)];
|
|
11
|
+
}, []);
|
|
12
|
+
}
|
|
13
|
+
function ExcludeTypeLeft(left, right) {
|
|
14
|
+
const check = Extends({}, left, right);
|
|
15
|
+
const result = ExtendsResult.IsExtendsTrueLike(check) ? [] : [left];
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
export function ExcludeOperation(left, right) {
|
|
19
|
+
const remaining = (IsEnum(left) ? ExcludeUnionLeft(EnumValuesToVariants(left.enum), right) :
|
|
20
|
+
IsUnion(left) ? ExcludeUnionLeft(Flatten(left.anyOf), right) :
|
|
21
|
+
ExcludeTypeLeft(left, right));
|
|
22
|
+
const result = EvaluateUnion(remaining);
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { type TSchema, type TSchemaOptions } from '../../types/schema.mjs';
|
|
2
2
|
import { type TProperties } from '../../types/properties.mjs';
|
|
3
|
-
import { type TEnum, type TEnumValue } from '../../types/enum.mjs';
|
|
4
|
-
import { type TUnion } from '../../types/union.mjs';
|
|
5
|
-
import { type TExtends, ExtendsResult } from '../../extends/index.mjs';
|
|
6
|
-
import { type TEnumValuesToVariants } from '../enum/index.mjs';
|
|
7
|
-
import { type TEvaluateUnion, type TFlatten } from '../evaluate/index.mjs';
|
|
8
3
|
import { type TState, type TInstantiateType, type TCanInstantiate } from '../instantiate.mjs';
|
|
9
4
|
import { type TExtractDeferred } from '../../action/extract.mjs';
|
|
10
|
-
|
|
11
|
-
type
|
|
12
|
-
|
|
13
|
-
type
|
|
14
|
-
export type TExtractInstantiate<Context extends TProperties, State extends TState, Left extends TSchema, Right extends TSchema> = TCanInstantiate<Context, [Left, Right]> extends true ? TExtractImmediate<Context, State, Left, Right> : TExtractDeferred<Left, Right>;
|
|
5
|
+
import { type TExtractOperation } from './operation.mjs';
|
|
6
|
+
export type TExtractAction<Left extends TSchema, Right extends TSchema, Result extends TSchema = TCanInstantiate<[Left, Right]> extends true ? TExtractOperation<Left, Right> : TExtractDeferred<Left, Right>> = Result;
|
|
7
|
+
export declare function ExtractAction<Left extends TSchema, Right extends TSchema>(left: Left, right: Right, options: TSchemaOptions): TExtractAction<Left, Right>;
|
|
8
|
+
export type TExtractInstantiate<Context extends TProperties, State extends TState, Left extends TSchema, Right extends TSchema, InstantiatedLeft extends TSchema = TInstantiateType<Context, State, Left>, InstantiatedRight extends TSchema = TInstantiateType<Context, State, Right>> = TExtractAction<InstantiatedLeft, InstantiatedRight>;
|
|
15
9
|
export declare function ExtractInstantiate<Context extends TProperties, State extends TState, Left extends TSchema, Right extends TSchema>(context: Context, state: State, left: Left, right: Right, options: TSchemaOptions): TExtractInstantiate<Context, State, Left, Right>;
|
|
16
|
-
export {};
|
|
@@ -1,37 +1,16 @@
|
|
|
1
|
-
// deno-lint-ignore-file ban-types
|
|
2
1
|
// deno-fmt-ignore-file
|
|
3
2
|
import { Memory } from '../../../system/memory/index.mjs';
|
|
4
|
-
import { IsEnum } from '../../types/enum.mjs';
|
|
5
|
-
import { IsUnion } from '../../types/union.mjs';
|
|
6
|
-
import { Extends, ExtendsResult } from '../../extends/index.mjs';
|
|
7
|
-
import { EnumValuesToVariants } from '../enum/index.mjs';
|
|
8
|
-
import { EvaluateUnion, Flatten } from '../evaluate/index.mjs';
|
|
9
3
|
import { InstantiateType, CanInstantiate } from '../instantiate.mjs';
|
|
10
4
|
import { ExtractDeferred } from '../../action/extract.mjs';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function ExtractType(left, right) {
|
|
17
|
-
const check = Extends({}, left, right);
|
|
18
|
-
const result = ExtendsResult.IsExtendsTrueLike(check) ? [left] : [];
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
function ExtractAction(left, right) {
|
|
22
|
-
const remaining = (IsEnum(left) ? ExtractUnion(EnumValuesToVariants(left.enum), right) :
|
|
23
|
-
IsUnion(left) ? ExtractUnion(Flatten(left.anyOf), right) :
|
|
24
|
-
ExtractType(left, right));
|
|
25
|
-
const result = EvaluateUnion(remaining);
|
|
5
|
+
import { ExtractOperation } from './operation.mjs';
|
|
6
|
+
export function ExtractAction(left, right, options) {
|
|
7
|
+
const result = CanInstantiate([left, right])
|
|
8
|
+
? Memory.Update(ExtractOperation(left, right), {}, options)
|
|
9
|
+
: ExtractDeferred(left, right, options);
|
|
26
10
|
return result;
|
|
27
11
|
}
|
|
28
|
-
function
|
|
12
|
+
export function ExtractInstantiate(context, state, left, right, options) {
|
|
29
13
|
const instantiatedLeft = InstantiateType(context, state, left);
|
|
30
14
|
const instantiatedRight = InstantiateType(context, state, right);
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
export function ExtractInstantiate(context, state, left, right, options) {
|
|
34
|
-
return (CanInstantiate(context, [left, right])
|
|
35
|
-
? ExtractImmediate(context, state, left, right, options)
|
|
36
|
-
: ExtractDeferred(left, right, options));
|
|
15
|
+
return ExtractAction(instantiatedLeft, instantiatedRight, options);
|
|
37
16
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type TSchema } from '../../types/schema.mjs';
|
|
2
|
+
import { type TEnum, type TEnumValue } from '../../types/enum.mjs';
|
|
3
|
+
import { type TUnion } from '../../types/union.mjs';
|
|
4
|
+
import { type TExtends, ExtendsResult } from '../../extends/index.mjs';
|
|
5
|
+
import { type TEnumValuesToVariants } from '../enum/index.mjs';
|
|
6
|
+
import { type TEvaluateUnion, type TFlatten } from '../evaluate/index.mjs';
|
|
7
|
+
type TExtractUnionLeft<Types extends TSchema[], Right extends TSchema, Result extends TSchema[] = []> = (Types extends [infer Head extends TSchema, ...infer Tail extends TSchema[]] ? TExtractUnionLeft<Tail, Right, [...Result, ...TExtractTypeLeft<Head, Right>]> : Result);
|
|
8
|
+
type TExtractTypeLeft<Left extends TSchema, Right extends TSchema, Check extends ExtendsResult.TResult = TExtends<{}, Left, Right>, Result extends TSchema[] = Check extends ExtendsResult.TExtendsTrueLike<infer _> ? [Left] : []> = Result;
|
|
9
|
+
export type TExtractOperation<Left extends TSchema, Right extends TSchema, Remaining extends TSchema[] = (Left extends TEnum<infer Values extends TEnumValue[]> ? TExtractUnionLeft<TEnumValuesToVariants<Values>, Right> : Left extends TUnion<infer Types extends TSchema[]> ? TExtractUnionLeft<TFlatten<Types>, Right> : TExtractTypeLeft<Left, Right>), Result extends TSchema = TEvaluateUnion<Remaining>> = Result;
|
|
10
|
+
export declare function ExtractOperation<Left extends TSchema, Right extends TSchema>(left: Left, right: Right): TExtractOperation<Left, Right>;
|
|
11
|
+
export {};
|