@buka/nestjs-kit 4.1.9 → 4.3.0
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 +14 -0
- package/dist/index.d.mts +100 -66
- package/dist/index.d.ts +100 -66
- package/dist/index.js +177 -71
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +171 -66
- package/dist/index.mjs.map +1 -1
- package/docs/core/index.md +1 -1
- package/docs/core/urn.md +93 -99
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.3.0](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.2.0...v4.3.0) (2026-05-24)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add MatchUrn validator ([89196bd](https://github.com/buka-ltd/npm.nestjs-kit/commit/89196bd1d263feccf7cc9d0f8b8adad90d1d219f))
|
|
9
|
+
|
|
10
|
+
## [4.2.0](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.1.9...v4.2.0) (2026-05-24)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* urn支持通配符 ([31bc4e1](https://github.com/buka-ltd/npm.nestjs-kit/commit/31bc4e13045255eb99b8b719589af697046005d0))
|
|
16
|
+
|
|
3
17
|
## [4.1.9](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.1.8...v4.1.9) (2026-05-24)
|
|
4
18
|
|
|
5
19
|
|
package/dist/index.d.mts
CHANGED
|
@@ -227,9 +227,9 @@ declare function IsScalarDictionary(ctor: ScalarClass, validationOptions?: Valid
|
|
|
227
227
|
//#endregion
|
|
228
228
|
//#region src/modules/core/decorators/class-validator/is-urn.d.ts
|
|
229
229
|
declare const IS_URN = "isUrn";
|
|
230
|
-
declare const
|
|
231
|
-
declare const
|
|
232
|
-
declare const
|
|
230
|
+
declare const IS_DOMAIN_URN = "isDomainUrn";
|
|
231
|
+
declare const IS_RESOURCE_TYPE_URN = "isResourceTypeUrn";
|
|
232
|
+
declare const IS_RESOURCE_ID_URN = "isResourceIdUrn";
|
|
233
233
|
/**
|
|
234
234
|
* 验证字符串是否为合法的 URN(任意层级)。
|
|
235
235
|
*
|
|
@@ -243,41 +243,56 @@ declare const IS_IDENTIFIER_URN = "isIdentifierUrn";
|
|
|
243
243
|
*/
|
|
244
244
|
declare function IsUrn(validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
|
|
245
245
|
/**
|
|
246
|
-
*
|
|
246
|
+
* 验证字符串是否为概念域级 URN(仅含 domain,无 resourceType 和 resourceId)。
|
|
247
247
|
*
|
|
248
248
|
* @example
|
|
249
249
|
* ```typescript
|
|
250
250
|
* class TokenPayloadDTO {
|
|
251
|
-
* @
|
|
251
|
+
* @IsDomainUrn()
|
|
252
252
|
* aud: string
|
|
253
253
|
* }
|
|
254
254
|
* ```
|
|
255
255
|
*/
|
|
256
|
-
declare function
|
|
256
|
+
declare function IsDomainUrn(validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
|
|
257
257
|
/**
|
|
258
|
-
* 验证字符串是否为资源类型级 URN(含
|
|
258
|
+
* 验证字符串是否为资源类型级 URN(含 domain 和 resourceType,无 resourceId)。
|
|
259
259
|
*
|
|
260
260
|
* @example
|
|
261
261
|
* ```typescript
|
|
262
262
|
* class ResourceDTO {
|
|
263
|
-
* @
|
|
263
|
+
* @IsResourceTypeUrn()
|
|
264
264
|
* resourceType: string
|
|
265
265
|
* }
|
|
266
266
|
* ```
|
|
267
267
|
*/
|
|
268
|
-
declare function
|
|
268
|
+
declare function IsResourceTypeUrn(validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
|
|
269
269
|
/**
|
|
270
|
-
* 验证字符串是否为实例级 URN(含完整三段:
|
|
270
|
+
* 验证字符串是否为实例级 URN(含完整三段:domain、resourceType 和 resourceId)。
|
|
271
271
|
*
|
|
272
272
|
* @example
|
|
273
273
|
* ```typescript
|
|
274
274
|
* class TokenPayloadDTO {
|
|
275
|
-
* @
|
|
275
|
+
* @IsResourceIdUrn()
|
|
276
276
|
* sub: string
|
|
277
277
|
* }
|
|
278
278
|
* ```
|
|
279
279
|
*/
|
|
280
|
-
declare function
|
|
280
|
+
declare function IsResourceIdUrn(validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
|
|
281
|
+
/**
|
|
282
|
+
* 验证字符串是否匹配指定的 URN 模式(支持通配符 `*` 和 `**`)。
|
|
283
|
+
*
|
|
284
|
+
* - `*` 匹配恰好一个段
|
|
285
|
+
* - `**` 匹配零个或多个尾部段
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```typescript
|
|
289
|
+
* class CreateClientDTO {
|
|
290
|
+
* @MatchesUrn('urn:buka:galaxy:client:*')
|
|
291
|
+
* clientUrn: string
|
|
292
|
+
* }
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
declare function MatchesUrn(pattern: string, validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
|
|
281
296
|
//#endregion
|
|
282
297
|
//#region src/modules/core/decorators/class-validator/match-json-schema.d.ts
|
|
283
298
|
declare const MATCH_JSON_SCHEMA = "matchJsonSchema";
|
|
@@ -969,123 +984,142 @@ declare class Slice<T extends object> {
|
|
|
969
984
|
/**
|
|
970
985
|
* 统一资源名称(URN)
|
|
971
986
|
*
|
|
972
|
-
* 格式: urn:buka:<
|
|
987
|
+
* 格式: urn:buka:<domain>:<resource-type>[:<resource-id>]
|
|
973
988
|
*
|
|
974
989
|
* 支持三种粒度:
|
|
975
|
-
* -
|
|
990
|
+
* - 概念域级: urn:buka:galaxy
|
|
976
991
|
* - 资源类型级: urn:buka:galaxy:principal
|
|
977
992
|
* - 实例级: urn:buka:galaxy:principal:550e8400-e29b-41d4-a716-446655440000
|
|
978
993
|
*
|
|
979
|
-
*
|
|
994
|
+
* domain 划分原则:按资源类型的定义权归属划分,非按部署单元。
|
|
995
|
+
* resource-type 第一级推荐用于 env(环境),这是一个语义约定,不强制。
|
|
980
996
|
*
|
|
981
997
|
* 推荐通过静态工厂方法或派生方法构建层级 URN:
|
|
982
998
|
* ```ts
|
|
983
|
-
* Urn.of('galaxy') // →
|
|
984
|
-
* Urn.of('galaxy', 'principal') // →
|
|
985
|
-
* Urn.of('galaxy', 'principal', '550e8400-...') // →
|
|
999
|
+
* Urn.of('galaxy') // → DomainUrn
|
|
1000
|
+
* Urn.of('galaxy', 'principal') // → ResourceTypeUrn
|
|
1001
|
+
* Urn.of('galaxy', 'principal', '550e8400-...') // → ResourceIdUrn
|
|
986
1002
|
*
|
|
987
1003
|
* // 或通过派生方法逐层构建
|
|
988
1004
|
* Urn.of('galaxy')
|
|
989
|
-
* .
|
|
990
|
-
* .
|
|
1005
|
+
* .withResourceType('principal') // → ResourceTypeUrn
|
|
1006
|
+
* .withResourceId('550e8400-...') // → ResourceIdUrn
|
|
991
1007
|
* ```
|
|
992
1008
|
*/
|
|
993
1009
|
declare class Urn {
|
|
994
|
-
/**
|
|
995
|
-
readonly
|
|
996
|
-
/**
|
|
997
|
-
readonly
|
|
998
|
-
/**
|
|
999
|
-
readonly
|
|
1010
|
+
/** 概念域 — 资源类型定义权归属,通常为系统名 */
|
|
1011
|
+
readonly domain: string;
|
|
1012
|
+
/** 资源类型,可多级。第一级推荐用于 env */
|
|
1013
|
+
readonly resourceType?: string | undefined;
|
|
1014
|
+
/** 资源实例唯一标识 */
|
|
1015
|
+
readonly resourceId?: string | undefined;
|
|
1000
1016
|
private constructor();
|
|
1001
1017
|
/**
|
|
1002
1018
|
* 序列化为 URN 字符串
|
|
1003
1019
|
*/
|
|
1004
1020
|
toString(): string;
|
|
1021
|
+
/**
|
|
1022
|
+
* 返回 resourceType 按 `:` 拆分后的层级数组
|
|
1023
|
+
*/
|
|
1024
|
+
get resourceTypeSegments(): string[];
|
|
1025
|
+
private toSegments;
|
|
1005
1026
|
/**
|
|
1006
1027
|
* 衍生出资源类型级 URN
|
|
1007
1028
|
*
|
|
1008
|
-
* @throws Error 当前 URN 已有
|
|
1029
|
+
* @throws Error 当前 URN 已有 resourceType 时抛出
|
|
1009
1030
|
*/
|
|
1010
|
-
|
|
1031
|
+
withResourceType(resourceType: string): ResourceTypeUrn;
|
|
1011
1032
|
/**
|
|
1012
1033
|
* 衍生出实例级 URN
|
|
1013
1034
|
*
|
|
1014
|
-
* @throws Error 当前 URN 无
|
|
1035
|
+
* @throws Error 当前 URN 无 resourceType 或已有 resourceId 时抛出
|
|
1015
1036
|
*/
|
|
1016
|
-
|
|
1037
|
+
withResourceId(resourceId: string): ResourceIdUrn;
|
|
1017
1038
|
/**
|
|
1018
|
-
*
|
|
1039
|
+
* 类型守卫:判断是否为概念域级 URN
|
|
1019
1040
|
*/
|
|
1020
|
-
|
|
1041
|
+
isDomainUrn(): this is DomainUrn;
|
|
1021
1042
|
/**
|
|
1022
1043
|
* 类型守卫:判断是否为资源类型级 URN
|
|
1023
1044
|
*/
|
|
1024
|
-
|
|
1045
|
+
isResourceTypeUrn(): this is ResourceTypeUrn;
|
|
1025
1046
|
/**
|
|
1026
1047
|
* 类型守卫:判断是否为实例级 URN
|
|
1027
1048
|
*/
|
|
1028
|
-
|
|
1049
|
+
isResourceIdUrn(): this is ResourceIdUrn;
|
|
1029
1050
|
/**
|
|
1030
1051
|
* 根据参数创建对应层级的 URN
|
|
1031
1052
|
*
|
|
1032
1053
|
* 重载签名使返回类型随参数数量自动窄化:
|
|
1033
|
-
* - 仅
|
|
1034
|
-
* -
|
|
1035
|
-
* -
|
|
1054
|
+
* - 仅 domain → DomainUrn
|
|
1055
|
+
* - domain + resourceType → ResourceTypeUrn
|
|
1056
|
+
* - domain + resourceType + resourceId → ResourceIdUrn
|
|
1036
1057
|
*/
|
|
1037
|
-
static of(
|
|
1038
|
-
static of(
|
|
1039
|
-
static of(
|
|
1058
|
+
static of(domain: string): DomainUrn;
|
|
1059
|
+
static of(domain: string, resourceType: string): ResourceTypeUrn;
|
|
1060
|
+
static of(domain: string, resourceType: string, resourceId: string): ResourceIdUrn;
|
|
1040
1061
|
/**
|
|
1041
|
-
* 从 URN
|
|
1062
|
+
* 从 URN 字符串解析,支持通配符 `*` 和 `**`
|
|
1063
|
+
*
|
|
1064
|
+
* - `*` 匹配恰好一个段
|
|
1065
|
+
* - `**` 匹配零个或多个尾部段(仅允许出现在末尾)
|
|
1042
1066
|
*
|
|
1043
1067
|
* @throws Error URN 格式不合法时抛出
|
|
1044
1068
|
*/
|
|
1045
1069
|
static parse(urn: string): Urn;
|
|
1046
1070
|
/**
|
|
1047
|
-
* 判断是否匹配指定的
|
|
1071
|
+
* 判断是否匹配指定的 domain、resourceType 和 resourceId
|
|
1048
1072
|
*
|
|
1049
1073
|
* 仅比较传入的参数,未传入的参数不参与比较。
|
|
1050
1074
|
*/
|
|
1051
|
-
is(
|
|
1075
|
+
is(domain: string, resourceType?: string, resourceId?: string): boolean;
|
|
1076
|
+
/**
|
|
1077
|
+
* 判断当前 URN 是否包含另一个 URN
|
|
1078
|
+
*
|
|
1079
|
+
* 当前 URN 含通配符(`*` 或 `**`)时,作为集合模式判断:
|
|
1080
|
+
* - `*` 匹配恰好一个段
|
|
1081
|
+
* - `**` 匹配零个或多个尾部段(仅末尾有效)
|
|
1082
|
+
*
|
|
1083
|
+
* 当前 URN 为具体 URN(无通配符)时,仅包含自身(严格相等)。
|
|
1084
|
+
*/
|
|
1085
|
+
contains(other: Urn): boolean;
|
|
1052
1086
|
}
|
|
1053
1087
|
/**
|
|
1054
|
-
*
|
|
1088
|
+
* 概念域级 URN — 仅含 domain,无 resourceType 和 resourceId
|
|
1055
1089
|
*
|
|
1056
|
-
* 可通过 `
|
|
1057
|
-
* 禁止直接调用 `
|
|
1090
|
+
* 可通过 `withResourceType()` 衍生出 `ResourceTypeUrn`。
|
|
1091
|
+
* 禁止直接调用 `withResourceId()`(跳层派生)。
|
|
1058
1092
|
*/
|
|
1059
|
-
interface
|
|
1060
|
-
readonly
|
|
1061
|
-
readonly
|
|
1062
|
-
/** @deprecated 禁止跳层派生,请先调用
|
|
1063
|
-
|
|
1093
|
+
interface DomainUrn extends Urn {
|
|
1094
|
+
readonly resourceType: undefined;
|
|
1095
|
+
readonly resourceId: undefined;
|
|
1096
|
+
/** @deprecated 禁止跳层派生,请先调用 withResourceType() */
|
|
1097
|
+
withResourceId: never;
|
|
1064
1098
|
}
|
|
1065
1099
|
/**
|
|
1066
|
-
* 资源类型级 URN — 含
|
|
1100
|
+
* 资源类型级 URN — 含 domain 和 resourceType,无 resourceId
|
|
1067
1101
|
*
|
|
1068
|
-
* 可通过 `
|
|
1069
|
-
* 禁止调用 `
|
|
1102
|
+
* 可通过 `withResourceId()` 衍生出 `ResourceIdUrn`。
|
|
1103
|
+
* 禁止调用 `withResourceType()`(横向衍生另一个资源类型)。
|
|
1070
1104
|
*/
|
|
1071
|
-
interface
|
|
1072
|
-
readonly
|
|
1073
|
-
readonly
|
|
1074
|
-
/** @deprecated 禁止横向衍生,
|
|
1075
|
-
|
|
1105
|
+
interface ResourceTypeUrn extends Urn {
|
|
1106
|
+
readonly resourceType: string;
|
|
1107
|
+
readonly resourceId: undefined;
|
|
1108
|
+
/** @deprecated 禁止横向衍生,ResourceTypeUrn 不能再衍生另一个资源类型 */
|
|
1109
|
+
withResourceType: never;
|
|
1076
1110
|
}
|
|
1077
1111
|
/**
|
|
1078
|
-
* 实例级 URN — 含完整三段:
|
|
1112
|
+
* 实例级 URN — 含完整三段:domain、resourceType 和 resourceId
|
|
1079
1113
|
*
|
|
1080
1114
|
* 终态 URN,不可继续衍生。
|
|
1081
1115
|
*/
|
|
1082
|
-
interface
|
|
1083
|
-
readonly
|
|
1084
|
-
readonly
|
|
1116
|
+
interface ResourceIdUrn extends Urn {
|
|
1117
|
+
readonly resourceType: string;
|
|
1118
|
+
readonly resourceId: string;
|
|
1085
1119
|
/** @deprecated 终态 URN,不可继续衍生 */
|
|
1086
|
-
|
|
1120
|
+
withResourceType: never;
|
|
1087
1121
|
/** @deprecated 终态 URN,不可继续衍生 */
|
|
1088
|
-
|
|
1122
|
+
withResourceId: never;
|
|
1089
1123
|
}
|
|
1090
1124
|
//#endregion
|
|
1091
1125
|
//#region src/modules/core/converters/eager-type/eager-type.d.ts
|
|
@@ -18660,5 +18694,5 @@ declare class ObjectStorageService implements OnModuleInit {
|
|
|
18660
18694
|
*/
|
|
18661
18695
|
declare function stableStringify(value: unknown): string;
|
|
18662
18696
|
//#endregion
|
|
18663
|
-
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, EagerType, type EncryptCommand, EncryptedPayload, 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,
|
|
18697
|
+
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, EagerType, type EncryptCommand, EncryptedPayload, 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 };
|
|
18664
18698
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -227,9 +227,9 @@ declare function IsScalarDictionary(ctor: ScalarClass, validationOptions?: Valid
|
|
|
227
227
|
//#endregion
|
|
228
228
|
//#region src/modules/core/decorators/class-validator/is-urn.d.ts
|
|
229
229
|
declare const IS_URN = "isUrn";
|
|
230
|
-
declare const
|
|
231
|
-
declare const
|
|
232
|
-
declare const
|
|
230
|
+
declare const IS_DOMAIN_URN = "isDomainUrn";
|
|
231
|
+
declare const IS_RESOURCE_TYPE_URN = "isResourceTypeUrn";
|
|
232
|
+
declare const IS_RESOURCE_ID_URN = "isResourceIdUrn";
|
|
233
233
|
/**
|
|
234
234
|
* 验证字符串是否为合法的 URN(任意层级)。
|
|
235
235
|
*
|
|
@@ -243,41 +243,56 @@ declare const IS_IDENTIFIER_URN = "isIdentifierUrn";
|
|
|
243
243
|
*/
|
|
244
244
|
declare function IsUrn(validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
|
|
245
245
|
/**
|
|
246
|
-
*
|
|
246
|
+
* 验证字符串是否为概念域级 URN(仅含 domain,无 resourceType 和 resourceId)。
|
|
247
247
|
*
|
|
248
248
|
* @example
|
|
249
249
|
* ```typescript
|
|
250
250
|
* class TokenPayloadDTO {
|
|
251
|
-
* @
|
|
251
|
+
* @IsDomainUrn()
|
|
252
252
|
* aud: string
|
|
253
253
|
* }
|
|
254
254
|
* ```
|
|
255
255
|
*/
|
|
256
|
-
declare function
|
|
256
|
+
declare function IsDomainUrn(validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
|
|
257
257
|
/**
|
|
258
|
-
* 验证字符串是否为资源类型级 URN(含
|
|
258
|
+
* 验证字符串是否为资源类型级 URN(含 domain 和 resourceType,无 resourceId)。
|
|
259
259
|
*
|
|
260
260
|
* @example
|
|
261
261
|
* ```typescript
|
|
262
262
|
* class ResourceDTO {
|
|
263
|
-
* @
|
|
263
|
+
* @IsResourceTypeUrn()
|
|
264
264
|
* resourceType: string
|
|
265
265
|
* }
|
|
266
266
|
* ```
|
|
267
267
|
*/
|
|
268
|
-
declare function
|
|
268
|
+
declare function IsResourceTypeUrn(validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
|
|
269
269
|
/**
|
|
270
|
-
* 验证字符串是否为实例级 URN(含完整三段:
|
|
270
|
+
* 验证字符串是否为实例级 URN(含完整三段:domain、resourceType 和 resourceId)。
|
|
271
271
|
*
|
|
272
272
|
* @example
|
|
273
273
|
* ```typescript
|
|
274
274
|
* class TokenPayloadDTO {
|
|
275
|
-
* @
|
|
275
|
+
* @IsResourceIdUrn()
|
|
276
276
|
* sub: string
|
|
277
277
|
* }
|
|
278
278
|
* ```
|
|
279
279
|
*/
|
|
280
|
-
declare function
|
|
280
|
+
declare function IsResourceIdUrn(validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
|
|
281
|
+
/**
|
|
282
|
+
* 验证字符串是否匹配指定的 URN 模式(支持通配符 `*` 和 `**`)。
|
|
283
|
+
*
|
|
284
|
+
* - `*` 匹配恰好一个段
|
|
285
|
+
* - `**` 匹配零个或多个尾部段
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```typescript
|
|
289
|
+
* class CreateClientDTO {
|
|
290
|
+
* @MatchesUrn('urn:buka:galaxy:client:*')
|
|
291
|
+
* clientUrn: string
|
|
292
|
+
* }
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
declare function MatchesUrn(pattern: string, validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
|
|
281
296
|
//#endregion
|
|
282
297
|
//#region src/modules/core/decorators/class-validator/match-json-schema.d.ts
|
|
283
298
|
declare const MATCH_JSON_SCHEMA = "matchJsonSchema";
|
|
@@ -969,123 +984,142 @@ declare class Slice<T extends object> {
|
|
|
969
984
|
/**
|
|
970
985
|
* 统一资源名称(URN)
|
|
971
986
|
*
|
|
972
|
-
* 格式: urn:buka:<
|
|
987
|
+
* 格式: urn:buka:<domain>:<resource-type>[:<resource-id>]
|
|
973
988
|
*
|
|
974
989
|
* 支持三种粒度:
|
|
975
|
-
* -
|
|
990
|
+
* - 概念域级: urn:buka:galaxy
|
|
976
991
|
* - 资源类型级: urn:buka:galaxy:principal
|
|
977
992
|
* - 实例级: urn:buka:galaxy:principal:550e8400-e29b-41d4-a716-446655440000
|
|
978
993
|
*
|
|
979
|
-
*
|
|
994
|
+
* domain 划分原则:按资源类型的定义权归属划分,非按部署单元。
|
|
995
|
+
* resource-type 第一级推荐用于 env(环境),这是一个语义约定,不强制。
|
|
980
996
|
*
|
|
981
997
|
* 推荐通过静态工厂方法或派生方法构建层级 URN:
|
|
982
998
|
* ```ts
|
|
983
|
-
* Urn.of('galaxy') // →
|
|
984
|
-
* Urn.of('galaxy', 'principal') // →
|
|
985
|
-
* Urn.of('galaxy', 'principal', '550e8400-...') // →
|
|
999
|
+
* Urn.of('galaxy') // → DomainUrn
|
|
1000
|
+
* Urn.of('galaxy', 'principal') // → ResourceTypeUrn
|
|
1001
|
+
* Urn.of('galaxy', 'principal', '550e8400-...') // → ResourceIdUrn
|
|
986
1002
|
*
|
|
987
1003
|
* // 或通过派生方法逐层构建
|
|
988
1004
|
* Urn.of('galaxy')
|
|
989
|
-
* .
|
|
990
|
-
* .
|
|
1005
|
+
* .withResourceType('principal') // → ResourceTypeUrn
|
|
1006
|
+
* .withResourceId('550e8400-...') // → ResourceIdUrn
|
|
991
1007
|
* ```
|
|
992
1008
|
*/
|
|
993
1009
|
declare class Urn {
|
|
994
|
-
/**
|
|
995
|
-
readonly
|
|
996
|
-
/**
|
|
997
|
-
readonly
|
|
998
|
-
/**
|
|
999
|
-
readonly
|
|
1010
|
+
/** 概念域 — 资源类型定义权归属,通常为系统名 */
|
|
1011
|
+
readonly domain: string;
|
|
1012
|
+
/** 资源类型,可多级。第一级推荐用于 env */
|
|
1013
|
+
readonly resourceType?: string | undefined;
|
|
1014
|
+
/** 资源实例唯一标识 */
|
|
1015
|
+
readonly resourceId?: string | undefined;
|
|
1000
1016
|
private constructor();
|
|
1001
1017
|
/**
|
|
1002
1018
|
* 序列化为 URN 字符串
|
|
1003
1019
|
*/
|
|
1004
1020
|
toString(): string;
|
|
1021
|
+
/**
|
|
1022
|
+
* 返回 resourceType 按 `:` 拆分后的层级数组
|
|
1023
|
+
*/
|
|
1024
|
+
get resourceTypeSegments(): string[];
|
|
1025
|
+
private toSegments;
|
|
1005
1026
|
/**
|
|
1006
1027
|
* 衍生出资源类型级 URN
|
|
1007
1028
|
*
|
|
1008
|
-
* @throws Error 当前 URN 已有
|
|
1029
|
+
* @throws Error 当前 URN 已有 resourceType 时抛出
|
|
1009
1030
|
*/
|
|
1010
|
-
|
|
1031
|
+
withResourceType(resourceType: string): ResourceTypeUrn;
|
|
1011
1032
|
/**
|
|
1012
1033
|
* 衍生出实例级 URN
|
|
1013
1034
|
*
|
|
1014
|
-
* @throws Error 当前 URN 无
|
|
1035
|
+
* @throws Error 当前 URN 无 resourceType 或已有 resourceId 时抛出
|
|
1015
1036
|
*/
|
|
1016
|
-
|
|
1037
|
+
withResourceId(resourceId: string): ResourceIdUrn;
|
|
1017
1038
|
/**
|
|
1018
|
-
*
|
|
1039
|
+
* 类型守卫:判断是否为概念域级 URN
|
|
1019
1040
|
*/
|
|
1020
|
-
|
|
1041
|
+
isDomainUrn(): this is DomainUrn;
|
|
1021
1042
|
/**
|
|
1022
1043
|
* 类型守卫:判断是否为资源类型级 URN
|
|
1023
1044
|
*/
|
|
1024
|
-
|
|
1045
|
+
isResourceTypeUrn(): this is ResourceTypeUrn;
|
|
1025
1046
|
/**
|
|
1026
1047
|
* 类型守卫:判断是否为实例级 URN
|
|
1027
1048
|
*/
|
|
1028
|
-
|
|
1049
|
+
isResourceIdUrn(): this is ResourceIdUrn;
|
|
1029
1050
|
/**
|
|
1030
1051
|
* 根据参数创建对应层级的 URN
|
|
1031
1052
|
*
|
|
1032
1053
|
* 重载签名使返回类型随参数数量自动窄化:
|
|
1033
|
-
* - 仅
|
|
1034
|
-
* -
|
|
1035
|
-
* -
|
|
1054
|
+
* - 仅 domain → DomainUrn
|
|
1055
|
+
* - domain + resourceType → ResourceTypeUrn
|
|
1056
|
+
* - domain + resourceType + resourceId → ResourceIdUrn
|
|
1036
1057
|
*/
|
|
1037
|
-
static of(
|
|
1038
|
-
static of(
|
|
1039
|
-
static of(
|
|
1058
|
+
static of(domain: string): DomainUrn;
|
|
1059
|
+
static of(domain: string, resourceType: string): ResourceTypeUrn;
|
|
1060
|
+
static of(domain: string, resourceType: string, resourceId: string): ResourceIdUrn;
|
|
1040
1061
|
/**
|
|
1041
|
-
* 从 URN
|
|
1062
|
+
* 从 URN 字符串解析,支持通配符 `*` 和 `**`
|
|
1063
|
+
*
|
|
1064
|
+
* - `*` 匹配恰好一个段
|
|
1065
|
+
* - `**` 匹配零个或多个尾部段(仅允许出现在末尾)
|
|
1042
1066
|
*
|
|
1043
1067
|
* @throws Error URN 格式不合法时抛出
|
|
1044
1068
|
*/
|
|
1045
1069
|
static parse(urn: string): Urn;
|
|
1046
1070
|
/**
|
|
1047
|
-
* 判断是否匹配指定的
|
|
1071
|
+
* 判断是否匹配指定的 domain、resourceType 和 resourceId
|
|
1048
1072
|
*
|
|
1049
1073
|
* 仅比较传入的参数,未传入的参数不参与比较。
|
|
1050
1074
|
*/
|
|
1051
|
-
is(
|
|
1075
|
+
is(domain: string, resourceType?: string, resourceId?: string): boolean;
|
|
1076
|
+
/**
|
|
1077
|
+
* 判断当前 URN 是否包含另一个 URN
|
|
1078
|
+
*
|
|
1079
|
+
* 当前 URN 含通配符(`*` 或 `**`)时,作为集合模式判断:
|
|
1080
|
+
* - `*` 匹配恰好一个段
|
|
1081
|
+
* - `**` 匹配零个或多个尾部段(仅末尾有效)
|
|
1082
|
+
*
|
|
1083
|
+
* 当前 URN 为具体 URN(无通配符)时,仅包含自身(严格相等)。
|
|
1084
|
+
*/
|
|
1085
|
+
contains(other: Urn): boolean;
|
|
1052
1086
|
}
|
|
1053
1087
|
/**
|
|
1054
|
-
*
|
|
1088
|
+
* 概念域级 URN — 仅含 domain,无 resourceType 和 resourceId
|
|
1055
1089
|
*
|
|
1056
|
-
* 可通过 `
|
|
1057
|
-
* 禁止直接调用 `
|
|
1090
|
+
* 可通过 `withResourceType()` 衍生出 `ResourceTypeUrn`。
|
|
1091
|
+
* 禁止直接调用 `withResourceId()`(跳层派生)。
|
|
1058
1092
|
*/
|
|
1059
|
-
interface
|
|
1060
|
-
readonly
|
|
1061
|
-
readonly
|
|
1062
|
-
/** @deprecated 禁止跳层派生,请先调用
|
|
1063
|
-
|
|
1093
|
+
interface DomainUrn extends Urn {
|
|
1094
|
+
readonly resourceType: undefined;
|
|
1095
|
+
readonly resourceId: undefined;
|
|
1096
|
+
/** @deprecated 禁止跳层派生,请先调用 withResourceType() */
|
|
1097
|
+
withResourceId: never;
|
|
1064
1098
|
}
|
|
1065
1099
|
/**
|
|
1066
|
-
* 资源类型级 URN — 含
|
|
1100
|
+
* 资源类型级 URN — 含 domain 和 resourceType,无 resourceId
|
|
1067
1101
|
*
|
|
1068
|
-
* 可通过 `
|
|
1069
|
-
* 禁止调用 `
|
|
1102
|
+
* 可通过 `withResourceId()` 衍生出 `ResourceIdUrn`。
|
|
1103
|
+
* 禁止调用 `withResourceType()`(横向衍生另一个资源类型)。
|
|
1070
1104
|
*/
|
|
1071
|
-
interface
|
|
1072
|
-
readonly
|
|
1073
|
-
readonly
|
|
1074
|
-
/** @deprecated 禁止横向衍生,
|
|
1075
|
-
|
|
1105
|
+
interface ResourceTypeUrn extends Urn {
|
|
1106
|
+
readonly resourceType: string;
|
|
1107
|
+
readonly resourceId: undefined;
|
|
1108
|
+
/** @deprecated 禁止横向衍生,ResourceTypeUrn 不能再衍生另一个资源类型 */
|
|
1109
|
+
withResourceType: never;
|
|
1076
1110
|
}
|
|
1077
1111
|
/**
|
|
1078
|
-
* 实例级 URN — 含完整三段:
|
|
1112
|
+
* 实例级 URN — 含完整三段:domain、resourceType 和 resourceId
|
|
1079
1113
|
*
|
|
1080
1114
|
* 终态 URN,不可继续衍生。
|
|
1081
1115
|
*/
|
|
1082
|
-
interface
|
|
1083
|
-
readonly
|
|
1084
|
-
readonly
|
|
1116
|
+
interface ResourceIdUrn extends Urn {
|
|
1117
|
+
readonly resourceType: string;
|
|
1118
|
+
readonly resourceId: string;
|
|
1085
1119
|
/** @deprecated 终态 URN,不可继续衍生 */
|
|
1086
|
-
|
|
1120
|
+
withResourceType: never;
|
|
1087
1121
|
/** @deprecated 终态 URN,不可继续衍生 */
|
|
1088
|
-
|
|
1122
|
+
withResourceId: never;
|
|
1089
1123
|
}
|
|
1090
1124
|
//#endregion
|
|
1091
1125
|
//#region src/modules/core/converters/eager-type/eager-type.d.ts
|
|
@@ -18660,5 +18694,5 @@ declare class ObjectStorageService implements OnModuleInit {
|
|
|
18660
18694
|
*/
|
|
18661
18695
|
declare function stableStringify(value: unknown): string;
|
|
18662
18696
|
//#endregion
|
|
18663
|
-
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, EagerType, type EncryptCommand, EncryptedPayload, 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,
|
|
18697
|
+
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, EagerType, type EncryptCommand, EncryptedPayload, 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 };
|
|
18664
18698
|
//# sourceMappingURL=index.d.ts.map
|