aniql 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -12
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { FieldsSelection, Mutation, MutationGenqlSelection, Query, QueryGenqlSelection } from './genql';
|
|
2
2
|
import { type ClientOptions } from './genql/runtime';
|
|
3
3
|
/** Represents a value that can be awaited. */
|
|
4
|
-
type Awaitable<T> = Promise<T> | T;
|
|
5
|
-
/** A utility type to make an object type more readable by removing excess properties. */
|
|
6
|
-
type Prettify<T> = T extends object ? {
|
|
7
|
-
[K in keyof T]: Prettify<T[K]>;
|
|
8
|
-
} & {} : T;
|
|
4
|
+
export type Awaitable<T> = Promise<T> | T;
|
|
9
5
|
interface AniQLAuthBase {
|
|
10
6
|
client_id: number;
|
|
11
7
|
}
|
|
@@ -17,26 +13,26 @@ interface AniQLAuthResCode extends AniQLAuthBase {
|
|
|
17
13
|
interface AniQLAuthResToken extends AniQLAuthBase {
|
|
18
14
|
response_type: 'token';
|
|
19
15
|
}
|
|
20
|
-
type AniQLAuth =
|
|
16
|
+
export type AniQLAuth = AniQLAuthResCode | AniQLAuthResToken;
|
|
21
17
|
/** Options for the AniQL client. */
|
|
22
|
-
type AniQLOptions = ClientOptions & {
|
|
18
|
+
export type AniQLOptions = ClientOptions & {
|
|
23
19
|
auth: AniQLAuth;
|
|
24
20
|
get_token?: () => Awaitable<string | undefined>;
|
|
25
21
|
};
|
|
26
22
|
/** Options for the request made by the AniQL client. */
|
|
27
|
-
type
|
|
23
|
+
export type AniQLRequestOptions = {
|
|
28
24
|
token?: string;
|
|
29
25
|
};
|
|
30
|
-
declare class AniQLClient {
|
|
26
|
+
export declare class AniQLClient {
|
|
31
27
|
_opts: AniQLOptions;
|
|
32
28
|
static base_url: string;
|
|
33
29
|
constructor(opts: AniQLOptions);
|
|
34
30
|
query<R extends QueryGenqlSelection>(request: R & {
|
|
35
31
|
__name?: string;
|
|
36
|
-
}, opts?:
|
|
32
|
+
}, opts?: AniQLRequestOptions): Promise<FieldsSelection<Query, R>>;
|
|
37
33
|
mutation<R extends MutationGenqlSelection>(request: R & {
|
|
38
34
|
__name?: string;
|
|
39
|
-
}, opts?:
|
|
35
|
+
}, opts?: AniQLRequestOptions): Promise<FieldsSelection<Mutation, R>>;
|
|
40
36
|
_fetcher(_token?: string): import("./genql/runtime/fetcher").Fetcher;
|
|
41
37
|
get auth_url(): string;
|
|
42
38
|
auth_exchange(code: string): Promise<{
|
|
@@ -47,4 +43,3 @@ declare class AniQLClient {
|
|
|
47
43
|
}>;
|
|
48
44
|
}
|
|
49
45
|
export * from './genql';
|
|
50
|
-
export { AniQLClient, type AniQLOptions, type Awaitable, type Prettify, type RequestOptions };
|