@codesoul-co/hypha-adapters-local / legacy-tool-artifact-importer
- Package index:
@codesoul-co/hypha-adapters-local - Source:
packages/adapters-local/src/legacy-tool-artifact-importer.ts - Exports: 7
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
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
| Symbol | Kind | Signature | Description |
|---|---|---|---|
LegacyToolArtifactImporter | class | new LegacyToolArtifactImporter(options: LegacyToolArtifactImporterOptions): LegacyToolArtifactImporter | Imports one explicitly identified legacy Tool file into Core ArtifactManager. |
LegacyToolArtifactImportError | class | new LegacyToolArtifactImportError(code: LegacyToolArtifactImportErrorCode, message: string, details?: Record<string, unknown> | undefined): LegacyToolArtifactImportError | Legacy Tool Artifact Import Error class with 10 public constructor or member entries; its exact declarations are listed below. |
legacyArtifactReference | function | legacyArtifactReference(relativePath: string, sizeBytes: number): string | Legacy Artifact Reference function with 1 public call signature; parameters and return types are listed below. |
LegacyToolArtifactImporterOptions | interface | interface LegacyToolArtifactImporterOptions | Legacy Tool Artifact Importer Options interface with 3 public fields or methods. |
LegacyToolArtifactImportRequest | interface | interface LegacyToolArtifactImportRequest | Legacy Tool Artifact Import Request interface with 9 public fields or methods. |
LegacyToolArtifactImportResult | interface | interface LegacyToolArtifactImportResult | Legacy Tool Artifact Import Result interface with 6 public fields or methods. |
LegacyToolArtifactImportErrorCode | type | 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' | 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.
- Kind: class
- Import:
import { LegacyToolArtifactImporter } from '@codesoul-co/hypha-adapters-local'; - Source module:
legacy-tool-artifact-importer
Declaration
export declare class LegacyToolArtifactImporter {
constructor(options: LegacyToolArtifactImporterOptions);
import(request: LegacyToolArtifactImportRequest): Promise<LegacyToolArtifactImportResult>;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
constructor | constructor | (options: LegacyToolArtifactImporterOptions): LegacyToolArtifactImporter | Creates an instance of this class. |
import | method | import(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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
cause | property | cause?: unknown | Public property; its type, readonly modifier and optionality are shown in the signature. |
code | property | readonly code: LegacyToolArtifactImportErrorCode | Public property; its type, readonly modifier and optionality are shown in the signature. |
constructor | constructor | (code: LegacyToolArtifactImportErrorCode, message: string, details?: Record<string, unknown> | undefined): LegacyToolArtifactImportError | 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. |
legacyArtifactReference
Legacy Artifact Reference function with 1 public call signature; parameters and return types are listed below.
- Kind: function
- Import:
import { legacyArtifactReference } from '@codesoul-co/hypha-adapters-local'; - Source module:
legacy-tool-artifact-importer
Declaration
export declare function legacyArtifactReference(relativePath: string, sizeBytes: number): string;Call signature
legacyArtifactReference(relativePath: string, sizeBytes: number): stringParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
relativePath | string | Yes | Required parameter; accepted values are defined by the type column. |
sizeBytes | number | Yes | Required 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
export interface LegacyToolArtifactImporterOptions {
legacyRootPath: string;
manager: Pick<ArtifactManager, 'create'>;
maxArtifactBytes?: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
legacyRootPath | property | legacyRootPath: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
manager | property | manager: Pick<ArtifactManager, "create"> | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxArtifactBytes | property | maxArtifactBytes?: number | Public 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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
context | property | context: ToolArtifactManagerContext | Public property; its type, readonly modifier and optionality are shown in the signature. |
expectedContentHash | property | expectedContentHash?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
expectedLegacyArtifactId | property | expectedLegacyArtifactId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
expectedSizeBytes | property | expectedSizeBytes?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
invocationId | property | invocationId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
metadata | property | metadata?: Record<string, unknown> | Public property; its type, readonly modifier and optionality are shown in the signature. |
mimeType | property | mimeType?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
relativePath | property | relativePath: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
toolId | property | toolId: string | Public 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
export interface LegacyToolArtifactImportResult {
legacyArtifactId: string;
artifactId: string;
versionId: string;
revision: number;
contentHash: string;
sizeBytes: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
artifactId | property | artifactId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
contentHash | property | contentHash: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
legacyArtifactId | property | legacyArtifactId: 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. |
sizeBytes | property | sizeBytes: 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. |
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
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';