metal-orm 1.0.92 → 1.0.94
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/dist/index.cjs +728 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +225 -1
- package/dist/index.d.ts +225 -1
- package/dist/index.js +712 -23
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/decorators/bootstrap.ts +11 -1
- package/src/decorators/decorator-metadata.ts +3 -1
- package/src/decorators/index.ts +27 -0
- package/src/decorators/transformers/built-in/string-transformers.ts +231 -0
- package/src/decorators/transformers/transformer-decorators.ts +137 -0
- package/src/decorators/transformers/transformer-executor.ts +172 -0
- package/src/decorators/transformers/transformer-metadata.ts +73 -0
- package/src/decorators/validators/built-in/br-cep-validator.ts +55 -0
- package/src/decorators/validators/built-in/br-cnpj-validator.ts +105 -0
- package/src/decorators/validators/built-in/br-cpf-validator.ts +103 -0
- package/src/decorators/validators/country-validator-registry.ts +64 -0
- package/src/decorators/validators/country-validators-decorators.ts +209 -0
- package/src/decorators/validators/country-validators.ts +105 -0
- package/src/decorators/validators/validator-metadata.ts +59 -0
- package/src/dto/openapi/utilities.ts +5 -0
- package/src/orm/entity-metadata.ts +64 -45
package/dist/index.d.cts
CHANGED
|
@@ -2716,6 +2716,58 @@ interface SimpleQueryRunner {
|
|
|
2716
2716
|
*/
|
|
2717
2717
|
declare function createExecutorFromQueryRunner(runner: SimpleQueryRunner): DbExecutor;
|
|
2718
2718
|
|
|
2719
|
+
interface TransformContext {
|
|
2720
|
+
entityName: string;
|
|
2721
|
+
propertyName: string;
|
|
2722
|
+
columnType: ColumnType;
|
|
2723
|
+
isUpdate: boolean;
|
|
2724
|
+
originalValue?: unknown;
|
|
2725
|
+
autoTransform: boolean;
|
|
2726
|
+
}
|
|
2727
|
+
interface AutoTransformResult<T = unknown> {
|
|
2728
|
+
success: boolean;
|
|
2729
|
+
correctedValue?: T;
|
|
2730
|
+
message?: string;
|
|
2731
|
+
}
|
|
2732
|
+
interface PropertyTransformer<TInput = unknown, TOutput = unknown> {
|
|
2733
|
+
readonly name: string;
|
|
2734
|
+
transform(value: TInput, context: TransformContext): TOutput;
|
|
2735
|
+
}
|
|
2736
|
+
interface PropertyValidator<T = unknown> {
|
|
2737
|
+
readonly name: string;
|
|
2738
|
+
validate(value: T, context: TransformContext): ValidationResult$1;
|
|
2739
|
+
}
|
|
2740
|
+
interface PropertySanitizer<T = unknown> {
|
|
2741
|
+
readonly name: string;
|
|
2742
|
+
sanitize(value: T, context: TransformContext): T;
|
|
2743
|
+
}
|
|
2744
|
+
interface CompositeTransformer<TInput = unknown, TOutput = unknown> extends PropertyTransformer<TInput, TOutput>, PropertyValidator<TInput> {
|
|
2745
|
+
}
|
|
2746
|
+
interface AutoTransformableValidator<T = unknown> extends PropertyValidator<T> {
|
|
2747
|
+
/**
|
|
2748
|
+
* Attempts to automatically correct an invalid value.
|
|
2749
|
+
* Returns undefined if auto-correction is not possible.
|
|
2750
|
+
*/
|
|
2751
|
+
autoTransform?(value: T, context: TransformContext): AutoTransformResult<T>;
|
|
2752
|
+
}
|
|
2753
|
+
interface ValidationResult$1 {
|
|
2754
|
+
isValid: boolean;
|
|
2755
|
+
error?: string;
|
|
2756
|
+
message?: string;
|
|
2757
|
+
}
|
|
2758
|
+
interface TransformerMetadata {
|
|
2759
|
+
propertyName: string;
|
|
2760
|
+
transformers: PropertyTransformer[];
|
|
2761
|
+
validators: PropertyValidator[];
|
|
2762
|
+
sanitizers: PropertySanitizer[];
|
|
2763
|
+
executionOrder: 'before-save' | 'after-load' | 'both';
|
|
2764
|
+
}
|
|
2765
|
+
interface TransformerConfig {
|
|
2766
|
+
auto?: boolean;
|
|
2767
|
+
execute?: 'before-save' | 'after-load' | 'both';
|
|
2768
|
+
stopOnFirstError?: boolean;
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2719
2771
|
/**
|
|
2720
2772
|
* Constructor type for entities.
|
|
2721
2773
|
* Supports any constructor signature for maximum flexibility with decorator-based entities.
|
|
@@ -6771,6 +6823,10 @@ interface DecoratorMetadataBag {
|
|
|
6771
6823
|
propertyName: string;
|
|
6772
6824
|
relation: RelationMetadata;
|
|
6773
6825
|
}>;
|
|
6826
|
+
transformers: Array<{
|
|
6827
|
+
propertyName: string;
|
|
6828
|
+
metadata: TransformerMetadata;
|
|
6829
|
+
}>;
|
|
6774
6830
|
}
|
|
6775
6831
|
/**
|
|
6776
6832
|
* Public helper to read decorator metadata from a class constructor.
|
|
@@ -6779,6 +6835,174 @@ interface DecoratorMetadataBag {
|
|
|
6779
6835
|
*/
|
|
6780
6836
|
declare const getDecoratorMetadata: (ctor: object) => DecoratorMetadataBag | undefined;
|
|
6781
6837
|
|
|
6838
|
+
declare function Trim(options?: {
|
|
6839
|
+
trimStart?: boolean;
|
|
6840
|
+
trimEnd?: boolean;
|
|
6841
|
+
trimAll?: boolean;
|
|
6842
|
+
}): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6843
|
+
declare function Lower(): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6844
|
+
declare function Upper(): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6845
|
+
declare function Capitalize(): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6846
|
+
declare function Title(): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6847
|
+
declare function Alphanumeric(options?: {
|
|
6848
|
+
allowSpaces?: boolean;
|
|
6849
|
+
allowUnderscores?: boolean;
|
|
6850
|
+
allowHyphens?: boolean;
|
|
6851
|
+
}): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6852
|
+
declare function Email(options?: {
|
|
6853
|
+
allowPlus?: boolean;
|
|
6854
|
+
requireTLD?: boolean;
|
|
6855
|
+
}): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6856
|
+
declare function Length(options: {
|
|
6857
|
+
min?: number;
|
|
6858
|
+
max?: number;
|
|
6859
|
+
exact?: number;
|
|
6860
|
+
}): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6861
|
+
declare function Pattern(options: {
|
|
6862
|
+
pattern: RegExp;
|
|
6863
|
+
flags?: string;
|
|
6864
|
+
errorMessage?: string;
|
|
6865
|
+
replacement?: string;
|
|
6866
|
+
}): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6867
|
+
|
|
6868
|
+
/**
|
|
6869
|
+
* Decorator to validate a Brazilian CPF number
|
|
6870
|
+
* @param options - Validation options
|
|
6871
|
+
* @returns Property decorator for CPF validation
|
|
6872
|
+
*/
|
|
6873
|
+
declare function CPF(options?: {
|
|
6874
|
+
strict?: boolean;
|
|
6875
|
+
errorMessage?: string;
|
|
6876
|
+
}): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6877
|
+
/**
|
|
6878
|
+
* Decorator to validate a Brazilian CNPJ number
|
|
6879
|
+
* @param options - Validation options
|
|
6880
|
+
* @returns Property decorator for CNPJ validation
|
|
6881
|
+
*/
|
|
6882
|
+
declare function CNPJ(options?: {
|
|
6883
|
+
strict?: boolean;
|
|
6884
|
+
errorMessage?: string;
|
|
6885
|
+
}): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6886
|
+
/**
|
|
6887
|
+
* Decorator to validate a Brazilian CEP number
|
|
6888
|
+
* @param options - Validation options
|
|
6889
|
+
* @returns Property decorator for CEP validation
|
|
6890
|
+
*/
|
|
6891
|
+
declare function CEP(options?: {
|
|
6892
|
+
strict?: boolean;
|
|
6893
|
+
errorMessage?: string;
|
|
6894
|
+
}): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6895
|
+
|
|
6896
|
+
/**
|
|
6897
|
+
* Base interface for country-specific identifier validators
|
|
6898
|
+
*/
|
|
6899
|
+
interface CountryValidator<T = string> {
|
|
6900
|
+
/** ISO 3166-1 alpha-2 country code (e.g., 'BR', 'US') */
|
|
6901
|
+
readonly countryCode: string;
|
|
6902
|
+
/** Identifier type (e.g., 'cpf', 'cnpj', 'ssn', 'zip') */
|
|
6903
|
+
readonly identifierType: string;
|
|
6904
|
+
/** Unique validator name (e.g., 'br-cpf', 'us-ssn') */
|
|
6905
|
+
readonly name: string;
|
|
6906
|
+
/**
|
|
6907
|
+
* Validates an identifier value
|
|
6908
|
+
* @param value - The identifier value to validate
|
|
6909
|
+
* @param options - Validation options
|
|
6910
|
+
* @returns Validation result with success status and optional error message
|
|
6911
|
+
*/
|
|
6912
|
+
validate(value: T, options?: ValidationOptions): ValidationResult;
|
|
6913
|
+
/**
|
|
6914
|
+
* Normalizes an identifier value (removes formatting, standardizes)
|
|
6915
|
+
* @param value - The identifier value to normalize
|
|
6916
|
+
* @returns Normalized value (digits only, uppercase, etc.)
|
|
6917
|
+
*/
|
|
6918
|
+
normalize(value: T): string;
|
|
6919
|
+
/**
|
|
6920
|
+
* Formats an identifier value according to country standards
|
|
6921
|
+
* @param value - The identifier value to format (can be normalized or formatted)
|
|
6922
|
+
* @returns Formatted value (e.g., '123.456.789-01' for CPF)
|
|
6923
|
+
*/
|
|
6924
|
+
format(value: T): string;
|
|
6925
|
+
/**
|
|
6926
|
+
* Attempts to auto-correct an invalid value
|
|
6927
|
+
* @param value - The invalid value to correct
|
|
6928
|
+
* @returns Auto-correction result or undefined if not possible
|
|
6929
|
+
*/
|
|
6930
|
+
autoCorrect?(value: T): AutoCorrectionResult<T>;
|
|
6931
|
+
}
|
|
6932
|
+
/**
|
|
6933
|
+
* Validation options for country identifiers
|
|
6934
|
+
*/
|
|
6935
|
+
interface ValidationOptions {
|
|
6936
|
+
/** Whether to allow formatted input (e.g., '123.456.789-01') */
|
|
6937
|
+
allowFormatted?: boolean;
|
|
6938
|
+
/** Whether to allow normalized input (e.g., '12345678901') */
|
|
6939
|
+
allowNormalized?: boolean;
|
|
6940
|
+
/** Whether to perform strict validation (e.g., check for known invalid numbers) */
|
|
6941
|
+
strict?: boolean;
|
|
6942
|
+
/** Custom error message */
|
|
6943
|
+
errorMessage?: string;
|
|
6944
|
+
}
|
|
6945
|
+
/**
|
|
6946
|
+
* Validation result
|
|
6947
|
+
*/
|
|
6948
|
+
interface ValidationResult {
|
|
6949
|
+
/** Whether validation passed */
|
|
6950
|
+
isValid: boolean;
|
|
6951
|
+
/** Error message if validation failed */
|
|
6952
|
+
error?: string;
|
|
6953
|
+
/** Normalized value (if validation passed) */
|
|
6954
|
+
normalizedValue?: string;
|
|
6955
|
+
/** Formatted value (if validation passed) */
|
|
6956
|
+
formattedValue?: string;
|
|
6957
|
+
}
|
|
6958
|
+
/**
|
|
6959
|
+
* Auto-correction result
|
|
6960
|
+
*/
|
|
6961
|
+
interface AutoCorrectionResult<T = string> {
|
|
6962
|
+
/** Whether auto-correction was successful */
|
|
6963
|
+
success: boolean;
|
|
6964
|
+
/** Corrected value */
|
|
6965
|
+
correctedValue?: T;
|
|
6966
|
+
/** Description of what was corrected */
|
|
6967
|
+
message?: string;
|
|
6968
|
+
}
|
|
6969
|
+
type CountryValidatorFactory<T = string> = (options?: ValidatorFactoryOptions) => CountryValidator<T>;
|
|
6970
|
+
interface ValidatorFactoryOptions {
|
|
6971
|
+
/** Custom validation rules */
|
|
6972
|
+
customRules?: Record<string, unknown>;
|
|
6973
|
+
/** Whether to enable strict mode by default */
|
|
6974
|
+
strict?: boolean;
|
|
6975
|
+
/** Custom error messages */
|
|
6976
|
+
errorMessages?: Record<string, string>;
|
|
6977
|
+
}
|
|
6978
|
+
|
|
6979
|
+
/**
|
|
6980
|
+
* Registers a country validator factory
|
|
6981
|
+
* @param countryCode - ISO 3166-1 alpha-2 country code (e.g., 'BR', 'US')
|
|
6982
|
+
* @param identifierType - Identifier type (e.g., 'cpf', 'ssn')
|
|
6983
|
+
* @param factory - Factory function that creates a validator instance
|
|
6984
|
+
*/
|
|
6985
|
+
declare const registerValidator: (countryCode: string, identifierType: string, factory: CountryValidatorFactory) => void;
|
|
6986
|
+
/**
|
|
6987
|
+
* Resolves a validator for a given country and identifier type
|
|
6988
|
+
* @param countryCode - ISO 3166-1 alpha-2 country code
|
|
6989
|
+
* @param identifierType - Identifier type
|
|
6990
|
+
* @returns Validator instance or undefined if not found
|
|
6991
|
+
*/
|
|
6992
|
+
declare const resolveValidator: (countryCode: string, identifierType: string) => CountryValidator | undefined;
|
|
6993
|
+
/**
|
|
6994
|
+
* Gets all registered validator keys
|
|
6995
|
+
* @returns Array of validator keys (e.g., ['br-cpf', 'us-ssn'])
|
|
6996
|
+
*/
|
|
6997
|
+
declare const getRegisteredValidators: () => string[];
|
|
6998
|
+
/**
|
|
6999
|
+
* Checks if a validator is registered
|
|
7000
|
+
* @param countryCode - ISO 3166-1 alpha-2 country code
|
|
7001
|
+
* @param identifierType - Identifier type
|
|
7002
|
+
* @returns True if validator is registered
|
|
7003
|
+
*/
|
|
7004
|
+
declare const hasValidator: (countryCode: string, identifierType: string) => boolean;
|
|
7005
|
+
|
|
6782
7006
|
/**
|
|
6783
7007
|
* Strategy interface for materializing entity instances (Open/Closed Principle).
|
|
6784
7008
|
*/
|
|
@@ -7814,4 +8038,4 @@ declare const paginationParamsSchema: OpenApiSchema;
|
|
|
7814
8038
|
declare function toPaginationParams(): OpenApiParameter[];
|
|
7815
8039
|
declare function pagedResponseToOpenApiSchema<T extends OpenApiSchema>(itemSchema: T): OpenApiSchema;
|
|
7816
8040
|
|
|
7817
|
-
export { type AliasRefNode, type AnyDomainEvent, type ApiRouteDefinition, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetweenExpressionNode, BigIntTypeStrategy, type BinaryExpressionNode, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, type CascadeMode, type CaseExpressionNode, type CastExpressionNode, type CheckConstraint, type CollateExpressionNode, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type ComponentOptions, type ComponentReference, ConstructorMaterializationStrategy, type CreateDto, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneReferenceApi, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type InExpressionRight, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, IntegerTypeStrategy, InterceptorPipeline, type IntrospectOptions, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NullExpressionNode, type NumberFilter, type OpenApiComponent, type OpenApiDialect, type OpenApiDocument, type OpenApiDocumentInfo, type OpenApiDocumentOptions, type OpenApiOperation, type OpenApiParameter, type OpenApiParameterObject, type OpenApiResponseObject, type OpenApiSchema, type OpenApiType, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PagedResponse, type PaginatedResult, type PaginationParams, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, PrototypeMaterializationStrategy, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey$1 as RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, STANDARD_COLUMN_TYPES, type SaveGraphInputPayload, type SaveGraphInputScalar, type SaveGraphJsonScalar, type SaveGraphSessionOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, type SimpleWhereInput, type Simplify, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type StringFilter, StringTypeStrategy, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeMappingService, type TypeMappingStrategy, TypeScriptGenerator, type TypedExpression, type TypedLike, type UpdateDto, UpdateQueryBuilder, UuidTypeStrategy, type ValueOperandInput, type WhereInput, type WindowFunctionNode, type WithRelations, abs, acos, add, addDomainEvent, age, aliasRef, and, applyFilter, applyNullability, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterExpression, calculateTotalPages, canonicalizeSchema, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, columnToFilterSchema, columnToOpenApiSchema, columnTypeToOpenApiFormat, columnTypeToOpenApiType, computePaginationMetadata, computeSchemaHash, concat, concatWs, correlateBy, cos, cot, count, countAll, createApiComponentsSection, createDeterministicNamingState, createDtoToOpenApiSchema, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createRef, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, firstValue, floor, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, getColumn, getColumnMap, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isNullableColumn, isOperandNode, isTableDef, isValueOperandInput, isWindowFunctionNode, jsonArrayAgg, jsonContains, jsonLength, jsonPath, jsonSet, jsonify, lag, lastValue, lead, least, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, localTime, localTimestamp, locate, log, log10, log2, logBase, lower, lpad, lt, lte, ltrim, mapFields, materializeAs, max, md5, mergeSchemas, min, minute, mod, month, mul, neq, nestedDtoToOpenApiSchema, nestedWhereInputToOpenApiSchema, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pagedResponseToOpenApiSchema, paginationParamsSchema, parameterToRef, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
|
|
8041
|
+
export { type AliasRefNode, Alphanumeric, type AnyDomainEvent, type ApiRouteDefinition, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, type AutoCorrectionResult, type AutoTransformResult, type AutoTransformableValidator, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetweenExpressionNode, BigIntTypeStrategy, type BinaryExpressionNode, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, CEP, CNPJ, CPF, Capitalize, type CascadeMode, type CaseExpressionNode, type CastExpressionNode, type CheckConstraint, type CollateExpressionNode, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type ComponentOptions, type ComponentReference, type CompositeTransformer, ConstructorMaterializationStrategy, type ValidationResult as CountryValidationResult, type CountryValidator, type CountryValidatorFactory, type CreateDto, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, Email, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneReferenceApi, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type InExpressionRight, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, IntegerTypeStrategy, InterceptorPipeline, type IntrospectOptions, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, Length, type LiteralNode, type LiteralValue, type LogicalExpressionNode, Lower, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NullExpressionNode, type NumberFilter, type OpenApiComponent, type OpenApiDialect, type OpenApiDocument, type OpenApiDocumentInfo, type OpenApiDocumentOptions, type OpenApiOperation, type OpenApiParameter, type OpenApiParameterObject, type OpenApiResponseObject, type OpenApiSchema, type OpenApiType, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PagedResponse, type PaginatedResult, type PaginationParams, Pattern, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, type PropertySanitizer, type PropertyTransformer, type PropertyValidator, PrototypeMaterializationStrategy, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey$1 as RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, STANDARD_COLUMN_TYPES, type SaveGraphInputPayload, type SaveGraphInputScalar, type SaveGraphJsonScalar, type SaveGraphSessionOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, type SimpleWhereInput, type Simplify, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type StringFilter, StringTypeStrategy, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, Title, type TrackedEntity, type TransformContext, type TransformerConfig, type TransformerMetadata, Trim, TypeMappingService, type TypeMappingStrategy, TypeScriptGenerator, type TypedExpression, type TypedLike, type UpdateDto, UpdateQueryBuilder, Upper, UuidTypeStrategy, type ValidationOptions, type ValidationResult$1 as ValidationResult, type ValidatorFactoryOptions, type ValueOperandInput, type WhereInput, type WindowFunctionNode, type WithRelations, abs, acos, add, addDomainEvent, age, aliasRef, and, applyFilter, applyNullability, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterExpression, calculateTotalPages, canonicalizeSchema, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, columnToFilterSchema, columnToOpenApiSchema, columnTypeToOpenApiFormat, columnTypeToOpenApiType, computePaginationMetadata, computeSchemaHash, concat, concatWs, correlateBy, cos, cot, count, countAll, createApiComponentsSection, createDeterministicNamingState, createDtoToOpenApiSchema, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createRef, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, firstValue, floor, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, getColumn, getColumnMap, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getRegisteredValidators, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hasValidator, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isNullableColumn, isOperandNode, isTableDef, isValueOperandInput, isWindowFunctionNode, jsonArrayAgg, jsonContains, jsonLength, jsonPath, jsonSet, jsonify, lag, lastValue, lead, least, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, localTime, localTimestamp, locate, log, log10, log2, logBase, lower, lpad, lt, lte, ltrim, mapFields, materializeAs, max, md5, mergeSchemas, min, minute, mod, month, mul, neq, nestedDtoToOpenApiSchema, nestedWhereInputToOpenApiSchema, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pagedResponseToOpenApiSchema, paginationParamsSchema, parameterToRef, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, registerValidator, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, resolveValidator, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
|
package/dist/index.d.ts
CHANGED
|
@@ -2716,6 +2716,58 @@ interface SimpleQueryRunner {
|
|
|
2716
2716
|
*/
|
|
2717
2717
|
declare function createExecutorFromQueryRunner(runner: SimpleQueryRunner): DbExecutor;
|
|
2718
2718
|
|
|
2719
|
+
interface TransformContext {
|
|
2720
|
+
entityName: string;
|
|
2721
|
+
propertyName: string;
|
|
2722
|
+
columnType: ColumnType;
|
|
2723
|
+
isUpdate: boolean;
|
|
2724
|
+
originalValue?: unknown;
|
|
2725
|
+
autoTransform: boolean;
|
|
2726
|
+
}
|
|
2727
|
+
interface AutoTransformResult<T = unknown> {
|
|
2728
|
+
success: boolean;
|
|
2729
|
+
correctedValue?: T;
|
|
2730
|
+
message?: string;
|
|
2731
|
+
}
|
|
2732
|
+
interface PropertyTransformer<TInput = unknown, TOutput = unknown> {
|
|
2733
|
+
readonly name: string;
|
|
2734
|
+
transform(value: TInput, context: TransformContext): TOutput;
|
|
2735
|
+
}
|
|
2736
|
+
interface PropertyValidator<T = unknown> {
|
|
2737
|
+
readonly name: string;
|
|
2738
|
+
validate(value: T, context: TransformContext): ValidationResult$1;
|
|
2739
|
+
}
|
|
2740
|
+
interface PropertySanitizer<T = unknown> {
|
|
2741
|
+
readonly name: string;
|
|
2742
|
+
sanitize(value: T, context: TransformContext): T;
|
|
2743
|
+
}
|
|
2744
|
+
interface CompositeTransformer<TInput = unknown, TOutput = unknown> extends PropertyTransformer<TInput, TOutput>, PropertyValidator<TInput> {
|
|
2745
|
+
}
|
|
2746
|
+
interface AutoTransformableValidator<T = unknown> extends PropertyValidator<T> {
|
|
2747
|
+
/**
|
|
2748
|
+
* Attempts to automatically correct an invalid value.
|
|
2749
|
+
* Returns undefined if auto-correction is not possible.
|
|
2750
|
+
*/
|
|
2751
|
+
autoTransform?(value: T, context: TransformContext): AutoTransformResult<T>;
|
|
2752
|
+
}
|
|
2753
|
+
interface ValidationResult$1 {
|
|
2754
|
+
isValid: boolean;
|
|
2755
|
+
error?: string;
|
|
2756
|
+
message?: string;
|
|
2757
|
+
}
|
|
2758
|
+
interface TransformerMetadata {
|
|
2759
|
+
propertyName: string;
|
|
2760
|
+
transformers: PropertyTransformer[];
|
|
2761
|
+
validators: PropertyValidator[];
|
|
2762
|
+
sanitizers: PropertySanitizer[];
|
|
2763
|
+
executionOrder: 'before-save' | 'after-load' | 'both';
|
|
2764
|
+
}
|
|
2765
|
+
interface TransformerConfig {
|
|
2766
|
+
auto?: boolean;
|
|
2767
|
+
execute?: 'before-save' | 'after-load' | 'both';
|
|
2768
|
+
stopOnFirstError?: boolean;
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2719
2771
|
/**
|
|
2720
2772
|
* Constructor type for entities.
|
|
2721
2773
|
* Supports any constructor signature for maximum flexibility with decorator-based entities.
|
|
@@ -6771,6 +6823,10 @@ interface DecoratorMetadataBag {
|
|
|
6771
6823
|
propertyName: string;
|
|
6772
6824
|
relation: RelationMetadata;
|
|
6773
6825
|
}>;
|
|
6826
|
+
transformers: Array<{
|
|
6827
|
+
propertyName: string;
|
|
6828
|
+
metadata: TransformerMetadata;
|
|
6829
|
+
}>;
|
|
6774
6830
|
}
|
|
6775
6831
|
/**
|
|
6776
6832
|
* Public helper to read decorator metadata from a class constructor.
|
|
@@ -6779,6 +6835,174 @@ interface DecoratorMetadataBag {
|
|
|
6779
6835
|
*/
|
|
6780
6836
|
declare const getDecoratorMetadata: (ctor: object) => DecoratorMetadataBag | undefined;
|
|
6781
6837
|
|
|
6838
|
+
declare function Trim(options?: {
|
|
6839
|
+
trimStart?: boolean;
|
|
6840
|
+
trimEnd?: boolean;
|
|
6841
|
+
trimAll?: boolean;
|
|
6842
|
+
}): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6843
|
+
declare function Lower(): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6844
|
+
declare function Upper(): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6845
|
+
declare function Capitalize(): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6846
|
+
declare function Title(): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6847
|
+
declare function Alphanumeric(options?: {
|
|
6848
|
+
allowSpaces?: boolean;
|
|
6849
|
+
allowUnderscores?: boolean;
|
|
6850
|
+
allowHyphens?: boolean;
|
|
6851
|
+
}): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6852
|
+
declare function Email(options?: {
|
|
6853
|
+
allowPlus?: boolean;
|
|
6854
|
+
requireTLD?: boolean;
|
|
6855
|
+
}): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6856
|
+
declare function Length(options: {
|
|
6857
|
+
min?: number;
|
|
6858
|
+
max?: number;
|
|
6859
|
+
exact?: number;
|
|
6860
|
+
}): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6861
|
+
declare function Pattern(options: {
|
|
6862
|
+
pattern: RegExp;
|
|
6863
|
+
flags?: string;
|
|
6864
|
+
errorMessage?: string;
|
|
6865
|
+
replacement?: string;
|
|
6866
|
+
}): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6867
|
+
|
|
6868
|
+
/**
|
|
6869
|
+
* Decorator to validate a Brazilian CPF number
|
|
6870
|
+
* @param options - Validation options
|
|
6871
|
+
* @returns Property decorator for CPF validation
|
|
6872
|
+
*/
|
|
6873
|
+
declare function CPF(options?: {
|
|
6874
|
+
strict?: boolean;
|
|
6875
|
+
errorMessage?: string;
|
|
6876
|
+
}): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6877
|
+
/**
|
|
6878
|
+
* Decorator to validate a Brazilian CNPJ number
|
|
6879
|
+
* @param options - Validation options
|
|
6880
|
+
* @returns Property decorator for CNPJ validation
|
|
6881
|
+
*/
|
|
6882
|
+
declare function CNPJ(options?: {
|
|
6883
|
+
strict?: boolean;
|
|
6884
|
+
errorMessage?: string;
|
|
6885
|
+
}): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6886
|
+
/**
|
|
6887
|
+
* Decorator to validate a Brazilian CEP number
|
|
6888
|
+
* @param options - Validation options
|
|
6889
|
+
* @returns Property decorator for CEP validation
|
|
6890
|
+
*/
|
|
6891
|
+
declare function CEP(options?: {
|
|
6892
|
+
strict?: boolean;
|
|
6893
|
+
errorMessage?: string;
|
|
6894
|
+
}): (_value: unknown, context: ClassFieldDecoratorContext) => void;
|
|
6895
|
+
|
|
6896
|
+
/**
|
|
6897
|
+
* Base interface for country-specific identifier validators
|
|
6898
|
+
*/
|
|
6899
|
+
interface CountryValidator<T = string> {
|
|
6900
|
+
/** ISO 3166-1 alpha-2 country code (e.g., 'BR', 'US') */
|
|
6901
|
+
readonly countryCode: string;
|
|
6902
|
+
/** Identifier type (e.g., 'cpf', 'cnpj', 'ssn', 'zip') */
|
|
6903
|
+
readonly identifierType: string;
|
|
6904
|
+
/** Unique validator name (e.g., 'br-cpf', 'us-ssn') */
|
|
6905
|
+
readonly name: string;
|
|
6906
|
+
/**
|
|
6907
|
+
* Validates an identifier value
|
|
6908
|
+
* @param value - The identifier value to validate
|
|
6909
|
+
* @param options - Validation options
|
|
6910
|
+
* @returns Validation result with success status and optional error message
|
|
6911
|
+
*/
|
|
6912
|
+
validate(value: T, options?: ValidationOptions): ValidationResult;
|
|
6913
|
+
/**
|
|
6914
|
+
* Normalizes an identifier value (removes formatting, standardizes)
|
|
6915
|
+
* @param value - The identifier value to normalize
|
|
6916
|
+
* @returns Normalized value (digits only, uppercase, etc.)
|
|
6917
|
+
*/
|
|
6918
|
+
normalize(value: T): string;
|
|
6919
|
+
/**
|
|
6920
|
+
* Formats an identifier value according to country standards
|
|
6921
|
+
* @param value - The identifier value to format (can be normalized or formatted)
|
|
6922
|
+
* @returns Formatted value (e.g., '123.456.789-01' for CPF)
|
|
6923
|
+
*/
|
|
6924
|
+
format(value: T): string;
|
|
6925
|
+
/**
|
|
6926
|
+
* Attempts to auto-correct an invalid value
|
|
6927
|
+
* @param value - The invalid value to correct
|
|
6928
|
+
* @returns Auto-correction result or undefined if not possible
|
|
6929
|
+
*/
|
|
6930
|
+
autoCorrect?(value: T): AutoCorrectionResult<T>;
|
|
6931
|
+
}
|
|
6932
|
+
/**
|
|
6933
|
+
* Validation options for country identifiers
|
|
6934
|
+
*/
|
|
6935
|
+
interface ValidationOptions {
|
|
6936
|
+
/** Whether to allow formatted input (e.g., '123.456.789-01') */
|
|
6937
|
+
allowFormatted?: boolean;
|
|
6938
|
+
/** Whether to allow normalized input (e.g., '12345678901') */
|
|
6939
|
+
allowNormalized?: boolean;
|
|
6940
|
+
/** Whether to perform strict validation (e.g., check for known invalid numbers) */
|
|
6941
|
+
strict?: boolean;
|
|
6942
|
+
/** Custom error message */
|
|
6943
|
+
errorMessage?: string;
|
|
6944
|
+
}
|
|
6945
|
+
/**
|
|
6946
|
+
* Validation result
|
|
6947
|
+
*/
|
|
6948
|
+
interface ValidationResult {
|
|
6949
|
+
/** Whether validation passed */
|
|
6950
|
+
isValid: boolean;
|
|
6951
|
+
/** Error message if validation failed */
|
|
6952
|
+
error?: string;
|
|
6953
|
+
/** Normalized value (if validation passed) */
|
|
6954
|
+
normalizedValue?: string;
|
|
6955
|
+
/** Formatted value (if validation passed) */
|
|
6956
|
+
formattedValue?: string;
|
|
6957
|
+
}
|
|
6958
|
+
/**
|
|
6959
|
+
* Auto-correction result
|
|
6960
|
+
*/
|
|
6961
|
+
interface AutoCorrectionResult<T = string> {
|
|
6962
|
+
/** Whether auto-correction was successful */
|
|
6963
|
+
success: boolean;
|
|
6964
|
+
/** Corrected value */
|
|
6965
|
+
correctedValue?: T;
|
|
6966
|
+
/** Description of what was corrected */
|
|
6967
|
+
message?: string;
|
|
6968
|
+
}
|
|
6969
|
+
type CountryValidatorFactory<T = string> = (options?: ValidatorFactoryOptions) => CountryValidator<T>;
|
|
6970
|
+
interface ValidatorFactoryOptions {
|
|
6971
|
+
/** Custom validation rules */
|
|
6972
|
+
customRules?: Record<string, unknown>;
|
|
6973
|
+
/** Whether to enable strict mode by default */
|
|
6974
|
+
strict?: boolean;
|
|
6975
|
+
/** Custom error messages */
|
|
6976
|
+
errorMessages?: Record<string, string>;
|
|
6977
|
+
}
|
|
6978
|
+
|
|
6979
|
+
/**
|
|
6980
|
+
* Registers a country validator factory
|
|
6981
|
+
* @param countryCode - ISO 3166-1 alpha-2 country code (e.g., 'BR', 'US')
|
|
6982
|
+
* @param identifierType - Identifier type (e.g., 'cpf', 'ssn')
|
|
6983
|
+
* @param factory - Factory function that creates a validator instance
|
|
6984
|
+
*/
|
|
6985
|
+
declare const registerValidator: (countryCode: string, identifierType: string, factory: CountryValidatorFactory) => void;
|
|
6986
|
+
/**
|
|
6987
|
+
* Resolves a validator for a given country and identifier type
|
|
6988
|
+
* @param countryCode - ISO 3166-1 alpha-2 country code
|
|
6989
|
+
* @param identifierType - Identifier type
|
|
6990
|
+
* @returns Validator instance or undefined if not found
|
|
6991
|
+
*/
|
|
6992
|
+
declare const resolveValidator: (countryCode: string, identifierType: string) => CountryValidator | undefined;
|
|
6993
|
+
/**
|
|
6994
|
+
* Gets all registered validator keys
|
|
6995
|
+
* @returns Array of validator keys (e.g., ['br-cpf', 'us-ssn'])
|
|
6996
|
+
*/
|
|
6997
|
+
declare const getRegisteredValidators: () => string[];
|
|
6998
|
+
/**
|
|
6999
|
+
* Checks if a validator is registered
|
|
7000
|
+
* @param countryCode - ISO 3166-1 alpha-2 country code
|
|
7001
|
+
* @param identifierType - Identifier type
|
|
7002
|
+
* @returns True if validator is registered
|
|
7003
|
+
*/
|
|
7004
|
+
declare const hasValidator: (countryCode: string, identifierType: string) => boolean;
|
|
7005
|
+
|
|
6782
7006
|
/**
|
|
6783
7007
|
* Strategy interface for materializing entity instances (Open/Closed Principle).
|
|
6784
7008
|
*/
|
|
@@ -7814,4 +8038,4 @@ declare const paginationParamsSchema: OpenApiSchema;
|
|
|
7814
8038
|
declare function toPaginationParams(): OpenApiParameter[];
|
|
7815
8039
|
declare function pagedResponseToOpenApiSchema<T extends OpenApiSchema>(itemSchema: T): OpenApiSchema;
|
|
7816
8040
|
|
|
7817
|
-
export { type AliasRefNode, type AnyDomainEvent, type ApiRouteDefinition, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetweenExpressionNode, BigIntTypeStrategy, type BinaryExpressionNode, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, type CascadeMode, type CaseExpressionNode, type CastExpressionNode, type CheckConstraint, type CollateExpressionNode, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type ComponentOptions, type ComponentReference, ConstructorMaterializationStrategy, type CreateDto, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneReferenceApi, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type InExpressionRight, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, IntegerTypeStrategy, InterceptorPipeline, type IntrospectOptions, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NullExpressionNode, type NumberFilter, type OpenApiComponent, type OpenApiDialect, type OpenApiDocument, type OpenApiDocumentInfo, type OpenApiDocumentOptions, type OpenApiOperation, type OpenApiParameter, type OpenApiParameterObject, type OpenApiResponseObject, type OpenApiSchema, type OpenApiType, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PagedResponse, type PaginatedResult, type PaginationParams, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, PrototypeMaterializationStrategy, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey$1 as RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, STANDARD_COLUMN_TYPES, type SaveGraphInputPayload, type SaveGraphInputScalar, type SaveGraphJsonScalar, type SaveGraphSessionOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, type SimpleWhereInput, type Simplify, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type StringFilter, StringTypeStrategy, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeMappingService, type TypeMappingStrategy, TypeScriptGenerator, type TypedExpression, type TypedLike, type UpdateDto, UpdateQueryBuilder, UuidTypeStrategy, type ValueOperandInput, type WhereInput, type WindowFunctionNode, type WithRelations, abs, acos, add, addDomainEvent, age, aliasRef, and, applyFilter, applyNullability, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterExpression, calculateTotalPages, canonicalizeSchema, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, columnToFilterSchema, columnToOpenApiSchema, columnTypeToOpenApiFormat, columnTypeToOpenApiType, computePaginationMetadata, computeSchemaHash, concat, concatWs, correlateBy, cos, cot, count, countAll, createApiComponentsSection, createDeterministicNamingState, createDtoToOpenApiSchema, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createRef, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, firstValue, floor, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, getColumn, getColumnMap, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isNullableColumn, isOperandNode, isTableDef, isValueOperandInput, isWindowFunctionNode, jsonArrayAgg, jsonContains, jsonLength, jsonPath, jsonSet, jsonify, lag, lastValue, lead, least, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, localTime, localTimestamp, locate, log, log10, log2, logBase, lower, lpad, lt, lte, ltrim, mapFields, materializeAs, max, md5, mergeSchemas, min, minute, mod, month, mul, neq, nestedDtoToOpenApiSchema, nestedWhereInputToOpenApiSchema, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pagedResponseToOpenApiSchema, paginationParamsSchema, parameterToRef, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
|
|
8041
|
+
export { type AliasRefNode, Alphanumeric, type AnyDomainEvent, type ApiRouteDefinition, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, type AutoCorrectionResult, type AutoTransformResult, type AutoTransformableValidator, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetweenExpressionNode, BigIntTypeStrategy, type BinaryExpressionNode, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, CEP, CNPJ, CPF, Capitalize, type CascadeMode, type CaseExpressionNode, type CastExpressionNode, type CheckConstraint, type CollateExpressionNode, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type ComponentOptions, type ComponentReference, type CompositeTransformer, ConstructorMaterializationStrategy, type ValidationResult as CountryValidationResult, type CountryValidator, type CountryValidatorFactory, type CreateDto, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, Email, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneReferenceApi, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type InExpressionRight, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, IntegerTypeStrategy, InterceptorPipeline, type IntrospectOptions, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, Length, type LiteralNode, type LiteralValue, type LogicalExpressionNode, Lower, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NullExpressionNode, type NumberFilter, type OpenApiComponent, type OpenApiDialect, type OpenApiDocument, type OpenApiDocumentInfo, type OpenApiDocumentOptions, type OpenApiOperation, type OpenApiParameter, type OpenApiParameterObject, type OpenApiResponseObject, type OpenApiSchema, type OpenApiType, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PagedResponse, type PaginatedResult, type PaginationParams, Pattern, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, type PropertySanitizer, type PropertyTransformer, type PropertyValidator, PrototypeMaterializationStrategy, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey$1 as RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, STANDARD_COLUMN_TYPES, type SaveGraphInputPayload, type SaveGraphInputScalar, type SaveGraphJsonScalar, type SaveGraphSessionOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, type SimpleWhereInput, type Simplify, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type StringFilter, StringTypeStrategy, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, Title, type TrackedEntity, type TransformContext, type TransformerConfig, type TransformerMetadata, Trim, TypeMappingService, type TypeMappingStrategy, TypeScriptGenerator, type TypedExpression, type TypedLike, type UpdateDto, UpdateQueryBuilder, Upper, UuidTypeStrategy, type ValidationOptions, type ValidationResult$1 as ValidationResult, type ValidatorFactoryOptions, type ValueOperandInput, type WhereInput, type WindowFunctionNode, type WithRelations, abs, acos, add, addDomainEvent, age, aliasRef, and, applyFilter, applyNullability, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterExpression, calculateTotalPages, canonicalizeSchema, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, columnToFilterSchema, columnToOpenApiSchema, columnTypeToOpenApiFormat, columnTypeToOpenApiType, computePaginationMetadata, computeSchemaHash, concat, concatWs, correlateBy, cos, cot, count, countAll, createApiComponentsSection, createDeterministicNamingState, createDtoToOpenApiSchema, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createRef, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, firstValue, floor, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, getColumn, getColumnMap, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getRegisteredValidators, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hasValidator, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isNullableColumn, isOperandNode, isTableDef, isValueOperandInput, isWindowFunctionNode, jsonArrayAgg, jsonContains, jsonLength, jsonPath, jsonSet, jsonify, lag, lastValue, lead, least, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, localTime, localTimestamp, locate, log, log10, log2, logBase, lower, lpad, lt, lte, ltrim, mapFields, materializeAs, max, md5, mergeSchemas, min, minute, mod, month, mul, neq, nestedDtoToOpenApiSchema, nestedWhereInputToOpenApiSchema, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pagedResponseToOpenApiSchema, paginationParamsSchema, parameterToRef, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, registerValidator, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, resolveValidator, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
|