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 {
11
11
endpoint ?: string
12
12
axiosOptions ?: AxiosRequestConfig
13
13
axiosRetryOptions ?: AxiosRetryConfig
14
- enableLegacyMethodBehaivor ?: boolean
15
14
}
16
15
17
16
type AxiosRetryConfig = Parameters < AxiosRetry > [ 1 ]
18
17
19
18
export type SeamHttpOptionsFromEnv = SeamHttpCommonOptions
20
19
21
- export interface SeamHttpOptionsWithClient
22
- extends Pick < SeamHttpCommonOptions , 'enableLegacyMethodBehaivor' > {
20
+ export interface SeamHttpOptionsWithClient {
23
21
client : Axios
24
22
}
25
23
@@ -29,12 +27,10 @@ export const isSeamHttpOptionsWithClient = (
29
27
if ( ! ( 'client' in options ) ) return false
30
28
if ( options . client == null ) return false
31
29
32
- const keys = Object . keys ( options ) . filter (
33
- ( k ) => ! [ 'client' , 'enableLegacyMethodBehaivor' ] . includes ( k ) ,
34
- )
30
+ const keys = Object . keys ( options )
35
31
if ( keys . length > 0 ) {
36
32
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 (
38
34
', ' ,
39
35
) } `,
40
36
)
Original file line number Diff line number Diff line change 1
1
import { isSeamHttpOptionsWithClient , type SeamHttpOptions } from './options.js'
2
2
3
- const enableLegacyMethodBehaivorDefault = true
4
-
5
3
export const parseOptions = (
6
4
apiKeyOrOptions : string | SeamHttpOptions ,
7
5
) : Required < SeamHttpOptions > => {
@@ -10,12 +8,7 @@ export const parseOptions = (
10
8
? { apiKey : apiKeyOrOptions }
11
9
: apiKeyOrOptions
12
10
13
- if ( isSeamHttpOptionsWithClient ( options ) )
14
- return {
15
- ...options ,
16
- enableLegacyMethodBehaivor :
17
- options . enableLegacyMethodBehaivor ?? enableLegacyMethodBehaivorDefault ,
18
- }
11
+ if ( isSeamHttpOptionsWithClient ( options ) ) return options
19
12
20
13
const endpoint =
21
14
options . endpoint ??
@@ -32,7 +25,5 @@ export const parseOptions = (
32
25
endpoint,
33
26
axiosOptions : options . axiosOptions ?? { } ,
34
27
axiosRetryOptions : options . axiosRetryOptions ?? { } ,
35
- enableLegacyMethodBehaivor :
36
- options . enableLegacyMethodBehaivor ?? enableLegacyMethodBehaivorDefault ,
37
28
}
38
29
}
You can’t perform that action at this time.
0 commit comments