@gati-framework/cli
Version:
CLI tool for Gati framework - create, develop, build and deploy cloud-native applications
67 lines • 1.79 kB
TypeScript
/**
* @module cli/extractor/constraint-extractor
* @description Extract branded types and constraint combinators from TypeScript types
*/
import type { Type } from 'ts-morph';
import type { StringConstraints, NumberConstraints } from '@gati-framework/types/gtype';
/**
* Extracted brand information
*/
export interface BrandInfo {
/**
* Brand name (from Brand<"name">)
*/
name: string;
/**
* Whether this is a branded type
*/
isBranded: true;
}
/**
* Constraint extractor for branded types and combinators
*/
export declare class ConstraintExtractor {
/**
* Extract brand from type intersection
*
* Detects patterns like:
* - string & Brand<"email">
* - number & Brand<"positive">
*/
extractBrand(type: Type): BrandInfo | null;
/**
* Extract string constraints from type intersection
*
* Detects patterns like:
* - string & MinLen<8>
* - string & MaxLen<100>
* - string & Pattern<"^[a-z]+$">
*/
extractStringConstraints(type: Type): StringConstraints;
/**
* Extract number constraints from type intersection
*
* Detects patterns like:
* - number & Min<0>
* - number & Max<100>
* - number & MultipleOf<5>
*/
extractNumberConstraints(type: Type): NumberConstraints;
/**
* Extract numeric type argument from generic type
*/
private extractNumericTypeArg;
/**
* Extract string type argument from generic type
*/
private extractStringTypeArg;
/**
* Check if type has Nullable<T> wrapper
*/
isNullable(type: Type): boolean;
/**
* Check if type has Optional<T> wrapper
*/
isOptional(type: Type): boolean;
}
//# sourceMappingURL=constraint-extractor.d.ts.map