Skip to content

@codesoul-co/hypha-memory / memory-server-consumer-migration

Using this module

Use the Memory server consumer migration module for using the public contracts and operations for this capability boundary. It exports 1 constant, 3 functions, 7 interfaces, 2 types.

Import from the package entrypoint

ts
import {
  allowedLegacyAdapterResponsibilities,
  assertCanonicalConsumerSet,
  createMemoryServerCanonicalMigrationState,
  transitionMemoryServerCanonicalMigration,
} from '@codesoul-co/hypha-memory';

import type {
  CanonicalProfileSwitchObservation,
  MemoryServerCanonicalMigrationState,
  MemoryServerMigrationReconciliation,
  MemoryServerMigrationRetirementEvidence,
  MemoryServerMigrationTransitionEvent,
  MemoryServerMigrationTransitionInput,
  MemoryServerMigrationTransitionResult,
  AllowedLegacyAdapterResponsibility,
} from '@codesoul-co/hypha-memory';

// The complete export list is documented below.

Usage patterns

  • Use the 9 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 3 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.
  • The 1 constant/enum export provides stable values, schemas, definitions, or defaults. Reuse these exports instead of copying internal values into an application.

Public exports

SymbolKindSignatureDescription
allowedLegacyAdapterResponsibilitiesconstantconst allowedLegacyAdapterResponsibilities: readonly ["delegate", "scope_mapping", "error_mapping"]Allowed Legacy Adapter Responsibilities constant exported by the memory-server-consumer-migration module.
assertCanonicalConsumerSetfunctionassertCanonicalConsumerSet(bindings: Partial<Record<MemoryServerConsumer, string>>, expectedServiceInstanceId: string, consumers: readonly MemoryServerConsumer[]): voidAssert Canonical Consumer Set function with 1 public call signature; parameters and return types are listed below.
createMemoryServerCanonicalMigrationStatefunctioncreateMemoryServerCanonicalMigrationState(input: { migrationId: string; revision: string; createdAt: string; }): MemoryServerCanonicalMigrationStateCreate Memory Server Canonical Migration State function with 1 public call signature; parameters and return types are listed below.
transitionMemoryServerCanonicalMigrationfunctiontransitionMemoryServerCanonicalMigration(current: MemoryServerCanonicalMigrationState, input: MemoryServerMigrationTransitionInput): MemoryServerMigrationTransitionResultTransition Memory Server Canonical Migration function with 1 public call signature; parameters and return types are listed below.
CanonicalProfileSwitchObservationinterfaceinterface CanonicalProfileSwitchObservationCanonical Profile Switch Observation interface with 4 public fields or methods.
MemoryServerCanonicalMigrationStateinterfaceinterface MemoryServerCanonicalMigrationStateMemory Server Canonical Migration State interface with 8 public fields or methods.
MemoryServerMigrationReconciliationinterfaceinterface MemoryServerMigrationReconciliationMemory Server Migration Reconciliation interface with 4 public fields or methods.
MemoryServerMigrationRetirementEvidenceinterfaceinterface MemoryServerMigrationRetirementEvidenceMemory Server Migration Retirement Evidence interface with 5 public fields or methods.
MemoryServerMigrationTransitionEventinterfaceinterface MemoryServerMigrationTransitionEventMemory Server Migration Transition Event interface with 10 public fields or methods.
MemoryServerMigrationTransitionInputinterfaceinterface MemoryServerMigrationTransitionInputMemory Server Migration Transition Input interface with 7 public fields or methods.
MemoryServerMigrationTransitionResultinterfaceinterface MemoryServerMigrationTransitionResultMemory Server Migration Transition Result interface with 2 public fields or methods.
AllowedLegacyAdapterResponsibilitytypetype AllowedLegacyAdapterResponsibility = (typeof allowedLegacyAdapterResponsibilities)[number]Public type alias for Allowed Legacy Adapter Responsibility; the declaration contains its complete type expression.
MemoryServerMigrationPhasetypetype MemoryServerMigrationPhase = 'planned' | 'shadow_read' | 'bounded_dual_write' | 'verify' | 'cutover' | 'retire' | 'rollback'Public type alias for Memory Server Migration Phase; the declaration contains its complete type expression.

allowedLegacyAdapterResponsibilities

Allowed Legacy Adapter Responsibilities constant exported by the memory-server-consumer-migration module.

Declaration

text
export declare const allowedLegacyAdapterResponsibilities: readonly ["delegate", "scope_mapping", "error_mapping"];

assertCanonicalConsumerSet

Assert Canonical Consumer Set function with 1 public call signature; parameters and return types are listed below.

Declaration

text
export declare function assertCanonicalConsumerSet(bindings: Partial<Record<MemoryServerConsumer, string>>, expectedServiceInstanceId: string, consumers: readonly MemoryServerConsumer[]): void;

Call signature

text
assertCanonicalConsumerSet(bindings: Partial<Record<MemoryServerConsumer, string>>, expectedServiceInstanceId: string, consumers: readonly MemoryServerConsumer[]): void

Parameters

ParameterTypeRequiredDescription
bindingsPartial<Record<MemoryServerConsumer, string>>YesRequired parameter; accepted values are defined by the type column.
expectedServiceInstanceIdstringYesRequired parameter; accepted values are defined by the type column.
consumersreadonly MemoryServerConsumer[]YesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: void
  • Description: Returns no value.

createMemoryServerCanonicalMigrationState

Create Memory Server Canonical Migration State function with 1 public call signature; parameters and return types are listed below.

Declaration

text
export declare function createMemoryServerCanonicalMigrationState(input: {
    migrationId: string;
    revision: string;
    createdAt: string;
}): MemoryServerCanonicalMigrationState;

Call signature

text
createMemoryServerCanonicalMigrationState(input: { migrationId: string; revision: string; createdAt: string; }): MemoryServerCanonicalMigrationState

Parameters

ParameterTypeRequiredDescription
input{ migrationId: string; revision: string; createdAt: string; }YesRequired parameter; accepted values are defined by the type column.

Returns

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

transitionMemoryServerCanonicalMigration

Transition Memory Server Canonical Migration function with 1 public call signature; parameters and return types are listed below.

Declaration

text
export declare function transitionMemoryServerCanonicalMigration(current: MemoryServerCanonicalMigrationState, input: MemoryServerMigrationTransitionInput): MemoryServerMigrationTransitionResult;

Call signature

text
transitionMemoryServerCanonicalMigration(current: MemoryServerCanonicalMigrationState, input: MemoryServerMigrationTransitionInput): MemoryServerMigrationTransitionResult

Parameters

ParameterTypeRequiredDescription
currentMemoryServerCanonicalMigrationStateYesRequired parameter; accepted values are defined by the type column.
inputMemoryServerMigrationTransitionInputYesRequired parameter; accepted values are defined by the type column.

Returns

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

CanonicalProfileSwitchObservation

Canonical Profile Switch Observation interface with 4 public fields or methods.

Declaration

text
export interface CanonicalProfileSwitchObservation {
    profileId: string;
    expectedProviderId: string;
    observedReadProviderId: string;
    observedWriteProviderId: string;
}

Contract members

MemberKindSignatureDescription
expectedProviderIdpropertyexpectedProviderId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
observedReadProviderIdpropertyobservedReadProviderId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
observedWriteProviderIdpropertyobservedWriteProviderId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
profileIdpropertyprofileId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryServerCanonicalMigrationState

Memory Server Canonical Migration State interface with 8 public fields or methods.

Declaration

text
export interface MemoryServerCanonicalMigrationState {
    migrationId: string;
    revision: string;
    phase: MemoryServerMigrationPhase;
    activePath: 'legacy' | 'dual' | 'canonical';
    updatedAt: string;
    dualWrite?: {
        deadlineAt: string;
        idempotencyKey: string;
        checkpointRef: string;
    };
    reconciliation: MemoryServerMigrationReconciliation;
    retirement?: MemoryServerMigrationRetirementEvidence;
}

Contract members

MemberKindSignatureDescription
activePathpropertyactivePath: "legacy" | "dual" | "canonical"Public property; its type, readonly modifier and optionality are shown in the signature.
dualWritepropertydualWrite?: { deadlineAt: string; idempotencyKey: string; checkpointRef: string; }Public property; its type, readonly modifier and optionality are shown in the signature.
migrationIdpropertymigrationId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
phasepropertyphase: MemoryServerMigrationPhasePublic property; its type, readonly modifier and optionality are shown in the signature.
reconciliationpropertyreconciliation: MemoryServerMigrationReconciliationPublic property; its type, readonly modifier and optionality are shown in the signature.
retirementpropertyretirement?: MemoryServerMigrationRetirementEvidencePublic property; its type, readonly modifier and optionality are shown in the signature.
revisionpropertyrevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
updatedAtpropertyupdatedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryServerMigrationReconciliation

Memory Server Migration Reconciliation interface with 4 public fields or methods.

Declaration

text
export interface MemoryServerMigrationReconciliation {
    status: 'not_run' | 'passed' | 'failed';
    comparedRecords: number;
    mismatchCount: number;
    shadowResult: 'not_run' | 'matched' | 'mismatched';
}

Contract members

MemberKindSignatureDescription
comparedRecordspropertycomparedRecords: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
mismatchCountpropertymismatchCount: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
shadowResultpropertyshadowResult: "not_run" | "matched" | "mismatched"Public property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus: "failed" | "not_run" | "passed"Public property; its type, readonly modifier and optionality are shown in the signature.

MemoryServerMigrationRetirementEvidence

Memory Server Migration Retirement Evidence interface with 5 public fields or methods.

Declaration

text
export interface MemoryServerMigrationRetirementEvidence {
    legacyReadTraffic: number;
    legacyWriteTraffic: number;
    legacyImports: number;
    legacyRegistrations: number;
    rollbackWindowEndsAt: string;
}

Contract members

MemberKindSignatureDescription
legacyImportspropertylegacyImports: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
legacyReadTrafficpropertylegacyReadTraffic: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
legacyRegistrationspropertylegacyRegistrations: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
legacyWriteTrafficpropertylegacyWriteTraffic: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
rollbackWindowEndsAtpropertyrollbackWindowEndsAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryServerMigrationTransitionEvent

Memory Server Migration Transition Event interface with 10 public fields or methods.

Declaration

text
export interface MemoryServerMigrationTransitionEvent {
    type: 'memory.server_migration.transitioned';
    migrationId: string;
    migrationRevision: string;
    fromPhase: MemoryServerMigrationPhase;
    toPhase: MemoryServerMigrationPhase;
    activePath: 'legacy' | 'dual' | 'canonical';
    shadowResult: MemoryServerMigrationReconciliation['shadowResult'];
    checkpointRef?: string;
    reason: string;
    occurredAt: string;
}

Contract members

MemberKindSignatureDescription
activePathpropertyactivePath: "legacy" | "dual" | "canonical"Public property; its type, readonly modifier and optionality are shown in the signature.
checkpointRefpropertycheckpointRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
fromPhasepropertyfromPhase: MemoryServerMigrationPhasePublic property; its type, readonly modifier and optionality are shown in the signature.
migrationIdpropertymigrationId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
migrationRevisionpropertymigrationRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
occurredAtpropertyoccurredAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
shadowResultpropertyshadowResult: "not_run" | "matched" | "mismatched"Public property; its type, readonly modifier and optionality are shown in the signature.
toPhasepropertytoPhase: MemoryServerMigrationPhasePublic property; its type, readonly modifier and optionality are shown in the signature.
typepropertytype: "memory.server_migration.transitioned"Public property; its type, readonly modifier and optionality are shown in the signature.

MemoryServerMigrationTransitionInput

Memory Server Migration Transition Input interface with 7 public fields or methods.

Declaration

text
export interface MemoryServerMigrationTransitionInput {
    targetPhase: Exclude<MemoryServerMigrationPhase, 'planned'>;
    expectedRevision: string;
    occurredAt: string;
    reason: string;
    dualWrite?: {
        deadlineAt: string;
        idempotencyKey: string;
        checkpointRef: string;
    };
    reconciliation?: MemoryServerMigrationReconciliation;
    retirement?: MemoryServerMigrationRetirementEvidence;
}

Contract members

MemberKindSignatureDescription
dualWritepropertydualWrite?: { deadlineAt: string; idempotencyKey: string; checkpointRef: string; }Public property; its type, readonly modifier and optionality are shown in the signature.
expectedRevisionpropertyexpectedRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
occurredAtpropertyoccurredAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reconciliationpropertyreconciliation?: MemoryServerMigrationReconciliationPublic property; its type, readonly modifier and optionality are shown in the signature.
retirementpropertyretirement?: MemoryServerMigrationRetirementEvidencePublic property; its type, readonly modifier and optionality are shown in the signature.
targetPhasepropertytargetPhase: "verify" | "shadow_read" | "bounded_dual_write" | "cutover" | "retire" | "rollback"Public property; its type, readonly modifier and optionality are shown in the signature.

MemoryServerMigrationTransitionResult

Memory Server Migration Transition Result interface with 2 public fields or methods.

Declaration

text
export interface MemoryServerMigrationTransitionResult {
    state: MemoryServerCanonicalMigrationState;
    event: MemoryServerMigrationTransitionEvent;
}

Contract members

MemberKindSignatureDescription
eventpropertyevent: MemoryServerMigrationTransitionEventPublic property; its type, readonly modifier and optionality are shown in the signature.
statepropertystate: MemoryServerCanonicalMigrationStatePublic property; its type, readonly modifier and optionality are shown in the signature.

AllowedLegacyAdapterResponsibility

Public type alias for Allowed Legacy Adapter Responsibility; the declaration contains its complete type expression.

Declaration

text
export type AllowedLegacyAdapterResponsibility = (typeof allowedLegacyAdapterResponsibilities)[number];

MemoryServerMigrationPhase

Public type alias for Memory Server Migration Phase; the declaration contains its complete type expression.

Declaration

text
export type MemoryServerMigrationPhase = 'planned' | 'shadow_read' | 'bounded_dual_write' | 'verify' | 'cutover' | 'retire' | 'rollback';