Skip to content

@codesoul-co/hypha-adapters-local / legacy-tool-artifact-migration-rollback

模块用法

用于使用该功能边界的公共契约与操作。Legacy tool artifact migration rollback 模块公开 2 类、5 接口、1 类型。

从包入口导入

ts
import {
  LegacyToolArtifactMigrationRollbackError,
  LegacyToolArtifactMigrationRollbackExecutor,
} from '@codesoul-co/hypha-adapters-local';

import type {
  LegacyToolArtifactMigrationRollbackExecutorOptions,
  LegacyToolArtifactMigrationRollbackItem,
  LegacyToolArtifactMigrationRollbackRequest,
  LegacyToolArtifactMigrationRollbackResult,
  LegacyToolArtifactMigrationRollbackSummary,
  LegacyToolArtifactMigrationRollbackErrorCode,
} from '@codesoul-co/hypha-adapters-local';

使用要点

  • 6 个类型/接口用于应用代码、Adapter 或测试中的静态契约;请使用 import type,运行时不应依赖它们。
  • 2 个类提供可实例化的运行时实现;构造参数与公开方法在各自条目中完整列出。

公共导出

Symbol种类签名说明
LegacyToolArtifactMigrationRollbackErrornew LegacyToolArtifactMigrationRollbackError(code: LegacyToolArtifactMigrationRollbackErrorCode, message: string, details?: Record<string, unknown> | undefined): LegacyToolArtifactMigrationRollbackErrorLegacy Tool Artifact Migration Rollback Error 类,共公开 10 个构造函数或成员;精确签名见本条目的声明与成员表。
LegacyToolArtifactMigrationRollbackExecutornew LegacyToolArtifactMigrationRollbackExecutor(options: LegacyToolArtifactMigrationRollbackExecutorOptions): LegacyToolArtifactMigrationRollbackExecutorReverses only Artifacts proven to have been created by a specific migration report. Revision fences prevent rollback from deleting a later mutation.
LegacyToolArtifactMigrationRollbackExecutorOptions接口interface LegacyToolArtifactMigrationRollbackExecutorOptionsLegacy Tool Artifact Migration Rollback Executor Options 接口,共包含 1 个公开字段或方法。
LegacyToolArtifactMigrationRollbackItem接口interface LegacyToolArtifactMigrationRollbackItemLegacy Tool Artifact Migration Rollback Item 接口,共包含 8 个公开字段或方法。
LegacyToolArtifactMigrationRollbackRequest接口interface LegacyToolArtifactMigrationRollbackRequestLegacy Tool Artifact Migration Rollback Request 接口,共包含 3 个公开字段或方法。
LegacyToolArtifactMigrationRollbackResult接口interface LegacyToolArtifactMigrationRollbackResultLegacy Tool Artifact Migration Rollback Result 接口,共包含 6 个公开字段或方法。
LegacyToolArtifactMigrationRollbackSummary接口interface LegacyToolArtifactMigrationRollbackSummaryLegacy Tool Artifact Migration Rollback Summary 接口,共包含 5 个公开字段或方法。
LegacyToolArtifactMigrationRollbackErrorCode类型type LegacyToolArtifactMigrationRollbackErrorCode = 'LEGACY_MIGRATION_ROLLBACK_INVALID_REPORT' | 'LEGACY_MIGRATION_ROLLBACK_TARGET_MISMATCH'Legacy Tool Artifact Migration Rollback Error Code 公共类型别名;完整类型表达式见声明。

LegacyToolArtifactMigrationRollbackError

Legacy Tool Artifact Migration Rollback Error 类,共公开 10 个构造函数或成员;精确签名见本条目的声明与成员表。

声明

text
export declare class LegacyToolArtifactMigrationRollbackError extends Error {
    readonly code: LegacyToolArtifactMigrationRollbackErrorCode;
    readonly details?: Record<string, unknown> | undefined;
    constructor(code: LegacyToolArtifactMigrationRollbackErrorCode, message: string, details?: Record<string, unknown> | undefined);
}

公开成员

成员种类签名说明
cause属性cause?: unknown公开属性;类型、只读和可选状态以签名列为准。
code属性readonly code: LegacyToolArtifactMigrationRollbackErrorCode公开属性;类型、只读和可选状态以签名列为准。
constructor构造函数(code: LegacyToolArtifactMigrationRollbackErrorCode, message: string, details?: Record<string, unknown> | undefined): LegacyToolArtifactMigrationRollbackError创建该类的实例。
details属性readonly details?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
message属性message: string公开属性;类型、只读和可选状态以签名列为准。
name属性name: string公开属性;类型、只读和可选状态以签名列为准。
stack属性stack?: string公开属性;类型、只读和可选状态以签名列为准。
static captureStackTrace方法static captureStackTrace(targetObject: object, constructorOpt?: Function): voidCreates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called. js const myObject = {}; Error.captureStackTrace(myObject); myObject.stack; // Similar to `new Error().stack` The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}. The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace. The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance: js function a() { b(); } function b() { c(); } function c() { // Create an error without stack trace to avoid calculating the stack trace twice. const { stackTraceLimit } = Error; Error.stackTraceLimit = 0; const error = new Error(); Error.stackTraceLimit = stackTraceLimit; // Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error; } a();
static prepareStackTrace方法static prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any公开方法;参数与返回类型以签名列为准。
static stackTraceLimit属性static stackTraceLimit: numberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

LegacyToolArtifactMigrationRollbackExecutor

Reverses only Artifacts proven to have been created by a specific migration report. Revision fences prevent rollback from deleting a later mutation.

声明

text
export declare class LegacyToolArtifactMigrationRollbackExecutor {
    constructor(options: LegacyToolArtifactMigrationRollbackExecutorOptions);
    rollback(request: LegacyToolArtifactMigrationRollbackRequest): Promise<LegacyToolArtifactMigrationRollbackResult>;
}

公开成员

成员种类签名说明
constructor构造函数(options: LegacyToolArtifactMigrationRollbackExecutorOptions): LegacyToolArtifactMigrationRollbackExecutor创建该类的实例。
rollback方法rollback(request: LegacyToolArtifactMigrationRollbackRequest): Promise<LegacyToolArtifactMigrationRollbackResult>公开方法;参数与返回类型以签名列为准。

LegacyToolArtifactMigrationRollbackExecutorOptions

Legacy Tool Artifact Migration Rollback Executor Options 接口,共包含 1 个公开字段或方法。

声明

text
export interface LegacyToolArtifactMigrationRollbackExecutorOptions {
    manager: Pick<ArtifactManager, 'get' | 'delete'>;
}

契约成员

成员种类签名说明
manager属性manager: Pick<ArtifactManager, "delete" | "get">公开属性;类型、只读和可选状态以签名列为准。

LegacyToolArtifactMigrationRollbackItem

Legacy Tool Artifact Migration Rollback Item 接口,共包含 8 个公开字段或方法。

声明

text
export interface LegacyToolArtifactMigrationRollbackItem {
    relativePath: string;
    legacyArtifactId: string;
    artifactId: string;
    versionId: string;
    revision: number;
    target: LegacyToolArtifactMigrationTargetSummary;
    status: 'dry_run' | 'rolled_back' | 'already_absent' | 'failed';
    failure?: LegacyToolArtifactMigrationFailure;
}

契约成员

成员种类签名说明
artifactId属性artifactId: string公开属性;类型、只读和可选状态以签名列为准。
failure属性failure?: LegacyToolArtifactMigrationFailure公开属性;类型、只读和可选状态以签名列为准。
legacyArtifactId属性legacyArtifactId: string公开属性;类型、只读和可选状态以签名列为准。
relativePath属性relativePath: string公开属性;类型、只读和可选状态以签名列为准。
revision属性revision: number公开属性;类型、只读和可选状态以签名列为准。
status属性status: "failed" | "rolled_back" | "dry_run" | "already_absent"公开属性;类型、只读和可选状态以签名列为准。
target属性target: LegacyToolArtifactMigrationTargetSummary公开属性;类型、只读和可选状态以签名列为准。
versionId属性versionId: string公开属性;类型、只读和可选状态以签名列为准。

LegacyToolArtifactMigrationRollbackRequest

Legacy Tool Artifact Migration Rollback Request 接口,共包含 3 个公开字段或方法。

声明

text
export interface LegacyToolArtifactMigrationRollbackRequest {
    plan: LegacyToolArtifactMigrationPlan;
    execution: LegacyToolArtifactMigrationExecutionResult;
    dryRun?: boolean;
}

契约成员

成员种类签名说明
dryRun属性dryRun?: boolean公开属性;类型、只读和可选状态以签名列为准。
execution属性execution: LegacyToolArtifactMigrationExecutionResult公开属性;类型、只读和可选状态以签名列为准。
plan属性plan: LegacyToolArtifactMigrationPlan公开属性;类型、只读和可选状态以签名列为准。

LegacyToolArtifactMigrationRollbackResult

Legacy Tool Artifact Migration Rollback Result 接口,共包含 6 个公开字段或方法。

声明

text
export interface LegacyToolArtifactMigrationRollbackResult {
    planHash: string;
    executionReportId: string;
    reportId: string;
    mode: 'dry_run' | 'rollback';
    items: LegacyToolArtifactMigrationRollbackItem[];
    summary: LegacyToolArtifactMigrationRollbackSummary;
}

契约成员

成员种类签名说明
executionReportId属性executionReportId: string公开属性;类型、只读和可选状态以签名列为准。
items属性items: LegacyToolArtifactMigrationRollbackItem[]公开属性;类型、只读和可选状态以签名列为准。
mode属性mode: "rollback" | "dry_run"公开属性;类型、只读和可选状态以签名列为准。
planHash属性planHash: string公开属性;类型、只读和可选状态以签名列为准。
reportId属性reportId: string公开属性;类型、只读和可选状态以签名列为准。
summary属性summary: LegacyToolArtifactMigrationRollbackSummary公开属性;类型、只读和可选状态以签名列为准。

LegacyToolArtifactMigrationRollbackSummary

Legacy Tool Artifact Migration Rollback Summary 接口,共包含 5 个公开字段或方法。

声明

text
export interface LegacyToolArtifactMigrationRollbackSummary {
    candidates: number;
    dryRun: number;
    rolledBack: number;
    alreadyAbsent: number;
    failed: number;
}

契约成员

成员种类签名说明
alreadyAbsent属性alreadyAbsent: number公开属性;类型、只读和可选状态以签名列为准。
candidates属性candidates: number公开属性;类型、只读和可选状态以签名列为准。
dryRun属性dryRun: number公开属性;类型、只读和可选状态以签名列为准。
failed属性failed: number公开属性;类型、只读和可选状态以签名列为准。
rolledBack属性rolledBack: number公开属性;类型、只读和可选状态以签名列为准。

LegacyToolArtifactMigrationRollbackErrorCode

Legacy Tool Artifact Migration Rollback Error Code 公共类型别名;完整类型表达式见声明。

声明

text
export type LegacyToolArtifactMigrationRollbackErrorCode = 'LEGACY_MIGRATION_ROLLBACK_INVALID_REPORT' | 'LEGACY_MIGRATION_ROLLBACK_TARGET_MISMATCH';