Skip to content

ServiceClient

Defined in: service-client.ts:35

Client-side counterpart of the server’s Service<T> — the same six method names, dispatched as REST calls, plus the similar() vector-search convention and real-time on()/off() service events over socket.io.

T = unknown

new ServiceClient<T>(path, rest, sockets?, scheduler?): ServiceClient<T>

Defined in: service-client.ts:36

string

RestDispatcher

SocketManager

BatchScheduler

ServiceClient<T>

get realtime(): boolean

Defined in: service-client.ts:118

True when the client was created with the socket option — on()/off() are available.

boolean

create(data, params?): Promise<T>

Defined in: service-client.ts:53

Partial<T>

ClientParams

Promise<T>


find(params?): Promise<T[] | Paginated<T>>

Defined in: service-client.ts:43

ClientParams

Promise<T[] | Paginated<T>>


get(id, params?): Promise<T>

Defined in: service-client.ts:48

Id

ClientParams

Promise<T>


off(event, handler): this

Defined in: service-client.ts:127

ServiceEvent

(data) => void

this


on(event, handler): this

Defined in: service-client.ts:122

ServiceEvent

(data) => void

this


patch(id, data, params?): Promise<T>

Defined in: service-client.ts:63

Id

Partial<T>

ClientParams

Promise<T>


remove(id, params?): Promise<T>

Defined in: service-client.ts:68

Id

ClientParams

Promise<T>


similar(data, params?): Promise<T & object[]>

Defined in: service-client.ts:113

Vector-search convention (custom methods dispatch as POST /:service/:method). The service must register similar in its methods — see VectorRepositoryService.

SimilarQuery

ClientParams

Promise<T & object[]>


update(id, data, params?): Promise<T>

Defined in: service-client.ts:58

Id

Partial<T>

ClientParams

Promise<T>


upload(file, options?): Promise<T>

Defined in: service-client.ts:94

Upload a file as multipart/form-data to a service whose create (or, with options.id, patch) runs @mantlejs/storage’s handleUpload(). Ordinary fields go before the file part, which handleUpload() merges into context.data. Never batched — POST /batch is JSON-only.

Blob

UploadOptions = {}

Promise<T>