@colisweb/rescript-toolkit 2.11.0 → 2.11.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colisweb/rescript-toolkit",
3
- "version": "2.11.0",
3
+ "version": "2.11.1",
4
4
  "scripts": {
5
5
  "clean": "rescript clean",
6
6
  "build": "rescript build",
@@ -3,7 +3,7 @@ module type Config = {
3
3
  type response
4
4
  type error
5
5
  let exec: argument => Promise.promise<
6
- result<response, Axios2.WithResult.customError<error, Js.Json.t, 'header, 'req>>,
6
+ result<response, Axios2.WithResult.customError<error, Js.Json.t>>,
7
7
  >
8
8
  }
9
9
 
@@ -23,24 +23,24 @@ type auth = {
23
23
  }
24
24
  type proxy = {host: int, port: int, auth: auth}
25
25
 
26
- type response<'data, 'header> = {
26
+ type response<'data> = {
27
27
  data: 'data,
28
28
  status: int,
29
29
  statusText: string,
30
- headers: Js.t<'header>,
30
+ headers: Js.Dict.t<string>,
31
31
  config: config,
32
32
  }
33
33
 
34
- type error<'responseData, 'responseHeader, 'request> = {
35
- request: option<'request>,
36
- response: option<response<'responseData, 'responseHeader>>,
34
+ type error<'responseData> = {
35
+ request: option<Js.Json.t>,
36
+ response: option<response<'responseData>>,
37
37
  message: string,
38
38
  }
39
39
 
40
- type adapter<'a, 'b, 'err> = config => Promise.Js.t<response<'a, 'b>, 'err>
40
+ type adapter<'a, 'b, 'err> = config => Promise.Js.t<response<'a>, 'err>
41
41
 
42
42
  @module("axios")
43
- external isAxiosError: error<'a, 'b, 'c> => bool = "isAxiosError"
43
+ external isAxiosError: error<'a> => bool = "isAxiosError"
44
44
 
45
45
  @obj
46
46
  external makeConfig: (
@@ -72,24 +72,15 @@ external makeConfig: (
72
72
  ) => config = ""
73
73
 
74
74
  @module("axios")
75
- external get: (string, ~config: config=?, unit) => Promise.Js.t<response<'data, 'headers>, 'err> =
76
- "get"
75
+ external get: (string, ~config: config=?, unit) => Promise.Js.t<response<'data>, 'err> = "get"
77
76
 
78
77
  @module("axios")
79
- external post: (
80
- string,
81
- ~data: 'a,
82
- ~config: config=?,
83
- unit,
84
- ) => Promise.Js.t<response<'data, 'headers>, 'err> = "post"
78
+ external post: (string, ~data: 'a, ~config: config=?, unit) => Promise.Js.t<response<'data>, 'err> =
79
+ "post"
85
80
 
86
81
  @module("axios")
87
- external put: (
88
- string,
89
- ~data: 'a,
90
- ~config: config=?,
91
- unit,
92
- ) => Promise.Js.t<response<'data, 'headers>, 'err> = "put"
82
+ external put: (string, ~data: 'a, ~config: config=?, unit) => Promise.Js.t<response<'data>, 'err> =
83
+ "put"
93
84
 
94
85
  @module("axios")
95
86
  external patch: (
@@ -97,21 +88,14 @@ external patch: (
97
88
  ~data: 'a,
98
89
  ~config: config=?,
99
90
  unit,
100
- ) => Promise.Js.t<response<'data, 'headers>, 'err> = "patch"
91
+ ) => Promise.Js.t<response<'data>, 'err> = "patch"
101
92
 
102
93
  @module("axios")
103
- external delete: (
104
- string,
105
- ~config: config=?,
106
- unit,
107
- ) => Promise.Js.t<response<'data, 'headers>, 'err> = "delete"
94
+ external delete: (string, ~config: config=?, unit) => Promise.Js.t<response<'data>, 'err> = "delete"
108
95
 
109
96
  @module("axios")
110
- external options: (
111
- string,
112
- ~config: config=?,
113
- unit,
114
- ) => Promise.Js.t<response<'data, 'headers>, 'err> = "options"
97
+ external options: (string, ~config: config=?, unit) => Promise.Js.t<response<'data>, 'err> =
98
+ "options"
115
99
 
116
100
  module Interceptors = {
117
101
  @module("axios") @scope(("default", "interceptors", "request"))
@@ -123,19 +107,15 @@ module Interceptors = {
123
107
  }
124
108
 
125
109
  module WithResult = {
126
- type customError<'apiError, 'response, 'headers, 'request> = [
127
- | #default(error<'response, 'headers, 'request>)
110
+ type customError<'apiError, 'response> = [
111
+ | #default(error<'response>)
128
112
  | #decodeError(Decco.decodeError)
129
113
  | #custom('apiError)
130
114
  ]
131
115
 
132
116
  type decodeData<'newData, 'err> = Js.Json.t => result<'newData, 'err>
133
117
 
134
- type mapError<'a, 'response, 'headers, 'request> = error<
135
- 'response,
136
- 'headers,
137
- 'request,
138
- > => customError<'a, 'response, 'headers, 'request>
118
+ type mapError<'a, 'response, 'headers, 'request> = error<'response> => customError<'a, 'response>
139
119
 
140
120
  let toResult = (promise, ~mapError, ~decodeData) =>
141
121
  promise
@@ -151,53 +131,47 @@ module WithResult = {
151
131
  })
152
132
 
153
133
  let get = (
154
- string,
155
134
  ~config=?,
156
135
  ~decodeData: decodeData<'newData, 'err>,
157
136
  ~mapError: option<mapError<'a, 'response, 'headers, 'request>>=?,
158
- unit,
159
- ) => get(string, ~config?, unit)->toResult(~decodeData, ~mapError)
137
+ string,
138
+ ) => get(string, ~config?, ())->toResult(~decodeData, ~mapError)
160
139
 
161
140
  let post = (
162
- string,
163
141
  ~data,
164
142
  ~config=?,
165
143
  ~decodeData: decodeData<'newData, 'err>,
166
144
  ~mapError: option<mapError<'a, 'response, 'headers, 'request>>=?,
167
- unit,
168
- ) => post(string, ~data, ~config?, unit)->toResult(~decodeData, ~mapError)
145
+ string,
146
+ ) => post(string, ~data, ~config?, ())->toResult(~decodeData, ~mapError)
169
147
 
170
148
  let put = (
171
- string,
172
149
  ~data,
173
150
  ~config=?,
174
151
  ~decodeData: decodeData<'newData, 'err>,
175
152
  ~mapError: option<mapError<'a, 'response, 'headers, 'request>>=?,
176
- unit,
177
- ) => put(string, ~data, ~config?, unit)->toResult(~decodeData, ~mapError)
153
+ string,
154
+ ) => put(string, ~data, ~config?, ())->toResult(~decodeData, ~mapError)
178
155
 
179
156
  let patch = (
180
- string,
181
157
  ~data,
182
158
  ~config=?,
183
159
  ~decodeData: decodeData<'newData, 'err>,
184
160
  ~mapError: option<mapError<'a, 'response, 'headers, 'request>>=?,
185
- unit,
186
- ) => patch(string, ~data, ~config?, unit)->toResult(~decodeData, ~mapError)
161
+ string,
162
+ ) => patch(string, ~data, ~config?, ())->toResult(~decodeData, ~mapError)
187
163
 
188
164
  let delete = (
189
- string,
190
165
  ~config=?,
191
166
  ~decodeData: decodeData<'newData, 'err>,
192
167
  ~mapError: option<mapError<'a, 'response, 'headers, 'request>>=?,
193
- unit,
194
- ) => delete(string, ~config?, unit)->toResult(~decodeData, ~mapError)
168
+ string,
169
+ ) => delete(string, ~config?, ())->toResult(~decodeData, ~mapError)
195
170
 
196
171
  let options = (
197
- string,
198
172
  ~config=?,
199
173
  ~decodeData: decodeData<'newData, 'err>,
200
174
  ~mapError: option<mapError<'a, 'response, 'headers, 'request>>=?,
201
- unit,
202
- ) => options(string, ~config?, unit)->toResult(~decodeData, ~mapError)
175
+ string,
176
+ ) => options(string, ~config?, ())->toResult(~decodeData, ~mapError)
203
177
  }