@buka/nestjs-kit 4.4.10 → 4.4.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.4.11](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.4.10...v4.4.11) (2026-07-27)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * should export IntersectionType ([350af46](https://github.com/buka-ltd/npm.nestjs-kit/commit/350af460f2aa45700f68a7ea0fe224fff2735d8e))
9
+ * 修复QueryType的循环引用问题 ([c94d110](https://github.com/buka-ltd/npm.nestjs-kit/commit/c94d11008eccadee3c6cff02fd1a71b1a2e24faa))
10
+
3
11
  ## [4.4.10](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.4.9...v4.4.10) (2026-07-06)
4
12
 
5
13
 
package/dist/index.d.mts CHANGED
@@ -1161,6 +1161,25 @@ declare function OmitType<T, K extends keyof T>(classRef: Class<T>, keys: K[]):
1161
1161
  */
1162
1162
  declare function PartialType<T>(classRef: Class<T>): Class<Partial<T>>;
1163
1163
  //#endregion
1164
+ //#region src/modules/core/converters/intersection-type/intersection-type.d.ts
1165
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
1166
+ type ClassRefsToConstructors<T extends Type[]> = { [U in keyof T]: T[U] extends Type<infer V> ? V : never };
1167
+ type Intersection<T extends Type[]> = Type<UnionToIntersection<ClassRefsToConstructors<T>[number]>>;
1168
+ /**
1169
+ * 将多个模型类合并为一个交叉类型。
1170
+ *
1171
+ * 类似 TypeScript 的交叉类型 `A & B`,同时合并 class-validator、class-transformer 和 Swagger 的元数据。
1172
+ *
1173
+ * @param classRefs - 需要合并的模型类引用列表
1174
+ * @returns 包含所有类属性的新类
1175
+ *
1176
+ * @example
1177
+ * ```typescript
1178
+ * const CreateUserDTO = IntersectionType(UserBaseDTO, UserProfileDTO)
1179
+ * ```
1180
+ */
1181
+ declare function IntersectionType<T extends Type[]>(...classRefs: T): Intersection<T>;
1182
+ //#endregion
1164
1183
  //#region src/modules/core/converters/order-query-type/types/order-query.d.ts
1165
1184
  interface IOrderQuery<T> {
1166
1185
  orderBy?: QueryOrderMap<T> | QueryOrderMap<T>[];
@@ -17848,5 +17867,5 @@ declare function throwOnResponseError(options?: ThrowOnResponseErrorOptions): Ke
17848
17867
  */
17849
17868
  declare function stableStringify(value: unknown): string;
17850
17869
  //#endregion
17851
- export { AssociationMetadata, AuthException, BUKA_MODULE_OPTIONS_TOKEN, Base32, BlindIndex, BlindIndexHasher, BlindIndexModule, BlindIndexService, BlindIndexV1Hasher, BukaConfigurableModuleClass, BukaExceptions, BukaModule, BukaModuleOptions, BukaPageQueryValidationPipe, BukaRequestException, type BukaRequestExceptionOptions, BukaValidationPipe, BusinessException, Cardinality, type CipherMetadata, CollectionAssociationMetadata, Column, Composite, CompositePropertyMetadata, ConfigurableModuleClass, ConflictException, CursorPagination, DatabaseConfig, type DecryptCommand, DegradeException, Dictionary, DictionaryPropertyMetadata, DiscreteEntity, type EncryptCommand, EncryptedPayload, EntityDto, EntityDtoShape, EntityRef, Enum, EnumPropertyMetadata, EnvelopeEncryptionModule, type EnvelopeEncryptionModuleOptions, EnvelopeEncryptionService, ErrorCategory, ErrorCode, ErrorCodeController, ErrorCodeExceptionFilter, ErrorCodeDefinitionDto as ErrorCodeItemDto, ErrorCodeMetadataDto, type ErrorCodeOptions, ErrorCodePartsDto, ErrorCodeRegistry, ErrorResponseSchema, type ExceptionConstructor, type ExceptionConstructorWithArgs, type ExceptionDetail, ExceptionDetailSchema, ExceptionModule, type ExceptionModuleOptions as ExceptionNestModuleOptions, type ExceptionOptions, type ExceptionOptionsWithFactory, type ExceptionOptionsWithMessage, ExcludeDefinedOpt, ExcludeHidden, ExcludeOpt, ExcludeRef, ExcludeScalarClass, FeatureException, FilterQuery, FilterQueryOperator, FilterQueryOperators, FilterQueryOperatorsMetadataKey, FilterQueryTransformPipe, HAS_ANY_KEY, HasAnyKey, HttpException, type HttpExceptionOptions, IEntityPrimaryKey, IFilter, IFilterQuery, IFilterQueryCollectionCondition, IFilterQueryCondition, IFilterQueryNestedProperty, IFilterQueryObject, IFilterQueryProperty, IListResponseBody, IListResponseBodyMeta, INextCursorPageParameters, IOffsetPageParameters, IOrderQuery, IPageQuery, IPreviousCursorPageParameters, IResponseBody, IS_CROCKFORD_BASE32, IS_DOMAIN_URN, IS_ENUM_COLUMN, IS_SCALAR_DICTIONARY, IS_URN, InjectLogger, IsBrowserRequest, IsCrockfordBase32, IsDomainUrn, IsEnumColumn, IsHidden, IsOpt, IsScalar, IsScalarDictionary, IsUrn, KeyEnvelope, LinearEntity, List, ListErrorCodesResponseDto, ListPropertyMetadata, ListResponseBodyType, Logger, LoggerConfig, LoggerErrorInterceptor, LoggerModule, type LoggerModuleOptions, MATCH_JSON_SCHEMA, MODULE_OPTIONS_TOKEN, MatchJsonSchema, MatchesUrn, Model, ModelMetadata, ModelOptions, ModelRegister, ModelSchemaOptions, ModuleExceptions, type ExceptionModuleOptions$1 as ModuleExceptionsOptions, NextCursorPageSchema, ObjectStorageModule, ObjectStorageModuleConfig, ObjectStorageModuleOptions, ObjectStorageOptions, ObjectStorageService, OffsetPageSchema, OffsetPagination, OmitType, OpenBaoAppRoleAuth, OpenBaoAppRoleAuthConfig, OpenBaoAuthMethod, OpenBaoAuthResponse, OpenBaoHttpClient, OpenBaoKubernetesAuth, OpenBaoKubernetesAuthConfig, OpenBaoModule, OpenBaoModuleConfig, OpenBaoModuleOptions, OpenBaoTokenAuth, OpenBaoTokenAuthConfig, OpenBaoTokenLookupSelfResponse, OpenBaoTokenManager, OpenBaoUserpassAuth, OpenBaoUserpassAuthConfig, OptionalPageQuery, OrderQueryType, PageQuery, ParseUUIDv7Pipe, PartialType, PendingException, PickType, PreviousCursorPageSchema, PrimaryKeyType, PrimaryKeyTypeClassMetadataPropertyKey, Property, PropertyKind, PropertyMetadata, RateLimitException, type ReencryptCommand, RefAssociationMetadata, type ResolveExceptions, ResponseBodyType, SaltedHash, SaltedHashHasher, SaltedHashModule, SaltedHashService, SaltedHashV1Hasher, ScalarClass, ScalarPropertyMetadata, type SchemaObject, Slice, SwaggerPatcher, SystemException, ThirdPartyException, type ThrowOnResponseErrorOptions, TimestampedEntity, type UnifyExceptionResponsesOptions, Urn, VALIDATE_NESTED_DICTIONARY, ValidateNestedDictionary, ValidationException, getExceptionModuleId, getFilterQueryOperators, isScalarClass, serializeModel, setOpenBaoToken, stableStringify, throwOnResponseError };
17870
+ export { AssociationMetadata, AuthException, BUKA_MODULE_OPTIONS_TOKEN, Base32, BlindIndex, BlindIndexHasher, BlindIndexModule, BlindIndexService, BlindIndexV1Hasher, BukaConfigurableModuleClass, BukaExceptions, BukaModule, BukaModuleOptions, BukaPageQueryValidationPipe, BukaRequestException, type BukaRequestExceptionOptions, BukaValidationPipe, BusinessException, Cardinality, type CipherMetadata, CollectionAssociationMetadata, Column, Composite, CompositePropertyMetadata, ConfigurableModuleClass, ConflictException, CursorPagination, DatabaseConfig, type DecryptCommand, DegradeException, Dictionary, DictionaryPropertyMetadata, DiscreteEntity, type EncryptCommand, EncryptedPayload, EntityDto, EntityDtoShape, EntityRef, Enum, EnumPropertyMetadata, EnvelopeEncryptionModule, type EnvelopeEncryptionModuleOptions, EnvelopeEncryptionService, ErrorCategory, ErrorCode, ErrorCodeController, ErrorCodeExceptionFilter, ErrorCodeDefinitionDto as ErrorCodeItemDto, ErrorCodeMetadataDto, type ErrorCodeOptions, ErrorCodePartsDto, ErrorCodeRegistry, ErrorResponseSchema, type ExceptionConstructor, type ExceptionConstructorWithArgs, type ExceptionDetail, ExceptionDetailSchema, ExceptionModule, type ExceptionModuleOptions as ExceptionNestModuleOptions, type ExceptionOptions, type ExceptionOptionsWithFactory, type ExceptionOptionsWithMessage, ExcludeDefinedOpt, ExcludeHidden, ExcludeOpt, ExcludeRef, ExcludeScalarClass, FeatureException, FilterQuery, FilterQueryOperator, FilterQueryOperators, FilterQueryOperatorsMetadataKey, FilterQueryTransformPipe, HAS_ANY_KEY, HasAnyKey, HttpException, type HttpExceptionOptions, IEntityPrimaryKey, IFilter, IFilterQuery, IFilterQueryCollectionCondition, IFilterQueryCondition, IFilterQueryNestedProperty, IFilterQueryObject, IFilterQueryProperty, IListResponseBody, IListResponseBodyMeta, INextCursorPageParameters, IOffsetPageParameters, IOrderQuery, IPageQuery, IPreviousCursorPageParameters, IResponseBody, IS_CROCKFORD_BASE32, IS_DOMAIN_URN, IS_ENUM_COLUMN, IS_SCALAR_DICTIONARY, IS_URN, InjectLogger, IntersectionType, IsBrowserRequest, IsCrockfordBase32, IsDomainUrn, IsEnumColumn, IsHidden, IsOpt, IsScalar, IsScalarDictionary, IsUrn, KeyEnvelope, LinearEntity, List, ListErrorCodesResponseDto, ListPropertyMetadata, ListResponseBodyType, Logger, LoggerConfig, LoggerErrorInterceptor, LoggerModule, type LoggerModuleOptions, MATCH_JSON_SCHEMA, MODULE_OPTIONS_TOKEN, MatchJsonSchema, MatchesUrn, Model, ModelMetadata, ModelOptions, ModelRegister, ModelSchemaOptions, ModuleExceptions, type ExceptionModuleOptions$1 as ModuleExceptionsOptions, NextCursorPageSchema, ObjectStorageModule, ObjectStorageModuleConfig, ObjectStorageModuleOptions, ObjectStorageOptions, ObjectStorageService, OffsetPageSchema, OffsetPagination, OmitType, OpenBaoAppRoleAuth, OpenBaoAppRoleAuthConfig, OpenBaoAuthMethod, OpenBaoAuthResponse, OpenBaoHttpClient, OpenBaoKubernetesAuth, OpenBaoKubernetesAuthConfig, OpenBaoModule, OpenBaoModuleConfig, OpenBaoModuleOptions, OpenBaoTokenAuth, OpenBaoTokenAuthConfig, OpenBaoTokenLookupSelfResponse, OpenBaoTokenManager, OpenBaoUserpassAuth, OpenBaoUserpassAuthConfig, OptionalPageQuery, OrderQueryType, PageQuery, ParseUUIDv7Pipe, PartialType, PendingException, PickType, PreviousCursorPageSchema, PrimaryKeyType, PrimaryKeyTypeClassMetadataPropertyKey, Property, PropertyKind, PropertyMetadata, RateLimitException, type ReencryptCommand, RefAssociationMetadata, type ResolveExceptions, ResponseBodyType, SaltedHash, SaltedHashHasher, SaltedHashModule, SaltedHashService, SaltedHashV1Hasher, ScalarClass, ScalarPropertyMetadata, type SchemaObject, Slice, SwaggerPatcher, SystemException, ThirdPartyException, type ThrowOnResponseErrorOptions, TimestampedEntity, type UnifyExceptionResponsesOptions, Urn, VALIDATE_NESTED_DICTIONARY, ValidateNestedDictionary, ValidationException, getExceptionModuleId, getFilterQueryOperators, isScalarClass, serializeModel, setOpenBaoToken, stableStringify, throwOnResponseError };
17852
17871
  //# sourceMappingURL=index.d.mts.map
package/dist/index.d.ts CHANGED
@@ -1161,6 +1161,25 @@ declare function OmitType<T, K extends keyof T>(classRef: Class<T>, keys: K[]):
1161
1161
  */
1162
1162
  declare function PartialType<T>(classRef: Class<T>): Class<Partial<T>>;
1163
1163
  //#endregion
1164
+ //#region src/modules/core/converters/intersection-type/intersection-type.d.ts
1165
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
1166
+ type ClassRefsToConstructors<T extends Type[]> = { [U in keyof T]: T[U] extends Type<infer V> ? V : never };
1167
+ type Intersection<T extends Type[]> = Type<UnionToIntersection<ClassRefsToConstructors<T>[number]>>;
1168
+ /**
1169
+ * 将多个模型类合并为一个交叉类型。
1170
+ *
1171
+ * 类似 TypeScript 的交叉类型 `A & B`,同时合并 class-validator、class-transformer 和 Swagger 的元数据。
1172
+ *
1173
+ * @param classRefs - 需要合并的模型类引用列表
1174
+ * @returns 包含所有类属性的新类
1175
+ *
1176
+ * @example
1177
+ * ```typescript
1178
+ * const CreateUserDTO = IntersectionType(UserBaseDTO, UserProfileDTO)
1179
+ * ```
1180
+ */
1181
+ declare function IntersectionType<T extends Type[]>(...classRefs: T): Intersection<T>;
1182
+ //#endregion
1164
1183
  //#region src/modules/core/converters/order-query-type/types/order-query.d.ts
1165
1184
  interface IOrderQuery<T> {
1166
1185
  orderBy?: QueryOrderMap<T> | QueryOrderMap<T>[];
@@ -17848,5 +17867,5 @@ declare function throwOnResponseError(options?: ThrowOnResponseErrorOptions): Ke
17848
17867
  */
17849
17868
  declare function stableStringify(value: unknown): string;
17850
17869
  //#endregion
17851
- export { AssociationMetadata, AuthException, BUKA_MODULE_OPTIONS_TOKEN, Base32, BlindIndex, BlindIndexHasher, BlindIndexModule, BlindIndexService, BlindIndexV1Hasher, BukaConfigurableModuleClass, BukaExceptions, BukaModule, BukaModuleOptions, BukaPageQueryValidationPipe, BukaRequestException, type BukaRequestExceptionOptions, BukaValidationPipe, BusinessException, Cardinality, type CipherMetadata, CollectionAssociationMetadata, Column, Composite, CompositePropertyMetadata, ConfigurableModuleClass, ConflictException, CursorPagination, DatabaseConfig, type DecryptCommand, DegradeException, Dictionary, DictionaryPropertyMetadata, DiscreteEntity, type EncryptCommand, EncryptedPayload, EntityDto, EntityDtoShape, EntityRef, Enum, EnumPropertyMetadata, EnvelopeEncryptionModule, type EnvelopeEncryptionModuleOptions, EnvelopeEncryptionService, ErrorCategory, ErrorCode, ErrorCodeController, ErrorCodeExceptionFilter, ErrorCodeDefinitionDto as ErrorCodeItemDto, ErrorCodeMetadataDto, type ErrorCodeOptions, ErrorCodePartsDto, ErrorCodeRegistry, ErrorResponseSchema, type ExceptionConstructor, type ExceptionConstructorWithArgs, type ExceptionDetail, ExceptionDetailSchema, ExceptionModule, type ExceptionModuleOptions as ExceptionNestModuleOptions, type ExceptionOptions, type ExceptionOptionsWithFactory, type ExceptionOptionsWithMessage, ExcludeDefinedOpt, ExcludeHidden, ExcludeOpt, ExcludeRef, ExcludeScalarClass, FeatureException, FilterQuery, FilterQueryOperator, FilterQueryOperators, FilterQueryOperatorsMetadataKey, FilterQueryTransformPipe, HAS_ANY_KEY, HasAnyKey, HttpException, type HttpExceptionOptions, IEntityPrimaryKey, IFilter, IFilterQuery, IFilterQueryCollectionCondition, IFilterQueryCondition, IFilterQueryNestedProperty, IFilterQueryObject, IFilterQueryProperty, IListResponseBody, IListResponseBodyMeta, INextCursorPageParameters, IOffsetPageParameters, IOrderQuery, IPageQuery, IPreviousCursorPageParameters, IResponseBody, IS_CROCKFORD_BASE32, IS_DOMAIN_URN, IS_ENUM_COLUMN, IS_SCALAR_DICTIONARY, IS_URN, InjectLogger, IsBrowserRequest, IsCrockfordBase32, IsDomainUrn, IsEnumColumn, IsHidden, IsOpt, IsScalar, IsScalarDictionary, IsUrn, KeyEnvelope, LinearEntity, List, ListErrorCodesResponseDto, ListPropertyMetadata, ListResponseBodyType, Logger, LoggerConfig, LoggerErrorInterceptor, LoggerModule, type LoggerModuleOptions, MATCH_JSON_SCHEMA, MODULE_OPTIONS_TOKEN, MatchJsonSchema, MatchesUrn, Model, ModelMetadata, ModelOptions, ModelRegister, ModelSchemaOptions, ModuleExceptions, type ExceptionModuleOptions$1 as ModuleExceptionsOptions, NextCursorPageSchema, ObjectStorageModule, ObjectStorageModuleConfig, ObjectStorageModuleOptions, ObjectStorageOptions, ObjectStorageService, OffsetPageSchema, OffsetPagination, OmitType, OpenBaoAppRoleAuth, OpenBaoAppRoleAuthConfig, OpenBaoAuthMethod, OpenBaoAuthResponse, OpenBaoHttpClient, OpenBaoKubernetesAuth, OpenBaoKubernetesAuthConfig, OpenBaoModule, OpenBaoModuleConfig, OpenBaoModuleOptions, OpenBaoTokenAuth, OpenBaoTokenAuthConfig, OpenBaoTokenLookupSelfResponse, OpenBaoTokenManager, OpenBaoUserpassAuth, OpenBaoUserpassAuthConfig, OptionalPageQuery, OrderQueryType, PageQuery, ParseUUIDv7Pipe, PartialType, PendingException, PickType, PreviousCursorPageSchema, PrimaryKeyType, PrimaryKeyTypeClassMetadataPropertyKey, Property, PropertyKind, PropertyMetadata, RateLimitException, type ReencryptCommand, RefAssociationMetadata, type ResolveExceptions, ResponseBodyType, SaltedHash, SaltedHashHasher, SaltedHashModule, SaltedHashService, SaltedHashV1Hasher, ScalarClass, ScalarPropertyMetadata, type SchemaObject, Slice, SwaggerPatcher, SystemException, ThirdPartyException, type ThrowOnResponseErrorOptions, TimestampedEntity, type UnifyExceptionResponsesOptions, Urn, VALIDATE_NESTED_DICTIONARY, ValidateNestedDictionary, ValidationException, getExceptionModuleId, getFilterQueryOperators, isScalarClass, serializeModel, setOpenBaoToken, stableStringify, throwOnResponseError };
17870
+ export { AssociationMetadata, AuthException, BUKA_MODULE_OPTIONS_TOKEN, Base32, BlindIndex, BlindIndexHasher, BlindIndexModule, BlindIndexService, BlindIndexV1Hasher, BukaConfigurableModuleClass, BukaExceptions, BukaModule, BukaModuleOptions, BukaPageQueryValidationPipe, BukaRequestException, type BukaRequestExceptionOptions, BukaValidationPipe, BusinessException, Cardinality, type CipherMetadata, CollectionAssociationMetadata, Column, Composite, CompositePropertyMetadata, ConfigurableModuleClass, ConflictException, CursorPagination, DatabaseConfig, type DecryptCommand, DegradeException, Dictionary, DictionaryPropertyMetadata, DiscreteEntity, type EncryptCommand, EncryptedPayload, EntityDto, EntityDtoShape, EntityRef, Enum, EnumPropertyMetadata, EnvelopeEncryptionModule, type EnvelopeEncryptionModuleOptions, EnvelopeEncryptionService, ErrorCategory, ErrorCode, ErrorCodeController, ErrorCodeExceptionFilter, ErrorCodeDefinitionDto as ErrorCodeItemDto, ErrorCodeMetadataDto, type ErrorCodeOptions, ErrorCodePartsDto, ErrorCodeRegistry, ErrorResponseSchema, type ExceptionConstructor, type ExceptionConstructorWithArgs, type ExceptionDetail, ExceptionDetailSchema, ExceptionModule, type ExceptionModuleOptions as ExceptionNestModuleOptions, type ExceptionOptions, type ExceptionOptionsWithFactory, type ExceptionOptionsWithMessage, ExcludeDefinedOpt, ExcludeHidden, ExcludeOpt, ExcludeRef, ExcludeScalarClass, FeatureException, FilterQuery, FilterQueryOperator, FilterQueryOperators, FilterQueryOperatorsMetadataKey, FilterQueryTransformPipe, HAS_ANY_KEY, HasAnyKey, HttpException, type HttpExceptionOptions, IEntityPrimaryKey, IFilter, IFilterQuery, IFilterQueryCollectionCondition, IFilterQueryCondition, IFilterQueryNestedProperty, IFilterQueryObject, IFilterQueryProperty, IListResponseBody, IListResponseBodyMeta, INextCursorPageParameters, IOffsetPageParameters, IOrderQuery, IPageQuery, IPreviousCursorPageParameters, IResponseBody, IS_CROCKFORD_BASE32, IS_DOMAIN_URN, IS_ENUM_COLUMN, IS_SCALAR_DICTIONARY, IS_URN, InjectLogger, IntersectionType, IsBrowserRequest, IsCrockfordBase32, IsDomainUrn, IsEnumColumn, IsHidden, IsOpt, IsScalar, IsScalarDictionary, IsUrn, KeyEnvelope, LinearEntity, List, ListErrorCodesResponseDto, ListPropertyMetadata, ListResponseBodyType, Logger, LoggerConfig, LoggerErrorInterceptor, LoggerModule, type LoggerModuleOptions, MATCH_JSON_SCHEMA, MODULE_OPTIONS_TOKEN, MatchJsonSchema, MatchesUrn, Model, ModelMetadata, ModelOptions, ModelRegister, ModelSchemaOptions, ModuleExceptions, type ExceptionModuleOptions$1 as ModuleExceptionsOptions, NextCursorPageSchema, ObjectStorageModule, ObjectStorageModuleConfig, ObjectStorageModuleOptions, ObjectStorageOptions, ObjectStorageService, OffsetPageSchema, OffsetPagination, OmitType, OpenBaoAppRoleAuth, OpenBaoAppRoleAuthConfig, OpenBaoAuthMethod, OpenBaoAuthResponse, OpenBaoHttpClient, OpenBaoKubernetesAuth, OpenBaoKubernetesAuthConfig, OpenBaoModule, OpenBaoModuleConfig, OpenBaoModuleOptions, OpenBaoTokenAuth, OpenBaoTokenAuthConfig, OpenBaoTokenLookupSelfResponse, OpenBaoTokenManager, OpenBaoUserpassAuth, OpenBaoUserpassAuthConfig, OptionalPageQuery, OrderQueryType, PageQuery, ParseUUIDv7Pipe, PartialType, PendingException, PickType, PreviousCursorPageSchema, PrimaryKeyType, PrimaryKeyTypeClassMetadataPropertyKey, Property, PropertyKind, PropertyMetadata, RateLimitException, type ReencryptCommand, RefAssociationMetadata, type ResolveExceptions, ResponseBodyType, SaltedHash, SaltedHashHasher, SaltedHashModule, SaltedHashService, SaltedHashV1Hasher, ScalarClass, ScalarPropertyMetadata, type SchemaObject, Slice, SwaggerPatcher, SystemException, ThirdPartyException, type ThrowOnResponseErrorOptions, TimestampedEntity, type UnifyExceptionResponsesOptions, Urn, VALIDATE_NESTED_DICTIONARY, ValidateNestedDictionary, ValidationException, getExceptionModuleId, getFilterQueryOperators, isScalarClass, serializeModel, setOpenBaoToken, stableStringify, throwOnResponseError };
17852
17871
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1602,7 +1602,7 @@ function swaggerMetadataToJsonSchema(metadata) {
1602
1602
  }
1603
1603
  //#endregion
1604
1604
  //#region src/modules/core/converters/filter-query-type/get-filter-query-schema.ts
1605
- function getObjectSchema(classRef) {
1605
+ function getObjectSchema(classRef, visited = /* @__PURE__ */ new WeakSet()) {
1606
1606
  const properties = {};
1607
1607
  const requiredKeys = [];
1608
1608
  const schema = {
@@ -1610,24 +1610,28 @@ function getObjectSchema(classRef) {
1610
1610
  properties,
1611
1611
  additionalProperties: false
1612
1612
  };
1613
+ visited.add(classRef);
1613
1614
  for (const propertyKey of ModelRegister.getModelPropertyKeys(classRef)) {
1614
1615
  if (typeof propertyKey !== "string") continue;
1615
1616
  const propertyMetadata = ModelRegister.getProperty(classRef, propertyKey);
1616
1617
  const isCollection = propertyMetadata?.association?.kind === "1:m" || propertyMetadata?.association?.kind === "m:n";
1617
1618
  const isRelation = !!propertyMetadata?.association;
1618
1619
  if (!!!propertyMetadata?.optional) requiredKeys.push(propertyKey);
1619
- if (isRelation) if (isCollection) {
1620
- const sub = getObjectSchema(propertyMetadata.association.type());
1621
- const operators = getCollectionOperators(classRef, propertyKey);
1622
- const wrapper = {
1623
- type: "object",
1624
- properties: {},
1625
- additionalProperties: false
1626
- };
1627
- for (const operator of operators) wrapper.properties[operator] = sub;
1628
- properties[propertyKey] = wrapper;
1629
- } else properties[propertyKey] = getObjectSchema(propertyMetadata.association.type());
1630
- else {
1620
+ if (isRelation) {
1621
+ const relationClassRef = propertyMetadata.association.type();
1622
+ if (visited.has(relationClassRef)) continue;
1623
+ if (isCollection) {
1624
+ const sub = getObjectSchema(relationClassRef, visited);
1625
+ const operators = getCollectionOperators(classRef, propertyKey);
1626
+ const wrapper = {
1627
+ type: "object",
1628
+ properties: {},
1629
+ additionalProperties: false
1630
+ };
1631
+ for (const operator of operators) wrapper.properties[operator] = sub;
1632
+ properties[propertyKey] = wrapper;
1633
+ } else properties[propertyKey] = getObjectSchema(relationClassRef, visited);
1634
+ } else {
1631
1635
  const propertySchema = {
1632
1636
  type: "object",
1633
1637
  properties: {},
@@ -1708,41 +1712,45 @@ function createFilterQueryPropertyClassRef(classRef, propertyKey) {
1708
1712
  }
1709
1713
  return propertyClass;
1710
1714
  }
1711
- function createFilterQueryObjectClassRef(classRef) {
1715
+ function createFilterQueryObjectClassRef(classRef, visited = /* @__PURE__ */ new WeakSet()) {
1712
1716
  class FilterQueryObjectClass {}
1713
1717
  ModelRegister.addModel(FilterQueryObjectClass);
1718
+ visited.add(classRef);
1714
1719
  for (const propertyKey of ModelRegister.getModelPropertyKeys(classRef)) {
1715
1720
  if (typeof propertyKey !== "string") continue;
1716
1721
  const propertyMetadata = ModelRegister.getProperty(classRef, propertyKey);
1717
1722
  const isCollection = propertyMetadata?.association?.kind === "1:m" || propertyMetadata?.association?.kind === "m:n";
1718
1723
  const isRelation = !!propertyMetadata?.association;
1719
1724
  const isOptional = !!propertyMetadata?.optional;
1720
- if (isRelation) if (isCollection) {
1721
- class FilterQueryCollectionClass {}
1722
- ModelRegister.addModel(FilterQueryCollectionClass);
1723
- const sub = createFilterQueryObjectClassRef(propertyMetadata.association.type());
1724
- const operators = getCollectionOperators(classRef, propertyKey);
1725
- for (const operator of operators) {
1725
+ if (isRelation) {
1726
+ const relationClassRef = propertyMetadata.association.type();
1727
+ if (visited.has(relationClassRef)) continue;
1728
+ if (isCollection) {
1729
+ class FilterQueryCollectionClass {}
1730
+ ModelRegister.addModel(FilterQueryCollectionClass);
1731
+ const sub = createFilterQueryObjectClassRef(relationClassRef, visited);
1732
+ const operators = getCollectionOperators(classRef, propertyKey);
1733
+ for (const operator of operators) {
1734
+ Composite({
1735
+ type: () => sub,
1736
+ optional: true
1737
+ })(FilterQueryCollectionClass.prototype, operator);
1738
+ if (!isOptional) HasAnyKey(getFilterQueryOperators(classRef, propertyKey))(FilterQueryCollectionClass.prototype, operator);
1739
+ (0, class_validator.IsOptional)()(FilterQueryCollectionClass.prototype, operator);
1740
+ }
1741
+ Composite({
1742
+ type: () => FilterQueryCollectionClass,
1743
+ optional: isOptional
1744
+ })(FilterQueryObjectClass.prototype, propertyKey);
1745
+ if (!isOptional) HasAnyKey(operators)(FilterQueryObjectClass.prototype, propertyKey);
1746
+ } else {
1747
+ const sub = createFilterQueryObjectClassRef(relationClassRef, visited);
1726
1748
  Composite({
1727
1749
  type: () => sub,
1728
- optional: true
1729
- })(FilterQueryCollectionClass.prototype, operator);
1730
- if (!isOptional) HasAnyKey(getFilterQueryOperators(classRef, propertyKey))(FilterQueryCollectionClass.prototype, operator);
1731
- (0, class_validator.IsOptional)()(FilterQueryCollectionClass.prototype, operator);
1750
+ optional: isOptional
1751
+ })(FilterQueryObjectClass.prototype, propertyKey);
1732
1752
  }
1733
- Composite({
1734
- type: () => FilterQueryCollectionClass,
1735
- optional: isOptional
1736
- })(FilterQueryObjectClass.prototype, propertyKey);
1737
- if (!isOptional) HasAnyKey(operators)(FilterQueryObjectClass.prototype, propertyKey);
1738
1753
  } else {
1739
- const sub = createFilterQueryObjectClassRef(propertyMetadata.association.type());
1740
- Composite({
1741
- type: () => sub,
1742
- optional: isOptional
1743
- })(FilterQueryObjectClass.prototype, propertyKey);
1744
- }
1745
- else {
1746
1754
  const propertyClass = createFilterQueryPropertyClassRef(classRef, propertyKey);
1747
1755
  Composite({
1748
1756
  type: () => propertyClass,
@@ -2951,11 +2959,12 @@ function ManyToOne(entity, options) {
2951
2959
  return;
2952
2960
  }
2953
2961
  const type = () => resolveEntityType(entityRef, resolvedOptions?.eager);
2962
+ const fullEntityType = () => resolveEntityType(entityRef, true);
2954
2963
  Composite({
2955
2964
  type,
2956
2965
  association: {
2957
2966
  kind: "m:1",
2958
- type
2967
+ type: fullEntityType
2959
2968
  },
2960
2969
  schema: {
2961
2970
  description: resolvedOptions?.comment,
@@ -2989,11 +2998,12 @@ function OneToOne(entity, mappedByOrOptions, options) {
2989
2998
  return;
2990
2999
  }
2991
3000
  const type = () => resolveEntityType(entityRef, resolvedOptions?.eager);
3001
+ const fullEntityType = () => resolveEntityType(entityRef, true);
2992
3002
  Composite({
2993
3003
  type,
2994
3004
  association: {
2995
3005
  kind: "1:1",
2996
- type
3006
+ type: fullEntityType
2997
3007
  },
2998
3008
  schema: {
2999
3009
  description: resolvedOptions?.comment,
@@ -3027,13 +3037,14 @@ function OneToMany(options) {
3027
3037
  }
3028
3038
  const entityRef = options.entity;
3029
3039
  const type = () => resolveEntityType(entityRef, options.eager);
3040
+ const fullEntityType = () => resolveEntityType(entityRef, true);
3030
3041
  List({
3031
3042
  type,
3032
3043
  optional: options.nullable,
3033
3044
  lazy: options.eager !== true,
3034
3045
  association: {
3035
3046
  kind: "1:m",
3036
- type
3047
+ type: fullEntityType
3037
3048
  },
3038
3049
  schema: {
3039
3050
  description: options.comment,
@@ -3068,13 +3079,14 @@ function ManyToMany(entity, mappedBy, options) {
3068
3079
  return;
3069
3080
  }
3070
3081
  const type = () => resolveEntityType(entityRef, resolvedOptions?.eager);
3082
+ const fullEntityType = () => resolveEntityType(entityRef, true);
3071
3083
  List({
3072
3084
  type,
3073
3085
  optional: resolvedOptions?.nullable,
3074
3086
  lazy: resolvedOptions?.eager !== true,
3075
3087
  association: {
3076
3088
  kind: "m:n",
3077
- type
3089
+ type: fullEntityType
3078
3090
  },
3079
3091
  schema: {
3080
3092
  description: resolvedOptions?.comment,
@@ -3476,6 +3488,34 @@ function PartialType(classRef) {
3476
3488
  return PartialTypeClass;
3477
3489
  }
3478
3490
  //#endregion
3491
+ //#region src/modules/core/converters/intersection-type/intersection-type.ts
3492
+ /**
3493
+ * 将多个模型类合并为一个交叉类型。
3494
+ *
3495
+ * 类似 TypeScript 的交叉类型 `A & B`,同时合并 class-validator、class-transformer 和 Swagger 的元数据。
3496
+ *
3497
+ * @param classRefs - 需要合并的模型类引用列表
3498
+ * @returns 包含所有类属性的新类
3499
+ *
3500
+ * @example
3501
+ * ```typescript
3502
+ * const CreateUserDTO = IntersectionType(UserBaseDTO, UserProfileDTO)
3503
+ * ```
3504
+ */
3505
+ function IntersectionType(...classRefs) {
3506
+ const IntersectionTypeClass = (0, _nestjs_swagger.IntersectionType)(...classRefs);
3507
+ for (const classRef of classRefs) for (const propertyKey of ModelRegister.getModelPropertyKeys(classRef)) {
3508
+ ModelRegister.copyProperty(classRef, IntersectionTypeClass, propertyKey);
3509
+ const metadataKeys = Reflect.getMetadataKeys(classRef.prototype, propertyKey);
3510
+ for (const metadataKey of metadataKeys) {
3511
+ const metadata = Reflect.getMetadata(metadataKey, classRef.prototype, propertyKey);
3512
+ if (Reflect.hasMetadata(metadataKey, IntersectionTypeClass.prototype, propertyKey)) continue;
3513
+ Reflect.defineMetadata(metadataKey, metadata, IntersectionTypeClass.prototype, propertyKey);
3514
+ }
3515
+ }
3516
+ return IntersectionTypeClass;
3517
+ }
3518
+ //#endregion
3479
3519
  //#region src/modules/core/converters/order-query-type/get-order-query-schema.ts
3480
3520
  function getOrderQueryEnum() {
3481
3521
  return {
@@ -8630,6 +8670,7 @@ exports.IS_ENUM_COLUMN = IS_ENUM_COLUMN;
8630
8670
  exports.IS_SCALAR_DICTIONARY = IS_SCALAR_DICTIONARY;
8631
8671
  exports.IS_URN = IS_URN;
8632
8672
  exports.InjectLogger = InjectLogger;
8673
+ exports.IntersectionType = IntersectionType;
8633
8674
  exports.IsBrowserRequest = IsBrowserRequest;
8634
8675
  exports.IsCrockfordBase32 = IsCrockfordBase32;
8635
8676
  exports.IsDomainUrn = IsDomainUrn;