Skip to content

@codesoul-co/hypha-adapters-local / legacy-tool-artifact-importer ​

Using this module ​

Use the Legacy tool artifact importer module for defining or implementing provider-neutral ports. It exports 2 classes, 1 function, 3 interfaces, 1 type.

Import from the package entrypoint ​

ts
import {
  LegacyToolArtifactImporter,
  LegacyToolArtifactImportError,
  legacyArtifactReference,
} from '@codesoul-co/hypha-adapters-local';

import type {
  LegacyToolArtifactImporterOptions,
  LegacyToolArtifactImportRequest,
  LegacyToolArtifactImportResult,
  LegacyToolArtifactImportErrorCode,
} from '@codesoul-co/hypha-adapters-local';

Usage patterns ​

  • Use the 4 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.
  • The module exposes 1 function as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.

Public exports ​

SymbolKindSignatureDescription
LegacyToolArtifactImporterclassnew LegacyToolArtifactImporter(options: LegacyToolArtifactImporterOptions): LegacyToolArtifactImporterImports one explicitly identified legacy Tool file into Core ArtifactManager.
LegacyToolArtifactImportErrorclassnew LegacyToolArtifactImportError(code: LegacyToolArtifactImportErrorCode, message: string, details?: Record<string, unknown> | undefined): LegacyToolArtifactImportErrorLegacy Tool Artifact Import Error class with 10 public constructor or member entries; its exact declarations are listed below.
legacyArtifactReferencefunctionlegacyArtifactReference(relativePath: string, sizeBytes: number): stringLegacy Artifact Reference function with 1 public call signature; parameters and return types are listed below.
LegacyToolArtifactImporterOptionsinterfaceinterface LegacyToolArtifactImporterOptionsLegacy Tool Artifact Importer Options interface with 3 public fields or methods.
LegacyToolArtifactImportRequestinterfaceinterface LegacyToolArtifactImportRequestLegacy Tool Artifact Import Request interface with 9 public fields or methods.
LegacyToolArtifactImportResultinterfaceinterface LegacyToolArtifactImportResultLegacy Tool Artifact Import Result interface with 6 public fields or methods.
LegacyToolArtifactImportErrorCodetypetype LegacyToolArtifactImportErrorCode = 'LEGACY_ARTIFACT_INVALID_PATH' | 'LEGACY_ARTIFACT_NOT_FOUND' | 'LEGACY_ARTIFACT_TOO_LARGE' | 'LEGACY_ARTIFACT_ID_MISMATCH' | 'LEGACY_ARTIFACT_SIZE_MISMATCH' | 'LEGACY_ARTIFACT_CONTENT_MISMATCH'Public type alias for Legacy Tool Artifact Import Error Code; the declaration contains its complete type expression.

LegacyToolArtifactImporter ​

Imports one explicitly identified legacy Tool file into Core ArtifactManager.

Declaration ​

text
export declare class LegacyToolArtifactImporter {
    constructor(options: LegacyToolArtifactImporterOptions);
    import(request: LegacyToolArtifactImportRequest): Promise<LegacyToolArtifactImportResult>;
}

Public members ​

MemberKindSignatureDescription
constructorconstructor(options: LegacyToolArtifactImporterOptions): LegacyToolArtifactImporterCreates an instance of this class.
importmethodimport(request: LegacyToolArtifactImportRequest): Promise<LegacyToolArtifactImportResult>Public method; parameters and return type are shown in the signature.

LegacyToolArtifactImportError ​

Legacy Tool Artifact Import Error class with 10 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { LegacyToolArtifactImportError } from '@codesoul-co/hypha-adapters-local';
  • Source module: legacy-tool-artifact-importer

Declaration ​

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

Public members ​

MemberKindSignatureDescription
causepropertycause?: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
codepropertyreadonly code: LegacyToolArtifactImportErrorCodePublic property; its type, readonly modifier and optionality are shown in the signature.
constructorconstructor(code: LegacyToolArtifactImportErrorCode, message: string, details?: Record<string, unknown> | undefined): LegacyToolArtifactImportErrorCreates an instance of this class.
detailspropertyreadonly details?: Record<string, unknown>Public 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.
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.

legacyArtifactReference ​

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

Declaration ​

text
export declare function legacyArtifactReference(relativePath: string, sizeBytes: number): string;

Call signature ​

text
legacyArtifactReference(relativePath: string, sizeBytes: number): string

Parameters ​

ParameterTypeRequiredDescription
relativePathstringYesRequired parameter; accepted values are defined by the type column.
sizeBytesnumberYesRequired parameter; accepted values are defined by the type column.

Returns ​

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

LegacyToolArtifactImporterOptions ​

Legacy Tool Artifact Importer Options interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { LegacyToolArtifactImporterOptions } from '@codesoul-co/hypha-adapters-local';
  • Source module: legacy-tool-artifact-importer

Declaration ​

text
export interface LegacyToolArtifactImporterOptions {
    legacyRootPath: string;
    manager: Pick<ArtifactManager, 'create'>;
    maxArtifactBytes?: number;
}

Contract members ​

MemberKindSignatureDescription
legacyRootPathpropertylegacyRootPath: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
managerpropertymanager: Pick<ArtifactManager, "create">Public property; its type, readonly modifier and optionality are shown in the signature.
maxArtifactBytespropertymaxArtifactBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

LegacyToolArtifactImportRequest ​

Legacy Tool Artifact Import Request interface with 9 public fields or methods.

  • Kind: interface
  • Import: import type { LegacyToolArtifactImportRequest } from '@codesoul-co/hypha-adapters-local';
  • Source module: legacy-tool-artifact-importer

Declaration ​

text
export interface LegacyToolArtifactImportRequest {
    relativePath: string;
    expectedLegacyArtifactId?: string;
    expectedContentHash?: string;
    expectedSizeBytes?: number;
    context: ToolArtifactManagerContext;
    toolId: string;
    invocationId: string;
    mimeType?: string;
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
contextpropertycontext: ToolArtifactManagerContextPublic 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.
expectedLegacyArtifactIdpropertyexpectedLegacyArtifactId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
expectedSizeBytespropertyexpectedSizeBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
invocationIdpropertyinvocationId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>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.
relativePathpropertyrelativePath: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
toolIdpropertytoolId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

LegacyToolArtifactImportResult ​

Legacy Tool Artifact Import Result interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { LegacyToolArtifactImportResult } from '@codesoul-co/hypha-adapters-local';
  • Source module: legacy-tool-artifact-importer

Declaration ​

text
export interface LegacyToolArtifactImportResult {
    legacyArtifactId: string;
    artifactId: string;
    versionId: string;
    revision: number;
    contentHash: string;
    sizeBytes: number;
}

Contract members ​

MemberKindSignatureDescription
artifactIdpropertyartifactId: stringPublic 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.
legacyArtifactIdpropertylegacyArtifactId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
revisionpropertyrevision: numberPublic 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.
versionIdpropertyversionId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

LegacyToolArtifactImportErrorCode ​

Public type alias for Legacy Tool Artifact Import Error Code; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { LegacyToolArtifactImportErrorCode } from '@codesoul-co/hypha-adapters-local';
  • Source module: legacy-tool-artifact-importer

Declaration ​

text
export type LegacyToolArtifactImportErrorCode = 'LEGACY_ARTIFACT_INVALID_PATH' | 'LEGACY_ARTIFACT_NOT_FOUND' | 'LEGACY_ARTIFACT_TOO_LARGE' | 'LEGACY_ARTIFACT_ID_MISMATCH' | 'LEGACY_ARTIFACT_SIZE_MISMATCH' | 'LEGACY_ARTIFACT_CONTENT_MISMATCH';