Class Memco
Constructors
constructor
-
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
Throws
MemcoConfigError If no credential is available, if a token is passed beside client credentials, if only half of the client pair is available, if
tokenLifetimeis given without client credentials or is not a positive whole number, if the host is blank or carries an invalid port, ifMEMCO_API_TLSis neithertruenorfalse, or if the timeout is not positive. - options: MemcoOptions = {}
Properties
Readonlymemory
The memory operations.
Readonlynetworks
The network administration: networks, their members and their groups. Needs an API client's credentials.
Readonlyusers
The user administration: external users and their API keys. Needs an API client's credentials.
ReadonlycredentialKind
Which credential the client resolved from its options and the
environment: token for an API token, apiClient for an API client's
clientId and clientSecret. Only an API client can administer networks
and users, or open a session acting as one of your users.
Methods
connect
-
Verify the connection.
Probes the health endpoint, then proves the credential. With a token that is MemoryOperations.listDomains, which also records the limits the service enforces. With client credentials it is the exchange for a token, and no memory method is called, since an issued token carries no content role. Safe to call more than once; it repeats both, except that a token already issued is reused until it is due for renewal.
Returns Promise<Memco>
This client.
close
-
Close the client.
Waits for calls already in flight rather than cancelling them, then ends the keys of sessions acting for your users that are still live — no key is ended under a call still using it — and then releases the connection. Safe to call more than once, and never throws: a key that cannot be ended is logged by its id at
WARNING, and expires on its own. Any call made afterwards throws MemcoConfigError, and closing a session changes nothing.Returns Promise<void>
[asyncDispose]
-
Close the client at the end of an
await usingblock.Returns Promise<void>
When the channel is closed.
provenance
-
Report which version of the contract this SDK was generated from.
Returns Provenance
The provenance recorded when this package was built.
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, with a token, teaches the client the limits the service enforces on the way, 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 — theawaitin the example below belongs to Memco.connect, andusingonly closes.A client built from an API client's
clientIdandclientSecretexchanges them for a token, and renews it before it expires. Such a token carries no content role of its own, so the service refuses memory calls made with it: that client administers Memco.networks and Memco.users, and reaches memory through sessions acting for your users — MemoryOperations.startSession with anexternalId.Example