File tree Expand file tree Collapse file tree 2 files changed +4
-17
lines changed Expand file tree Collapse file tree 2 files changed +4
-17
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,13 @@ interface SeamHttpCommonOptions {
1111 endpoint ?: string
1212 axiosOptions ?: AxiosRequestConfig
1313 axiosRetryOptions ?: AxiosRetryConfig
14- enableLegacyMethodBehaivor ?: boolean
1514}
1615
1716type AxiosRetryConfig = Parameters < AxiosRetry > [ 1 ]
1817
1918export type SeamHttpOptionsFromEnv = SeamHttpCommonOptions
2019
21- export interface SeamHttpOptionsWithClient
22- extends Pick < SeamHttpCommonOptions , 'enableLegacyMethodBehaivor' > {
20+ export interface SeamHttpOptionsWithClient {
2321 client : Axios
2422}
2523
@@ -29,12 +27,10 @@ export const isSeamHttpOptionsWithClient = (
2927 if ( ! ( 'client' in options ) ) return false
3028 if ( options . client == null ) return false
3129
32- const keys = Object . keys ( options ) . filter (
33- ( k ) => ! [ 'client' , 'enableLegacyMethodBehaivor' ] . includes ( k ) ,
34- )
30+ const keys = Object . keys ( options )
3531 if ( keys . length > 0 ) {
3632 throw new SeamHttpInvalidOptionsError (
37- `The client option cannot be used with any other option except enableLegacyMethodBehaivor , but received: ${ keys . join (
33+ `The client option cannot be used with any other option, but received: ${ keys . join (
3834 ', ' ,
3935 ) } `,
4036 )
Original file line number Diff line number Diff line change 11import { isSeamHttpOptionsWithClient , type SeamHttpOptions } from './options.js'
22
3- const enableLegacyMethodBehaivorDefault = true
4-
53export const parseOptions = (
64 apiKeyOrOptions : string | SeamHttpOptions ,
75) : Required < SeamHttpOptions > => {
@@ -10,12 +8,7 @@ export const parseOptions = (
108 ? { apiKey : apiKeyOrOptions }
119 : apiKeyOrOptions
1210
13- if ( isSeamHttpOptionsWithClient ( options ) )
14- return {
15- ...options ,
16- enableLegacyMethodBehaivor :
17- options . enableLegacyMethodBehaivor ?? enableLegacyMethodBehaivorDefault ,
18- }
11+ if ( isSeamHttpOptionsWithClient ( options ) ) return options
1912
2013 const endpoint =
2114 options . endpoint ??
@@ -32,7 +25,5 @@ export const parseOptions = (
3225 endpoint,
3326 axiosOptions : options . axiosOptions ?? { } ,
3427 axiosRetryOptions : options . axiosRetryOptions ?? { } ,
35- enableLegacyMethodBehaivor :
36- options . enableLegacyMethodBehaivor ?? enableLegacyMethodBehaivorDefault ,
3728 }
3829}
You can’t perform that action at this time.
0 commit comments