Documentation / @warp-drive/core / request / Future
Defined in: warp-drive-packages/core/src/request/-private/types.ts:37
A Future is a Promise which resolves to a StructuredDocument while providing the ability to abort
the underlying request, getStream
the response before the outer promise resolves;
Future
Extends
Promise
<StructuredDataDocument
<T
>>
Type Parameters
T
T
Properties
___(unique) Symbol(IS_FUTURE)
___(unique) Symbol(IS_FUTURE): true;
Defined in: warp-drive-packages/core/src/request/-private/types.ts:38
[toStringTag]
readonly [toStringTag]: string;
Defined in: node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:176
Inherited from
Promise.[toStringTag]
id
id: number;
Defined in: warp-drive-packages/core/src/request/-private/types.ts:83
The id of the associated request, if any, as assigned by the RequestManager
lid
lid:
| null
| StableDocumentIdentifier;
Defined in: warp-drive-packages/core/src/request/-private/types.ts:73
The identifier of the associated request, if any, as assigned by the CacheHandler.
Methods
abort()
abort(reason?): void;
Defined in: warp-drive-packages/core/src/request/-private/types.ts:46
Cancel this request by firing the AbortController's signal.
Parameters
reason?
string
optional reason for aborting the request
Returns
void
catch()
catch<TResult>(onrejected?): Promise<
| StructuredDataDocument<T>
| TResult>;
Defined in: node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es5.d.ts:1557
Attaches a callback for only the rejection of the Promise.
Type Parameters
TResult
TResult
= never
Parameters
onrejected?
The callback to execute when the Promise is rejected.
null
| (reason
) => TResult
| PromiseLike
<TResult
>
Returns
Promise
< | StructuredDataDocument
<T
> | TResult
>
A Promise for the completion of the callback.
Inherited from
Promise.catch
finally()
finally(onfinally?): Promise<StructuredDataDocument<T>>;
Defined in: node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.promise.d.ts:29
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?
The callback to execute when the Promise is settled (fulfilled or rejected).
null
| () => void
Returns
Promise
<StructuredDataDocument
<T
>>
A Promise for the completion of the callback.
Inherited from
Promise.finally
getStream()
getStream(): Promise<null | ReadableStream<any>>;
Defined in: warp-drive-packages/core/src/request/-private/types.ts:53
Get the response stream, if any, once made available.
Returns
Promise
<null
| ReadableStream
<any
>>
onFinalize()
onFinalize(cb): void;
Defined in: warp-drive-packages/core/src/request/-private/types.ts:63
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()
then<TResult1, TResult2>(onfulfilled?, onrejected?): Promise<TResult1 | TResult2>;
Defined in: node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es5.d.ts:1550
Attaches callbacks for the resolution and/or rejection of the Promise.
Type Parameters
TResult1
TResult1
= StructuredDataDocument
<T
>
TResult2
TResult2
= never
Parameters
onfulfilled?
The callback to execute when the Promise is resolved.
null
| (value
) => TResult1
| PromiseLike
<TResult1
>
onrejected?
The callback to execute when the Promise is rejected.
null
| (reason
) => TResult2
| PromiseLike
<TResult2
>
Returns
Promise
<TResult1
| TResult2
>
A Promise for the completion of which ever callback is executed.
Inherited from
Promise.then