@codesoul-co/hypha-core / contracts/artifact-record-repository
- Package index:
@codesoul-co/hypha-core - Source:
packages/core/src/contracts/artifact-record-repository.ts - Exports: 7
Using this module
Use the Artifact record repository module for declaring and runtime-validating contracts. It exports 2 classes, 5 interfaces.
Import from the package entrypoint
import {
ArtifactRecordRepositoryConflictError,
ArtifactRecordRepositoryError,
} from '@codesoul-co/hypha-core';
import type {
ArtifactIdempotencyRecord,
ArtifactRecordCommitRequest,
ArtifactRecordRepository,
ArtifactRevisionFence,
StoredArtifactRecord,
} from '@codesoul-co/hypha-core';Usage patterns
- Use the 5 type/interface exports as static contracts in application code, adapters, or tests. Import them with
import type; they do not exist at runtime. - The module exposes 2 classes as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
Public exports
| Symbol | Kind | Signature | Description |
|---|---|---|---|
ArtifactRecordRepositoryConflictError | class | new ArtifactRecordRepositoryConflictError(message: string, details?: Record<string, unknown> | undefined): ArtifactRecordRepositoryConflictError | Artifact Record Repository Conflict Error class with 9 public constructor or member entries; its exact declarations are listed below. |
ArtifactRecordRepositoryError | class | new ArtifactRecordRepositoryError(code: "ARTIFACT_RECORD_REPOSITORY_UNAVAILABLE" | "ARTIFACT_RECORD_REPOSITORY_CORRUPT", message: string, cause?: unknown | undefined): ArtifactRecordRepositoryError | Artifact Record Repository Error class with 9 public constructor or member entries; its exact declarations are listed below. |
ArtifactIdempotencyRecord | interface | interface ArtifactIdempotencyRecord | Artifact Idempotency Record interface with 4 public fields or methods. |
ArtifactRecordCommitRequest | interface | interface ArtifactRecordCommitRequest | Artifact Record Commit Request interface with 3 public fields or methods. |
ArtifactRecordRepository | interface | interface ArtifactRecordRepository | Metadata persistence port for ArtifactManager. Implementations persist records, version/lineage links, and idempotency results, but never Artifact content bytes. |
ArtifactRevisionFence | interface | interface ArtifactRevisionFence | Artifact Revision Fence interface with 3 public fields or methods. |
StoredArtifactRecord | interface | interface StoredArtifactRecord | Stored Artifact Record interface with 2 public fields or methods. |
ArtifactRecordRepositoryConflictError
Artifact Record Repository Conflict Error class with 9 public constructor or member entries; its exact declarations are listed below.
- Kind: class
- Import:
import { ArtifactRecordRepositoryConflictError } from '@codesoul-co/hypha-core'; - Source module:
contracts/artifact-record-repository
Declaration
export declare class ArtifactRecordRepositoryConflictError extends Error {
readonly details?: Record<string, unknown> | undefined;
constructor(message: string, details?: Record<string, unknown> | undefined);
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
cause | property | cause?: unknown | Public property; its type, readonly modifier and optionality are shown in the signature. |
constructor | constructor | (message: string, details?: Record<string, unknown> | undefined): ArtifactRecordRepositoryConflictError | Creates an instance of this class. |
details | property | readonly details?: Record<string, unknown> | Public property; its type, readonly modifier and optionality are shown in the signature. |
message | property | message: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
name | property | name: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
stack | property | stack?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
static captureStackTrace | method | static captureStackTrace(targetObject: object, constructorOpt?: Function): void | Creates 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 | method | static prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any | Public method; parameters and return type are shown in the signature. |
static stackTraceLimit | property | static stackTraceLimit: number | The 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. |
ArtifactRecordRepositoryError
Artifact Record Repository Error class with 9 public constructor or member entries; its exact declarations are listed below.
- Kind: class
- Import:
import { ArtifactRecordRepositoryError } from '@codesoul-co/hypha-core'; - Source module:
contracts/artifact-record-repository
Declaration
export declare class ArtifactRecordRepositoryError extends Error {
readonly code: 'ARTIFACT_RECORD_REPOSITORY_UNAVAILABLE' | 'ARTIFACT_RECORD_REPOSITORY_CORRUPT';
readonly cause?: unknown | undefined;
constructor(code: 'ARTIFACT_RECORD_REPOSITORY_UNAVAILABLE' | 'ARTIFACT_RECORD_REPOSITORY_CORRUPT', message: string, cause?: unknown | undefined);
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
cause | property | readonly cause?: unknown | Public property; its type, readonly modifier and optionality are shown in the signature. |
code | property | readonly code: "ARTIFACT_RECORD_REPOSITORY_UNAVAILABLE" | "ARTIFACT_RECORD_REPOSITORY_CORRUPT" | Public property; its type, readonly modifier and optionality are shown in the signature. |
constructor | constructor | (code: "ARTIFACT_RECORD_REPOSITORY_UNAVAILABLE" | "ARTIFACT_RECORD_REPOSITORY_CORRUPT", message: string, cause?: unknown | undefined): ArtifactRecordRepositoryError | Creates an instance of this class. |
message | property | message: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
name | property | name: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
stack | property | stack?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
static captureStackTrace | method | static captureStackTrace(targetObject: object, constructorOpt?: Function): void | Creates 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 | method | static prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any | Public method; parameters and return type are shown in the signature. |
static stackTraceLimit | property | static stackTraceLimit: number | The 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. |
ArtifactIdempotencyRecord
Artifact Idempotency Record interface with 4 public fields or methods.
- Kind: interface
- Import:
import type { ArtifactIdempotencyRecord } from '@codesoul-co/hypha-core'; - Source module:
contracts/artifact-record-repository
Declaration
export interface ArtifactIdempotencyRecord {
operationId: string;
idempotencyKey: string;
artifactId: string;
versionId: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
artifactId | property | artifactId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
idempotencyKey | property | idempotencyKey: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
operationId | property | operationId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
versionId | property | versionId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
ArtifactRecordCommitRequest
Artifact Record Commit Request interface with 3 public fields or methods.
- Kind: interface
- Import:
import type { ArtifactRecordCommitRequest } from '@codesoul-co/hypha-core'; - Source module:
contracts/artifact-record-repository
Declaration
export interface ArtifactRecordCommitRequest {
records: StoredArtifactRecord[];
expectedLatest?: ArtifactRevisionFence;
idempotency?: ArtifactIdempotencyRecord;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
expectedLatest | property | expectedLatest?: ArtifactRevisionFence | Public property; its type, readonly modifier and optionality are shown in the signature. |
idempotency | property | idempotency?: ArtifactIdempotencyRecord | Public property; its type, readonly modifier and optionality are shown in the signature. |
records | property | records: StoredArtifactRecord[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
ArtifactRecordRepository
Metadata persistence port for ArtifactManager. Implementations persist records, version/lineage links, and idempotency results, but never Artifact content bytes.
- Kind: interface
- Import:
import type { ArtifactRecordRepository } from '@codesoul-co/hypha-core'; - Source module:
contracts/artifact-record-repository
Declaration
export interface ArtifactRecordRepository {
get(artifactId: string, versionId?: string): Promise<StoredArtifactRecord | null>;
getByVersionId(versionId: string): Promise<StoredArtifactRecord | null>;
list(): Promise<StoredArtifactRecord[]>;
findIdempotency(operationId: string, idempotencyKey: string): Promise<StoredArtifactRecord | null>;
commit(request: ArtifactRecordCommitRequest): Promise<void>;
listGarbageCollectionCandidates(request: ArtifactGarbageCollectionScanRequest): Promise<ArtifactGarbageCollectionCandidate[]>;
claimGarbageCollection(request: ArtifactGarbageCollectionClaimRequest): Promise<boolean>;
completeGarbageCollection(claimId: string, completedAt: string): Promise<void>;
releaseGarbageCollection(claimId: string): Promise<void>;
health(): Promise<ProviderHealth>;
close?(): Promise<void>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
claimGarbageCollection | method | claimGarbageCollection(request: ArtifactGarbageCollectionClaimRequest): Promise<boolean> | Public method; parameters and return type are shown in the signature. |
close | method | close?(): Promise<void> | Public method; parameters and return type are shown in the signature. |
commit | method | commit(request: ArtifactRecordCommitRequest): Promise<void> | Public method; parameters and return type are shown in the signature. |
completeGarbageCollection | method | completeGarbageCollection(claimId: string, completedAt: string): Promise<void> | Public method; parameters and return type are shown in the signature. |
findIdempotency | method | findIdempotency(operationId: string, idempotencyKey: string): Promise<StoredArtifactRecord | null> | Public method; parameters and return type are shown in the signature. |
get | method | get(artifactId: string, versionId?: string): Promise<StoredArtifactRecord | null> | Public method; parameters and return type are shown in the signature. |
getByVersionId | method | getByVersionId(versionId: string): Promise<StoredArtifactRecord | null> | Public method; parameters and return type are shown in the signature. |
health | method | health(): Promise<ProviderHealth> | Public method; parameters and return type are shown in the signature. |
list | method | list(): Promise<StoredArtifactRecord[]> | Public method; parameters and return type are shown in the signature. |
listGarbageCollectionCandidates | method | listGarbageCollectionCandidates(request: ArtifactGarbageCollectionScanRequest): Promise<ArtifactGarbageCollectionCandidate[]> | Public method; parameters and return type are shown in the signature. |
releaseGarbageCollection | method | releaseGarbageCollection(claimId: string): Promise<void> | Public method; parameters and return type are shown in the signature. |
ArtifactRevisionFence
Artifact Revision Fence interface with 3 public fields or methods.
- Kind: interface
- Import:
import type { ArtifactRevisionFence } from '@codesoul-co/hypha-core'; - Source module:
contracts/artifact-record-repository
Declaration
export interface ArtifactRevisionFence {
artifactId: string;
versionId: string;
revision: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
artifactId | property | artifactId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
revision | property | revision: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
versionId | property | versionId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
StoredArtifactRecord
Stored Artifact Record interface with 2 public fields or methods.
- Kind: interface
- Import:
import type { StoredArtifactRecord } from '@codesoul-co/hypha-core'; - Source module:
contracts/artifact-record-repository
Declaration
export interface StoredArtifactRecord {
record: ArtifactRecord;
profileRef: SpecRef;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
profileRef | property | profileRef: SpecRef | Public property; its type, readonly modifier and optionality are shown in the signature. |
record | property | record: ArtifactRecord | Public property; its type, readonly modifier and optionality are shown in the signature. |
