Skip to content

身份与资源归属 ​

仅适用于 5.x

本页只适用于 5.x 线(npm 5.1.x,分支 5.x)。从 6.0 起,@ahoo-wang/fetcher-wow 位于 Wow 仓库(typescript/),文档见 wow.ahoo.me;后继包 @ahoo-wang/wow-client 自 Wow 9.2.0 起已发布到 npm(9.2.1 及以上兼容 fetcher 6)。

构造聚合身份或资源归属路径时使用这些类型。它们描述传输字段,不从认证令牌推断身份,也不执行权限检查。下表字段除精确声明标记为可选外均必填;接口不提供运行时默认值。

契约含义与约束
Identifier.id / Version.version通用字符串身份 / 数字版本;不会生成 ID 或验证版本范围。
AggregateId平铺的 {aggregateId, tenantId, contextName, aggregateName}。关联结果时应匹配四项,仅 ID 字符串不是完整身份。
AggregateIdCapable.aggregateId嵌套上述完整对象,不要与 AggregateId 中同名的字符串字段混淆。
NamedBoundedContext / AliasBoundedContextcontextName 是模型名;contextAlias 是路由别名。Named/AliasAggregate 还要求 aggregateName。
OwnerId、TenantId、SpaceIdCapable显式字符串归属字段。DEFAULT_OWNER_ID 为 '',不是 FetcherViewer 的默认 (0)。
UrlPathParams可选 tenant/owner/id 及自定义字符串路径槽位;必须提供所选模板所需的槽位。
ResourceAttributionPathSpec无归属、租户、所有者及租户+所有者路径前缀;模板不构成授权。
AbacTags / AbacTaggable.tags每个标签键对应字符串数组;空标签 {},通配值 ['*'];策略含义由服务端定义。
ApplyAbacTags / AbacTagsApplied含 tags 的命令/事件载荷;不包含本地策略引擎或自动修改行为。
Named / DescriptionCapable必填 name / description 字符串,不验证格式或非空。

发送 HTTP 命令时将身份/路径字段与命令选项组合。保存视图的身份应遵循远端确认规则,不能用 UI 租户过滤代替服务端授权。

精确契约 ​

AbacTagKey ​

ts
export type AbacTagKey = string;

packages/wow/src/types/abac.ts:13

AbacTagValue ​

ts
export type AbacTagValue = string[];

packages/wow/src/types/abac.ts:14

AbacTags ​

ts
export type AbacTags = Record<AbacTagKey, AbacTagValue>;

packages/wow/src/types/abac.ts:15

EMPTY_ABAC_TAGS ​

ts
declare const EMPTY_ABAC_TAGS: AbacTags;

packages/wow/src/types/abac.ts:16

WILDCARD_ABAC_TAG_VALUES ​

ts
declare const WILDCARD_ABAC_TAG_VALUES: string[];

packages/wow/src/types/abac.ts:17

AbacTaggable ​

ts
export interface AbacTaggable {
  tags: AbacTags;
}

packages/wow/src/types/abac.ts:19

ApplyAbacTags ​

ts
export interface ApplyAbacTags extends AbacTaggable {}

packages/wow/src/types/abac.ts:24

AbacTagsApplied ​

ts
export interface AbacTagsApplied extends AbacTaggable {}

packages/wow/src/types/abac.ts:27

Identifier ​

ts
export interface Identifier {
  id: string;
}

packages/wow/src/types/common.ts:17

Version ​

ts
export interface Version {
  version: number;
}

packages/wow/src/types/common.ts:31

UrlPathParams ​

ts
export interface UrlPathParams {
  tenantId?: string;
  ownerId?: string;
  id?: string;
  [key: string]: string | undefined;
}

packages/wow/src/types/endpoints.ts:19

ResourceAttributionPathSpec ​

ts
export enum ResourceAttributionPathSpec {
  NONE = '',
  TENANT = '/tenant/{tenantId}',
  OWNER = '/owner/{ownerId}',
  TENANT_OWNER = '/tenant/{tenantId}/owner/{ownerId}',
}

packages/wow/src/types/endpoints.ts:57

AggregateNameCapable ​

ts
export interface AggregateNameCapable {
  aggregateName: string;
}

packages/wow/src/types/modeling.ts:79

NamedAggregate ​

ts
export interface NamedAggregate
  extends NamedBoundedContext, AggregateNameCapable {}

packages/wow/src/types/modeling.ts:89

AliasAggregate ​

ts
export interface AliasAggregate
  extends AliasBoundedContext, AggregateNameCapable {}

packages/wow/src/types/modeling.ts:92

AggregateId ​

ts
export interface AggregateId extends TenantId, NamedAggregate {
  aggregateId: string;
}

packages/wow/src/types/modeling.ts:98

AggregateIdCapable ​

ts
export interface AggregateIdCapable {
  aggregateId: AggregateId;
}

packages/wow/src/types/modeling.ts:109

DEFAULT_OWNER_ID ​

ts
declare const DEFAULT_OWNER_ID: '';

packages/wow/src/types/modeling.ts:129

OwnerId ​

ts
export interface OwnerId {
  ownerId: string;
}

packages/wow/src/types/modeling.ts:134

SpaceIdCapable ​

ts
export interface SpaceIdCapable {
  spaceId: string;
}

packages/wow/src/types/modeling.ts:141

TenantId ​

ts
export interface TenantId {
  tenantId: string;
}

packages/wow/src/types/modeling.ts:158

NamedBoundedContext ​

ts
export interface NamedBoundedContext {
  contextName: string;
}

packages/wow/src/types/naming.ts:17

AliasBoundedContext ​

ts
export interface AliasBoundedContext {
  contextAlias: string;
}

packages/wow/src/types/naming.ts:21

Named ​

ts
export interface Named {
  name: string;
}

packages/wow/src/types/naming.ts:28

DescriptionCapable ​

ts
export interface DescriptionCapable {
  description: string;
}

packages/wow/src/types/naming.ts:39

完整符号索引

基于 Apache License 2.0 发布。