Skip to content
module@warp-drive/core/request

Interface Future<T> ​

Defined in: warp-drive-packages/core/src/request/-private/types.ts:68

A Future is a Promise which resolves or rejects with a StructuredDocument while providing the ability to abort the underlying request, and access the response stream before the outer promise resolves;

Extends ​

Type Parameters ​

T ​

T

Methods ​

abort() ​

ts
abort(reason?): void;

Defined in: warp-drive-packages/core/src/request/-private/types.ts:83

Cancel this request by firing the AbortController's signal.

This method can be used as an action or event handler as its context is bound to the Future instance.

Parameters ​

reason? ​

string

optional reason for aborting the request

Returns ​

void


catch() ​

ts
catch<TResult>(onrejected?): Promise<
  | StructuredDataDocument<T>
| TResult>;

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1562

Attaches a callback for only the rejection of the Promise.

Type Parameters ​

TResult ​

TResult = never

Parameters ​

onrejected? ​

((reason) => TResult | PromiseLike<TResult>) | null

The callback to execute when the Promise is rejected.

Returns ​

Promise< | StructuredDataDocument<T> | TResult>

A Promise for the completion of the callback.

Inherited from ​

ts
Promise.catch

finally() ​

ts
finally(onfinally?): Promise<StructuredDataDocument<T>>;

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2018.promise.d.ts:27

Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.

Parameters ​

onfinally? ​

(() => void) | null

The callback to execute when the Promise is settled (fulfilled or rejected).

Returns ​

Promise<StructuredDataDocument<T>>

A Promise for the completion of the callback.

Inherited from ​

ts
Promise.finally

getStream() ​

ts
getStream(): Promise<
  | ReadableStream<any>
| null>;

Defined in: warp-drive-packages/core/src/request/-private/types.ts:92

Get the response stream, if any, once made available.

This method can be used as an action or event handler as its context is bound to the Future instance.

Returns ​

Promise< | ReadableStream<any> | null>


onFinalize() ​

ts
onFinalize(cb): void;

Defined in: warp-drive-packages/core/src/request/-private/types.ts:100

Run a callback when this request completes. Use sparingly, mostly useful for instrumentation and infrastructure.

Parameters ​

cb ​

() => void

the callback to run

Returns ​

void


then() ​

ts
then<TResult1, TResult2>(onfulfilled?, onrejected?): Promise<TResult1 | TResult2>;

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1555

Attaches callbacks for the resolution and/or rejection of the Promise.

Type Parameters ​

TResult1 ​

TResult1 = StructuredDataDocument<T>

TResult2 ​

TResult2 = never

Parameters ​

onfulfilled? ​

((value) => TResult1 | PromiseLike<TResult1>) | null

The callback to execute when the Promise is resolved.

onrejected? ​

((reason) => TResult2 | PromiseLike<TResult2>) | null

The callback to execute when the Promise is rejected.

Returns ​

Promise<TResult1 | TResult2>

A Promise for the completion of which ever callback is executed.

Inherited from ​

ts
Promise.then

Properties ​

[toStringTag] ​

ts
readonly [toStringTag]: string;

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:174

Inherited from ​

ts
Promise.[toStringTag]

id ​

ts
id: number;

Defined in: warp-drive-packages/core/src/request/-private/types.ts:115

The id of the associated request, if any, as assigned by the RequestManager

This is not unique across Manager instances and cannot be used to identify or dedupe requests.


lid ​

ts
lid: RequestKey | null;

Defined in: warp-drive-packages/core/src/request/-private/types.ts:106

The identifier of the associated request, if any, as assigned by the CacheHandler.

Released under the MIT License.