Skip to Content

Class Memco

A connection to Memco Shared Memory.

Constructing one resolves settings and opens a channel but sends nothing. Memco.connect runs the two checks that prove the connection works — and, on the way, teaches the client the limits the service enforces, which is what lets later calls refuse an over-long field before spending a round trip on it. Nothing else runs them: a client is not awaitable, so await using client = new Memco(...) opens no connection at all — the await in the example below belongs to Memco.connect, and using only closes.

import { Memco } from '@memco/memcoai'

await using client = await new Memco().connect() // reads MEMCO_API_TOKEN
const { domains } = await client.memory.listDomains()
Index
  • Parameters

    • options: MemcoOptions = {}

      Credential, endpoint and per-call deadline, each falling back to the environment where one supplies it and then to a built-in default.

    Returns Memco

    MemcoConfigError If no credential is available, if the host is blank or carries an invalid port, or if the timeout is not positive.

The memory operations.

  • Verify the connection.

    Probes the health endpoint, then calls MemoryOperations.listDomains, which proves the credential and records the limits the service enforces. Safe to call more than once; it simply repeats both.

    Returns Promise<Memco>

    This client.

    MemcoUnavailableError If the service cannot be reached.

    MemcoUnhealthyError If it answers but is not serving.

    MemcoAuthenticationError If the credential is rejected.

    MemcoSunsetError If what this client uses is past its sunset date.

    MemcoConfigError If the client has been closed.

  • Close the channel.

    Waits for calls already in flight rather than cancelling them, then releases the connection. Safe to call more than once. Any call made afterwards throws MemcoConfigError.

    Returns Promise<void>

  • Close the client at the end of an await using block.

    Returns Promise<void>

    When the channel is closed.

  • Report which version of the contract this SDK was generated from.

    Returns Provenance

    The provenance recorded when this package was built.

    client.provenance().serverCommit  // the commit this package was built from