@buka/nestjs-kit 4.3.3 → 4.3.5

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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.3.5](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.3.4...v4.3.5) (2026-06-02)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * 修复ManyToMany和OneToMany立刻获取type数据导致的循环引用报错问题 ([c2c44c1](https://github.com/buka-ltd/npm.nestjs-kit/commit/c2c44c1d3e5d7ac2110f480f303fc9123a73087e))
9
+
10
+ ## [4.3.4](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.3.3...v4.3.4) (2026-05-27)
11
+
12
+
13
+ ### Performance Improvements
14
+
15
+ * 修正 urn 支持最新规范 ([a4ba918](https://github.com/buka-ltd/npm.nestjs-kit/commit/a4ba918cc237ee720eda28b120ddd2ce489ae1fe))
16
+
3
17
  ## [4.3.3](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.3.2...v4.3.3) (2026-05-27)
4
18
 
5
19
 
package/dist/index.d.mts CHANGED
@@ -228,8 +228,6 @@ declare function IsScalarDictionary(ctor: ScalarClass, validationOptions?: Valid
228
228
  //#region src/modules/core/decorators/class-validator/is-urn.d.ts
229
229
  declare const IS_URN = "isUrn";
230
230
  declare const IS_DOMAIN_URN = "isDomainUrn";
231
- declare const IS_RESOURCE_TYPE_URN = "isResourceTypeUrn";
232
- declare const IS_RESOURCE_ID_URN = "isResourceIdUrn";
233
231
  /**
234
232
  * 验证字符串是否为合法的 URN(任意层级)。
235
233
  *
@@ -254,30 +252,6 @@ declare function IsUrn(validationOptions?: ValidationOptions): (object: object,
254
252
  * ```
255
253
  */
256
254
  declare function IsDomainUrn(validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
257
- /**
258
- * 验证字符串是否为资源类型级 URN(含 domain 和 resourceType,无 resourceId)。
259
- *
260
- * @example
261
- * ```typescript
262
- * class ResourceDTO {
263
- * @IsResourceTypeUrn()
264
- * resourceType: string
265
- * }
266
- * ```
267
- */
268
- declare function IsResourceTypeUrn(validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
269
- /**
270
- * 验证字符串是否为实例级 URN(含完整三段:domain、resourceType 和 resourceId)。
271
- *
272
- * @example
273
- * ```typescript
274
- * class TokenPayloadDTO {
275
- * @IsResourceIdUrn()
276
- * sub: string
277
- * }
278
- * ```
279
- */
280
- declare function IsResourceIdUrn(validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
281
255
  /**
282
256
  * 验证字符串是否匹配指定的 URN 模式(支持通配符 `*` 和 `**`)。
283
257
  *
@@ -989,80 +963,52 @@ declare class Slice<T extends object> {
989
963
  /**
990
964
  * 统一资源名称(URN)
991
965
  *
992
- * 格式: urn:buka:<domain>:<resource-type>[:<resource-id>]
966
+ * 格式: urn:buka:<domain>:<resource...>
993
967
  *
994
- * 支持三种粒度:
995
968
  * - 概念域级: urn:buka:galaxy
996
- * - 资源类型级: urn:buka:galaxy:principal
997
- * - 实例级: urn:buka:galaxy:principal:550e8400-e29b-41d4-a716-446655440000
969
+ * - 资源级: urn:buka:galaxy:auth-client:galaxy:console
998
970
  *
999
- * domain 划分原则:按资源类型的定义权归属划分,非按部署单元。
1000
- * resource-type 第一级推荐用于 env(环境),这是一个语义约定,不强制。
971
+ * domain 之后的全部段为 resource 路径(: 分隔),parser 不区分"类型"和"实例"。
972
+ * 应用层自行约定 resource 各段的语义。
1001
973
  *
1002
- * 推荐通过静态工厂方法或派生方法构建层级 URN:
1003
974
  * ```ts
1004
- * Urn.of('galaxy') // → DomainUrn
1005
- * Urn.of('galaxy', 'principal') // → ResourceTypeUrn
1006
- * Urn.of('galaxy', 'principal', '550e8400-...') // → ResourceIdUrn
975
+ * Urn.of('galaxy') // → 概念域级 URN
976
+ * Urn.of('galaxy', 'auth-client:galaxy:console') // → 资源级 URN
977
+ * Urn.of('galaxy', ['auth-client', 'galaxy', 'console'])
1007
978
  *
1008
- * // 或通过派生方法逐层构建
1009
- * Urn.of('galaxy')
1010
- * .withResourceType('principal') // → ResourceTypeUrn
1011
- * .withResourceId('550e8400-...') // → ResourceIdUrn
979
+ * // 或通过派生方法构建
980
+ * Urn.of('galaxy').withResource('auth-client', 'galaxy', 'console')
1012
981
  * ```
1013
982
  */
1014
983
  declare class Urn {
1015
- /** 概念域 — 资源类型定义权归属,通常为系统名 */
984
+ /** 概念域 — 资源定义权归属,通常为系统名 */
1016
985
  readonly domain: string;
1017
- /** 资源类型,可多级。第一级推荐用于 env */
1018
- readonly resourceType?: string | undefined;
1019
- /** 资源实例唯一标识 */
1020
- readonly resourceId?: string | undefined;
986
+ /** domain 之后的完整资源路径(: 分隔),undefined 表示概念域级 */
987
+ readonly resource?: string | undefined;
1021
988
  private constructor();
1022
989
  /**
1023
- * 序列化为 URN 字符串
990
+ * resource 按 `:` 拆分后的段数组
1024
991
  */
1025
- toString(): string;
992
+ get resourceSegments(): string[];
1026
993
  /**
1027
- * 返回 resourceType 按 `:` 拆分后的层级数组
994
+ * 序列化为 URN 字符串
1028
995
  */
1029
- get resourceTypeSegments(): string[];
996
+ toString(): string;
1030
997
  private toSegments;
1031
998
  /**
1032
- * 衍生出资源类型级 URN
1033
- *
1034
- * @throws Error 当前 URN 已有 resourceType 时抛出
1035
- */
1036
- withResourceType(resourceType: string): ResourceTypeUrn;
1037
- /**
1038
- * 衍生出实例级 URN
999
+ * 从概念域级 URN 衍生出资源级 URN
1039
1000
  *
1040
- * @throws Error 当前 URN 无 resourceType 或已有 resourceId 时抛出
1041
- */
1042
- withResourceId(resourceId: string): ResourceIdUrn;
1043
- /**
1044
- * 类型守卫:判断是否为概念域级 URN
1001
+ * @throws Error 当前 URN 已有 resource 时抛出
1045
1002
  */
1046
- isDomainUrn(): this is DomainUrn;
1003
+ withResource(...segments: string[]): Urn;
1047
1004
  /**
1048
- * 类型守卫:判断是否为资源类型级 URN
1005
+ * 类型守卫:判断是否为概念域级 URN(无 resource)
1049
1006
  */
1050
- isResourceTypeUrn(): this is ResourceTypeUrn;
1051
- /**
1052
- * 类型守卫:判断是否为实例级 URN
1053
- */
1054
- isResourceIdUrn(): this is ResourceIdUrn;
1007
+ isDomainUrn(): boolean;
1055
1008
  /**
1056
1009
  * 根据参数创建对应层级的 URN
1057
- *
1058
- * 重载签名使返回类型随参数数量自动窄化:
1059
- * - 仅 domain → DomainUrn
1060
- * - domain + resourceType → ResourceTypeUrn
1061
- * - domain + resourceType + resourceId → ResourceIdUrn
1062
1010
  */
1063
- static of(domain: string): DomainUrn;
1064
- static of(domain: string, resourceType: string): ResourceTypeUrn;
1065
- static of(domain: string, resourceType: string, resourceId: string): ResourceIdUrn;
1011
+ static of(domain: string, resource?: string | string[]): Urn;
1066
1012
  /**
1067
1013
  * 从 URN 字符串解析,支持通配符 `*` 和 `**`
1068
1014
  *
@@ -1073,11 +1019,20 @@ declare class Urn {
1073
1019
  */
1074
1020
  static parse(urn: string): Urn;
1075
1021
  /**
1076
- * 判断是否匹配指定的 domain、resourceType 和 resourceId
1022
+ * 判断是否匹配指定的 domain 和 resource
1077
1023
  *
1078
- * 仅比较传入的参数,未传入的参数不参与比较。
1024
+ * 未传入的参数不参与比较。
1079
1025
  */
1080
- is(domain: string, resourceType?: string, resourceId?: string): boolean;
1026
+ is(domain: string, resource?: string): boolean;
1027
+ /**
1028
+ * 判断当前 URN 是否匹配指定的 URN 模式(支持通配符)
1029
+ *
1030
+ * ```ts
1031
+ * urn.match('urn:buka:galaxy:principal:*') // resource 以 principal: 开头
1032
+ * urn.match('urn:buka:galaxy:auth-client:**') // 任意深度的 auth-client
1033
+ * ```
1034
+ */
1035
+ match(pattern: string): boolean;
1081
1036
  /**
1082
1037
  * 判断当前 URN 是否包含另一个 URN
1083
1038
  *
@@ -1089,43 +1044,6 @@ declare class Urn {
1089
1044
  */
1090
1045
  contains(other: Urn): boolean;
1091
1046
  }
1092
- /**
1093
- * 概念域级 URN — 仅含 domain,无 resourceType 和 resourceId
1094
- *
1095
- * 可通过 `withResourceType()` 衍生出 `ResourceTypeUrn`。
1096
- * 禁止直接调用 `withResourceId()`(跳层派生)。
1097
- */
1098
- interface DomainUrn extends Urn {
1099
- readonly resourceType: undefined;
1100
- readonly resourceId: undefined;
1101
- /** @deprecated 禁止跳层派生,请先调用 withResourceType() */
1102
- withResourceId: never;
1103
- }
1104
- /**
1105
- * 资源类型级 URN — 含 domain 和 resourceType,无 resourceId
1106
- *
1107
- * 可通过 `withResourceId()` 衍生出 `ResourceIdUrn`。
1108
- * 禁止调用 `withResourceType()`(横向衍生另一个资源类型)。
1109
- */
1110
- interface ResourceTypeUrn extends Urn {
1111
- readonly resourceType: string;
1112
- readonly resourceId: undefined;
1113
- /** @deprecated 禁止横向衍生,ResourceTypeUrn 不能再衍生另一个资源类型 */
1114
- withResourceType: never;
1115
- }
1116
- /**
1117
- * 实例级 URN — 含完整三段:domain、resourceType 和 resourceId
1118
- *
1119
- * 终态 URN,不可继续衍生。
1120
- */
1121
- interface ResourceIdUrn extends Urn {
1122
- readonly resourceType: string;
1123
- readonly resourceId: string;
1124
- /** @deprecated 终态 URN,不可继续衍生 */
1125
- withResourceType: never;
1126
- /** @deprecated 终态 URN,不可继续衍生 */
1127
- withResourceId: never;
1128
- }
1129
1047
  //#endregion
1130
1048
  //#region src/modules/core/converters/filter-query-type/decorators/filter-query-operators.decorator.d.ts
1131
1049
  type FilterQueryOperator = 'eq' | 'ne' | 'lt' | 'gt' | 'lte' | 'gte' | 'in' | 'nin' | 'some' | 'every' | 'none';
@@ -18717,5 +18635,5 @@ declare class ObjectStorageService implements OnModuleInit {
18717
18635
  */
18718
18636
  declare function stableStringify(value: unknown): string;
18719
18637
  //#endregion
18720
- export { AssociationMetadata, AuthException, BUKA_MODULE_OPTIONS_TOKEN, Base32, BlindIndex, BlindIndexHasher, BlindIndexModule, BlindIndexService, BlindIndexV1Hasher, BukaConfigurableModuleClass, BukaExceptions, BukaModule, BukaModuleOptions, BukaPageQueryValidationPipe, BukaValidationPipe, BusinessException, Cardinality, type CipherMetadata, CollectionAssociationMetadata, Column, Composite, CompositePropertyMetadata, ConfigurableModuleClass, ConflictException, CursorPagination, DatabaseConfig, type DecryptCommand, DegradeException, Dictionary, DictionaryPropertyMetadata, DiscreteEntity, DomainUrn, 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_RESOURCE_ID_URN, IS_RESOURCE_TYPE_URN, IS_SCALAR_DICTIONARY, IS_URN, InjectLogger, IsBrowserRequest, IsCrockfordBase32, IsDomainUrn, IsHidden, IsOpt, IsResourceIdUrn, IsResourceTypeUrn, 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, ResourceIdUrn, ResourceTypeUrn, ResponseBodyType, SaltedHash, SaltedHashHasher, SaltedHashModule, SaltedHashService, SaltedHashV1Hasher, ScalarClass, ScalarPropertyMetadata, type SchemaObject, Slice, SwaggerPatcher, SystemException, ThirdPartyException, TimestampedEntity, type UnifyExceptionResponsesOptions, Urn, VALIDATE_NESTED_DICTIONARY, ValidateNestedDictionary, ValidationException, getExceptionModuleId, getFilterQueryOperators, isScalarClass, serializeModel, setOpenBaoToken, stableStringify };
18638
+ export { AssociationMetadata, AuthException, BUKA_MODULE_OPTIONS_TOKEN, Base32, BlindIndex, BlindIndexHasher, BlindIndexModule, BlindIndexService, BlindIndexV1Hasher, BukaConfigurableModuleClass, BukaExceptions, BukaModule, BukaModuleOptions, BukaPageQueryValidationPipe, 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_SCALAR_DICTIONARY, IS_URN, InjectLogger, IsBrowserRequest, IsCrockfordBase32, IsDomainUrn, 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, TimestampedEntity, type UnifyExceptionResponsesOptions, Urn, VALIDATE_NESTED_DICTIONARY, ValidateNestedDictionary, ValidationException, getExceptionModuleId, getFilterQueryOperators, isScalarClass, serializeModel, setOpenBaoToken, stableStringify };
18721
18639
  //# sourceMappingURL=index.d.mts.map
package/dist/index.d.ts CHANGED
@@ -228,8 +228,6 @@ declare function IsScalarDictionary(ctor: ScalarClass, validationOptions?: Valid
228
228
  //#region src/modules/core/decorators/class-validator/is-urn.d.ts
229
229
  declare const IS_URN = "isUrn";
230
230
  declare const IS_DOMAIN_URN = "isDomainUrn";
231
- declare const IS_RESOURCE_TYPE_URN = "isResourceTypeUrn";
232
- declare const IS_RESOURCE_ID_URN = "isResourceIdUrn";
233
231
  /**
234
232
  * 验证字符串是否为合法的 URN(任意层级)。
235
233
  *
@@ -254,30 +252,6 @@ declare function IsUrn(validationOptions?: ValidationOptions): (object: object,
254
252
  * ```
255
253
  */
256
254
  declare function IsDomainUrn(validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
257
- /**
258
- * 验证字符串是否为资源类型级 URN(含 domain 和 resourceType,无 resourceId)。
259
- *
260
- * @example
261
- * ```typescript
262
- * class ResourceDTO {
263
- * @IsResourceTypeUrn()
264
- * resourceType: string
265
- * }
266
- * ```
267
- */
268
- declare function IsResourceTypeUrn(validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
269
- /**
270
- * 验证字符串是否为实例级 URN(含完整三段:domain、resourceType 和 resourceId)。
271
- *
272
- * @example
273
- * ```typescript
274
- * class TokenPayloadDTO {
275
- * @IsResourceIdUrn()
276
- * sub: string
277
- * }
278
- * ```
279
- */
280
- declare function IsResourceIdUrn(validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
281
255
  /**
282
256
  * 验证字符串是否匹配指定的 URN 模式(支持通配符 `*` 和 `**`)。
283
257
  *
@@ -989,80 +963,52 @@ declare class Slice<T extends object> {
989
963
  /**
990
964
  * 统一资源名称(URN)
991
965
  *
992
- * 格式: urn:buka:<domain>:<resource-type>[:<resource-id>]
966
+ * 格式: urn:buka:<domain>:<resource...>
993
967
  *
994
- * 支持三种粒度:
995
968
  * - 概念域级: urn:buka:galaxy
996
- * - 资源类型级: urn:buka:galaxy:principal
997
- * - 实例级: urn:buka:galaxy:principal:550e8400-e29b-41d4-a716-446655440000
969
+ * - 资源级: urn:buka:galaxy:auth-client:galaxy:console
998
970
  *
999
- * domain 划分原则:按资源类型的定义权归属划分,非按部署单元。
1000
- * resource-type 第一级推荐用于 env(环境),这是一个语义约定,不强制。
971
+ * domain 之后的全部段为 resource 路径(: 分隔),parser 不区分"类型"和"实例"。
972
+ * 应用层自行约定 resource 各段的语义。
1001
973
  *
1002
- * 推荐通过静态工厂方法或派生方法构建层级 URN:
1003
974
  * ```ts
1004
- * Urn.of('galaxy') // → DomainUrn
1005
- * Urn.of('galaxy', 'principal') // → ResourceTypeUrn
1006
- * Urn.of('galaxy', 'principal', '550e8400-...') // → ResourceIdUrn
975
+ * Urn.of('galaxy') // → 概念域级 URN
976
+ * Urn.of('galaxy', 'auth-client:galaxy:console') // → 资源级 URN
977
+ * Urn.of('galaxy', ['auth-client', 'galaxy', 'console'])
1007
978
  *
1008
- * // 或通过派生方法逐层构建
1009
- * Urn.of('galaxy')
1010
- * .withResourceType('principal') // → ResourceTypeUrn
1011
- * .withResourceId('550e8400-...') // → ResourceIdUrn
979
+ * // 或通过派生方法构建
980
+ * Urn.of('galaxy').withResource('auth-client', 'galaxy', 'console')
1012
981
  * ```
1013
982
  */
1014
983
  declare class Urn {
1015
- /** 概念域 — 资源类型定义权归属,通常为系统名 */
984
+ /** 概念域 — 资源定义权归属,通常为系统名 */
1016
985
  readonly domain: string;
1017
- /** 资源类型,可多级。第一级推荐用于 env */
1018
- readonly resourceType?: string | undefined;
1019
- /** 资源实例唯一标识 */
1020
- readonly resourceId?: string | undefined;
986
+ /** domain 之后的完整资源路径(: 分隔),undefined 表示概念域级 */
987
+ readonly resource?: string | undefined;
1021
988
  private constructor();
1022
989
  /**
1023
- * 序列化为 URN 字符串
990
+ * resource 按 `:` 拆分后的段数组
1024
991
  */
1025
- toString(): string;
992
+ get resourceSegments(): string[];
1026
993
  /**
1027
- * 返回 resourceType 按 `:` 拆分后的层级数组
994
+ * 序列化为 URN 字符串
1028
995
  */
1029
- get resourceTypeSegments(): string[];
996
+ toString(): string;
1030
997
  private toSegments;
1031
998
  /**
1032
- * 衍生出资源类型级 URN
1033
- *
1034
- * @throws Error 当前 URN 已有 resourceType 时抛出
1035
- */
1036
- withResourceType(resourceType: string): ResourceTypeUrn;
1037
- /**
1038
- * 衍生出实例级 URN
999
+ * 从概念域级 URN 衍生出资源级 URN
1039
1000
  *
1040
- * @throws Error 当前 URN 无 resourceType 或已有 resourceId 时抛出
1041
- */
1042
- withResourceId(resourceId: string): ResourceIdUrn;
1043
- /**
1044
- * 类型守卫:判断是否为概念域级 URN
1001
+ * @throws Error 当前 URN 已有 resource 时抛出
1045
1002
  */
1046
- isDomainUrn(): this is DomainUrn;
1003
+ withResource(...segments: string[]): Urn;
1047
1004
  /**
1048
- * 类型守卫:判断是否为资源类型级 URN
1005
+ * 类型守卫:判断是否为概念域级 URN(无 resource)
1049
1006
  */
1050
- isResourceTypeUrn(): this is ResourceTypeUrn;
1051
- /**
1052
- * 类型守卫:判断是否为实例级 URN
1053
- */
1054
- isResourceIdUrn(): this is ResourceIdUrn;
1007
+ isDomainUrn(): boolean;
1055
1008
  /**
1056
1009
  * 根据参数创建对应层级的 URN
1057
- *
1058
- * 重载签名使返回类型随参数数量自动窄化:
1059
- * - 仅 domain → DomainUrn
1060
- * - domain + resourceType → ResourceTypeUrn
1061
- * - domain + resourceType + resourceId → ResourceIdUrn
1062
1010
  */
1063
- static of(domain: string): DomainUrn;
1064
- static of(domain: string, resourceType: string): ResourceTypeUrn;
1065
- static of(domain: string, resourceType: string, resourceId: string): ResourceIdUrn;
1011
+ static of(domain: string, resource?: string | string[]): Urn;
1066
1012
  /**
1067
1013
  * 从 URN 字符串解析,支持通配符 `*` 和 `**`
1068
1014
  *
@@ -1073,11 +1019,20 @@ declare class Urn {
1073
1019
  */
1074
1020
  static parse(urn: string): Urn;
1075
1021
  /**
1076
- * 判断是否匹配指定的 domain、resourceType 和 resourceId
1022
+ * 判断是否匹配指定的 domain 和 resource
1077
1023
  *
1078
- * 仅比较传入的参数,未传入的参数不参与比较。
1024
+ * 未传入的参数不参与比较。
1079
1025
  */
1080
- is(domain: string, resourceType?: string, resourceId?: string): boolean;
1026
+ is(domain: string, resource?: string): boolean;
1027
+ /**
1028
+ * 判断当前 URN 是否匹配指定的 URN 模式(支持通配符)
1029
+ *
1030
+ * ```ts
1031
+ * urn.match('urn:buka:galaxy:principal:*') // resource 以 principal: 开头
1032
+ * urn.match('urn:buka:galaxy:auth-client:**') // 任意深度的 auth-client
1033
+ * ```
1034
+ */
1035
+ match(pattern: string): boolean;
1081
1036
  /**
1082
1037
  * 判断当前 URN 是否包含另一个 URN
1083
1038
  *
@@ -1089,43 +1044,6 @@ declare class Urn {
1089
1044
  */
1090
1045
  contains(other: Urn): boolean;
1091
1046
  }
1092
- /**
1093
- * 概念域级 URN — 仅含 domain,无 resourceType 和 resourceId
1094
- *
1095
- * 可通过 `withResourceType()` 衍生出 `ResourceTypeUrn`。
1096
- * 禁止直接调用 `withResourceId()`(跳层派生)。
1097
- */
1098
- interface DomainUrn extends Urn {
1099
- readonly resourceType: undefined;
1100
- readonly resourceId: undefined;
1101
- /** @deprecated 禁止跳层派生,请先调用 withResourceType() */
1102
- withResourceId: never;
1103
- }
1104
- /**
1105
- * 资源类型级 URN — 含 domain 和 resourceType,无 resourceId
1106
- *
1107
- * 可通过 `withResourceId()` 衍生出 `ResourceIdUrn`。
1108
- * 禁止调用 `withResourceType()`(横向衍生另一个资源类型)。
1109
- */
1110
- interface ResourceTypeUrn extends Urn {
1111
- readonly resourceType: string;
1112
- readonly resourceId: undefined;
1113
- /** @deprecated 禁止横向衍生,ResourceTypeUrn 不能再衍生另一个资源类型 */
1114
- withResourceType: never;
1115
- }
1116
- /**
1117
- * 实例级 URN — 含完整三段:domain、resourceType 和 resourceId
1118
- *
1119
- * 终态 URN,不可继续衍生。
1120
- */
1121
- interface ResourceIdUrn extends Urn {
1122
- readonly resourceType: string;
1123
- readonly resourceId: string;
1124
- /** @deprecated 终态 URN,不可继续衍生 */
1125
- withResourceType: never;
1126
- /** @deprecated 终态 URN,不可继续衍生 */
1127
- withResourceId: never;
1128
- }
1129
1047
  //#endregion
1130
1048
  //#region src/modules/core/converters/filter-query-type/decorators/filter-query-operators.decorator.d.ts
1131
1049
  type FilterQueryOperator = 'eq' | 'ne' | 'lt' | 'gt' | 'lte' | 'gte' | 'in' | 'nin' | 'some' | 'every' | 'none';
@@ -18717,5 +18635,5 @@ declare class ObjectStorageService implements OnModuleInit {
18717
18635
  */
18718
18636
  declare function stableStringify(value: unknown): string;
18719
18637
  //#endregion
18720
- export { AssociationMetadata, AuthException, BUKA_MODULE_OPTIONS_TOKEN, Base32, BlindIndex, BlindIndexHasher, BlindIndexModule, BlindIndexService, BlindIndexV1Hasher, BukaConfigurableModuleClass, BukaExceptions, BukaModule, BukaModuleOptions, BukaPageQueryValidationPipe, BukaValidationPipe, BusinessException, Cardinality, type CipherMetadata, CollectionAssociationMetadata, Column, Composite, CompositePropertyMetadata, ConfigurableModuleClass, ConflictException, CursorPagination, DatabaseConfig, type DecryptCommand, DegradeException, Dictionary, DictionaryPropertyMetadata, DiscreteEntity, DomainUrn, 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_RESOURCE_ID_URN, IS_RESOURCE_TYPE_URN, IS_SCALAR_DICTIONARY, IS_URN, InjectLogger, IsBrowserRequest, IsCrockfordBase32, IsDomainUrn, IsHidden, IsOpt, IsResourceIdUrn, IsResourceTypeUrn, 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, ResourceIdUrn, ResourceTypeUrn, ResponseBodyType, SaltedHash, SaltedHashHasher, SaltedHashModule, SaltedHashService, SaltedHashV1Hasher, ScalarClass, ScalarPropertyMetadata, type SchemaObject, Slice, SwaggerPatcher, SystemException, ThirdPartyException, TimestampedEntity, type UnifyExceptionResponsesOptions, Urn, VALIDATE_NESTED_DICTIONARY, ValidateNestedDictionary, ValidationException, getExceptionModuleId, getFilterQueryOperators, isScalarClass, serializeModel, setOpenBaoToken, stableStringify };
18638
+ export { AssociationMetadata, AuthException, BUKA_MODULE_OPTIONS_TOKEN, Base32, BlindIndex, BlindIndexHasher, BlindIndexModule, BlindIndexService, BlindIndexV1Hasher, BukaConfigurableModuleClass, BukaExceptions, BukaModule, BukaModuleOptions, BukaPageQueryValidationPipe, 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_SCALAR_DICTIONARY, IS_URN, InjectLogger, IsBrowserRequest, IsCrockfordBase32, IsDomainUrn, 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, TimestampedEntity, type UnifyExceptionResponsesOptions, Urn, VALIDATE_NESTED_DICTIONARY, ValidateNestedDictionary, ValidationException, getExceptionModuleId, getFilterQueryOperators, isScalarClass, serializeModel, setOpenBaoToken, stableStringify };
18721
18639
  //# sourceMappingURL=index.d.ts.map