Class: NexusClient
client.NexusClient
Client for standalone Nexus operations. Access via Client.nexus.
Use createServiceClient to get a typed service client, or call the namespace-wide list, count, and getHandle methods directly.
See
Nexus Standalone Operations are experimental.
Hierarchy
-
BaseClient↳
NexusClient
Constructors
constructor
• new NexusClient(options?): NexusClient
Parameters
| Name | Type |
|---|---|
options? | NexusClientOptions |
Returns
Overrides
BaseClient.constructor
Properties
connection
• Readonly connection: ConnectionLike
The underlying connection or NativeConnection | native connection used by this client.
Clients are cheap to create, but connections are expensive. Where it makes sense,
a single connection may and should be reused by multiple Clients.
Inherited from
BaseClient.connection
options
• Readonly options: LoadedNexusClientOptions
Methods
count
▸ count(query?): Promise<NexusOperationExecutionCount>
Count standalone Nexus operations matching a visibility query.
Nexus Standalone Operations are experimental.
Parameters
| Name | Type |
|---|---|
query? | string |
Returns
Promise<NexusOperationExecutionCount>
createServiceClient
▸ createServiceClient<T>(options): NexusServiceClient<T>
Create a typed service client for starting and executing Nexus operations on a specific endpoint + service.
Nexus Standalone Operations are experimental.
Type parameters
| Name | Type |
|---|---|
T | extends ServiceDefinition<OperationMap> |
Parameters
| Name | Type |
|---|---|
options | Object |
options.endpoint | string |
options.service | T |
Returns
getHandle
▸ getHandle<T>(operationId, options?): NexusOperationHandle<NexusOperationHandleResult<T>>
Get a handle to an existing standalone Nexus operation.
If GetNexusOperationHandleOptions.runId is not provided, operations on the handle (like NexusOperationHandle.result) will target the latest run.
Nexus Standalone Operations are experimental.
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
operationId | string |
options? | GetNexusOperationHandleOptions |
Returns
NexusOperationHandle<NexusOperationHandleResult<T>>
list
▸ list(options?): AsyncIterable<NexusOperationExecution>
List standalone Nexus operations matching a visibility query.
Nexus Standalone Operations are experimental.
Parameters
| Name | Type |
|---|---|
options? | ListNexusOperationsOptions |
Returns
AsyncIterable<NexusOperationExecution>
withAbortSignal
▸ withAbortSignal<R>(abortSignal, fn): Promise<R>
Set an AbortSignal that, when aborted, cancels any ongoing service requests executed in
fn's scope. This will locally result in the request call throwing a _grpc.ServiceError|ServiceError
with code _grpc.status.CANCELLED|CANCELLED; see isGrpcCancelledError.
This method is only a convenience wrapper around Connection.withAbortSignal.
Type parameters
| Name |
|---|
R |
Parameters
| Name | Type |
|---|---|
abortSignal | AbortSignal |
fn | () => Promise<R> |
Returns
Promise<R>
value returned from fn
See
https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
Inherited from
BaseClient.withAbortSignal
withDeadline
▸ withDeadline<R>(deadline, fn): Promise<R>
Set a deadline for any service requests executed in fn's scope.
The deadline is a point in time after which any pending gRPC request will be considered as failed; this will locally result in the request call throwing a _grpc.ServiceError|ServiceError with code _grpc.status.DEADLINE_EXCEEDED|DEADLINE_EXCEEDED; see isGrpcDeadlineError.
It is stronly recommended to explicitly set deadlines. If no deadline is set, then it is possible for the client to end up waiting forever for a response.
This method is only a convenience wrapper around Connection.withDeadline.
Type parameters
| Name |
|---|
R |
Parameters
| Name | Type | Description |
|---|---|---|
deadline | number | Date | a point in time after which the request will be considered as failed; either a Date object, or a number of milliseconds since the Unix epoch (UTC). |
fn | () => Promise<R> | - |
Returns
Promise<R>
the value returned from fn
See
https://grpc.io/docs/guides/deadlines/
Inherited from
BaseClient.withDeadline
withMetadata
▸ withMetadata<R>(metadata, fn): Promise<R>
Set metadata for any service requests executed in fn's scope.
This method is only a convenience wrapper around Connection.withMetadata.
Type parameters
| Name |
|---|
R |
Parameters
| Name | Type |
|---|---|
metadata | Metadata |
fn | () => Promise<R> |
Returns
Promise<R>
returned value of fn
Inherited from
BaseClient.withMetadata