@slango/ristretto 1.0.51 → 1.0.53
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 +9 -6
- package/.turbo/turbo-build.log +0 -1
- package/.turbo/turbo-lint.log +0 -1
- package/.turbo/turbo-test.log +0 -18
- package/CHANGELOG.md +0 -386
- package/eslint.config.js +0 -1
- package/lint-staged.config.js +0 -1
- package/src/abortable/index.ts +0 -50
- package/src/index.ts +0 -35
- package/src/middleware/index.ts +0 -20
- package/src/middleware/runner.spec.ts +0 -174
- package/src/middleware/runner.ts +0 -65
- package/src/utils/HttpError.ts +0 -9
- package/src/utils/abortableRequest.spec.ts +0 -50
- package/src/utils/abortableRequest.ts +0 -22
- package/src/utils/auth.spec.ts +0 -58
- package/src/utils/auth.ts +0 -16
- package/src/utils/baseUrl.ts +0 -17
- package/src/utils/body.spec.ts +0 -123
- package/src/utils/body.ts +0 -74
- package/src/utils/httpMethod.ts +0 -11
- package/src/utils/queryParams.spec.ts +0 -75
- package/src/utils/queryParams.ts +0 -31
- package/src/utils/request.spec.ts +0 -180
- package/src/utils/request.ts +0 -57
- package/src/utils/status.spec.ts +0 -66
- package/src/utils/status.ts +0 -15
- package/src/utils/withBaseUrl.spec.ts +0 -53
- package/src/utils/withBaseUrl.ts +0 -12
- package/tsconfig.build.json +0 -10
- package/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.json +0 -10
- package/vitest.config.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slango/ristretto",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.53",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Opinionated rest client",
|
|
6
6
|
"repository": {
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
"directory": "packages/ristretto"
|
|
10
10
|
},
|
|
11
11
|
"type": "module",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
12
15
|
"main": "./dist/index.js",
|
|
13
16
|
"types": "./dist/index.d.ts",
|
|
14
17
|
"exports": {
|
|
@@ -22,19 +25,19 @@
|
|
|
22
25
|
}
|
|
23
26
|
},
|
|
24
27
|
"dependencies": {
|
|
25
|
-
"@slango/tessera": "1.0.
|
|
28
|
+
"@slango/tessera": "1.0.30"
|
|
26
29
|
},
|
|
27
30
|
"devDependencies": {
|
|
28
31
|
"@types/node": "26.1.1",
|
|
29
32
|
"@vitest/coverage-v8": "4.1.10",
|
|
30
33
|
"@vitest/ui": "4.1.10",
|
|
31
|
-
"eslint": "10.
|
|
34
|
+
"eslint": "10.7.0",
|
|
32
35
|
"type-fest": "5.8.0",
|
|
33
36
|
"typescript": "6.0.3",
|
|
34
37
|
"vitest": "4.1.10",
|
|
35
|
-
"@slango.configs/eslint": "1.2.
|
|
36
|
-
"@slango.configs/typescript": "2.0.
|
|
37
|
-
"@slango.configs/vitest": "2.0.
|
|
38
|
+
"@slango.configs/eslint": "1.2.33",
|
|
39
|
+
"@slango.configs/typescript": "2.0.10",
|
|
40
|
+
"@slango.configs/vitest": "2.0.42"
|
|
38
41
|
},
|
|
39
42
|
"scripts": {
|
|
40
43
|
"build": "tsc -p tsconfig.build.json",
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
$ tsc -p tsconfig.build.json
|
package/.turbo/turbo-lint.log
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
$ eslint . --max-warnings 0
|
package/.turbo/turbo-test.log
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
$ vitest --run
|
|
2
|
-
|
|
3
|
-
[1m[30m[46m RUN [49m[39m[22m [36mv4.1.10 [39m[90m/home/runner/work/slango/slango/packages/ristretto[39m
|
|
4
|
-
|
|
5
|
-
[32m✓[39m src/utils/body.spec.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 33[2mms[22m[39m
|
|
6
|
-
[32m✓[39m src/middleware/runner.spec.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 22[2mms[22m[39m
|
|
7
|
-
[32m✓[39m src/utils/request.spec.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 33[2mms[22m[39m
|
|
8
|
-
[32m✓[39m src/utils/status.spec.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
9
|
-
[32m✓[39m src/utils/queryParams.spec.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 17[2mms[22m[39m
|
|
10
|
-
[32m✓[39m src/utils/withBaseUrl.spec.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 15[2mms[22m[39m
|
|
11
|
-
[32m✓[39m src/utils/auth.spec.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
12
|
-
[32m✓[39m src/utils/abortableRequest.spec.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 15[2mms[22m[39m
|
|
13
|
-
|
|
14
|
-
[2m Test Files [22m [1m[32m8 passed[39m[22m[90m (8)[39m
|
|
15
|
-
[2m Tests [22m [1m[32m35 passed[39m[22m[90m (35)[39m
|
|
16
|
-
[2m Start at [22m 23:37:39
|
|
17
|
-
[2m Duration [22m 6.82s[2m (transform 399ms, setup 0ms, import 736ms, tests 153ms, environment 14.61s)[22m
|
|
18
|
-
|
package/CHANGELOG.md
DELETED
|
@@ -1,386 +0,0 @@
|
|
|
1
|
-
# @slango/ristretto
|
|
2
|
-
|
|
3
|
-
## 1.0.51
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- 83f12c6: Dependencies bump
|
|
8
|
-
- @slango/tessera@1.0.28
|
|
9
|
-
|
|
10
|
-
## 1.0.50
|
|
11
|
-
|
|
12
|
-
### Patch Changes
|
|
13
|
-
|
|
14
|
-
- 463d9ce: Dependencies bump
|
|
15
|
-
- Updated dependencies [463d9ce]
|
|
16
|
-
- @slango/tessera@1.0.28
|
|
17
|
-
|
|
18
|
-
## 1.0.49
|
|
19
|
-
|
|
20
|
-
### Patch Changes
|
|
21
|
-
|
|
22
|
-
- 6d64ea9: Dependencies bump
|
|
23
|
-
|
|
24
|
-
## 1.0.48
|
|
25
|
-
|
|
26
|
-
### Patch Changes
|
|
27
|
-
|
|
28
|
-
- 02b8cd1: Dependencies bump
|
|
29
|
-
- Updated dependencies [02b8cd1]
|
|
30
|
-
- @slango/tessera@1.0.27
|
|
31
|
-
|
|
32
|
-
## 1.0.47
|
|
33
|
-
|
|
34
|
-
### Patch Changes
|
|
35
|
-
|
|
36
|
-
- f59dae8: Dependencies bump
|
|
37
|
-
- @slango/tessera@1.0.26
|
|
38
|
-
|
|
39
|
-
## 1.0.46
|
|
40
|
-
|
|
41
|
-
### Patch Changes
|
|
42
|
-
|
|
43
|
-
- 75b71f7: Dependencies bump
|
|
44
|
-
- Updated dependencies [75b71f7]
|
|
45
|
-
- @slango/tessera@1.0.26
|
|
46
|
-
|
|
47
|
-
## 1.0.45
|
|
48
|
-
|
|
49
|
-
### Patch Changes
|
|
50
|
-
|
|
51
|
-
- 7b9def8: Dependencies bump
|
|
52
|
-
- Updated dependencies [7b9def8]
|
|
53
|
-
- @slango/tessera@1.0.25
|
|
54
|
-
|
|
55
|
-
## 1.0.44
|
|
56
|
-
|
|
57
|
-
### Patch Changes
|
|
58
|
-
|
|
59
|
-
- dfd3015: Dependencies bump
|
|
60
|
-
- @slango/tessera@1.0.24
|
|
61
|
-
|
|
62
|
-
## 1.0.43
|
|
63
|
-
|
|
64
|
-
### Patch Changes
|
|
65
|
-
|
|
66
|
-
- 1052e1d: Dependencies bump
|
|
67
|
-
|
|
68
|
-
## 1.0.42
|
|
69
|
-
|
|
70
|
-
### Patch Changes
|
|
71
|
-
|
|
72
|
-
- 59effbe: Dependencies bump
|
|
73
|
-
- Updated dependencies [59effbe]
|
|
74
|
-
- @slango/tessera@1.0.24
|
|
75
|
-
|
|
76
|
-
## 1.0.41
|
|
77
|
-
|
|
78
|
-
### Patch Changes
|
|
79
|
-
|
|
80
|
-
- 3e79aa6: Dependencies bump
|
|
81
|
-
- Updated dependencies [3e79aa6]
|
|
82
|
-
- @slango/tessera@1.0.23
|
|
83
|
-
|
|
84
|
-
## 1.0.40
|
|
85
|
-
|
|
86
|
-
### Patch Changes
|
|
87
|
-
|
|
88
|
-
- 70230d2: Dependencies bump
|
|
89
|
-
- Updated dependencies [70230d2]
|
|
90
|
-
- @slango/tessera@1.0.22
|
|
91
|
-
|
|
92
|
-
## 1.0.39
|
|
93
|
-
|
|
94
|
-
### Patch Changes
|
|
95
|
-
|
|
96
|
-
- f4e8645: Dependencies bump
|
|
97
|
-
- Updated dependencies [f4e8645]
|
|
98
|
-
- @slango/tessera@1.0.21
|
|
99
|
-
|
|
100
|
-
## 1.0.38
|
|
101
|
-
|
|
102
|
-
### Patch Changes
|
|
103
|
-
|
|
104
|
-
- e80d5ac: Dependencies bump
|
|
105
|
-
- Updated dependencies [e80d5ac]
|
|
106
|
-
- @slango/tessera@1.0.20
|
|
107
|
-
|
|
108
|
-
## 1.0.37
|
|
109
|
-
|
|
110
|
-
### Patch Changes
|
|
111
|
-
|
|
112
|
-
- a692cf9: Dependencies bump
|
|
113
|
-
- Updated dependencies [a692cf9]
|
|
114
|
-
- @slango/tessera@1.0.19
|
|
115
|
-
|
|
116
|
-
## 1.0.36
|
|
117
|
-
|
|
118
|
-
### Patch Changes
|
|
119
|
-
|
|
120
|
-
- dca0a26: Dependencies bump
|
|
121
|
-
- Updated dependencies [dca0a26]
|
|
122
|
-
- @slango/tessera@1.0.18
|
|
123
|
-
|
|
124
|
-
## 1.0.35
|
|
125
|
-
|
|
126
|
-
### Patch Changes
|
|
127
|
-
|
|
128
|
-
- df2e3c2: Dependencies bump
|
|
129
|
-
- Updated dependencies [df2e3c2]
|
|
130
|
-
- @slango/tessera@1.0.17
|
|
131
|
-
|
|
132
|
-
## 1.0.34
|
|
133
|
-
|
|
134
|
-
### Patch Changes
|
|
135
|
-
|
|
136
|
-
- 6ab8613: Dependencies bump
|
|
137
|
-
- Updated dependencies [6ab8613]
|
|
138
|
-
- @slango/tessera@1.0.16
|
|
139
|
-
|
|
140
|
-
## 1.0.33
|
|
141
|
-
|
|
142
|
-
### Patch Changes
|
|
143
|
-
|
|
144
|
-
- 07ec4aa: Dependencies bump
|
|
145
|
-
- Updated dependencies [07ec4aa]
|
|
146
|
-
- @slango/tessera@1.0.15
|
|
147
|
-
|
|
148
|
-
## 1.0.32
|
|
149
|
-
|
|
150
|
-
### Patch Changes
|
|
151
|
-
|
|
152
|
-
- 57f6c46: Dependencies bump
|
|
153
|
-
- Updated dependencies [57f6c46]
|
|
154
|
-
- @slango/tessera@1.0.14
|
|
155
|
-
|
|
156
|
-
## 1.0.31
|
|
157
|
-
|
|
158
|
-
### Patch Changes
|
|
159
|
-
|
|
160
|
-
- 4ba0ccb: Dependencies bump
|
|
161
|
-
- Updated dependencies [4ba0ccb]
|
|
162
|
-
- @slango/tessera@1.0.13
|
|
163
|
-
|
|
164
|
-
## 1.0.30
|
|
165
|
-
|
|
166
|
-
### Patch Changes
|
|
167
|
-
|
|
168
|
-
- 09ac7a7: Dependencies bump
|
|
169
|
-
- Updated dependencies [09ac7a7]
|
|
170
|
-
- @slango/tessera@1.0.12
|
|
171
|
-
|
|
172
|
-
## 1.0.29
|
|
173
|
-
|
|
174
|
-
### Patch Changes
|
|
175
|
-
|
|
176
|
-
- ad32208: Dependencies bump
|
|
177
|
-
- Updated dependencies [ad32208]
|
|
178
|
-
- @slango/tessera@1.0.11
|
|
179
|
-
|
|
180
|
-
## 1.0.28
|
|
181
|
-
|
|
182
|
-
### Patch Changes
|
|
183
|
-
|
|
184
|
-
- 35aaf02: Dependencies bump
|
|
185
|
-
- @slango/tessera@1.0.10
|
|
186
|
-
|
|
187
|
-
## 1.0.27
|
|
188
|
-
|
|
189
|
-
### Patch Changes
|
|
190
|
-
|
|
191
|
-
- fafa8e1: Dependencies bump
|
|
192
|
-
- Updated dependencies [fafa8e1]
|
|
193
|
-
- @slango/tessera@1.0.10
|
|
194
|
-
|
|
195
|
-
## 1.0.26
|
|
196
|
-
|
|
197
|
-
### Patch Changes
|
|
198
|
-
|
|
199
|
-
- ec2131e: Dependencies bump
|
|
200
|
-
- @slango/tessera@1.0.9
|
|
201
|
-
|
|
202
|
-
## 1.0.25
|
|
203
|
-
|
|
204
|
-
### Patch Changes
|
|
205
|
-
|
|
206
|
-
- ebe4053: Dependencies bump
|
|
207
|
-
- @slango/tessera@1.0.9
|
|
208
|
-
|
|
209
|
-
## 1.0.24
|
|
210
|
-
|
|
211
|
-
### Patch Changes
|
|
212
|
-
|
|
213
|
-
- 4010cfc: Dependencies bump
|
|
214
|
-
- @slango/tessera@1.0.9
|
|
215
|
-
|
|
216
|
-
## 1.0.23
|
|
217
|
-
|
|
218
|
-
### Patch Changes
|
|
219
|
-
|
|
220
|
-
- 8ee771f: Dependencies bump
|
|
221
|
-
- @slango/tessera@1.0.9
|
|
222
|
-
|
|
223
|
-
## 1.0.22
|
|
224
|
-
|
|
225
|
-
### Patch Changes
|
|
226
|
-
|
|
227
|
-
- 1731369: Dependencies bump
|
|
228
|
-
- @slango/tessera@1.0.9
|
|
229
|
-
|
|
230
|
-
## 1.0.21
|
|
231
|
-
|
|
232
|
-
### Patch Changes
|
|
233
|
-
|
|
234
|
-
- 3ceebbb: Dependencies bump
|
|
235
|
-
- Updated dependencies [3ceebbb]
|
|
236
|
-
- @slango/tessera@1.0.9
|
|
237
|
-
|
|
238
|
-
## 1.0.20
|
|
239
|
-
|
|
240
|
-
### Patch Changes
|
|
241
|
-
|
|
242
|
-
- 2ab1c4d: Dependencies bump
|
|
243
|
-
- @slango/tessera@1.0.8
|
|
244
|
-
|
|
245
|
-
## 1.0.19
|
|
246
|
-
|
|
247
|
-
### Patch Changes
|
|
248
|
-
|
|
249
|
-
- 9f290cf: Dependencies bump
|
|
250
|
-
- @slango/tessera@1.0.8
|
|
251
|
-
|
|
252
|
-
## 1.0.18
|
|
253
|
-
|
|
254
|
-
### Patch Changes
|
|
255
|
-
|
|
256
|
-
- 4e2e552: Dependencies bump
|
|
257
|
-
- Updated dependencies [4e2e552]
|
|
258
|
-
- @slango/tessera@1.0.8
|
|
259
|
-
|
|
260
|
-
## 1.0.17
|
|
261
|
-
|
|
262
|
-
### Patch Changes
|
|
263
|
-
|
|
264
|
-
- b6cdd05: Dependencies bump
|
|
265
|
-
- Updated dependencies [b6cdd05]
|
|
266
|
-
- @slango/tessera@1.0.7
|
|
267
|
-
|
|
268
|
-
## 1.0.16
|
|
269
|
-
|
|
270
|
-
### Patch Changes
|
|
271
|
-
|
|
272
|
-
- 7ceb0df: Dependencies bump
|
|
273
|
-
- @slango/tessera@1.0.6
|
|
274
|
-
|
|
275
|
-
## 1.0.15
|
|
276
|
-
|
|
277
|
-
### Patch Changes
|
|
278
|
-
|
|
279
|
-
- 86530f1: Dependencies bump
|
|
280
|
-
- Updated dependencies [86530f1]
|
|
281
|
-
- @slango/tessera@1.0.6
|
|
282
|
-
|
|
283
|
-
## 1.0.14
|
|
284
|
-
|
|
285
|
-
### Patch Changes
|
|
286
|
-
|
|
287
|
-
- 8519268: Dependencies bump
|
|
288
|
-
- Updated dependencies [8519268]
|
|
289
|
-
- @slango/tessera@1.0.5
|
|
290
|
-
|
|
291
|
-
## 1.0.13
|
|
292
|
-
|
|
293
|
-
### Patch Changes
|
|
294
|
-
|
|
295
|
-
- 5bcda82: Dependencies bump
|
|
296
|
-
- Updated dependencies [5bcda82]
|
|
297
|
-
- @slango/tessera@1.0.4
|
|
298
|
-
|
|
299
|
-
## 1.0.12
|
|
300
|
-
|
|
301
|
-
### Patch Changes
|
|
302
|
-
|
|
303
|
-
- cc43aa2: Dependencies bump
|
|
304
|
-
- @slango/tessera@1.0.3
|
|
305
|
-
|
|
306
|
-
## 1.0.11
|
|
307
|
-
|
|
308
|
-
### Patch Changes
|
|
309
|
-
|
|
310
|
-
- a661329: Dependencies bump
|
|
311
|
-
|
|
312
|
-
## 1.0.10
|
|
313
|
-
|
|
314
|
-
### Patch Changes
|
|
315
|
-
|
|
316
|
-
- 72ffa91: Dependnecies bump and eslint presets normalization
|
|
317
|
-
- @slango/tessera@1.0.3
|
|
318
|
-
|
|
319
|
-
## 1.0.9
|
|
320
|
-
|
|
321
|
-
### Patch Changes
|
|
322
|
-
|
|
323
|
-
- fb024e5: Dependencies bump
|
|
324
|
-
- Updated dependencies [fb024e5]
|
|
325
|
-
- @slango/tessera@1.0.3
|
|
326
|
-
|
|
327
|
-
## 1.0.8
|
|
328
|
-
|
|
329
|
-
### Patch Changes
|
|
330
|
-
|
|
331
|
-
- 7d6305d: Dependencies bump
|
|
332
|
-
- Updated dependencies [7d6305d]
|
|
333
|
-
- @slango/tessera@1.0.2
|
|
334
|
-
|
|
335
|
-
## 1.0.7
|
|
336
|
-
|
|
337
|
-
### Patch Changes
|
|
338
|
-
|
|
339
|
-
- 60f7e37: Dependencies bump
|
|
340
|
-
- @slango/tessera@1.0.1
|
|
341
|
-
|
|
342
|
-
## 1.0.6
|
|
343
|
-
|
|
344
|
-
### Patch Changes
|
|
345
|
-
|
|
346
|
-
- 87e2b79: Dependencies bump
|
|
347
|
-
- Updated dependencies [87e2b79]
|
|
348
|
-
- @slango/tessera@1.0.1
|
|
349
|
-
|
|
350
|
-
## 1.0.5
|
|
351
|
-
|
|
352
|
-
### Patch Changes
|
|
353
|
-
|
|
354
|
-
- 7912c01: Dependencies bump
|
|
355
|
-
|
|
356
|
-
## 1.0.4
|
|
357
|
-
|
|
358
|
-
### Patch Changes
|
|
359
|
-
|
|
360
|
-
- 0f0e49c: Dependencies bump
|
|
361
|
-
|
|
362
|
-
## 1.0.3
|
|
363
|
-
|
|
364
|
-
### Patch Changes
|
|
365
|
-
|
|
366
|
-
- c73ab09: Dependencies bump
|
|
367
|
-
- @slango/tessera@1.0.0
|
|
368
|
-
|
|
369
|
-
## 1.0.2
|
|
370
|
-
|
|
371
|
-
### Patch Changes
|
|
372
|
-
|
|
373
|
-
- 4016ce6: withBaseUrl helper
|
|
374
|
-
|
|
375
|
-
## 1.0.1
|
|
376
|
-
|
|
377
|
-
### Patch Changes
|
|
378
|
-
|
|
379
|
-
- Updated dependencies [9d73d40]
|
|
380
|
-
- @slango/tessera@1.0.0
|
|
381
|
-
|
|
382
|
-
## 1.0.0
|
|
383
|
-
|
|
384
|
-
### Major Changes
|
|
385
|
-
|
|
386
|
-
- 759bc27: First version (renamed from @slango/rest-client)
|
package/eslint.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@slango.configs/eslint/typescript-isomorphic.js';
|
package/lint-staged.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@slango.configs/lint-staged/typescript.js';
|
package/src/abortable/index.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { AbortablePromise, abortableRequest } from '../utils/abortableRequest.js';
|
|
2
|
-
import { HttpMethod } from '../utils/httpMethod.js';
|
|
3
|
-
import { Request as BaseRequest, RequestOptionsWithoutUrl, RequestURL } from '../utils/request.js';
|
|
4
|
-
|
|
5
|
-
export type { AbortablePromise } from '../utils/abortableRequest.js';
|
|
6
|
-
export { withBearerToken } from '../utils/auth.js';
|
|
7
|
-
export type { BaseURL } from '../utils/baseUrl.js';
|
|
8
|
-
export { withBaseUrl } from '../utils/baseUrl.js';
|
|
9
|
-
|
|
10
|
-
export { withFormDataBody, withJsonBody } from '../utils/body.js';
|
|
11
|
-
export { HttpError } from '../utils/HttpError.js';
|
|
12
|
-
export { withQueryParams } from '../utils/queryParams.js';
|
|
13
|
-
export type { RequestOptionsWithoutUrl, RequestURL } from '../utils/request.js';
|
|
14
|
-
export { withNotFoundAsNull } from '../utils/status.js';
|
|
15
|
-
|
|
16
|
-
export type Request<Response> = BaseRequest<Response, AbortablePromise<Response>>;
|
|
17
|
-
|
|
18
|
-
const abortableRequestFactory =
|
|
19
|
-
(method: HttpMethod) =>
|
|
20
|
-
<Response>(url: RequestURL) =>
|
|
21
|
-
(options?: RequestOptionsWithoutUrl): AbortablePromise<Response> =>
|
|
22
|
-
abortableRequest<Response>(method, { ...options, url });
|
|
23
|
-
|
|
24
|
-
export const get = abortableRequestFactory(HttpMethod.GET);
|
|
25
|
-
|
|
26
|
-
export const del = abortableRequestFactory(HttpMethod.DELETE);
|
|
27
|
-
|
|
28
|
-
export const post = abortableRequestFactory(HttpMethod.POST);
|
|
29
|
-
|
|
30
|
-
export const put = abortableRequestFactory(HttpMethod.PUT);
|
|
31
|
-
|
|
32
|
-
export const patch = abortableRequestFactory(HttpMethod.PATCH);
|
|
33
|
-
|
|
34
|
-
export const withTransformer =
|
|
35
|
-
<Input, Output>(transformFn: (input: Input) => Output) =>
|
|
36
|
-
(req: Request<Input>): Request<Output> =>
|
|
37
|
-
(options?: RequestOptionsWithoutUrl) => {
|
|
38
|
-
const abortablePromise = req(options);
|
|
39
|
-
|
|
40
|
-
const wrappedPromise = abortablePromise.then((result: Input) =>
|
|
41
|
-
transformFn ? transformFn(result) : result,
|
|
42
|
-
) as AbortablePromise<Output>;
|
|
43
|
-
|
|
44
|
-
if ('abort' in abortablePromise) {
|
|
45
|
-
// Assign the abort function if it's an AbortablePromise
|
|
46
|
-
wrappedPromise.abort = abortablePromise.abort;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return wrappedPromise;
|
|
50
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { HttpMethod } from './utils/httpMethod.js';
|
|
2
|
-
import {
|
|
3
|
-
Request as BaseRequest,
|
|
4
|
-
request,
|
|
5
|
-
RequestOptionsWithoutUrl,
|
|
6
|
-
RequestURL,
|
|
7
|
-
} from './utils/request.js';
|
|
8
|
-
|
|
9
|
-
export { withBearerToken } from './utils/auth.js';
|
|
10
|
-
export type { BaseURL } from './utils/baseUrl.js';
|
|
11
|
-
export { withBaseUrl } from './utils/baseUrl.js';
|
|
12
|
-
export { withFormDataBody, withJsonBody } from './utils/body.js';
|
|
13
|
-
export { HttpError } from './utils/HttpError.js';
|
|
14
|
-
export { withQueryParams } from './utils/queryParams.js';
|
|
15
|
-
export type { RequestOptionsWithoutUrl, RequestURL } from './utils/request.js';
|
|
16
|
-
|
|
17
|
-
export { withNotFoundAsNull } from './utils/status.js';
|
|
18
|
-
|
|
19
|
-
export type Request<Response> = BaseRequest<Response, Promise<Response>>;
|
|
20
|
-
|
|
21
|
-
const requestFactory =
|
|
22
|
-
(method: HttpMethod) =>
|
|
23
|
-
<Response>(url: RequestURL): Request<Response> =>
|
|
24
|
-
(options?: RequestOptionsWithoutUrl): Promise<Response> =>
|
|
25
|
-
request<Response>(method, { ...options, url });
|
|
26
|
-
|
|
27
|
-
export const get = requestFactory(HttpMethod.GET);
|
|
28
|
-
|
|
29
|
-
export const del = requestFactory(HttpMethod.DELETE);
|
|
30
|
-
|
|
31
|
-
export const post = requestFactory(HttpMethod.POST);
|
|
32
|
-
|
|
33
|
-
export const put = requestFactory(HttpMethod.PUT);
|
|
34
|
-
|
|
35
|
-
export const patch = requestFactory(HttpMethod.PATCH);
|
package/src/middleware/index.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Promisable } from 'type-fest';
|
|
2
|
-
|
|
3
|
-
import { RequestOptions } from '../utils/request.js';
|
|
4
|
-
|
|
5
|
-
export type PreRequestMiddlewareContext = {
|
|
6
|
-
request: RequestOptions;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export type PostResponseMiddlewareContext = PreRequestMiddlewareContext & {
|
|
10
|
-
response: Response;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type MiddlewareNext = (error?: Error) => Promisable<void>;
|
|
14
|
-
|
|
15
|
-
export type Middleware<Context> = (ctx: Context, next: MiddlewareNext) => Promisable<void>;
|
|
16
|
-
|
|
17
|
-
export {
|
|
18
|
-
addPostResponseMiddleware as usePostResponse,
|
|
19
|
-
addPreRequestMiddleware as usePreRequest,
|
|
20
|
-
} from './runner.js';
|