@@ -2,51 +2,51 @@ import type { Config } from "./client/client/index.js";
2
2
import { client } from "./client/client.gen.js" ;
3
3
4
4
export type EngineClientOptions = {
5
- readonly clientId ?: string ;
6
- readonly secretKey ?: string ;
5
+ readonly clientId ?: string ;
6
+ readonly secretKey ?: string ;
7
7
} ;
8
8
9
9
export function configure (
10
- options : EngineClientOptions & { override ?: Config } ,
10
+ options : EngineClientOptions & { override ?: Config } ,
11
11
) {
12
- client . setConfig ( {
13
- bodySerializer : stringify ,
14
- headers : {
15
- ...( options . clientId && { "x-client-id" : options . clientId } ) ,
16
- ...( options . secretKey && { "x-secret-key" : options . secretKey } ) ,
17
- } ,
18
- ...( options . override ?? { } ) ,
19
- } ) ;
12
+ client . setConfig ( {
13
+ bodySerializer : stringify ,
14
+ headers : {
15
+ ...( options . clientId && { "x-client-id" : options . clientId } ) ,
16
+ ...( options . secretKey && { "x-secret-key" : options . secretKey } ) ,
17
+ } ,
18
+ ...( options . override ?? { } ) ,
19
+ } ) ;
20
20
}
21
21
22
22
function stringify (
23
- // biome-ignore lint/suspicious/noExplicitAny: JSON.stringify signature
24
- value : any ,
25
- // biome-ignore lint/suspicious/noExplicitAny: JSON.stringify signature
26
- replacer ?: ( ( this : any , key : string , value : any ) => any ) | null ,
27
- space ?: string | number ,
23
+ // biome-ignore lint/suspicious/noExplicitAny: JSON.stringify signature
24
+ value : any ,
25
+ // biome-ignore lint/suspicious/noExplicitAny: JSON.stringify signature
26
+ replacer ?: ( ( this : any , key : string , value : any ) => any ) | null ,
27
+ space ?: string | number ,
28
28
) {
29
- const res = JSON . stringify (
30
- value ,
31
- ( key , value_ ) => {
32
- const value__ = typeof value_ === "bigint" ? value_ . toString ( ) : value_ ;
33
- return typeof replacer === "function" ? replacer ( key , value__ ) : value__ ;
34
- } ,
35
- space ,
36
- ) ;
37
- return res ;
29
+ const res = JSON . stringify (
30
+ value ,
31
+ ( key , value_ ) => {
32
+ const value__ = typeof value_ === "bigint" ? value_ . toString ( ) : value_ ;
33
+ return typeof replacer === "function" ? replacer ( key , value__ ) : value__ ;
34
+ } ,
35
+ space ,
36
+ ) ;
37
+ return res ;
38
38
}
39
39
40
40
export type MaybeErrorResponse < D , E > = { result : D } | { error : E } ;
41
41
42
42
export function isErrorResponse < D , E > (
43
- res : MaybeErrorResponse < D , E > ,
43
+ res : MaybeErrorResponse < D , E > ,
44
44
) : res is { error : E } {
45
- return "error" in res ;
45
+ return "error" in res ;
46
46
}
47
47
48
48
export function isSuccessResponse < D , E > (
49
- res : MaybeErrorResponse < D , E > ,
49
+ res : MaybeErrorResponse < D , E > ,
50
50
) : res is { result : D } {
51
- return "result" in res ;
51
+ return "result" in res ;
52
52
}
0 commit comments