@codesoul-co/hypha-memory / memory-server-redis-migration
- Package index:
@codesoul-co/hypha-memory - Source:
packages/memory/src/memory-server-redis-migration.ts - Exports: 9
Using this module
Use the Memory server redis migration module for using the public contracts and operations for this capability boundary. It exports 1 class, 1 function, 7 interfaces.
Import from the package entrypoint
import {
RedisStreamWorkingMemoryMigrationAdapter,
scanRedisWorkingMemoryKeys,
} from '@codesoul-co/hypha-memory';
import type {
RedisScanBudget,
RedisScanReport,
RedisStreamMigrationClient,
RedisStreamWorkingMemoryMigrationAdapterOptions,
WorkingMemoryMigrationAppend,
WorkingMemoryMigrationEntry,
WorkingMemoryMigrationPort,
} from '@codesoul-co/hypha-memory';Usage patterns
- Use the 7 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 1 class 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 |
|---|---|---|---|
RedisStreamWorkingMemoryMigrationAdapter | class | new RedisStreamWorkingMemoryMigrationAdapter(options: RedisStreamWorkingMemoryMigrationAdapterOptions): RedisStreamWorkingMemoryMigrationAdapter | Redis Stream adapter used by dev to execute the Framework-owned migration acceptance suite. |
scanRedisWorkingMemoryKeys | function | scanRedisWorkingMemoryKeys(client: Pick<RedisStreamMigrationClient, "scan">, pattern: string, budget?: RedisScanBudget, nowMs?: () => number): Promise<RedisScanReport> | Scan Redis Working Memory Keys function with 1 public call signature; parameters and return types are listed below. |
RedisScanBudget | interface | interface RedisScanBudget | Redis Scan Budget interface with 4 public fields or methods. |
RedisScanReport | interface | interface RedisScanReport | Redis Scan Report interface with 3 public fields or methods. |
RedisStreamMigrationClient | interface | interface RedisStreamMigrationClient | Redis Stream Migration Client interface with 6 public fields or methods. |
RedisStreamWorkingMemoryMigrationAdapterOptions | interface | interface RedisStreamWorkingMemoryMigrationAdapterOptions | Redis Stream Working Memory Migration Adapter Options interface with 4 public fields or methods. |
WorkingMemoryMigrationAppend | interface | interface WorkingMemoryMigrationAppend | Working Memory Migration Append interface with 5 public fields or methods. |
WorkingMemoryMigrationEntry | interface | interface WorkingMemoryMigrationEntry | Working Memory Migration Entry interface with 4 public fields or methods. |
WorkingMemoryMigrationPort | interface | interface WorkingMemoryMigrationPort | Working Memory Migration Port interface with 4 public fields or methods. |
RedisStreamWorkingMemoryMigrationAdapter
Redis Stream adapter used by dev to execute the Framework-owned migration acceptance suite.
- Kind: class
- Import:
import { RedisStreamWorkingMemoryMigrationAdapter } from '@codesoul-co/hypha-memory'; - Source module:
memory-server-redis-migration
Declaration
export declare class RedisStreamWorkingMemoryMigrationAdapter implements WorkingMemoryMigrationPort {
constructor(options: RedisStreamWorkingMemoryMigrationAdapterOptions);
append<TValue = unknown>(input: WorkingMemoryMigrationAppend<TValue>): Promise<void>;
list<TValue = unknown>(scope: ManagedMemoryScope): Promise<Array<WorkingMemoryMigrationEntry<TValue>>>;
latest<TValue = unknown>(scope: ManagedMemoryScope): Promise<WorkingMemoryMigrationEntry<TValue> | null>;
clearScope(scope: ManagedMemoryScope, budget?: Partial<RedisScanBudget>): Promise<RedisScanReport>;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
append | method | append<TValue = unknown>(input: WorkingMemoryMigrationAppend<TValue>): Promise<void> | Public method; parameters and return type are shown in the signature. |
clearScope | method | clearScope(scope: ManagedMemoryScope, budget?: Partial<RedisScanBudget>): Promise<RedisScanReport> | Public method; parameters and return type are shown in the signature. |
constructor | constructor | (options: RedisStreamWorkingMemoryMigrationAdapterOptions): RedisStreamWorkingMemoryMigrationAdapter | Creates an instance of this class. |
latest | method | latest<TValue = unknown>(scope: ManagedMemoryScope): Promise<WorkingMemoryMigrationEntry<TValue> | null> | Public method; parameters and return type are shown in the signature. |
list | method | list<TValue = unknown>(scope: ManagedMemoryScope): Promise<Array<WorkingMemoryMigrationEntry<TValue>>> | Public method; parameters and return type are shown in the signature. |
scanRedisWorkingMemoryKeys
Scan Redis Working Memory Keys function with 1 public call signature; parameters and return types are listed below.
- Kind: function
- Import:
import { scanRedisWorkingMemoryKeys } from '@codesoul-co/hypha-memory'; - Source module:
memory-server-redis-migration
Declaration
export declare function scanRedisWorkingMemoryKeys(client: Pick<RedisStreamMigrationClient, 'scan'>, pattern: string, budget?: RedisScanBudget, nowMs?: () => number): Promise<RedisScanReport>;Call signature
scanRedisWorkingMemoryKeys(client: Pick<RedisStreamMigrationClient, "scan">, pattern: string, budget?: RedisScanBudget, nowMs?: () => number): Promise<RedisScanReport>Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
client | Pick<RedisStreamMigrationClient, "scan"> | Yes | Required parameter; accepted values are defined by the type column. |
pattern | string | Yes | Required parameter; accepted values are defined by the type column. |
budget | RedisScanBudget | No | Optional parameter; accepted values are defined by the type column. |
nowMs | () => number | No | Optional parameter; accepted values are defined by the type column. |
Returns
- Type:
Promise<RedisScanReport> - Description: The return contract is defined by the type shown above.
RedisScanBudget
Redis Scan Budget interface with 4 public fields or methods.
- Kind: interface
- Import:
import type { RedisScanBudget } from '@codesoul-co/hypha-memory'; - Source module:
memory-server-redis-migration
Declaration
export interface RedisScanBudget {
maxCalls: number;
maxItems: number;
maxDurationMs: number;
count: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
count | property | count: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxCalls | property | maxCalls: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxDurationMs | property | maxDurationMs: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxItems | property | maxItems: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
RedisScanReport
Redis Scan Report interface with 3 public fields or methods.
- Kind: interface
- Import:
import type { RedisScanReport } from '@codesoul-co/hypha-memory'; - Source module:
memory-server-redis-migration
Declaration
export interface RedisScanReport {
keys: string[];
calls: number;
terminated: boolean;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
calls | property | calls: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
keys | property | keys: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
terminated | property | terminated: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
RedisStreamMigrationClient
Redis Stream Migration Client interface with 6 public fields or methods.
- Kind: interface
- Import:
import type { RedisStreamMigrationClient } from '@codesoul-co/hypha-memory'; - Source module:
memory-server-redis-migration
Declaration
export interface RedisStreamMigrationClient {
xadd(key: string, id: '*', field: 'entry', value: string): Promise<string | null>;
xtrim(key: string, strategy: 'MAXLEN', threshold: number): Promise<number>;
xrange(key: string, start: '-', end: '+'): Promise<Array<[string, string[]]>>;
xrevrange(key: string, end: '+', start: '-', countToken: 'COUNT', count: 1): Promise<Array<[string, string[]]>>;
scan(cursor: string, matchToken: 'MATCH', pattern: string, countToken: 'COUNT', count: number): Promise<[string, string[]]>;
del(...keys: string[]): Promise<number>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
del | method | del(...keys: string[]): Promise<number> | Public method; parameters and return type are shown in the signature. |
scan | method | scan(cursor: string, matchToken: "MATCH", pattern: string, countToken: "COUNT", count: number): Promise<[string, string[]]> | Public method; parameters and return type are shown in the signature. |
xadd | method | xadd(key: string, id: "*", field: "entry", value: string): Promise<string | null> | Public method; parameters and return type are shown in the signature. |
xrange | method | xrange(key: string, start: "-", end: "+"): Promise<Array<[string, string[]]>> | Public method; parameters and return type are shown in the signature. |
xrevrange | method | xrevrange(key: string, end: "+", start: "-", countToken: "COUNT", count: 1): Promise<Array<[string, string[]]>> | Public method; parameters and return type are shown in the signature. |
xtrim | method | xtrim(key: string, strategy: "MAXLEN", threshold: number): Promise<number> | Public method; parameters and return type are shown in the signature. |
RedisStreamWorkingMemoryMigrationAdapterOptions
Redis Stream Working Memory Migration Adapter Options interface with 4 public fields or methods.
- Kind: interface
- Import:
import type { RedisStreamWorkingMemoryMigrationAdapterOptions } from '@codesoul-co/hypha-memory'; - Source module:
memory-server-redis-migration
Declaration
export interface RedisStreamWorkingMemoryMigrationAdapterOptions {
client: RedisStreamMigrationClient;
namespace?: string;
scanBudget?: Partial<RedisScanBudget>;
nowMs?: () => number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
client | property | client: RedisStreamMigrationClient | Public property; its type, readonly modifier and optionality are shown in the signature. |
namespace | property | namespace?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
nowMs | method | nowMs?(): number | Public method; parameters and return type are shown in the signature. |
scanBudget | property | scanBudget?: Partial<RedisScanBudget> | Public property; its type, readonly modifier and optionality are shown in the signature. |
WorkingMemoryMigrationAppend
Working Memory Migration Append interface with 5 public fields or methods.
- Kind: interface
- Import:
import type { WorkingMemoryMigrationAppend } from '@codesoul-co/hypha-memory'; - Source module:
memory-server-redis-migration
Declaration
export interface WorkingMemoryMigrationAppend<TValue = unknown> {
id: string;
scope: ManagedMemoryScope;
value: TValue;
createdAt: string;
maxMessages: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
createdAt | property | createdAt: 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. |
maxMessages | property | maxMessages: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: ManagedMemoryScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
value | property | value: TValue | Public property; its type, readonly modifier and optionality are shown in the signature. |
WorkingMemoryMigrationEntry
Working Memory Migration Entry interface with 4 public fields or methods.
- Kind: interface
- Import:
import type { WorkingMemoryMigrationEntry } from '@codesoul-co/hypha-memory'; - Source module:
memory-server-redis-migration
Declaration
export interface WorkingMemoryMigrationEntry<TValue = unknown> {
id: string;
scopeHash: string;
value: TValue;
createdAt: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
createdAt | property | createdAt: 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. |
scopeHash | property | scopeHash: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
value | property | value: TValue | Public property; its type, readonly modifier and optionality are shown in the signature. |
WorkingMemoryMigrationPort
Working Memory Migration Port interface with 4 public fields or methods.
- Kind: interface
- Import:
import type { WorkingMemoryMigrationPort } from '@codesoul-co/hypha-memory'; - Source module:
memory-server-redis-migration
Declaration
export interface WorkingMemoryMigrationPort {
append<TValue = unknown>(input: WorkingMemoryMigrationAppend<TValue>): Promise<void>;
list<TValue = unknown>(scope: ManagedMemoryScope): Promise<Array<WorkingMemoryMigrationEntry<TValue>>>;
latest<TValue = unknown>(scope: ManagedMemoryScope): Promise<WorkingMemoryMigrationEntry<TValue> | null>;
clearScope(scope: ManagedMemoryScope, budget?: Partial<RedisScanBudget>): Promise<RedisScanReport>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
append | method | append<TValue = unknown>(input: WorkingMemoryMigrationAppend<TValue>): Promise<void> | Public method; parameters and return type are shown in the signature. |
clearScope | method | clearScope(scope: ManagedMemoryScope, budget?: Partial<RedisScanBudget>): Promise<RedisScanReport> | Public method; parameters and return type are shown in the signature. |
latest | method | latest<TValue = unknown>(scope: ManagedMemoryScope): Promise<WorkingMemoryMigrationEntry<TValue> | null> | Public method; parameters and return type are shown in the signature. |
list | method | list<TValue = unknown>(scope: ManagedMemoryScope): Promise<Array<WorkingMemoryMigrationEntry<TValue>>> | Public method; parameters and return type are shown in the signature. |
