@strictly/define 0.0.30 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.out/index.d.ts +26 -26
- package/.out/index.js +26 -26
- package/.out/transformers/copies/copy.d.ts +3 -3
- package/.out/transformers/copies/copy.js +1 -1
- package/.out/transformers/copies/{copy_to.d.ts → copyTo.d.ts} +3 -3
- package/.out/transformers/copies/{copy_to.js → copyTo.js} +2 -3
- package/.out/transformers/copies/mobxCopy.d.ts +5 -0
- package/.out/transformers/copies/{mobx_copy.js → mobxCopy.js} +5 -5
- package/.out/transformers/copies/specs/{copy_to.tests.js → copyTo.tests.js} +3 -3
- package/.out/transformers/copies/specs/{mobx_copy.tests.js → mobxCopy.tests.js} +1 -1
- package/.out/transformers/equals.d.ts +2 -2
- package/.out/transformers/equals.js +1 -1
- package/.out/transformers/flatteners/{flatten_accessors_of_type.d.ts → flattenAccessorsOfType.d.ts} +4 -4
- package/.out/transformers/flatteners/{flatten_accessors_of_type.js → flattenAccessorsOfType.js} +1 -1
- package/.out/transformers/flatteners/{flatten_json_value_to_type_paths_of.d.ts → flattenJsonValueToTypePathsOf.d.ts} +2 -2
- package/.out/transformers/flatteners/{flatten_json_value_to_type_paths_of.js → flattenJsonValueToTypePathsOf.js} +1 -1
- package/.out/transformers/flatteners/{flatten_type_to.d.ts → flattenTypeTo.d.ts} +1 -1
- package/.out/transformers/flatteners/{flatten_type_to.js → flattenTypeTo.js} +2 -2
- package/.out/transformers/flatteners/flattenTypesOfType.d.ts +3 -0
- package/.out/transformers/flatteners/{flatten_types_of_type.js → flattenTypesOfType.js} +1 -1
- package/.out/transformers/flatteners/{flatten_validation_errors_of_type.d.ts → flattenValidationErrorsOfType.d.ts} +5 -5
- package/.out/transformers/flatteners/{flatten_validation_errors_of_type.js → flattenValidationErrorsOfType.js} +1 -1
- package/.out/transformers/flatteners/{flatten_validators_of_validating_type.d.ts → flattenValidatorsOfValidatingType.d.ts} +3 -3
- package/.out/transformers/flatteners/{flatten_validators_of_validating_type.js → flattenValidatorsOfValidatingType.js} +1 -1
- package/.out/transformers/flatteners/{flatten_value_to.d.ts → flattenValueTo.d.ts} +5 -5
- package/.out/transformers/flatteners/{flatten_value_to.js → flattenValueTo.js} +2 -2
- package/.out/transformers/flatteners/{flatten_values_of_type.d.ts → flattenValuesOfType.d.ts} +2 -2
- package/.out/transformers/flatteners/{flatten_values_of_type.js → flattenValuesOfType.js} +1 -1
- package/.out/transformers/flatteners/specs/{flatten_accessors_of_type.tests.js → flattenAccessorsOfType.tests.js} +1 -1
- package/.out/transformers/flatteners/specs/{flatten_json_value_to_type_paths_of.tests.js → flattenJsonValueToTypePathsOf.tests.js} +2 -1
- package/.out/transformers/flatteners/specs/{flatten_type_to.tests.js → flattenTypeTo.tests.js} +5 -3
- package/.out/transformers/flatteners/specs/{flatten_types_of_type.tests.js → flattenTypesOfType.tests.js} +1 -1
- package/.out/transformers/flatteners/specs/{flatten_validation_errors_of_type.tests.js → flattenValidationErrorsOfType.tests.js} +1 -1
- package/.out/transformers/flatteners/specs/{flatten_value_to.tests.js → flattenValueTo.tests.js} +2 -1
- package/.out/transformers/flatteners/specs/{flatten_values_of_type.tests.js → flattenValuesOfType.tests.js} +1 -1
- package/.out/transformers/flatteners/specs/{json_paths.tests.js → jsonPaths.tests.js} +1 -1
- package/.out/transformers/flatteners/specs/{value_path_to_type_path.tests.js → valuePathToTypePath.tests.js} +1 -1
- package/.out/transformers/flatteners/{value_path_to_type_path.d.ts → valuePathToTypePath.d.ts} +1 -1
- package/.out/transformers/flatteners/{value_path_to_type_path.js → valuePathToTypePath.js} +1 -1
- package/.out/tsconfig.tsbuildinfo +1 -1
- package/.out/types/{flattened_accessors_of_type.d.ts → FlattenedAccessorsOfType.d.ts} +2 -2
- package/.out/types/{flattened_types_of_type.d.ts → FlattenedTypesOfType.d.ts} +2 -2
- package/.out/types/{flattened_types_of_validating_type.d.ts → FlattenedTypesOfValidatingType.d.ts} +3 -3
- package/.out/types/{flattened_validators_of_validating_type.d.ts → FlattenedValidatorsOfValidatingType.d.ts} +4 -4
- package/.out/types/{flattened_values_of_type.d.ts → FlattenedValuesOfType.d.ts} +3 -3
- package/.out/types/{mobx_value_of_type.d.ts → MobxValueOfType.d.ts} +2 -2
- package/.out/types/{partial_type_of_type.d.ts → PartialTypeOfType.d.ts} +1 -1
- package/.out/types/{paths_of_type.d.ts → PathsOfType.d.ts} +2 -2
- package/.out/types/{readonly_type_of_type.d.ts → ReadonlyTypeOfType.d.ts} +1 -1
- package/.out/types/{strict_definitions.d.ts → StrictType.d.ts} +1 -1
- package/.out/types/{validating_definitions.d.ts → ValidatingType.d.ts} +1 -1
- package/.out/types/{validating_type_def_with_error.d.ts → ValidatingTypeDefWithError.d.ts} +2 -2
- package/.out/types/{value_of_type.d.ts → ValueOfType.d.ts} +1 -1
- package/.out/types/{value_to_type_paths_of_type.d.ts → ValueToTypePathsOfType.d.ts} +3 -3
- package/.out/types/{value_types_of_discriminated_union.d.ts → ValueTypesOfDiscriminatedUnion.d.ts} +3 -3
- package/.out/types/builders.d.ts +5 -5
- package/.out/types/builders.js +26 -4
- package/.out/types/flattened.d.ts +1 -1
- package/.out/types/specs/builder.tests.js +1 -1
- package/.out/types/{type_of_type.d.ts → typeOfType.d.ts} +1 -1
- package/.out/types/{type_of_type.js → typeOfType.js} +1 -1
- package/.out/validation/validator.js +1 -1
- package/.out/validation/validators/specs/{minimum_string_length_validator.tests.js → minimumStringLengthValidator.tests.js} +1 -1
- package/.out/validation/validators/specs/{regexp_validator.tests.js → regexpValidator.tests.js} +1 -1
- package/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-check-types.log +1 -1
- package/.turbo/turbo-release$colon$exports.log +1 -1
- package/dist/index.cjs +56 -33
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +59 -34
- package/index.ts +26 -26
- package/package.json +1 -1
- package/transformers/copies/copy.ts +4 -4
- package/transformers/copies/{copy_to.ts → copyTo.ts} +10 -18
- package/transformers/copies/{mobx_copy.ts → mobxCopy.ts} +11 -12
- package/transformers/copies/specs/{copy_to.tests.ts → copyTo.tests.ts} +4 -4
- package/transformers/copies/specs/{mobx_copy.tests.ts → mobxCopy.tests.ts} +2 -2
- package/transformers/equals.ts +2 -2
- package/transformers/flatteners/{flatten_accessors_of_type.ts → flattenAccessorsOfType.ts} +7 -7
- package/transformers/flatteners/{flatten_json_value_to_type_paths_of.ts → flattenJsonValueToTypePathsOf.ts} +3 -3
- package/transformers/flatteners/{flatten_type_to.ts → flattenTypeTo.ts} +3 -5
- package/transformers/flatteners/{flatten_types_of_type.ts → flattenTypesOfType.ts} +3 -3
- package/transformers/flatteners/{flatten_validation_errors_of_type.ts → flattenValidationErrorsOfType.ts} +8 -8
- package/transformers/flatteners/{flatten_validators_of_validating_type.ts → flattenValidatorsOfValidatingType.ts} +4 -4
- package/transformers/flatteners/{flatten_value_to.ts → flattenValueTo.ts} +10 -10
- package/transformers/flatteners/{flatten_values_of_type.ts → flattenValuesOfType.ts} +4 -4
- package/transformers/flatteners/specs/{flatten_accessors_of_type.tests.ts → flattenAccessorsOfType.tests.ts} +3 -3
- package/transformers/flatteners/specs/{flatten_json_value_to_type_paths_of.tests.ts → flattenJsonValueToTypePathsOf.tests.ts} +2 -1
- package/transformers/flatteners/specs/{flatten_type_to.tests.ts → flattenTypeTo.tests.ts} +5 -3
- package/transformers/flatteners/specs/{flatten_types_of_type.tests.ts → flattenTypesOfType.tests.ts} +1 -1
- package/transformers/flatteners/specs/{flatten_validation_errors_of_type.tests.ts → flattenValidationErrorsOfType.tests.ts} +2 -2
- package/transformers/flatteners/specs/{flatten_value_to.tests.ts → flattenValueTo.tests.ts} +5 -4
- package/transformers/flatteners/specs/{flatten_values_of_type.tests.ts → flattenValuesOfType.tests.ts} +1 -1
- package/transformers/flatteners/specs/{json_paths.tests.ts → jsonPaths.tests.ts} +1 -1
- package/transformers/flatteners/specs/{value_path_to_type_path.tests.ts → valuePathToTypePath.tests.ts} +2 -2
- package/transformers/flatteners/{value_path_to_type_path.ts → valuePathToTypePath.ts} +1 -1
- package/types/{flattened_accessors_of_type.ts → FlattenedAccessorsOfType.ts} +2 -2
- package/types/{flattened_types_of_type.ts → FlattenedTypesOfType.ts} +6 -6
- package/types/{flattened_types_of_validating_type.ts → FlattenedTypesOfValidatingType.ts} +6 -6
- package/types/{flattened_validators_of_validating_type.ts → FlattenedValidatorsOfValidatingType.ts} +4 -4
- package/types/{flattened_values_of_type.ts → FlattenedValuesOfType.ts} +3 -3
- package/types/{mobx_value_of_type.ts → MobxValueOfType.ts} +2 -2
- package/types/{partial_type_of_type.ts → PartialTypeOfType.ts} +1 -1
- package/types/{paths_of_type.ts → PathsOfType.ts} +6 -6
- package/types/{readonly_type_of_type.ts → ReadonlyTypeOfType.ts} +1 -1
- package/types/{strict_definitions.ts → StrictType.ts} +1 -1
- package/types/{validating_definitions.ts → ValidatingType.ts} +1 -1
- package/types/{validating_type_def_with_error.ts → ValidatingTypeDefWithError.ts} +2 -2
- package/types/{value_of_type.ts → ValueOfType.ts} +1 -1
- package/types/{value_to_type_paths_of_type.ts → ValueToTypePathsOfType.ts} +7 -7
- package/types/{value_types_of_discriminated_union.ts → ValueTypesOfDiscriminatedUnion.ts} +3 -3
- package/types/builders.ts +44 -6
- package/types/flattened.ts +1 -1
- package/types/specs/{flattened_accessors_of_type.tests.ts → FlattenedAccessorsOfType.tests.ts} +1 -1
- package/types/specs/{flattened_types_of_type.tests.ts → FlattenedTypesOfType.tests.ts} +2 -2
- package/types/specs/{flattened_validators_of_validating_type.tests.ts → FlattenedValidatorsOfValidatingType.tests.ts} +2 -2
- package/types/specs/{flattened_values_of_type.tests.ts → FlattenedValuesOfType.tests.ts} +1 -1
- package/types/specs/{partial_type_of_type.tests.ts → PartialTypeOfType.tests.ts} +2 -2
- package/types/specs/{paths_of_type.tests.ts → PathsOfType.tests.ts} +1 -1
- package/types/specs/{readonly_type_of_type.tests.ts → ReadonlyTypeOfType.tests.ts} +2 -2
- package/types/specs/{strict_definitions.tests.ts → StrictType.tests.ts} +5 -5
- package/types/specs/{type_of_type.tests.ts → TypeOfType.tests.ts} +2 -2
- package/types/specs/{value_of_type.tests.ts → ValueOfType.tests.ts} +2 -2
- package/types/specs/{value_to_type_paths_of_type.tests.ts → ValueToTypePathsOfType.tests.ts} +2 -2
- package/types/specs/{value_types_of_discriminated_union.tests.ts → ValueTypesOfDiscriminatedUnion.tests.ts} +1 -1
- package/types/specs/builder.tests.ts +2 -2
- package/types/{type_of_type.ts → typeOfType.ts} +1 -1
- package/validation/specs/{errors_of_validators.tests.ts → errorsOfValidators.tests.ts} +1 -1
- package/validation/specs/{validators_of_values.tests.ts → validatorsOfValues.tests.ts} +1 -1
- package/validation/validator.ts +1 -1
- package/validation/validators/specs/{minimum_string_length_validator.tests.ts → minimumStringLengthValidator.tests.ts} +1 -1
- package/validation/validators/specs/{regexp_validator.tests.ts → regexpValidator.tests.ts} +1 -1
- package/.out/transformers/copies/mobx_copy.d.ts +0 -5
- package/.out/transformers/flatteners/flatten_types_of_type.d.ts +0 -3
- /package/.out/transformers/copies/specs/{copy_to.tests.d.ts → copyTo.tests.d.ts} +0 -0
- /package/.out/transformers/copies/specs/{mobx_copy.tests.d.ts → mobxCopy.tests.d.ts} +0 -0
- /package/.out/transformers/flatteners/{json_path.d.ts → jsonPath.d.ts} +0 -0
- /package/.out/transformers/flatteners/{json_path.js → jsonPath.js} +0 -0
- /package/.out/transformers/flatteners/specs/{flatten_accessors_of_type.tests.d.ts → flattenAccessorsOfType.tests.d.ts} +0 -0
- /package/.out/transformers/flatteners/specs/{flatten_json_value_to_type_paths_of.tests.d.ts → flattenJsonValueToTypePathsOf.tests.d.ts} +0 -0
- /package/.out/transformers/flatteners/specs/{flatten_type_to.tests.d.ts → flattenTypeTo.tests.d.ts} +0 -0
- /package/.out/transformers/flatteners/specs/{flatten_types_of_type.tests.d.ts → flattenTypesOfType.tests.d.ts} +0 -0
- /package/.out/transformers/flatteners/specs/{flatten_validation_errors_of_type.tests.d.ts → flattenValidationErrorsOfType.tests.d.ts} +0 -0
- /package/.out/transformers/flatteners/specs/{flatten_value_to.tests.d.ts → flattenValueTo.tests.d.ts} +0 -0
- /package/.out/transformers/flatteners/specs/{flatten_values_of_type.tests.d.ts → flattenValuesOfType.tests.d.ts} +0 -0
- /package/.out/transformers/flatteners/specs/{json_paths.tests.d.ts → jsonPaths.tests.d.ts} +0 -0
- /package/.out/transformers/flatteners/specs/{value_path_to_type_path.tests.d.ts → valuePathToTypePath.tests.d.ts} +0 -0
- /package/.out/types/{flattened_accessors_of_type.js → FlattenedAccessorsOfType.js} +0 -0
- /package/.out/types/{flattened_types_of_type.js → FlattenedTypesOfType.js} +0 -0
- /package/.out/types/{flattened_types_of_validating_type.js → FlattenedTypesOfValidatingType.js} +0 -0
- /package/.out/types/{flattened_validators_of_validating_type.js → FlattenedValidatorsOfValidatingType.js} +0 -0
- /package/.out/types/{flattened_values_of_type.js → FlattenedValuesOfType.js} +0 -0
- /package/.out/types/{mobx_value_of_type.js → MobxValueOfType.js} +0 -0
- /package/.out/types/{partial_type_of_type.js → PartialTypeOfType.js} +0 -0
- /package/.out/types/{path_of.d.ts → PathOf.d.ts} +0 -0
- /package/.out/types/{path_of.js → PathOf.js} +0 -0
- /package/.out/types/{paths_of_type.js → PathsOfType.js} +0 -0
- /package/.out/types/{readonly_type_of_type.js → ReadonlyTypeOfType.js} +0 -0
- /package/.out/types/{specs/flattened_accessors_of_type.tests.d.ts → StrictType.js} +0 -0
- /package/.out/types/{definitions.d.ts → Type.d.ts} +0 -0
- /package/.out/types/{definitions.js → Type.js} +0 -0
- /package/.out/types/{specs/flattened_types_of_type.tests.d.ts → ValidatingType.js} +0 -0
- /package/.out/types/{specs/flattened_validators_of_validating_type.tests.d.ts → ValidatingTypeDefWithError.js} +0 -0
- /package/.out/types/{specs/flattened_values_of_type.tests.d.ts → ValueOfType.js} +0 -0
- /package/.out/types/{specs/partial_type_of_type.tests.d.ts → ValueToTypePathsOfType.js} +0 -0
- /package/.out/types/{specs/paths_of_type.tests.d.ts → ValueTypesOfDiscriminatedUnion.js} +0 -0
- /package/.out/types/specs/{readonly_type_of_type.tests.d.ts → FlattenedAccessorsOfType.tests.d.ts} +0 -0
- /package/.out/types/specs/{flattened_accessors_of_type.tests.js → FlattenedAccessorsOfType.tests.js} +0 -0
- /package/.out/types/specs/{strict_definitions.tests.d.ts → FlattenedTypesOfType.tests.d.ts} +0 -0
- /package/.out/types/specs/{flattened_types_of_type.tests.js → FlattenedTypesOfType.tests.js} +0 -0
- /package/.out/types/specs/{type_of_type.tests.d.ts → FlattenedValidatorsOfValidatingType.tests.d.ts} +0 -0
- /package/.out/types/specs/{flattened_validators_of_validating_type.tests.js → FlattenedValidatorsOfValidatingType.tests.js} +0 -0
- /package/.out/types/specs/{value_of_type.tests.d.ts → FlattenedValuesOfType.tests.d.ts} +0 -0
- /package/.out/types/specs/{flattened_values_of_type.tests.js → FlattenedValuesOfType.tests.js} +0 -0
- /package/.out/types/specs/{value_to_type_paths_of_type.tests.d.ts → PartialTypeOfType.tests.d.ts} +0 -0
- /package/.out/types/specs/{partial_type_of_type.tests.js → PartialTypeOfType.tests.js} +0 -0
- /package/.out/types/specs/{value_types_of_discriminated_union.tests.d.ts → PathsOfType.tests.d.ts} +0 -0
- /package/.out/types/specs/{paths_of_type.tests.js → PathsOfType.tests.js} +0 -0
- /package/.out/types/{strict_definitions.js → specs/ReadonlyTypeOfType.tests.d.ts} +0 -0
- /package/.out/types/specs/{readonly_type_of_type.tests.js → ReadonlyTypeOfType.tests.js} +0 -0
- /package/.out/types/{validating_definitions.js → specs/StrictType.tests.d.ts} +0 -0
- /package/.out/types/specs/{strict_definitions.tests.js → StrictType.tests.js} +0 -0
- /package/.out/types/{validating_type_def_with_error.js → specs/TypeOfType.tests.d.ts} +0 -0
- /package/.out/types/specs/{type_of_type.tests.js → TypeOfType.tests.js} +0 -0
- /package/.out/types/{value_of_type.js → specs/ValueOfType.tests.d.ts} +0 -0
- /package/.out/types/specs/{value_of_type.tests.js → ValueOfType.tests.js} +0 -0
- /package/.out/types/{value_to_type_paths_of_type.js → specs/ValueToTypePathsOfType.tests.d.ts} +0 -0
- /package/.out/types/specs/{value_to_type_paths_of_type.tests.js → ValueToTypePathsOfType.tests.js} +0 -0
- /package/.out/types/{value_types_of_discriminated_union.js → specs/ValueTypesOfDiscriminatedUnion.tests.d.ts} +0 -0
- /package/.out/types/specs/{value_types_of_discriminated_union.tests.js → ValueTypesOfDiscriminatedUnion.tests.js} +0 -0
- /package/.out/validation/{errors_of_validators.d.ts → ErrorsOfValidators.d.ts} +0 -0
- /package/.out/validation/{errors_of_validators.js → ErrorsOfValidators.js} +0 -0
- /package/.out/validation/{validators_of_values.d.ts → ValidatorsOfValues.d.ts} +0 -0
- /package/.out/validation/{specs/errors_of_validators.tests.d.ts → ValidatorsOfValues.js} +0 -0
- /package/.out/validation/specs/{validators_of_values.tests.d.ts → errorsOfValidators.tests.d.ts} +0 -0
- /package/.out/validation/specs/{errors_of_validators.tests.js → errorsOfValidators.tests.js} +0 -0
- /package/.out/validation/{validators/specs/minimum_string_length_validator.tests.d.ts → specs/validatorsOfValues.tests.d.ts} +0 -0
- /package/.out/validation/specs/{validators_of_values.tests.js → validatorsOfValues.tests.js} +0 -0
- /package/.out/validation/validators/{composite_validator.d.ts → CompositeValidator.d.ts} +0 -0
- /package/.out/validation/validators/{composite_validator.js → CompositeValidator.js} +0 -0
- /package/.out/validation/validators/{defined_validator.d.ts → DefinedValidator.d.ts} +0 -0
- /package/.out/validation/validators/{defined_validator.js → DefinedValidator.js} +0 -0
- /package/.out/validation/validators/{maximum_string_length_validator.d.ts → MaximumStringLengthValidator.d.ts} +0 -0
- /package/.out/validation/validators/{maximum_string_length_validator.js → MaximumStringLengthValidator.js} +0 -0
- /package/.out/validation/validators/{minimum_string_length_validator.d.ts → MinimumStringLengthValidator.d.ts} +0 -0
- /package/.out/validation/validators/{minimum_string_length_validator.js → MinimumStringLengthValidator.js} +0 -0
- /package/.out/validation/validators/{optional_validator_proxy.d.ts → OptionalValidatorProxy.d.ts} +0 -0
- /package/.out/validation/validators/{optional_validator_proxy.js → OptionalValidatorProxy.js} +0 -0
- /package/.out/validation/validators/{regexp_validator.d.ts → RegexpValidator.d.ts} +0 -0
- /package/.out/validation/validators/{regexp_validator.js → RegexpValidator.js} +0 -0
- /package/.out/validation/validators/specs/{regexp_validator.tests.d.ts → minimumStringLengthValidator.tests.d.ts} +0 -0
- /package/.out/validation/{validators_of_values.js → validators/specs/regexpValidator.tests.d.ts} +0 -0
- /package/transformers/flatteners/{json_path.ts → jsonPath.ts} +0 -0
- /package/types/{path_of.ts → PathOf.ts} +0 -0
- /package/types/{definitions.ts → Type.ts} +0 -0
- /package/validation/{errors_of_validators.ts → ErrorsOfValidators.ts} +0 -0
- /package/validation/{validators_of_values.ts → ValidatorsOfValues.ts} +0 -0
- /package/validation/validators/{composite_validator.ts → CompositeValidator.ts} +0 -0
- /package/validation/validators/{defined_validator.ts → DefinedValidator.ts} +0 -0
- /package/validation/validators/{maximum_string_length_validator.ts → MaximumStringLengthValidator.ts} +0 -0
- /package/validation/validators/{minimum_string_length_validator.ts → MinimumStringLengthValidator.ts} +0 -0
- /package/validation/validators/{optional_validator_proxy.ts → OptionalValidatorProxy.ts} +0 -0
- /package/validation/validators/{regexp_validator.ts → RegexpValidator.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
1
|
+
import { type FlattenedValuesOfType } from './FlattenedValuesOfType';
|
|
2
|
+
import { type Type } from './Type';
|
|
3
3
|
export type Accessor<T = any> = {
|
|
4
4
|
readonly value: T;
|
|
5
5
|
set(v: T): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type UnionToIntersection } from 'type-fest';
|
|
2
|
-
import { type ListTypeDef, type LiteralTypeDef, type ObjectTypeDef, type RecordTypeDef, type Type, type TypeDef, type UnionTypeDef } from './definitions';
|
|
3
2
|
import { type Depths, type StartingDepth } from './flattened';
|
|
4
|
-
import { type PathOf } from './
|
|
3
|
+
import { type PathOf } from './PathOf';
|
|
4
|
+
import { type ListTypeDef, type LiteralTypeDef, type ObjectTypeDef, type RecordTypeDef, type Type, type TypeDef, type UnionTypeDef } from './Type';
|
|
5
5
|
export type FlattenedTypesOfType<T extends Type, SegmentOverride extends string | null, Path extends string = '$', Depth extends number = StartingDepth> = InternalFlattenedTypeDefsOf<T['definition'], SegmentOverride, Path, Depth>;
|
|
6
6
|
type InternalFlattenedTypeDefsOf<T extends TypeDef, SegmentOverride extends string | null, Path extends string, Depth extends number> = {
|
|
7
7
|
readonly [K in Path]: Type<T>;
|
package/.out/types/{flattened_types_of_validating_type.d.ts → FlattenedTypesOfValidatingType.d.ts}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type UnionToIntersection } from 'type-fest';
|
|
2
|
-
import { type Type, type TypeDef } from './definitions';
|
|
3
2
|
import { type Depths, type StartingDepth } from './flattened';
|
|
4
|
-
import { type PathOf } from './
|
|
5
|
-
import { type
|
|
3
|
+
import { type PathOf } from './PathOf';
|
|
4
|
+
import { type Type, type TypeDef } from './Type';
|
|
5
|
+
import { type ContextOfValidatingTypeDef, type ErrorOfValidatingTypeDef, type ValidatingListTypeDef, type ValidatingLiteralTypeDef, type ValidatingObjectTypeDef, type ValidatingRecordTypeDef, type ValidatingUnionTypeDef } from './ValidatingType';
|
|
6
6
|
export type FlattenedTypesOfValidatingType<T extends Type, SegmentOverride extends string | null, Path extends string = '$', Depth extends number = StartingDepth> = InternalFlattenedTypeDefsOf<T['definition'], SegmentOverride, Path, Depth>;
|
|
7
7
|
type InternalFlattenedTypeDefsOf<T extends TypeDef, SegmentOverride extends string | null, Path extends string, Depth extends number> = {
|
|
8
8
|
readonly [K in Path]: Type<T>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type Simplify } from 'type-fest';
|
|
2
2
|
import { type Validator } from 'validation/validator';
|
|
3
|
-
import { type FlattenedTypesOfType } from './
|
|
4
|
-
import { type ReadonlyOfTypeDef } from './
|
|
5
|
-
import { type ErrorOfValidatingTypeDef, type ValidatingType, type ValidatingTypeDef } from './
|
|
6
|
-
import { type ValueOfTypeDef } from './
|
|
3
|
+
import { type FlattenedTypesOfType } from './FlattenedTypesOfType';
|
|
4
|
+
import { type ReadonlyOfTypeDef } from './ReadonlyTypeOfType';
|
|
5
|
+
import { type ErrorOfValidatingTypeDef, type ValidatingType, type ValidatingTypeDef } from './ValidatingType';
|
|
6
|
+
import { type ValueOfTypeDef } from './ValueOfType';
|
|
7
7
|
type ValidatorOfValidatingType<T extends ValidatingTypeDef, ValuePath extends string> = T extends ValidatingTypeDef<infer E, infer C> ? Validator<ValueOfTypeDef<ReadonlyOfTypeDef<T>>, E, ValuePath, C> : never;
|
|
8
8
|
export type FlattenedValidatorsOfValidatingType<T extends ValidatingType, TypePathsToValuePaths extends Readonly<Record<keyof FlattenedTypes, string>>, FlattenedTypes extends Readonly<Record<string, ValidatingType>> = FlattenedTypesOfType<T, '*'>> = Simplify<{
|
|
9
9
|
[K in keyof FlattenedTypes as ErrorOfValidatingTypeDef<FlattenedTypes[K]['definition']> extends never ? never : K]: ValidatorOfValidatingType<FlattenedTypes[K]['definition'], TypePathsToValuePaths[K]>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
3
|
-
import { type ValueOfType } from './
|
|
1
|
+
import { type FlattenedTypesOfType } from './FlattenedTypesOfType';
|
|
2
|
+
import { type Type } from './Type';
|
|
3
|
+
import { type ValueOfType } from './ValueOfType';
|
|
4
4
|
export type FlattenedValuesOfType<T extends Type, SegmentOverride extends string | null = null, Flattened extends Readonly<Record<string, Type>> = FlattenedTypesOfType<T, SegmentOverride>> = {
|
|
5
5
|
[K in keyof Flattened]: ValueOfType<Flattened[K], {}>;
|
|
6
6
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Type } from './
|
|
2
|
-
import { type ValueOfType } from './
|
|
1
|
+
import { type Type } from './Type';
|
|
2
|
+
import { type ValueOfType } from './ValueOfType';
|
|
3
3
|
declare const MOBX_OBSERVABLE_KEY = "___mobx_observable";
|
|
4
4
|
export type MobxObservable<T = {}> = {
|
|
5
5
|
[MOBX_OBSERVABLE_KEY]: true;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ListTypeDef, type LiteralTypeDef, type ObjectTypeDef, type RecordTypeDef, type Type, type TypeDef, type TypeDefType, type UnionTypeDef } from './
|
|
1
|
+
import { type ListTypeDef, type LiteralTypeDef, type ObjectTypeDef, type RecordTypeDef, type Type, type TypeDef, type TypeDefType, type UnionTypeDef } from './Type';
|
|
2
2
|
export type PartialTypeOfType<T extends Type> = {
|
|
3
3
|
readonly typeDef: InternalPartialAndNullableOf<T['definition']>;
|
|
4
4
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type ListTypeDef, type LiteralTypeDef, type ObjectTypeDef, type RecordTypeDef, type Type, type TypeDef, type UnionTypeDef } from './definitions';
|
|
2
1
|
import { type Depths, type StartingDepth } from './flattened';
|
|
3
|
-
import { type PathOf } from './
|
|
2
|
+
import { type PathOf } from './PathOf';
|
|
3
|
+
import { type ListTypeDef, type LiteralTypeDef, type ObjectTypeDef, type RecordTypeDef, type Type, type TypeDef, type UnionTypeDef } from './Type';
|
|
4
4
|
export type PathsOfType<T extends Type, SegmentOverride extends string | null = null, Prefix extends string = '$'> = InternalJsonPathsOf<T['definition'], Prefix, SegmentOverride, StartingDepth>;
|
|
5
5
|
export type InternalJsonPathsOf<F extends TypeDef, Prefix extends string, SegmentOverride extends string | null, Depth extends number, NextDepth extends number = Depths[Depth]> = InternalJsonPathsOfChildren<F, Prefix, SegmentOverride, NextDepth> | Prefix;
|
|
6
6
|
type InternalJsonPathsOfChildren<F extends TypeDef, Prefix extends string, SegmentOverride extends string | null, Depth extends number> = Depth extends -1 ? never : F extends LiteralTypeDef ? InternalJsonPathsOfLiteralChildren : F extends ListTypeDef ? InternalJsonPathsOfListChildren<F, Prefix, SegmentOverride, Depth> : F extends RecordTypeDef ? InternalJsonPathsOfRecordChildren<F, Prefix, SegmentOverride, Depth> : F extends ObjectTypeDef ? InternalJsonPathsOfObjectChildren<F, Prefix, SegmentOverride, Depth> : F extends UnionTypeDef ? InternalJsonPathsOfUnionChildren<F, Prefix, SegmentOverride, Depth> : never;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ListTypeDef, type LiteralTypeDef, type ObjectTypeDef, type RecordTypeDef, type Type, type TypeDef, type UnionTypeDef } from './
|
|
1
|
+
import { type ListTypeDef, type LiteralTypeDef, type ObjectTypeDef, type RecordTypeDef, type Type, type TypeDef, type UnionTypeDef } from './Type';
|
|
2
2
|
export type ReadonlyTypeOfType<T extends Type> = {
|
|
3
3
|
readonly definition: ReadonlyOfTypeDef<T['definition']>;
|
|
4
4
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IsEqual, type Simplify } from 'type-fest';
|
|
2
|
-
import { type ObjectFieldKey, type RecordKeyType, type TypeDefType, type UnionKey } from './
|
|
2
|
+
import { type ObjectFieldKey, type RecordKeyType, type TypeDefType, type UnionKey } from './Type';
|
|
3
3
|
export type StrictType<T extends StrictTypeDef = StrictTypeDef> = {
|
|
4
4
|
readonly definition: T;
|
|
5
5
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type FunctionalValidator } from 'validation/validator';
|
|
2
|
-
import { type ObjectFieldKey, type RecordKeyType, type TypeDefType, type UnionKey } from './
|
|
2
|
+
import { type ObjectFieldKey, type RecordKeyType, type TypeDefType, type UnionKey } from './Type';
|
|
3
3
|
export type ValidatingType<T extends ValidatingTypeDef = ValidatingTypeDef> = {
|
|
4
4
|
readonly definition: T;
|
|
5
5
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type IsFieldReadonly } from '@strictly/base';
|
|
2
|
-
import { type TypeDefType } from '
|
|
3
|
-
import { type Rule, type ValidatingListTypeDef, type ValidatingLiteralTypeDef, type ValidatingObjectTypeDef, type ValidatingRecordTypeDef, type ValidatingTypeDef, type ValidatingUnionTypeDef } from './
|
|
2
|
+
import { type TypeDefType } from './Type';
|
|
3
|
+
import { type Rule, type ValidatingListTypeDef, type ValidatingLiteralTypeDef, type ValidatingObjectTypeDef, type ValidatingRecordTypeDef, type ValidatingTypeDef, type ValidatingUnionTypeDef } from './ValidatingType';
|
|
4
4
|
export type ValidatingTypeDefWithError<T extends ValidatingTypeDef, E, C> = T extends ValidatingLiteralTypeDef ? ValidatingLiteralTypeDefWithError<T, E, C> : T extends ValidatingListTypeDef ? ValidatingListTypeDefWithError<T, E, C> : T extends ValidatingRecordTypeDef ? ValidatingRecordTypeDefWithError<T, E, C> : T extends ValidatingObjectTypeDef ? ValidatingObjectTypeDefWithError<T, E, C> : T extends ValidatingUnionTypeDef ? ValidatingUnionTypeDefWithError<T, E, C> : never;
|
|
5
5
|
type ValidatingLiteralTypeDefWithError<T extends ValidatingLiteralTypeDef, E2, C2> = T extends ValidatingLiteralTypeDef<infer E1, infer C1, infer V> ? {
|
|
6
6
|
readonly type: TypeDefType.Literal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IsFieldReadonly } from '@strictly/base';
|
|
2
|
-
import { type ListTypeDef, type LiteralTypeDef, type ObjectTypeDef, type RecordTypeDef, type Type, type TypeDef, type UnionTypeDef } from './
|
|
2
|
+
import { type ListTypeDef, type LiteralTypeDef, type ObjectTypeDef, type RecordTypeDef, type Type, type TypeDef, type UnionTypeDef } from './Type';
|
|
3
3
|
export type ValueOfType<T, Extra = {}> = T extends Type ? ValueOfTypeDef<T['definition'], Extra> : never;
|
|
4
4
|
export type ValueOfTypeDef<F extends TypeDef, Extra = {}> = F extends LiteralTypeDef ? ValueOfLiteralTypeDef<F> : F extends ListTypeDef ? ValueOfListTypeDef<F, Extra> : F extends RecordTypeDef ? ValueOfRecordTypeDef<F, Extra> : F extends ObjectTypeDef ? ValueOfObjectTypeDef<F, Extra> : F extends UnionTypeDef ? ValueOfUnionTypeDef<F, Extra> : never;
|
|
5
5
|
type ValueOfLiteralTypeDef<F extends LiteralTypeDef> = F['valuePrototype'][number];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type SimplifyDeep, type UnionToIntersection } from 'type-fest';
|
|
2
|
-
import { type ListTypeDef, type LiteralTypeDef, type ObjectTypeDef, type RecordTypeDef, type TypeDef, type UnionTypeDef } from './definitions';
|
|
3
2
|
import { type Depths, type StartingDepth } from './flattened';
|
|
4
|
-
import { type PathOf } from './
|
|
5
|
-
import { type StrictType } from './
|
|
3
|
+
import { type PathOf } from './PathOf';
|
|
4
|
+
import { type StrictType } from './StrictType';
|
|
5
|
+
import { type ListTypeDef, type LiteralTypeDef, type ObjectTypeDef, type RecordTypeDef, type TypeDef, type UnionTypeDef } from './Type';
|
|
6
6
|
export type ValueToTypePathsOfType<T extends StrictType, SegmentOverride extends string = '*', Path extends string = '$'> = SimplifyDeep<InternalFlattenedTypePathsOf<T['definition'], SegmentOverride, Path, Path, StartingDepth>>;
|
|
7
7
|
type InternalFlattenedTypePathsOf<T extends TypeDef, SegmentOverride extends string, ValuePath extends string, TypePath extends string, Depth extends number> = {
|
|
8
8
|
readonly [K in ValuePath]: TypePath;
|
package/.out/types/{value_types_of_discriminated_union.d.ts → ValueTypesOfDiscriminatedUnion.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
3
|
-
import { type ValueOfType } from './
|
|
1
|
+
import { type ReadonlyTypeOfType } from './ReadonlyTypeOfType';
|
|
2
|
+
import { type UnionTypeDef } from './Type';
|
|
3
|
+
import { type ValueOfType } from './ValueOfType';
|
|
4
4
|
export type ValueTypesOfDiscriminatedUnion<U extends UnionTypeDef> = U extends UnionTypeDef<infer D, infer Unions> ? D extends string ? {
|
|
5
5
|
[K in keyof Unions]: ValueOfType<ReadonlyTypeOfType<{
|
|
6
6
|
definition: Unions[K];
|
package/.out/types/builders.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type IsFieldReadonly } from '@strictly/base';
|
|
2
2
|
import { type Validator } from 'validation/validator';
|
|
3
|
-
import { type ObjectFieldKey, type RecordKeyType, type Type, type TypeDef, TypeDefType, type UnionKey } from './
|
|
4
|
-
import { type TypeOfType } from './
|
|
5
|
-
import { type Rule, type ValidatingListTypeDef, type ValidatingLiteralTypeDef, type ValidatingObjectTypeDef, type ValidatingRecordTypeDef, type ValidatingType, type ValidatingTypeDef, type ValidatingUnionTypeDef } from './
|
|
6
|
-
import { type ValidatingTypeDefWithError } from './
|
|
7
|
-
import { type ValueOfType, type ValueOfTypeDef } from './
|
|
3
|
+
import { type ObjectFieldKey, type RecordKeyType, type Type, type TypeDef, TypeDefType, type UnionKey } from './Type';
|
|
4
|
+
import { type TypeOfType } from './typeOfType';
|
|
5
|
+
import { type Rule, type ValidatingListTypeDef, type ValidatingLiteralTypeDef, type ValidatingObjectTypeDef, type ValidatingRecordTypeDef, type ValidatingType, type ValidatingTypeDef, type ValidatingUnionTypeDef } from './ValidatingType';
|
|
6
|
+
import { type ValidatingTypeDefWithError } from './ValidatingTypeDefWithError';
|
|
7
|
+
import { type ValueOfType, type ValueOfTypeDef } from './ValueOfType';
|
|
8
8
|
declare class TypeDefBuilder<T extends ValidatingTypeDef> implements ValidatingType<T> {
|
|
9
9
|
readonly definition: T;
|
|
10
10
|
constructor(definition: T);
|
package/.out/types/builders.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { map, UnreachableError, } from '@strictly/base';
|
|
1
2
|
import { isAnnotatedValidator, mergeAnnotations, validate, } from 'validation/validator';
|
|
2
|
-
import { TypeDefType, } from './
|
|
3
|
-
import { typeOfType, } from './
|
|
3
|
+
import { TypeDefType, } from './Type';
|
|
4
|
+
import { typeOfType, } from './typeOfType';
|
|
4
5
|
function emptyRule() {
|
|
5
6
|
return null;
|
|
6
7
|
}
|
|
@@ -97,10 +98,31 @@ class ObjectTypeDefBuilder extends TypeDefBuilder {
|
|
|
97
98
|
}
|
|
98
99
|
class UnionTypeDefBuilder extends TypeDefBuilder {
|
|
99
100
|
or(k, { definition: typeDef, }) {
|
|
100
|
-
const { unions, } = this.definition;
|
|
101
|
+
const { unions, discriminator, } = this.definition;
|
|
102
|
+
// add the discriminator as a field to the underlying union type
|
|
103
|
+
const enhancedTypeDef = maybeAddDiscriminatorField(typeDef, discriminator, k);
|
|
101
104
|
return new UnionTypeDefBuilder(Object.assign(Object.assign({}, this.definition), {
|
|
102
105
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
103
|
-
unions: Object.assign(Object.assign({}, unions), { [k]:
|
|
106
|
+
unions: Object.assign(Object.assign({}, unions), { [k]: enhancedTypeDef }) }));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function maybeAddDiscriminatorField(t, discriminatorKey, discriminatorLiteral) {
|
|
110
|
+
if (discriminatorKey == null) {
|
|
111
|
+
return t;
|
|
112
|
+
}
|
|
113
|
+
switch (t.type) {
|
|
114
|
+
case TypeDefType.List:
|
|
115
|
+
case TypeDefType.Literal:
|
|
116
|
+
case TypeDefType.Record:
|
|
117
|
+
return t;
|
|
118
|
+
case TypeDefType.Object:
|
|
119
|
+
return Object.assign(Object.assign({}, t), { fields: Object.assign(Object.assign({}, t.fields), { [discriminatorKey]: literal([discriminatorLiteral]).readonly().required().narrow.definition }) });
|
|
120
|
+
case TypeDefType.Union:
|
|
121
|
+
return Object.assign(Object.assign({}, t), { unions: map(t.unions, (_k, v) => {
|
|
122
|
+
return maybeAddDiscriminatorField(v, discriminatorKey, discriminatorLiteral);
|
|
123
|
+
}) });
|
|
124
|
+
default:
|
|
125
|
+
throw new UnreachableError(t);
|
|
104
126
|
}
|
|
105
127
|
}
|
|
106
128
|
export function literal(value) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type StartingDepth =
|
|
1
|
+
export type StartingDepth = 5;
|
|
2
2
|
export type Depths = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { booleanType, list, nullable, numberType, object, record, stringType, union, } from 'types/builders';
|
|
2
|
-
import { TypeDefType, } from 'types/
|
|
2
|
+
import { TypeDefType, } from 'types/Type';
|
|
3
3
|
describe('builder', function () {
|
|
4
4
|
describe('literal', function () {
|
|
5
5
|
const { definition } = numberType;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IsFieldReadonly } from '@strictly/base';
|
|
2
|
-
import { type ListTypeDef, type LiteralTypeDef, type ObjectFieldKey, type ObjectTypeDef, type RecordTypeDef, type Type, type TypeDef, TypeDefType, type UnionTypeDef } from '
|
|
2
|
+
import { type ListTypeDef, type LiteralTypeDef, type ObjectFieldKey, type ObjectTypeDef, type RecordTypeDef, type Type, type TypeDef, TypeDefType, type UnionTypeDef } from './Type';
|
|
3
3
|
export type TypeOfType<T extends Type> = T extends Type<infer D> ? {
|
|
4
4
|
readonly definition: TypeDefOfTypeDef<D>;
|
|
5
5
|
} : never;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { map, UnreachableError, } from '@strictly/base';
|
|
2
|
-
import { TypeDefType, } from '
|
|
2
|
+
import { TypeDefType, } from './Type';
|
|
3
3
|
export function typeOfType({ definition }) {
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
5
5
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MinimumStringLengthValidationErrorType, MinimumStringLengthValidator, } from 'validation/validators/
|
|
1
|
+
import { MinimumStringLengthValidationErrorType, MinimumStringLengthValidator, } from 'validation/validators/MinimumStringLengthValidator';
|
|
2
2
|
describe('MinimumStringLengthValidator', () => {
|
|
3
3
|
describe('required', () => {
|
|
4
4
|
it.each([
|
package/.out/validation/validators/specs/{regexp_validator.tests.js → regexpValidator.tests.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RegexpValidationErrorType, RegexpValidator, } from 'validation/validators/
|
|
1
|
+
import { RegexpValidationErrorType, RegexpValidator, } from 'validation/validators/RegexpValidator';
|
|
2
2
|
describe('RegexpValidator', () => {
|
|
3
3
|
describe('phone', () => {
|
|
4
4
|
it.each([
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -7,12 +7,12 @@ $ tsup
|
|
|
7
7
|
[34mCLI[39m Target: es6
|
|
8
8
|
[34mCJS[39m Build start
|
|
9
9
|
[34mESM[39m Build start
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
10
|
+
[32mESM[39m [1mdist/index.js [22m[32m34.08 KB[39m
|
|
11
|
+
[32mESM[39m ⚡️ Build success in 119ms
|
|
12
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m36.67 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 126ms
|
|
14
14
|
[34mDTS[39m Build start
|
|
15
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[32m41.
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m41.
|
|
18
|
-
Done in
|
|
15
|
+
[32mDTS[39m ⚡️ Build success in 5988ms
|
|
16
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m41.82 KB[39m
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m41.82 KB[39m
|
|
18
|
+
Done in 7.55s.
|
package/dist/index.cjs
CHANGED
|
@@ -81,10 +81,10 @@ __export(index_exports, {
|
|
|
81
81
|
});
|
|
82
82
|
module.exports = __toCommonJS(index_exports);
|
|
83
83
|
|
|
84
|
-
// transformers/copies/
|
|
84
|
+
// transformers/copies/copyTo.ts
|
|
85
85
|
var import_base = require("@strictly/base");
|
|
86
86
|
|
|
87
|
-
// types/
|
|
87
|
+
// types/Type.ts
|
|
88
88
|
var TypeDefType = /* @__PURE__ */ ((TypeDefType2) => {
|
|
89
89
|
TypeDefType2[TypeDefType2["Literal"] = 1] = "Literal";
|
|
90
90
|
TypeDefType2[TypeDefType2["List"] = 2] = "List";
|
|
@@ -94,7 +94,7 @@ var TypeDefType = /* @__PURE__ */ ((TypeDefType2) => {
|
|
|
94
94
|
return TypeDefType2;
|
|
95
95
|
})(TypeDefType || {});
|
|
96
96
|
|
|
97
|
-
// transformers/copies/
|
|
97
|
+
// transformers/copies/copyTo.ts
|
|
98
98
|
function copyTo({ definition }, value, copier) {
|
|
99
99
|
return internalCopyTo(
|
|
100
100
|
definition,
|
|
@@ -193,14 +193,7 @@ function copyUnion(typeDef, value, copier) {
|
|
|
193
193
|
} = typeDef;
|
|
194
194
|
if (discriminator != null) {
|
|
195
195
|
const discriminatorValue = value[discriminator];
|
|
196
|
-
|
|
197
|
-
unions[discriminatorValue],
|
|
198
|
-
value,
|
|
199
|
-
copier
|
|
200
|
-
)), {
|
|
201
|
-
[discriminator]: discriminatorValue
|
|
202
|
-
});
|
|
203
|
-
return copier(discriminatingUnion, typeDef);
|
|
196
|
+
return internalCopyTo(unions[discriminatorValue], value, copier);
|
|
204
197
|
}
|
|
205
198
|
const allTypeDefs = Object.values(unions);
|
|
206
199
|
const variableTypeDefs = allTypeDefs.filter(function(typeDef2) {
|
|
@@ -225,14 +218,14 @@ function copy(t, proto) {
|
|
|
225
218
|
return copyTo(t, proto, identity);
|
|
226
219
|
}
|
|
227
220
|
|
|
228
|
-
// transformers/copies/
|
|
221
|
+
// transformers/copies/mobxCopy.ts
|
|
229
222
|
var import_base4 = require("@strictly/base");
|
|
230
223
|
var import_mobx = require("mobx");
|
|
231
224
|
|
|
232
|
-
// transformers/flatteners/
|
|
225
|
+
// transformers/flatteners/flattenValueTo.ts
|
|
233
226
|
var import_base3 = require("@strictly/base");
|
|
234
227
|
|
|
235
|
-
// transformers/flatteners/
|
|
228
|
+
// transformers/flatteners/jsonPath.ts
|
|
236
229
|
var import_base2 = require("@strictly/base");
|
|
237
230
|
function jsonPath(prefix, segment, qualifier) {
|
|
238
231
|
const s = `.${segment}`;
|
|
@@ -257,7 +250,7 @@ function jsonPathUnprefix(prefix, path) {
|
|
|
257
250
|
return `$${path.slice(prefix.length)}`;
|
|
258
251
|
}
|
|
259
252
|
|
|
260
|
-
// transformers/flatteners/
|
|
253
|
+
// transformers/flatteners/flattenValueTo.ts
|
|
261
254
|
function flattenValueTo({ definition }, v, setter, mapper2, listIndicesToKeys = {}) {
|
|
262
255
|
const r = {};
|
|
263
256
|
internalFlattenValue(
|
|
@@ -398,7 +391,7 @@ function getUnionTypeDef(typeDef, v) {
|
|
|
398
391
|
return typeDef.unions[v[typeDef.discriminator]];
|
|
399
392
|
}
|
|
400
393
|
|
|
401
|
-
// transformers/copies/
|
|
394
|
+
// transformers/copies/mobxCopy.ts
|
|
402
395
|
function observeValue(v, def) {
|
|
403
396
|
if (v == null) {
|
|
404
397
|
return v;
|
|
@@ -417,7 +410,7 @@ function observeValue(v, def) {
|
|
|
417
410
|
}
|
|
418
411
|
);
|
|
419
412
|
case 4 /* Object */:
|
|
420
|
-
return (0, import_mobx.
|
|
413
|
+
return (0, import_mobx.observable)(
|
|
421
414
|
v,
|
|
422
415
|
(0, import_base4.reduce)(
|
|
423
416
|
def.fields,
|
|
@@ -506,7 +499,7 @@ function internalUnionEquals({
|
|
|
506
499
|
return o1 === o2 || variableTypeDefs.length === 1 && internalEquals(variableTypeDefs[0], o1, o2);
|
|
507
500
|
}
|
|
508
501
|
|
|
509
|
-
// transformers/flatteners/
|
|
502
|
+
// transformers/flatteners/flattenAccessorsOfType.ts
|
|
510
503
|
function mapAccessor(_t, value, set) {
|
|
511
504
|
return {
|
|
512
505
|
value,
|
|
@@ -523,7 +516,7 @@ function flattenAccessorsOfType(t, value, setValue, listIndicesToKeys) {
|
|
|
523
516
|
);
|
|
524
517
|
}
|
|
525
518
|
|
|
526
|
-
// transformers/flatteners/
|
|
519
|
+
// transformers/flatteners/flattenJsonValueToTypePathsOf.ts
|
|
527
520
|
function mapTypePaths(_t, _value, _set, typePath) {
|
|
528
521
|
return typePath;
|
|
529
522
|
}
|
|
@@ -538,7 +531,7 @@ function flattenJsonValueToTypePathsOf(t, value, listIndicesToKeys) {
|
|
|
538
531
|
);
|
|
539
532
|
}
|
|
540
533
|
|
|
541
|
-
// transformers/flatteners/
|
|
534
|
+
// transformers/flatteners/flattenTypeTo.ts
|
|
542
535
|
var import_base6 = require("@strictly/base");
|
|
543
536
|
function flattenTypeTo({ definition }, mapper2) {
|
|
544
537
|
const typeDefs = internalFlattenTypeDef("$", definition, {});
|
|
@@ -609,7 +602,7 @@ function internalFlattenUnionTypeDefChildren(path, qualifier, {
|
|
|
609
602
|
);
|
|
610
603
|
}
|
|
611
604
|
|
|
612
|
-
// transformers/flatteners/
|
|
605
|
+
// transformers/flatteners/flattenTypesOfType.ts
|
|
613
606
|
function flattenTypesOfType(t) {
|
|
614
607
|
return flattenTypeTo(
|
|
615
608
|
t,
|
|
@@ -619,7 +612,7 @@ function flattenTypesOfType(t) {
|
|
|
619
612
|
);
|
|
620
613
|
}
|
|
621
614
|
|
|
622
|
-
// transformers/flatteners/
|
|
615
|
+
// transformers/flatteners/flattenValidatorsOfValidatingType.ts
|
|
623
616
|
function flattenValidatorsOfValidatingType(type) {
|
|
624
617
|
return flattenTypeTo(type, function(definition) {
|
|
625
618
|
const {
|
|
@@ -640,7 +633,7 @@ function flattenValidatorsOfValidatingType(type) {
|
|
|
640
633
|
});
|
|
641
634
|
}
|
|
642
635
|
|
|
643
|
-
// transformers/flatteners/
|
|
636
|
+
// transformers/flatteners/flattenValuesOfType.ts
|
|
644
637
|
function mapper(_t, v) {
|
|
645
638
|
return v;
|
|
646
639
|
}
|
|
@@ -655,7 +648,7 @@ function flattenValuesOfType(typeDef, value, listIndicesToKeys) {
|
|
|
655
648
|
);
|
|
656
649
|
}
|
|
657
650
|
|
|
658
|
-
// transformers/flatteners/
|
|
651
|
+
// transformers/flatteners/valuePathToTypePath.ts
|
|
659
652
|
var import_base7 = require("@strictly/base");
|
|
660
653
|
function valuePathToTypePath({ definition: typeDef }, valuePath, allowMissingPaths = false) {
|
|
661
654
|
const valueSteps = valuePath.split(/\.|\[/g);
|
|
@@ -800,7 +793,10 @@ function internalJsonValuePathToTypePath(typeDef, qualifiers, valueSteps, allowM
|
|
|
800
793
|
}
|
|
801
794
|
}
|
|
802
795
|
|
|
803
|
-
//
|
|
796
|
+
// types/builders.ts
|
|
797
|
+
var import_base9 = require("@strictly/base");
|
|
798
|
+
|
|
799
|
+
// validation/validators/CompositeValidator.ts
|
|
804
800
|
var CompositeValidator = class {
|
|
805
801
|
constructor(...validators) {
|
|
806
802
|
__publicField(this, "validators");
|
|
@@ -868,7 +864,7 @@ function mergeAnnotations(a1, a2) {
|
|
|
868
864
|
};
|
|
869
865
|
}
|
|
870
866
|
|
|
871
|
-
// types/
|
|
867
|
+
// types/typeOfType.ts
|
|
872
868
|
var import_base8 = require("@strictly/base");
|
|
873
869
|
function typeOfType({ definition }) {
|
|
874
870
|
return {
|
|
@@ -1066,18 +1062,45 @@ var UnionTypeDefBuilder = class _UnionTypeDefBuilder extends TypeDefBuilder {
|
|
|
1066
1062
|
definition: typeDef
|
|
1067
1063
|
}) {
|
|
1068
1064
|
const {
|
|
1069
|
-
unions
|
|
1065
|
+
unions,
|
|
1066
|
+
discriminator
|
|
1070
1067
|
} = this.definition;
|
|
1068
|
+
const enhancedTypeDef = maybeAddDiscriminatorField(typeDef, discriminator, k);
|
|
1071
1069
|
return new _UnionTypeDefBuilder(
|
|
1072
1070
|
__spreadProps(__spreadValues({}, this.definition), {
|
|
1073
1071
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1074
1072
|
unions: __spreadProps(__spreadValues({}, unions), {
|
|
1075
|
-
[k]:
|
|
1073
|
+
[k]: enhancedTypeDef
|
|
1076
1074
|
})
|
|
1077
1075
|
})
|
|
1078
1076
|
);
|
|
1079
1077
|
}
|
|
1080
1078
|
};
|
|
1079
|
+
function maybeAddDiscriminatorField(t, discriminatorKey, discriminatorLiteral) {
|
|
1080
|
+
if (discriminatorKey == null) {
|
|
1081
|
+
return t;
|
|
1082
|
+
}
|
|
1083
|
+
switch (t.type) {
|
|
1084
|
+
case 2 /* List */:
|
|
1085
|
+
case 1 /* Literal */:
|
|
1086
|
+
case 3 /* Record */:
|
|
1087
|
+
return t;
|
|
1088
|
+
case 4 /* Object */:
|
|
1089
|
+
return __spreadProps(__spreadValues({}, t), {
|
|
1090
|
+
fields: __spreadProps(__spreadValues({}, t.fields), {
|
|
1091
|
+
[discriminatorKey]: literal([discriminatorLiteral]).readonly().required().narrow.definition
|
|
1092
|
+
})
|
|
1093
|
+
});
|
|
1094
|
+
case 5 /* Union */:
|
|
1095
|
+
return __spreadProps(__spreadValues({}, t), {
|
|
1096
|
+
unions: (0, import_base9.map)(t.unions, (_k, v) => {
|
|
1097
|
+
return maybeAddDiscriminatorField(v, discriminatorKey, discriminatorLiteral);
|
|
1098
|
+
})
|
|
1099
|
+
});
|
|
1100
|
+
default:
|
|
1101
|
+
throw new import_base9.UnreachableError(t);
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1081
1104
|
function literal(value) {
|
|
1082
1105
|
return new TypeDefBuilder({
|
|
1083
1106
|
type: 1 /* Literal */,
|
|
@@ -1149,7 +1172,7 @@ function union(discriminator) {
|
|
|
1149
1172
|
);
|
|
1150
1173
|
}
|
|
1151
1174
|
|
|
1152
|
-
// validation/validators/
|
|
1175
|
+
// validation/validators/DefinedValidator.ts
|
|
1153
1176
|
var DefinedValidator = class {
|
|
1154
1177
|
constructor(error) {
|
|
1155
1178
|
this.error = error;
|
|
@@ -1168,7 +1191,7 @@ var DefinedValidator = class {
|
|
|
1168
1191
|
}
|
|
1169
1192
|
};
|
|
1170
1193
|
|
|
1171
|
-
// validation/validators/
|
|
1194
|
+
// validation/validators/MaximumStringLengthValidator.ts
|
|
1172
1195
|
var MaximumStringLengthValidationErrorType = "maximum_string_length";
|
|
1173
1196
|
var MaximumStringLengthValidator = class {
|
|
1174
1197
|
constructor(maximumLength) {
|
|
@@ -1192,7 +1215,7 @@ var MaximumStringLengthValidator = class {
|
|
|
1192
1215
|
}
|
|
1193
1216
|
};
|
|
1194
1217
|
|
|
1195
|
-
// validation/validators/
|
|
1218
|
+
// validation/validators/MinimumStringLengthValidator.ts
|
|
1196
1219
|
var MinimumStringLengthValidationErrorType = "minimum_string_length";
|
|
1197
1220
|
var MinimumStringLengthValidator = class {
|
|
1198
1221
|
constructor(minimumLength) {
|
|
@@ -1216,7 +1239,7 @@ var MinimumStringLengthValidator = class {
|
|
|
1216
1239
|
}
|
|
1217
1240
|
};
|
|
1218
1241
|
|
|
1219
|
-
// validation/validators/
|
|
1242
|
+
// validation/validators/OptionalValidatorProxy.ts
|
|
1220
1243
|
var OptionalValidatorProxy = class _OptionalValidatorProxy {
|
|
1221
1244
|
constructor(proxied, isRequired) {
|
|
1222
1245
|
this.proxied = proxied;
|
|
@@ -1241,7 +1264,7 @@ var OptionalValidatorProxy = class _OptionalValidatorProxy {
|
|
|
1241
1264
|
}
|
|
1242
1265
|
};
|
|
1243
1266
|
|
|
1244
|
-
// validation/validators/
|
|
1267
|
+
// validation/validators/RegexpValidator.ts
|
|
1245
1268
|
var RegexpValidationErrorType = "regexp";
|
|
1246
1269
|
var _RegexpValidator = class _RegexpValidator {
|
|
1247
1270
|
constructor(regexp, intent, {
|
package/dist/index.d.cts
CHANGED
|
@@ -149,7 +149,7 @@ declare function mobxCopy<T extends StrictType>(t: T, proto: ValueOfType<Readonl
|
|
|
149
149
|
|
|
150
150
|
declare function equals<T extends Type>({ definition }: T, o1: ValueOfType<T>, o2: ValueOfType<T>): boolean;
|
|
151
151
|
|
|
152
|
-
type StartingDepth =
|
|
152
|
+
type StartingDepth = 5;
|
|
153
153
|
type Depths = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
|
|
154
154
|
|
|
155
155
|
type PathOf<Prefix extends string, Accessor extends string | number | symbol, SegmentOverride extends string | null = null> = SegmentOverride extends string ? `${Prefix}.${SegmentOverride}` : Accessor extends string | number ? `${Prefix}.${Accessor}` : never;
|
|
@@ -189,7 +189,7 @@ type FlattenedAccessorsOfType<T extends Type, Flattened extends Readonly<Record<
|
|
|
189
189
|
type AnyValueType = any;
|
|
190
190
|
type Setter<V> = (v: V) => void;
|
|
191
191
|
type Mapper<R> = (t: StrictTypeDef, v: AnyValueType, setter: Setter<AnyValueType>, typePath: string, valuePath: string) => R;
|
|
192
|
-
declare function flattenValueTo<T extends StrictType, M, R extends Readonly<Record<string, M>>>({ definition }: T, v: ValueOfType<T
|
|
192
|
+
declare function flattenValueTo<T extends StrictType, M, R extends Readonly<Record<string, M>>>({ definition }: T, v: ValueOfType<ReadonlyTypeOfType<T>>, setter: Setter<ValueOfType<T>>, mapper: Mapper<M>, listIndicesToKeys?: Record<string, number[]>): R;
|
|
193
193
|
declare function getUnionTypeDef<T extends UnionTypeDef>(typeDef: T, v: ValueOfType<ReadonlyTypeOfType<{
|
|
194
194
|
definition: T;
|
|
195
195
|
}>>): any;
|
package/dist/index.d.ts
CHANGED
|
@@ -149,7 +149,7 @@ declare function mobxCopy<T extends StrictType>(t: T, proto: ValueOfType<Readonl
|
|
|
149
149
|
|
|
150
150
|
declare function equals<T extends Type>({ definition }: T, o1: ValueOfType<T>, o2: ValueOfType<T>): boolean;
|
|
151
151
|
|
|
152
|
-
type StartingDepth =
|
|
152
|
+
type StartingDepth = 5;
|
|
153
153
|
type Depths = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
|
|
154
154
|
|
|
155
155
|
type PathOf<Prefix extends string, Accessor extends string | number | symbol, SegmentOverride extends string | null = null> = SegmentOverride extends string ? `${Prefix}.${SegmentOverride}` : Accessor extends string | number ? `${Prefix}.${Accessor}` : never;
|
|
@@ -189,7 +189,7 @@ type FlattenedAccessorsOfType<T extends Type, Flattened extends Readonly<Record<
|
|
|
189
189
|
type AnyValueType = any;
|
|
190
190
|
type Setter<V> = (v: V) => void;
|
|
191
191
|
type Mapper<R> = (t: StrictTypeDef, v: AnyValueType, setter: Setter<AnyValueType>, typePath: string, valuePath: string) => R;
|
|
192
|
-
declare function flattenValueTo<T extends StrictType, M, R extends Readonly<Record<string, M>>>({ definition }: T, v: ValueOfType<T
|
|
192
|
+
declare function flattenValueTo<T extends StrictType, M, R extends Readonly<Record<string, M>>>({ definition }: T, v: ValueOfType<ReadonlyTypeOfType<T>>, setter: Setter<ValueOfType<T>>, mapper: Mapper<M>, listIndicesToKeys?: Record<string, number[]>): R;
|
|
193
193
|
declare function getUnionTypeDef<T extends UnionTypeDef>(typeDef: T, v: ValueOfType<ReadonlyTypeOfType<{
|
|
194
194
|
definition: T;
|
|
195
195
|
}>>): any;
|