Skip to content

@codesoul-co/hypha-core / contracts/artifact-retention

模块用法

用于声明并运行时校验契约。Artifact retention 模块公开 7 接口、2 类型。

从包入口导入

ts
import type {
  ArtifactRetentionDecision,
  ArtifactRetentionEvaluationRequest,
  ArtifactRetentionEvaluator,
  ArtifactRetentionProcessor,
  ArtifactRetentionProcessRequest,
  ArtifactRetentionProcessResult,
  DefaultArtifactRetentionProcessorOptions,
  ArtifactRetentionAction,
} from '@codesoul-co/hypha-core';

// 完整导出列表见下方。

使用要点

  • 9 个类型/接口用于应用代码、Adapter 或测试中的静态契约;请使用 import type,运行时不应依赖它们。

公共导出

Symbol种类签名说明
ArtifactRetentionDecision接口interface ArtifactRetentionDecisionArtifact Retention Decision 接口,共包含 3 个公开字段或方法。
ArtifactRetentionEvaluationRequest接口interface ArtifactRetentionEvaluationRequestArtifact Retention Evaluation Request 接口,共包含 3 个公开字段或方法。
ArtifactRetentionEvaluator接口interface ArtifactRetentionEvaluatorArtifact Retention Evaluator 接口,共包含 1 个公开字段或方法。
ArtifactRetentionProcessor接口interface ArtifactRetentionProcessorArtifact Retention Processor 接口,共包含 1 个公开字段或方法。
ArtifactRetentionProcessRequest接口interface ArtifactRetentionProcessRequestArtifact Retention Process Request 接口,共包含 6 个公开字段或方法。
ArtifactRetentionProcessResult接口interface ArtifactRetentionProcessResultArtifact Retention Process Result 接口,共包含 7 个公开字段或方法。
DefaultArtifactRetentionProcessorOptions接口interface DefaultArtifactRetentionProcessorOptionsDefault Artifact Retention Processor Options 接口,共包含 4 个公开字段或方法。
ArtifactRetentionAction类型type ArtifactRetentionAction = 'retain' | 'archive' | 'delete'Artifact Retention Action 公共类型别名;完整类型表达式见声明。
ArtifactRetentionDecisionReason类型type ArtifactRetentionDecisionReason = 'not_due' | 'already_terminal' | 'archive_after' | 'delete_after' | 'expired' | 'legal_hold' | 'referenced' | 'retain_final' | 'retain_failure'Artifact Retention Decision Reason 公共类型别名;完整类型表达式见声明。

ArtifactRetentionDecision

Artifact Retention Decision 接口,共包含 3 个公开字段或方法。

声明

text
export interface ArtifactRetentionDecision {
    action: ArtifactRetentionAction;
    reason: ArtifactRetentionDecisionReason;
    effectiveAt?: string;
}

契约成员

成员种类签名说明
action属性action: ArtifactRetentionAction公开属性;类型、只读和可选状态以签名列为准。
effectiveAt属性effectiveAt?: string公开属性;类型、只读和可选状态以签名列为准。
reason属性reason: ArtifactRetentionDecisionReason公开属性;类型、只读和可选状态以签名列为准。

ArtifactRetentionEvaluationRequest

Artifact Retention Evaluation Request 接口,共包含 3 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { ArtifactRetentionEvaluationRequest } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/artifact-retention

声明

text
export interface ArtifactRetentionEvaluationRequest {
    record: ArtifactRecord;
    profile: ArtifactProfileSpec;
    evaluatedAt: string;
}

契约成员

成员种类签名说明
evaluatedAt属性evaluatedAt: string公开属性;类型、只读和可选状态以签名列为准。
profile属性profile: ArtifactProfileSpec公开属性;类型、只读和可选状态以签名列为准。
record属性record: ArtifactRecord公开属性;类型、只读和可选状态以签名列为准。

ArtifactRetentionEvaluator

Artifact Retention Evaluator 接口,共包含 1 个公开字段或方法。

声明

text
export interface ArtifactRetentionEvaluator {
    evaluate(request: ArtifactRetentionEvaluationRequest): ArtifactRetentionDecision;
}

契约成员

成员种类签名说明
evaluate方法evaluate(request: ArtifactRetentionEvaluationRequest): ArtifactRetentionDecision公开方法;参数与返回类型以签名列为准。

ArtifactRetentionProcessor

Artifact Retention Processor 接口,共包含 1 个公开字段或方法。

声明

text
export interface ArtifactRetentionProcessor {
    process(request: ArtifactRetentionProcessRequest): Promise<ArtifactRetentionProcessResult>;
}

契约成员

成员种类签名说明
process方法process(request: ArtifactRetentionProcessRequest): Promise<ArtifactRetentionProcessResult>公开方法;参数与返回类型以签名列为准。

ArtifactRetentionProcessRequest

Artifact Retention Process Request 接口,共包含 6 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { ArtifactRetentionProcessRequest } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/artifact-retention

声明

text
export interface ArtifactRetentionProcessRequest {
    operationId: string;
    principal: ExecutionPrincipal;
    artifactId: string;
    evaluatedAt?: string;
    dryRun?: boolean;
    idempotencyKey?: string;
}

契约成员

成员种类签名说明
artifactId属性artifactId: string公开属性;类型、只读和可选状态以签名列为准。
dryRun属性dryRun?: boolean公开属性;类型、只读和可选状态以签名列为准。
evaluatedAt属性evaluatedAt?: string公开属性;类型、只读和可选状态以签名列为准。
idempotencyKey属性idempotencyKey?: string公开属性;类型、只读和可选状态以签名列为准。
operationId属性operationId: string公开属性;类型、只读和可选状态以签名列为准。
principal属性principal: ExecutionPrincipal公开属性;类型、只读和可选状态以签名列为准。

ArtifactRetentionProcessResult

Artifact Retention Process Result 接口,共包含 7 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { ArtifactRetentionProcessResult } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/artifact-retention

声明

text
export interface ArtifactRetentionProcessResult {
    artifactId: string;
    versionId: string;
    workspaceId: string;
    decision: ArtifactRetentionDecision;
    /** True when this invocation applied the retention mutation. */
    applied: boolean;
    /** True when the same idempotent mutation was committed by an earlier attempt. */
    replayed: boolean;
    dryRun: boolean;
}

契约成员

成员种类签名说明
applied属性applied: booleanTrue when this invocation applied the retention mutation.
artifactId属性artifactId: string公开属性;类型、只读和可选状态以签名列为准。
decision属性decision: ArtifactRetentionDecision公开属性;类型、只读和可选状态以签名列为准。
dryRun属性dryRun: boolean公开属性;类型、只读和可选状态以签名列为准。
replayed属性replayed: booleanTrue when the same idempotent mutation was committed by an earlier attempt.
versionId属性versionId: string公开属性;类型、只读和可选状态以签名列为准。
workspaceId属性workspaceId: string公开属性;类型、只读和可选状态以签名列为准。

DefaultArtifactRetentionProcessorOptions

Default Artifact Retention Processor Options 接口,共包含 4 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { DefaultArtifactRetentionProcessorOptions } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/artifact-retention

声明

text
export interface DefaultArtifactRetentionProcessorOptions {
    manager: ArtifactManager;
    repository: ArtifactRecordRepository;
    evaluator?: ArtifactRetentionEvaluator;
    now?: () => string;
}

契约成员

成员种类签名说明
evaluator属性evaluator?: ArtifactRetentionEvaluator公开属性;类型、只读和可选状态以签名列为准。
manager属性manager: ArtifactManager公开属性;类型、只读和可选状态以签名列为准。
now方法now?(): string公开方法;参数与返回类型以签名列为准。
repository属性repository: ArtifactRecordRepository公开属性;类型、只读和可选状态以签名列为准。

ArtifactRetentionAction

Artifact Retention Action 公共类型别名;完整类型表达式见声明。

声明

text
export type ArtifactRetentionAction = 'retain' | 'archive' | 'delete';

ArtifactRetentionDecisionReason

Artifact Retention Decision Reason 公共类型别名;完整类型表达式见声明。

  • 种类: 类型
  • 导入: import type { ArtifactRetentionDecisionReason } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/artifact-retention

声明

text
export type ArtifactRetentionDecisionReason = 'not_due' | 'already_terminal' | 'archive_after' | 'delete_after' | 'expired' | 'legal_hold' | 'referenced' | 'retain_final' | 'retain_failure';