@codesoul-co/hypha-memory / memory-data-migration
- Package index:
@codesoul-co/hypha-memory - Source:
packages/memory/src/memory-data-migration.ts - Exports: 8
Using this module
Use the Memory data migration module for using the public contracts and operations for this capability boundary. It exports 2 classes, 1 function, 5 interfaces.
Import from the package entrypoint
import {
MemoryDataMigrationCoordinator,
StructuredMemoryDataMigrationStateStore,
migrationPlanHash,
} from '@codesoul-co/hypha-memory';
import type {
MemoryDataMigrationCoordinatorOptions,
MemoryDataMigrationPlan,
MemoryDataMigrationState,
MemoryDataMigrationStateStore,
MemoryDataMigrationStep,
} from '@codesoul-co/hypha-memory';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.
- 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 |
|---|---|---|---|
MemoryDataMigrationCoordinator | class | new MemoryDataMigrationCoordinator(options: MemoryDataMigrationCoordinatorOptions): MemoryDataMigrationCoordinator | Resumable migration/rollback runner. Step implementations remain with the data owner. |
StructuredMemoryDataMigrationStateStore | class | new StructuredMemoryDataMigrationStateStore(store: StructuredStoreProvider, table?: string): StructuredMemoryDataMigrationStateStore | Structured Memory Data Migration State Store class with 3 public constructor or member entries; its exact declarations are listed below. |
migrationPlanHash | function | migrationPlanHash(plan: MemoryDataMigrationPlan): string | Migration Plan Hash function with 1 public call signature; parameters and return types are listed below. |
MemoryDataMigrationCoordinatorOptions | interface | interface MemoryDataMigrationCoordinatorOptions | Memory Data Migration Coordinator Options interface with 2 public fields or methods. |
MemoryDataMigrationPlan | interface | interface MemoryDataMigrationPlan | Memory Data Migration Plan interface with 5 public fields or methods. |
MemoryDataMigrationState | interface | interface MemoryDataMigrationState | Memory Data Migration State interface with 9 public fields or methods. |
MemoryDataMigrationStateStore | interface | interface MemoryDataMigrationStateStore | Memory Data Migration State Store interface with 2 public fields or methods. |
MemoryDataMigrationStep | interface | interface MemoryDataMigrationStep | Memory Data Migration Step interface with 3 public fields or methods. |
MemoryDataMigrationCoordinator
Resumable migration/rollback runner. Step implementations remain with the data owner.
- Kind: class
- Import:
import { MemoryDataMigrationCoordinator } from '@codesoul-co/hypha-memory'; - Source module:
memory-data-migration
Declaration
export declare class MemoryDataMigrationCoordinator {
constructor(options: MemoryDataMigrationCoordinatorOptions);
apply(plan: MemoryDataMigrationPlan): Promise<MemoryDataMigrationState>;
rollback(plan: MemoryDataMigrationPlan): Promise<MemoryDataMigrationState>;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
apply | method | apply(plan: MemoryDataMigrationPlan): Promise<MemoryDataMigrationState> | Public method; parameters and return type are shown in the signature. |
constructor | constructor | (options: MemoryDataMigrationCoordinatorOptions): MemoryDataMigrationCoordinator | Creates an instance of this class. |
rollback | method | rollback(plan: MemoryDataMigrationPlan): Promise<MemoryDataMigrationState> | Public method; parameters and return type are shown in the signature. |
StructuredMemoryDataMigrationStateStore
Structured Memory Data Migration State Store class with 3 public constructor or member entries; its exact declarations are listed below.
- Kind: class
- Import:
import { StructuredMemoryDataMigrationStateStore } from '@codesoul-co/hypha-memory'; - Source module:
memory-data-migration
Declaration
export declare class StructuredMemoryDataMigrationStateStore implements MemoryDataMigrationStateStore {
constructor(store: StructuredStoreProvider, table?: string);
get(planId: string): Promise<MemoryDataMigrationState | null>;
save(state: MemoryDataMigrationState): Promise<void>;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
constructor | constructor | (store: StructuredStoreProvider, table?: string): StructuredMemoryDataMigrationStateStore | Creates an instance of this class. |
get | method | get(planId: string): Promise<MemoryDataMigrationState | null> | Public method; parameters and return type are shown in the signature. |
save | method | save(state: MemoryDataMigrationState): Promise<void> | Public method; parameters and return type are shown in the signature. |
migrationPlanHash
Migration Plan Hash function with 1 public call signature; parameters and return types are listed below.
- Kind: function
- Import:
import { migrationPlanHash } from '@codesoul-co/hypha-memory'; - Source module:
memory-data-migration
Declaration
export declare function migrationPlanHash(plan: MemoryDataMigrationPlan): string;Call signature
migrationPlanHash(plan: MemoryDataMigrationPlan): stringParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
plan | MemoryDataMigrationPlan | 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.
MemoryDataMigrationCoordinatorOptions
Memory Data Migration Coordinator Options interface with 2 public fields or methods.
- Kind: interface
- Import:
import type { MemoryDataMigrationCoordinatorOptions } from '@codesoul-co/hypha-memory'; - Source module:
memory-data-migration
Declaration
export interface MemoryDataMigrationCoordinatorOptions {
stateStore: MemoryDataMigrationStateStore;
now?: () => string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
now | method | now?(): string | Public method; parameters and return type are shown in the signature. |
stateStore | property | stateStore: MemoryDataMigrationStateStore | Public property; its type, readonly modifier and optionality are shown in the signature. |
MemoryDataMigrationPlan
Memory Data Migration Plan interface with 5 public fields or methods.
- Kind: interface
- Import:
import type { MemoryDataMigrationPlan } from '@codesoul-co/hypha-memory'; - Source module:
memory-data-migration
Declaration
export interface MemoryDataMigrationPlan {
id: string;
version: string;
source: string;
target: string;
steps: readonly MemoryDataMigrationStep[];
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
source | property | source: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
steps | property | steps: readonly MemoryDataMigrationStep[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
target | property | target: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
version | property | version: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
MemoryDataMigrationState
Memory Data Migration State interface with 9 public fields or methods.
- Kind: interface
- Import:
import type { MemoryDataMigrationState } from '@codesoul-co/hypha-memory'; - Source module:
memory-data-migration
Declaration
export interface MemoryDataMigrationState {
id: string;
planId: string;
planVersion: string;
planHash: string;
state: 'pending' | 'applying' | 'applied' | 'rolling_back' | 'rolled_back' | 'failed';
appliedStepIds: string[];
activeStepId?: string;
lastError?: ReturnType<typeof normalizeMemoryError>;
updatedAt: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
activeStepId | property | activeStepId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
appliedStepIds | property | appliedStepIds: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
lastError | property | lastError?: import("/Users/erwin/Downloads/codespace/Hypha/packages/memory/dist/contracts").NormalizedMemoryError | Public property; its type, readonly modifier and optionality are shown in the signature. |
planHash | property | planHash: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
planId | property | planId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
planVersion | property | planVersion: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
state | property | state: "failed" | "applied" | "pending" | "applying" | "rolling_back" | "rolled_back" | Public property; its type, readonly modifier and optionality are shown in the signature. |
updatedAt | property | updatedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
MemoryDataMigrationStateStore
Memory Data Migration State Store interface with 2 public fields or methods.
- Kind: interface
- Import:
import type { MemoryDataMigrationStateStore } from '@codesoul-co/hypha-memory'; - Source module:
memory-data-migration
Declaration
export interface MemoryDataMigrationStateStore {
get(planId: string): Promise<MemoryDataMigrationState | null>;
save(state: MemoryDataMigrationState): Promise<void>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
get | method | get(planId: string): Promise<MemoryDataMigrationState | null> | Public method; parameters and return type are shown in the signature. |
save | method | save(state: MemoryDataMigrationState): Promise<void> | Public method; parameters and return type are shown in the signature. |
MemoryDataMigrationStep
Memory Data Migration Step interface with 3 public fields or methods.
- Kind: interface
- Import:
import type { MemoryDataMigrationStep } from '@codesoul-co/hypha-memory'; - Source module:
memory-data-migration
Declaration
export interface MemoryDataMigrationStep {
id: string;
apply(): Promise<void>;
rollback(): Promise<void>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
apply | method | apply(): Promise<void> | Public method; parameters and return type are shown in the signature. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
rollback | method | rollback(): Promise<void> | Public method; parameters and return type are shown in the signature. |
