@@ -2,51 +2,51 @@ import type { Config } from "./client/client/index.js";
22import { client } from "./client/client.gen.js" ;
33
44export type EngineClientOptions = {
5- readonly clientId ?: string ;
6- readonly secretKey ?: string ;
5+ readonly clientId ?: string ;
6+ readonly secretKey ?: string ;
77} ;
88
99export function configure (
10- options : EngineClientOptions & { override ?: Config } ,
10+ options : EngineClientOptions & { override ?: Config } ,
1111) {
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+ } ) ;
2020}
2121
2222function 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 ,
2828) {
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 ;
3838}
3939
4040export type MaybeErrorResponse < D , E > = { result : D } | { error : E } ;
4141
4242export function isErrorResponse < D , E > (
43- res : MaybeErrorResponse < D , E > ,
43+ res : MaybeErrorResponse < D , E > ,
4444) : res is { error : E } {
45- return "error" in res ;
45+ return "error" in res ;
4646}
4747
4848export function isSuccessResponse < D , E > (
49- res : MaybeErrorResponse < D , E > ,
49+ res : MaybeErrorResponse < D , E > ,
5050) : res is { result : D } {
51- return "result" in res ;
51+ return "result" in res ;
5252}
0 commit comments