From 57b44c151f5eb9591cc9e05c8ded0715061d8960 Mon Sep 17 00:00:00 2001 From: "E. Cooper" Date: Mon, 7 Oct 2024 14:42:46 -0700 Subject: [PATCH] Add backwards compatible type params for HTTPRequest and HTTPStreamRequest --- src/http-client/http-client.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/http-client/http-client.ts b/src/http-client/http-client.ts index 66ed767c..1fb49124 100644 --- a/src/http-client/http-client.ts +++ b/src/http-client/http-client.ts @@ -6,15 +6,17 @@ import { SupportedFaunaAPIPaths } from "./paths"; /** * An object representing an http request. * The {@link Client} provides this to the {@link HTTPClient} implementation. + * + * @typeParam T - The expected type of the request sent to fauna. */ -export type HTTPRequest = { +export type HTTPRequest = { /** * The timeout of each http request, in milliseconds. */ client_timeout_ms: number; - /** The encoded Fauna query to send */ - data: QueryRequest; + /** The encoded request to send */ + data: T; /** Headers in object format */ headers: Record; @@ -73,11 +75,13 @@ export interface HTTPClient { /** * An object representing an http request. * The {@link Client} provides this to the {@link HTTPStreamClient} implementation. + * + * @typeParam T - The expected type of the request sent to fauna. */ -export type HTTPStreamRequest = { - /** The encoded Fauna query to send */ +export type HTTPStreamRequest = { + /** The encoded Fauna request to send */ // TODO: Allow type to be a QueryRequest once implemented by the db - data: StreamRequest; + data: T; /** Headers in object format */ headers: Record;