| import { type TSchema, type TSchemaOptions } from '../types/schema.mjs'; | ||
| import { type TDeferred } from '../types/deferred.mjs'; | ||
| import { type TAddImmutableAction } from '../engine/immutable/instantiate_add.mjs'; | ||
| /** Creates a deferred AddImmutable action. */ | ||
| export type TAddImmutableDeferred<Type extends TSchema> = (TDeferred<'AddImmutable', [Type]>); | ||
| /** Creates a deferred AddImmutable action. */ | ||
| export declare function AddImmutableDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TAddImmutableDeferred<Type>; | ||
| /** Applies an AddImmutable action to a type. */ | ||
| export type TAddImmutable<Type extends TSchema> = (TAddImmutableAction<Type>); | ||
| /** Applies an AddImmutable action to a type. */ | ||
| export declare function AddImmutable<Type extends TSchema>(type: Type, options?: TSchemaOptions): TAddImmutable<Type>; |
| // deno-fmt-ignore-file | ||
| import { Deferred } from '../types/deferred.mjs'; | ||
| import { AddImmutableAction } from '../engine/immutable/instantiate_add.mjs'; | ||
| /** Creates a deferred AddImmutable action. */ | ||
| export function AddImmutableDeferred(type, options = {}) { | ||
| return Deferred('AddImmutable', [type], options); | ||
| } | ||
| /** Applies an AddImmutable action to a type. */ | ||
| export function AddImmutable(type, options = {}) { | ||
| return AddImmutableAction(type, options); | ||
| } |
| import { type TSchema, type TSchemaOptions } from '../types/schema.mjs'; | ||
| import { type TDeferred } from '../types/deferred.mjs'; | ||
| import { type TAddOptionalAction } from '../engine/optional/instantiate_add.mjs'; | ||
| /** Creates a deferred AddOptional action. */ | ||
| export type TAddOptionalDeferred<Type extends TSchema> = (TDeferred<'AddOptional', [Type]>); | ||
| /** Creates a deferred AddOptional action. */ | ||
| export declare function AddOptionalDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TAddOptionalDeferred<Type>; | ||
| /** Applies an AddOptional action to a type. */ | ||
| export type TAddOptional<Type extends TSchema> = (TAddOptionalAction<Type>); | ||
| /** Applies an AddOptional action to a type. */ | ||
| export declare function AddOptional<Type extends TSchema>(type: Type, options?: TSchemaOptions): TAddOptional<Type>; |
| // deno-fmt-ignore-file | ||
| import { Deferred } from '../types/deferred.mjs'; | ||
| import { AddOptionalAction } from '../engine/optional/instantiate_add.mjs'; | ||
| /** Creates a deferred AddOptional action. */ | ||
| export function AddOptionalDeferred(type, options = {}) { | ||
| return Deferred('AddOptional', [type], options); | ||
| } | ||
| /** Applies an AddOptional action to a type. */ | ||
| export function AddOptional(type, options = {}) { | ||
| return AddOptionalAction(type, options); | ||
| } |
| import { type TSchema, type TSchemaOptions } from '../types/schema.mjs'; | ||
| import { type TDeferred } from '../types/deferred.mjs'; | ||
| import { type TAddReadonlyAction } from '../engine/readonly/instantiate_add.mjs'; | ||
| /** Creates a deferred AddReadonly action. */ | ||
| export type TAddReadonlyDeferred<Type extends TSchema> = (TDeferred<'AddReadonly', [Type]>); | ||
| /** Creates a deferred AddReadonly action. */ | ||
| export declare function AddReadonlyDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TAddReadonlyDeferred<Type>; | ||
| /** Applies an AddReadonly action to a type. */ | ||
| export type TAddReadonly<Type extends TSchema> = (TAddReadonlyAction<Type>); | ||
| /** Applies an AddReadonly action to a type. */ | ||
| export declare function AddReadonly<Type extends TSchema>(type: Type, options?: TSchemaOptions): TAddReadonly<Type>; |
| // deno-fmt-ignore-file | ||
| import { Deferred } from '../types/deferred.mjs'; | ||
| import { AddReadonlyAction } from '../engine/readonly/instantiate_add.mjs'; | ||
| /** Creates a deferred AddReadonly action. */ | ||
| export function AddReadonlyDeferred(type, options = {}) { | ||
| return Deferred('AddReadonly', [type], options); | ||
| } | ||
| /** Applies an AddReadonly action to a type. */ | ||
| export function AddReadonly(type, options = {}) { | ||
| return AddReadonlyAction(type, options); | ||
| } |
| import { type TSchema, type TSchemaOptions } from '../types/schema.mjs'; | ||
| import { type TDeferred } from '../types/deferred.mjs'; | ||
| import { type TRemoveImmutableAction } from '../engine/immutable/instantiate_remove.mjs'; | ||
| /** Creates a deferred RemoveImmutable action. */ | ||
| export type TRemoveImmutableDeferred<Type extends TSchema> = (TDeferred<'RemoveImmutable', [Type]>); | ||
| /** Creates a deferred RemoveImmutable action. */ | ||
| export declare function RemoveImmutableDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TRemoveImmutableDeferred<Type>; | ||
| /** Applies an RemoveImmutable action to a type. */ | ||
| export type TRemoveImmutable<Type extends TSchema> = (TRemoveImmutableAction<Type>); | ||
| /** Applies an RemoveImmutable action to a type. */ | ||
| export declare function RemoveImmutable<Type extends TSchema>(type: Type, options?: TSchemaOptions): TRemoveImmutable<Type>; |
| // deno-fmt-ignore-file | ||
| import { Deferred } from '../types/deferred.mjs'; | ||
| import { RemoveImmutableAction } from '../engine/immutable/instantiate_remove.mjs'; | ||
| /** Creates a deferred RemoveImmutable action. */ | ||
| export function RemoveImmutableDeferred(type, options = {}) { | ||
| return Deferred('RemoveImmutable', [type], options); | ||
| } | ||
| /** Applies an RemoveImmutable action to a type. */ | ||
| export function RemoveImmutable(type, options = {}) { | ||
| return RemoveImmutableAction(type, options); | ||
| } |
| import { type TSchema, type TSchemaOptions } from '../types/schema.mjs'; | ||
| import { type TDeferred } from '../types/deferred.mjs'; | ||
| import { type TRemoveOptionalAction } from '../engine/optional/instantiate_remove.mjs'; | ||
| /** Creates a deferred RemoveOptional action. */ | ||
| export type TRemoveOptionalDeferred<Type extends TSchema> = (TDeferred<'RemoveOptional', [Type]>); | ||
| /** Creates a deferred RemoveOptional action. */ | ||
| export declare function RemoveOptionalDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TRemoveOptionalDeferred<Type>; | ||
| /** Applies an RemoveOptional action to a type. */ | ||
| export type TRemoveOptional<Type extends TSchema> = (TRemoveOptionalAction<Type>); | ||
| /** Applies an RemoveOptional action to a type. */ | ||
| export declare function RemoveOptional<Type extends TSchema>(type: Type, options?: TSchemaOptions): TRemoveOptional<Type>; |
| // deno-fmt-ignore-file | ||
| import { Deferred } from '../types/deferred.mjs'; | ||
| import { RemoveOptionalAction } from '../engine/optional/instantiate_remove.mjs'; | ||
| /** Creates a deferred RemoveOptional action. */ | ||
| export function RemoveOptionalDeferred(type, options = {}) { | ||
| return Deferred('RemoveOptional', [type], options); | ||
| } | ||
| /** Applies an RemoveOptional action to a type. */ | ||
| export function RemoveOptional(type, options = {}) { | ||
| return RemoveOptionalAction(type, options); | ||
| } |
| import { type TSchema, type TSchemaOptions } from '../types/schema.mjs'; | ||
| import { type TDeferred } from '../types/deferred.mjs'; | ||
| import { type TRemoveReadonlyAction } from '../engine/readonly/instantiate_remove.mjs'; | ||
| /** Creates a deferred RemoveReadonly action. */ | ||
| export type TRemoveReadonlyDeferred<Type extends TSchema> = (TDeferred<'RemoveReadonly', [Type]>); | ||
| /** Creates a deferred RemoveReadonly action. */ | ||
| export declare function RemoveReadonlyDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TRemoveReadonlyDeferred<Type>; | ||
| /** Applies an RemoveReadonly action to a type. */ | ||
| export type TRemoveReadonly<Type extends TSchema> = (TRemoveReadonlyAction<Type>); | ||
| /** Applies an RemoveReadonly action to a type. */ | ||
| export declare function RemoveReadonly<Type extends TSchema>(type: Type, options?: TSchemaOptions): TRemoveReadonly<Type>; |
| // deno-fmt-ignore-file | ||
| import { Deferred } from '../types/deferred.mjs'; | ||
| import { RemoveReadonlyAction } from '../engine/readonly/instantiate_remove.mjs'; | ||
| /** Creates a deferred RemoveReadonly action. */ | ||
| export function RemoveReadonlyDeferred(type, options = {}) { | ||
| return Deferred('RemoveReadonly', [type], options); | ||
| } | ||
| /** Applies an RemoveReadonly action to a type. */ | ||
| export function RemoveReadonly(type, options = {}) { | ||
| return RemoveReadonlyAction(type, options); | ||
| } |
| import { type TSchema, type TSchemaOptions } from '../../types/schema.mjs'; | ||
| import { type TProperties } from '../../types/properties.mjs'; | ||
| import { type TImmutable } from '../../types/_immutable.mjs'; | ||
| import { type TState, type TInstantiateType } from '../instantiate.mjs'; | ||
| type TAddImmutableOperation<Type extends TSchema, Result extends TSchema = '~immutable' extends keyof Type ? Type : TImmutable<Type>> = Result; | ||
| export type TAddImmutableAction<Type extends TSchema, Result extends TSchema = TAddImmutableOperation<Type>> = Result; | ||
| export declare function AddImmutableAction<Type extends TSchema>(type: Type, options: TSchemaOptions): TAddImmutableAction<Type>; | ||
| export type TAddImmutableInstantiate<Context extends TProperties, State extends TState, Type extends TSchema, InstantiateType extends TSchema = TInstantiateType<Context, State, Type>> = TAddImmutableAction<InstantiateType>; | ||
| export declare function AddImmutableInstantiate<Context extends TProperties, State extends TState, Type extends TSchema>(context: Context, state: State, type: Type, options: TSchemaOptions): TAddImmutableInstantiate<Context, State, Type>; | ||
| export {}; |
| // deno-fmt-ignore-file | ||
| import { Memory } from '../../../system/memory/index.mjs'; | ||
| import { InstantiateType } from '../instantiate.mjs'; | ||
| function AddImmutableOperation(type) { | ||
| return Memory.Update(type, { '~immutable': true }, {}); | ||
| } | ||
| export function AddImmutableAction(type, options) { | ||
| const result = Memory.Update(AddImmutableOperation(type), {}, options); | ||
| return result; | ||
| } | ||
| export function AddImmutableInstantiate(context, state, type, options) { | ||
| const instantiatedType = InstantiateType(context, state, type); | ||
| return AddImmutableAction(instantiatedType, options); | ||
| } |
| import { type TSchema, type TSchemaOptions } from '../../types/schema.mjs'; | ||
| import { type TProperties } from '../../types/properties.mjs'; | ||
| import { type TImmutable } from '../../types/_immutable.mjs'; | ||
| import { type TState, type TInstantiateType } from '../instantiate.mjs'; | ||
| type TRemoveImmutableOperation<Type extends TSchema, Result extends TSchema = Type extends TImmutable<infer Type extends TSchema> ? Type : Type> = Result; | ||
| export type TRemoveImmutableAction<Type extends TSchema, Result extends TSchema = TRemoveImmutableOperation<Type>> = Result; | ||
| export declare function RemoveImmutableAction<Type extends TSchema>(type: Type, options: TSchemaOptions): TRemoveImmutableAction<Type>; | ||
| export type TRemoveImmutableInstantiate<Context extends TProperties, State extends TState, Type extends TSchema, InstantiateType extends TSchema = TInstantiateType<Context, State, Type>> = TRemoveImmutableAction<InstantiateType>; | ||
| export declare function RemoveImmutableInstantiate<Context extends TProperties, State extends TState, Type extends TSchema>(context: Context, state: State, type: Type, options: TSchemaOptions): TRemoveImmutableInstantiate<Context, State, Type>; | ||
| export {}; |
| // deno-fmt-ignore-file | ||
| import { Memory } from '../../../system/memory/index.mjs'; | ||
| import { InstantiateType } from '../instantiate.mjs'; | ||
| function RemoveImmutableOperation(type) { | ||
| return Memory.Discard(type, ['~immutable']); | ||
| } | ||
| export function RemoveImmutableAction(type, options) { | ||
| const result = Memory.Update(RemoveImmutableOperation(type), {}, options); | ||
| return result; | ||
| } | ||
| export function RemoveImmutableInstantiate(context, state, type, options) { | ||
| const instantiatedType = InstantiateType(context, state, type); | ||
| return RemoveImmutableAction(instantiatedType, options); | ||
| } |
| import { type TSchema, type TSchemaOptions } from '../../types/schema.mjs'; | ||
| import { type TProperties } from '../../types/properties.mjs'; | ||
| import { type TOptional } from '../../types/_optional.mjs'; | ||
| import { type TState, type TInstantiateType } from '../instantiate.mjs'; | ||
| type TAddOptionalOperation<Type extends TSchema, Result extends TSchema = `~optional` extends keyof Type ? Type : TOptional<Type>> = Result; | ||
| export type TAddOptionalAction<Type extends TSchema, Result extends TSchema = TAddOptionalOperation<Type>> = Result; | ||
| export declare function AddOptionalAction<Type extends TSchema>(type: Type, options: TSchemaOptions): TAddOptionalAction<Type>; | ||
| export type TAddOptionalInstantiate<Context extends TProperties, State extends TState, Type extends TSchema, InstantiateType extends TSchema = TInstantiateType<Context, State, Type>> = TAddOptionalAction<InstantiateType>; | ||
| export declare function AddOptionalInstantiate<Context extends TProperties, State extends TState, Type extends TSchema>(context: Context, state: State, type: Type, options: TSchemaOptions): TAddOptionalInstantiate<Context, State, Type>; | ||
| export {}; |
| // deno-fmt-ignore-file | ||
| import { Memory } from '../../../system/memory/index.mjs'; | ||
| import { InstantiateType } from '../instantiate.mjs'; | ||
| function AddOptionalOperation(type) { | ||
| return Memory.Update(type, { '~optional': true }, {}); | ||
| } | ||
| export function AddOptionalAction(type, options) { | ||
| const result = Memory.Update(AddOptionalOperation(type), {}, options); | ||
| return result; | ||
| } | ||
| export function AddOptionalInstantiate(context, state, type, options) { | ||
| const instantiatedType = InstantiateType(context, state, type); | ||
| return AddOptionalAction(instantiatedType, options); | ||
| } |
| import { type TSchema, type TSchemaOptions } from '../../types/schema.mjs'; | ||
| import { type TProperties } from '../../types/properties.mjs'; | ||
| import { type TOptional } from '../../types/_optional.mjs'; | ||
| import { type TState, type TInstantiateType } from '../instantiate.mjs'; | ||
| type TRemoveOptionalOperation<Type extends TSchema, Result extends TSchema = Type extends TOptional<infer Type extends TSchema> ? Type : Type> = Result; | ||
| export type TRemoveOptionalAction<Type extends TSchema, Result extends TSchema = TRemoveOptionalOperation<Type>> = Result; | ||
| export declare function RemoveOptionalAction<Type extends TSchema>(type: Type, options: TSchemaOptions): TRemoveOptionalAction<Type>; | ||
| export type TRemoveOptionalInstantiate<Context extends TProperties, State extends TState, Type extends TSchema, InstantiateType extends TSchema = TInstantiateType<Context, State, Type>> = TRemoveOptionalAction<InstantiateType>; | ||
| export declare function RemoveOptionalInstantiate<Context extends TProperties, State extends TState, Type extends TSchema>(context: Context, state: State, type: Type, options: TSchemaOptions): TRemoveOptionalInstantiate<Context, State, Type>; | ||
| export {}; |
| // deno-fmt-ignore-file | ||
| import { Memory } from '../../../system/memory/index.mjs'; | ||
| import { InstantiateType } from '../instantiate.mjs'; | ||
| function RemoveOptionalOperation(type) { | ||
| return Memory.Discard(type, ['~optional']); | ||
| } | ||
| export function RemoveOptionalAction(type, options) { | ||
| const result = Memory.Update(RemoveOptionalOperation(type), {}, options); | ||
| return result; | ||
| } | ||
| export function RemoveOptionalInstantiate(context, state, type, options) { | ||
| const instantiatedType = InstantiateType(context, state, type); | ||
| return RemoveOptionalAction(instantiatedType, options); | ||
| } |
| import { type TSchema, type TSchemaOptions } from '../../types/schema.mjs'; | ||
| import { type TProperties } from '../../types/properties.mjs'; | ||
| import { type TReadonly } from '../../types/_readonly.mjs'; | ||
| import { type TState, type TInstantiateType } from '../instantiate.mjs'; | ||
| type TAddReadonlyOperation<Type extends TSchema, Result extends TSchema = `~readonly` extends keyof Type ? Type : TReadonly<Type>> = Result; | ||
| export type TAddReadonlyAction<Type extends TSchema, Result extends TSchema = TAddReadonlyOperation<Type>> = Result; | ||
| export declare function AddReadonlyAction<Type extends TSchema>(type: Type, options: TSchemaOptions): TAddReadonlyAction<Type>; | ||
| export type TAddReadonlyInstantiate<Context extends TProperties, State extends TState, Type extends TSchema, InstantiateType extends TSchema = TInstantiateType<Context, State, Type>> = TAddReadonlyAction<InstantiateType>; | ||
| export declare function AddReadonlyInstantiate<Context extends TProperties, State extends TState, Type extends TSchema>(context: Context, state: State, type: Type, options: TSchemaOptions): TAddReadonlyInstantiate<Context, State, Type>; | ||
| export {}; |
| // deno-fmt-ignore-file | ||
| import { Memory } from '../../../system/memory/index.mjs'; | ||
| import { InstantiateType } from '../instantiate.mjs'; | ||
| function AddReadonlyOperation(type) { | ||
| return Memory.Update(type, { '~readonly': true }, {}); | ||
| } | ||
| export function AddReadonlyAction(type, options) { | ||
| const result = Memory.Update(AddReadonlyOperation(type), {}, options); | ||
| return result; | ||
| } | ||
| export function AddReadonlyInstantiate(context, state, type, options) { | ||
| const instantiatedType = InstantiateType(context, state, type); | ||
| return AddReadonlyAction(instantiatedType, options); | ||
| } |
| import { type TSchema, type TSchemaOptions } from '../../types/schema.mjs'; | ||
| import { type TProperties } from '../../types/properties.mjs'; | ||
| import { type TReadonly } from '../../types/_readonly.mjs'; | ||
| import { type TState, type TInstantiateType } from '../instantiate.mjs'; | ||
| type TRemoveReadonlyOperation<Type extends TSchema, Result extends TSchema = Type extends TReadonly<infer Type extends TSchema> ? Type : Type> = Result; | ||
| export type TRemoveReadonlyAction<Type extends TSchema, Result extends TSchema = TRemoveReadonlyOperation<Type>> = Result; | ||
| export declare function RemoveReadonlyAction<Type extends TSchema>(type: Type, options: TSchemaOptions): TRemoveReadonlyAction<Type>; | ||
| export type TRemoveReadonlyInstantiate<Context extends TProperties, State extends TState, Type extends TSchema, InstantiateType extends TSchema = TInstantiateType<Context, State, Type>> = TRemoveReadonlyAction<InstantiateType>; | ||
| export declare function RemoveReadonlyInstantiate<Context extends TProperties, State extends TState, Type extends TSchema>(context: Context, state: State, type: Type, options: TSchemaOptions): TRemoveReadonlyInstantiate<Context, State, Type>; | ||
| export {}; |
| // deno-fmt-ignore-file | ||
| import { Memory } from '../../../system/memory/index.mjs'; | ||
| import { InstantiateType } from '../instantiate.mjs'; | ||
| function RemoveReadonlyOperation(type) { | ||
| return Memory.Discard(type, ['~readonly']); | ||
| } | ||
| export function RemoveReadonlyAction(type, options) { | ||
| const result = Memory.Update(RemoveReadonlyOperation(type), {}, options); | ||
| return result; | ||
| } | ||
| export function RemoveReadonlyInstantiate(context, state, type, options) { | ||
| const instantiatedType = InstantiateType(context, state, type); | ||
| return RemoveReadonlyAction(instantiatedType, options); | ||
| } |
@@ -1,3 +0,7 @@ | ||
| export * from './_optional.mjs'; | ||
| export * from './_readonly.mjs'; | ||
| export * from './_add_immutable.mjs'; | ||
| export * from './_add_readonly.mjs'; | ||
| export * from './_add_optional.mjs'; | ||
| export * from './_remove_immutable.mjs'; | ||
| export * from './_remove_readonly.mjs'; | ||
| export * from './_remove_optional.mjs'; | ||
| export * from './awaited.mjs'; | ||
@@ -4,0 +8,0 @@ export * from './capitalize.mjs'; |
@@ -1,3 +0,7 @@ | ||
| export * from './_optional.mjs'; | ||
| export * from './_readonly.mjs'; | ||
| export * from './_add_immutable.mjs'; | ||
| export * from './_add_readonly.mjs'; | ||
| export * from './_add_optional.mjs'; | ||
| export * from './_remove_immutable.mjs'; | ||
| export * from './_remove_readonly.mjs'; | ||
| export * from './_remove_optional.mjs'; | ||
| export * from './awaited.mjs'; | ||
@@ -4,0 +8,0 @@ export * from './capitalize.mjs'; |
| import { type TUnreachable } from '../../../system/unreachable/index.mjs'; | ||
| import { type TReadonly, type TReadonlyAdd, type TReadonlyRemove } from '../../types/_readonly.mjs'; | ||
| import { type TOptional, type TOptionalAdd, type TOptionalRemove } from '../../types/_optional.mjs'; | ||
| import { type TReadonly } from '../../types/_readonly.mjs'; | ||
| import { type TOptional } from '../../types/_optional.mjs'; | ||
| import { type TSchema } from '../../types/schema.mjs'; | ||
@@ -9,2 +9,6 @@ import { type TProperties } from '../../types/properties.mjs'; | ||
| import { type TTuple } from '../../types/tuple.mjs'; | ||
| import { type TAddReadonly } from '../../action/_add_readonly.mjs'; | ||
| import { type TAddOptional } from '../../action/_add_optional.mjs'; | ||
| import { type TRemoveReadonly } from '../../action/_remove_readonly.mjs'; | ||
| import { type TRemoveOptional } from '../../action/_remove_optional.mjs'; | ||
| import { type TTupleElementsToProperties } from '../tuple/to_object.mjs'; | ||
@@ -14,12 +18,12 @@ import { type TEvaluateIntersect } from './evaluate.mjs'; | ||
| type TIsOptionalProperty<Left extends TSchema, Right extends TSchema> = (Left extends TOptional<Left> ? Right extends TOptional<Right> ? true : false : false); | ||
| type TCompositeProperty<Left extends TSchema, Right extends TSchema, IsReadonly extends boolean = TIsReadonlyProperty<Left, Right>, IsOptional extends boolean = TIsOptionalProperty<Left, Right>, Evaluated extends TSchema = TEvaluateIntersect<[Left, Right]>, Property extends TSchema = TReadonlyRemove<TOptionalRemove<Evaluated>>> = ([ | ||
| type TCompositeProperty<Left extends TSchema, Right extends TSchema, IsReadonly extends boolean = TIsReadonlyProperty<Left, Right>, IsOptional extends boolean = TIsOptionalProperty<Left, Right>, Evaluated extends TSchema = TEvaluateIntersect<[Left, Right]>, Property extends TSchema = TRemoveReadonly<TRemoveOptional<Evaluated>>> = ([ | ||
| IsReadonly, | ||
| IsOptional | ||
| ] extends [true, true] ? TReadonlyAdd<TOptionalAdd<Property>> : [ | ||
| ] extends [true, true] ? TAddReadonly<TAddOptional<Property>> : [ | ||
| IsReadonly, | ||
| IsOptional | ||
| ] extends [true, false] ? TReadonlyAdd<Property> : [ | ||
| ] extends [true, false] ? TAddReadonly<Property> : [ | ||
| IsReadonly, | ||
| IsOptional | ||
| ] extends [false, true] ? TOptionalAdd<Property> : Property); | ||
| ] extends [false, true] ? TAddOptional<Property> : Property); | ||
| type TCompositePropertyKey<Left extends TProperties, Right extends TProperties, Key extends PropertyKey, Result extends TSchema = (Key extends keyof Left ? Key extends keyof Right ? TCompositeProperty<Left[Key], Right[Key]> : Left[Key] : Key extends keyof Right ? Right[Key] : TNever)> = Result; | ||
@@ -26,0 +30,0 @@ type TCompositeProperties<Left extends TProperties, Right extends TProperties, Result extends TProperties = { |
@@ -5,7 +5,11 @@ // deno-fmt-ignore-file | ||
| import { Guard } from '../../../guard/index.mjs'; | ||
| import { ReadonlyAdd, ReadonlyRemove, IsReadonly } from '../../types/_readonly.mjs'; | ||
| import { OptionalAdd, OptionalRemove, IsOptional } from '../../types/_optional.mjs'; | ||
| import { IsReadonly } from '../../types/_readonly.mjs'; | ||
| import { IsOptional } from '../../types/_optional.mjs'; | ||
| import { Object, IsObject } from '../../types/object.mjs'; | ||
| import { Never } from '../../types/never.mjs'; | ||
| import { IsTuple } from '../../types/tuple.mjs'; | ||
| import { AddReadonly } from '../../action/_add_readonly.mjs'; | ||
| import { AddOptional } from '../../action/_add_optional.mjs'; | ||
| import { RemoveReadonly } from '../../action/_remove_readonly.mjs'; | ||
| import { RemoveOptional } from '../../action/_remove_optional.mjs'; | ||
| import { TupleElementsToProperties } from '../tuple/to_object.mjs'; | ||
@@ -24,6 +28,6 @@ import { EvaluateIntersect } from './evaluate.mjs'; | ||
| // Modifiers need to be discarded and re-applied | ||
| const property = ReadonlyRemove(OptionalRemove(evaluated)); | ||
| return (isReadonly && isOptional ? ReadonlyAdd(OptionalAdd(property)) : | ||
| isReadonly && !isOptional ? ReadonlyAdd(property) : | ||
| !isReadonly && isOptional ? OptionalAdd(property) : | ||
| const property = RemoveReadonly(RemoveOptional(evaluated)); | ||
| return (isReadonly && isOptional ? AddReadonly(AddOptional(property)) : | ||
| isReadonly && !isOptional ? AddReadonly(property) : | ||
| !isReadonly && isOptional ? AddOptional(property) : | ||
| property); | ||
@@ -30,0 +34,0 @@ } |
@@ -1,4 +0,1 @@ | ||
| import { type TImmutable } from '../types/_immutable.mjs'; | ||
| import { type TOptional, type TOptionalAdd, type TOptionalRemove } from '../types/_optional.mjs'; | ||
| import { type TReadonly, type TReadonlyAdd, type TReadonlyRemove } from '../types/_readonly.mjs'; | ||
| import { type TSchema } from '../types/schema.mjs'; | ||
@@ -23,4 +20,11 @@ import { type TArray } from '../types/array.mjs'; | ||
| import { type TRest } from '../types/rest.mjs'; | ||
| import { type TReadonlyAddAction, type TReadonlyRemoveAction } from '../action/_readonly.mjs'; | ||
| import { type TOptionalAddAction, type TOptionalRemoveAction } from '../action/_optional.mjs'; | ||
| import { type TAddImmutableInstantiate } from './immutable/instantiate_add.mjs'; | ||
| import { type TRemoveImmutableInstantiate } from './immutable/instantiate_remove.mjs'; | ||
| import { type TAddReadonlyInstantiate } from './readonly/instantiate_add.mjs'; | ||
| import { type TRemoveReadonlyInstantiate } from './readonly/instantiate_remove.mjs'; | ||
| import { type TAddOptionalInstantiate } from './optional/instantiate_add.mjs'; | ||
| import { type TRemoveOptionalInstantiate } from './optional/instantiate_remove.mjs'; | ||
| import { type TOptional } from '../types/_optional.mjs'; | ||
| import { type TImmutable } from '../types/_immutable.mjs'; | ||
| import { type TReadonly } from '../types/_readonly.mjs'; | ||
| import { type TAwaitedInstantiate } from './awaited/instantiate.mjs'; | ||
@@ -63,10 +67,2 @@ import { type TCallInstantiate } from './call/instantiate.mjs'; | ||
| export declare function CanInstantiate<Types extends TSchema[]>(types: [...Types]): TCanInstantiate<Types>; | ||
| type ModifierAction = 'add' | 'remove' | 'none'; | ||
| type TModifierActions<Type extends TSchema, Readonly extends ModifierAction, Optional extends ModifierAction> = (Type extends TReadonlyRemoveAction<infer Type extends TSchema> ? TModifierActions<Type, 'remove', Optional> : Type extends TOptionalRemoveAction<infer Type extends TSchema> ? TModifierActions<Type, Readonly, 'remove'> : Type extends TReadonlyAddAction<infer Type extends TSchema> ? TModifierActions<Type, 'add', Optional> : Type extends TOptionalAddAction<infer Type extends TSchema> ? TModifierActions<Type, Readonly, 'add'> : [ | ||
| Type, | ||
| Readonly, | ||
| Optional | ||
| ]); | ||
| type TApplyReadonly<Action extends ModifierAction, Type extends TSchema> = (Action extends 'remove' ? TReadonlyRemove<Type> : Action extends 'add' ? TReadonlyAdd<Type> : Type); | ||
| type TApplyOptional<Action extends ModifierAction, Type extends TSchema> = (Action extends 'remove' ? TOptionalRemove<Type> : Action extends 'add' ? TOptionalAdd<Type> : Type); | ||
| export type TInstantiateProperties<Context extends TProperties, State extends TState, Properties extends TProperties, Result extends TProperties = { | ||
@@ -83,2 +79,20 @@ [Key in keyof Properties]: TInstantiateType<Context, State, Properties[Key]>; | ||
| Parameters | ||
| ] extends ['AddImmutable', [infer Type extends TSchema]] ? TAddImmutableInstantiate<Context, State, Type> : [ | ||
| Action, | ||
| Parameters | ||
| ] extends ['RemoveImmutable', [infer Type extends TSchema]] ? TRemoveImmutableInstantiate<Context, State, Type> : [ | ||
| Action, | ||
| Parameters | ||
| ] extends ['AddReadonly', [infer Type extends TSchema]] ? TAddReadonlyInstantiate<Context, State, Type> : [ | ||
| Action, | ||
| Parameters | ||
| ] extends ['RemoveReadonly', [infer Type extends TSchema]] ? TRemoveReadonlyInstantiate<Context, State, Type> : [ | ||
| Action, | ||
| Parameters | ||
| ] extends ['AddOptional', [infer Type extends TSchema]] ? TAddOptionalInstantiate<Context, State, Type> : [ | ||
| Action, | ||
| Parameters | ||
| ] extends ['RemoveOptional', [infer Type extends TSchema]] ? TRemoveOptionalInstantiate<Context, State, Type> : [ | ||
| Action, | ||
| Parameters | ||
| ] extends ['Awaited', [infer Type extends TSchema]] ? TAwaitedInstantiate<Context, State, Type> : [ | ||
@@ -163,4 +177,7 @@ Action, | ||
| ] extends ['With', [infer Type extends TSchema, infer Options extends TSchema]] ? TWithInstantiate<Context, State, Type, Options> : TDeferred<Action, Parameters>); | ||
| export type TInstantiateType<Context extends TProperties, State extends TState, Input extends TSchema, Immutable extends boolean = Input extends TImmutable ? true : false, Modifiers extends [TSchema, ModifierAction, ModifierAction] = TModifierActions<Input, Input extends TReadonly<Input> ? 'add' : 'none', Input extends TOptional<Input> ? 'add' : 'none'>, Type extends TSchema = Modifiers[0], Instantiated 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), WithImmutable extends TSchema = Immutable extends true ? TImmutable<Instantiated> : Instantiated, WithModifiers extends TSchema = TApplyReadonly<Modifiers[1], TApplyOptional<Modifiers[2], WithImmutable>>> = WithModifiers; | ||
| export declare function InstantiateType<Context extends TProperties, State extends TState, Type extends TSchema>(context: Context, state: State, input: Type): TInstantiateType<Context, State, Type>; | ||
| 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; | ||
| export declare function InstantiateImmediate<Context extends TProperties, State extends TState, Type extends TSchema>(context: Context, state: State, type: Type): TInstantiateImmediate<Context, State, Type>; | ||
| 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; | ||
| 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; | ||
| export declare function InstantiateType<Context extends TProperties, State extends TState, Type extends TSchema>(context: TProperties, state: TState, type: Type): TInstantiateType<Context, State, Type>; | ||
| /** Instantiates computed schematics using the given context and type. */ | ||
@@ -167,0 +184,0 @@ export type TInstantiate<Context extends TProperties, Type extends TSchema> = (TInstantiateType<Context, TState<[], []>, Type>); |
@@ -5,8 +5,2 @@ // deno-fmt-ignore-file | ||
| // ------------------------------------------------------------------ | ||
| // Modifiers | ||
| // ------------------------------------------------------------------ | ||
| import { IsImmutable, Immutable } from '../types/_immutable.mjs'; | ||
| import { IsOptional, OptionalAdd, OptionalRemove } from '../types/_optional.mjs'; | ||
| import { IsReadonly, ReadonlyAdd, ReadonlyRemove } from '../types/_readonly.mjs'; | ||
| // ------------------------------------------------------------------ | ||
| // Types | ||
@@ -32,6 +26,13 @@ // ------------------------------------------------------------------ | ||
| // ------------------------------------------------------------------ | ||
| // Modifier Actions | ||
| // Modifier Instantiate | ||
| // ------------------------------------------------------------------ | ||
| import { IsReadonlyAddAction, IsReadonlyRemoveAction } from '../action/_readonly.mjs'; | ||
| import { IsOptionalAddAction, IsOptionalRemoveAction } from '../action/_optional.mjs'; | ||
| import { AddImmutableInstantiate } from './immutable/instantiate_add.mjs'; | ||
| import { RemoveImmutableInstantiate } from './immutable/instantiate_remove.mjs'; | ||
| import { AddReadonlyInstantiate } from './readonly/instantiate_add.mjs'; | ||
| import { RemoveReadonlyInstantiate } from './readonly/instantiate_remove.mjs'; | ||
| import { AddOptionalInstantiate } from './optional/instantiate_add.mjs'; | ||
| import { RemoveOptionalInstantiate } from './optional/instantiate_remove.mjs'; | ||
| import { Optional, IsOptional } from '../types/_optional.mjs'; | ||
| import { Immutable, IsImmutable } from '../types/_immutable.mjs'; | ||
| import { Readonly, IsReadonly } from '../types/_readonly.mjs'; | ||
| // ------------------------------------------------------------------ | ||
@@ -78,19 +79,2 @@ // Instantiate | ||
| } | ||
| function ModifierActions(type, readonly, optional) { | ||
| return (IsReadonlyRemoveAction(type) ? ModifierActions(type.type, 'remove', optional) : | ||
| IsOptionalRemoveAction(type) ? ModifierActions(type.type, readonly, 'remove') : | ||
| IsReadonlyAddAction(type) ? ModifierActions(type.type, 'add', optional) : | ||
| IsOptionalAddAction(type) ? ModifierActions(type.type, readonly, 'add') : | ||
| [type, readonly, optional]); | ||
| } | ||
| function ApplyReadonly(action, type) { | ||
| return (Guard.IsEqual(action, 'remove') ? ReadonlyRemove(type) : | ||
| Guard.IsEqual(action, 'add') ? ReadonlyAdd(type) : | ||
| type); | ||
| } | ||
| function ApplyOptional(action, type) { | ||
| return (Guard.IsEqual(action, 'remove') ? OptionalRemove(type) : | ||
| Guard.IsEqual(action, 'add') ? OptionalAdd(type) : | ||
| type); | ||
| } | ||
| export function InstantiateProperties(context, state, properties) { | ||
@@ -110,36 +94,43 @@ return Guard.Keys(properties).reduce((result, key) => { | ||
| function InstantiateDeferred(context, state, action, parameters, options) { | ||
| return (Guard.IsEqual(action, 'Awaited') ? AwaitedInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Capitalize') ? CapitalizeInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Conditional') ? ConditionalInstantiate(context, state, parameters[0], parameters[1], parameters[2], parameters[3], options) : | ||
| Guard.IsEqual(action, 'ConstructorParameters') ? ConstructorParametersInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Evaluate') ? EvaluateInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Exclude') ? ExcludeInstantiate(context, state, parameters[0], parameters[1], options) : | ||
| Guard.IsEqual(action, 'Extract') ? ExtractInstantiate(context, state, parameters[0], parameters[1], options) : | ||
| Guard.IsEqual(action, 'Index') ? IndexInstantiate(context, state, parameters[0], parameters[1], options) : | ||
| Guard.IsEqual(action, 'InstanceType') ? InstanceTypeInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Interface') ? InterfaceInstantiate(context, state, parameters[0], parameters[1], options) : | ||
| Guard.IsEqual(action, 'KeyOf') ? KeyOfInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Lowercase') ? LowercaseInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Mapped') ? MappedInstantiate(context, state, parameters[0], parameters[1], parameters[2], parameters[3], options) : | ||
| Guard.IsEqual(action, 'Module') ? ModuleInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'NonNullable') ? NonNullableInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Pick') ? PickInstantiate(context, state, parameters[0], parameters[1], options) : | ||
| Guard.IsEqual(action, 'Parameters') ? ParametersInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Partial') ? PartialInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Omit') ? OmitInstantiate(context, state, parameters[0], parameters[1], options) : | ||
| Guard.IsEqual(action, 'ReadonlyObject') ? ReadonlyObjectInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Record') ? RecordInstantiate(context, state, parameters[0], parameters[1], options) : | ||
| Guard.IsEqual(action, 'Required') ? RequiredInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'ReturnType') ? ReturnTypeInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'TemplateLiteral') ? TemplateLiteralInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Uncapitalize') ? UncapitalizeInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Uppercase') ? UppercaseInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'With') ? WithInstantiate(context, state, parameters[0], parameters[1]) : | ||
| Deferred(action, parameters, options)); | ||
| return ( | ||
| // Modifier Actions | ||
| Guard.IsEqual(action, 'AddImmutable') ? AddImmutableInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'RemoveImmutable') ? RemoveImmutableInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'AddReadonly') ? AddReadonlyInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'RemoveReadonly') ? RemoveReadonlyInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'AddOptional') ? AddOptionalInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'RemoveOptional') ? RemoveOptionalInstantiate(context, state, parameters[0], options) : | ||
| // Actions | ||
| Guard.IsEqual(action, 'Awaited') ? AwaitedInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Capitalize') ? CapitalizeInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Conditional') ? ConditionalInstantiate(context, state, parameters[0], parameters[1], parameters[2], parameters[3], options) : | ||
| Guard.IsEqual(action, 'ConstructorParameters') ? ConstructorParametersInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Evaluate') ? EvaluateInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Exclude') ? ExcludeInstantiate(context, state, parameters[0], parameters[1], options) : | ||
| Guard.IsEqual(action, 'Extract') ? ExtractInstantiate(context, state, parameters[0], parameters[1], options) : | ||
| Guard.IsEqual(action, 'Index') ? IndexInstantiate(context, state, parameters[0], parameters[1], options) : | ||
| Guard.IsEqual(action, 'InstanceType') ? InstanceTypeInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Interface') ? InterfaceInstantiate(context, state, parameters[0], parameters[1], options) : | ||
| Guard.IsEqual(action, 'KeyOf') ? KeyOfInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Lowercase') ? LowercaseInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Mapped') ? MappedInstantiate(context, state, parameters[0], parameters[1], parameters[2], parameters[3], options) : | ||
| Guard.IsEqual(action, 'Module') ? ModuleInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'NonNullable') ? NonNullableInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Pick') ? PickInstantiate(context, state, parameters[0], parameters[1], options) : | ||
| Guard.IsEqual(action, 'Parameters') ? ParametersInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Partial') ? PartialInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Omit') ? OmitInstantiate(context, state, parameters[0], parameters[1], options) : | ||
| Guard.IsEqual(action, 'ReadonlyObject') ? ReadonlyObjectInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Record') ? RecordInstantiate(context, state, parameters[0], parameters[1], options) : | ||
| Guard.IsEqual(action, 'Required') ? RequiredInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'ReturnType') ? ReturnTypeInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'TemplateLiteral') ? TemplateLiteralInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Uncapitalize') ? UncapitalizeInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'Uppercase') ? UppercaseInstantiate(context, state, parameters[0], options) : | ||
| Guard.IsEqual(action, 'With') ? WithInstantiate(context, state, parameters[0], parameters[1]) : | ||
| Deferred(action, parameters, options)); | ||
| } | ||
| export function InstantiateType(context, state, input) { | ||
| const immutable = IsImmutable(input); | ||
| const modifiers = ModifierActions(input, IsReadonly(input) ? 'add' : 'none', IsOptional(input) ? 'add' : 'none'); | ||
| const type = IsBase(modifiers[0]) ? modifiers[0].Clone() : modifiers[0]; | ||
| const instantiated = (IsRef(type) ? RefInstantiate(context, state, type, type.$ref) : | ||
| export function InstantiateImmediate(context, state, type) { | ||
| type = (IsBase(type) ? type.Clone() : type); | ||
| const result = (IsRef(type) ? RefInstantiate(context, state, type, type.$ref) : | ||
| IsArray(type) ? _Array_(InstantiateType(context, state, type.items), ArrayOptions(type)) : | ||
@@ -161,4 +152,13 @@ IsAsyncIterator(type) ? AsyncIterator(InstantiateType(context, state, type.iteratorItems), AsyncIteratorOptions(type)) : | ||
| type); | ||
| const withImmutable = immutable ? Immutable(instantiated) : instantiated; | ||
| const withModifiers = ApplyReadonly(modifiers[1], ApplyOptional(modifiers[2], withImmutable)); | ||
| return result; | ||
| } | ||
| function WithModifiers(type, instantiatedType) { | ||
| const withImmutable = IsImmutable(type) ? Immutable(instantiatedType) : instantiatedType; | ||
| const withReadonly = IsReadonly(type) ? Readonly(withImmutable) : withImmutable; | ||
| const withOptional = IsOptional(type) ? Optional(withReadonly) : withReadonly; | ||
| return withOptional; | ||
| } | ||
| export function InstantiateType(context, state, type) { | ||
| const instantiatedType = InstantiateImmediate(context, state, type); | ||
| const withModifiers = IsDeferred(type) ? instantiatedType : WithModifiers(type, instantiatedType); | ||
| return withModifiers; | ||
@@ -165,0 +165,0 @@ } |
| import { type TSchema } from '../../types/schema.mjs'; | ||
| import { type TObject } from '../../types/object.mjs'; | ||
| import { type TOptionalAdd } from '../../types/_optional.mjs'; | ||
| import { type TAddOptional } from '../../action/_add_optional.mjs'; | ||
| import { type TProperties } from '../../types/properties.mjs'; | ||
| export type TFromObject<Properties extends TProperties, Mapped extends TProperties = { | ||
| [Key in keyof Properties]: TOptionalAdd<Properties[Key]>; | ||
| [Key in keyof Properties]: TAddOptional<Properties[Key]>; | ||
| }, Result extends TSchema = TObject<Mapped>> = Result; | ||
| export declare function FromObject<Properties extends TProperties>(properties: Properties): TFromObject<Properties>; |
| // deno-fmt-ignore-file | ||
| import { Guard } from '../../../guard/index.mjs'; | ||
| import { Object } from '../../types/object.mjs'; | ||
| import { Optional } from '../../types/_optional.mjs'; | ||
| import { AddOptional } from '../../action/_add_optional.mjs'; | ||
| export function FromObject(properties) { | ||
| const mapped = Guard.Keys(properties).reduce((result, left) => { | ||
| return { ...result, [left]: Optional(properties[left]) }; | ||
| return { ...result, [left]: AddOptional(properties[left]) }; | ||
| }, {}); | ||
@@ -9,0 +9,0 @@ const result = Object(mapped); |
| import { type TSchema } from '../../types/schema.mjs'; | ||
| import { type TArray } from '../../types/array.mjs'; | ||
| import { type TImmutableAdd } from '../../types/_immutable.mjs'; | ||
| export type TFromArray<Type extends TSchema, Result extends TSchema = TImmutableAdd<TArray<Type>>> = Result; | ||
| import { type TAddImmutable } from '../../action/_add_immutable.mjs'; | ||
| export type TFromArray<Type extends TSchema, Result extends TSchema = TAddImmutable<TArray<Type>>> = Result; | ||
| export declare function FromArray<Type extends TSchema>(type: Type): TFromArray<Type>; |
| // deno-fmt-ignore-file | ||
| import { Array } from '../../types/array.mjs'; | ||
| import { Immutable } from '../../types/_immutable.mjs'; | ||
| import { AddImmutable } from '../../action/_add_immutable.mjs'; | ||
| export function FromArray(type) { | ||
| const result = Immutable(Array(type)); | ||
| const result = AddImmutable(Array(type)); | ||
| return result; | ||
| } |
| import { type TSchema } from '../../types/schema.mjs'; | ||
| import { type TObject } from '../../types/object.mjs'; | ||
| import { type TReadonlyAdd } from '../../types/_readonly.mjs'; | ||
| import { type TAddReadonly } from '../../action/_add_readonly.mjs'; | ||
| import { type TProperties } from '../../types/properties.mjs'; | ||
| export type TFromObject<Properties extends TProperties, Mapped extends TProperties = { | ||
| [Key in keyof Properties]: TReadonlyAdd<Properties[Key]>; | ||
| [Key in keyof Properties]: TAddReadonly<Properties[Key]>; | ||
| }, Result extends TSchema = TObject<Mapped>> = Result; | ||
| export declare function FromObject<Properties extends TProperties>(properties: Properties): TFromObject<Properties>; |
| // deno-fmt-ignore-file | ||
| import { Guard } from '../../../guard/index.mjs'; | ||
| import { Object } from '../../types/object.mjs'; | ||
| import { Readonly } from '../../types/_readonly.mjs'; | ||
| import { AddReadonly } from '../../action/_add_readonly.mjs'; | ||
| export function FromObject(properties) { | ||
| const mapped = Guard.Keys(properties).reduce((result, left) => { | ||
| return { ...result, [left]: Readonly(properties[left]) }; | ||
| return { ...result, [left]: AddReadonly(properties[left]) }; | ||
| }, {}); | ||
@@ -9,0 +9,0 @@ const result = Object(mapped); |
| import { type TSchema } from '../../types/schema.mjs'; | ||
| import { type TTuple } from '../../types/tuple.mjs'; | ||
| import { type TImmutableAdd } from '../../types/_immutable.mjs'; | ||
| export type TFromTuple<Types extends TSchema[], Result extends TSchema = TImmutableAdd<TTuple<Types>>> = Result; | ||
| import { type TAddImmutable } from '../../action/_add_immutable.mjs'; | ||
| export type TFromTuple<Types extends TSchema[], Result extends TSchema = TAddImmutable<TTuple<Types>>> = Result; | ||
| export declare function FromTuple<Types extends TSchema[]>(types: [...Types]): TFromTuple<Types>; |
| // deno-fmt-ignore-file | ||
| import { Tuple } from '../../types/tuple.mjs'; | ||
| import { Immutable } from '../../types/_immutable.mjs'; | ||
| import { AddImmutable } from '../../action/_add_immutable.mjs'; | ||
| export function FromTuple(types) { | ||
| const result = Immutable(Tuple(types)); | ||
| const result = AddImmutable(Tuple(types)); | ||
| return result; | ||
| } |
| import { type TSchema } from '../../types/schema.mjs'; | ||
| import { type TObject } from '../../types/object.mjs'; | ||
| import { type TOptionalRemove } from '../../types/_optional.mjs'; | ||
| import { type TRemoveOptional } from '../../action/_remove_optional.mjs'; | ||
| import { type TProperties } from '../../types/properties.mjs'; | ||
| export type TFromObject<Properties extends TProperties, Mapped extends TProperties = { | ||
| [Key in keyof Properties]: TOptionalRemove<Properties[Key]>; | ||
| [Key in keyof Properties]: TRemoveOptional<Properties[Key]>; | ||
| }, Result extends TSchema = TObject<Mapped>> = Result; | ||
| export declare function FromObject<Properties extends TProperties>(properties: Properties): TFromObject<Properties>; |
| // deno-fmt-ignore-file | ||
| import { Guard } from '../../../guard/index.mjs'; | ||
| import { Object } from '../../types/object.mjs'; | ||
| import { OptionalRemove } from '../../types/_optional.mjs'; | ||
| import { RemoveOptional } from '../../action/_remove_optional.mjs'; | ||
| export function FromObject(properties) { | ||
| const mapped = Guard.Keys(properties).reduce((result, left) => { | ||
| return { ...result, [left]: OptionalRemove(properties[left]) }; | ||
| return { ...result, [left]: RemoveOptional(properties[left]) }; | ||
| }, {}); | ||
@@ -9,0 +9,0 @@ const result = Object(mapped); |
@@ -10,1 +10,2 @@ // deno-fmt-ignore-file | ||
| } | ||
| // deno-coverage-ignore-stop |
| import { Memory } from '../../system/memory/index.mjs'; | ||
| import * as C from '../action/index.mjs'; | ||
| import * as T from '../types/index.mjs'; | ||
| import * as S from '../action/index.mjs'; | ||
| type TIntrinsicOrCall<Target extends string, Parameters extends T.TSchema[]> = ([ | ||
@@ -19,48 +19,48 @@ Target, | ||
| Parameters | ||
| ] extends ['Awaited', [infer Type extends T.TSchema]] ? C.TAwaitedDeferred<Type> : [ | ||
| ] extends ['Awaited', [infer Type extends T.TSchema]] ? S.TAwaitedDeferred<Type> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['Capitalize', [infer Type extends T.TSchema]] ? C.TCapitalizeDeferred<Type> : [ | ||
| ] extends ['Capitalize', [infer Type extends T.TSchema]] ? S.TCapitalizeDeferred<Type> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['ConstructorParameters', [infer Type extends T.TSchema]] ? C.TConstructorParametersDeferred<Type> : [ | ||
| ] extends ['ConstructorParameters', [infer Type extends T.TSchema]] ? S.TConstructorParametersDeferred<Type> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['Evaluate', [infer Type extends T.TSchema]] ? C.TEvaluateDeferred<Type> : [ | ||
| ] extends ['Evaluate', [infer Type extends T.TSchema]] ? S.TEvaluateDeferred<Type> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['Exclude', [infer Left extends T.TSchema, infer Right extends T.TSchema]] ? C.TExcludeDeferred<Left, Right> : [ | ||
| ] extends ['Exclude', [infer Left extends T.TSchema, infer Right extends T.TSchema]] ? S.TExcludeDeferred<Left, Right> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['Extract', [infer Left extends T.TSchema, infer Right extends T.TSchema]] ? C.TExtractDeferred<Left, Right> : [ | ||
| ] extends ['Extract', [infer Left extends T.TSchema, infer Right extends T.TSchema]] ? S.TExtractDeferred<Left, Right> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['Index', [infer Type extends T.TSchema, infer Indexer extends T.TSchema]] ? C.TIndexDeferred<Type, Indexer> : [ | ||
| ] extends ['Index', [infer Type extends T.TSchema, infer Indexer extends T.TSchema]] ? S.TIndexDeferred<Type, Indexer> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['InstanceType', [infer Type extends T.TSchema]] ? C.TInstanceTypeDeferred<Type> : [ | ||
| ] extends ['InstanceType', [infer Type extends T.TSchema]] ? S.TInstanceTypeDeferred<Type> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['KeyOf', [infer Type extends T.TSchema]] ? C.TKeyOfDeferred<Type> : [ | ||
| ] extends ['KeyOf', [infer Type extends T.TSchema]] ? S.TKeyOfDeferred<Type> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['Lowercase', [infer Type extends T.TSchema]] ? C.TLowercaseDeferred<Type> : [ | ||
| ] extends ['Lowercase', [infer Type extends T.TSchema]] ? S.TLowercaseDeferred<Type> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['NonNullable', [infer Type extends T.TSchema]] ? C.TNonNullableDeferred<Type> : [ | ||
| ] extends ['NonNullable', [infer Type extends T.TSchema]] ? S.TNonNullableDeferred<Type> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['Omit', [infer Type extends T.TSchema, infer Indexer extends T.TSchema]] ? C.TOmitDeferred<Type, Indexer> : [ | ||
| ] extends ['Omit', [infer Type extends T.TSchema, infer Indexer extends T.TSchema]] ? S.TOmitDeferred<Type, Indexer> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['Parameters', [infer Type extends T.TSchema]] ? C.TParametersDeferred<Type> : [ | ||
| ] extends ['Parameters', [infer Type extends T.TSchema]] ? S.TParametersDeferred<Type> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['Partial', [infer Type extends T.TSchema]] ? C.TPartialDeferred<Type> : [ | ||
| ] extends ['Partial', [infer Type extends T.TSchema]] ? S.TPartialDeferred<Type> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['Pick', [infer Type extends T.TSchema, infer Indexer extends T.TSchema]] ? C.TPickDeferred<Type, Indexer> : [ | ||
| ] extends ['Pick', [infer Type extends T.TSchema, infer Indexer extends T.TSchema]] ? S.TPickDeferred<Type, Indexer> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['Readonly', [infer Type extends T.TSchema]] ? C.TReadonlyObjectDeferred<Type> : [ | ||
| ] extends ['Readonly', [infer Type extends T.TSchema]] ? S.TReadonlyObjectDeferred<Type> : [ | ||
| Target, | ||
@@ -71,12 +71,12 @@ Parameters | ||
| Parameters | ||
| ] extends ['Required', [infer Type extends T.TSchema]] ? C.TRequiredDeferred<Type> : [ | ||
| ] extends ['Required', [infer Type extends T.TSchema]] ? S.TRequiredDeferred<Type> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['ReturnType', [infer Type extends T.TSchema]] ? C.TReturnTypeDeferred<Type> : [ | ||
| ] extends ['ReturnType', [infer Type extends T.TSchema]] ? S.TReturnTypeDeferred<Type> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['Uncapitalize', [infer Type extends T.TSchema]] ? C.TUncapitalizeDeferred<Type> : [ | ||
| ] extends ['Uncapitalize', [infer Type extends T.TSchema]] ? S.TUncapitalizeDeferred<Type> : [ | ||
| Target, | ||
| Parameters | ||
| ] extends ['Uppercase', [infer Type extends T.TSchema]] ? C.TUppercaseDeferred<Type> : T.TCallConstruct<T.TRef<Target>, Parameters>); | ||
| ] extends ['Uppercase', [infer Type extends T.TSchema]] ? S.TUppercaseDeferred<Type> : T.TCallConstruct<T.TRef<Target>, Parameters>); | ||
| type TDelimitedDecode<Input extends ([unknown, unknown] | unknown)[], Result extends unknown[] = []> = (Input extends [infer Left, ...infer Right] ? Left extends [infer Item, infer _] ? TDelimitedDecode<Right, [...Result, Item]> : TDelimitedDecode<Right, [...Result, Left]> : Result); | ||
@@ -166,6 +166,6 @@ type TDelimited<Input extends [unknown, unknown]> = Input extends [infer Left extends unknown[], infer Right extends unknown[]] ? TDelimitedDecode<[...Left, ...Right]> : []; | ||
| export declare function WithMapping(input: [unknown, unknown] | []): unknown; | ||
| type TFactorIndexArray<Type extends T.TSchema, IndexArray extends unknown[]> = (IndexArray extends [infer Left extends T.TSchema[], ...infer Right extends unknown[]] ? (Left extends [infer Indexer extends T.TSchema] ? TFactorIndexArray<C.TIndexDeferred<Type, Indexer>, Right> : Left extends [] ? TFactorIndexArray<T.TArray<Type>, Right> : T.TNever) : Type); | ||
| type TFactorExtends<Type extends T.TSchema, Extends extends unknown[]> = (Extends extends [infer Right extends T.TSchema, infer True extends T.TSchema, infer False extends T.TSchema] ? C.TConditionalDeferred<Type, Right, True, False> : Type); | ||
| type TFactorWith<Type extends T.TSchema, With extends unknown> = (With extends Record<PropertyKey, unknown> ? C.TWithDeferred<Type, With> : Type); | ||
| export type TFactorMapping<Input extends [unknown, unknown, unknown, unknown, unknown]> = (Input extends [infer KeyOf extends boolean, infer Type extends T.TSchema, infer IndexArray extends unknown[], infer Extend extends unknown[], infer WithClause extends unknown] ? TFactorWith<KeyOf extends true ? TFactorExtends<C.TKeyOfDeferred<TFactorIndexArray<Type, IndexArray>>, Extend> : TFactorExtends<TFactorIndexArray<Type, IndexArray>, Extend>, WithClause> : never); | ||
| type TFactorIndexArray<Type extends T.TSchema, IndexArray extends unknown[]> = (IndexArray extends [infer Left extends T.TSchema[], ...infer Right extends unknown[]] ? (Left extends [infer Indexer extends T.TSchema] ? TFactorIndexArray<S.TIndexDeferred<Type, Indexer>, Right> : Left extends [] ? TFactorIndexArray<T.TArray<Type>, Right> : T.TNever) : Type); | ||
| type TFactorExtends<Type extends T.TSchema, Extends extends unknown[]> = (Extends extends [infer Right extends T.TSchema, infer True extends T.TSchema, infer False extends T.TSchema] ? S.TConditionalDeferred<Type, Right, True, False> : Type); | ||
| type TFactorWith<Type extends T.TSchema, With extends unknown> = (With extends Record<PropertyKey, unknown> ? S.TWithDeferred<Type, With> : Type); | ||
| export type TFactorMapping<Input extends [unknown, unknown, unknown, unknown, unknown]> = (Input extends [infer KeyOf extends boolean, infer Type extends T.TSchema, infer IndexArray extends unknown[], infer Extend extends unknown[], infer WithClause extends unknown] ? TFactorWith<KeyOf extends true ? TFactorExtends<S.TKeyOfDeferred<TFactorIndexArray<Type, IndexArray>>, Extend> : TFactorExtends<TFactorIndexArray<Type, IndexArray>, Extend>, WithClause> : never); | ||
| export declare function FactorMapping(input: [unknown, unknown, unknown, unknown, unknown]): unknown; | ||
@@ -181,3 +181,3 @@ type TExprBinaryMapping<Left extends T.TSchema, Rest extends unknown[]> = (Rest extends [infer Operator extends unknown, infer Right extends T.TSchema, infer Next extends unknown[]] ? (TExprBinaryMapping<Right, Next> extends infer Schema extends T.TSchema ? (Operator extends '&' ? (Schema extends T.TIntersect<infer Types extends T.TSchema[]> ? T.TIntersect<[Left, ...Types]> : T.TIntersect<[Left, Schema]>) : Operator extends '|' ? (Schema extends T.TUnion<infer Types extends T.TSchema[]> ? T.TUnion<[Left, ...Types]> : T.TUnion<[Left, Schema]>) : never) : never) : Left); | ||
| export declare function ExprMapping(input: [unknown, unknown]): unknown; | ||
| export type TExprReadonlyMapping<Input extends [unknown, unknown]> = (Input extends ['readonly', infer Type extends T.TSchema] ? T.TImmutableAdd<Type> : never); | ||
| export type TExprReadonlyMapping<Input extends [unknown, unknown]> = (Input extends ['readonly', infer Type extends T.TSchema] ? S.TAddImmutableDeferred<Type> : never); | ||
| export declare function ExprReadonlyMapping(input: [unknown, unknown]): unknown; | ||
@@ -210,9 +210,9 @@ export type TExprPipeMapping<Input extends [unknown, unknown]> = (Input extends ['|', infer Type extends T.TSchema] ? Type : never); | ||
| IsOptional | ||
| ] extends [true, true] ? T.TReadonlyAdd<T.TOptionalAdd<Type>> : [ | ||
| ] extends [true, true] ? S.TAddReadonlyDeferred<S.TAddOptionalDeferred<Type>> : [ | ||
| IsReadonly, | ||
| IsOptional | ||
| ] extends [true, false] ? T.TReadonlyAdd<Type> : [ | ||
| ] extends [true, false] ? S.TAddReadonlyDeferred<Type> : [ | ||
| IsReadonly, | ||
| IsOptional | ||
| ] extends [false, true] ? T.TOptionalAdd<Type> : Type); | ||
| ] extends [false, true] ? S.TAddOptionalDeferred<Type> : Type); | ||
| } : never); | ||
@@ -237,9 +237,9 @@ export declare function PropertyMapping(input: [unknown, unknown, unknown, unknown, unknown]): unknown; | ||
| export declare function _Object_Mapping(input: unknown): unknown; | ||
| export type TElementNamedMapping<Input extends [unknown, unknown, unknown, unknown, unknown] | [unknown, unknown, unknown, unknown] | [unknown, unknown, unknown]> = (Input extends [string, '?', ':', 'readonly', infer Type extends T.TSchema] ? T.TReadonlyAdd<T.TOptionalAdd<Type>> : Input extends [string, /**/ ':', 'readonly', infer Type extends T.TSchema] ? T.TReadonlyAdd<Type> : Input extends [string, '?', ':', /* */ infer Type extends T.TSchema] ? T.TOptionalAdd<Type> : Input extends [string, /**/ ':', /* */ infer Type extends T.TSchema] ? Type : never); | ||
| export type TElementNamedMapping<Input extends [unknown, unknown, unknown, unknown, unknown] | [unknown, unknown, unknown, unknown] | [unknown, unknown, unknown]> = (Input extends [string, '?', ':', 'readonly', infer Type extends T.TSchema] ? S.TAddReadonlyDeferred<S.TAddOptionalDeferred<Type>> : Input extends [string, /**/ ':', 'readonly', infer Type extends T.TSchema] ? S.TAddReadonlyDeferred<Type> : Input extends [string, '?', ':', /* */ infer Type extends T.TSchema] ? S.TAddOptionalDeferred<Type> : Input extends [string, /**/ ':', /* */ infer Type extends T.TSchema] ? Type : never); | ||
| export declare function ElementNamedMapping(input: [unknown, unknown, unknown, unknown, unknown] | [unknown, unknown, unknown, unknown] | [unknown, unknown, unknown]): unknown; | ||
| export type TElementReadonlyOptionalMapping<Input extends [unknown, unknown, unknown]> = (Input extends ['readonly', infer Type extends T.TSchema, '?'] ? T.TReadonlyAdd<T.TOptionalAdd<Type>> : never); | ||
| export type TElementReadonlyOptionalMapping<Input extends [unknown, unknown, unknown]> = (Input extends ['readonly', infer Type extends T.TSchema, '?'] ? S.TAddReadonlyDeferred<S.TAddOptionalDeferred<Type>> : never); | ||
| export declare function ElementReadonlyOptionalMapping(input: [unknown, unknown, unknown]): unknown; | ||
| export type TElementReadonlyMapping<Input extends [unknown, unknown]> = (Input extends ['readonly', infer Type extends T.TSchema] ? T.TReadonlyAdd<Type> : never); | ||
| export type TElementReadonlyMapping<Input extends [unknown, unknown]> = (Input extends ['readonly', infer Type extends T.TSchema] ? S.TAddReadonlyDeferred<Type> : never); | ||
| export declare function ElementReadonlyMapping(input: [unknown, unknown]): unknown; | ||
| export type TElementOptionalMapping<Input extends [unknown, unknown]> = (Input extends [infer Type extends T.TSchema, '?'] ? T.TOptionalAdd<Type> : never); | ||
| export type TElementOptionalMapping<Input extends [unknown, unknown]> = (Input extends [infer Type extends T.TSchema, '?'] ? S.TAddOptionalDeferred<Type> : never); | ||
| export declare function ElementOptionalMapping(input: [unknown, unknown]): unknown; | ||
@@ -254,7 +254,7 @@ export type TElementBaseMapping<Input extends unknown> = (Input); | ||
| export declare function _Tuple_Mapping(input: [unknown, unknown, unknown]): unknown; | ||
| export type TParameterReadonlyOptionalMapping<Input extends [unknown, unknown, unknown, unknown, unknown]> = (Input extends [string, '?', ':', 'readonly', infer Type extends T.TSchema] ? T.TReadonlyAdd<T.TOptionalAdd<Type>> : never); | ||
| export type TParameterReadonlyOptionalMapping<Input extends [unknown, unknown, unknown, unknown, unknown]> = (Input extends [string, '?', ':', 'readonly', infer Type extends T.TSchema] ? S.TAddReadonlyDeferred<S.TAddOptionalDeferred<Type>> : never); | ||
| export declare function ParameterReadonlyOptionalMapping(input: [unknown, unknown, unknown, unknown, unknown]): unknown; | ||
| export type TParameterReadonlyMapping<Input extends [unknown, unknown, unknown, unknown]> = (Input extends [string, ':', 'readonly', infer Type extends T.TSchema] ? T.TReadonlyAdd<Type> : never); | ||
| export type TParameterReadonlyMapping<Input extends [unknown, unknown, unknown, unknown]> = (Input extends [string, ':', 'readonly', infer Type extends T.TSchema] ? S.TAddReadonlyDeferred<Type> : never); | ||
| export declare function ParameterReadonlyMapping(input: [unknown, unknown, unknown, unknown]): unknown; | ||
| export type TParameterOptionalMapping<Input extends [unknown, unknown, unknown, unknown]> = (Input extends [string, '?', ':', infer Type extends T.TSchema] ? T.TOptionalAdd<Type> : never); | ||
| export type TParameterOptionalMapping<Input extends [unknown, unknown, unknown, unknown]> = (Input extends [string, '?', ':', infer Type extends T.TSchema] ? S.TAddOptionalDeferred<Type> : never); | ||
| export declare function ParameterOptionalMapping(input: [unknown, unknown, unknown, unknown]): unknown; | ||
@@ -274,6 +274,6 @@ export type TParameterTypeMapping<Input extends [unknown, unknown, unknown]> = (Input extends [string, ':', infer Type extends T.TSchema] ? Type : never); | ||
| type TModifierOperation = 'add' | 'remove' | 'none'; | ||
| type TApplyReadonly<Readonly extends TModifierOperation, Type extends T.TSchema> = (Readonly extends 'remove' ? C.TReadonlyRemoveAction<Type> : Readonly extends 'add' ? C.TReadonlyAddAction<Type> : Type); | ||
| type TApplyReadonly<Readonly extends TModifierOperation, Type extends T.TSchema> = (Readonly extends 'remove' ? S.TRemoveReadonlyDeferred<Type> : Readonly extends 'add' ? S.TAddReadonlyDeferred<Type> : Type); | ||
| export type TMappedReadonlyMapping<Input extends [unknown, unknown] | [unknown] | []> = (Input extends ['-', 'readonly'] ? 'remove' : Input extends ['+', 'readonly'] ? 'add' : Input extends ['readonly'] ? 'add' : 'none'); | ||
| export declare function MappedReadonlyMapping(input: [unknown, unknown] | [unknown] | []): unknown; | ||
| type TApplyOptional<Optional extends TModifierOperation, Type extends T.TSchema> = (Optional extends 'remove' ? C.TOptionalRemoveAction<Type> : Optional extends 'add' ? C.TOptionalAddAction<Type> : Type); | ||
| type TApplyOptional<Optional extends TModifierOperation, Type extends T.TSchema> = (Optional extends 'remove' ? S.TRemoveOptionalDeferred<Type> : Optional extends 'add' ? S.TAddOptionalDeferred<Type> : Type); | ||
| export type TMappedOptionalMapping<Input extends [unknown, unknown] | [unknown] | []> = (Input extends ['-', '?'] ? 'remove' : Input extends ['+', '?'] ? 'add' : Input extends ['?'] ? 'add' : 'none'); | ||
@@ -283,3 +283,3 @@ export declare function MappedOptionalMapping(input: [unknown, unknown] | [unknown] | []): unknown; | ||
| export declare function MappedAsMapping(input: [unknown, unknown] | []): unknown; | ||
| export type T_Mapped_Mapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown]> = (Input extends ['{', infer Readonly extends TModifierOperation, '[', infer Key extends string, 'in', infer Type extends T.TSchema, infer As extends T.TSchema[], ']', infer Optional extends TModifierOperation, ':', infer Property extends T.TSchema, null, '}'] ? (As extends [infer As extends T.TSchema] ? C.TMappedDeferred<T.TIdentifier<Key>, Type, As, TApplyReadonly<Readonly, TApplyOptional<Optional, Property>>> : C.TMappedDeferred<T.TIdentifier<Key>, Type, T.TRef<Key>, TApplyReadonly<Readonly, TApplyOptional<Optional, Property>>>) : never); | ||
| export type T_Mapped_Mapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown]> = (Input extends ['{', infer Readonly extends TModifierOperation, '[', infer Key extends string, 'in', infer Type extends T.TSchema, infer As extends T.TSchema[], ']', infer Optional extends TModifierOperation, ':', infer Property extends T.TSchema, null, '}'] ? (As extends [infer As extends T.TSchema] ? S.TMappedDeferred<T.TIdentifier<Key>, Type, As, TApplyReadonly<Readonly, TApplyOptional<Optional, Property>>> : S.TMappedDeferred<T.TIdentifier<Key>, Type, T.TRef<Key>, TApplyReadonly<Readonly, TApplyOptional<Optional, Property>>>) : never); | ||
| export declare function _Mapped_Mapping(input: [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown]): unknown; | ||
@@ -343,7 +343,7 @@ export type TReferenceMapping<Input extends string, Result extends T.TSchema = T.TRef<Input>> = Result; | ||
| export type TInterfaceDeclarationGenericMapping<Input extends [unknown, unknown, unknown, unknown, unknown]> = (Input extends ['interface', infer Name extends string, infer Parameters extends T.TParameter[], infer Heritage extends T.TSchema[], infer Properties extends [T.TProperties, T.TProperties]] ? { | ||
| [_ in Name]: T.TGeneric<Parameters, C.TInterfaceDeferred<Heritage, Properties[0]>>; | ||
| [_ in Name]: T.TGeneric<Parameters, S.TInterfaceDeferred<Heritage, Properties[0]>>; | ||
| } : never); | ||
| export declare function InterfaceDeclarationGenericMapping(input: [unknown, unknown, unknown, unknown, unknown]): unknown; | ||
| export type TInterfaceDeclarationMapping<Input extends [unknown, unknown, unknown, unknown]> = (Input extends ['interface', infer Name extends string, infer Heritage extends T.TSchema[], infer Properties extends [T.TProperties, T.TProperties]] ? { | ||
| [_ in Name]: C.TInterfaceDeferred<Heritage, Properties[0]>; | ||
| [_ in Name]: S.TInterfaceDeferred<Heritage, Properties[0]>; | ||
| } : never); | ||
@@ -367,3 +367,3 @@ export declare function InterfaceDeclarationMapping(input: [unknown, unknown, unknown, unknown]): unknown; | ||
| export declare function ModuleDeclarationMapping(input: [unknown, unknown, unknown]): unknown; | ||
| export type TModuleMapping<Input extends [unknown, unknown]> = (Input extends [infer ModuleDeclaration extends T.TProperties, infer ModuleDeclarationList extends [T.TProperties, T.TProperties]] ? C.TModuleDeferred<Memory.TAssign<ModuleDeclaration, ModuleDeclarationList[0]>> : never); | ||
| export type TModuleMapping<Input extends [unknown, unknown]> = (Input extends [infer ModuleDeclaration extends T.TProperties, infer ModuleDeclarationList extends [T.TProperties, T.TProperties]] ? S.TModuleDeferred<Memory.TAssign<ModuleDeclaration, ModuleDeclarationList[0]>> : never); | ||
| export declare function ModuleMapping(input: [unknown, unknown]): unknown; | ||
@@ -370,0 +370,0 @@ export type TScriptMapping<Input extends unknown> = (Input); |
@@ -5,4 +5,4 @@ // deno-fmt-ignore-file | ||
| import { Guard } from '../../guard/index.mjs'; | ||
| import * as C from '../action/index.mjs'; | ||
| import * as T from '../types/index.mjs'; | ||
| import * as S from '../action/index.mjs'; | ||
| function IntrinsicOrCall(ref, parameters) { | ||
@@ -16,23 +16,23 @@ // deno-coverage-ignore-start | ||
| Guard.IsEqual(ref, 'Promise') ? T.Promise(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Awaited') ? C.AwaitedDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Capitalize') ? C.CapitalizeDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'ConstructorParameters') ? C.ConstructorParametersDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Evaluate') ? C.EvaluateDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Exclude') ? C.ExcludeDeferred(parameters[0], parameters[1]) : | ||
| Guard.IsEqual(ref, 'Extract') ? C.ExtractDeferred(parameters[0], parameters[1]) : | ||
| Guard.IsEqual(ref, 'Index') ? C.IndexDeferred(parameters[0], parameters[1]) : | ||
| Guard.IsEqual(ref, 'InstanceType') ? C.InstanceTypeDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Lowercase') ? C.LowercaseDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'NonNullable') ? C.NonNullableDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Omit') ? C.OmitDeferred(parameters[0], parameters[1]) : | ||
| Guard.IsEqual(ref, 'Parameters') ? C.ParametersDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Partial') ? C.PartialDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Pick') ? C.PickDeferred(parameters[0], parameters[1]) : | ||
| Guard.IsEqual(ref, 'Readonly') ? C.ReadonlyObjectDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'KeyOf') ? C.KeyOfDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Awaited') ? S.AwaitedDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Capitalize') ? S.CapitalizeDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'ConstructorParameters') ? S.ConstructorParametersDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Evaluate') ? S.EvaluateDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Exclude') ? S.ExcludeDeferred(parameters[0], parameters[1]) : | ||
| Guard.IsEqual(ref, 'Extract') ? S.ExtractDeferred(parameters[0], parameters[1]) : | ||
| Guard.IsEqual(ref, 'Index') ? S.IndexDeferred(parameters[0], parameters[1]) : | ||
| Guard.IsEqual(ref, 'InstanceType') ? S.InstanceTypeDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Lowercase') ? S.LowercaseDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'NonNullable') ? S.NonNullableDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Omit') ? S.OmitDeferred(parameters[0], parameters[1]) : | ||
| Guard.IsEqual(ref, 'Parameters') ? S.ParametersDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Partial') ? S.PartialDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Pick') ? S.PickDeferred(parameters[0], parameters[1]) : | ||
| Guard.IsEqual(ref, 'Readonly') ? S.ReadonlyObjectDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'KeyOf') ? S.KeyOfDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Record') ? T.RecordDeferred(parameters[0], parameters[1]) : | ||
| Guard.IsEqual(ref, 'Required') ? C.RequiredDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'ReturnType') ? C.ReturnTypeDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Uncapitalize') ? C.UncapitalizeDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Uppercase') ? C.UppercaseDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Required') ? S.RequiredDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'ReturnType') ? S.ReturnTypeDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Uncapitalize') ? S.UncapitalizeDeferred(parameters[0]) : | ||
| Guard.IsEqual(ref, 'Uppercase') ? S.UppercaseDeferred(parameters[0]) : | ||
| T.CallConstruct(T.Ref(ref), parameters)); | ||
@@ -194,3 +194,3 @@ // deno-coverage-ignore-stop | ||
| const _left = left; | ||
| return (Guard.IsEqual(_left.length, 1) ? C.IndexDeferred(result, _left[0]) : | ||
| return (Guard.IsEqual(_left.length, 1) ? S.IndexDeferred(result, _left[0]) : | ||
| Guard.IsEqual(_left.length, 0) ? T.Array(result) : | ||
@@ -203,3 +203,3 @@ Unreachable()); | ||
| return Guard.IsEqual(extend.length, 3) | ||
| ? C.ConditionalDeferred(type, extend[0], extend[1], extend[2]) | ||
| ? S.ConditionalDeferred(type, extend[0], extend[1], extend[2]) | ||
| : type; | ||
@@ -210,3 +210,3 @@ } | ||
| ? type | ||
| : C.WithDeferred(type, withClause); | ||
| : S.WithDeferred(type, withClause); | ||
| } | ||
@@ -216,3 +216,3 @@ export function FactorMapping(input) { | ||
| return FactorWith(keyOf | ||
| ? FactorExtends(C.KeyOfDeferred(FactorIndexArray(type, indexArray)), extend) | ||
| ? FactorExtends(S.KeyOfDeferred(FactorIndexArray(type, indexArray)), extend) | ||
| : FactorExtends(FactorIndexArray(type, indexArray), extend), withClause); | ||
@@ -253,3 +253,3 @@ } | ||
| export function ExprReadonlyMapping(input) { | ||
| return T.ImmutableAdd(input[1]); | ||
| return S.AddImmutableDeferred(input[1]); | ||
| } | ||
@@ -300,5 +300,5 @@ export function ExprPipeMapping(input) { | ||
| return { | ||
| [key]: (isReadonly && isOptional ? T.ReadonlyAdd(T.OptionalAdd(type)) : | ||
| isReadonly && !isOptional ? T.ReadonlyAdd(type) : | ||
| !isReadonly && isOptional ? T.OptionalAdd(type) : | ||
| [key]: (isReadonly && isOptional ? S.AddReadonlyDeferred(S.AddOptionalDeferred(type)) : | ||
| isReadonly && !isOptional ? S.AddReadonlyDeferred(type) : | ||
| !isReadonly && isOptional ? S.AddOptionalDeferred(type) : | ||
| type) | ||
@@ -332,15 +332,15 @@ }; | ||
| export function ElementNamedMapping(input) { | ||
| return (Guard.IsEqual(input.length, 5) ? T.ReadonlyAdd(T.OptionalAdd(input[4])) : | ||
| return (Guard.IsEqual(input.length, 5) ? S.AddReadonlyDeferred(S.AddOptionalDeferred(input[4])) : | ||
| Guard.IsEqual(input.length, 3) ? input[2] : | ||
| Guard.IsEqual(input.length, 4) ? (Guard.IsEqual(input[2], 'readonly') ? T.ReadonlyAdd(input[3]) : T.OptionalAdd(input[3])) : | ||
| Guard.IsEqual(input.length, 4) ? (Guard.IsEqual(input[2], 'readonly') ? S.AddReadonlyDeferred(input[3]) : S.AddOptionalDeferred(input[3])) : | ||
| Unreachable()); | ||
| } | ||
| export function ElementReadonlyOptionalMapping(input) { | ||
| return T.ReadonlyAdd(T.OptionalAdd(input[1])); | ||
| return S.AddReadonlyDeferred(S.AddOptionalDeferred(input[1])); | ||
| } | ||
| export function ElementReadonlyMapping(input) { | ||
| return T.ReadonlyAdd(input[1]); | ||
| return S.AddReadonlyDeferred(input[1]); | ||
| } | ||
| export function ElementOptionalMapping(input) { | ||
| return T.OptionalAdd(input[0]); | ||
| return S.AddOptionalDeferred(input[0]); | ||
| } | ||
@@ -363,9 +363,9 @@ export function ElementBaseMapping(input) { | ||
| export function ParameterReadonlyOptionalMapping(input) { | ||
| return T.ReadonlyAdd(T.OptionalAdd(input[4])); | ||
| return S.AddReadonlyDeferred(S.AddOptionalDeferred(input[4])); | ||
| } | ||
| export function ParameterReadonlyMapping(input) { | ||
| return T.ReadonlyAdd(input[3]); | ||
| return S.AddReadonlyDeferred(input[3]); | ||
| } | ||
| export function ParameterOptionalMapping(input) { | ||
| return T.OptionalAdd(input[3]); | ||
| return S.AddOptionalDeferred(input[3]); | ||
| } | ||
@@ -394,4 +394,4 @@ export function ParameterTypeMapping(input) { | ||
| function ApplyReadonly(state, type) { | ||
| return (Guard.IsEqual(state, 'remove') ? C.ReadonlyRemoveAction(type) : | ||
| Guard.IsEqual(state, 'add') ? C.ReadonlyAddAction(type) : | ||
| return (Guard.IsEqual(state, 'remove') ? S.RemoveReadonlyDeferred(type) : | ||
| Guard.IsEqual(state, 'add') ? S.AddReadonlyDeferred(type) : | ||
| type); | ||
@@ -406,4 +406,4 @@ } | ||
| function ApplyOptional(state, type) { | ||
| return (Guard.IsEqual(state, 'remove') ? C.OptionalRemoveAction(type) : | ||
| Guard.IsEqual(state, 'add') ? C.OptionalAddAction(type) : | ||
| return (Guard.IsEqual(state, 'remove') ? S.RemoveOptionalDeferred(type) : | ||
| Guard.IsEqual(state, 'add') ? S.AddOptionalDeferred(type) : | ||
| type); | ||
@@ -422,4 +422,4 @@ } | ||
| return (Guard.IsArray(input[6]) && Guard.IsEqual(input[6].length, 1) | ||
| ? C.MappedDeferred(T.Identifier(input[3]), input[5], input[6][0], ApplyReadonly(input[1], ApplyOptional(input[8], input[10]))) | ||
| : C.MappedDeferred(T.Identifier(input[3]), input[5], T.Ref(input[3]), ApplyReadonly(input[1], ApplyOptional(input[8], input[10])))); | ||
| ? S.MappedDeferred(T.Identifier(input[3]), input[5], input[6][0], ApplyReadonly(input[1], ApplyOptional(input[8], input[10]))) | ||
| : S.MappedDeferred(T.Identifier(input[3]), input[5], T.Ref(input[3]), ApplyReadonly(input[1], ApplyOptional(input[8], input[10])))); | ||
| } | ||
@@ -513,3 +513,3 @@ export function ReferenceMapping(input) { | ||
| const options = Guard.IsEqual(Guard.Keys(patternProperties).length, 0) ? {} : { patternProperties }; | ||
| return { [input[1]]: T.Generic(parameters, C.InterfaceDeferred(heritage, properties, options)) }; | ||
| return { [input[1]]: T.Generic(parameters, S.InterfaceDeferred(heritage, properties, options)) }; | ||
| } | ||
@@ -520,3 +520,3 @@ export function InterfaceDeclarationMapping(input) { | ||
| const options = Guard.IsEqual(Guard.Keys(patternProperties).length, 0) ? {} : { patternProperties }; | ||
| return { [input[1]]: C.InterfaceDeferred(heritage, properties, options) }; | ||
| return { [input[1]]: S.InterfaceDeferred(heritage, properties, options) }; | ||
| } | ||
@@ -544,3 +544,3 @@ export function TypeAliasDeclarationGenericMapping(input) { | ||
| const moduleDeclarationList = input[1]; | ||
| return C.ModuleDeferred(Memory.Assign(moduleDeclaration, moduleDeclarationList[0])); | ||
| return S.ModuleDeferred(Memory.Assign(moduleDeclaration, moduleDeclarationList[0])); | ||
| } | ||
@@ -547,0 +547,0 @@ export function ScriptMapping(input) { |
| import { type TSchema } from './schema.mjs'; | ||
| /** Removes Immutable from the given type. */ | ||
| export type TImmutableRemove<Type extends TSchema, Result extends TSchema = Type extends TImmutable<infer Type extends TSchema> ? Type : Type> = Result; | ||
| /** Removes Immutable from the given type. */ | ||
| export declare function ImmutableRemove<Type extends TSchema>(type: Type): TImmutableRemove<Type>; | ||
| /** Adds Immutable to the given type. */ | ||
| export type TImmutableAdd<Type extends TSchema = TSchema> = ('~immutable' extends keyof Type ? Type : TImmutable<Type>); | ||
| /** Adds Immutable to the given type. */ | ||
| export declare function ImmutableAdd<Type extends TSchema>(type: Type): TImmutableAdd<Type>; | ||
| import { type TAddImmutable } from '../action/_add_immutable.mjs'; | ||
| export type TImmutable<Type extends TSchema = TSchema> = (Type & { | ||
@@ -14,4 +7,4 @@ '~immutable': true; | ||
| /** Applies an Immutable modifier to the given type. */ | ||
| export declare function Immutable<Type extends TSchema>(type: Type): TImmutableAdd<Type>; | ||
| export declare function Immutable<Type extends TSchema>(type: Type): TAddImmutable<Type>; | ||
| /** Returns true if the given value is a TImmutable */ | ||
| export declare function IsImmutable(value: unknown): value is TImmutable<TSchema>; |
| // deno-fmt-ignore-file | ||
| import { Memory } from '../../system/memory/index.mjs'; | ||
| import { Guard } from '../../guard/index.mjs'; | ||
| import { IsSchema } from './schema.mjs'; | ||
| /** Removes Immutable from the given type. */ | ||
| export function ImmutableRemove(type) { | ||
| return Memory.Discard(type, ['~immutable']); | ||
| } | ||
| /** Adds Immutable to the given type. */ | ||
| export function ImmutableAdd(type) { | ||
| return Memory.Update(type, { '~immutable': true }, {}); | ||
| } | ||
| import { AddImmutable } from '../action/_add_immutable.mjs'; | ||
| // ------------------------------------------------------------------ | ||
@@ -18,3 +10,3 @@ // Factory | ||
| export function Immutable(type) { | ||
| return ImmutableAdd(type); | ||
| return AddImmutable(type); | ||
| } | ||
@@ -21,0 +13,0 @@ // ------------------------------------------------------------------ |
| import { type TSchema } from './schema.mjs'; | ||
| /** Removes Optional from the given type. */ | ||
| export type TOptionalRemove<Type extends TSchema, Result extends TSchema = Type extends TOptional<infer Type extends TSchema> ? Type : Type> = Result; | ||
| /** Removes Optional from the given type. */ | ||
| export declare function OptionalRemove<Type extends TSchema>(type: Type): TOptionalRemove<Type>; | ||
| /** Adds Optional to the given type. */ | ||
| export type TOptionalAdd<Type extends TSchema = TSchema, Result extends TSchema = '~optional' extends keyof Type ? Type : TOptional<Type>> = Result; | ||
| /** Adds Optional to the given type. */ | ||
| export declare function OptionalAdd<Type extends TSchema>(type: Type): TOptionalAdd<Type>; | ||
| import { type TAddOptional } from '../action/_add_optional.mjs'; | ||
| export type TOptional<Type extends TSchema = TSchema> = (Type & { | ||
@@ -14,4 +7,4 @@ '~optional': true; | ||
| /** Applies an Optional modifier to the given type. */ | ||
| export declare function Optional<Type extends TSchema>(type: Type): TOptionalAdd<Type>; | ||
| export declare function Optional<Type extends TSchema>(type: Type): TAddOptional<Type>; | ||
| /** Returns true if the given value is TOptional */ | ||
| export declare function IsOptional(value: unknown): value is TOptional<TSchema>; |
| // deno-fmt-ignore-file | ||
| import { Guard } from '../../guard/index.mjs'; | ||
| import { Memory } from '../../system/memory/index.mjs'; | ||
| import { IsSchema } from './schema.mjs'; | ||
| /** Removes Optional from the given type. */ | ||
| export function OptionalRemove(type) { | ||
| const result = Memory.Discard(type, ['~optional']); | ||
| return result; | ||
| } | ||
| /** Adds Optional to the given type. */ | ||
| export function OptionalAdd(type) { | ||
| return Memory.Update(type, { '~optional': true }, {}); | ||
| } | ||
| import { AddOptional } from '../action/_add_optional.mjs'; | ||
| // ------------------------------------------------------------------ | ||
@@ -19,3 +10,3 @@ // Factory | ||
| export function Optional(type) { | ||
| return OptionalAdd(type); | ||
| return AddOptional(type); | ||
| } | ||
@@ -22,0 +13,0 @@ // ------------------------------------------------------------------ |
| import { type TSchema } from './schema.mjs'; | ||
| /** Removes a Readonly property modifier from the given type. */ | ||
| export type TReadonlyRemove<Type extends TSchema, Result extends TSchema = Type extends TReadonly<infer Type extends TSchema> ? Type : Type> = Result; | ||
| /** Removes a Readonly property modifier from the given type. */ | ||
| export declare function ReadonlyRemove<Type extends TSchema>(type: Type): TReadonlyRemove<Type>; | ||
| /** Adds a Readonly property modifier to the given type. */ | ||
| export type TReadonlyAdd<Type extends TSchema = TSchema> = ('~readonly' extends keyof Type ? Type : TReadonly<Type>); | ||
| /** Adds a Readonly property modifier to the given type. */ | ||
| export declare function ReadonlyAdd<Type extends TSchema>(type: Type): TReadonlyAdd<Type>; | ||
| import { type TAddReadonly } from '../action/_add_readonly.mjs'; | ||
| export type TReadonly<Type extends TSchema = TSchema> = (Type & { | ||
@@ -14,4 +7,4 @@ '~readonly': true; | ||
| /** Applies an Readonly property modifier to the given type. */ | ||
| export declare function Readonly<Type extends TSchema>(type: Type): TReadonlyAdd<Type>; | ||
| export declare function Readonly<Type extends TSchema>(type: Type): TAddReadonly<Type>; | ||
| /** Returns true if the given value is a TReadonly */ | ||
| export declare function IsReadonly(value: unknown): value is TReadonly<TSchema>; |
| // deno-fmt-ignore-file | ||
| import { Memory } from '../../system/memory/index.mjs'; | ||
| import { Guard } from '../../guard/index.mjs'; | ||
| import { IsSchema } from './schema.mjs'; | ||
| /** Removes a Readonly property modifier from the given type. */ | ||
| export function ReadonlyRemove(type) { | ||
| return Memory.Discard(type, ['~readonly']); | ||
| } | ||
| /** Adds a Readonly property modifier to the given type. */ | ||
| export function ReadonlyAdd(type) { | ||
| return Memory.Update(type, { '~readonly': true }, {}); | ||
| } | ||
| import { AddReadonly } from '../action/_add_readonly.mjs'; | ||
| // ------------------------------------------------------------------ | ||
@@ -18,3 +10,3 @@ // Factory | ||
| export function Readonly(type) { | ||
| return ReadonlyAdd(type); | ||
| return AddReadonly(type); | ||
| } | ||
@@ -21,0 +13,0 @@ // ------------------------------------------------------------------ |
@@ -5,2 +5,3 @@ import { type TSchema, type TSchemaOptions } from './schema.mjs'; | ||
| '~kind': 'Deferred'; | ||
| type: 'deferred'; | ||
| action: Action; | ||
@@ -7,0 +8,0 @@ parameters: Types; |
@@ -8,3 +8,3 @@ import { Memory } from '../../system/memory/index.mjs'; | ||
| export function Deferred(action, parameters, options) { | ||
| return Memory.Create({ '~kind': 'Deferred' }, { action, parameters, options }, {}); | ||
| return Memory.Create({ '~kind': 'Deferred' }, { type: 'deferred', action, parameters, options }, {}); | ||
| } | ||
@@ -11,0 +11,0 @@ // ------------------------------------------------------------------ |
+1
-1
| { | ||
| "name": "typebox", | ||
| "description": "Json Schema Type Builder with Static Type Resolution for TypeScript", | ||
| "version": "1.2.3", | ||
| "version": "1.2.4", | ||
| "keywords": [ | ||
@@ -6,0 +6,0 @@ "typescript", |
| import { type TSchema } from '../types/schema.mjs'; | ||
| /** Represents a operation to apply Optional to a property */ | ||
| export interface TOptionalAddAction<Type extends TSchema = TSchema> extends TSchema { | ||
| '~kind': 'OptionalAddAction'; | ||
| type: Type; | ||
| } | ||
| /** Creates an OptionalAddAction. */ | ||
| export declare function OptionalAddAction<Type extends TSchema>(type: Type): TOptionalAddAction<Type>; | ||
| /** Returns true if this value is a OptionalAddAction. */ | ||
| export declare function IsOptionalAddAction(value: unknown): value is TOptionalAddAction; | ||
| /** Represents a operation to remove Optional from a property */ | ||
| export interface TOptionalRemoveAction<Type extends TSchema = TSchema> extends TSchema { | ||
| '~kind': 'OptionalRemoveAction'; | ||
| type: Type; | ||
| } | ||
| /** Creates a OptionalRemoveAction. */ | ||
| export declare function OptionalRemoveAction<Type extends TSchema>(type: Type): TOptionalRemoveAction<Type>; | ||
| /** Returns true if this value is a OptionalRemoveAction. */ | ||
| export declare function IsOptionalRemoveAction(value: unknown): value is TOptionalRemoveAction; |
| // deno-fmt-ignore-file | ||
| import { Memory } from '../../system/memory/index.mjs'; | ||
| import { Guard } from '../../guard/index.mjs'; | ||
| import { IsSchema } from '../types/schema.mjs'; | ||
| // ------------------------------------------------------------------ | ||
| // Action | ||
| // ------------------------------------------------------------------ | ||
| /** Creates an OptionalAddAction. */ | ||
| export function OptionalAddAction(type) { | ||
| return Memory.Create({ ['~kind']: 'OptionalAddAction' }, { type }, {}); | ||
| } | ||
| // ------------------------------------------------------------------ | ||
| // Guard | ||
| // ------------------------------------------------------------------ | ||
| /** Returns true if this value is a OptionalAddAction. */ | ||
| export function IsOptionalAddAction(value) { | ||
| return Guard.IsObject(value) | ||
| && Guard.HasPropertyKey(value, '~kind') | ||
| && Guard.HasPropertyKey(value, 'type') | ||
| && Guard.IsEqual(value['~kind'], 'OptionalAddAction') | ||
| && IsSchema(value.type); | ||
| } | ||
| // ------------------------------------------------------------------ | ||
| // Factory | ||
| // ------------------------------------------------------------------ | ||
| /** Creates a OptionalRemoveAction. */ | ||
| export function OptionalRemoveAction(type) { | ||
| return Memory.Create({ ['~kind']: 'OptionalRemoveAction' }, { type }, {}); | ||
| } | ||
| // ------------------------------------------------------------------ | ||
| // Guard | ||
| // ------------------------------------------------------------------ | ||
| /** Returns true if this value is a OptionalRemoveAction. */ | ||
| export function IsOptionalRemoveAction(value) { | ||
| return Guard.IsObject(value) | ||
| && Guard.HasPropertyKey(value, '~kind') | ||
| && Guard.HasPropertyKey(value, 'type') | ||
| && Guard.IsEqual(value['~kind'], 'OptionalRemoveAction') | ||
| && IsSchema(value.type); | ||
| } |
| import { type TSchema } from '../types/schema.mjs'; | ||
| /** Represents an operation to apply Readonly to a property. */ | ||
| export interface TReadonlyAddAction<Type extends TSchema = TSchema> extends TSchema { | ||
| '~kind': 'ReadonlyAddAction'; | ||
| type: Type; | ||
| } | ||
| /** Creates a ReadonlyAddAction. */ | ||
| export declare function ReadonlyAddAction<Type extends TSchema>(type: Type): TReadonlyAddAction<Type>; | ||
| /** Returns true if this value is a ReadonlyAddAction. */ | ||
| export declare function IsReadonlyAddAction(value: unknown): value is TReadonlyAddAction; | ||
| /** Represents an action to remove Readonly from a property. */ | ||
| export interface TReadonlyRemoveAction<Type extends TSchema = TSchema> extends TSchema { | ||
| '~kind': 'ReadonlyRemoveAction'; | ||
| type: Type; | ||
| } | ||
| /** Creates a ReadonlyRemoveAction. */ | ||
| export declare function ReadonlyRemoveAction<Type extends TSchema>(type: Type): TReadonlyRemoveAction<Type>; | ||
| /** Returns true if this value is a ReadonlyRemoveAction. */ | ||
| export declare function IsReadonlyRemoveAction(value: unknown): value is TReadonlyRemoveAction; |
| // deno-fmt-ignore-file | ||
| import { Memory } from '../../system/memory/index.mjs'; | ||
| import { Guard } from '../../guard/index.mjs'; | ||
| import { IsSchema } from '../types/schema.mjs'; | ||
| // ------------------------------------------------------------------ | ||
| // Action | ||
| // ------------------------------------------------------------------ | ||
| /** Creates a ReadonlyAddAction. */ | ||
| export function ReadonlyAddAction(type) { | ||
| return Memory.Create({ ['~kind']: 'ReadonlyAddAction' }, { type }, {}); | ||
| } | ||
| // ------------------------------------------------------------------ | ||
| // Guard | ||
| // ------------------------------------------------------------------ | ||
| /** Returns true if this value is a ReadonlyAddAction. */ | ||
| export function IsReadonlyAddAction(value) { | ||
| return Guard.IsObject(value) | ||
| && Guard.HasPropertyKey(value, '~kind') | ||
| && Guard.HasPropertyKey(value, 'type') | ||
| && Guard.IsEqual(value['~kind'], 'ReadonlyAddAction') | ||
| && IsSchema(value.type); | ||
| } | ||
| // ------------------------------------------------------------------ | ||
| // Factory | ||
| // ------------------------------------------------------------------ | ||
| /** Creates a ReadonlyRemoveAction. */ | ||
| export function ReadonlyRemoveAction(type) { | ||
| return Memory.Create({ ['~kind']: 'ReadonlyRemoveAction' }, { type }, {}); | ||
| } | ||
| // ------------------------------------------------------------------ | ||
| // Guard | ||
| // ------------------------------------------------------------------ | ||
| /** Returns true if this value is a ReadonlyRemoveAction. */ | ||
| export function IsReadonlyRemoveAction(value) { | ||
| return Guard.IsObject(value) | ||
| && Guard.HasPropertyKey(value, '~kind') | ||
| && Guard.HasPropertyKey(value, 'type') | ||
| && Guard.IsEqual(value['~kind'], 'ReadonlyRemoveAction') | ||
| && IsSchema(value.type); | ||
| } |
1498957
0.85%1415
1.43%17123
0.32%