Skip to content

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

Using this module

Use the Artifact store module for declaring and runtime-validating contracts. It exports 12 interfaces, 1 type.

Import from the package entrypoint

ts
import type {
  ArtifactByteRange,
  ArtifactContent,
  ArtifactCopyRequest,
  ArtifactDownloadAccess,
  ArtifactDownloadAccessRequest,
  ArtifactGetRequest,
  ArtifactObjectMetadata,
  ArtifactOperationOptions,
} from '@codesoul-co/hypha-core';

// The complete export list is documented below.

Usage patterns

  • Use the 13 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.

Public exports

SymbolKindSignatureDescription
ArtifactByteRangeinterfaceinterface ArtifactByteRangeArtifact Byte Range interface with 2 public fields or methods.
ArtifactContentinterfaceinterface ArtifactContentArtifact Content interface with 6 public fields or methods.
ArtifactCopyRequestinterfaceinterface ArtifactCopyRequestArtifact Copy Request interface with 4 public fields or methods.
ArtifactDownloadAccessinterfaceinterface ArtifactDownloadAccessArtifact Download Access interface with 4 public fields or methods.
ArtifactDownloadAccessRequestinterfaceinterface ArtifactDownloadAccessRequestArtifact Download Access Request interface with 4 public fields or methods.
ArtifactGetRequestinterfaceinterface ArtifactGetRequestArtifact Get Request interface with 3 public fields or methods.
ArtifactObjectMetadatainterfaceinterface ArtifactObjectMetadataArtifact Object Metadata interface with 6 public fields or methods.
ArtifactOperationOptionsinterfaceinterface ArtifactOperationOptionsArtifact Operation Options interface with 1 public fields or methods.
ArtifactPutRequestinterfaceinterface ArtifactPutRequestArtifact Put Request interface with 8 public fields or methods.
ArtifactStoreCapabilitiesinterfaceinterface ArtifactStoreCapabilitiesArtifact Store Capabilities interface with 7 public fields or methods.
ArtifactStoreProviderinterfaceinterface ArtifactStoreProviderArtifact Store Provider interface with 11 public fields or methods.
ArtifactStoreProviderFactoryinterfaceinterface ArtifactStoreProviderFactoryArtifact Store Provider Factory interface with 2 public fields or methods.
ArtifactByteSourcetypetype ArtifactByteSource = Uint8Array | AsyncIterable<Uint8Array>Public type alias for Artifact Byte Source; the declaration contains its complete type expression.

ArtifactByteRange

Artifact Byte Range interface with 2 public fields or methods.

  • Kind: interface
  • Import: import type { ArtifactByteRange } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-store

Declaration

text
export interface ArtifactByteRange {
    start: number;
    endInclusive?: number;
}

Contract members

MemberKindSignatureDescription
endInclusivepropertyendInclusive?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
startpropertystart: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

ArtifactContent

Artifact Content interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { ArtifactContent } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-store

Declaration

text
export interface ArtifactContent {
    stream: AsyncIterable<Uint8Array>;
    contentHash: string;
    sizeBytes: number;
    mimeType?: string;
    etag?: string;
    range?: ArtifactByteRange;
}

Contract members

MemberKindSignatureDescription
contentHashpropertycontentHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
etagpropertyetag?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
mimeTypepropertymimeType?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
rangepropertyrange?: ArtifactByteRangePublic property; its type, readonly modifier and optionality are shown in the signature.
sizeBytespropertysizeBytes: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
streampropertystream: AsyncIterable<Uint8Array<ArrayBufferLike>>Public property; its type, readonly modifier and optionality are shown in the signature.

ArtifactCopyRequest

Artifact Copy Request interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { ArtifactCopyRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-store

Declaration

text
export interface ArtifactCopyRequest {
    operationId: string;
    source: ArtifactStorageRef;
    targetObjectKey: string;
    ifAbsent?: boolean;
}

Contract members

MemberKindSignatureDescription
ifAbsentpropertyifAbsent?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
operationIdpropertyoperationId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourcepropertysource: ArtifactStorageRefPublic property; its type, readonly modifier and optionality are shown in the signature.
targetObjectKeypropertytargetObjectKey: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ArtifactDownloadAccess

Artifact Download Access interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { ArtifactDownloadAccess } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-store

Declaration

text
export interface ArtifactDownloadAccess {
    method: 'GET';
    url: string;
    expiresAt: string;
    headers?: Record<string, string>;
}

Contract members

MemberKindSignatureDescription
expiresAtpropertyexpiresAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
headerspropertyheaders?: Record<string, string>Public property; its type, readonly modifier and optionality are shown in the signature.
methodpropertymethod: "GET"Public property; its type, readonly modifier and optionality are shown in the signature.
urlpropertyurl: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ArtifactDownloadAccessRequest

Artifact Download Access Request interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { ArtifactDownloadAccessRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-store

Declaration

text
export interface ArtifactDownloadAccessRequest {
    ref: ArtifactStorageRef;
    expiresInSeconds: number;
    responseMimeType?: string;
    responseFilename?: string;
}

Contract members

MemberKindSignatureDescription
expiresInSecondspropertyexpiresInSeconds: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
refpropertyref: ArtifactStorageRefPublic property; its type, readonly modifier and optionality are shown in the signature.
responseFilenamepropertyresponseFilename?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
responseMimeTypepropertyresponseMimeType?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ArtifactGetRequest

Artifact Get Request interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { ArtifactGetRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-store

Declaration

text
export interface ArtifactGetRequest {
    ref: ArtifactStorageRef;
    range?: ArtifactByteRange;
    expectedContentHash?: string;
}

Contract members

MemberKindSignatureDescription
expectedContentHashpropertyexpectedContentHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
rangepropertyrange?: ArtifactByteRangePublic property; its type, readonly modifier and optionality are shown in the signature.
refpropertyref: ArtifactStorageRefPublic property; its type, readonly modifier and optionality are shown in the signature.

ArtifactObjectMetadata

Artifact Object Metadata interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { ArtifactObjectMetadata } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-store

Declaration

text
export interface ArtifactObjectMetadata {
    contentHash: string;
    sizeBytes: number;
    mimeType?: string;
    etag?: string;
    lastModifiedAt?: string;
    metadata?: Record<string, string>;
}

Contract members

MemberKindSignatureDescription
contentHashpropertycontentHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
etagpropertyetag?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
lastModifiedAtpropertylastModifiedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, string>Public property; its type, readonly modifier and optionality are shown in the signature.
mimeTypepropertymimeType?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sizeBytespropertysizeBytes: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

ArtifactOperationOptions

Artifact Operation Options interface with 1 public fields or methods.

  • Kind: interface
  • Import: import type { ArtifactOperationOptions } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-store

Declaration

text
export interface ArtifactOperationOptions {
    abortSignal?: AbortSignal;
}

Contract members

MemberKindSignatureDescription
abortSignalpropertyabortSignal?: AbortSignalPublic property; its type, readonly modifier and optionality are shown in the signature.

ArtifactPutRequest

Artifact Put Request interface with 8 public fields or methods.

  • Kind: interface
  • Import: import type { ArtifactPutRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-store

Declaration

text
export interface ArtifactPutRequest {
    operationId: string;
    objectKey: string;
    content: ArtifactByteSource;
    expectedContentHash?: string;
    sizeBytes?: number;
    mimeType?: string;
    metadata?: Record<string, string>;
    ifAbsent?: boolean;
}

Contract members

MemberKindSignatureDescription
contentpropertycontent: ArtifactByteSourcePublic property; its type, readonly modifier and optionality are shown in the signature.
expectedContentHashpropertyexpectedContentHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
ifAbsentpropertyifAbsent?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, string>Public property; its type, readonly modifier and optionality are shown in the signature.
mimeTypepropertymimeType?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
objectKeypropertyobjectKey: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
operationIdpropertyoperationId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sizeBytespropertysizeBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

ArtifactStoreCapabilities

Artifact Store Capabilities interface with 7 public fields or methods.

  • Kind: interface
  • Import: import type { ArtifactStoreCapabilities } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-store

Declaration

text
export interface ArtifactStoreCapabilities {
    versioning: boolean;
    rangeRead: boolean;
    signedAccess: boolean;
    serverSideCopy: boolean;
    encryption: boolean;
    multipartUpload: boolean;
    contentAddressing: boolean;
}

Contract members

MemberKindSignatureDescription
contentAddressingpropertycontentAddressing: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
encryptionpropertyencryption: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
multipartUploadpropertymultipartUpload: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
rangeReadpropertyrangeRead: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
serverSideCopypropertyserverSideCopy: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
signedAccesspropertysignedAccess: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
versioningpropertyversioning: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.

ArtifactStoreProvider

Artifact Store Provider interface with 11 public fields or methods.

  • Kind: interface
  • Import: import type { ArtifactStoreProvider } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-store

Declaration

text
export interface ArtifactStoreProvider {
    readonly id: string;
    capabilities(): Promise<ArtifactStoreCapabilities>;
    put(request: ArtifactPutRequest, options?: ArtifactOperationOptions): Promise<ArtifactStorageRef>;
    get(request: ArtifactGetRequest, options?: ArtifactOperationOptions): Promise<ArtifactContent>;
    head(ref: ArtifactStorageRef): Promise<ArtifactObjectMetadata | null>;
    exists(ref: ArtifactStorageRef): Promise<boolean>;
    delete(ref: ArtifactStorageRef): Promise<void>;
    copy(request: ArtifactCopyRequest): Promise<ArtifactStorageRef>;
    createDownloadAccess?(request: ArtifactDownloadAccessRequest): Promise<ArtifactDownloadAccess>;
    health(): Promise<ProviderHealth>;
    close?(): Promise<void>;
}

Contract members

MemberKindSignatureDescription
capabilitiesmethodcapabilities(): Promise<ArtifactStoreCapabilities>Public method; parameters and return type are shown in the signature.
closemethodclose?(): Promise<void>Public method; parameters and return type are shown in the signature.
copymethodcopy(request: ArtifactCopyRequest): Promise<ArtifactStorageRef>Public method; parameters and return type are shown in the signature.
createDownloadAccessmethodcreateDownloadAccess?(request: ArtifactDownloadAccessRequest): Promise<ArtifactDownloadAccess>Public method; parameters and return type are shown in the signature.
deletemethoddelete(ref: ArtifactStorageRef): Promise<void>Public method; parameters and return type are shown in the signature.
existsmethodexists(ref: ArtifactStorageRef): Promise<boolean>Public method; parameters and return type are shown in the signature.
getmethodget(request: ArtifactGetRequest, options?: ArtifactOperationOptions): Promise<ArtifactContent>Public method; parameters and return type are shown in the signature.
headmethodhead(ref: ArtifactStorageRef): Promise<ArtifactObjectMetadata | null>Public method; parameters and return type are shown in the signature.
healthmethodhealth(): Promise<ProviderHealth>Public method; parameters and return type are shown in the signature.
idpropertyreadonly id: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
putmethodput(request: ArtifactPutRequest, options?: ArtifactOperationOptions): Promise<ArtifactStorageRef>Public method; parameters and return type are shown in the signature.

ArtifactStoreProviderFactory

Artifact Store Provider Factory interface with 2 public fields or methods.

  • Kind: interface
  • Import: import type { ArtifactStoreProviderFactory } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-store

Declaration

text
export interface ArtifactStoreProviderFactory {
    readonly providerId: string;
    create(): ArtifactStoreProvider | Promise<ArtifactStoreProvider>;
}

Contract members

MemberKindSignatureDescription
createmethodcreate(): ArtifactStoreProvider | Promise<ArtifactStoreProvider>Public method; parameters and return type are shown in the signature.
providerIdpropertyreadonly providerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ArtifactByteSource

Public type alias for Artifact Byte Source; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { ArtifactByteSource } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-store

Declaration

text
export type ArtifactByteSource = Uint8Array | AsyncIterable<Uint8Array>;