Skip to content

@codesoul-co/hypha-adapters-local / artifact-content-io ​

Using this module ​

Use the Artifact content io module for using the public contracts and operations for this capability boundary. It exports 1 class, 4 functions, 1 interface.

Import from the package entrypoint ​

ts
import {
  ArtifactContentLimitError,
  collectArtifactContent,
  hashArtifactBytes,
  readArtifactStream,
  streamArtifactBytes,
} from '@codesoul-co/hypha-adapters-local';

import type {
  CollectedArtifactContent,
} from '@codesoul-co/hypha-adapters-local';

Usage patterns ​

  • Use the 1 type/interface export as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The module exposes 1 class as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
  • The module exposes 4 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.

Public exports ​

SymbolKindSignatureDescription
ArtifactContentLimitErrorclassnew ArtifactContentLimitError(maxBytes: number, observedBytes: number): ArtifactContentLimitErrorArtifact Content Limit Error class with 10 public constructor or member entries; its exact declarations are listed below.
collectArtifactContentfunctioncollectArtifactContent(source: ArtifactByteSource, maxBytes: number): Promise<CollectedArtifactContent>Collect Artifact Content function with 1 public call signature; parameters and return types are listed below.
hashArtifactBytesfunctionhashArtifactBytes(bytes: Uint8Array): stringHash Artifact Bytes function with 1 public call signature; parameters and return types are listed below.
readArtifactStreamfunctionreadArtifactStream(stream: AsyncIterable<Uint8Array>): Promise<Uint8Array>Read Artifact Stream function with 1 public call signature; parameters and return types are listed below.
streamArtifactBytesfunctionstreamArtifactBytes(bytes: Uint8Array): AsyncIterable<Uint8Array>Stream Artifact Bytes function with 1 public call signature; parameters and return types are listed below.
CollectedArtifactContentinterfaceinterface CollectedArtifactContentCollected Artifact Content interface with 2 public fields or methods.

ArtifactContentLimitError ​

Artifact Content Limit Error class with 10 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { ArtifactContentLimitError } from '@codesoul-co/hypha-adapters-local';
  • Source module: artifact-content-io

Declaration ​

text
export declare class ArtifactContentLimitError extends Error {
    readonly maxBytes: number;
    readonly observedBytes: number;
    constructor(maxBytes: number, observedBytes: number);
}

Public members ​

MemberKindSignatureDescription
causepropertycause?: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
constructorconstructor(maxBytes: number, observedBytes: number): ArtifactContentLimitErrorCreates an instance of this class.
maxBytespropertyreadonly maxBytes: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
messagepropertymessage: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
namepropertyname: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
observedBytespropertyreadonly observedBytes: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
stackpropertystack?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
static captureStackTracemethodstatic 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 prepareStackTracemethodstatic prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): anyPublic method; parameters and return type are shown in the signature.
static stackTraceLimitpropertystatic 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.

collectArtifactContent ​

Collect Artifact Content function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { collectArtifactContent } from '@codesoul-co/hypha-adapters-local';
  • Source module: artifact-content-io

Declaration ​

text
export declare function collectArtifactContent(source: ArtifactByteSource, maxBytes: number): Promise<CollectedArtifactContent>;

Call signature ​

text
collectArtifactContent(source: ArtifactByteSource, maxBytes: number): Promise<CollectedArtifactContent>

Parameters ​

ParameterTypeRequiredDescription
sourceArtifactByteSourceYesRequired parameter; accepted values are defined by the type column.
maxBytesnumberYesRequired parameter; accepted values are defined by the type column.

Returns ​

  • Type: Promise<CollectedArtifactContent>
  • Description: The return contract is defined by the type shown above.

hashArtifactBytes ​

Hash Artifact Bytes function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { hashArtifactBytes } from '@codesoul-co/hypha-adapters-local';
  • Source module: artifact-content-io

Declaration ​

text
export declare function hashArtifactBytes(bytes: Uint8Array): string;

Call signature ​

text
hashArtifactBytes(bytes: Uint8Array): string

Parameters ​

ParameterTypeRequiredDescription
bytesUint8Array<ArrayBufferLike>YesRequired parameter; accepted values are defined by the type column.

Returns ​

  • Type: string
  • Description: The return contract is defined by the type shown above.

readArtifactStream ​

Read Artifact Stream function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { readArtifactStream } from '@codesoul-co/hypha-adapters-local';
  • Source module: artifact-content-io

Declaration ​

text
export declare function readArtifactStream(stream: AsyncIterable<Uint8Array>): Promise<Uint8Array>;

Call signature ​

text
readArtifactStream(stream: AsyncIterable<Uint8Array>): Promise<Uint8Array>

Parameters ​

ParameterTypeRequiredDescription
streamAsyncIterable<Uint8Array<ArrayBufferLike>>YesRequired parameter; accepted values are defined by the type column.

Returns ​

  • Type: Promise<Uint8Array<ArrayBufferLike>>
  • Description: The return contract is defined by the type shown above.

streamArtifactBytes ​

Stream Artifact Bytes function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { streamArtifactBytes } from '@codesoul-co/hypha-adapters-local';
  • Source module: artifact-content-io

Declaration ​

text
export declare function streamArtifactBytes(bytes: Uint8Array): AsyncIterable<Uint8Array>;

Call signature ​

text
streamArtifactBytes(bytes: Uint8Array): AsyncIterable<Uint8Array>

Parameters ​

ParameterTypeRequiredDescription
bytesUint8Array<ArrayBufferLike>YesRequired parameter; accepted values are defined by the type column.

Returns ​

  • Type: AsyncIterable<Uint8Array<ArrayBufferLike>>
  • Description: The return contract is defined by the type shown above.

CollectedArtifactContent ​

Collected Artifact Content interface with 2 public fields or methods.

  • Kind: interface
  • Import: import type { CollectedArtifactContent } from '@codesoul-co/hypha-adapters-local';
  • Source module: artifact-content-io

Declaration ​

text
export interface CollectedArtifactContent {
    bytes: Uint8Array;
    contentHash: string;
}

Contract members ​

MemberKindSignatureDescription
bytespropertybytes: Uint8Array<ArrayBufferLike>Public property; its type, readonly modifier and optionality are shown in the signature.
contentHashpropertycontentHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.