metal-orm 1.1.2 → 1.1.3
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/README.md +13 -4
- package/dist/index.cjs +158 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +108 -1
- package/dist/index.d.ts +108 -1
- package/dist/index.js +163 -0
- package/dist/index.js.map +1 -1
- package/package.json +8 -2
- package/src/cache/adapters/keyv-cache-adapter.ts +5 -0
- package/src/cache/adapters/memory-cache-adapter.ts +5 -0
- package/src/cache/adapters/redis-cache-adapter.ts +233 -0
- package/src/cache/cache-interfaces.ts +11 -0
- package/src/cache/index.ts +2 -0
package/dist/index.d.cts
CHANGED
|
@@ -3038,11 +3038,21 @@ interface CacheInvalidator {
|
|
|
3038
3038
|
invalidateTags(tags: string[]): Promise<void>;
|
|
3039
3039
|
invalidatePrefix(prefix: string): Promise<void>;
|
|
3040
3040
|
}
|
|
3041
|
+
/**
|
|
3042
|
+
* Capabilities de um cache provider
|
|
3043
|
+
* Permite detectar funcionalidades suportadas em runtime
|
|
3044
|
+
*/
|
|
3045
|
+
interface CacheCapabilities {
|
|
3046
|
+
tags: boolean;
|
|
3047
|
+
prefix: boolean;
|
|
3048
|
+
ttl: boolean;
|
|
3049
|
+
}
|
|
3041
3050
|
/**
|
|
3042
3051
|
* Interface completa para implementações full-featured
|
|
3043
3052
|
*/
|
|
3044
3053
|
interface CacheProvider extends CacheReader, CacheWriter, CacheInvalidator {
|
|
3045
3054
|
readonly name: string;
|
|
3055
|
+
readonly capabilities: CacheCapabilities;
|
|
3046
3056
|
dispose?(): Promise<void>;
|
|
3047
3057
|
}
|
|
3048
3058
|
/**
|
|
@@ -3209,6 +3219,11 @@ declare class DefaultCacheStrategy implements CacheStrategy {
|
|
|
3209
3219
|
*/
|
|
3210
3220
|
declare class MemoryCacheAdapter implements CacheProvider {
|
|
3211
3221
|
readonly name = "memory";
|
|
3222
|
+
readonly capabilities: {
|
|
3223
|
+
tags: boolean;
|
|
3224
|
+
prefix: boolean;
|
|
3225
|
+
ttl: boolean;
|
|
3226
|
+
};
|
|
3212
3227
|
private storage;
|
|
3213
3228
|
private tagIndex;
|
|
3214
3229
|
get<T>(key: string): Promise<T | undefined>;
|
|
@@ -3255,6 +3270,11 @@ interface KeyvInstance {
|
|
|
3255
3270
|
declare class KeyvCacheAdapter implements CacheProvider {
|
|
3256
3271
|
private keyv;
|
|
3257
3272
|
readonly name = "keyv";
|
|
3273
|
+
readonly capabilities: {
|
|
3274
|
+
tags: boolean;
|
|
3275
|
+
prefix: boolean;
|
|
3276
|
+
ttl: boolean;
|
|
3277
|
+
};
|
|
3258
3278
|
constructor(keyv: KeyvInstance);
|
|
3259
3279
|
get<T>(key: string): Promise<T | undefined>;
|
|
3260
3280
|
has(key: string): Promise<boolean>;
|
|
@@ -3266,6 +3286,93 @@ declare class KeyvCacheAdapter implements CacheProvider {
|
|
|
3266
3286
|
dispose(): Promise<void>;
|
|
3267
3287
|
}
|
|
3268
3288
|
|
|
3289
|
+
interface RedisLike {
|
|
3290
|
+
get(key: string): Promise<string | null>;
|
|
3291
|
+
set(key: string, value: string, ...args: (string | number)[]): Promise<string | null>;
|
|
3292
|
+
del(...keys: string[]): Promise<number>;
|
|
3293
|
+
sadd(key: string, ...members: string[]): Promise<number>;
|
|
3294
|
+
smembers(key: string): Promise<string[]>;
|
|
3295
|
+
srem(key: string, ...members: string[]): Promise<number>;
|
|
3296
|
+
scan(cursor: string | number, ...args: (string | number)[]): Promise<[string, string[]]>;
|
|
3297
|
+
quit(): Promise<string>;
|
|
3298
|
+
disconnect(): void;
|
|
3299
|
+
isReady?: boolean;
|
|
3300
|
+
status?: string;
|
|
3301
|
+
}
|
|
3302
|
+
interface RedisOptions {
|
|
3303
|
+
host?: string;
|
|
3304
|
+
port?: number;
|
|
3305
|
+
password?: string;
|
|
3306
|
+
db?: number;
|
|
3307
|
+
keyPrefix?: string;
|
|
3308
|
+
lazyConnect?: boolean;
|
|
3309
|
+
[key: string]: unknown;
|
|
3310
|
+
}
|
|
3311
|
+
/**
|
|
3312
|
+
* Adapter para Redis usando ioredis
|
|
3313
|
+
*
|
|
3314
|
+
* Suporta:
|
|
3315
|
+
* - Tags via Redis Sets (SADD, SMEMBERS, SREM)
|
|
3316
|
+
* - Prefix invalidation via SCAN
|
|
3317
|
+
* - TTL nativo do Redis
|
|
3318
|
+
*
|
|
3319
|
+
* Instalação:
|
|
3320
|
+
* npm install ioredis
|
|
3321
|
+
*
|
|
3322
|
+
* Para testes (dev):
|
|
3323
|
+
* npm install --save-dev ioredis-mock
|
|
3324
|
+
*/
|
|
3325
|
+
declare class RedisCacheAdapter implements CacheProvider {
|
|
3326
|
+
readonly name = "redis";
|
|
3327
|
+
readonly capabilities: {
|
|
3328
|
+
tags: boolean;
|
|
3329
|
+
prefix: boolean;
|
|
3330
|
+
ttl: boolean;
|
|
3331
|
+
};
|
|
3332
|
+
private redis;
|
|
3333
|
+
private ownsConnection;
|
|
3334
|
+
private tagPrefix;
|
|
3335
|
+
/**
|
|
3336
|
+
* Cria um adapter Redis
|
|
3337
|
+
*
|
|
3338
|
+
* @param redis - Instância do ioredis OU opções de conexão
|
|
3339
|
+
* @param options - Opções adicionais
|
|
3340
|
+
* @param options.tagPrefix - Prefixo para chaves de tag (default: 'tag:')
|
|
3341
|
+
*
|
|
3342
|
+
* Exemplos:
|
|
3343
|
+
*
|
|
3344
|
+
* // Com instância existente (recomendado para connection pooling):
|
|
3345
|
+
* const redis = new Redis({ host: 'localhost', port: 6379 });
|
|
3346
|
+
* const adapter = new RedisCacheAdapter(redis);
|
|
3347
|
+
*
|
|
3348
|
+
* // Com opções (adapter gerencia conexão):
|
|
3349
|
+
* const adapter = new RedisCacheAdapter({ host: 'localhost', port: 6379 });
|
|
3350
|
+
*
|
|
3351
|
+
* // Para testes com ioredis-mock:
|
|
3352
|
+
* import Redis from 'ioredis-mock';
|
|
3353
|
+
* const adapter = new RedisCacheAdapter(new Redis());
|
|
3354
|
+
*/
|
|
3355
|
+
constructor(redis: RedisLike | RedisOptions, options?: {
|
|
3356
|
+
tagPrefix?: string;
|
|
3357
|
+
});
|
|
3358
|
+
private isRedisInstance;
|
|
3359
|
+
private createRedis;
|
|
3360
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
3361
|
+
has(key: string): Promise<boolean>;
|
|
3362
|
+
set<T>(key: string, value: T, ttlMs?: number, tags?: string[]): Promise<void>;
|
|
3363
|
+
delete(key: string): Promise<void>;
|
|
3364
|
+
invalidate(key: string): Promise<void>;
|
|
3365
|
+
invalidateTags(tags: string[]): Promise<void>;
|
|
3366
|
+
invalidatePrefix(prefix: string): Promise<void>;
|
|
3367
|
+
private registerTags;
|
|
3368
|
+
dispose(): Promise<void>;
|
|
3369
|
+
/**
|
|
3370
|
+
* Retorna a instância Redis subjacente
|
|
3371
|
+
* Útil para operações avançadas ou health checks
|
|
3372
|
+
*/
|
|
3373
|
+
getRedis(): RedisLike;
|
|
3374
|
+
}
|
|
3375
|
+
|
|
3269
3376
|
/**
|
|
3270
3377
|
* Indexa chaves por tags para invalidação em massa
|
|
3271
3378
|
* Implementação em memória (pode ser persistida no Redis)
|
|
@@ -9531,4 +9638,4 @@ declare function setTreeBounds(entity: object, config: TreeConfig, lft: number,
|
|
|
9531
9638
|
*/
|
|
9532
9639
|
declare function setTreeParentId(entity: object, config: TreeConfig, parentId: unknown): void;
|
|
9533
9640
|
|
|
9534
|
-
export { type AliasRefNode, Alphanumeric, type AnyDomainEvent, type ApiRouteDefinition, type ApplyFilterOptions, 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, BinaryTypeStrategy, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, CEP, CNPJ, CPF, type CacheInvalidator, type CacheOptions, type CacheProvider, type CacheReader, type CacheState, type CacheStrategy, type CacheWriter, 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, DEFAULT_TREE_CONFIG, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DatabaseView, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultCacheStrategy, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, type Duration, Email, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecuteFilteredPagedOptions, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type FindChildrenOptions, type FindPathOptions, 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 InvalidationStrategy, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, KeyvCacheAdapter, Length, type LiteralNode, type LiteralValue, type LogicalExpressionNode, Lower, type ManyToManyCollection, MemoryCacheAdapter, type MoveOptions, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NestedSetBounds, type NestedSetRow, NestedSetStrategy, type NodeWithPk, 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 OrmCacheOptions, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PagedResponse, type PaginatedResult, type PaginationParams, type PatchGraphInputPayload, Pattern, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, type PropertySanitizer, type PropertyTransformer, type PropertyValidator, PrototypeMaterializationStrategy, QueryCacheManager, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type RecoverResult, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationFilter, 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, TagIndex, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type ThreadedNode, Title, type ToJsonOptions, type TrackedEntity, type TransformContext, type TransformerConfig, type TransformerMetadata, Tree, TreeChildren, type TreeColumns, type TreeConfig, type TreeDecoratorOptions, type TreeInsertData, type TreeListEntry, type TreeListOptions, type TreeListSchemaOptions, TreeManager, type TreeManagerOptions, type TreeMetadata, type TreeMoveData, type TreeNode, type TreeNodeResult, type TreeNodeResultSchemaOptions, type TreeNodeSchemaOptions, TreeParent, type TreeQuery, type TreeScope, type TreeValidationResult, 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, buildScopeConditions, calculateRowDepths, 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, createTreeManager, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeFilteredPaged, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, extractScopeValues, firstValue, floor, formatDuration, formatTreeList, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, generateTreeComponents, getColumn, getColumnMap, getColumnType, getDateKind, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getRegisteredValidators, getSchemaIntrospector, getTableDefFromEntity, getTreeBounds, getTreeColumns, getTreeConfig, getTreeMetadata, getTreeParentId, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hasTreeBehavior, hasValidator, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isNullableColumn, isOperandNode, isTableDef, isTreeConfig, isValidDuration, 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, parseDuration, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, registerValidator, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, resolveTreeConfig, resolveValidator, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, setTreeBounds, setTreeMetadata, setTreeParentId, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, threadResults, threadedNodeToOpenApiSchema, toColumnRef, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, treeEntityRegistry, treeListEntryToOpenApiSchema, treeNodeResultToOpenApiSchema, treeNodeToOpenApiSchema, treeQuery, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, validateTreeTable, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
|
|
9641
|
+
export { type AliasRefNode, Alphanumeric, type AnyDomainEvent, type ApiRouteDefinition, type ApplyFilterOptions, 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, BinaryTypeStrategy, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, CEP, CNPJ, CPF, type CacheCapabilities, type CacheInvalidator, type CacheOptions, type CacheProvider, type CacheReader, type CacheState, type CacheStrategy, type CacheWriter, 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, DEFAULT_TREE_CONFIG, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DatabaseView, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultCacheStrategy, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, type Duration, Email, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecuteFilteredPagedOptions, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type FindChildrenOptions, type FindPathOptions, 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 InvalidationStrategy, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, KeyvCacheAdapter, Length, type LiteralNode, type LiteralValue, type LogicalExpressionNode, Lower, type ManyToManyCollection, MemoryCacheAdapter, type MoveOptions, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NestedSetBounds, type NestedSetRow, NestedSetStrategy, type NodeWithPk, 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 OrmCacheOptions, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PagedResponse, type PaginatedResult, type PaginationParams, type PatchGraphInputPayload, Pattern, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, type PropertySanitizer, type PropertyTransformer, type PropertyValidator, PrototypeMaterializationStrategy, QueryCacheManager, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type RecoverResult, RedisCacheAdapter, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationFilter, 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, TagIndex, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type ThreadedNode, Title, type ToJsonOptions, type TrackedEntity, type TransformContext, type TransformerConfig, type TransformerMetadata, Tree, TreeChildren, type TreeColumns, type TreeConfig, type TreeDecoratorOptions, type TreeInsertData, type TreeListEntry, type TreeListOptions, type TreeListSchemaOptions, TreeManager, type TreeManagerOptions, type TreeMetadata, type TreeMoveData, type TreeNode, type TreeNodeResult, type TreeNodeResultSchemaOptions, type TreeNodeSchemaOptions, TreeParent, type TreeQuery, type TreeScope, type TreeValidationResult, 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, buildScopeConditions, calculateRowDepths, 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, createTreeManager, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeFilteredPaged, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, extractScopeValues, firstValue, floor, formatDuration, formatTreeList, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, generateTreeComponents, getColumn, getColumnMap, getColumnType, getDateKind, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getRegisteredValidators, getSchemaIntrospector, getTableDefFromEntity, getTreeBounds, getTreeColumns, getTreeConfig, getTreeMetadata, getTreeParentId, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hasTreeBehavior, hasValidator, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isNullableColumn, isOperandNode, isTableDef, isTreeConfig, isValidDuration, 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, parseDuration, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, registerValidator, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, resolveTreeConfig, resolveValidator, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, setTreeBounds, setTreeMetadata, setTreeParentId, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, threadResults, threadedNodeToOpenApiSchema, toColumnRef, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, treeEntityRegistry, treeListEntryToOpenApiSchema, treeNodeResultToOpenApiSchema, treeNodeToOpenApiSchema, treeQuery, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, validateTreeTable, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
|
package/dist/index.d.ts
CHANGED
|
@@ -3038,11 +3038,21 @@ interface CacheInvalidator {
|
|
|
3038
3038
|
invalidateTags(tags: string[]): Promise<void>;
|
|
3039
3039
|
invalidatePrefix(prefix: string): Promise<void>;
|
|
3040
3040
|
}
|
|
3041
|
+
/**
|
|
3042
|
+
* Capabilities de um cache provider
|
|
3043
|
+
* Permite detectar funcionalidades suportadas em runtime
|
|
3044
|
+
*/
|
|
3045
|
+
interface CacheCapabilities {
|
|
3046
|
+
tags: boolean;
|
|
3047
|
+
prefix: boolean;
|
|
3048
|
+
ttl: boolean;
|
|
3049
|
+
}
|
|
3041
3050
|
/**
|
|
3042
3051
|
* Interface completa para implementações full-featured
|
|
3043
3052
|
*/
|
|
3044
3053
|
interface CacheProvider extends CacheReader, CacheWriter, CacheInvalidator {
|
|
3045
3054
|
readonly name: string;
|
|
3055
|
+
readonly capabilities: CacheCapabilities;
|
|
3046
3056
|
dispose?(): Promise<void>;
|
|
3047
3057
|
}
|
|
3048
3058
|
/**
|
|
@@ -3209,6 +3219,11 @@ declare class DefaultCacheStrategy implements CacheStrategy {
|
|
|
3209
3219
|
*/
|
|
3210
3220
|
declare class MemoryCacheAdapter implements CacheProvider {
|
|
3211
3221
|
readonly name = "memory";
|
|
3222
|
+
readonly capabilities: {
|
|
3223
|
+
tags: boolean;
|
|
3224
|
+
prefix: boolean;
|
|
3225
|
+
ttl: boolean;
|
|
3226
|
+
};
|
|
3212
3227
|
private storage;
|
|
3213
3228
|
private tagIndex;
|
|
3214
3229
|
get<T>(key: string): Promise<T | undefined>;
|
|
@@ -3255,6 +3270,11 @@ interface KeyvInstance {
|
|
|
3255
3270
|
declare class KeyvCacheAdapter implements CacheProvider {
|
|
3256
3271
|
private keyv;
|
|
3257
3272
|
readonly name = "keyv";
|
|
3273
|
+
readonly capabilities: {
|
|
3274
|
+
tags: boolean;
|
|
3275
|
+
prefix: boolean;
|
|
3276
|
+
ttl: boolean;
|
|
3277
|
+
};
|
|
3258
3278
|
constructor(keyv: KeyvInstance);
|
|
3259
3279
|
get<T>(key: string): Promise<T | undefined>;
|
|
3260
3280
|
has(key: string): Promise<boolean>;
|
|
@@ -3266,6 +3286,93 @@ declare class KeyvCacheAdapter implements CacheProvider {
|
|
|
3266
3286
|
dispose(): Promise<void>;
|
|
3267
3287
|
}
|
|
3268
3288
|
|
|
3289
|
+
interface RedisLike {
|
|
3290
|
+
get(key: string): Promise<string | null>;
|
|
3291
|
+
set(key: string, value: string, ...args: (string | number)[]): Promise<string | null>;
|
|
3292
|
+
del(...keys: string[]): Promise<number>;
|
|
3293
|
+
sadd(key: string, ...members: string[]): Promise<number>;
|
|
3294
|
+
smembers(key: string): Promise<string[]>;
|
|
3295
|
+
srem(key: string, ...members: string[]): Promise<number>;
|
|
3296
|
+
scan(cursor: string | number, ...args: (string | number)[]): Promise<[string, string[]]>;
|
|
3297
|
+
quit(): Promise<string>;
|
|
3298
|
+
disconnect(): void;
|
|
3299
|
+
isReady?: boolean;
|
|
3300
|
+
status?: string;
|
|
3301
|
+
}
|
|
3302
|
+
interface RedisOptions {
|
|
3303
|
+
host?: string;
|
|
3304
|
+
port?: number;
|
|
3305
|
+
password?: string;
|
|
3306
|
+
db?: number;
|
|
3307
|
+
keyPrefix?: string;
|
|
3308
|
+
lazyConnect?: boolean;
|
|
3309
|
+
[key: string]: unknown;
|
|
3310
|
+
}
|
|
3311
|
+
/**
|
|
3312
|
+
* Adapter para Redis usando ioredis
|
|
3313
|
+
*
|
|
3314
|
+
* Suporta:
|
|
3315
|
+
* - Tags via Redis Sets (SADD, SMEMBERS, SREM)
|
|
3316
|
+
* - Prefix invalidation via SCAN
|
|
3317
|
+
* - TTL nativo do Redis
|
|
3318
|
+
*
|
|
3319
|
+
* Instalação:
|
|
3320
|
+
* npm install ioredis
|
|
3321
|
+
*
|
|
3322
|
+
* Para testes (dev):
|
|
3323
|
+
* npm install --save-dev ioredis-mock
|
|
3324
|
+
*/
|
|
3325
|
+
declare class RedisCacheAdapter implements CacheProvider {
|
|
3326
|
+
readonly name = "redis";
|
|
3327
|
+
readonly capabilities: {
|
|
3328
|
+
tags: boolean;
|
|
3329
|
+
prefix: boolean;
|
|
3330
|
+
ttl: boolean;
|
|
3331
|
+
};
|
|
3332
|
+
private redis;
|
|
3333
|
+
private ownsConnection;
|
|
3334
|
+
private tagPrefix;
|
|
3335
|
+
/**
|
|
3336
|
+
* Cria um adapter Redis
|
|
3337
|
+
*
|
|
3338
|
+
* @param redis - Instância do ioredis OU opções de conexão
|
|
3339
|
+
* @param options - Opções adicionais
|
|
3340
|
+
* @param options.tagPrefix - Prefixo para chaves de tag (default: 'tag:')
|
|
3341
|
+
*
|
|
3342
|
+
* Exemplos:
|
|
3343
|
+
*
|
|
3344
|
+
* // Com instância existente (recomendado para connection pooling):
|
|
3345
|
+
* const redis = new Redis({ host: 'localhost', port: 6379 });
|
|
3346
|
+
* const adapter = new RedisCacheAdapter(redis);
|
|
3347
|
+
*
|
|
3348
|
+
* // Com opções (adapter gerencia conexão):
|
|
3349
|
+
* const adapter = new RedisCacheAdapter({ host: 'localhost', port: 6379 });
|
|
3350
|
+
*
|
|
3351
|
+
* // Para testes com ioredis-mock:
|
|
3352
|
+
* import Redis from 'ioredis-mock';
|
|
3353
|
+
* const adapter = new RedisCacheAdapter(new Redis());
|
|
3354
|
+
*/
|
|
3355
|
+
constructor(redis: RedisLike | RedisOptions, options?: {
|
|
3356
|
+
tagPrefix?: string;
|
|
3357
|
+
});
|
|
3358
|
+
private isRedisInstance;
|
|
3359
|
+
private createRedis;
|
|
3360
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
3361
|
+
has(key: string): Promise<boolean>;
|
|
3362
|
+
set<T>(key: string, value: T, ttlMs?: number, tags?: string[]): Promise<void>;
|
|
3363
|
+
delete(key: string): Promise<void>;
|
|
3364
|
+
invalidate(key: string): Promise<void>;
|
|
3365
|
+
invalidateTags(tags: string[]): Promise<void>;
|
|
3366
|
+
invalidatePrefix(prefix: string): Promise<void>;
|
|
3367
|
+
private registerTags;
|
|
3368
|
+
dispose(): Promise<void>;
|
|
3369
|
+
/**
|
|
3370
|
+
* Retorna a instância Redis subjacente
|
|
3371
|
+
* Útil para operações avançadas ou health checks
|
|
3372
|
+
*/
|
|
3373
|
+
getRedis(): RedisLike;
|
|
3374
|
+
}
|
|
3375
|
+
|
|
3269
3376
|
/**
|
|
3270
3377
|
* Indexa chaves por tags para invalidação em massa
|
|
3271
3378
|
* Implementação em memória (pode ser persistida no Redis)
|
|
@@ -9531,4 +9638,4 @@ declare function setTreeBounds(entity: object, config: TreeConfig, lft: number,
|
|
|
9531
9638
|
*/
|
|
9532
9639
|
declare function setTreeParentId(entity: object, config: TreeConfig, parentId: unknown): void;
|
|
9533
9640
|
|
|
9534
|
-
export { type AliasRefNode, Alphanumeric, type AnyDomainEvent, type ApiRouteDefinition, type ApplyFilterOptions, 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, BinaryTypeStrategy, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, CEP, CNPJ, CPF, type CacheInvalidator, type CacheOptions, type CacheProvider, type CacheReader, type CacheState, type CacheStrategy, type CacheWriter, 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, DEFAULT_TREE_CONFIG, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DatabaseView, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultCacheStrategy, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, type Duration, Email, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecuteFilteredPagedOptions, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type FindChildrenOptions, type FindPathOptions, 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 InvalidationStrategy, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, KeyvCacheAdapter, Length, type LiteralNode, type LiteralValue, type LogicalExpressionNode, Lower, type ManyToManyCollection, MemoryCacheAdapter, type MoveOptions, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NestedSetBounds, type NestedSetRow, NestedSetStrategy, type NodeWithPk, 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 OrmCacheOptions, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PagedResponse, type PaginatedResult, type PaginationParams, type PatchGraphInputPayload, Pattern, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, type PropertySanitizer, type PropertyTransformer, type PropertyValidator, PrototypeMaterializationStrategy, QueryCacheManager, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type RecoverResult, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationFilter, 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, TagIndex, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type ThreadedNode, Title, type ToJsonOptions, type TrackedEntity, type TransformContext, type TransformerConfig, type TransformerMetadata, Tree, TreeChildren, type TreeColumns, type TreeConfig, type TreeDecoratorOptions, type TreeInsertData, type TreeListEntry, type TreeListOptions, type TreeListSchemaOptions, TreeManager, type TreeManagerOptions, type TreeMetadata, type TreeMoveData, type TreeNode, type TreeNodeResult, type TreeNodeResultSchemaOptions, type TreeNodeSchemaOptions, TreeParent, type TreeQuery, type TreeScope, type TreeValidationResult, 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, buildScopeConditions, calculateRowDepths, 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, createTreeManager, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeFilteredPaged, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, extractScopeValues, firstValue, floor, formatDuration, formatTreeList, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, generateTreeComponents, getColumn, getColumnMap, getColumnType, getDateKind, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getRegisteredValidators, getSchemaIntrospector, getTableDefFromEntity, getTreeBounds, getTreeColumns, getTreeConfig, getTreeMetadata, getTreeParentId, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hasTreeBehavior, hasValidator, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isNullableColumn, isOperandNode, isTableDef, isTreeConfig, isValidDuration, 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, parseDuration, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, registerValidator, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, resolveTreeConfig, resolveValidator, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, setTreeBounds, setTreeMetadata, setTreeParentId, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, threadResults, threadedNodeToOpenApiSchema, toColumnRef, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, treeEntityRegistry, treeListEntryToOpenApiSchema, treeNodeResultToOpenApiSchema, treeNodeToOpenApiSchema, treeQuery, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, validateTreeTable, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
|
|
9641
|
+
export { type AliasRefNode, Alphanumeric, type AnyDomainEvent, type ApiRouteDefinition, type ApplyFilterOptions, 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, BinaryTypeStrategy, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, CEP, CNPJ, CPF, type CacheCapabilities, type CacheInvalidator, type CacheOptions, type CacheProvider, type CacheReader, type CacheState, type CacheStrategy, type CacheWriter, 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, DEFAULT_TREE_CONFIG, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DatabaseView, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultCacheStrategy, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, type Duration, Email, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecuteFilteredPagedOptions, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type FindChildrenOptions, type FindPathOptions, 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 InvalidationStrategy, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, KeyvCacheAdapter, Length, type LiteralNode, type LiteralValue, type LogicalExpressionNode, Lower, type ManyToManyCollection, MemoryCacheAdapter, type MoveOptions, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NestedSetBounds, type NestedSetRow, NestedSetStrategy, type NodeWithPk, 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 OrmCacheOptions, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PagedResponse, type PaginatedResult, type PaginationParams, type PatchGraphInputPayload, Pattern, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, type PropertySanitizer, type PropertyTransformer, type PropertyValidator, PrototypeMaterializationStrategy, QueryCacheManager, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type RecoverResult, RedisCacheAdapter, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationFilter, 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, TagIndex, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type ThreadedNode, Title, type ToJsonOptions, type TrackedEntity, type TransformContext, type TransformerConfig, type TransformerMetadata, Tree, TreeChildren, type TreeColumns, type TreeConfig, type TreeDecoratorOptions, type TreeInsertData, type TreeListEntry, type TreeListOptions, type TreeListSchemaOptions, TreeManager, type TreeManagerOptions, type TreeMetadata, type TreeMoveData, type TreeNode, type TreeNodeResult, type TreeNodeResultSchemaOptions, type TreeNodeSchemaOptions, TreeParent, type TreeQuery, type TreeScope, type TreeValidationResult, 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, buildScopeConditions, calculateRowDepths, 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, createTreeManager, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeFilteredPaged, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, extractScopeValues, firstValue, floor, formatDuration, formatTreeList, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, generateTreeComponents, getColumn, getColumnMap, getColumnType, getDateKind, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getRegisteredValidators, getSchemaIntrospector, getTableDefFromEntity, getTreeBounds, getTreeColumns, getTreeConfig, getTreeMetadata, getTreeParentId, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hasTreeBehavior, hasValidator, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isNullableColumn, isOperandNode, isTableDef, isTreeConfig, isValidDuration, 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, parseDuration, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, registerValidator, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, resolveTreeConfig, resolveValidator, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, setTreeBounds, setTreeMetadata, setTreeParentId, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, threadResults, threadedNodeToOpenApiSchema, toColumnRef, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, treeEntityRegistry, treeListEntryToOpenApiSchema, treeNodeResultToOpenApiSchema, treeNodeToOpenApiSchema, treeQuery, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, validateTreeTable, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
4
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
5
|
+
}) : x)(function(x) {
|
|
6
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
+
});
|
|
3
9
|
var __esm = (fn8, res) => function __init() {
|
|
4
10
|
return fn8 && (res = (0, fn8[__getOwnPropNames(fn8)[0]])(fn8 = 0)), res;
|
|
5
11
|
};
|
|
@@ -13609,6 +13615,11 @@ function isValidDuration(value) {
|
|
|
13609
13615
|
// src/cache/adapters/memory-cache-adapter.ts
|
|
13610
13616
|
var MemoryCacheAdapter = class {
|
|
13611
13617
|
name = "memory";
|
|
13618
|
+
capabilities = {
|
|
13619
|
+
tags: true,
|
|
13620
|
+
prefix: true,
|
|
13621
|
+
ttl: true
|
|
13622
|
+
};
|
|
13612
13623
|
storage = /* @__PURE__ */ new Map();
|
|
13613
13624
|
tagIndex = /* @__PURE__ */ new Map();
|
|
13614
13625
|
async get(key) {
|
|
@@ -18462,6 +18473,11 @@ var KeyvCacheAdapter = class {
|
|
|
18462
18473
|
this.keyv = keyv;
|
|
18463
18474
|
}
|
|
18464
18475
|
name = "keyv";
|
|
18476
|
+
capabilities = {
|
|
18477
|
+
tags: false,
|
|
18478
|
+
prefix: true,
|
|
18479
|
+
ttl: true
|
|
18480
|
+
};
|
|
18465
18481
|
async get(key) {
|
|
18466
18482
|
return this.keyv.get(key);
|
|
18467
18483
|
}
|
|
@@ -18505,6 +18521,152 @@ var KeyvCacheAdapter = class {
|
|
|
18505
18521
|
}
|
|
18506
18522
|
};
|
|
18507
18523
|
|
|
18524
|
+
// src/cache/adapters/redis-cache-adapter.ts
|
|
18525
|
+
var RedisCacheAdapter = class {
|
|
18526
|
+
name = "redis";
|
|
18527
|
+
capabilities = {
|
|
18528
|
+
tags: true,
|
|
18529
|
+
prefix: true,
|
|
18530
|
+
ttl: true
|
|
18531
|
+
};
|
|
18532
|
+
redis;
|
|
18533
|
+
ownsConnection;
|
|
18534
|
+
tagPrefix;
|
|
18535
|
+
/**
|
|
18536
|
+
* Cria um adapter Redis
|
|
18537
|
+
*
|
|
18538
|
+
* @param redis - Instância do ioredis OU opções de conexão
|
|
18539
|
+
* @param options - Opções adicionais
|
|
18540
|
+
* @param options.tagPrefix - Prefixo para chaves de tag (default: 'tag:')
|
|
18541
|
+
*
|
|
18542
|
+
* Exemplos:
|
|
18543
|
+
*
|
|
18544
|
+
* // Com instância existente (recomendado para connection pooling):
|
|
18545
|
+
* const redis = new Redis({ host: 'localhost', port: 6379 });
|
|
18546
|
+
* const adapter = new RedisCacheAdapter(redis);
|
|
18547
|
+
*
|
|
18548
|
+
* // Com opções (adapter gerencia conexão):
|
|
18549
|
+
* const adapter = new RedisCacheAdapter({ host: 'localhost', port: 6379 });
|
|
18550
|
+
*
|
|
18551
|
+
* // Para testes com ioredis-mock:
|
|
18552
|
+
* import Redis from 'ioredis-mock';
|
|
18553
|
+
* const adapter = new RedisCacheAdapter(new Redis());
|
|
18554
|
+
*/
|
|
18555
|
+
constructor(redis, options) {
|
|
18556
|
+
this.tagPrefix = options?.tagPrefix ?? "tag:";
|
|
18557
|
+
if (this.isRedisInstance(redis)) {
|
|
18558
|
+
this.redis = redis;
|
|
18559
|
+
this.ownsConnection = false;
|
|
18560
|
+
} else {
|
|
18561
|
+
this.redis = this.createRedis(redis);
|
|
18562
|
+
this.ownsConnection = true;
|
|
18563
|
+
}
|
|
18564
|
+
}
|
|
18565
|
+
isRedisInstance(obj) {
|
|
18566
|
+
return typeof obj === "object" && obj !== null && "get" in obj && "set" in obj && "del" in obj && typeof obj.get === "function";
|
|
18567
|
+
}
|
|
18568
|
+
createRedis(options) {
|
|
18569
|
+
try {
|
|
18570
|
+
const Redis = __require("ioredis");
|
|
18571
|
+
return new Redis(options);
|
|
18572
|
+
} catch {
|
|
18573
|
+
throw new Error(
|
|
18574
|
+
"ioredis is required for RedisCacheAdapter. Install it with: npm install ioredis"
|
|
18575
|
+
);
|
|
18576
|
+
}
|
|
18577
|
+
}
|
|
18578
|
+
async get(key) {
|
|
18579
|
+
const value = await this.redis.get(key);
|
|
18580
|
+
if (value === null) {
|
|
18581
|
+
return void 0;
|
|
18582
|
+
}
|
|
18583
|
+
try {
|
|
18584
|
+
return JSON.parse(value);
|
|
18585
|
+
} catch {
|
|
18586
|
+
return void 0;
|
|
18587
|
+
}
|
|
18588
|
+
}
|
|
18589
|
+
async has(key) {
|
|
18590
|
+
const value = await this.redis.get(key);
|
|
18591
|
+
return value !== null;
|
|
18592
|
+
}
|
|
18593
|
+
async set(key, value, ttlMs, tags) {
|
|
18594
|
+
const serialized = JSON.stringify(value);
|
|
18595
|
+
if (ttlMs) {
|
|
18596
|
+
await this.redis.set(key, serialized, "PX", ttlMs);
|
|
18597
|
+
} else {
|
|
18598
|
+
await this.redis.set(key, serialized);
|
|
18599
|
+
}
|
|
18600
|
+
if (tags && tags.length > 0) {
|
|
18601
|
+
await this.registerTags(key, tags);
|
|
18602
|
+
}
|
|
18603
|
+
}
|
|
18604
|
+
async delete(key) {
|
|
18605
|
+
await this.redis.del(key);
|
|
18606
|
+
}
|
|
18607
|
+
async invalidate(key) {
|
|
18608
|
+
await this.delete(key);
|
|
18609
|
+
}
|
|
18610
|
+
async invalidateTags(tags) {
|
|
18611
|
+
const keysToDelete = /* @__PURE__ */ new Set();
|
|
18612
|
+
for (const tag of tags) {
|
|
18613
|
+
const tagKey = `${this.tagPrefix}${tag}`;
|
|
18614
|
+
const keys = await this.redis.smembers(tagKey);
|
|
18615
|
+
for (const key of keys) {
|
|
18616
|
+
keysToDelete.add(key);
|
|
18617
|
+
}
|
|
18618
|
+
await this.redis.del(tagKey);
|
|
18619
|
+
}
|
|
18620
|
+
if (keysToDelete.size > 0) {
|
|
18621
|
+
await this.redis.del(...Array.from(keysToDelete));
|
|
18622
|
+
}
|
|
18623
|
+
}
|
|
18624
|
+
async invalidatePrefix(prefix) {
|
|
18625
|
+
const keysToDelete = [];
|
|
18626
|
+
let cursor = "0";
|
|
18627
|
+
do {
|
|
18628
|
+
const [nextCursor, keys] = await this.redis.scan(
|
|
18629
|
+
cursor,
|
|
18630
|
+
"MATCH",
|
|
18631
|
+
`${prefix}*`,
|
|
18632
|
+
"COUNT",
|
|
18633
|
+
100
|
|
18634
|
+
);
|
|
18635
|
+
cursor = nextCursor;
|
|
18636
|
+
keysToDelete.push(...keys);
|
|
18637
|
+
} while (cursor !== "0");
|
|
18638
|
+
if (keysToDelete.length > 0) {
|
|
18639
|
+
const batchSize = 1e3;
|
|
18640
|
+
for (let i = 0; i < keysToDelete.length; i += batchSize) {
|
|
18641
|
+
const batch = keysToDelete.slice(i, i + batchSize);
|
|
18642
|
+
await this.redis.del(...batch);
|
|
18643
|
+
}
|
|
18644
|
+
}
|
|
18645
|
+
}
|
|
18646
|
+
async registerTags(key, tags) {
|
|
18647
|
+
for (const tag of tags) {
|
|
18648
|
+
const tagKey = `${this.tagPrefix}${tag}`;
|
|
18649
|
+
await this.redis.sadd(tagKey, key);
|
|
18650
|
+
}
|
|
18651
|
+
}
|
|
18652
|
+
async dispose() {
|
|
18653
|
+
if (this.ownsConnection) {
|
|
18654
|
+
try {
|
|
18655
|
+
await this.redis.quit();
|
|
18656
|
+
} catch {
|
|
18657
|
+
this.redis.disconnect?.();
|
|
18658
|
+
}
|
|
18659
|
+
}
|
|
18660
|
+
}
|
|
18661
|
+
/**
|
|
18662
|
+
* Retorna a instância Redis subjacente
|
|
18663
|
+
* Útil para operações avançadas ou health checks
|
|
18664
|
+
*/
|
|
18665
|
+
getRedis() {
|
|
18666
|
+
return this.redis;
|
|
18667
|
+
}
|
|
18668
|
+
};
|
|
18669
|
+
|
|
18508
18670
|
// src/cache/tag-index.ts
|
|
18509
18671
|
var TagIndex = class {
|
|
18510
18672
|
tagToKeys = /* @__PURE__ */ new Map();
|
|
@@ -18658,6 +18820,7 @@ export {
|
|
|
18658
18820
|
PrimaryKey,
|
|
18659
18821
|
PrototypeMaterializationStrategy,
|
|
18660
18822
|
QueryCacheManager,
|
|
18823
|
+
RedisCacheAdapter,
|
|
18661
18824
|
RelationKinds,
|
|
18662
18825
|
STANDARD_COLUMN_TYPES,
|
|
18663
18826
|
SelectQueryBuilder,
|