Skip to content

@codesoul-co/hypha-core / modules/artifact/manager-content

模块用法

用于使用该功能边界的公共契约与操作。Manager content 模块公开 1 函数、2 接口。

从包入口导入

ts
import {
  persistArtifactContent,
} from '@codesoul-co/hypha-core';

import type {
  PersistArtifactContentRequest,
  PersistedArtifactContent,
} from '@codesoul-co/hypha-core';

使用要点

  • 2 个类型/接口用于应用代码、Adapter 或测试中的静态契约;请使用 import type,运行时不应依赖它们。
  • 1 个函数是该模块的直接操作入口;每个 overload 的必需/可选参数与返回类型均在下方列出。

公共导出

Symbol种类签名说明
persistArtifactContent函数persistArtifactContent(request: PersistArtifactContentRequest, options?: ArtifactOperationOptions): Promise<PersistedArtifactContent>Persist Artifact Content 函数,提供 1 个公开调用签名;参数与返回类型见下表。
PersistArtifactContentRequest接口interface PersistArtifactContentRequestPersist Artifact Content Request 接口,共包含 8 个公开字段或方法。
PersistedArtifactContent接口interface PersistedArtifactContentPersisted Artifact Content 接口,共包含 5 个公开字段或方法。

persistArtifactContent

Persist Artifact Content 函数,提供 1 个公开调用签名;参数与返回类型见下表。

声明

text
export declare function persistArtifactContent(request: PersistArtifactContentRequest, options?: ArtifactOperationOptions): Promise<PersistedArtifactContent>;

调用签名

text
persistArtifactContent(request: PersistArtifactContentRequest, options?: ArtifactOperationOptions): Promise<PersistedArtifactContent>

参数

参数类型必需说明
requestPersistArtifactContentRequest必需参数;接受的值由类型列定义。
optionsArtifactOperationOptions可选参数;接受的值由类型列定义。

返回值

  • 类型: Promise<PersistedArtifactContent>
  • 说明: 返回值契约由上述类型定义。

PersistArtifactContentRequest

Persist Artifact Content Request 接口,共包含 8 个公开字段或方法。

声明

text
export interface PersistArtifactContentRequest {
    operationId: string;
    content: ArtifactByteSource;
    expectedContentHash?: string;
    expectedSizeBytes?: number;
    mimeType?: string;
    profile: ArtifactProfileSpec;
    store: ArtifactStoreProvider;
    nonce: string;
}

契约成员

成员种类签名说明
content属性content: ArtifactByteSource公开属性;类型、只读和可选状态以签名列为准。
expectedContentHash属性expectedContentHash?: string公开属性;类型、只读和可选状态以签名列为准。
expectedSizeBytes属性expectedSizeBytes?: number公开属性;类型、只读和可选状态以签名列为准。
mimeType属性mimeType?: string公开属性;类型、只读和可选状态以签名列为准。
nonce属性nonce: string公开属性;类型、只读和可选状态以签名列为准。
operationId属性operationId: string公开属性;类型、只读和可选状态以签名列为准。
profile属性profile: ArtifactProfileSpec公开属性;类型、只读和可选状态以签名列为准。
store属性store: ArtifactStoreProvider公开属性;类型、只读和可选状态以签名列为准。

PersistedArtifactContent

Persisted Artifact Content 接口,共包含 5 个公开字段或方法。

声明

text
export interface PersistedArtifactContent {
    storageRef: ArtifactStorageRef;
    contentHash: string;
    sizeBytes: number;
    mimeType?: string;
    deduplicated: boolean;
}

契约成员

成员种类签名说明
contentHash属性contentHash: string公开属性;类型、只读和可选状态以签名列为准。
deduplicated属性deduplicated: boolean公开属性;类型、只读和可选状态以签名列为准。
mimeType属性mimeType?: string公开属性;类型、只读和可选状态以签名列为准。
sizeBytes属性sizeBytes: number公开属性;类型、只读和可选状态以签名列为准。
storageRef属性storageRef: ArtifactStorageRef公开属性;类型、只读和可选状态以签名列为准。