Skip to content

Commit a5548d2

Browse files
committed
Revert unnecessary change
1 parent 315c7a1 commit a5548d2

File tree

3 files changed

+99
-100
lines changed

3 files changed

+99
-100
lines changed

src/types/http-requests.ts

Lines changed: 0 additions & 99 deletions
This file was deleted.

src/types/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export * from "./experimental-features.js";
2-
export * from "./http-requests.js";
32
export * from "./network.js";
43
export * from "./search-parameters.js";
54
export * from "./search-response.js";

src/types/types.ts

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,108 @@
44
// Definitions: https://github.com/meilisearch/meilisearch-js
55
// TypeScript Version: ^5.8.2
66

7+
import type { WaitOptions } from "./task-and-batch.js";
78
import type { FilterExpression } from "./search-parameters.js";
89
import type { RecordAny } from "./shared.js";
910

11+
/**
12+
* Shape of allowed record object that can be appended to a
13+
* {@link URLSearchParams}.
14+
*/
15+
export type URLSearchParamsRecord = Record<
16+
string,
17+
string | string[] | number | number[] | boolean | null | undefined
18+
>;
19+
20+
/**
21+
* {@link RequestInit} without {@link RequestInit.body} and
22+
* {@link RequestInit.method} properties.
23+
*/
24+
export type ExtraRequestInit = Omit<RequestInit, "body" | "method">;
25+
26+
/** Same as {@link ExtraRequestInit} but without {@link ExtraRequestInit.signal}. */
27+
export type BaseRequestInit = Omit<ExtraRequestInit, "signal">;
28+
29+
/**
30+
* Same as {@link BaseRequestInit} but with its headers property forced as a
31+
* {@link Headers} object.
32+
*/
33+
export type HttpRequestsRequestInit = Omit<BaseRequestInit, "headers"> & {
34+
headers: Headers;
35+
};
36+
37+
/** Main configuration object for the meilisearch client. */
38+
export type Config = {
39+
/**
40+
* The base URL for reaching a meilisearch instance.
41+
*
42+
* @remarks
43+
* Protocol and trailing slash can be omitted.
44+
*/
45+
host: string;
46+
/**
47+
* API key for interacting with a meilisearch instance.
48+
*
49+
* @see {@link https://www.meilisearch.com/docs/learn/security/basic_security}
50+
*/
51+
apiKey?: string;
52+
/**
53+
* Custom strings that will be concatenated to the "X-Meilisearch-Client"
54+
* header on each request.
55+
*/
56+
clientAgents?: string[];
57+
/** Base request options that may override the default ones. */
58+
requestInit?: BaseRequestInit;
59+
/**
60+
* Custom function that can be provided in place of {@link fetch}.
61+
*
62+
* @remarks
63+
* API response errors will have to be handled manually with this as well.
64+
* @deprecated This will be removed in a future version. See
65+
* {@link https://github.com/meilisearch/meilisearch-js/issues/1824 | issue}.
66+
*/
67+
httpClient?: (...args: Parameters<typeof fetch>) => Promise<unknown>;
68+
/** Timeout in milliseconds for each HTTP request. */
69+
timeout?: number;
70+
/** Options for waiting on tasks. */
71+
defaultWaitOptions?: WaitOptions;
72+
};
73+
74+
/** Main options of a request. */
75+
export type MainRequestOptions = {
76+
/** The path or subpath of the URL to make a request to. */
77+
path: string;
78+
/** The REST method of the request. */
79+
method?: string;
80+
/** The search parameters of the URL. */
81+
params?: URLSearchParamsRecord;
82+
/**
83+
* {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type | Content-Type}
84+
* passed to request {@link Headers}.
85+
*/
86+
contentType?: string;
87+
/**
88+
* The body of the request.
89+
*
90+
* @remarks
91+
* This only really supports string for now (any other type gets stringified)
92+
* but it could support more in the future.
93+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#body}
94+
*/
95+
body?: string | boolean | number | object | null;
96+
/**
97+
* An extra, more limited {@link RequestInit}, that may override some of the
98+
* options.
99+
*/
100+
extraRequestInit?: ExtraRequestInit;
101+
};
102+
103+
/**
104+
* {@link MainRequestOptions} without {@link MainRequestOptions.method}, for
105+
* method functions.
106+
*/
107+
export type RequestOptions = Omit<MainRequestOptions, "method">;
108+
10109
///
11110
/// Resources
12111
///

0 commit comments

Comments
 (0)